diff --git a/http/login.js b/http/login.js index c2e6d6c..17e915d 100644 --- a/http/login.js +++ b/http/login.js @@ -24,8 +24,34 @@ export const register = (data) => { data, }); }; +// 身份验证 +export const chenckId = (data) => { + return http.request({ + url: "/api/wxuser/ocr", + method: "POST", + data, + }); +}; +// 法大大 +export const fddRealName = (data) => { + return http.request({ + url: "/api/wxuser/bind/fdd", + method: "POST", + data, + }); +}; +//法大大是否验证 +export const checkFdd = () => { + return http.request({ + url: "/api/wxuser/fdd/check", + method: "POST", + }); +}; export default { login, getTel, register, + chenckId, + fddRealName, + checkFdd, }; diff --git a/pages.json b/pages.json index 3ac282e..38d7a78 100644 --- a/pages.json +++ b/pages.json @@ -34,6 +34,16 @@ } } }, + { + "path": "pages/realName/FDDRegister", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "app-plus": { + "titleNView": false // 禁用原生导航 + } + } + }, { "path": "pages/cameraContext/cameraContext", "style": { diff --git a/pages/realName/FDDRegister.vue b/pages/realName/FDDRegister.vue new file mode 100644 index 0000000..1c08014 --- /dev/null +++ b/pages/realName/FDDRegister.vue @@ -0,0 +1,33 @@ + + + + + \ No newline at end of file diff --git a/pages/realName/realName.vue b/pages/realName/realName.vue index 95b785c..af9904d 100644 --- a/pages/realName/realName.vue +++ b/pages/realName/realName.vue @@ -61,14 +61,14 @@ 法大大认证 - + 前往认证 - + @@ -97,19 +97,30 @@ export default { fileList: [], fileList2: [], video: '', - isfinish: false + isfinish: false, + isChecked: false }; }, - onLoad(options) { - if(options.tempVideoPath){ - this.isfinish = JSON.parse(options.isfinish)||false - this.video = options.tempVideoPath; - this.uploadFilePromise(options.tempVideoPath,'video') + async onLoad(options) { + if (options.tempVideoPath) { + this.isfinish = JSON.parse(options.isfinish) || false + this.video = await this.uploadFilePromise(options.tempVideoPath) + console.log('this.video',this.video) + const data = { + num: uni.getStorageSync("info").name || '', + name: uni.getStorageSync("info").num || '', + fileList: uni.getStorageSync("info").fileList || [], + fileList2: uni.getStorageSync("info").fileList2, + video: this.video + } + uni.setStorageSync("info", data) } - this.name = uni.getStorageSync("info").name||'' - this.num = uni.getStorageSync("info").num||'' - this.fileList = uni.getStorageSync("info").fileList||[] - this.fileList2 = uni.getStorageSync("info").fileList2||[] + this.name = uni.getStorageSync("info").name || '' + this.num = uni.getStorageSync("info").num || '' + this.fileList = uni.getStorageSync("info").fileList || [] + this.fileList2 = uni.getStorageSync("info").fileList2 || [] + this.video = uni.getStorageSync("info").video || '' + // this.isFdd = uni.getStorageSync("isFdd") || false uni.removeStorageSync("info") }, methods: { @@ -132,13 +143,6 @@ export default { uni.setStorageSync("info", data) }, async completeRegistration() { - if (!this.checked.length) return this.$common.msgToast("请阅读并勾选协议"); - if (!this.checked.length) return this.$common.msgToast("请阅读并勾选协议"); - if (!this.name) return this.$common.msgToast("请输入姓名"); - if (!this.num) return this.$common.msgToast("请输入身份证号"); - if (!this.fileList.length) return this.$common.msgToast("请上传身份证人面像"); - if (!this.fileList2.length) return this.$common.msgToast("请上传身份国徽面"); - if (!this.video) return this.$common.msgToast("请上传人脸识别视频"); console.log({ telNum: uni.getStorageSync("telNum"), realNameIDName: this.num, @@ -147,19 +151,32 @@ export default { realIDImgA: this.fileList[0]?.url, realIDImgB: this.fileList2[0].url }) - const res = await this.$api.login.register({user:{ - telNum: uni.getStorageSync("telNum"), - realNameIDName: this.num, - realName: this.name, - video: this.video, - realIDImgA: this.fileList[0]?.url, - realIDImgB: this.fileList2[0]?.url - }}) + this.checkFdd().then((res) => { + if (!res) return this.$common.msgToast("法大大验证未通过") + }) + if (!this.checked.length) return this.$common.msgToast("请阅读并勾选协议"); + if (!this.checked.length) return this.$common.msgToast("请阅读并勾选协议"); + if (!this.name) return this.$common.msgToast("请输入姓名"); + if (!this.num) return this.$common.msgToast("请输入身份证号"); + if (!this.fileList.length) return this.$common.msgToast("请上传身份证人面像"); + if (!this.fileList2.length) return this.$common.msgToast("请上传身份国徽面"); + if (!this.video) return this.$common.msgToast("请上传人脸识别视频"); + + const res = await this.$api.login.register({ + user: { + telNum: uni.getStorageSync("telNum"), + realNameIDName: this.num, + realName: this.name, + video: this.video, + realIDImgA: this.fileList[0]?.url, + realIDImgB: this.fileList2[0]?.url + } + }) if (res.status === 0) { uni.switchTab({ url: '/pages/home/index' }); - }else{ + } else { this.$common.msgToast(res.msg) } @@ -185,7 +202,8 @@ export default { }) }) for (let i = 0; i < lists.length; i++) { - const result = await this.uploadFilePromise(lists[i].url) + const result = await this.uploadFilePromise(lists[i].url, 'check') + console.log(result) let item = this[`fileList`][fileListLen] this[`fileList`].splice(fileListLen, 1, Object.assign(item, { status: 'success', @@ -217,24 +235,71 @@ export default { fileListLen++ } }, - uploadFilePromise(url,type=null) { - console.log(url) + uploadFilePromise(url, type = null) { return new Promise((resolve) => { uni.uploadFile({ url: http.baseUrl + "/api/wxuser/uploadpic", filePath: url, name: "file", success: (res) => { - console.log(9999999999999999999,res) - res.data = JSON.parse(res.data); - resolve(res.data.data.path); - if(type ==='video'){ - this.video = res.data.data.path + const { path } = JSON.parse(res.data).data; + console.log('@@@@', path) + resolve(path); + if (type === 'check') { + this.chenckId(path) } }, }); - }); + }) }, + async chenckId(realIDImgA) { + const res = await this.$api.login.chenckId({ realIDImgA }) + if (res.status === 0) { + this.num = res.data.iDNum + this.name = res.data.realName + } else { + this.$common.msgToast(res.msg) + } + }, + async fddRealName() { + const data = { + num: this.num, + name: this.name, + fileList: this.fileList, + fileList2: this.fileList2, + video: this.video + } + console.log(data, 'data') + uni.setStorageSync("info", data) + const mobile = uni.getStorageSync("telNum") + const res = await this.$api.login.fddRealName({ + customerName: this.name, + customerIdentNo: this.num, + mobile + }) + if (res.status === 0) { + uni.setStorage({ + key: "fddUrl", + data: res.data?.url, + success: function () { + uni.navigateTo({ + url: "/pages/realName/FDDRegister", + }); + }, + }); + } else { + this.$common.msgToast(res.msg) + } + }, + checkFdd() { + return this.$api.login.checkFdd().then((res) => { + if (res.status === 0) { + return res.data.isVerify + } else { + this.$common.msgToast(res.msg) + } + }) + } } };