From cfb7e9bd5db4d182ac7318ffded750b782702ce3 Mon Sep 17 00:00:00 2001 From: 26947 <12@1> Date: Sat, 25 May 2024 09:34:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=87=E4=BB=B6=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/common/file/fileUpload/index.vue | 26 +++++++++++++++++++++++--- pages/work/index.vue | 4 ++-- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/pages/common/file/fileUpload/index.vue b/pages/common/file/fileUpload/index.vue index c817c31..5a80e76 100644 --- a/pages/common/file/fileUpload/index.vue +++ b/pages/common/file/fileUpload/index.vue @@ -76,6 +76,7 @@ const form = reactive({ // 新增图片 const afterRead = async (event) => { + console.log("event:",event) let name = event.name; let lists = [].concat(event.file); let fileListLen = fileList1.value.length; @@ -97,7 +98,6 @@ const afterRead = async (event) => { url: store.state.user.QNDomain+result, furl:result }); - console.log("返回的数据:", store.state.user.QNDomain+result); emit('fileList', fileList1.value); fileListLen++; } catch (error) { @@ -107,8 +107,18 @@ const afterRead = async (event) => { }; const uploadFilePromise = async (fileInfo1, name) => { - fileInfo.name = store.state.user.phoneType + "_" + name; + console.log("fileInfo1:",fileInfo1.name) + let fileNameOld = [0,1] + if(fileInfo1.name !== undefined){ + fileNameOld = fileInfo1.name.split('.') + } + + fileInfo.name =fileNameOld[0]+"_"+ store.state.user.phoneType + "_" + name; let extension1 = fileInfo1.url.split('.'); + //防止h5报错 + if(extension1[1] == null){ + extension1[1] = fileNameOld[1] + } fileInfo.type = fileInfo1.type + "/" + extension1[1]; fileInfo.extension = extension1[1]; try { @@ -122,7 +132,17 @@ const uploadFilePromise = async (fileInfo1, name) => { throw error; } }; - +const observer = { + next(res){ + console.log("next:",res) + }, + error(err){ + console.log("error:",err) + }, + complete(res){ + console.log("complete:",res) + } +} const uploadQN = (file) => { return new Promise((resolve, reject) => { uni.uploadFile({ diff --git a/pages/work/index.vue b/pages/work/index.vue index c5938fb..e1c6c5d 100644 --- a/pages/work/index.vue +++ b/pages/work/index.vue @@ -71,7 +71,7 @@ - + @@ -87,7 +87,7 @@ import fileUpload from './../common/file/fileUpload/index.vue' import {ref, reactive} from 'vue' import { useStore } from 'vuex'; const store = useStore(); - +const fileTypeInfo = ref("images,video") const QNDomain = store.state.user.QNDomain const current = ref(0) const swiperDotIndex = ref(0)