diff --git a/pages/me/confirmInfo.vue b/pages/me/confirmInfo.vue index a3011f8..bf2e758 100644 --- a/pages/me/confirmInfo.vue +++ b/pages/me/confirmInfo.vue @@ -15,14 +15,15 @@ {{bankInfo.auditStatus=='apply'?i18n.apply:bankInfo.auditStatus=='agree'?i18n.agree:i18n.reject}} - - + + {{ i18n.Reasonforrejection }} - + {{bankInfo.auditReason}} - - + + {{ i18n.FirstName }} @@ -42,26 +43,27 @@ {{ i18n.IDcard }} - - - - - - - - - - + + + + + + + + + + - - - + + + - + {{ i18n.Confirm }} @@ -79,7 +81,9 @@ name: "withdrawalRecord", data() { return { - hideButton:false, + language: '', + ticket: '', + hideButton: false, baseURL: '', fileList1: [], rules: { @@ -95,12 +99,12 @@ message: this.$t('withdrawal').enterIdNumber, trigger: ['blur', 'change'] }, - + }, bankInfo: { name: null, certId: null, - certFrontImgPath:null + certFrontImgPath: null }, pageState: 'addBank', // 页面状态,是添加还是编辑银行卡 @@ -120,6 +124,8 @@ } }, onLoad(option) { + this.language = uni.getStorageSync("language") || 'en_US'; + this.ticket = uni.getStorageSync('ticket') this.getBank() this.baseURL = constant.BASE_URL }, @@ -128,6 +134,7 @@ // 删除图片 deletePic(event) { this[`fileList${event.name}`].splice(event.index, 1) + this.bankInfo.certFrontImgPath = null; }, // 新增图片 @@ -138,7 +145,6 @@ }) // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式 let lists = [].concat(event.file) - console.log(event) let fileListLen = this[`fileList${event.name}`].length lists.map((item) => { this[`fileList${event.name}`].push({ @@ -158,86 +164,47 @@ fileListLen++ } }, - + uploadFilePromise(url) { - // #ifdef APP-PLUS console.log(url) - pathToBase64(url) - .then(path => { - console.log(path) - let res=path - res = res.split(',')[1] - console.log(res,'res') - return new Promise((resolve, reject) => { - api.uploadImg({ - img: res - }).then(res => { + return new Promise((resolve, reject) => { + let a = uni.uploadFile({ + url: this.baseURL + '/api/user/uploadImg1', // 仅为示例,非真实的接口地址 + filePath: url, + name: 'file', + formData: { + ticket: this.ticket, + lang: this.language, + }, + success: (res) => { + setTimeout(() => { uni.hideLoading() - this.bankInfo.certFrontImgPath=res - }) - }) - }) - .catch(error => { - uni.hideLoading() - console.error(error) - }) - - // #endif - // #ifdef H5 - const image = new Image() // 新建一个img标签(还没嵌入DOM节点) - //blob:http://localhost:8080/b878edea-e649-4f8d-b723-c3f25454141b - image.src = url; - image.onload = () => { - const canvas = document.createElement('canvas') - canvas.width = image.width - canvas.height = image.height - const context = canvas.getContext('2d') - context.drawImage(image, 0, 0, image.width, image.height); - let imgUrl = canvas.toDataURL() //图片的base64地址 - imgUrl = imgUrl.split(',')[1] - return new Promise((resolve, reject) => { - api.uploadImg({ - img: imgUrl - }).then(res => { - this.bankInfo.certFrontImgPath=res - console.log(res) - console.log(this.bankInfo.certFrontImgPath) - }) - }) - - } - // #endif + let data = JSON.parse(res.data) + this.bankInfo.certFrontImgPath = data.data + }, 1000) + }, + failed(res) { + uni.hideLoading() + console.log(res) + } + }); + }) }, - - - - getBase64(file) { - return new Promise((resolve, reject) => { - const reader = new FileReader() - reader.readAsDataURL(file) - reader.onload = () => resolve(reader.result) - reader.onerror = (error) => reject(error) + // 获取实名信息 + getBank() { + api.certificationInfo().then(res => { + this.bankInfo = res; + this.bankInfo.certFrontImgPath = res.certFrontImg + if (this.bankInfo.auditStatus == 'agree' || this.bankInfo.auditStatus == 'apply') { + this.hideButton = true + } }) }, - - - - // 获取实名信息 - getBank() { - api.certificationInfo().then(res => { - this.bankInfo = res; - this.bankInfo.certFrontImgPath=res.certFrontImg - if(this.bankInfo.auditStatus=='agree'||this.bankInfo.auditStatus=='apply'){ - this.hideButton=true - } - }) - }, - // 修改或添加实名信息 bank() { - if(!this.bankInfo.certFrontImgPath){ + if (!this.bankInfo.certFrontImgPath) { uni.$u.toast(this.$t("withdrawal").enterIdCard) return; } @@ -248,9 +215,9 @@ certFrontImgPath: this.bankInfo.certFrontImgPath } api.certification(bankInfo).then(res => { - uni.$u.toast(this.$t("me").addSuccessfully) - this.getBank() - + uni.$u.toast(this.$t("me").addSuccessfully) + this.getBank() + }) }).catch(errors => { console.log('err') @@ -261,20 +228,21 @@