From afcd0a537eee932fc323cc8c7dc26a5b49fe5b12 Mon Sep 17 00:00:00 2001 From: "Mr.jiang" <714156421@qq.com> Date: Wed, 14 Aug 2024 16:38:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A4=E8=AF=81=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- my/renzheng/index.vue | 198 +++++++++++++++++++++++++++++++++--------- pages/index/index.vue | 2 +- pages/my/index.vue | 2 +- pages/my/user.vue | 2 +- pages/order/index.vue | 8 +- 5 files changed, 162 insertions(+), 50 deletions(-) diff --git a/my/renzheng/index.vue b/my/renzheng/index.vue index 07cf42d..8f84bb9 100644 --- a/my/renzheng/index.vue +++ b/my/renzheng/index.vue @@ -49,6 +49,15 @@ + + 请选择认证类型 + + + {{item.value}} + + + 上传身份证正面 @@ -244,6 +253,7 @@ export default { data() { return { + selected:[], showAgree: false, form: { name: '', @@ -314,9 +324,10 @@ closeable: true, XCXIsSelect: '否', renzhengStatus: false, + typeList:[], } }, - onLoad(e) { + onLoad() { this.XCXIsSelect = this.$queue.getData("XCXIsSelect"); if (this.XCXIsSelect != '否') { uni.setNavigationBarTitle({ @@ -327,9 +338,10 @@ title: '关于我们' }) } - if (e.id) { - this.typeId = e.id; - } + // if (e.id) { + // this.typeId = e.id; + // } + this.fuwuType() this.getUserInfo() this.renzheng = uni.getStorageSync("renzheng") @@ -369,6 +381,31 @@ this.checkRenzhengStatus(); }, methods: { + gukeBtn(item) { + var index = this.selected.indexOf(item); + if (index === -1) { + this.selected.push(item); + } else { + this.selected.splice(index, 1); + } + var data = []; + for (var i = 0; i < this.selected.length; i++) { + data.push(this.selected[i].id) + } + this.typeId = data.join(",") + console.log("this.typeId",this.typeId) + }, + fuwuType(){ + this.$Request.get("/app/dict/list", { + type: '服务类型' + }).then(res => { + if (res.code == 0) { + if (res.data) { + this.typeList = res.data + } + } + }); + }, checkRenzhengStatus() { if ((this.renzheng == 0 || this.renzheng == 3) && (this.renzheng !== 1 || this.renzheng !== 2)) { this.renzhengStatus = false; @@ -502,6 +539,14 @@ }) return; } + if (!this.typeId) { + uni.showToast({ + title: '请输选择认证类型!', + icon: 'none', + duration: 1000 + }) + return; + } let regX = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/; if (!regX.test(this.form.idNumber)) { @@ -645,7 +690,7 @@ this.form.idNumber = res.data.idNumber ? res.data.idNumber : '' this.form.front = res.data.front ? res.data.front : '' this.form.back = res.data.back ? res.data.back : '' - this.classify = res.data.classify + this.classify = res.data.classify; this.form.address = res.data.address this.form.describes = res.data.individualResume this.form.birthdate = res.data.birthdate @@ -690,29 +735,48 @@ success: res => { for (let i = 0; i < res.tempFilePaths.length; i++) { that.$queue.showLoading("上传中..."); - uni.uploadFile({ // 上传接口 - //url: websocketUtils.uploadFileUrl(), //真实的接口地址 - url: urlName, - filePath: res.tempFilePaths[i], - name: 'file', - success: (uploadFileRes) => { - if (e == 3) { - if (that.infantImg.length <= 5) { - that.infantImg.push(JSON.parse(uploadFileRes.data) - .data) - + uni.getFileInfo({ + filePath: res.tempFilePaths[i], + success: (infoRes) => { + const size = infoRes.size; + if (size / 1024 / 1024 > 2) { + // 图片大于2MB + uni.showToast({ + icon:'error', + title:'图片超出2MB限制,请重新选择' + }) + } else { + // 图片小于等于2MB + uni.uploadFile({ // 上传接口 + //url: websocketUtils.uploadFileUrl(), //真实的接口地址 + url: urlName, + filePath: res.tempFilePaths[i], + name: 'file', + success: (uploadFileRes) => { + if (e == 3) { + if (that.infantImg.length <= 5) { + that.infantImg.push(JSON.parse(uploadFileRes.data) + .data) + + } + } else if (e == 2) { + if (that.certificateImg.length <= 5) { + that.certificateImg.push(JSON.parse(uploadFileRes.data) + .data) + // that.image = JSON.parse(uploadFileRes.data) + // .data + } + } + uni.hideLoading(); } - } else if (e == 2) { - if (that.certificateImg.length <= 5) { - that.certificateImg.push(JSON.parse(uploadFileRes.data) - .data) - // that.image = JSON.parse(uploadFileRes.data) - // .data - } - } - uni.hideLoading(); - } + }); + } + }, + fail: () => { + cons.log("上传失败") + } }); + } } }) @@ -725,23 +789,42 @@ success: res => { for (let i = 0; i < res.tempFilePaths.length; i++) { that.$queue.showLoading("上传中..."); - uni.uploadFile({ // 上传接口 - url: websocketUtils.uploadFileUrl(), //真实的接口地址 - filePath: res.tempFilePaths[i], - name: 'file', - success: (uploadFileRes) => { - if (e == 1) { - that.form.front = JSON.parse(uploadFileRes.data).data - } else if (e == 2) { - that.form.back = JSON.parse(uploadFileRes.data).data - } else if (e == 4) { - that.form.headImg = JSON.parse(uploadFileRes.data).data - console.log(that.form.headImg) - } - uni.hideLoading(); - - } + uni.getFileInfo({ + filePath: res.tempFilePaths[i], + success: (infoRes) => { + const size = infoRes.size; + if (size / 1024 / 1024 > 2) { + // 图片大于2MB + uni.showToast({ + icon:'error', + title:'图片超出2MB限制,请重新选择' + }) + } else { + // 图片小于等于2MB + uni.uploadFile({ // 上传接口 + url: websocketUtils.uploadFileUrl(), //真实的接口地址 + filePath: res.tempFilePaths[i], + name: 'file', + success: (uploadFileRes) => { + if (e == 1) { + that.form.front = JSON.parse(uploadFileRes.data).data + } else if (e == 2) { + that.form.back = JSON.parse(uploadFileRes.data).data + } else if (e == 4) { + that.form.headImg = JSON.parse(uploadFileRes.data).data + console.log(that.form.headImg) + } + uni.hideLoading(); + + } + }); + } + }, + fail: () => { + cons.log("上传失败") + } }); + } } }) @@ -926,7 +1009,36 @@ } -