安全性问题处理:添加页面访问校验组件修改 --提交人:阳华祥

This commit is contained in:
yang.huaxiang
2020-11-16 13:28:16 +08:00
parent f643f61ee3
commit e3deb46104

View File

@@ -8,24 +8,47 @@
@cancel="checkModelCancel" @cancel="checkModelCancel"
:before-close="checkModelBeforeClose" :before-close="checkModelBeforeClose"
> >
<van-tabs v-model="active" @click="clickTable">
<van-tab>
<template #title>密码校验 </template>
<div class="p10 fs14">
<p>为保护客户隐私数据安全请您授权访问请在下面输入框输入登录密码</p>
<van-field v-model="checkModel.pwd" clearable type="password" label="密码:" name="密码" label-width="3em" placeholder="请输入密码" />
</div>
</van-tab>
<van-tab v-if="isShowSms">
<template #title>短信校验校验 </template>
<div>
<p class="p10 fs14"> <p class="p10 fs14">
为保护客户隐私数据安全请您授权访问短信验证码已发送至您手机号{{ checkModel.mobile | encryCheckModelMobile }}请您输入验证码以完成后续操作 为保护客户隐私数据安全请您授权访问短信验证码已发送至您手机号{{ checkModel.mobile | encryCheckModelMobile }}请您输入验证码以完成后续操作
</p> </p>
<van-cell-group class="flex align-items-c pr5 mb15"> <van-cell-group class="flex align-items-c pr5 mb15">
<van-field maxlength="6" placeholder="请输入短信验证码" v-model="checkModel.authCode" clearable label-width="0" /> <van-field maxlength="6" placeholder="请输入短信验证码" v-model="checkModel.authCode" clearable label-width="0" />
<van-button type="danger" plain size="small" class="w160 p0" @click="checkModelGetCode" :disabled="checkModel.codeDisabled" v-no-more-click="2000">{{ <van-button
checkModel.codeDisabled ? `${checkModel.countDown}s后重新获取` : '获取验证码' type="danger"
}}</van-button> plain
size="small"
class="w160 p0"
@click="checkModelGetCode"
:disabled="checkModel.codeDisabled"
v-no-more-click="2000"
>{{ checkModel.codeDisabled ? `${checkModel.countDown}s后重新获取` : '获取验证码' }}</van-button
>
</van-cell-group> </van-cell-group>
</div>
</van-tab>
</van-tabs>
</van-dialog> </van-dialog>
</template> </template>
<script> <script>
import { Search, Cell, IndexBar, IndexAnchor, Popup, Button, Tag, Dialog, Field } from 'vant' import { Search, Cell, IndexBar, IndexAnchor, Popup, Button, Tag, Dialog, Field, Tab, Tabs } from 'vant'
import { checkEnterPower, getAuthCode, getCheckModelAgentInfo } from '@/api/ebiz/common/common' import { checkEnterPower, getAuthCode, getCheckModelAgentInfo } from '@/api/ebiz/common/common'
export default { export default {
name: 'CheckAgent', name: 'CheckAgent',
props: {}, props: {},
components: { components: {
[Tab.name]: Tab,
[Tabs.name]: Tabs,
[Search.name]: Search, [Search.name]: Search,
[Cell.name]: Cell, [Cell.name]: Cell,
[IndexBar.name]: IndexBar, [IndexBar.name]: IndexBar,
@@ -38,7 +61,10 @@ export default {
}, },
data() { data() {
return { return {
active: 0,
isShowSms: false,
checkModel: { checkModel: {
pwd: null,
show: false, show: false,
authCode: '', authCode: '',
smsId: '', smsId: '',
@@ -59,6 +85,9 @@ export default {
} }
}, },
methods: { methods: {
clickTable() {
console.log('active', this.active)
},
// 校验是否显示弹窗 // 校验是否显示弹窗
async checkModelEnterValidate() { async checkModelEnterValidate() {
let checkModelResult = await checkEnterPower({ operateType: 'isEnter' }) let checkModelResult = await checkEnterPower({ operateType: 'isEnter' })
@@ -89,11 +118,10 @@ export default {
if (!/^N{1}/.test(agentInfoRes.branchType)) { if (!/^N{1}/.test(agentInfoRes.branchType)) {
this.checkModel.mobile = agentInfoRes.phoneNo this.checkModel.mobile = agentInfoRes.phoneNo
this.checkModel.show = true this.checkModel.show = true
this.isShowSms = true
} else { } else {
// 已校验过 触发成功事件 // 已校验过 触发成功事件
this.checkModel.show = false this.checkModel.show = true
let that = this
this.$emit('checModelSuccessMethod', that.checkModel.show)
} }
} else { } else {
this.$toast(agentInfoRes.resultMessage) this.$toast(agentInfoRes.resultMessage)
@@ -101,6 +129,23 @@ export default {
}, },
// 提交处理 // 提交处理
async checkModelConfirm() { async checkModelConfirm() {
let that = this
let reqParam = { operateType: 'validateSms', smsId: that.checkModel.smsId, code: that.checkModel.authCode }
if (this.active == 0) {
if (!this.checkModel.pwd || this.checkModel.pwd == '') {
this.checkModel.show = true
return this.$toast('请输入密码')
}
if (this.checkModel.pwd.length < 6) {
this.checkModel.pwd = ''
this.checkModel.show = true
return this.$toast('密码格式错误,请重新输入')
}
reqParam = {
operateType: 'validatePwd',
pwd: this.$MD5(this.checkModel.pwd)
}
} else {
if (!this.checkModel.codeDisabled) { if (!this.checkModel.codeDisabled) {
this.checkModel.show = true this.checkModel.show = true
return this.$toast('请先获取验证码') return this.$toast('请先获取验证码')
@@ -113,8 +158,13 @@ export default {
this.checkModel.show = true this.checkModel.show = true
return this.$toast('验证码格式错误') return this.$toast('验证码格式错误')
} }
let that = this reqParam = {
let checkModelResult = await checkEnterPower({ operateType: 'validateSms', smsId: that.checkModel.smsId, code: that.checkModel.authCode }) operateType: 'validateSms',
smsId: that.checkModel.smsId,
code: that.checkModel.authCode
}
}
let checkModelResult = await checkEnterPower(reqParam)
if (checkModelResult.result == 0) { if (checkModelResult.result == 0) {
// 校验通过过 触发成功事件 // 校验通过过 触发成功事件
this.checkModel.show = false this.checkModel.show = false