From e79a23e6dc965b9eef4755a80be679301192d351 Mon Sep 17 00:00:00 2001 From: "yang.huaxiang" Date: Tue, 27 Oct 2020 17:48:22 +0800 Subject: [PATCH 1/4] =?UTF-8?q?GFRS-1989=E3=80=90=E5=BE=85=E7=A1=AE?= =?UTF-8?q?=E5=AE=9A=E3=80=91=E5=AE=A2=E6=88=B7=E6=A0=B8=E9=AA=8C=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E4=BC=98=E5=8C=96:=20rid=20=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=A4=84=E7=90=86=20--=E6=8F=90=E4=BA=A4=E4=BA=BA=EF=BC=9A?= =?UTF-8?q?=E9=98=B3=E5=8D=8E=E7=A5=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ebiz/sale/SignatureConfirmation.vue | 79 ++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/src/views/ebiz/sale/SignatureConfirmation.vue b/src/views/ebiz/sale/SignatureConfirmation.vue index 86457f5fd..44abc1d45 100644 --- a/src/views/ebiz/sale/SignatureConfirmation.vue +++ b/src/views/ebiz/sale/SignatureConfirmation.vue @@ -332,7 +332,11 @@ export default { changeCard: localStorage.changeCard, salePageFlag: '-10', recognizeResult: '', //微信端-人脸识别结果 - recognizeMessage: '' //微信端-人脸识别失败原因 + recognizeMessage: '', //微信端-人脸识别失败原因 + realPeopleRidInfo: { + appntRidFlag: null, + insureRidFlag: null + } } }, methods: { @@ -501,6 +505,37 @@ export default { }) }) }, + // 手机号鉴权 + async realPeopleCheckMobile(type) { + this.$toast.loading({ + // 持续展示 toast + duration: 0, + // 禁用背景点击s + forbidClick: true, + loadingType: 'spinner', + message: '加载中……' + }) + let data = {} + if ('appnt' == type) { + let appntData = JSON.parse(localStorage.saleInsuredInfo) + data = { + name: appntData.name, + idType: appntData.idType, + idNo: appntData.idNo, + mobile: appntData.mobile + } + } else if ('insured' == type) { + let insuredData = JSON.parse(localStorage.saleInsuredPersonInfo) + data = { + name: insuredData.name, + idType: insuredData.idType, + idNo: insuredData.idNo, + mobile: insuredData.mobile + } + } + let res = await checkPhone(data) + return res + }, // 验证码确认事件 async authConfirm() { //清理计时器 @@ -581,6 +616,16 @@ export default { if (JSON.parse(localStorage.saleInsuredInfo).idType != '1') { that.goUrl() } else { + //RID 状态--有效 + if (this.realPeopleRidInfo.appntRidFlag && this.realPeopleRidInfo.appntRidFlag == '0') { + // 手机号鉴权 --通过 + let res = this.realPeopleCheckMobile('appnt') + if (res && res.result == '0') { + that.goUrl() + return + } + } + // 人脸识别 if (this.faceAuthCount.appnt < this.smsAuthNum) { // this.idcardData.typeface = !this.idcardData.typeface // this.idcardData.idcardName = JSON.parse(this.$route.query.saleInsuredInfo).name @@ -600,6 +645,16 @@ export default { // if (JSON.parse(this.$route.query.saleInsuredPersonInfo).idType != '1') { that.insuredUrl() } else { + //RID 状态--有效 + if (this.realPeopleRidInfo.insureRidFlag && this.realPeopleRidInfo.insureRidFlag == '0') { + // 手机号鉴权 --通过 + let res = this.realPeopleCheckMobile('insured') + if (res && res.result == '0') { + that.insuredUrl() + return + } + } + // 人脸识别 if (this.faceAuthCount.insured < this.smsAuthNum) { // this.idcardData.typeface = !this.idcardData.typeface // this.idcardData.idcardName = JSON.parse(this.$route.query.saleInsuredPersonInfo).name @@ -621,6 +676,15 @@ export default { // if (this.saleInsuredInfo.idType != '1' || this.saleInsuredInfo.age < '18') { that.goUrl() } else { + //RID 状态--有效 + if (this.realPeopleRidInfo.appntRidFlag && this.realPeopleRidInfo.appntRidFlag == '0') { + // 手机号鉴权 --通过 + let res = this.realPeopleCheckMobile('appnt') + if (res && res.result == '0') { + that.goUrl() + return + } + } if (this.faceAuthCount.appnt < this.smsAuthNum) { // 原人脸识别 console.log(this.faceAuthCount, 'faceAuthCount') @@ -653,6 +717,16 @@ export default { if (this.saleInsuredPersonInfo.idType != '1' || this.saleInsuredPersonInfo.age < '18') { that.insuredUrl() } else { + //RID 状态--有效 + if (this.realPeopleRidInfo.insureRidFlag && this.realPeopleRidInfo.insureRidFlag == '0') { + // 手机号鉴权 --通过 + let res = this.realPeopleCheckMobile('insured') + if (res && res.result == '0') { + that.insuredUrl() + return + } + } + // 人脸识别 if (this.faceAuthCount.insured < this.smsAuthNum) { // 调原生人脸识别 EWebBridge.webCallAppInJs('face_auth', { @@ -1053,6 +1127,9 @@ export default { that.recmd = res.orderDTO.recmdDTO that.orderInfo = res.orderDTO.orderInfoDTO that.insured = res.orderDTO.insuredDTOs + // 初始化RID状态 + this.realPeopleRidInfo.appntRidFlag = this.appnt.ridStatus + this.realPeopleRidInfo.insureRidFlag = this.insured[0].ridStatus //存code区分万能型产品 let productCode, riskName console.log('isDoubleMailRisk', that.orderInfo.isDoubleMailRisk) From 23058ceec6b1aaef9b946755c4685765cafdb413 Mon Sep 17 00:00:00 2001 From: "yang.huaxiang" Date: Tue, 27 Oct 2020 18:01:49 +0800 Subject: [PATCH 2/4] =?UTF-8?q?GFRS-1989=E3=80=90=E5=BE=85=E7=A1=AE?= =?UTF-8?q?=E5=AE=9A=E3=80=91=E5=AE=A2=E6=88=B7=E6=A0=B8=E9=AA=8C=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E4=BC=98=E5=8C=96:=20rid=20=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=20--=E6=8F=90=E4=BA=A4=E4=BA=BA=EF=BC=9A?= =?UTF-8?q?=E9=98=B3=E5=8D=8E=E7=A5=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ebiz/sale/SignatureConfirmation.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/views/ebiz/sale/SignatureConfirmation.vue b/src/views/ebiz/sale/SignatureConfirmation.vue index 44abc1d45..15006102e 100644 --- a/src/views/ebiz/sale/SignatureConfirmation.vue +++ b/src/views/ebiz/sale/SignatureConfirmation.vue @@ -1034,7 +1034,8 @@ export default { message: '加载中……' }) let data = { - orderNo: window.localStorage.getItem('orderNo') + orderNo: window.localStorage.getItem('orderNo'), + getOtherType: 'RID' } localStorage.setItem('riskName', '') return new Promise(resolve => { From 1ea106daa7cdb52b2e7b81c3a219406f89743c32 Mon Sep 17 00:00:00 2001 From: mengxiaolong Date: Wed, 28 Oct 2020 10:26:52 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E5=8A=A0=E5=AF=86AES?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 + src/assets/js/utils/cacheUtils.js | 59 +++++++++++++++++++++++++++++ src/assets/js/utils/cryptoJsUtil.js | 47 +++++++++++++++++++++++ src/assets/js/utils/needCacheKey.js | 4 ++ src/config/index.js | 19 +++++++++- src/main.js | 6 +++ 6 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 src/assets/js/utils/cacheUtils.js create mode 100644 src/assets/js/utils/cryptoJsUtil.js create mode 100644 src/assets/js/utils/needCacheKey.js diff --git a/package.json b/package.json index 11951032c..dcade524b 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,8 @@ "echarts": "^4.2.1", "fastclick": "^1.0.6", "js-base64": "^2.5.1", + "crypto-js": "^4.0.0", + "js-md5": "^0.7.3", "nprogress": "^0.2.0", "pdfh5": "^1.2.13", "vant": "2.2.0", diff --git a/src/assets/js/utils/cacheUtils.js b/src/assets/js/utils/cacheUtils.js new file mode 100644 index 000000000..ae186769a --- /dev/null +++ b/src/assets/js/utils/cacheUtils.js @@ -0,0 +1,59 @@ +import AESTools from '@/assets/js/utils/cryptoJsUtil' +import configApp from '@/config' +import cacheKeys from '@/assets/js/utils/needCacheKey' +export default { + setLocItem: function(key, value) { + const exist = cacheKeys.encodeKeys.find(item => { + return item === key + }) + //设置localStorage 值 + if (cacheKeys.isAll || exist) { + window.localStorage.setItem(key, AESTools.AESCacheEncrypt(value, configApp.CACHE_ENCRYP)) + } else { + window.localStorage.setItem(key, value) + } + }, + getLocItem: function(key) { + // 获取localStorage 中值 + let value = window.localStorage.getItem(key) + if (value && value != '') { + const exist = cacheKeys.encodeKeys.find(item => { + return item === key + }) + if (cacheKeys.isAll || exist) { + return AESTools.AESCacheDecrypt(value, configApp.CACHE_ENCRYP) + } + } + return value + }, + removeLocItem: function(key) { + // 获取localStorage 中值 + window.localStorage.removeItem(key) + }, + setSessionItem: function(key, value) { + //设置sessionStorage 值 + const exist = cacheKeys.encodeKeys.find(item => { + return item === key + }) + //设置localStorage 值 + if (cacheKeys.isAll || exist) { + window.sessionStorage.setItem(key, AESTools.AESCacheEncrypt(value, configApp.CACHE_ENCRYP)) + } else { + window.sessionStorage.setItem(key, value) + } + }, + getSessionItem: function(key) { + //设置sessionStorage 值 + let value = window.sessionStorage.getItem(key) + if (value && value != '') { + const exist = cacheKeys.encodeKeys.find(item => { + return item === key + }) + //设置localStorage 值 + if (cacheKeys.isAll || exist) { + return AESTools.AESCacheDecrypt(value, configApp.CACHE_ENCRYP) + } + } + return value + } +} diff --git a/src/assets/js/utils/cryptoJsUtil.js b/src/assets/js/utils/cryptoJsUtil.js new file mode 100644 index 000000000..1282179f0 --- /dev/null +++ b/src/assets/js/utils/cryptoJsUtil.js @@ -0,0 +1,47 @@ +import CryptoJS from 'crypto-js' +export default { + AESEncrypt: function(data, keys) { + //加密 + var key = CryptoJS.enc.Hex.parse(keys) + var iv = CryptoJS.enc.Utf8.parse('0123456789ABCDEF') //偏移量 + var encrypted = CryptoJS.AES.encrypt(data, key, { + iv: iv, + mode: CryptoJS.mode.CBC, + padding: CryptoJS.pad.Pkcs7 + }) + return encrypted.toString() + }, + AESDecrypt: function(encrypted, keys) { + //解密 + var key = CryptoJS.enc.Hex.parse(keys) + var iv = CryptoJS.enc.Utf8.parse('0123456789ABCDEF') + var decrypted = CryptoJS.AES.decrypt(encrypted, key, { + iv: iv, + mode: CryptoJS.mode.CBC, + padding: CryptoJS.pad.Pkcs7 + }) + return CryptoJS.enc.Utf8.stringify(decrypted) + }, + AESCacheEncrypt: function(data, keys) { + //加密 緩存 + var key = CryptoJS.enc.Hex.parse(keys) + var iv = CryptoJS.enc.Utf8.parse('0123456789ABCDEF') //偏移量 + var encrypted = CryptoJS.AES.encrypt(data, key, { + iv: iv, + mode: CryptoJS.mode.CBC, + padding: CryptoJS.pad.Pkcs7 + }) + return encrypted.toString() + }, + AESCacheDecrypt: function(encrypted, keys) { + //解密 緩存 + var key = CryptoJS.enc.Hex.parse(keys) + var iv = CryptoJS.enc.Utf8.parse('0123456789ABCDEF') + var decrypted = CryptoJS.AES.decrypt(encrypted, key, { + iv: iv, + mode: CryptoJS.mode.CBC, + padding: CryptoJS.pad.Pkcs7 + }) + return CryptoJS.enc.Utf8.stringify(decrypted) + } +} diff --git a/src/assets/js/utils/needCacheKey.js b/src/assets/js/utils/needCacheKey.js new file mode 100644 index 000000000..d66594a20 --- /dev/null +++ b/src/assets/js/utils/needCacheKey.js @@ -0,0 +1,4 @@ +export default { + isAll: false, + encodeKeys: ['saleInsuredInfo', 'saleInsuredPersonInfo', 'appntDTO', 'proposalAppnt'] +} diff --git a/src/config/index.js b/src/config/index.js index 04608af99..19983104c 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -5,7 +5,7 @@ * */ -let apiDomain, imgDomain, assetsUrl, mainUrl, payUrl, zssqUrl // 保融支付的收银台服务地址 +let apiDomain, imgDomain, assetsUrl, mainUrl, payUrl, zssqUrl, REQ_PWD, CACHE_ENCRYP, API_VERSION // 保融支付的收银台服务地址 // 可以多个接口域名,按需添加 console.log('环境:', process.env.VUE_APP_FLAG) @@ -18,6 +18,9 @@ switch (process.env.VUE_APP_FLAG) { mainUrl = 'http://139.199.50.151' payUrl = 'https://funduat.e-guofu.com/s3-modules-gateway/embed/gateway.action' zssqUrl = 'http://139.199.50.151/html/test/index.html#/' + REQ_PWD = '41424344454631323334353637383930' + CACHE_ENCRYP = '41424344454631323334353637383930' + API_VERSION = 'v2' break case 'uat': apiDomain = 'http://115.159.235.59:7000/api/v1' // 国富api @@ -27,6 +30,9 @@ switch (process.env.VUE_APP_FLAG) { mainUrl = 'http://115.159.235.59' payUrl = 'https://funduat.e-guofu.com/s3-modules-gateway/embed/gateway.action' zssqUrl = '' + REQ_PWD = '41424344454631323334353637383930' + CACHE_ENCRYP = '41424344454631323334353637383930' + API_VERSION = 'v2' break case 'prd': apiDomain = 'https://iagentsales.e-guofu.com/api/v1' @@ -35,6 +41,9 @@ switch (process.env.VUE_APP_FLAG) { mainUrl = 'https://iagentsales.e-guofu.com' payUrl = 'https://uns3.e-guofu.com/s3-modules-gateway/embed/gateway.action' zssqUrl = '' + REQ_PWD = '41424344454631323334353637383930' + CACHE_ENCRYP = '41424344454631323334353637383930' + API_VERSION = 'v2' break case 'dat': apiDomain = '' @@ -44,6 +53,9 @@ switch (process.env.VUE_APP_FLAG) { mainUrl = '' payUrl = '' zssqUrl = '' + REQ_PWD = '41424344454631323334353637383930' + CACHE_ENCRYP = '41424344454631323334353637383930' + API_VERSION = 'v2' break } /** @@ -61,5 +73,8 @@ export default { assetsUrl, mainUrl, payUrl, - zssqUrl //知识社区地址 + zssqUrl, //知识社区地址 + REQ_PWD, //报文加密密码 + CACHE_ENCRYP, //缓存加密密码 + API_VERSION //渠道版本 } diff --git a/src/main.js b/src/main.js index 98ab6203e..4c93bea39 100644 --- a/src/main.js +++ b/src/main.js @@ -11,6 +11,9 @@ import config from '@/config' import noMoreClick from '@/directive/noMoreClick' import vueHashCalendar from 'vue-hash-calendar' import 'vue-hash-calendar/lib/vue-hash-calendar.css' +import md5 from 'js-md5' +import cryptoJs from 'crypto-js' +import cacheUtils from '@/assets/js/utils/cacheUtils' import { Cell, CellGroup, DatetimePicker, Popup, Picker, Col, Row, Tab, Tabs, NavBar, Toast, Button, Dialog, Icon, Lazyload } from 'vant' Vue.use(Cell) @@ -35,6 +38,9 @@ Vue.use(Lazyload, { Vue.prototype.$assetsUrl = config.assetsUrl Vue.prototype.$mainUrl = config.mainUrl Vue.prototype.$zssqUrl = config.zssqUrl +Vue.prototype.$MD5 = md5 +Vue.prototype.$CryptoJs = cryptoJs +Vue.prototype.$CacheUtils = cacheUtils // 全局 防重复点击 Vue.directive('no-more-click', noMoreClick) From 409ca7e9d5f59db39c4d0173c9c7680cfdc4c3ab Mon Sep 17 00:00:00 2001 From: "yang.huaxiang" Date: Wed, 28 Oct 2020 10:31:31 +0800 Subject: [PATCH 4/4] =?UTF-8?q?GFRS-1989=E3=80=90=E5=BE=85=E7=A1=AE?= =?UTF-8?q?=E5=AE=9A=E3=80=91=E5=AE=A2=E6=88=B7=E6=A0=B8=E9=AA=8C=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E4=BC=98=E5=8C=96:=20=E9=89=B4=E6=9D=83=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=8A=A0=E5=AF=86=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= =?UTF-8?q?=20--=E6=8F=90=E4=BA=A4=E4=BA=BA=EF=BC=9A=E9=98=B3=E5=8D=8E?= =?UTF-8?q?=E7=A5=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ebiz/sale/SignatureConfirmation.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/ebiz/sale/SignatureConfirmation.vue b/src/views/ebiz/sale/SignatureConfirmation.vue index 15006102e..90cb18884 100644 --- a/src/views/ebiz/sale/SignatureConfirmation.vue +++ b/src/views/ebiz/sale/SignatureConfirmation.vue @@ -517,7 +517,7 @@ export default { }) let data = {} if ('appnt' == type) { - let appntData = JSON.parse(localStorage.saleInsuredInfo) + let appntData = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredInfo')) data = { name: appntData.name, idType: appntData.idType, @@ -525,7 +525,7 @@ export default { mobile: appntData.mobile } } else if ('insured' == type) { - let insuredData = JSON.parse(localStorage.saleInsuredPersonInfo) + let insuredData = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')) data = { name: insuredData.name, idType: insuredData.idType,