From b2d5fa43338c140452dfb7ba6dcd7f72d43b19a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=9E=E4=B8=9C=E6=97=AD?= <850374051@qq.com> Date: Thu, 15 Jun 2023 16:47:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E6=9D=83=E4=BA=A4=E6=98=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/register/index.js | 8 ++ src/views/register/companyRegister.vue | 36 ++++- src/views/register/userRegister.vue | 74 +++++++++- .../userInformation/companyInformation.vue | 76 +++++------ .../userInformation/userInformation.vue | 127 ++++++++++++------ 5 files changed, 237 insertions(+), 84 deletions(-) diff --git a/src/api/register/index.js b/src/api/register/index.js index 537d9803..3f0ae976 100644 --- a/src/api/register/index.js +++ b/src/api/register/index.js @@ -37,4 +37,12 @@ export function userRegister(data) { data: data }) } +//注册 +export function base64Upload(data) { + return request({ + url: '/transaction/website/common/base64Upload', + method: 'post', + data: data + }) +} diff --git a/src/views/register/companyRegister.vue b/src/views/register/companyRegister.vue index 41d2114e..4b72f058 100644 --- a/src/views/register/companyRegister.vue +++ b/src/views/register/companyRegister.vue @@ -49,6 +49,11 @@ + + +
立即注册 @@ -59,7 +64,7 @@ diff --git a/src/views/register/userRegister.vue b/src/views/register/userRegister.vue index 00ad0273..d4cedcc2 100644 --- a/src/views/register/userRegister.vue +++ b/src/views/register/userRegister.vue @@ -39,6 +39,16 @@ + + + + + +
立即注册 @@ -49,7 +59,8 @@ diff --git a/src/views/user/accountSetting/userInformation/companyInformation.vue b/src/views/user/accountSetting/userInformation/companyInformation.vue index 2775cdbc..71bbdfcb 100644 --- a/src/views/user/accountSetting/userInformation/companyInformation.vue +++ b/src/views/user/accountSetting/userInformation/companyInformation.vue @@ -66,12 +66,11 @@ - + -

*身份证照片、本人和身份证的合影

保存
@@ -83,6 +82,7 @@ import { getInfo } from "@/api/login/index"; import { getMember , base64Attach , userUpdate , showUserImg , deleteUserImg} from "@/api/user/index"; import {Dialog} from "vant"; +import {base64Upload} from "@/api/register"; export default { name: "companyInformation", data() { @@ -98,6 +98,7 @@ export default { companyNameValue:'', fileList:[], companyNameList:[], + fileListKHZM:[], form: { files:[], fileType:'', @@ -110,7 +111,6 @@ export default { idCardNum:'', realname:'', companyCode:'', - companyName:'', companyNature:'', companyScope:'', companyTimeLimit:'', @@ -118,6 +118,7 @@ export default { companyCapital:'', companyLicense:'', address:'', + accountOpenCert:'', }, userInfo:[], upLoadList:[] @@ -165,6 +166,13 @@ export default { this.userForm.companyLicense = response.data.companyLicense; this.userForm.address = response.data.address; + if (response.data.accountOpenCert!=''){ + this.fileListKHZM = [{ + url:'/api'+response.data.accountOpenCert, + isImage: true + }]; + } + this.tel = response.data.phone this.getDicts("company_nature").then(res => { @@ -184,50 +192,42 @@ export default { }); }); }, - afterRead(file) { + afterReadKHZM(file) { // 此时可以自行将文件上传至服务器 - console.log(this.fileList) - for ( var i = 0 ; i < this.fileList.length ; i++){ - console.log(this.fileList[i].url) - if(this.fileList[i].url == undefined&&this.fileList!='') { - this.fileList[i] = {url:this.fileList[i].content, id: '', isImage: true}; - } - } + let params1 = new FormData(); + params1.append("file", file.content); + base64Upload(params1).then((r1) => { + this.userForm.accountOpenCert = r1.fileName; + }) }, - deleteFile(elIndex){ - if(elIndex.id != ''){ - deleteUserImg(elIndex.id).then(response => {}); - } + deleteFileKHZM(elIndex){ return (file, name) => { let fileIndex = name.index - this.fileList[elIndex].splice(fileIndex, 1) - this.upLoadList[elIndex].splice(fileIndex, 1) + this.fileListKHZM[elIndex].splice(fileIndex, 1) + this.userForm.accountOpenCert = ''; } }, submitForm(){ - this.form.files = []; + if (this.userForm.accountOpenCert == ''){ + this.$toast({ + icon: 'error', // 找到自己需要的图标 + message: '请上传开户证明', + duration:"2000", + onClose:function(){ + } + }) + return; + } userUpdate(this.userForm).then(response => { if(response.code == 200) { - var imgList = []; - console.log(this.fileList) - for (var i = 0; i < this.fileList.length; i++) { - if (this.fileList[i].url.indexOf('http') == -1 && this.fileList != '') { - this.form.files.push(this.fileList[i].url); - } - } - console.log(this.form.files) - base64Attach(this.form).then(responseSecond => { - if (responseSecond.code == 200) { - Dialog.confirm({ - title: '系统提示', - message: '修改成功', - confirmButtonText: '确定', + Dialog.confirm({ + title: '系统提示', + message: '修改成功', + confirmButtonText: '确定', + }) + .then(() => { + this.onClickLeft() }) - .then(() => { - this.onClickLeft() - }) - } - }); } }); } diff --git a/src/views/user/accountSetting/userInformation/userInformation.vue b/src/views/user/accountSetting/userInformation/userInformation.vue index b4350609..6eea35d0 100644 --- a/src/views/user/accountSetting/userInformation/userInformation.vue +++ b/src/views/user/accountSetting/userInformation/userInformation.vue @@ -16,9 +16,14 @@ - + + + +
@@ -32,6 +37,7 @@ import { getInfo } from "@/api/login/index"; import { getMember , base64Attach , userUpdate , showUserImg , deleteUserImg} from "@/api/user/index"; import {Dialog} from "vant"; +import {base64Upload} from "@/api/register"; export default { name: "userInformation", data() { @@ -44,15 +50,19 @@ export default { fileType:'', bizPath:'transaction', tableName:'t_transaction_member', - tableId:'' + tableId:'', }, userForm:{ idCardNum:'', realname:'', address:'', + idCardPic :'', + accountOpenCert:'', }, userInfo:[], - upLoadList:[] + upLoadList:[], + fileListSFZ:[], + fileListYHK:[] }; }, created() { @@ -69,55 +79,92 @@ export default { this.userForm.address = response.data.address; this.userForm.id = response.data.id; this.form.tableId = response.data.id; - this.tel = response.data.phone - showUserImg(response.data.id).then(responseSecond => { - console.log(responseSecond) - for (var i = 0 ; i < responseSecond.data.length ; i++){ - this.fileList.push({url:this.global.severApi+responseSecond.data[i].fileUrl,id:responseSecond.data[i].id}) - } - }); + this.tel = response.data.phone; + + if (response.data.idCardPic!=''){ + this.fileListSFZ = [{ + url:'/api'+response.data.idCardPic, + isImage: true + }]; + } + + if (response.data.accountOpenCert!=''){ + this.fileListYHK = [{ + url:'/api'+response.data.accountOpenCert, + isImage: true + }]; + } + + + + // showUserImg(response.data.id).then(responseSecond => { + // console.log(responseSecond) + // for (var i = 0 ; i < responseSecond.data.length ; i++){ + // this.fileList.push({url:this.global.severApi+responseSecond.data[i].fileUrl,id:responseSecond.data[i].id}) + // } + // }); }); }); }, - afterRead(file) { + afterReadSFZ(file) { // 此时可以自行将文件上传至服务器 - for ( var i = 0 ; i < this.fileList.length ; i++){ - console.log(this.fileList[i].url) - if(this.fileList[i].url == undefined&&this.fileList!='') { - this.fileList[i] = {url:this.fileList[i].content, id: '', isImage: true}; - } - } + let params1 = new FormData(); + params1.append("file", file.content); + base64Upload(params1).then((r1) => { + this.userForm.idCardPic = r1.fileName; + }) }, - deleteFile(elIndex){ - if(elIndex.id != ''){ - deleteUserImg(elIndex.id).then(response => {}); + afterReadYHK(file) { + // 此时可以自行将文件上传至服务器 + let params1 = new FormData(); + params1.append("file", file.content); + base64Upload(params1).then((r1) => { + this.userForm.accountOpenCert = r1.fileName; + }) + }, + deleteFileSFZ(elIndex){ + return (file, name) => { + let fileIndex = name.index + this.fileListSFZ[elIndex].splice(fileIndex, 1) + this.userForm.idCardPic = ''; } + }, + deleteFileYHK(elIndex){ return (file, name) => { let fileIndex = name.index - this.fileList[elIndex].splice(fileIndex, 1) - this.upLoadList[elIndex].splice(fileIndex, 1) + this.fileListYHK[elIndex].splice(fileIndex, 1) + this.userForm.accountOpenCert = ''; } }, submitForm(){ - this.form.files = []; - userUpdate(this.userForm).then(response => { - var imgList = []; - console.log(this.fileList) - for (var i = 0 ; i < this.fileList.length ; i++){ - if(this.fileList[i].url.indexOf('http') == -1&&this.fileList!=''){ - this.form.files.push(this.fileList[i].url); + if (this.userForm.idCardPic == ''){ + this.$toast({ + icon: 'error', // 找到自己需要的图标 + message: '请上传身份证', + duration:"2000", + onClose:function(){ } - } - console.log(this.form.files) - base64Attach(this.form).then(responseSecond => { - if(response.code == 200 && responseSecond.code == 200){ - Dialog.confirm({ - title: '系统提示', - message: '修改成功', - confirmButtonText: '确定', - }) + }) + return; + } + if (this.userForm.accountOpenCert == ''){ + this.$toast({ + icon: 'error', // 找到自己需要的图标 + message: '请上传银行卡', + duration:"2000", + onClose:function(){ } - }); + }) + return; + } + userUpdate(this.userForm).then(response => { + if(response.code == 200){ + Dialog.confirm({ + title: '系统提示', + message: '修改成功', + confirmButtonText: '确定', + }) + } }); } },