绿满眶商城微信小程序-uniapp
xiangpei
2025-05-26 1076d3e64cfb8648e429b3d7a3399e4593affc0c
pages/tabbar/video/video.vue
@@ -207,6 +207,7 @@
      id: '',
        title: '',
      videoFileKey: '',
      videoDuration: 0,
      videoFit: 'cover',
        goodsId: '',
        tags: [],
@@ -260,7 +261,7 @@
  },
  methods: {
     // 获取推荐标签
     getRecommendTags(type) {
     async getRecommendTags(type) {
        const params = {
           tagName: this.tagInput.trim(),
           searchType: type
@@ -274,7 +275,6 @@
        console.log("执行了");
        // 调用后端获取sts临时访问凭证
        getSTSToken().then(res => {
           console.log(res, "sts结构");
           const COS = require('@/lib/cos-wx-sdk-v5.js'); // 开发时使用
           // const COS = require('./lib/cos-wx-sdk-v5.min.js'); // 上线时使用压缩包
           
@@ -308,20 +308,21 @@
         if(fileName.indexOf('%') > -1) {
            fileName = decodeURIComponent(fileName);
         }
          const fileKey = getFileKey(fileName);
        this.videoInfo = {
         url: res.tempFilePath,
          fileKey: fileKey,
          fileType: fileKey.split('/')[0],
          fileSize: res.size,
          originalFileName: fileName,
          cover: ''
        };
        this.formData.videoFileKey = fileKey;
        // 判断视频的填充模式
        this.formData.videoFit = this.calculateVideoFit(res.width, res.height)
         const fileKey = getFileKey(fileName);
         this.videoInfo = {
          url: res.tempFilePath,
          fileKey: fileKey,
          fileType: fileKey.split('/')[0],
          fileSize: res.size,
          originalFileName: fileName,
          cover: ''
         };
         this.formData.videoFileKey = fileKey;
         this.formData.videoDuration = res.duration;
         // 判断视频的填充模式
         this.formData.videoFit = this.calculateVideoFit(res.width, res.height)
        
        this.cosClient.uploadFile({
         this.cosClient.uploadFile({
              Bucket: this.bucket,
              Region: this.region,
              Key: fileKey,
@@ -496,6 +497,7 @@
             title: '',
            videoFileKey: '',
            videoFit: 'cover',
            videoDuration: 0,
             goodsId: '',
             tags: [],
             fileInfo: {}