绿满眶商城微信小程序-uniapp
xiangpei
2025-07-02 ceadff3b61f49ab2326020aac0358f6c3b0f3683
pages/video/video-play.vue
@@ -331,7 +331,8 @@
         pageNumber: 1,
         pageSize: 10,
         authorId: '',
         videoFrom: ''
         videoFrom: '',
         keyword: ''
      },
      marginBottom: 0, // 底部安全区域
      windowHeight: 0 // 可使用屏幕高度
@@ -350,6 +351,7 @@
  },
  onUnload() {
     uni.removeStorageSync("playInfo");
     uni.removeStorageSync("searchPlayInfo");
  },
  onReady() {
     
@@ -357,11 +359,11 @@
  onLoad(option) {
     this.marginBottom = uni.getSystemInfoSync().safeAreaInsets.bottom
     this.windowHeight = uni.getSystemInfoSync().windowHeight
     const playInfo = uni.getStorageSync("playInfo", playInfo);
     const playInfo = uni.getStorageSync("playInfo");
     const searchPlayInfo = uni.getStorageSync("searchPlayInfo");
     if(playInfo) {
        this.currentIndex = playInfo.playIndex;
        this.videoList = playInfo.videoList;
        console.log("拿到数据了",playInfo);
        this.videoQuery.pageNumber = playInfo.pageNumber;
        this.videoNoMore = playInfo.nomore;
        this.videoQuery.authorId = option.authorId;
@@ -371,6 +373,18 @@
           const videoContext = uni.createVideoContext(`video${this.currentIndex}`, this);
           videoContext.play()
        })
     } else if (searchPlayInfo) { // 搜索页跳转过来的数据略有不同
        this.currentIndex = searchPlayInfo.playIndex;
        this.videoList = searchPlayInfo.videoList;
        this.videoQuery.pageNumber = searchPlayInfo.pageNumber;
        this.videoNoMore = searchPlayInfo.nomore;
        this.videoQuery.keyword = searchPlayInfo.keyword;
        this.videoQuery.videoFrom = option.videoFrom;
        this.currentVideoIsPlaying = true;
        this.$nextTick(() => {
                   const videoContext = uni.createVideoContext(`video${this.currentIndex}`, this);
                   videoContext.play()
        })
     } else {
        this.videoQuery.videoFrom = 'recommend';
        this.loadVideos();