From 15f831700cc516b74a8b76e43a62d97d61ef3b20 Mon Sep 17 00:00:00 2001 From: "yang.huaxiang" Date: Fri, 13 Nov 2020 17:42:33 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=AE=89=E5=85=A8=E6=80=A7=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=A4=84=E7=90=86=EF=BC=9A=E6=B7=BB=E5=8A=A0=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E8=AE=BF=E9=97=AE=E6=A0=A1=E9=AA=8C=E5=88=9D=E7=89=88?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=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/api/ebiz/common/common.js | 18 +++++++ src/views/ebiz/sale/List.vue | 88 ++++++++++++++++++++++++++++++++++- 2 files changed, 105 insertions(+), 1 deletion(-) diff --git a/src/api/ebiz/common/common.js b/src/api/ebiz/common/common.js index 95c52828d..7a3037c9f 100644 --- a/src/api/ebiz/common/common.js +++ b/src/api/ebiz/common/common.js @@ -62,3 +62,21 @@ export function wxShare(data) { data }) } + +//验证代理人访问 +export function checkEnterPower(data) { + return request({ + url: getUrl('/customer/agent/checkEnterPower', 1), + method: 'post', + data + }) +} + +// 获取验证码 +export function getAuthCode(data) { + return request({ + url: getUrl('/customer/authcode/loginedSend', 1), + method: 'post', + data + }) +} diff --git a/src/views/ebiz/sale/List.vue b/src/views/ebiz/sale/List.vue index 00a52cf75..713493dd6 100644 --- a/src/views/ebiz/sale/List.vue +++ b/src/views/ebiz/sale/List.vue @@ -142,6 +142,17 @@ 点我新增 + + + +

为确保是您本人操作,短信验证码已发送至您手机号{{ checkModel.mobile }},请您输入验证码以完成后续操作。

+ + + {{ + checkModel.codeDisabled ? `${checkModel.countDown}s后重新获取` : '获取验证码' + }} + +
@@ -149,6 +160,7 @@ import { Search, Tabs, Tab, List, Tag, Sticky, Toast, Dialog } from 'vant' import { orderList, deleteOrderInfo, revokeOrder } from '@/api/ebiz/sale/sale' import { formatRiskList } from '@/assets/js/utils/formatRiskList.js' +import { getAuthCode, checkEnterPower } from '@/api/ebiz/common/common' import dataDictionary from '@/assets/js/utils/data-dictionary' //根据数据字典找到用户等级 export default { @@ -164,6 +176,15 @@ export default { }, data() { return { + checkModel: { + show: false, + authCode: '', + smsId: '', + mobile: localStorage.mobile, + timeId: null, // 计时器ID + countDown: 60, // 倒计时 + codeDisabled: true // 获取验证码按钮是否禁用 + }, searchName: '', active: 'uncommit', //uncommit 表示未提交 commit表示已提交 saleList: [], @@ -192,9 +213,74 @@ export default { }) }, 100) window.appCallBack = this.appCallBack - this.loadMore() }, methods: { + async checkModelEnterValidate() { + let checkModelResult = await checkEnterPower({ operateType: 'isEnter' }) + if (checkModelResult.result == 0) { + if (checkModelResult.enterFlag == '0') { + this.loadMore() + } else { + this.checkModel.show = true + } + } else { + this.$toast(checkModelResult.resultMessage) + } + }, + async checkModelConfirm() { + if (!this.checkModel.codeDisabled) { + return this.$toast('请先获取验证码') + } + if (!this.checkModel.authCode || this.logoutDTO.authCode == '') { + return this.$toast('请输入短信验证码') + } + if (this.checkModel.authCode.length !== 6) { + return this.$toast('验证码格式错误') + } + let that = this + let checkModelResult = await checkEnterPower({ operateType: 'validateSms', smsId: that.checkModel.smsId, code: that.checkModel.authCode }) + if (checkModelResult.result == 0) { + that.loadMore() + } else { + this.codeDisabled = false + window.clearInterval(this.timeId) + this.$toast(checkModelResult.resultMessage) + } + }, + checkModelCancel() { + // 跳转首页 + this.$jump({ + flag: 'home' + }) + }, + checkModelGetCode() { + let data = { + operateType: 'agentValidateEnter', + type: 'H5', + operateCode: this.checkModel.mobile, + system: 'agentApp', + operateCodeType: '0' + } + //获取验证码 + getAuthCode(data).then(res => { + this.codeDisabled = true + if (res.result == 0) { + this.checkModel.smsId = res.sessionId + this.checkModel.smsCode = null + //倒计时 + this.timeId = setInterval(() => { + this.countDown-- + if (this.countDown <= 0) { + window.clearInterval(this.timeId) + this.codeDisabled = false + this.countDown = 60 + } + }, 1000) + } else { + this.$toast(res.resultMessage) + } + }) + }, appCallBack(data) { if (data.trigger == 'left_button_click') { this.$jump({ From b8b04b413654aa6b3d1c665c901ce95fe766cdf7 Mon Sep 17 00:00:00 2001 From: "yang.huaxiang" Date: Fri, 13 Nov 2020 18:32:20 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=AE=89=E5=85=A8=E6=80=A7=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=A4=84=E7=90=86=EF=BC=9A=E8=8C=83=E6=96=87=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=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/assets/js/utils/request.js | 4 ++-- src/assets/js/utils/request1.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/assets/js/utils/request.js b/src/assets/js/utils/request.js index 4a4673fb1..15a679061 100644 --- a/src/assets/js/utils/request.js +++ b/src/assets/js/utils/request.js @@ -127,7 +127,7 @@ service.interceptors.request.use( /** * 请求拦截处理(待添加 判断走统一网关处理) */ - if(config.url && /api\/$/.test(config.url.split(configApp.API_VERSION)[0])){ + if(config.url && /api\/$/.test(config.url.split(configApp.API_VERSION)[0]) && configApp.API_VERSION == 'v2'){ if(!config.data || config.data == null){ config.data = {} } @@ -158,7 +158,7 @@ service.interceptors.response.use( console.log(response) console.log('----------------') let res = response.data - if(response.config.url && response.headers['content-type'].match(/application\/json/) && /api\/$/.test(response.config.url.split(configApp.API_VERSION)[0])){ + if( configApp.API_VERSION == 'v2' && response.config.url && response.headers['content-type'].match(/application\/json/) && /api\/$/.test(response.config.url.split(configApp.API_VERSION)[0])){ if(res.response){// 正常情況返回必有response 节点 console.log("[调用请求解密服务][请求地址:"+response.config.url+"][解密前报文:]",JSON.stringify(res.response)) res = JSON.parse(AESTools.AESDecrypt(res.response,configApp.REQ_PWD)) diff --git a/src/assets/js/utils/request1.js b/src/assets/js/utils/request1.js index 8d9a1bd0f..d7af9379c 100644 --- a/src/assets/js/utils/request1.js +++ b/src/assets/js/utils/request1.js @@ -31,7 +31,7 @@ service.interceptors.request.use( /** * 请求拦截处理(待添加 判断走统一网关处理) */ - if(config.url && /api\/$/.test(config.url.split(configApp.API_VERSION)[0])){ + if(config.url && /api\/$/.test(config.url.split(configApp.API_VERSION)[0]) && configApp.API_VERSION == 'v2'){ if(!config.data || config.data == null){ config.data = {} } @@ -62,7 +62,7 @@ service.interceptors.response.use( console.log(response) console.log('----------------') let res = response.data - if(response.config.url && response.headers['content-type'].match(/application\/json/) && /api\/$/.test(response.config.url.split(configApp.API_VERSION)[0])){ + if( configApp.API_VERSION == 'v2' && response.config.url && response.headers['content-type'].match(/application\/json/) && /api\/$/.test(response.config.url.split(configApp.API_VERSION)[0])){ if(res.response){// 正常情況返回必有response 节点 console.log("[调用请求解密服务][请求地址:"+response.config.url+"][解密前报文:]",JSON.stringify(res.response)) res = JSON.parse(AESTools.AESDecrypt(res.response,configApp.REQ_PWD)) From 8b5a8bce817e66a0af22ff5bfe424fdaf5d86cad Mon Sep 17 00:00:00 2001 From: "yang.huaxiang" Date: Fri, 13 Nov 2020 18:33:19 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=AE=89=E5=85=A8=E6=80=A7=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=A4=84=E7=90=86=EF=BC=9A=E6=B7=BB=E5=8A=A0=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E8=AE=BF=E9=97=AE=E6=A0=A1=E9=AA=8C=E5=88=9D=E7=89=88?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=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/List.vue | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/views/ebiz/sale/List.vue b/src/views/ebiz/sale/List.vue index 713493dd6..c7856005a 100644 --- a/src/views/ebiz/sale/List.vue +++ b/src/views/ebiz/sale/List.vue @@ -157,7 +157,7 @@ diff --git a/src/views/ebiz/manpower/Training.vue b/src/views/ebiz/manpower/Training.vue index 1086d9d49..6258ebc9a 100644 --- a/src/views/ebiz/manpower/Training.vue +++ b/src/views/ebiz/manpower/Training.vue @@ -4,6 +4,17 @@ + + + +

为确保是您本人操作,短信验证码已发送至您手机号{{ checkModel.mobile }},请您输入验证码以完成后续操作。

+ + + {{ + checkModel.codeDisabled ? `${checkModel.countDown}s后重新获取` : '获取验证码' + }} + +
@@ -11,19 +22,32 @@ import UserInfoHeader from '@/components/ebiz/manpower/UserInfoHeader' import NavItem from '@/components/ebiz/manpower/NavItem' import record from '@/assets/images/u73803.png' -import { CellGroup } from 'vant' - +import { CellGroup, Cell, Button, Dialog, Field } from 'vant' import { getTokenForUserModel } from '@/api/ebiz/manpower/manpower' +import { checkEnterPower, getAuthCode } from '@/api/ebiz/common/common' export default { name: 'Navigation', components: { [UserInfoHeader.name]: UserInfoHeader, [NavItem.name]: NavItem, - [CellGroup.name]: CellGroup + [CellGroup.name]: CellGroup, + [Cell.name]: Cell, + [Button.name]: Button, + [Field.name]: Field, + [Dialog.name]: Dialog }, data() { return { + checkModel: { + show: false, + authCode: '', + smsId: '', + mobile: localStorage.mobile, + timeId: null, // 计时器ID + countDown: 60, // 倒计时 + codeDisabled: false // 获取验证码按钮是否禁用 + }, active: 0, navList: [ { @@ -47,9 +71,80 @@ export default { } }, created() { - this.getInfo() + this.checkModelEnterValidate() }, methods: { + async checkModelEnterValidate() { + let checkModelResult = await checkEnterPower({ operateType: 'isEnter' }) + if (checkModelResult.result == 0) { + if (checkModelResult.enterFlag == '0') { + this.getInfo() + } else { + this.checkModel.show = true + } + } else { + this.$toast(checkModelResult.resultMessage) + } + }, + async checkModelConfirm() { + if (!this.checkModel.codeDisabled) { + this.checkModel.show = true + return this.$toast('请先获取验证码') + } + if (!this.checkModel.authCode || this.checkModel.authCode == '') { + this.checkModel.show = true + return this.$toast('请输入短信验证码') + } + if (this.checkModel.authCode.length !== 6) { + this.checkModel.show = true + return this.$toast('验证码格式错误') + } + let that = this + let checkModelResult = await checkEnterPower({ operateType: 'validateSms', smsId: that.checkModel.smsId, code: that.checkModel.authCode }) + if (checkModelResult.result == 0) { + this.checkModel.show = false + this.getInfo() + } else { + this.checkModel.show = false + this.checkModel.codeDisabled = true + window.clearInterval(this.checkModel.timeId) + this.$toast(checkModelResult.resultMessage) + } + }, + checkModelCancel() { + // 跳转首页 + this.$jump({ + flag: 'home' + }) + }, + checkModelGetCode() { + this.checkModel.codeDisabled = true + let data = { + operateType: 'agentValidateEnter', + type: 'H5', + operateCode: this.checkModel.mobile, + system: 'agentApp', + operateCodeType: '0' + } + //获取验证码 + getAuthCode(data).then(res => { + if (res.result == 0) { + this.checkModel.smsId = res.sessionId + this.checkModel.smsCode = null + //倒计时 + this.checkModel.timeId = setInterval(() => { + this.checkModel.countDown-- + if (this.checkModel.countDown <= 0) { + window.clearInterval(this.checkModel.timeId) + this.checkModel.codeDisabled = false + this.checkModel.countDown = 60 + } + }, 1000) + } else { + this.$toast(res.resultMessage) + } + }) + }, async getInfo() { const res = await getTokenForUserModel() if (res.result == 0) { From 247f403bab6f4d9eb69dad9f3e2c5043492fa97b Mon Sep 17 00:00:00 2001 From: "yang.huaxiang" Date: Sat, 14 Nov 2020 15:26:25 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=AE=89=E5=85=A8=E6=80=A7=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=A4=84=E7=90=86=EF=BC=9A=E6=B7=BB=E5=8A=A0=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E8=AE=BF=E9=97=AE=E6=A0=A1=E9=AA=8C=E5=88=9D=E7=89=88?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=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/customer/customerList.vue | 5 ++++- src/views/ebiz/manpower/Navigation.vue | 7 ++++++- src/views/ebiz/manpower/Training.vue | 7 ++++++- src/views/ebiz/sale/List.vue | 9 +++++++-- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/views/ebiz/customer/customerList.vue b/src/views/ebiz/customer/customerList.vue index b222bf8c6..41ad806d7 100644 --- a/src/views/ebiz/customer/customerList.vue +++ b/src/views/ebiz/customer/customerList.vue @@ -87,7 +87,7 @@ -

为确保是您本人操作,短信验证码已发送至您手机号{{ checkModel.mobile }},请您输入验证码以完成后续操作。

+

为确保是您本人操作,短信验证码已发送至您手机号{{ checkModel.mobile | encryCheckModelMobile }},请您输入验证码以完成后续操作。

{{ @@ -180,6 +180,9 @@ export default { this.checkModelEnterValidate() }, filters: { + encryCheckModelMobile(code) { + return code.replace(/^(\d{3})\d{4}(\d{4})$/, '$1****$2') + }, toCustomer(value) { if (value == 0) { return (value = '准客户') diff --git a/src/views/ebiz/manpower/Navigation.vue b/src/views/ebiz/manpower/Navigation.vue index af2239525..fc74fa358 100644 --- a/src/views/ebiz/manpower/Navigation.vue +++ b/src/views/ebiz/manpower/Navigation.vue @@ -6,7 +6,7 @@ -

为确保是您本人操作,短信验证码已发送至您手机号{{ checkModel.mobile }},请您输入验证码以完成后续操作。

+

为确保是您本人操作,短信验证码已发送至您手机号{{ checkModel.mobile | encryCheckModelMobile }},请您输入验证码以完成后续操作。

{{ @@ -72,6 +72,11 @@ export default { mounted() { this.checkModelEnterValidate() }, + filters: { + encryCheckModelMobile(code) { + return code.replace(/^(\d{3})\d{4}(\d{4})$/, '$1****$2') + } + }, methods: { async checkModelEnterValidate() { let checkModelResult = await checkEnterPower({ operateType: 'isEnter' }) diff --git a/src/views/ebiz/manpower/Training.vue b/src/views/ebiz/manpower/Training.vue index 6258ebc9a..36427023d 100644 --- a/src/views/ebiz/manpower/Training.vue +++ b/src/views/ebiz/manpower/Training.vue @@ -7,7 +7,7 @@ -

为确保是您本人操作,短信验证码已发送至您手机号{{ checkModel.mobile }},请您输入验证码以完成后续操作。

+

为确保是您本人操作,短信验证码已发送至您手机号{{ checkModel.mobile | encryCheckModelMobile }},请您输入验证码以完成后续操作。

{{ @@ -73,6 +73,11 @@ export default { created() { this.checkModelEnterValidate() }, + filters: { + encryCheckModelMobile(code) { + return code.replace(/^(\d{3})\d{4}(\d{4})$/, '$1****$2') + } + }, methods: { async checkModelEnterValidate() { let checkModelResult = await checkEnterPower({ operateType: 'isEnter' }) diff --git a/src/views/ebiz/sale/List.vue b/src/views/ebiz/sale/List.vue index 5c4a743f8..e0bc2aa8f 100644 --- a/src/views/ebiz/sale/List.vue +++ b/src/views/ebiz/sale/List.vue @@ -145,7 +145,7 @@ -

为确保是您本人操作,短信验证码已发送至您手机号{{ checkModel.mobile }},请您输入验证码以完成后续操作。

+

为确保是您本人操作,短信验证码已发送至您手机号{{ checkModel.mobile | encryCheckModelMobile }},请您输入验证码以完成后续操作。

{{ @@ -157,7 +157,7 @@