index.vue 6.8 KB

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