index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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. activeList: [],
  67. classList: [],
  68. sortList: [{
  69. tit: '活动专区',
  70. bri: '简短简介',
  71. img: '../../static/Framehhh.png',
  72. cla: 'sortcon',
  73. briCla:'di'
  74. },
  75. {
  76. tit: '课程专区',
  77. bri: '简短简介',
  78. img: '../../static/Framesss.png',
  79. cla: 'sortcon sortcon2',
  80. briCla:'di2'
  81. }
  82. ]
  83. };
  84. },
  85. onLoad() {},
  86. methods: {
  87. gotoTab(e){
  88. console.log(e.currentTarget.dataset.index.tit);
  89. let aaa=e.currentTarget.dataset.index.tit
  90. if(aaa=='活动专区'){
  91. return uni.switchTab({
  92. url:'/pages/activityPageNew/activityPageNew'
  93. })
  94. }else{
  95. uni.switchTab({
  96. url:'/pages/resource/resource'
  97. })
  98. }
  99. },
  100. gotoCost(){
  101. uni.showToast({
  102. title:'功能暂未开放,敬请期待',
  103. icon:'none'
  104. })
  105. },
  106. // 获取精选活动
  107. // getData() {
  108. // let data = {
  109. // openid: uni.getStorageSync('oId'),
  110. // ty: 2,
  111. // page: 1, //下拉获取更多的备用字段
  112. // lim: 12 //一次获取多少数据
  113. // }
  114. // this.$request('/selectActivity', "POST", data).then(res => {
  115. // console.log('精选活动', res[0]);
  116. // // this.activeList=[...this.activeList,...res[0]]
  117. // this.activeList = res[0]
  118. // })
  119. // },
  120. // 获取教研室活动list 数据
  121. getlistBlock1Data() {
  122. let data = {
  123. openid: uni.getStorageSync('oId'),
  124. ty: 3,
  125. page: 1, //下拉获取更多的备用字段
  126. lim: 12 //一次获取多少数据
  127. }
  128. this.$request('/selectActivity', "POST", data).then(res => {
  129. console.log('推荐活动', res[0]);
  130. this.classList = res[0]
  131. // console.log('推荐课程',this.classList);
  132. })
  133. },
  134. // 跳转到推荐课程查看更多
  135. listBlock1More() {
  136. const value = this.$store.state.user.openid;
  137. if (value == '') return this.goLog()
  138. uni.navigateTo({
  139. url: "/pages/teachingList/teachingList",
  140. });
  141. },
  142. // gotoTeDetail() {
  143. // const value = this.$store.state.user.openid;
  144. // if (value == '') return this.goLog()
  145. // uni.navigateTo({
  146. // url: "/pages/teachingDetail/teachingDetail",
  147. // });
  148. // },
  149. // 顶部大图跳转外部链接
  150. gotoHome() {
  151. // const web = this.classList[this.current];
  152. const url = "https://mp.weixin.qq.com/s/QZEGcvBn3aW7aHirMFLBQA";
  153. uni.navigateTo({
  154. url: "/pages/skipone/skipone?url=" + encodeURIComponent(url),
  155. });
  156. },
  157. goLog() {
  158. uni.navigateTo({
  159. url: "/pages/login_Wechat/login_Wechat",
  160. });
  161. },
  162. },
  163. // onReady(){
  164. // this.$refs.listBlock1.getdata()
  165. // },
  166. onShow() {
  167. //获取 精选
  168. // this.getData()
  169. // 获取教研室
  170. this.getlistBlock1Data()
  171. this.getAllMessage() // 调用app.js中的方法
  172. // 因为组件没有onshow
  173. // 获取收藏事件
  174. this.$refs.listBlock1.getdata()
  175. // 获取订阅事件
  176. // this.$refs.listBlock1.getSub(0)
  177. }
  178. };
  179. </script>
  180. <style lang="scss" scoped>
  181. .content {
  182. // 分类区样式
  183. .sortBlock {
  184. width: 750rpx;
  185. margin: 20rpx 0;
  186. background-color: rgba(255, 255, 255, 1);
  187. display: flex;
  188. justify-content: space-between;
  189. padding: 30rpx;
  190. position: relative;
  191. // 收费区
  192. .sortCostcon {
  193. padding: 30rpx;
  194. width: 336rpx;
  195. height: 300rpx;
  196. flex-shrink: 0;
  197. background-image: url('../../static/Rectangle1922.png');
  198. background-repeat: no-repeat;
  199. background-size: 100%;
  200. .sortCostcontent {
  201. display: flex;
  202. flex-direction: column;
  203. .costTit {
  204. font-weight: 400rpx;
  205. font-size: 36rpx;
  206. height: 48rpx;
  207. line-height: 48rpx;
  208. }
  209. .costbri {
  210. color: rgba(244, 142, 143, 1);
  211. font-size: 24rpx;
  212. width: 400;
  213. margin: 10rpx 0;
  214. }
  215. }
  216. .costimgblc{
  217. display: flex;
  218. justify-content: flex-end;
  219. .costImg {
  220. width: 162rpx;
  221. height: 162rpx;
  222. }
  223. }
  224. }
  225. .sortleft {
  226. flex: 1;
  227. display: flex;
  228. flex-direction: column;
  229. justify-content: space-between;
  230. margin-left: 20rpx;
  231. .sortcon2{
  232. background-image: url('https://teacherapi.cocorobo.cn/teaching-file/static/Rectangle938.png') !important;
  233. }
  234. .sortcon {
  235. width: 336rpx;
  236. height: 140rpx;
  237. background-image: url('https://teacherapi.cocorobo.cn/teaching-file/static/Rectangle937.png');
  238. background-repeat: no-repeat;
  239. background-size: 100%;
  240. display: flex;
  241. padding: 20rpx;
  242. .sortImg {
  243. position: absolute;
  244. left: 0;
  245. top: 0;
  246. width: 100%;
  247. height: 100%;
  248. }
  249. .sortcontent {
  250. display: flex;
  251. width: 100%;
  252. height: 100%;
  253. color: #000;
  254. .contentl {
  255. width: 70%;
  256. .tit {
  257. font-size: 36rpx;
  258. line-height: 48rpx;
  259. }
  260. .bri {
  261. font-size: 24rpx;
  262. height: 48rpx;
  263. width: 144rpx;
  264. line-height: 32rpx;
  265. position: relative;
  266. .di {
  267. position: absolute;
  268. bottom: 0;
  269. left: 0;
  270. color: rgba(243, 189, 91, 1);
  271. }
  272. .di2 {
  273. position: absolute;
  274. bottom: 0;
  275. left: 0;
  276. color: rgba(180, 193, 250, 1);
  277. }
  278. }
  279. }
  280. .sortleftImgBlock{
  281. position: relative;
  282. .sortleftImg {
  283. position: absolute;
  284. bottom: -10rpx;
  285. left: 0;
  286. height: 68rpx;
  287. width: 68rpx;
  288. }
  289. }
  290. }
  291. }
  292. }
  293. }
  294. // 顶部大图
  295. .top {
  296. width: 750rpx;
  297. height: 288rpx;
  298. display: flex;
  299. margin-bottom: 20rpx;
  300. align-items: center;
  301. background-color: #fff;
  302. justify-content: center;
  303. image {
  304. height: 246rpx;
  305. width: 690rpx;
  306. border-radius: 10rpx;
  307. }
  308. }
  309. .title {
  310. font-weight: bold;
  311. }
  312. .lookMore {
  313. color: #666666;
  314. // font-size: 14px;
  315. }
  316. }
  317. </style>