zxl
2025-07-11 e81eae6c8446bbd91c162b5ef3e42051b5523bf1
manager/src/views/kitchen/kitchenVideo.vue
@@ -252,9 +252,12 @@
        @on-selection-change="showSelect"
      >
        <template slot-scope="{ row, index }" slot="typeList">
          <div v-for="(tag, index) in row.typeList" :key="'tag' + index" style="margin-top: 5px">
            <Tag color="red">{{ tag.typeName }}</Tag>
          <div style="display: flex;flex-wrap: wrap">
            <div v-for="(tag, index) in row.typeList" :key="'tag' + index" style="margin-top: 5px">
              <Tag color="red">{{ tag.typeName }}</Tag>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="videoFileKey">
          <div class="play-text" @click="playVideo(row.videoFileKey, row.title)">点击播放</div>
@@ -394,7 +397,7 @@
        checkKitchenType: [
          {
            required: true,
            message: '请选择厨神标签',
            message: '请选择厨神标签且不能超过5个',
            trigger: 'blur',
            validator: (rule, value, callback) => {
              console.log('验证值:-------------->', value, '类型:', typeof value);
@@ -462,7 +465,7 @@
        {
          title: "视频分类",
          key: "typeList",
          width: 180,
          width: 310,
          slot: "typeList",
        },
        {
@@ -521,6 +524,7 @@
          slot: "action",
          align: "center",
          width: 200,
          fixed: "right",
        },
      ],
      data: [], // 表单数据
@@ -581,6 +585,12 @@
      this.$set(this.uploadVideoForm, 'showCoverUrl', '');
      this.$set(this.uploadVideoForm, 'temp', new Date().getTime());
    },
    calculateVideoFit(width, height) {
      const videoRatio = width / height;
      // 规则2:竖屏视频(如9:16)
      if (videoRatio < 0.8) return 'cover';
      return 'contain';
    },
    //重新上传视频
    clearVideo() {
      this.clearCoverImage();
@@ -591,6 +601,12 @@
    },
    getVideoDuration(e){
      const duration = this.$refs.healthVideoInfo.duration;
      const videoWidth = this.$refs.healthVideoInfo.videoWidth;
      const videoHeight = this.$refs.healthVideoInfo.videoHeight;
      // 根据宽高比选择视频填充模式
      const fitType = this.calculateVideoFit(videoWidth, videoHeight)
      this.uploadVideoForm.videoFit = fitType
      console.log('------视频信息3------------>', videoWidth,videoHeight,fitType)
      this.uploadVideoForm.videoDuration = Math.floor(duration);
    },
    // 视频上架