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)