index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <view class="content">
  3. <statusBar :item="navBarData"></statusBar>
  4. <!-- 消息提示 -->
  5. <msgPop></msgPop>
  6. <view class="top">
  7. <image src="https://teacherapi.cocorobo.cn/teaching-file/static/yym/Rectangle25.png" mode="aspectFill"
  8. @click="gotoHome">
  9. </image>
  10. </view>
  11. <view class="sortBlock">
  12. <view class="sortCostcon" @click="gotoCost">
  13. <view class="sortCostcontent">
  14. <view class="costTit">
  15. 收费专区
  16. </view>
  17. <view class="costbri">
  18. <text class="di">暂未开放</text>
  19. </view>
  20. </view>
  21. <view class="costimgblc">
  22. <image src="../../static/Framezzz.png" class="costImg" mode="aspectFill"></image>
  23. </view>
  24. </view>
  25. <view class="sortleft">
  26. <view :class="item.cla" v-for="(item,index) in sortList" @click="gotoTab" :data-index="item">
  27. <!-- <image class="sortImg" src="../../static/Rectangle 937.png" mode="aspectFill"></image> -->
  28. <view class="sortcontent">
  29. <view class="contentl">
  30. <view class="tit">
  31. {{item.tit}}
  32. </view>
  33. <view class="bri">
  34. <text :class="item.briCla">{{item.bri}}</text>
  35. </view>
  36. </view>
  37. <view class="sortleftImgBlock">
  38. <image class="sortleftImg" :src="item.img" mode="aspectFill"></image>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <viewX-Case>
  45. <template #title>
  46. <view class="title three-font">推荐内容</view>
  47. </template>
  48. <template #lookMore>
  49. <view class="lookMore fz-font" @click="listBlock1More">查看更多</view>
  50. </template>
  51. <template #teaching>
  52. <!-- 推荐课程组件 -->
  53. <listBlock1 ref="listBlock1" :classList="classList"></listBlock1>
  54. </template>
  55. </viewX-Case>
  56. <view class="" style="height: 30rpx; width: 100%"> </view>
  57. </view>
  58. </template>
  59. <script>
  60. export default {
  61. data() {
  62. return {
  63. title: "Hello",
  64. navBarData: {
  65. title: "首页", //导航栏标题
  66. btn: 0, //是否显示返回按钮 0不显示 1 显示
  67. },
  68. // 推荐课程
  69. classList: [],
  70. sortList: [{
  71. tit: '活动专区',
  72. bri: '精彩纷呈',
  73. img: '../../static/Framehhh.png',
  74. cla: 'sortcon',
  75. briCla: 'di'
  76. },
  77. {
  78. tit: '课程专区',
  79. bri: '海量资源',
  80. img: '../../static/Framesss.png',
  81. cla: 'sortcon sortcon2',
  82. briCla: 'di2'
  83. }
  84. ]
  85. };
  86. },
  87. methods: {
  88. gotoTab(e) {
  89. console.log(e.currentTarget.dataset.index.tit);
  90. let aaa = e.currentTarget.dataset.index.tit
  91. if (aaa == '活动专区') {
  92. return uni.switchTab({
  93. url: '/pages/activityPageNew/activityPageNew'
  94. })
  95. } else {
  96. uni.switchTab({
  97. url: '/pages/resource/resource'
  98. })
  99. }
  100. },
  101. gotoCost() {
  102. uni.showToast({
  103. title: '功能暂未开放,敬请期待',
  104. icon: 'none'
  105. })
  106. },
  107. // 获取教研室活动list 数据
  108. getlistBlock1Data() {
  109. let data = {
  110. openid: uni.getStorageSync('oId'),
  111. ty: 3,
  112. page: 1, //下拉获取更多的备用字段
  113. lim: 12 //一次获取多少数据
  114. }
  115. this.$request('/selectActivity', "POST", data).then(res => {
  116. console.log('推荐活动', res[0]);
  117. this.classList = res[0]
  118. // console.log('推荐课程',this.classList);
  119. })
  120. },
  121. // 跳转到推荐课程查看更多
  122. listBlock1More() {
  123. const value = this.$store.state.user.openid;
  124. if (value == '') return this.goLog()
  125. uni.navigateTo({
  126. url: "/pages/teachingList/teachingList",
  127. });
  128. },
  129. // 顶部大图跳转外部链接
  130. gotoHome() {
  131. // const web = this.classList[this.current];
  132. const url = "https://mp.weixin.qq.com/s/QZEGcvBn3aW7aHirMFLBQA";
  133. uni.navigateTo({
  134. url: "/pages/skipone/skipone?url=" + encodeURIComponent(url),
  135. });
  136. },
  137. goLog() {
  138. uni.navigateTo({
  139. url: "/pages/login_Wechat/login_Wechat",
  140. });
  141. },
  142. },
  143. onLoad() {
  144. // this.animation = uni.createAnimation()
  145. },
  146. onShow() {
  147. // 清空推荐课程
  148. this.classList = []
  149. // 获取数据
  150. this.getlistBlock1Data()
  151. this.getAllMessage() // 调用app.js中的方法
  152. // 因为组件没有onshow
  153. // 获取收藏事件
  154. this.$refs.listBlock1.getdata()
  155. }
  156. };
  157. </script>
  158. <style lang="scss" scoped>
  159. .content {
  160. // 分类区样式
  161. .sortBlock {
  162. width: 750rpx;
  163. margin: 20rpx 0;
  164. background-color: rgba(255, 255, 255, 1);
  165. display: flex;
  166. justify-content: space-between;
  167. padding: 30rpx;
  168. position: relative;
  169. // 收费区
  170. .sortCostcon {
  171. padding: 30rpx;
  172. width: 336rpx;
  173. height: 300rpx;
  174. flex-shrink: 0;
  175. background-image: url('../../static/Rectangle1922.png');
  176. background-repeat: no-repeat;
  177. background-size: 100%;
  178. .sortCostcontent {
  179. display: flex;
  180. flex-direction: column;
  181. .costTit {
  182. font-weight: 400rpx;
  183. font-size: 36rpx;
  184. height: 48rpx;
  185. line-height: 48rpx;
  186. }
  187. .costbri {
  188. color: rgba(244, 142, 143, 1);
  189. font-size: 24rpx;
  190. width: 400;
  191. margin: 10rpx 0;
  192. }
  193. }
  194. .costimgblc {
  195. display: flex;
  196. justify-content: flex-end;
  197. .costImg {
  198. width: 162rpx;
  199. height: 162rpx;
  200. }
  201. }
  202. }
  203. .sortleft {
  204. flex: 1;
  205. display: flex;
  206. flex-direction: column;
  207. justify-content: space-between;
  208. margin-left: 20rpx;
  209. .sortcon2 {
  210. background-image: url('https://teacherapi.cocorobo.cn/teaching-file/static/Rectangle938.png') !important;
  211. }
  212. .sortcon {
  213. width: 336rpx;
  214. height: 140rpx;
  215. background-image: url('https://teacherapi.cocorobo.cn/teaching-file/static/Rectangle937.png');
  216. background-repeat: no-repeat;
  217. background-size: 100%;
  218. display: flex;
  219. padding: 20rpx;
  220. .sortImg {
  221. position: absolute;
  222. left: 0;
  223. top: 0;
  224. width: 100%;
  225. height: 100%;
  226. }
  227. .sortcontent {
  228. display: flex;
  229. width: 100%;
  230. height: 100%;
  231. color: #000;
  232. .contentl {
  233. width: 70%;
  234. .tit {
  235. font-size: 36rpx;
  236. line-height: 48rpx;
  237. }
  238. .bri {
  239. font-size: 24rpx;
  240. height: 48rpx;
  241. width: 144rpx;
  242. line-height: 32rpx;
  243. position: relative;
  244. .di {
  245. position: absolute;
  246. bottom: 0;
  247. left: 0;
  248. color: rgba(243, 189, 91, 1);
  249. }
  250. .di2 {
  251. position: absolute;
  252. bottom: 0;
  253. left: 0;
  254. color: rgba(180, 193, 250, 1);
  255. }
  256. }
  257. }
  258. .sortleftImgBlock {
  259. position: relative;
  260. .sortleftImg {
  261. position: absolute;
  262. bottom: -10rpx;
  263. left: 0;
  264. height: 68rpx;
  265. width: 68rpx;
  266. }
  267. }
  268. }
  269. }
  270. }
  271. }
  272. // 顶部大图
  273. .top {
  274. width: 750rpx;
  275. height: 288rpx;
  276. display: flex;
  277. margin-bottom: 20rpx;
  278. align-items: center;
  279. background-color: #fff;
  280. justify-content: center;
  281. image {
  282. height: 246rpx;
  283. width: 690rpx;
  284. border-radius: 10rpx;
  285. }
  286. }
  287. .title {
  288. font-weight: bold;
  289. }
  290. .lookMore {
  291. color: #666666;
  292. // font-size: 14px;
  293. }
  294. }
  295. </style>