Kaynağa Gözat

课程管理-视频库 去掉ID列、FIX批量上传视频未完成时列表编辑不正确的问题

Long 1 ay önce
ebeveyn
işleme
6e89a91010
1 değiştirilmiş dosya ile 5 ekleme ve 10 silme
  1. 5 10
      src/views/course/videoResource/index.vue

+ 5 - 10
src/views/course/videoResource/index.vue

@@ -84,11 +84,6 @@
                 {{ scope.$index + 1 }}
               </template>
             </el-table-column>
-      <el-table-column label="主键ID" align="center" width="80">
-        <template slot-scope="scope">
-          <a @click="copy(scope.row.id)" style="color: #409EFF;">ID</a>
-        </template>
-      </el-table-column>
       <el-table-column label="素材名称" align="center" :show-overflow-tooltip="true" prop="resourceName" width="300"/>
       <el-table-column label="文件名称" align="center" :show-overflow-tooltip="true" prop="fileName" width="300"/>
       <el-table-column label="分类" align="center" width="120">
@@ -1023,7 +1018,6 @@ export default {
     //获取第一帧封面
     async getFirstThumbnail(file, form){
       getThumbnail(file).then(response => {
-        console.log("获取到第一帧为封面=======>",response.url)
         form.thumbnail = response.url;
       })
     },
@@ -1032,7 +1026,7 @@ export default {
       try {
         const data = await uploadObject(file, (progress) => {
           const progressEvent = {
-            percent: Math.floor(progress.percent * 100) / 2, // COS SDK 百分比是 0-1,el-upload 需要 0-100
+            percent: Math.floor(progress.percent * 100 / 2), // COS SDK 百分比是 0-1,el-upload 需要 0-100
             loaded: progress.loaded,
             total: progress.total,
             lengthComputable: true // 文件上传通常总大小可知
@@ -1177,7 +1171,7 @@ export default {
       this.batchEditDialog.open = false
     },
     batchEditSubmitForm() {
-      let temp = this.videoList.find(item => item.fileKey === this.batchEditDialog.form.fileKey)
+      let temp = this.videoList.find(item => item.tempId === this.batchEditDialog.form.tempId)
       Object.assign(temp, this.batchEditDialog.form)
       this.batchEditDialog.open = false
     },
@@ -1191,7 +1185,7 @@ export default {
         // 从视频列表中删除该项
         const index = this.videoList.findIndex(item => {
           // 通过文件名和大小确定唯一性,因为临时视频可能没有id
-          return item.fileKey === row.fileKey
+          return item.tempId === row.tempId
         });
 
         if (index !== -1) {
@@ -1232,6 +1226,7 @@ export default {
 
       // 创建临时视频对象添加到列表中
       const tempVideo = {
+        tempId: Math.random().toString(36).substring(2, 15),
         resourceName: file.name.split('.')[0], // 使用文件名作为视频名称
         fileName: file.name,
         thumbnail: null,
@@ -1256,7 +1251,7 @@ export default {
       const video = document.createElement('video');
       video.preload = 'metadata';
       video.onloadedmetadata = () => {
-        const index = this.videoList.findIndex(item => item.resourceName === tempVideo.resourceName);
+        const index = this.videoList.findIndex(item => item.tempId === tempVideo.tempId);
         if (index !== -1) {
           tempVideo.duration = Math.round(video.duration);
         }