From 0f8890674f53d91df2a0dacd4dcb3e765073b8ad Mon Sep 17 00:00:00 2001 From: huangyuxuan Date: Tue, 18 Feb 2025 17:55:29 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E=E5=8A=9F=E8=83=BD](hyx=5F20?= =?UTF-8?q?25-01-13=5Fxgf2.0):=20-=20=E7=9B=B8=E5=85=B3=E6=96=B9APP2.0?= =?UTF-8?q?=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/certificate_information/add.vue | 16 +++++++--------- pages/mine/information/index.vue | 1 + pages/mine/information/update.vue | 1 + store/index.js | 1 + utils/request.js | 11 +++++++++-- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/pages/certificate_information/add.vue b/pages/certificate_information/add.vue index 0ae6497..0518f0f 100644 --- a/pages/certificate_information/add.vue +++ b/pages/certificate_information/add.vue @@ -335,20 +335,18 @@ export default { this.form.REVIEW_TIME = uni.$u.timeFormat(event.value, 'yyyy-mm-dd') }, fnAfterRead(event) { - var houzhui = event.file.url.replace(/.+\./, ""); - console.log(houzhui); - if (houzhui == "jpg" || houzhui == "png") { - this.form.fileList.push(event.file) + var houzhui = event.file.name.split('.').pop().toLowerCase(); + console.log(houzhui) + if (['jpg', 'png'].includes(houzhui)) { + this.form.fileList.push(event.file); } else { - uni.$u.toast('图片格式不正确,请上传jpg格式图片或者png格式图片') - this.form.fileList = [] - + uni.$u.toast('图片格式不正确,请上传jpg格式图片或者png格式图片'); } }, fnAfterRead1(event) { - var houzhui = event.file.url.replace(/.+\./, ""); + var houzhui = event.file.name.split('.').pop().toLowerCase(); console.log(houzhui); - if (houzhui == "jpg" || houzhui == "png") { + if (['jpg', 'png'].includes(houzhui)) { this.form.fileListBack.push(event.file) } else { uni.$u.toast('图片格式不正确,请上传jpg格式图片或者png格式图片') diff --git a/pages/mine/information/index.vue b/pages/mine/information/index.vue index 80aaf8e..5072063 100644 --- a/pages/mine/information/index.vue +++ b/pages/mine/information/index.vue @@ -166,6 +166,7 @@ export default { }) } let resData = await getUserInfo({ + USER_ID: this.userInfo.USER_ID, CORPINFO_ID: this.userInfo.CORPINFO_ID, EMPLOYMENT_APPLY_MANAGEMENT_ID: this.EMPLOYMENT_APPLY_MANAGEMENT_ID }) diff --git a/pages/mine/information/update.vue b/pages/mine/information/update.vue index ace4771..de2a1fe 100644 --- a/pages/mine/information/update.vue +++ b/pages/mine/information/update.vue @@ -1032,6 +1032,7 @@ export default { USER_ID: result.pd.USER_ID, PHOTO: this.$filePath + result.pd.PHOTO, userPhoto: this.$filePath + result.pd.PHOTO, + token: this.userInfo.token }) uni.$u.toast('保存成功') setTimeout(() => { diff --git a/store/index.js b/store/index.js index cf0b9e9..e334391 100644 --- a/store/index.js +++ b/store/index.js @@ -15,6 +15,7 @@ const store = new Vuex.Store({ USERNAME: "", USER_ID: "", PHOTO: "", + token: "" }, }, getters: { diff --git a/utils/request.js b/utils/request.js index 62d0e9c..005c26c 100644 --- a/utils/request.js +++ b/utils/request.js @@ -1,4 +1,4 @@ -let requestPath = 'https://qggf.qhdsafety.com/xgfApi/'; // 后台请求地址 +let requestPath = 'http://192.168.0.104:8059/xgf_gwj'; // 后台请求地址 // let requestPath = 'https://skqhdg.porthebei.com:9006/qa-prevention-xgf/'; // 后台请求地址 // let requestPath = 'https://qgxgf.qhdsafety.com/qa-prevention-xgf/'; // 外网地址 import store from '../store/index' @@ -19,7 +19,8 @@ function post(url, data) { }, method: 'POST', header: { - 'Content-type': data?.postMethod || 'application/x-www-form-urlencoded' + 'Content-type': data?.postMethod || 'application/x-www-form-urlencoded', + 'token': store.state.userInfo.token || '' }, success: (res) => { if (res.statusCode != 200){ @@ -71,6 +72,9 @@ function upload(url, data) { filePath: data.filePath, name: data.name || 'file', formData: data.formData || {}, + header: { + 'token': store.state.userInfo.token || '' + }, success: (res) => { uni.hideLoading(); if (JSON.parse(res.data).result === 'success') { @@ -108,6 +112,9 @@ function uploads(url, data) { url: requestPath + url, files: data.files, formData: data.formData || {}, + header: { + 'token': store.state.userInfo.token || '' + }, success: (res) => { uni.hideLoading(); if (JSON.parse(res.data).result === 'success') {