绿满眶商城微信小程序-uniapp
peng
2025-08-05 f562cf22e554e7e89017ef98d60ccaf5fbfc0208
pages/video/home-page.vue
@@ -74,7 +74,16 @@
              v-for="(item, index) in videoList"
              :key="item.id"
            >
              <image class="video-cover" @click="playAuthorVideo(index)" :src="item.videoContentType === 'video' ? item.coverUrl : item.imgs[0]" mode="aspectFill"></image>
              <image v-if="item.videoContentType === 'img'" class="video-cover" @click="playAuthorVideo(index)" :src="item.imgs[0]" mode="aspectFill"></image>
              <!-- <image class="video-cover" @click="playAuthorVideo(index)" :src="item.videoContentType === 'video' ? item.coverUrl : item.imgs[0]" mode="aspectFill"></image> -->
              <video v-else :src="item.videoUrl"
              :poster-for-crawler='item.coverUrl'
              object-fit='"cover"'
              :show-fullscreen-btn='false'
              :show-play-btn='false'
              :show-center-play-btn='false'
              :enable-progress-gesture='false'
               class="video-cover" @click="playAuthorVideo(index)"></video>
              <view class="video-info">
                <view class="video-stats">
                  <view class="stat">
@@ -103,7 +112,16 @@
              :key="item.id"
              @click="playCollectVideo(index)"
            >
              <image class="video-cover" :src="item.videoContentType === 'video' ? item.coverUrl : item.imgs[0]" mode="aspectFill"></image>
            <image v-if="tem.videoContentType === 'img'" class="video-cover" :src="item.imgs[0]" mode="aspectFill"></image>
               <video v-else class="video-cover"
               :src="item.videoUrl"
               initial-time='0.01'
               muted
               :controls="false"
               :show-center-play-btn="false"
               object-fit="cover"></video>
              <!-- <image class="video-cover" :src="getCoverUrl(item)"></image> -->
              <view class="video-info">
                <view class="video-stats">
                  <view class="stat">
@@ -123,7 +141,13 @@
              :key="item.id"
              @click="playLikeVideo(index)"
            >
              <image class="video-cover" :src="item.videoContentType === 'video' ? item.coverUrl : item.imgs[0]" mode="aspectFill"></image>
              <video class="video-cover"
              :src="item.videoContentType === 'video' ? item.videoUrl : item.imgs[0]" mode="aspectFill"
              initial-time='0.01'
              muted
              :controls="false"
              :show-center-play-btn="false"
              object-fit="cover"></video>
              <view class="video-info">
                <view class="video-stats">
                  <view class="stat">
@@ -167,7 +191,7 @@
</template>
<script>
import DropdownMenu from '@/components/dropdown-menu.vue'
import DropdownMenu from '@/pages/video/dropdown-menu.vue'
import {getAuthorInfo, getAuthorVideoPage, getAuthorCollectVideoPage, getAuthorLikeVideoPage} from '@/api/user.js'
import {subscribe, unSubscribe, delVideo, updateVideo, userDownVideo} from '@/api/video.js'
@@ -222,27 +246,37 @@
    }
  },
  onShow() {
    this.getAuthorInfo();
    if (this.currentTab === 'works') {
      this.videoQuery.pageNumber = 1
      this.nomoreVideo = false
      this.getAuthorVideoPage();
    } else if (this.currentTab === 'collect') {
       this.collectVideoQuery.pageNumber = 1
       this.nomoreCollectVideo = false
       this.getAuthorCollectVideoPage()
    } else if (this.currentTab === 'likes') {
       this.likeVideoQuery.pageNumber = 1
       this.nomoreLikeVideo = false
       this.getAuthorLikeVideoPage()
    if (this.authorId) {
       this.getAuthorInfo();
       if (this.currentTab === 'works') {
             this.videoQuery.pageNumber = 1
             this.nomoreVideo = false
             this.getAuthorVideoPage();
       } else if (this.currentTab === 'collect') {
              this.collectVideoQuery.pageNumber = 1
              this.nomoreCollectVideo = false
              this.getAuthorCollectVideoPage()
       } else if (this.currentTab === 'likes') {
              this.likeVideoQuery.pageNumber = 1
              this.nomoreLikeVideo = false
              this.getAuthorLikeVideoPage()
       }
    }
  },
  onLoad(option) {
     console.log("收到参数", option);
   this.authorId = option.authorId;
    this.getAuthorInfo();
   this.getAuthorVideoPage();
  },
  methods: {
      getCoverUrl(item) {
           if (item.videoContentType === 'video') {
             // OSS视频封面参数(完整格式)
             return `${item.videoUrl}?x-oss-process=video/snapshot,t_1000,f_jpg,m_fast`
           }
           return item.imgs?.[0]
         },
   dialogClose() {
      this.opVideo = {
         id: '',