classList.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <view class="content">
  3. <view class="top-input dfsb">
  4. <navigator url="/pages/index/screenList" class="sel dffs">
  5. 条件筛选
  6. <u-icon name="arrow-right" color="#F89638" size="10"></u-icon>
  7. </navigator>
  8. <u-search :showAction="false" placeholder="输入关键词搜索课程" @input="search()" v-model="keyword"></u-search>
  9. </view>
  10. <view class="swiper"><u-swiper :autoplay="false" :list="banner" keyName="img" height="120" border-radius="20" @click="bannerClick"></u-swiper></view>
  11. <view v-if="flag == 1" class="conwarp">
  12. <view class="fl-five"><video-list :flag="1" :list="list"></video-list></view>
  13. </view>
  14. <view v-if="flag == 2" class="conwarp">
  15. <view class="fl-five"><course-list :flag="2" :list="list"></course-list></view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import courseList from './components/knowVidList.vue';
  21. import videoList from './video/componets/list.vue';
  22. export default {
  23. components: {
  24. courseList,
  25. videoList
  26. },
  27. data() {
  28. return {
  29. keyword: '',
  30. banner: [],
  31. flag: '', // 1 视频 2.其他
  32. cat_id:0,
  33. nav_id: '',
  34. subject_id: '',
  35. grade_id: '',
  36. list: [
  37. // { image: '/static/img/pro/indnotice.png', name: '知识过关', path: '/pages/knowledge/knowledge' },
  38. ],
  39. status: 'loadmore',
  40. page: 1,
  41. pagenum: 6
  42. };
  43. },
  44. onPullDownRefresh() {
  45. this.page = 1;
  46. this.list = [];
  47. this.getInfoList();
  48. setTimeout(res => {
  49. uni.stopPullDownRefresh();
  50. }, 1000);
  51. },
  52. onReachBottom() {
  53. if (this.status == 'nomore') return;
  54. this.status = 'loading';
  55. this.page = ++this.page;
  56. this.getInfoList();
  57. },
  58. //url: `/pages/index/knowledgeList?flag=${val}&subject_id=${val}&grade_id=${this.grade_id}&title=${item.name}`
  59. onLoad(opt) {
  60. this.flag = opt.flag || '1'; // 1 视频 2.其他
  61. this.keyword = opt.keyword || ''; // 1 视频 2.其他
  62. this.subject_id = opt.subject_id || '';
  63. this.grade_id = opt.grade_id || '';
  64. this.nav_id = opt.nav_id || ''; //导航ID
  65. this.cat_id = opt.cat_id || 0; //二级分类ID
  66. uni.setNavigationBarTitle({
  67. title: opt.title
  68. });
  69. if (!this.keyword) return this.getInfoList();
  70. },
  71. methods: {
  72. search() {
  73. this.page = 1;
  74. this.list = [];
  75. this.getInfoList();
  76. },
  77. getInfoList() {
  78. this.status = 'loadmore';
  79. let url = this.flag == 1 ? 'index/getVideoList' : 'index/getClassList';
  80. this.$api
  81. .request(url, {
  82. keyword: this.keyword || '',
  83. is_top: 0,
  84. grade_id: this.grade_id || '',
  85. cat_id:this.cat_id||0,
  86. nav_id:this.nav_id||'',
  87. subject_id: this.subject_id || '',
  88. year: this.year || '',
  89. page: this.page,
  90. limit: this.pagenum
  91. })
  92. .then(data => {
  93. console.log(data);
  94. if (data.code == 200) {
  95. this.banner = data.data.banner;
  96. if (this.flag == 1) {
  97. this.list = this.list.concat(data.data.video_list);
  98. if (data.data.video_list.length < this.pagnum) {
  99. this.status = 'nomore';
  100. }
  101. } else {
  102. this.list = this.list.concat(data.data.list);
  103. if (data.data.list.length < this.pagnum) {
  104. this.status = 'nomore';
  105. }
  106. }
  107. } else {
  108. this.$api.toast(data.msg);
  109. }
  110. });
  111. },
  112. toNext(url) {
  113. uni.navigateTo({
  114. url: url
  115. });
  116. },
  117. bannerClick(e) {
  118. console.log(e);
  119. let item = this.banner[e];
  120. if (item.goods_id != 0) {
  121. if (item.type == 1) {
  122. uni.navigateTo({
  123. url: '/pages/index/video/videoInfo?id=' + item.goods_id
  124. });
  125. } else {
  126. uni.navigateTo({
  127. url: '/pages/index/navInfo?id=' + item.goods_id
  128. });
  129. }
  130. }
  131. }
  132. }
  133. };
  134. </script>
  135. <style lang="scss" scoped>
  136. .content {
  137. .top-input {
  138. padding: 20rpx 30rpx;
  139. .sel {
  140. color: #f89638;
  141. padding: 12rpx 20rpx;
  142. font-size: $font-sm;
  143. background-color: rgba(#f89638, 0.1);
  144. border-radius: 30rpx;
  145. margin-right: 36rpx;
  146. }
  147. }
  148. .swiper {
  149. margin: 20rpx 30rpx;
  150. }
  151. .conwarp {
  152. background-color: #fff;
  153. padding: 32rpx 30rpx 30rpx;
  154. border-radius: 16rpx;
  155. margin-bottom: 20rpx;
  156. .gdHead {
  157. line-height: 58rpx;
  158. margin-bottom: 16rpx;
  159. .head {
  160. font-size: 34rpx;
  161. font-family: PingFangSC-Medium, PingFang SC;
  162. font-weight: 600;
  163. color: #333333;
  164. line-height: 48rpx;
  165. }
  166. }
  167. }
  168. }
  169. </style>