search.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <view class="indList">
  3. <view class="navTit dffs">
  4. <!-- <input type="text" v-model="keyword" placeholder="输入关键词搜索课程" @search="searchThis"/> -->
  5. <u-search class="input" bgColor="#FAFAFA" :show-action="false" placeholder="输入关键词搜索课程" v-model="keyword" @search="searchThis" @change="searchThis"></u-search>
  6. <view class="search fontsm">搜索</view>
  7. </view>
  8. <view v-if="newsInfo.length < 1" class="hisPage">
  9. <view class="pagebox">
  10. <view class="title blod dfsb">
  11. 历史搜索
  12. <u-icon name="trash"></u-icon>
  13. </view>
  14. <view class="con dffs">
  15. <view class="textcon" @click="searchThis(item)" v-for="(item, ind) in hotInfo" :key="ind">{{ item }}</view>
  16. </view>
  17. </view>
  18. </view>
  19. <!-- <view v-if="list.length > 1" class="listBox dffs">
  20. <text @tap="cliTab(ind)" :class="tabsel == ind ? 'sel' : ''" v-for="(item, ind) in list">{{ item }}</text>
  21. </view> -->
  22. <view class="newsBox">
  23. <view class="title">文档</view>
  24. <view class="box">
  25. <course-list :list="newsInfo.class_list"></course-list>
  26. <navigator :url="'/pages/index/classList?flag=2&keyword='+keyword" class="center textgrey fontsm">
  27. 查看更多文档>
  28. </navigator>
  29. </view>
  30. </view>
  31. <view v-if="vedio_status == 1" class="newsBox">
  32. <view class="title">视频</view>
  33. <view class="box">
  34. <video-list :list="newsInfo.video_list"></video-list>
  35. <navigator :url="'/pages/index/video/video?keyword='+keyword" class="center textgrey fontsm">
  36. 查看更多视频>
  37. </navigator>
  38. </view>
  39. </view>
  40. <view class="newsBox">
  41. <view class="title">实物</view>
  42. <view class="box">
  43. <shop-list :list="newsInfo.goods_list"></shop-list>
  44. <navigator :url="'/pagesA/mall/mall?type=1&keyword='+keyword" class="center textgrey fontsm">
  45. 查看更多实物>
  46. </navigator>
  47. </view>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. import courseList from './components/knowVidList.vue';
  53. import videoList from './video/componets/list.vue';
  54. import shopList from '@/components/shopList.vue';
  55. export default {
  56. components: {
  57. courseList,
  58. videoList,
  59. shopList
  60. },
  61. data() {
  62. return {
  63. vedio_status:0,
  64. keyword: '',
  65. newsInfo: {},
  66. status: 'nomore', //loading / nomore
  67. page: 1,
  68. pagenum: 6
  69. };
  70. },
  71. onLoad(param) {
  72. this.vedio_status = param.vedio_status;
  73. },
  74. onShow() {
  75. // this.loading();
  76. },
  77. onReachBottom() {
  78. // if (this.status == 'nomore') return;
  79. // this.status = 'loadmore';
  80. // this.page = ++this.page;
  81. // this.searchThis();
  82. },
  83. methods: {
  84. cliTab(val) {
  85. this.tabsel = val;
  86. this.status = 'loadmore';
  87. this.page = 1;
  88. this.newsInfo = [];
  89. this.getList();
  90. },
  91. //搜索
  92. searchThis(val) {
  93. this.keyword = val;
  94. this.page = 1;
  95. this.newsInfo = [];
  96. this.status = 'loadmore';
  97. this.getList();
  98. },
  99. loading() {
  100. this.$api
  101. .request('index/getHotSearch')
  102. .then(data => {
  103. console.log(data);
  104. if (data.code == 200) {
  105. this.hotInfo = data.data;
  106. } else {
  107. this.$api.toast(data.msg);
  108. }
  109. })
  110. },
  111. getList() {
  112. this.$api
  113. .request('index/searchList', {
  114. keyword: this.keyword
  115. })
  116. .then(data => {
  117. console.log(data);
  118. if (data.code == 200) {
  119. this.newsInfo = data.data;
  120. } else {
  121. this.$api.toast(data.msg);
  122. }
  123. });
  124. }
  125. }
  126. };
  127. </script>
  128. <style lang="scss" scoped>
  129. .indList {
  130. min-height: 100vh;
  131. padding: 96rpx 0 30rpx;
  132. .listBox {
  133. padding: 30rpx;
  134. background-color: #fff;
  135. text {
  136. margin-right: 30rpx;
  137. }
  138. .sel {
  139. color: $base-color;
  140. }
  141. }
  142. .navTit {
  143. position: fixed;
  144. width: 691rpx;
  145. height: 96rpx;
  146. top: 0;
  147. /* #ifdef H5 */
  148. top: 100rpx;
  149. /* #endif */
  150. left: 30rpx;
  151. height: 68rpx;
  152. line-height: 68rpx;
  153. border: 2px solid #31c671;
  154. border-radius: 40rpx;
  155. .search {
  156. width: 146rpx;
  157. height: 62rpx;
  158. line-height: 62rpx;
  159. background: #31c671;
  160. color: #fff;
  161. border-radius: 37rpx;
  162. font-size: 26rpx;
  163. text-align: center;
  164. }
  165. }
  166. .hisPage {
  167. padding: 30rpx 31rpx 0;
  168. .pagebox {
  169. margin-bottom: 37rpx;
  170. .title {
  171. font-size: 36rpx;
  172. margin-left: 26rpx;
  173. }
  174. .con {
  175. flex-wrap: wrap;
  176. margin-top: 22rpx;
  177. .textcon {
  178. // min-width: 130rpx;
  179. text-align: center;
  180. padding: 10rpx 30rpx;
  181. font-size: 24rpx;
  182. background-color: #f5f5f5;
  183. border-radius: 27rpx;
  184. margin-right: 13rpx;
  185. margin-bottom: 15rpx;
  186. }
  187. }
  188. }
  189. }
  190. .newsBox {
  191. margin-bottom: 30rpx;
  192. padding: 30rpx;
  193. background-color: #fff;
  194. .box{
  195. .center{
  196. padding-top: 30rpx;
  197. border-top: 1rpx solid #F5F5F5;
  198. }
  199. }
  200. }
  201. }
  202. </style>