|
@@ -84,9 +84,11 @@
|
|
|
ref="upload"
|
|
|
v-model:file-list="row.fileList"
|
|
|
class="list-upload-style"
|
|
|
+ :accept="DrawFormats.toString()"
|
|
|
:class="{
|
|
|
activefileList: row.fileList && row.fileList.length == 1,
|
|
|
}"
|
|
|
+ :before-upload="beforeUpload"
|
|
|
list-type="picture-card"
|
|
|
:action="uploadFileUrl"
|
|
|
:on-success="handleUploadSuccess"
|
|
@@ -197,7 +199,7 @@ const caseId = ref(null);
|
|
|
const project = reactive({
|
|
|
title: "",
|
|
|
});
|
|
|
-
|
|
|
+const DrawFormats = [".jpg", ".jpeg", ".png",".mp4",".m4v",".mp3",".aac", ".wav"]
|
|
|
const isNotFound = ref(false);
|
|
|
|
|
|
const dialogImageUrl = ref("");
|
|
@@ -253,11 +255,22 @@ const columns = ref([
|
|
|
{ prop: "words", label: "台词文案" },
|
|
|
{ prop: "marks", label: "备注" },
|
|
|
]);
|
|
|
+const beforeUpload = async (file: File) => {
|
|
|
+ const fileType = file.name
|
|
|
+ .substring(file.name.lastIndexOf("."))
|
|
|
+ .toUpperCase();
|
|
|
+ if (!DrawFormats.some((type) => type.toUpperCase() === fileType)) {
|
|
|
+ ElMessage.error(`请上传${DrawFormats}`);
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ };
|
|
|
const checkSourceIsVideo = computed(() => (url: string) => {
|
|
|
- return url.includes(".mp4");
|
|
|
+ return url.includes(".mp4") || url.includes(".m4v");
|
|
|
});
|
|
|
const checkSourceIsAudio = computed(() => (url: string) => {
|
|
|
- return url.includes(".mp3");
|
|
|
+ return url.includes(".mp3") || url.includes(".aac") || url.includes(".wav");
|
|
|
});
|
|
|
const checkSourceIsImage = computed(() => (url: string) => {
|
|
|
return url.includes(".jpg") || url.includes(".png") || url.includes(".gif");
|
|
@@ -269,7 +282,7 @@ const getCoverUrl = computed(() => (url: string) => {
|
|
|
// return (
|
|
|
// url + "?x-oss-process=video/snapshot,t_0,f_jpg,w_0,h_0,m_fast,ar_auto"
|
|
|
// );
|
|
|
- case url.includes(".mp3") || url.includes(".wmv"):
|
|
|
+ case url.includes(".mp3") || url.includes(".aac") || url.includes(".wmv"):
|
|
|
return musicHeadphones;
|
|
|
default:
|
|
|
return url;
|
|
@@ -366,11 +379,18 @@ const handlePictureCardPreview = (file: UploadFile) => {
|
|
|
|
|
|
const saveProject = () => {
|
|
|
// let content = sortList.value.map((index) => data.list[index]);
|
|
|
+ let apiDataList = data.newSortList.map((item) => {
|
|
|
+ let asData = data.list.find(ele => ele.id === item.id) || {};
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ ...asData,
|
|
|
+ }
|
|
|
+ });
|
|
|
console.log("saveProject", data.list, data.newSortList);
|
|
|
CaseScriptSaveOrUpdate({
|
|
|
caseId: caseId.value,
|
|
|
name: project.title,
|
|
|
- content: data.newSortList,
|
|
|
+ content: apiDataList,
|
|
|
}).then((res) => {
|
|
|
console.log("saveProject");
|
|
|
ElMessage.success("保存成功");
|