index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. <template>
  2. <view class="content">
  3. <view class="top-input"><u-search :showAction="false" placeholder="输入关键词搜索课程" @focus="toNext('/pages/index/search?vedio_status='+ info.vedio_status)" v-model="keyword"></u-search></view>
  4. <view class="swiper">
  5. <u-swiper :autoplay="true" :list="banner" keyName="img" height="140" border-radius="20" @click="bannerClick"></u-swiper>
  6. <view class="notice bb dffs">
  7. <image src="/static/img/pro/indnotice.png" mode=""></image>
  8. <swiper class="noswiper flex1" :autoplay="true" :interval="3000" vertical :duration="1000">
  9. <swiper-item @click="navTo(item)" v-for="(item, index) in notic" :key="index">
  10. <!-- <view class="swiper-item"></view> -->
  11. <view class="title fontmid">{{ item.title }}</view>
  12. </swiper-item>
  13. </swiper>
  14. <u-icon name="arrow-right"></u-icon>
  15. </view>
  16. </view>
  17. <!-- 导航列表 -->
  18. <view class="nav">
  19. <sh-menu class="funliBox" :flag="0" :detail="nav" menu="5" :imgW="74"></sh-menu>
  20. </view>
  21. <!-- 导航列表 -->
  22. <view class="conwarp">
  23. <view class="gdHead dfsb"><view class="head">热门榜单</view></view>
  24. <view class="specGod dffs">
  25. <view @click="newxtTo(1, item, ite)" v-for="(item, index) in list_one" class="shopsLi" :key="index">
  26. <image class="bg" :src="'/static/img/temp/indbg' + (index + 1) + '.png'" mode=""></image>
  27. <view class="shopBox">
  28. <view class="topLeft">Top {{ item.num }}</view>
  29. <view class="title blod fontbase">{{ item.name }}</view>
  30. <view class="sub-title">共{{ item.count }}套|每天更新</view>
  31. <view class="line-list oneelli">
  32. <!-- @click="newxtTo(2, item, ite)" -->
  33. <view v-if="ind < 3" v-for="(ite, ind) in item.data" :key="ind" class="li oneelli">{{ ite.rank_num }}、{{ ite.desc }}</view>
  34. </view>
  35. <view class="all dffs">
  36. 查看全部{{ item.count }}套
  37. <u-icon name="arrow-right" color="#fff" size="10"></u-icon>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="conwarp fl-box">
  44. <view class="gdHead dfsb"><view class="head">活动专区</view></view>
  45. <view class="fl-two dfsb">
  46. <image @click="toNext('/pagesA/mall/mall?type=2')" :src="info.pintuan_img" mode="widthFix"></image>
  47. <image @click="toNext('/pagesA/mall/mall?type=3')" :src="info.miaosha_img" mode="widthFix"></image>
  48. </view>
  49. </view>
  50. <!-- -->
  51. <view v-if="info.vedio_status==1" class="conwarp fl-box">
  52. <view class="gdHead dfsb">
  53. <view class="head">教学视频</view>
  54. <view @click="toNext('/pages/index/video/video')" class="fontssm promain dffs">
  55. 查看更多
  56. <u-icon name="arrow-right" color="#025B58" size="10"></u-icon>
  57. </view>
  58. </view>
  59. <view class="fl-thr">
  60. <view class="thr-tab scrollx">
  61. <navigator :url="'/pages/index/video/video?cat='+item.id" class="li fontssm" :class="ind == 0 ? 'sel' : ''" v-for="(item, ind) in vedio_cats" :key="ind">{{ item.name }}</navigator>
  62. </view>
  63. <view class="tab-con scrollx dffs"><video-list :flag="1" :list="video_list"></video-list></view>
  64. </view>
  65. </view>
  66. <view class="conwarp fl-box">
  67. <view class="gdHead dfsb">
  68. <view class="titBox dffs">
  69. <view class="head">名校推荐</view>
  70. <!-- <view
  71. @click="toNext('/pages/index/school/school?type=' + item.id)"
  72. v-for="(item, ind) in school_type"
  73. :key="ind"
  74. :class="[ind == 0 ? 'head' : '', 'textgrey fontmid']"
  75. >
  76. {{ item.name }}
  77. </view> -->
  78. </view>
  79. <view @click="toNext('/pages/index/school/school?type=' + school_type[0].id)" class="fontssm promain dffs">
  80. 查看更多
  81. <u-icon name="arrow-right" color="#025B58" size="10"></u-icon>
  82. </view>
  83. </view>
  84. <view class="fl-four scrollx dffs">
  85. <view @click="toNext('/pages/index/school/schoolInfo?id=' + item.id)" class="schLi dffs" v-for="(item, ind) in school" :key="ind">
  86. <image class="bg" :src="item.logo" mode=""></image>
  87. <view class="shopBox flex1 dffd">
  88. <view class="bold fontmid oneelli">{{ item.name }}</view>
  89. <view class="textgrey desc fontssm">{{ item.brief }}</view>
  90. <view class="all dffs">
  91. 查看更多
  92. <u-icon name="arrow-right" color="#025B58" size="10"></u-icon>
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. <view class="conwarp fl-box">
  99. <view class="gdHead dfsb">
  100. <view class="head">热门资料</view>
  101. <!-- <navigator url="/pagesA/mall/class" class="fontssm promain dffs">
  102. 查看更多
  103. <u-icon name="arrow-right" color="#025B58" size="10"></u-icon> -->
  104. </navigator>
  105. </view>
  106. <view class="fl-five"><shop-list :flag="1" :list="newsInfo"></shop-list></view>
  107. </view>
  108. </view>
  109. </template>
  110. <script>
  111. import shMenu from './components/sh-menu.vue';
  112. import videoList from '@/components/videoList.vue';
  113. import shopList from '@/components/shopList.vue';
  114. export default {
  115. components: {
  116. shMenu,
  117. shopList,
  118. videoList
  119. },
  120. data() {
  121. return {
  122. keyword: '',
  123. banner: [],
  124. notic: [],
  125. info:{},
  126. list_one: {},
  127. nav: [],
  128. dl_nav:[], //独立导航列表
  129. school: [],
  130. vedio_cats: [],
  131. school_type: '', //教学视频 选中
  132. video_list: [],
  133. newsInfo: [],
  134. page: 1,
  135. limit: 6
  136. };
  137. },
  138. onPullDownRefresh() {
  139. setTimeout(res => {
  140. uni.stopPullDownRefresh();
  141. }, 1000);
  142. this.newsInfo = [];
  143. this.page = 1;
  144. this.status = 'loadmore';
  145. // this.getInfoList();
  146. this.getInfoOne();
  147. this.getInfotwo();
  148. this.getInfothree();
  149. },
  150. onReachBottom() {
  151. if (this.status == 'nomore') return;
  152. this.status = 'loading';
  153. this.page = ++this.page;
  154. // this.getInfoList();
  155. this.getInfothree();
  156. },
  157. onLoad(opt) {
  158. var yqm = '';
  159. let scene = decodeURIComponent(opt.scene);
  160. if(scene)
  161. {
  162. let scene_arr = scene.split('=');
  163. var yqm = scene_arr[1];
  164. console.log(yqm);
  165. }
  166. // let yqm = opt.yqm || '';
  167. if(yqm)
  168. {
  169. uni.setStorageSync('yqm', yqm);
  170. }
  171. this.getInfoOne();
  172. this.getInfotwo();
  173. this.getInfothree();
  174. // this.getInfoList();
  175. },
  176. onShareAppMessage() {
  177. let that = this;
  178. return {
  179. title: that.goodInfo.info.name,
  180. path: ""
  181. };
  182. },
  183. methods: {
  184. // 轮播
  185. bannerClick(e) {
  186. console.log('bannerClick:',e);
  187. let item = this.banner[e];
  188. console.log('item:',item);
  189. if (item.goods_id != 0) {
  190. switch(item.type)
  191. {
  192. case 1:
  193. uni.navigateTo({
  194. url: '/pages/index/navDet?id= ' + item.goods_id
  195. // url: '/pages/index/navInfo?id=' + item.goods_id
  196. });
  197. break;
  198. case 2:
  199. uni.navigateTo({
  200. url: '/pages/index/video/videoInfo?id=' + item.goods_id
  201. });
  202. break;
  203. case 3:
  204. uni.navigateTo({
  205. url: '/pages/news/newsInfo?type=2&id=' + item.goods_id
  206. });
  207. break;
  208. case 4:
  209. uni.navigateTo({
  210. url: '/pages/news/newsInfo?type=2&id=' + item.goods_id
  211. });
  212. break;
  213. }
  214. }
  215. },
  216. // 热门榜单 val 1列表 2.详情 type 1 文档 2 视频
  217. newxtTo(val, item, ite) {
  218. if (val == 1) {
  219. // /pages/index/classList?flag=2&subject_id=2&grade_id=1&title=资源类
  220. uni.navigateTo({
  221. url: `/pages/index/indHot?id=${item.id}&type=${item.type}`
  222. });
  223. return;
  224. }
  225. if (item.type == 1) {
  226. uni.navigateTo({
  227. url: '/pages/index/navDet?id=' + ite.id
  228. });
  229. } else {
  230. console.log(ite);
  231. uni.navigateTo({
  232. url: '/pages/index/video/videoInfo?id=' + ite.id
  233. });
  234. }
  235. },
  236. // 公告
  237. navTo(item) {
  238. console.log('navTo:',item);
  239. uni.navigateTo({
  240. url: '/pages/news/newsInfo?type=2&id=' + item.id
  241. });
  242. },
  243. //首页第一块 (轮播图 + 公告 + 导航)
  244. getInfoOne() {
  245. this.$api
  246. .request('index/index_one', {
  247. })
  248. .then(data => {
  249. if (data.code == 200) {
  250. let dl_nav = data.data.dl_nav;
  251. let nav = data.data.nav;
  252. let hb = dl_nav.concat(nav);
  253. this.nav = hb;
  254. uni.setStorageSync('showVideo',data.data.vedio_status)
  255. this.info = data.data;
  256. this.banner = data.data.banner;
  257. this.notic = data.data.notic;
  258. } else {
  259. this.$api.toast(data.msg);
  260. }
  261. });
  262. },
  263. //首页第二块 (榜单 + 配置 + 视频 + 名校)
  264. getInfotwo() {
  265. this.$api
  266. .request('index/index_two', {
  267. })
  268. .then(data => {
  269. if (data.code == 200) {
  270. this.school_type = data.data.school_type;
  271. this.vedio_cats = data.data.vedio_cats;
  272. this.list_one = data.data.list_one;
  273. // this.nav = data.data.nav;
  274. this.school = data.data.school;
  275. this.video_list = data.data.video_list;
  276. } else {
  277. this.$api.toast(data.msg);
  278. }
  279. });
  280. },
  281. //首页第三块 (商品)
  282. getInfothree() {
  283. this.$api
  284. .request('index/index_three', {
  285. })
  286. .then(data => {
  287. if (data.code == 200) {
  288. this.newsInfo = this.newsInfo.concat(data.data.goods);
  289. console.log(this.newsInfo);
  290. if (data.data.goods.length < this.limit) {
  291. this.status = 'nomore';
  292. }
  293. } else {
  294. this.$api.toast(data.msg);
  295. }
  296. });
  297. },
  298. getInfoList() {
  299. this.$api
  300. .request('index/index', {
  301. school_type: this.school_type || '',
  302. video_cat: this.vedio_cats || '',
  303. page: this.page,
  304. limit: this.limit
  305. })
  306. .then(data => {
  307. console.log("热门资料",data);
  308. if (data.code == 200) {
  309. let dl_nav = data.data.dl_nav;
  310. let nav = data.data.nav;
  311. let hb = dl_nav.concat(nav);
  312. this.nav = hb;
  313. console.log('合并数组: ',hb);
  314. uni.setStorageSync('showVideo',data.data.vedio_status)
  315. this.info =data.data;
  316. this.school_type = data.data.school_type;
  317. this.vedio_cats = data.data.vedio_cats;
  318. this.list_one = data.data.list_one;
  319. // this.nav = data.data.nav;
  320. this.school = data.data.school;
  321. this.banner = data.data.banner;
  322. this.notic = data.data.notic;
  323. this.video_list = data.data.video_list;
  324. this.newsInfo = this.newsInfo.concat(data.data.goods);
  325. console.log(this.newsInfo);
  326. if (data.data.goods.length < this.limit) {
  327. this.status = 'nomore';
  328. }
  329. } else {
  330. this.$api.toast(data.msg);
  331. }
  332. });
  333. },
  334. toNext(url) {
  335. console.log(11);
  336. uni.navigateTo({
  337. url: url
  338. });
  339. }
  340. }
  341. };
  342. </script>
  343. <style lang="scss" scoped>
  344. .content {
  345. .top-input {
  346. padding: 20rpx 30rpx;
  347. }
  348. .swiper {
  349. margin: 0 30rpx;
  350. }
  351. .notice {
  352. padding: 35rpx 0 33rpx;
  353. image {
  354. width: 66rpx;
  355. height: 31rpx;
  356. margin-right: 28rpx;
  357. }
  358. .title {
  359. border-left: 1rpx solid #bfbfbf;
  360. flex: 1;
  361. padding: 0 26rpx;
  362. }
  363. .noswiper {
  364. height: 50rpx;
  365. }
  366. }
  367. .nav {
  368. margin: 25rpx 30rpx 0;
  369. }
  370. .conwarp {
  371. margin-left: 32rpx;
  372. border-radius: 16rpx;
  373. .gdHead {
  374. line-height: 58rpx;
  375. margin-bottom: 16rpx;
  376. .head {
  377. font-size: 34rpx;
  378. font-family: PingFangSC-Medium, PingFang SC;
  379. font-weight: 600;
  380. color: #333333;
  381. line-height: 48rpx;
  382. }
  383. .fontmid {
  384. margin-right: 10rpx;
  385. }
  386. }
  387. .specGod {
  388. padding: 5rpx 5rpx 10rpx;
  389. // flex-wrap: wrap;
  390. display: -webkit-box;
  391. overflow-x: auto;
  392. &::-webkit-scrollbar {
  393. display: none;
  394. }
  395. .shopsLi {
  396. margin-right: 30rpx;
  397. width: 286rpx;
  398. height: 331rpx;
  399. border-radius: 16rpx;
  400. overflow: hidden;
  401. position: relative;
  402. .bg {
  403. position: absolute;
  404. top: 0;
  405. left: 0;
  406. width: 286rpx;
  407. height: 431rpx;
  408. }
  409. .shopBox {
  410. width: 100%;
  411. position: absolute;
  412. top: 0;
  413. left: 0;
  414. z-index: 2;
  415. padding: 22rpx 18rpx 20rpx;
  416. .topLeft {
  417. background: linear-gradient(90deg, #fdd597 0%, #eec37a 100%);
  418. border-radius: 15rpx;
  419. font-size: 18rpx;
  420. font-family: PingFangSC-Medium, PingFang SC;
  421. font-weight: 500;
  422. line-height: 25rpx;
  423. padding: 5rpx 12rpx;
  424. width: 120rpx;
  425. }
  426. .title {
  427. font-family: PingFangSC-Semibold, PingFang SC;
  428. font-weight: 600;
  429. color: #ffffff;
  430. line-height: 42rpx;
  431. margin: 9rpx 5rpx 10rpx;
  432. }
  433. .sub-title {
  434. font-size: 18rpx;
  435. font-family: PingFangSC-Light, PingFang SC;
  436. font-weight: 300;
  437. color: #ffffff;
  438. line-height: 25rpx;
  439. }
  440. .line-list {
  441. margin-top: 27rpx;
  442. .li {
  443. width: 100%;
  444. font-size: 20rpx;
  445. color: #ffffff;
  446. line-height: 28rpx;
  447. margin-bottom: 13rpx;
  448. }
  449. }
  450. .all {
  451. font-size: 16rpx;
  452. font-family: PingFangSC-Light, PingFang SC;
  453. font-weight: 300;
  454. color: #ffffff;
  455. line-height: 22rpx;
  456. justify-content: center;
  457. align-items: center;
  458. }
  459. }
  460. }
  461. }
  462. }
  463. .fl-box {
  464. margin: 30rpx 30rpx 0;
  465. .fl-two {
  466. image {
  467. width: 340rpx;
  468. }
  469. }
  470. .fl-thr {
  471. .thr-tab {
  472. .li {
  473. background: #f2f2f2;
  474. border-radius: 27rpx;
  475. color: #999;
  476. padding: 8rpx 15rpx;
  477. margin-right: 20rpx;
  478. }
  479. .sel {
  480. color: $promain;
  481. font-weight: 500rpx;
  482. background: rgba(2, 91, 88, 0.1);
  483. border-radius: 27rpx;
  484. border: 1px solid #025b58;
  485. }
  486. }
  487. .tab-con {
  488. margin-top: 30rpx;
  489. // width: 100%;
  490. }
  491. }
  492. .titBox {
  493. &:nth-of-type(2) {
  494. margin-left: 30rpx;
  495. }
  496. }
  497. .fl-four {
  498. margin-top: 21rpx;
  499. .schLi {
  500. width: 430rpx;
  501. background-color: #fff;
  502. margin-right: 20rpx;
  503. padding: 12rpx 10rpx;
  504. .bg {
  505. width: 149rpx;
  506. height: 149rpx;
  507. margin-right: 16rpx;
  508. }
  509. .shopBox {
  510. width: 240rpx;
  511. .oneelli {
  512. width: 100%;
  513. }
  514. .desc {
  515. margin: 12rpx 0 27rpx;
  516. font-family: PingFangSC-Light, PingFang SC;
  517. font-weight: 300;
  518. line-height: 34rpx;
  519. text-overflow: -o-ellipsis-lastline;
  520. overflow: hidden;
  521. text-overflow: ellipsis;
  522. display: -webkit-box;
  523. -webkit-line-clamp: 2;
  524. line-clamp: 2;
  525. -webkit-box-orient: vertical;
  526. }
  527. .all {
  528. padding: 6rpx 18rpx;
  529. background: rgba(#025b58, 0.2);
  530. border-radius: 21rpx;
  531. font-size: 20rpx;
  532. color: $promain;
  533. align-self: flex-end;
  534. }
  535. }
  536. }
  537. }
  538. }
  539. }
  540. </style>