绿满眶商城微信小程序-uniapp
peng
9 天以前 25ee0fc249a081bb7bc4b485708c3e1afd3b07d1
pages/kitchen/KitchenVideo.vue
@@ -284,6 +284,8 @@
  changeCollect
} from "@/api/collect.js";
import { saveShare, saveShareClickRecord } from "@/api/share.js";
import storage from "@/utils/storage.js";
export default {
  computed: {
    hasPlayTime() {
@@ -439,6 +441,7 @@
            }
               this.getKitchenTypeList();
               this.loadVideos(queryParam);
         })
      }else{
         if (option.userId && option.videoId) {
@@ -447,7 +450,7 @@
            saveShareClickRecord({refId: option.videoId, shareUserId: option.userId})
      }
      this.getKitchenTypeList();
      this.loadVideos();
      this.loadVideos(queryParam);
   }
   
  }, 
@@ -799,14 +802,48 @@
      })
    },
    // 加载视频数据
    async loadVideos() {
    async loadVideos(param) {
      console.log(this.loading, this.videoNoMore,this.videoQuery)
      if (this.videoQuery.pageNumber == 1) {
      } else if (this.loading || this.videoNoMore) return;
      this.loading = true;
      if(param){
         console.log("二维码扫码数据执行在此处1")
         console.log(this.videoQuery)
         getkitchenVideoList(this.videoQuery).then(res => {
            console.log(res)
           // 新增一个字段用于循环时的key
           const data = res.data.data.map(item => {
              return {
                 ...item,
                 updateKey: item.id
              }
           })
           if (this.videoQuery.pageNumber === 1) {
             this.videoList = data;
           } else {
             this.videoList = [
               ...this.videoList,
               ...data.filter(
                   (newItem) => !this.videoList.some((oldItem) => oldItem.id === newItem.id)
               ),
             ];
           }
           this.loading = false;
           if (data.length < this.videoQuery.pageSize) {
             this.videoNoMore = true;
             return;
           }
           this.videoQuery.pageNumber++;
         })
      }else{
      console.log("二维码扫码数据执行在此处2")
      console.log(this.videoQuery)
      getkitchenVideoList(this.videoQuery).then(res => {
        console.log(res)
        // 新增一个字段用于循环时的key
        const data = res.data.data.map(item => {
           return {
@@ -832,6 +869,7 @@
        this.videoQuery.pageNumber++;
      })
     }
    },
    // 滑动切换视频