From 012acbb587a33dad8b299e557a8b35c28ab39d7f Mon Sep 17 00:00:00 2001 From: XaoLi717 <144221124+XaoLi717@users.noreply.github.com> Date: Tue, 8 Oct 2024 18:54:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8C=E6=AD=A5=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UploadFile/src/UploadFile.vue | 41 +++++++------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/src/components/UploadFile/src/UploadFile.vue b/src/components/UploadFile/src/UploadFile.vue index 2dc7ce7..6e7f280 100644 --- a/src/components/UploadFile/src/UploadFile.vue +++ b/src/components/UploadFile/src/UploadFile.vue @@ -234,7 +234,7 @@ const SyncFiles = async () => { const addMap = { docx: 'add_docs', xlsx: 'add_excel', - pptx: 'add_pppt', + pptx: 'add_ppt', pdf: 'add_pdfs', md: 'add_mds', txt: 'add_texts', @@ -260,19 +260,19 @@ const SyncFiles = async () => { console.error("同 步 错 误 :", error); } } - console.log("fileList.value完成",fileList.value) + // console.log("fileList.value完成",fileList.value) message.success("同步完成! ") emitUpdatePage() } const emitUpdatePage = () => { - console.log("emitUpdatePage",fileList.value) + // console.log("emitUpdatePage",fileList.value) let result:number[] = []; for (const pe of fileList.value){ const pa = pe as UploadUserFile & {page?: number}; if (pa.page != null) { result.push(pa.page) } - console.log(result) + // console.log(result) } emit('update:fileStatus', result) } @@ -403,7 +403,7 @@ const handleFileSuccess: UploadProps['onSuccess'] = (res: any): void => { fileVerify.value = false; //判断是不是有相同名字文件 for (let i = 0; i { //删除文件链接已选择删除的链接索引 fileList.value.splice(index, 1) MysqlUrl.value.splice(index,1) + const updatedFileStatus = [...props.fileStatus]; + updatedFileStatus.splice(index, 1); + emit('update:fileStatus', updatedFileStatus); + // console.log("updatedFileStatus",updatedFileStatus) // console.log("fileList",fileList.value) // console.log("MysqlUrl",MysqlUrl.value) emitUpdateModelValue2() @@ -466,7 +470,7 @@ const handleView = (file)=> { console.error("文件不可预览"); } const fileExt = url.substring(url.length-5,url.length).trim().toLowerCase() - console.log(fileExt) + // console.log(fileExt) if (fileExt==="docx"||fileExt==="xlsx"||fileExt==="pptx"){ window.open("https://view.officeapps.live.com/op/view.aspx?src="+encodeURIComponent(url),'_blank') }else if(fileExt===".txt"||fileExt===".pdf"){ @@ -476,7 +480,7 @@ const handleView = (file)=> { //文件下载时文件名为原来名字 const downloadFile = async (file)=> { - console.log("file",file) + // console.log("file",file) //使用 fetch API 请求文件并返回 Blob 数据 const response = await fetch(file.url); //获取 response blob 属性 @@ -540,23 +544,8 @@ watch( ...(val as string[]).map((url) => ({ name: url,url: url})) ); } - console.log("fileList", fileList.value) - console.log("props.fileStatus", props.fileStatus) + // console.log("fileList", fileList.value) // console.log("MysqlUrl", MysqlUrl.value) - - if (!props.fileStatus) { - lod.value=false; - console.log("为空", val); - return; // 如果 val 为空或者不是数组,直接返回 - } - // props.fileStatus.forEach((item, index) => { - // fileList.value[index].page = item - // if (item == 10 ){ - // fileList.value[index].lodTxt = "错误" - // }else{ - // fileList.value[index].lodTxt = "完成" - // } - // }); }, { immediate: true, deep: true } ) @@ -565,10 +554,8 @@ watch( (val:number[]) => { if (!val) { lod.value=false; - console.log("为空", val); - return; // 如果 val 为空或者不是数组,直接返回 + return; } - console.log("ileList.value",fileList.value) val.forEach((item, index) => { fileList.value[index].page = item if (item == 10 ){ @@ -577,7 +564,7 @@ watch( fileList.value[index].lodTxt = "完成" } }); - console.log("ileList.value",fileList.value) + // console.log("fileList int",fileList.value) }, { immediate: true, deep: true } )