index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. <template>
  2. <view class="content">
  3. <statusBar :item="navBarData"></statusBar>
  4. <view class="top">
  5. <!-- <image src="https://teacherapi.cocorobo.cn/teaching-file/static//logo.png" mode="aspectFill"></image> -->
  6. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//yym/Rectangle25.png" mode="aspectFill"
  7. @click="gotoHome">
  8. </image>
  9. </view>
  10. <viewX-Case class="mid">
  11. <template #title>
  12. <view class="title three-font">专题教研活动</view>
  13. </template>
  14. <template #lookMore>
  15. <view class="lookMore fz-font" @click="gotoActivity">查看更多</view>
  16. </template>
  17. <template #activeBlock>
  18. <view class="activeData" @click="gotoActivityDetail" v-for="(item, index) in activeList" :key="index"
  19. :data-index="index">
  20. <image :src="item.pic" mode="aspectFill"></image>
  21. <view class="activeTit sBtn-font" style="font-weight: bold">
  22. {{ item.acName }}
  23. </view>
  24. <view class="numData">
  25. <view class="proNum bqZ-font">{{ item.pers }} 人报名</view>
  26. <view class="price num-font">
  27. <text class="fz-font">¥</text>{{ item.cost }}
  28. </view>
  29. </view>
  30. <button class="btn sBtn-font" @click.stop="gotoHd(index)">
  31. 立即报名
  32. </button>
  33. </view>
  34. </template>
  35. </viewX-Case>
  36. <viewX-Case>
  37. <template #title>
  38. <view class="title three-font">推荐课程</view>
  39. </template>
  40. <template #lookMore>
  41. <view class="lookMore fz-font" @click="listBlock1More">查看更多</view>
  42. </template>
  43. <template #teaching>
  44. <!-- <teaching-case :classList="classList"></teaching-case> -->
  45. <!-- 推荐课程组件 -->
  46. <listBlock1 ref="listBlock1" :classList="classList"></listBlock1>
  47. <!-- {{classList}} -->
  48. <!-- {{activeList}} -->
  49. </template>
  50. </viewX-Case>
  51. <view class="" style="height: 30rpx; width: 100%"> </view>
  52. </view>
  53. </template>
  54. <script>
  55. export default {
  56. data() {
  57. return {
  58. title: "Hello",
  59. navBarData: {
  60. title: "首页", //导航栏标题
  61. btn: 0, //是否显示返回按钮 0不显示 1 显示
  62. },
  63. activeList: [],
  64. classList: []
  65. };
  66. },
  67. onLoad() {},
  68. methods: {
  69. getData() {
  70. let data = {
  71. openid: uni.getStorageSync('oId'),
  72. ty: 2,
  73. page: 1, //下拉获取更多的备用字段
  74. lim: 6 //一次获取多少数据
  75. }
  76. this.$request('/selectActivity', "POST", data).then(res => {
  77. // console.log(res[0]);
  78. // this.activeList=[...this.activeList,...res[0]]
  79. this.activeList = res[0]
  80. })
  81. },
  82. // 获取推荐课程list 数据
  83. getlistBlock1Data() {
  84. let data = {
  85. openid: uni.getStorageSync('oId'),
  86. ty: 3,
  87. page: 1, //下拉获取更多的备用字段
  88. lim: 6 //一次获取多少数据
  89. }
  90. this.$request('/selectActivity', "POST", data).then(res => {
  91. console.log(res[0]);
  92. // this.activeList=[...this.activeList,...res[0]]
  93. this.classList =res[0]
  94. console.log('推荐课程',this.classList);
  95. })
  96. },
  97. // 跳转到推荐课程查看更多
  98. listBlock1More() {
  99. const value = this.$store.state.user.openid;
  100. if (value == '') {
  101. uni.navigateTo({
  102. url: "/pages/login_Wechat/login_Wechat",
  103. });
  104. } else {
  105. uni.navigateTo({
  106. url: "/pages/teachingList/teachingList",
  107. });
  108. }
  109. },
  110. gotoTeDetail() {
  111. const value = this.$store.state.user.openid;
  112. if (value == '') {
  113. uni.navigateTo({
  114. url: "/pages/login_Wechat/login_Wechat",
  115. });
  116. } else {
  117. uni.navigateTo({
  118. url: "/pages/teachingDetail/teachingDetail",
  119. });
  120. }
  121. },
  122. // 跳转到专题教研活动查看更多
  123. gotoActivity() {
  124. const value = this.$store.state.user.openid;
  125. if (value == '') {
  126. uni.navigateTo({
  127. url: "/pages/login_Wechat/login_Wechat",
  128. });
  129. } else {
  130. uni.navigateTo({
  131. url: "/pages/activityList_2/activityList_2",
  132. });
  133. }
  134. },
  135. gotoActivityDetail(e) {
  136. let edata = e.currentTarget.dataset['index'];
  137. console.log(e.currentTarget.dataset['index'], 123);
  138. const clickedAcId = this.activeList[edata].acId;
  139. console.log(clickedAcId);
  140. const value = this.$store.state.user.openid;
  141. if (value == '') {
  142. uni.navigateTo({
  143. url: "/pages/login_Wechat/login_Wechat",
  144. });
  145. } else {
  146. uni.navigateTo({
  147. url: "/pages/teachingDetail/teachingDetail?acId=" + clickedAcId,
  148. });
  149. // const urls = [
  150. // "https://szptxnjys.yuketang.cn/pro/portal/announcementdetail/1181",
  151. // "https://szptxnjys.yuketang.cn/pro/portal/announcementdetail/1183",
  152. // "https://szptxnjys.yuketang.cn/pro/portal/announcementdetail/1210",
  153. // "https://szptxnjys.yuketang.cn/pro/portal/announcementdetail/1234",
  154. // ];
  155. // if (index >= 0 && index < urls.length) {
  156. // const url = urls[index];
  157. // uni.navigateTo({
  158. // url: "/pages/skipone/skipone?url=" + encodeURIComponent(url),
  159. // });
  160. // }
  161. }
  162. },
  163. gotoHd(index) {
  164. // console.log(this.$store.state.user.openid,33333333333333333);
  165. const value = this.$store.state.user.openid;
  166. if (value == '') {
  167. console.log(11);
  168. uni.navigateTo({
  169. url: "/pages/login_Wechat/login_Wechat",
  170. });
  171. } else {
  172. const urls = [
  173. "https://szptxnjys.yuketang.cn/pro/portal/announcementdetail/1181",
  174. "https://szptxnjys.yuketang.cn/pro/portal/announcementdetail/1183",
  175. "https://szptxnjys.yuketang.cn/pro/portal/announcementdetail/1210",
  176. "https://szptxnjys.yuketang.cn/pro/portal/announcementdetail/1234",
  177. ];
  178. if (index >= 0 && index < urls.length) {
  179. const url = urls[index];
  180. uni.navigateTo({
  181. url: "/pages/skipone/skipone?url=" + encodeURIComponent(url),
  182. });
  183. }
  184. }
  185. },
  186. gotoHome() {
  187. // const web = this.classList[this.current];
  188. const url = "https://mp.weixin.qq.com/s/QZEGcvBn3aW7aHirMFLBQA";
  189. uni.navigateTo({
  190. url: "/pages/skipone/skipone?url=" + encodeURIComponent(url),
  191. });
  192. },
  193. },
  194. onShow() {
  195. this.getData()
  196. this.getlistBlock1Data()
  197. this.$refs.listBlock1.getdata()
  198. }
  199. };
  200. </script>
  201. <style lang="scss" scoped>
  202. .content {
  203. // .listBlock1PIC {
  204. // width: 160rpx;
  205. // height: 160rpx;
  206. // border-radius: 10rpx;
  207. // }
  208. .list1btn {
  209. z-index: 5;
  210. border: none;
  211. padding: 0;
  212. text-align: center;
  213. // padding: 8px, 24px, 8px, 24px;
  214. background-color: rgba(48, 129, 232, 1);
  215. color: #fff;
  216. border-radius: 100rpx;
  217. float: right;
  218. width: 144rpx;
  219. height: 48rpx;
  220. line-height: 48rpx;
  221. letter-spacing: 1px;
  222. }
  223. // background-color: ;
  224. // background-color: #f0f2f5;
  225. .top {
  226. width: 750rpx;
  227. height: 288rpx;
  228. display: flex;
  229. margin-bottom: 20rpx;
  230. align-items: center;
  231. background-color: #fff;
  232. justify-content: center;
  233. image {
  234. height: 246rpx;
  235. width: 690rpx;
  236. border-radius: 12rpx;
  237. }
  238. }
  239. .mid {
  240. margin: 10px 0;
  241. height: 498rpx;
  242. .activeData {
  243. width: 290rpx;
  244. display: inline-block;
  245. padding-right: 20rpx;
  246. image {
  247. width: 100%;
  248. height: 80px;
  249. border-radius: 10px;
  250. margin-bottom: 10rpx;
  251. }
  252. .activeTit {
  253. // font-weight: 600;
  254. height: 64rpx;
  255. white-space: normal;
  256. /*隐藏溢出*/
  257. /*当文本溢出包含元素时显示省略符号来代表被修剪的文本*/
  258. /*规定段落中的文本不进行换行*/
  259. letter-spacing: 2rpx;
  260. display: -webkit-box;
  261. word-break: break-all;
  262. text-overflow: ellipsis;
  263. overflow: hidden;
  264. -webkit-box-orient: vertical;
  265. -webkit-line-clamp: 2;
  266. /*设置 需要显示的行数*/
  267. }
  268. .numData {
  269. display: flex;
  270. justify-content: space-between;
  271. align-items: baseline;
  272. // padding: 10rpx 0;
  273. .proNum {
  274. color: #999999;
  275. // font-size: 14px;
  276. }
  277. .price {
  278. color: #f68717;
  279. // font-size: 18px;
  280. }
  281. }
  282. .btn {
  283. border: none;
  284. padding: 0;
  285. float: left;
  286. text-align: center;
  287. // padding: 8px 24px 8px 24px;
  288. background-color: #3081e8;
  289. color: #fff;
  290. border-radius: 100rpx;
  291. width: 144rpx;
  292. height: 48rpx;
  293. line-height: 48rpx;
  294. letter-spacing: 1px;
  295. margin-bottom: 30rpx;
  296. }
  297. }
  298. .activeData:nth-child(1) {
  299. margin-left: 15px;
  300. }
  301. }
  302. .title {
  303. font-weight: bold;
  304. }
  305. .lookMore {
  306. color: #666666;
  307. // font-size: 14px;
  308. }
  309. }
  310. </style>