|
@@ -92,10 +92,10 @@
|
|
|
<el-table v-loading="loading" :data="resourceList" @selection-change="handleSelectionChange" border>
|
|
<el-table v-loading="loading" :data="resourceList" @selection-change="handleSelectionChange" border>
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
<el-table-column label="序号" width="55" align="center">
|
|
<el-table-column label="序号" width="55" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
|
|
- {{ scope.$index + 1 }}
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ {{ scope.$index + 1 }}
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="素材名称" align="center" :show-overflow-tooltip="true" prop="resourceName"/>
|
|
<el-table-column label="素材名称" align="center" :show-overflow-tooltip="true" prop="resourceName"/>
|
|
|
<el-table-column label="文件名称" align="center" :show-overflow-tooltip="true" prop="fileName"/>
|
|
<el-table-column label="文件名称" align="center" :show-overflow-tooltip="true" prop="fileName"/>
|
|
|
<el-table-column label="排序" align="center" prop="sort" />
|
|
<el-table-column label="排序" align="center" prop="sort" />
|
|
@@ -354,7 +354,7 @@
|
|
|
<minimizable-dialog :title="'批量修改'" :visible.sync="batchUpdateVisible" width="700px" append-to-body :before-close="cancel"
|
|
<minimizable-dialog :title="'批量修改'" :visible.sync="batchUpdateVisible" width="700px" append-to-body :before-close="cancel"
|
|
|
@minimize="hasMinimizableDialog = true" @restore="hasMinimizableDialog = false">
|
|
@minimize="hasMinimizableDialog = true" @restore="hasMinimizableDialog = false">
|
|
|
<el-form ref="form" :model="batchUpdateForm" :rules="rules" label-width="80px">
|
|
<el-form ref="form" :model="batchUpdateForm" :rules="rules" label-width="80px">
|
|
|
- <el-form-item label="分类" prop="typeId">
|
|
|
|
|
|
|
+ <el-form-item label="分类" prop="typeId">
|
|
|
<el-select v-model="batchUpdateForm.typeId" placeholder="请选择分类" style="width: 100%" @change="val => changeCateType(val, 2)">
|
|
<el-select v-model="batchUpdateForm.typeId" placeholder="请选择分类" style="width: 100%" @change="val => changeCateType(val, 2)">
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="item in rootTypeList"
|
|
v-for="item in rootTypeList"
|
|
@@ -383,8 +383,8 @@
|
|
|
</minimizable-dialog>
|
|
</minimizable-dialog>
|
|
|
<!-- 批量选择视频弹窗 -->
|
|
<!-- 批量选择视频弹窗 -->
|
|
|
<minimizable-dialog :title="'选择视频'" :visible.sync="batchAddVisible" width="1200px" append-to-body class="batch-dialog"
|
|
<minimizable-dialog :title="'选择视频'" :visible.sync="batchAddVisible" width="1200px" append-to-body class="batch-dialog"
|
|
|
- :close-on-click-modal="false" :before-close="cancelBeforeBatch" @minimize="hasMinimizableDialog = true"
|
|
|
|
|
- @restore="hasMinimizableDialog = false">
|
|
|
|
|
|
|
+ :close-on-click-modal="false" :before-close="cancelBeforeBatch" @minimize="hasMinimizableDialog = true"
|
|
|
|
|
+ @restore="hasMinimizableDialog = false">
|
|
|
<div class="filter-container">
|
|
<div class="filter-container">
|
|
|
<el-button type="primary" icon="el-icon-plus" size="small" @click="showUploadPanel">上传视频</el-button>
|
|
<el-button type="primary" icon="el-icon-plus" size="small" @click="showUploadPanel">上传视频</el-button>
|
|
|
</div>
|
|
</div>
|
|
@@ -413,9 +413,9 @@
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="关联项目" align="center" min-width="100">
|
|
<el-table-column label="关联项目" align="center" min-width="100">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
- <a
|
|
|
|
|
- @click="handleViewProject(scope.row, 4)"
|
|
|
|
|
- :style="scope.row.projectIds.length > 0 ? {
|
|
|
|
|
|
|
+ <a
|
|
|
|
|
+ @click="handleViewProject(scope.row, 4)"
|
|
|
|
|
+ :style="scope.row.projectIds.length > 0 ? {
|
|
|
backgroundColor: '#409EFF',
|
|
backgroundColor: '#409EFF',
|
|
|
color: 'white',
|
|
color: 'white',
|
|
|
border: 'none',
|
|
border: 'none',
|
|
@@ -436,9 +436,9 @@
|
|
|
display: 'inline-block',
|
|
display: 'inline-block',
|
|
|
textDecoration: 'none'
|
|
textDecoration: 'none'
|
|
|
}">
|
|
}">
|
|
|
- {{ scope.row.projectIds.length > 0 ? '查看详情' : '未关联题目' }}
|
|
|
|
|
- </a>
|
|
|
|
|
- </template>
|
|
|
|
|
|
|
+ {{ scope.row.projectIds.length > 0 ? '查看详情' : '未关联题目' }}
|
|
|
|
|
+ </a>
|
|
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="视频文件" align="center" prop="fileName" min-width="120">
|
|
<el-table-column label="视频文件" align="center" prop="fileName" min-width="120">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
@@ -673,9 +673,6 @@
|
|
|
<div class="project-list">
|
|
<div class="project-list">
|
|
|
<div class="filter-container">
|
|
<div class="filter-container">
|
|
|
<el-form :inline="true" :model="projectQueryParams" ref="projectForm">
|
|
<el-form :inline="true" :model="projectQueryParams" ref="projectForm">
|
|
|
- <el-form-item>
|
|
|
|
|
- <el-input prefix-icon="el-icon-search" @input="searchProjects" v-model="projectQueryParams.sort" placeholder="请输入题目序号" clearable size="small" />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
<el-form-item>
|
|
<el-form-item>
|
|
|
<el-input prefix-icon="el-icon-search" @input="searchProjects" v-model="projectQueryParams.title" placeholder="请输入题目标题" clearable size="small" />
|
|
<el-input prefix-icon="el-icon-search" @input="searchProjects" v-model="projectQueryParams.title" placeholder="请输入题目标题" clearable size="small" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -702,9 +699,9 @@
|
|
|
|
|
|
|
|
<div class="table-footer">
|
|
<div class="table-footer">
|
|
|
<el-pagination style="text-align: right" v-show="projectListTotal>0" :pager-count="5" background
|
|
<el-pagination style="text-align: right" v-show="projectListTotal>0" :pager-count="5" background
|
|
|
- @size-change="handleProjectPageSizeChange" @current-change="handleProjectPageChange" :current-page="projectQueryParams.pageNum"
|
|
|
|
|
- :page-sizes="[10, 20, 30, 50]" :page-size="projectQueryParams.pageSize" layout="total, sizes, prev, pager, next, jumper"
|
|
|
|
|
- :total="projectListTotal">
|
|
|
|
|
|
|
+ @size-change="handleProjectPageSizeChange" @current-change="handleProjectPageChange" :current-page="projectQueryParams.pageNum"
|
|
|
|
|
+ :page-sizes="[10, 20, 30, 50]" :page-size="projectQueryParams.pageSize" layout="total, sizes, prev, pager, next, jumper"
|
|
|
|
|
+ :total="projectListTotal">
|
|
|
</el-pagination>
|
|
</el-pagination>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -777,7 +774,9 @@ import {getByIds, listCourseQuestionBank} from '@/api/course/courseQuestionBank'
|
|
|
import {getThumbnail} from "@/api/course/userVideo";
|
|
import {getThumbnail} from "@/api/course/userVideo";
|
|
|
import {uploadObject} from "@/utils/cos.js";
|
|
import {uploadObject} from "@/utils/cos.js";
|
|
|
import {uploadToOBS} from "@/utils/obs.js";
|
|
import {uploadToOBS} from "@/utils/obs.js";
|
|
|
|
|
+import {uploadToHSY} from "@/utils/hsy.js";
|
|
|
import MinimizableDialog from "@/components/MinimizableDialog"
|
|
import MinimizableDialog from "@/components/MinimizableDialog"
|
|
|
|
|
+import log from "@/views/monitor/job/log.vue";
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: 'VideoResource',
|
|
name: 'VideoResource',
|
|
@@ -830,6 +829,8 @@ export default {
|
|
|
typeSubId: null,
|
|
typeSubId: null,
|
|
|
projectIds: [],
|
|
projectIds: [],
|
|
|
sort: null,
|
|
sort: null,
|
|
|
|
|
+ hsyVid:null,//火山云上传视频返回vid
|
|
|
|
|
+ hsyVodUrl:null,//火山云url
|
|
|
// 新增上传状态字段
|
|
// 新增上传状态字段
|
|
|
uploadStatus: 'pending', // pending, uploading, success, failed
|
|
uploadStatus: 'pending', // pending, uploading, success, failed
|
|
|
uploadProgress: {
|
|
uploadProgress: {
|
|
@@ -904,8 +905,7 @@ export default {
|
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
|
questionType: null,
|
|
questionType: null,
|
|
|
questionSubType: null,
|
|
questionSubType: null,
|
|
|
- title: null,
|
|
|
|
|
- sort: null
|
|
|
|
|
|
|
+ title: null
|
|
|
},
|
|
},
|
|
|
projectLoading: false,
|
|
projectLoading: false,
|
|
|
projectListTotal: 0,
|
|
projectListTotal: 0,
|
|
@@ -988,10 +988,12 @@ export default {
|
|
|
},
|
|
},
|
|
|
// 取消按钮
|
|
// 取消按钮
|
|
|
cancel() {
|
|
cancel() {
|
|
|
- this.$refs.videoUpload.clearFiles()
|
|
|
|
|
this.open = false;
|
|
this.open = false;
|
|
|
this.reset();
|
|
this.reset();
|
|
|
|
|
+ this.resetForm("form");
|
|
|
|
|
+ this.batchUpdateVisible = false;
|
|
|
this.changeCateType(this.queryParams.typeId)
|
|
this.changeCateType(this.queryParams.typeId)
|
|
|
|
|
+ this.$refs.videoUpload.clearFiles()
|
|
|
},
|
|
},
|
|
|
// 表单重置
|
|
// 表单重置
|
|
|
reset() {
|
|
reset() {
|
|
@@ -1109,6 +1111,7 @@ export default {
|
|
|
this.add = true
|
|
this.add = true
|
|
|
|
|
|
|
|
const params = Object.assign({}, this.form);
|
|
const params = Object.assign({}, this.form);
|
|
|
|
|
+ console.log("提交素材表单参数",this.form)
|
|
|
params.projectIds = this.form.projectIds.join(',');
|
|
params.projectIds = this.form.projectIds.join(',');
|
|
|
if (this.form.id != null) {
|
|
if (this.form.id != null) {
|
|
|
updateVideoResource(params).then(response => {
|
|
updateVideoResource(params).then(response => {
|
|
@@ -1134,15 +1137,15 @@ export default {
|
|
|
handleDelete(row) {
|
|
handleDelete(row) {
|
|
|
const ids = row.id || this.ids;
|
|
const ids = row.id || this.ids;
|
|
|
this.$confirm('是否确认删除视频素材库编号为"' + ids + '"的数据项?', "警告", {
|
|
this.$confirm('是否确认删除视频素材库编号为"' + ids + '"的数据项?', "警告", {
|
|
|
- confirmButtonText: "确定",
|
|
|
|
|
- cancelButtonText: "取消",
|
|
|
|
|
- type: "warning"
|
|
|
|
|
- }).then(function() {
|
|
|
|
|
- return deleteVideoResource(ids);
|
|
|
|
|
- }).then(() => {
|
|
|
|
|
- this.getList();
|
|
|
|
|
- this.msgSuccess("删除成功");
|
|
|
|
|
- }).catch(function() {});
|
|
|
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
|
+ type: "warning"
|
|
|
|
|
+ }).then(function() {
|
|
|
|
|
+ return deleteVideoResource(ids);
|
|
|
|
|
+ }).then(() => {
|
|
|
|
|
+ this.getList();
|
|
|
|
|
+ this.msgSuccess("删除成功");
|
|
|
|
|
+ }).catch(function() {});
|
|
|
},
|
|
},
|
|
|
/** 查询视频分类列表 */
|
|
/** 查询视频分类列表 */
|
|
|
getTypeList() {
|
|
getTypeList() {
|
|
@@ -1303,37 +1306,95 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
//上传华为云Obs
|
|
//上传华为云Obs
|
|
|
- async uploadVideoToHwObs(file, form, onProgress) {
|
|
|
|
|
|
|
+ // async uploadVideoToHwObs(file, form, onProgress) {
|
|
|
|
|
+ // try {
|
|
|
|
|
+ // // 更新线路2状态为上传中
|
|
|
|
|
+ // this.updateUploadProgress('line2Status', 'uploading');
|
|
|
|
|
+ //
|
|
|
|
|
+ // const data = await uploadToOBS(file, (progress) => {
|
|
|
|
|
+ // const progressPercent = Math.floor(progress);
|
|
|
|
|
+ // this.updateUploadProgress('line2', progressPercent);
|
|
|
|
|
+ // const progressEvent = { percent: progressPercent, loaded: progress, total: progress, lengthComputable: true };
|
|
|
|
|
+ // onProgress(progressEvent);
|
|
|
|
|
+ // }, 1, (uploadInfo) => {
|
|
|
|
|
+ // if (form.tempId) {
|
|
|
|
|
+ // const tokens = this.uploadCancellationTokens.get(form.tempId) || {};
|
|
|
|
|
+ // tokens.obs = uploadInfo.cancel;
|
|
|
|
|
+ // this.uploadCancellationTokens.set(form.tempId, tokens);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // });
|
|
|
|
|
+ //
|
|
|
|
|
+ // form.line2 = `${process.env.VUE_APP_VIDEO_LINE_2}/${data.urlPath}`;
|
|
|
|
|
+ //
|
|
|
|
|
+ // // 更新线路2状态为成功
|
|
|
|
|
+ // this.updateUploadProgress('line2Status', 'success');
|
|
|
|
|
+ // this.updateUploadProgress('line2', 100);
|
|
|
|
|
+ //
|
|
|
|
|
+ // this.$message.success("线路二上传成功");
|
|
|
|
|
+ // return { success: true, url: form.line2 };
|
|
|
|
|
+ // } catch (error) {
|
|
|
|
|
+ // // 更新线路2状态为失败
|
|
|
|
|
+ // this.updateUploadProgress('line2Status', 'failed');
|
|
|
|
|
+ // this.$message.error("线路二上传失败");
|
|
|
|
|
+ // return { success: false, error: error.message };
|
|
|
|
|
+ // }
|
|
|
|
|
+ // },
|
|
|
|
|
+ //上传火山云
|
|
|
|
|
+ async uploadVideoToHsy(file, form, onProgress) {
|
|
|
try {
|
|
try {
|
|
|
- // 更新线路2状态为上传中
|
|
|
|
|
this.updateUploadProgress('line2Status', 'uploading');
|
|
this.updateUploadProgress('line2Status', 'uploading');
|
|
|
|
|
|
|
|
- const data = await uploadToOBS(file, (progress) => {
|
|
|
|
|
- const progressPercent = Math.floor(progress);
|
|
|
|
|
- this.updateUploadProgress('line2', progressPercent);
|
|
|
|
|
- const progressEvent = { percent: progressPercent, loaded: progress, total: progress, lengthComputable: true };
|
|
|
|
|
- onProgress(progressEvent);
|
|
|
|
|
- }, 1, (uploadInfo) => {
|
|
|
|
|
- if (form.tempId) {
|
|
|
|
|
- const tokens = this.uploadCancellationTokens.get(form.tempId) || {};
|
|
|
|
|
- tokens.obs = uploadInfo.cancel;
|
|
|
|
|
- this.uploadCancellationTokens.set(form.tempId, tokens);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ const data = await uploadToHSY(
|
|
|
|
|
+ file,
|
|
|
|
|
+ (progress) => {
|
|
|
|
|
+ // 火山云的进度是小数0-1
|
|
|
|
|
+ if (typeof progress.percent === 'number') {
|
|
|
|
|
+ const percent = Math.floor(progress.percent * 100);
|
|
|
|
|
+
|
|
|
|
|
+ // 更新线路2进度
|
|
|
|
|
+ this.updateUploadProgress('line2', percent);
|
|
|
|
|
+
|
|
|
|
|
+ // 对外统一 progress 事件(模拟 xhr)
|
|
|
|
|
+ onProgress?.({
|
|
|
|
|
+ percent,
|
|
|
|
|
+ loaded: percent,
|
|
|
|
|
+ total: 100,
|
|
|
|
|
+ lengthComputable: true
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- form.line2 = `${process.env.VUE_APP_VIDEO_LINE_2}/${data.urlPath}`;
|
|
|
|
|
|
|
+ // 状态同步(成功 / 失败)
|
|
|
|
|
+ if (progress.status === 'success') {
|
|
|
|
|
+ this.updateUploadProgress('line2Status', 'success');
|
|
|
|
|
+ this.updateUploadProgress('line2', 100);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- // 更新线路2状态为成功
|
|
|
|
|
- this.updateUploadProgress('line2Status', 'success');
|
|
|
|
|
- this.updateUploadProgress('line2', 100);
|
|
|
|
|
|
|
+ if (progress.status === 'failed') {
|
|
|
|
|
+ this.updateUploadProgress('line2Status', 'failed');
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ 1,
|
|
|
|
|
+ (uploadInfo) => {
|
|
|
|
|
+ if (form.tempId) {
|
|
|
|
|
+ const tokens = this.uploadCancellationTokens.get(form.tempId) || {};
|
|
|
|
|
+ tokens.hsy = uploadInfo.cancel;
|
|
|
|
|
+ this.uploadCancellationTokens.set(form.tempId, tokens);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ );
|
|
|
|
|
+ console.log("上传火山云返回参数",data)
|
|
|
|
|
|
|
|
- this.$message.success("线路二上传成功");
|
|
|
|
|
|
|
+ form.line2 = `${process.env.VUE_APP_VIDEO_URL}/${data.SourceInfo.FileName}`;
|
|
|
|
|
+ this.form.hsyVid = data.Vid
|
|
|
|
|
+ this.form.hsyVodUrl = process.env.VUE_APP_VIDEO_URL+"/"+data.SourceInfo.FileName
|
|
|
|
|
+ console.log("this.form",this.form)
|
|
|
|
|
+ this.$message.success('线路二上传成功');
|
|
|
return { success: true, url: form.line2 };
|
|
return { success: true, url: form.line2 };
|
|
|
|
|
+
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
- // 更新线路2状态为失败
|
|
|
|
|
this.updateUploadProgress('line2Status', 'failed');
|
|
this.updateUploadProgress('line2Status', 'failed');
|
|
|
- this.$message.error("线路二上传失败");
|
|
|
|
|
- return { success: false, error: error.message };
|
|
|
|
|
|
|
+ this.$message.error('线路二上传失败');
|
|
|
|
|
+ return { success: false, error: error?.message || 'upload failed' };
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
// 更新上传进度的辅助方法
|
|
// 更新上传进度的辅助方法
|
|
@@ -1370,7 +1431,8 @@ export default {
|
|
|
await this.getFirstThumbnail(file, this.form);
|
|
await this.getFirstThumbnail(file, this.form);
|
|
|
const [line1Result, line2Result] = await Promise.allSettled([
|
|
const [line1Result, line2Result] = await Promise.allSettled([
|
|
|
this.uploadVideoToTxPcdn(file, this.form, options.onProgress),
|
|
this.uploadVideoToTxPcdn(file, this.form, options.onProgress),
|
|
|
- this.uploadVideoToHwObs(file, this.form, options.onProgress)
|
|
|
|
|
|
|
+ //this.uploadVideoToHwObs(file, this.form, options.onProgress)
|
|
|
|
|
+ this.uploadVideoToHsy(file, this.form, options.onProgress)
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
const line1Success = line1Result.status === 'fulfilled' && line1Result.value.success;
|
|
const line1Success = line1Result.status === 'fulfilled' && line1Result.value.success;
|
|
@@ -1433,8 +1495,7 @@ export default {
|
|
|
this.$message.warning("请至少选择一条数据");
|
|
this.$message.warning("请至少选择一条数据");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- this.batchUpdateForm.typeId = null;
|
|
|
|
|
- this.batchUpdateForm.typeSubId = null;
|
|
|
|
|
|
|
+ this.resetForm("form");
|
|
|
this.batchUpdateForm.ids = this.ids; // 将选中的ID传递给批量修改表单
|
|
this.batchUpdateForm.ids = this.ids; // 将选中的ID传递给批量修改表单
|
|
|
this.batchUpdateVisible = true;
|
|
this.batchUpdateVisible = true;
|
|
|
},
|
|
},
|
|
@@ -1457,6 +1518,8 @@ export default {
|
|
|
cancelBatch() {
|
|
cancelBatch() {
|
|
|
if (!this.videoList || this.videoList.length === 0) {
|
|
if (!this.videoList || this.videoList.length === 0) {
|
|
|
this.batchAddVisible = false
|
|
this.batchAddVisible = false
|
|
|
|
|
+ this.batchUpdateVisible = false
|
|
|
|
|
+
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
this.$confirm('关闭窗口视频需要重新上传,确定关闭吗?', '提示', {
|
|
this.$confirm('关闭窗口视频需要重新上传,确定关闭吗?', '提示', {
|
|
@@ -1465,11 +1528,13 @@ export default {
|
|
|
type: 'warning'
|
|
type: 'warning'
|
|
|
}).then(() => {
|
|
}).then(() => {
|
|
|
this.batchAddVisible = false
|
|
this.batchAddVisible = false
|
|
|
|
|
+ this.batchUpdateVisible = false
|
|
|
this.changeCateType(this.queryParams.typeId)
|
|
this.changeCateType(this.queryParams.typeId)
|
|
|
}).catch(() => { });
|
|
}).catch(() => { });
|
|
|
},
|
|
},
|
|
|
/** 批量修改 */
|
|
/** 批量修改 */
|
|
|
submitBatchUpdate() {
|
|
submitBatchUpdate() {
|
|
|
|
|
+ console.log("批量上传表单提交参数",this.form)
|
|
|
this.$refs["form"].validate(valid => {
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
if (valid) {
|
|
|
if (this.batchUpdateForm.ids.length === 0) {
|
|
if (this.batchUpdateForm.ids.length === 0) {
|
|
@@ -1503,6 +1568,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 检查是否所有选中的视频都已上传完成
|
|
// 检查是否所有选中的视频都已上传完成
|
|
|
|
|
+ console.log("videoList",this.videoList)
|
|
|
const incompleteVideos = this.videoList.filter(item => (item.progress || 0) < 100);
|
|
const incompleteVideos = this.videoList.filter(item => (item.progress || 0) < 100);
|
|
|
if (incompleteVideos.length > 0) {
|
|
if (incompleteVideos.length > 0) {
|
|
|
this.$message.warning('有未完成上传的视频,请先完成上传');
|
|
this.$message.warning('有未完成上传的视频,请先完成上传');
|
|
@@ -1711,7 +1777,7 @@ export default {
|
|
|
this.uploadQueue.push(tempVideo);
|
|
this.uploadQueue.push(tempVideo);
|
|
|
this.videoList.unshift(tempVideo);
|
|
this.videoList.unshift(tempVideo);
|
|
|
|
|
|
|
|
- // 获取视频时长
|
|
|
|
|
|
|
+ // 获取视频时长
|
|
|
const video = document.createElement('video');
|
|
const video = document.createElement('video');
|
|
|
video.preload = 'metadata';
|
|
video.preload = 'metadata';
|
|
|
video.onloadedmetadata = () => {
|
|
video.onloadedmetadata = () => {
|
|
@@ -1776,6 +1842,7 @@ export default {
|
|
|
this.isProcessingBatch = false;
|
|
this.isProcessingBatch = false;
|
|
|
this.isUploading = false;
|
|
this.isUploading = false;
|
|
|
this.$message.success('所有视频上传队列处理完成!');
|
|
this.$message.success('所有视频上传队列处理完成!');
|
|
|
|
|
+ console.log("批量上传form",this.form)
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
async uploadSingleVideo(tempVideo) {
|
|
async uploadSingleVideo(tempVideo) {
|
|
@@ -1786,7 +1853,9 @@ export default {
|
|
|
// 并行上传到两个服务器
|
|
// 并行上传到两个服务器
|
|
|
const [line1Result, line2Result] = await Promise.allSettled([
|
|
const [line1Result, line2Result] = await Promise.allSettled([
|
|
|
this.uploadVideoToTxPcdnBatch(tempVideo.file, tempVideo),
|
|
this.uploadVideoToTxPcdnBatch(tempVideo.file, tempVideo),
|
|
|
- this.uploadVideoToHwObsBatch(tempVideo.file, tempVideo)
|
|
|
|
|
|
|
+ // this.uploadVideoToHwObsBatch(tempVideo.file, tempVideo)
|
|
|
|
|
+ this.uploadVideoToHSYBatch(tempVideo.file, tempVideo),
|
|
|
|
|
+
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
// 检查上传结果
|
|
// 检查上传结果
|
|
@@ -1993,8 +2062,8 @@ export default {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
getByIds({ids: projectIds}).then(response => {
|
|
getByIds({ids: projectIds}).then(response => {
|
|
|
- this.projectShowList = response.data;
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ this.projectShowList = response.data;
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
// 打开弹窗展示列表
|
|
// 打开弹窗展示列表
|
|
|
this.projectListDialogVisible = true;
|
|
this.projectListDialogVisible = true;
|
|
@@ -2067,108 +2136,6 @@ export default {
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- /** 删除视频 */
|
|
|
|
|
- handleDeleteVideo(row) {
|
|
|
|
|
- if (row.uploadStatus === 'uploading') {
|
|
|
|
|
- this.$confirm('该视频正在上传中,确认要取消上传并删除吗?', '取消上传', {
|
|
|
|
|
- confirmButtonText: '确定取消',
|
|
|
|
|
- cancelButtonText: '继续上传',
|
|
|
|
|
- type: 'warning'
|
|
|
|
|
- }).then(() => {
|
|
|
|
|
- // Cancel the upload and remove from list
|
|
|
|
|
- this.cancelVideoUpload(row);
|
|
|
|
|
- }).catch(() => {
|
|
|
|
|
- // User chose to continue uploading
|
|
|
|
|
- this.$message.info('继续上传该视频');
|
|
|
|
|
- });
|
|
|
|
|
- } else {
|
|
|
|
|
- // Original confirmation for non-uploading videos
|
|
|
|
|
- this.$confirm('确认要从列表中删除该视频吗?', '提示', {
|
|
|
|
|
- confirmButtonText: '确定',
|
|
|
|
|
- cancelButtonText: '取消',
|
|
|
|
|
- type: 'warning'
|
|
|
|
|
- }).then(() => {
|
|
|
|
|
- this.removeVideoFromList(row);
|
|
|
|
|
- }).catch(() => {
|
|
|
|
|
- // 取消删除
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- cancelVideoUpload(row) {
|
|
|
|
|
- const cancellationTokens = this.uploadCancellationTokens.get(row.tempId);
|
|
|
|
|
- if (cancellationTokens) {
|
|
|
|
|
- // Cancel COS upload if exists
|
|
|
|
|
- if (cancellationTokens.cos) {
|
|
|
|
|
- try {
|
|
|
|
|
- cancellationTokens.cos();
|
|
|
|
|
- console.log('COS upload cancelled for video:', row.tempId);
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.error('Error cancelling COS upload:', error);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // Cancel OBS upload if exists
|
|
|
|
|
- if (cancellationTokens.obs) {
|
|
|
|
|
- try {
|
|
|
|
|
- cancellationTokens.obs();
|
|
|
|
|
- console.log('OBS upload cancelled for video:', row.tempId);
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.error('Error cancelling OBS upload:', error);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // Remove cancellation tokens
|
|
|
|
|
- this.uploadCancellationTokens.delete(row.tempId);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const videoIndex = this.videoList.findIndex(item => item.tempId === row.tempId);
|
|
|
|
|
- if (videoIndex !== -1) {
|
|
|
|
|
- this.videoList[videoIndex].uploadStatus = 'cancelled';
|
|
|
|
|
- this.videoList.splice(videoIndex, 1);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const queueIndex = this.uploadQueue.findIndex(item => item.tempId === row.tempId);
|
|
|
|
|
- if (queueIndex !== -1) {
|
|
|
|
|
- this.uploadQueue.splice(queueIndex, 1);
|
|
|
|
|
- this.updateQueuePositions();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- this.$message.success('已取消视频上传并从列表中移除');
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- removeVideoFromList(row) {
|
|
|
|
|
- const videoIndex = this.videoList.findIndex(item => item.tempId === row.tempId);
|
|
|
|
|
- if (videoIndex !== -1) {
|
|
|
|
|
- this.videoList.splice(videoIndex, 1);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // Remove from upload queue if it's still queued
|
|
|
|
|
- const queueIndex = this.uploadQueue.findIndex(item => item.tempId === row.tempId);
|
|
|
|
|
- if (queueIndex !== -1) {
|
|
|
|
|
- this.uploadQueue.splice(queueIndex, 1);
|
|
|
|
|
- this.updateQueuePositions();
|
|
|
|
|
- this.$message.success('已从上传队列中移除该视频');
|
|
|
|
|
- } else {
|
|
|
|
|
- this.$message.success('已从列表中移除该视频');
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- getUploadStatusText(status, queuePosition) {
|
|
|
|
|
- switch (status) {
|
|
|
|
|
- case 'success':
|
|
|
|
|
- return '上传成功';
|
|
|
|
|
- case 'failed':
|
|
|
|
|
- return '上传失败';
|
|
|
|
|
- case 'uploading':
|
|
|
|
|
- return '上传中';
|
|
|
|
|
- case 'queued':
|
|
|
|
|
- return `队列中 (第${queuePosition}位)`;
|
|
|
|
|
- default:
|
|
|
|
|
- return '待上传';
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
getQueueStatusColor(status) {
|
|
getQueueStatusColor(status) {
|
|
|
switch (status) {
|
|
switch (status) {
|
|
|
case 'success':
|
|
case 'success':
|
|
@@ -2212,9 +2179,31 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
// 批量上传 - 华为云
|
|
// 批量上传 - 华为云
|
|
|
- async uploadVideoToHwObsBatch(file, tempVideo) {
|
|
|
|
|
|
|
+ // async uploadVideoToHwObsBatch(file, tempVideo) {
|
|
|
|
|
+ // try {
|
|
|
|
|
+ // const data = await uploadToOBS(file, (progress) => {
|
|
|
|
|
+ // const progressPercent = Math.floor(progress);
|
|
|
|
|
+ // const index = this.videoList.findIndex(item => item.tempId === tempVideo.tempId);
|
|
|
|
|
+ // if (index !== -1) {
|
|
|
|
|
+ // this.videoList[index].uploadDetails.line2 = progressPercent;
|
|
|
|
|
+ // this.videoList[index].uploadDetails.line2Status = 'uploading';
|
|
|
|
|
+ // this.updateBatchProgress(index);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }, 1, (uploadInfo) => {
|
|
|
|
|
+ // const tokens = this.uploadCancellationTokens.get(tempVideo.tempId) || {};
|
|
|
|
|
+ // tokens.obs = uploadInfo.cancel;
|
|
|
|
|
+ // this.uploadCancellationTokens.set(tempVideo.tempId, tokens);
|
|
|
|
|
+ // });
|
|
|
|
|
+ //
|
|
|
|
|
+ // tempVideo.line2 = `${process.env.VUE_APP_VIDEO_LINE_2}/${data.urlPath}`;
|
|
|
|
|
+ // return { success: true, url: tempVideo.line2 };
|
|
|
|
|
+ // } catch (error) {
|
|
|
|
|
+ // return { success: false, error: error.message };
|
|
|
|
|
+ // }
|
|
|
|
|
+ // },
|
|
|
|
|
+ async uploadVideoToHSYBatch(file, tempVideo) {
|
|
|
try {
|
|
try {
|
|
|
- const data = await uploadToOBS(file, (progress) => {
|
|
|
|
|
|
|
+ const data = await uploadToHSY(file, (progress) => {
|
|
|
const progressPercent = Math.floor(progress);
|
|
const progressPercent = Math.floor(progress);
|
|
|
const index = this.videoList.findIndex(item => item.tempId === tempVideo.tempId);
|
|
const index = this.videoList.findIndex(item => item.tempId === tempVideo.tempId);
|
|
|
if (index !== -1) {
|
|
if (index !== -1) {
|
|
@@ -2227,9 +2216,11 @@ export default {
|
|
|
tokens.obs = uploadInfo.cancel;
|
|
tokens.obs = uploadInfo.cancel;
|
|
|
this.uploadCancellationTokens.set(tempVideo.tempId, tokens);
|
|
this.uploadCancellationTokens.set(tempVideo.tempId, tokens);
|
|
|
});
|
|
});
|
|
|
|
|
+ console.log("批量上传返回参数",data)
|
|
|
|
|
+ tempVideo.line2 = `${process.env.VUE_APP_VIDEO_URL}/${data.SourceInfo.FileName}`;
|
|
|
|
|
+ tempVideo.hsyVid = data.Vid;
|
|
|
|
|
|
|
|
- tempVideo.line2 = `${process.env.VUE_APP_VIDEO_LINE_2}/${data.urlPath}`;
|
|
|
|
|
- return { success: true, url: tempVideo.line2 };
|
|
|
|
|
|
|
+ return { success: true, url: tempVideo.line2};
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
return { success: false, error: error.message };
|
|
return { success: false, error: error.message };
|
|
|
}
|
|
}
|