SearchPage.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <view class="">
  3. <view class="rmkdwwer">
  4. <view class="fzctob inbddwddre">
  5. <image src="/static/index/ina1.png"
  6. style="width: 40rpx;height: 40rpx;min-width: 40rpx;margin-right: 12rpx;"></image>
  7. <input type="text" v-model="title" focus confirm-type="search" @confirm="getList" placeholder-style="color: #CCCCCC;font-size: 28rpx;"
  8. placeholder="搜索你感兴趣的内容" />
  9. </view>
  10. </view>
  11. <view class="zytlidde" style="padding: 0 30rpx;" @click="toDetail(item.id)" v-for="(item,index) in list" :key="index">
  12. <view class="zytyyrimg" style="overflow: hidden;">
  13. <image :src="item.img" mode="aspectFill" style="width: 100%; height: 100%;"></image>
  14. </view>
  15. <view class="zytyyopf">
  16. <view class="zytyotxta"><text>{{item.title}}</text></view>
  17. <view class="flztoa zytyotxtb">
  18. <text>{{item.lecturer_name}}</text>
  19. <image src="/static/zy/zyb3.png" style="width: 48rpx;height: 48rpx;" mode=""></image>
  20. </view>
  21. <view class="flztoa">
  22. <view class="fzctob zytyotxtc">
  23. <text>{{item.sales}}人观看</text>
  24. </view>
  25. <!-- 分钟 -->
  26. <text class="zytyotxtd">{{item.time}}</text>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <style>
  33. page {
  34. background: #FAFAFA;
  35. }
  36. </style>
  37. <script>
  38. export default {
  39. data() {
  40. return {
  41. list: [],
  42. info:null,
  43. page:1,
  44. num:20,
  45. title:'',
  46. total:0
  47. }
  48. },
  49. onLoad(e) {
  50. this.type_id = e.type_id || '-1'
  51. // this.getList()
  52. },
  53. onReachBottom() {
  54. if(this.list.length<this.total){
  55. this.page++
  56. this.getList()
  57. }
  58. },
  59. methods:{
  60. getList(){
  61. this.$post({
  62. data:{
  63. do:'CourseList',
  64. data:{
  65. page:this.page,
  66. num:this.num,
  67. title:this.title,
  68. user_id:uni.getStorageSync('id'),
  69. type_id:'-1',
  70. }
  71. }
  72. }).then(res=>{
  73. console.log(res,'llllll')
  74. this.total = res.data.total
  75. if(res.data.data.length){
  76. this.list = this.page==1?res.data.data:[...this.list,...res.data.data]
  77. }else{
  78. this.total = 0
  79. this.list = []
  80. }
  81. }).catch(()=>{
  82. this.total = 0
  83. this.list = []
  84. })
  85. },
  86. toDetail(id){
  87. uni.navigateTo({
  88. url: './kcxq-x?id=' + id
  89. })
  90. }
  91. }
  92. }
  93. </script>
  94. <style lang="scss" scoped>
  95. </style>