|
|
@@ -1,38 +1,17 @@
|
|
|
<template>
|
|
|
<div class="validation">
|
|
|
<div class="container">
|
|
|
- <div class="content" v-show="goFirstStep">
|
|
|
+ <div class="content">
|
|
|
<div class="content-top">
|
|
|
<h3>添加密保设置</h3>
|
|
|
<div class="step">
|
|
|
<img src="/images/all/step01.png" alt=""/>
|
|
|
<div class="step-item"><span class="active">账号验证</span><span>密保设置</span><span>设置完成</span></div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="choose">
|
|
|
- <div v-show="hasValidPhoneWay"
|
|
|
- @click="chooseWay(1)">
|
|
|
- <img src="/images/all/icon01.png" alt="" class="first mob"/>
|
|
|
- <span>通过验证手机</span><i class="fa fa-angle-right second"></i>
|
|
|
- </div>
|
|
|
- <div v-show="hasValidEmailWay"
|
|
|
- @click="chooseWay(2)">
|
|
|
- <img src="/images/all/icon02.png" alt="" class="first"/>
|
|
|
- <span>通过验证邮箱</span><i class="fa fa-angle-right second"></i>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="content" v-show="showPhoneValid">
|
|
|
- <div class="content-top">
|
|
|
- <h3>添加密保设置</h3>
|
|
|
- <div class="step">
|
|
|
- <img src="/images/all/step01.png" alt=""/>
|
|
|
- <div class="step-item"><span class="active">账号验证</span><span>密保设置</span><span>设置完成</span></div>
|
|
|
- <a @click="goPreviousStep" class="return"><img src="/images/all/return.png" alt=""/></a>
|
|
|
+ <a @click="chooseWay('select')" class="return"><img src="/images/all/return.png" alt=""/></a>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="content-bottom">
|
|
|
- <span class="use">使用手机号<em>{{secretMobile}}</em>接收验证码</span>
|
|
|
+ <span class="use">使用手机号<em>{{info | hide}}</em>接收验证码</span>
|
|
|
<div>
|
|
|
<el-form :model="valid" :rules="rules" ref="valid" label-width="100px" class="demo-ruleForm" style="margin-top: 0;">
|
|
|
<el-form-item prop="code">
|
|
|
@@ -55,39 +34,6 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="content" v-show="showEmailValid">
|
|
|
- <div class="content-top">
|
|
|
- <h3>添加密保设置</h3>
|
|
|
- <div class="step">
|
|
|
- <img src="/images/all/step01.png" alt=""/>
|
|
|
- <div class="step-item"><span class="active">账号验证</span><span>密保设置</span><span>设置完成</span></div>
|
|
|
- <a href="" class="return"><img src="/images/all/return.png" alt=""/></a>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="content-bottom">
|
|
|
- <span class="use">使用电子邮箱<em>{{secretEmail}}</em>进行验证,有效期7天</span>
|
|
|
- <div class="warp"
|
|
|
- @click="firstStepValidEmail"
|
|
|
- v-show="!emailSendSuccess">
|
|
|
- <button class="btn">发送验证请求</button>
|
|
|
- </div>
|
|
|
- <div class="warp" v-show="emailSendSuccess">
|
|
|
- <button class="btn" :disabled="emailSendSuccess">已发送验证邮件,请查收</button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <!--未验证手机弹出框-->
|
|
|
- <div>
|
|
|
- <el-dialog class="valid-phone"
|
|
|
- :visible.sync="goValidPhone"
|
|
|
- @click="goVaildPhoneStep"
|
|
|
- size="tiny">
|
|
|
- <div class="set-tip" v-show="goValidPhone">
|
|
|
- <p>您的账号未验证手机,请先验证手机号</p>
|
|
|
- <a href="/validation/phoneValidation">确定</a>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
- </div>
|
|
|
<loading v-show="isShowLoading"/>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -99,6 +45,7 @@
|
|
|
components: {
|
|
|
Loading
|
|
|
},
|
|
|
+ props: ['info'],
|
|
|
data () {
|
|
|
// 第一步校验验证码
|
|
|
var validateFirstCode = (rule, value, callback) => {
|
|
|
@@ -109,9 +56,9 @@
|
|
|
} else {
|
|
|
if (this.valid.code !== '') {
|
|
|
if (this.token) {
|
|
|
- if (this.valid.code !== '' && this.getMobile !== '') {
|
|
|
+ if (this.valid.code !== '' && this.info !== '') {
|
|
|
let param = new FormData()
|
|
|
- param.append('mobile', this.getMobile)
|
|
|
+ param.append('mobile', this.info)
|
|
|
param.append('code', this.valid.code)
|
|
|
param.append('token', this.token)
|
|
|
let config = {
|
|
|
@@ -142,23 +89,12 @@
|
|
|
}
|
|
|
return {
|
|
|
isShowLoading: false,
|
|
|
- goFirstStep: true,
|
|
|
- hasValidPhoneWay: false,
|
|
|
- hasValidEmailWay: false,
|
|
|
- showPhoneValid: false,
|
|
|
- showEmailValid: false,
|
|
|
sendAccountCode: true,
|
|
|
account_time: 0,
|
|
|
codeErrorChecked: false,
|
|
|
codeChecked: false,
|
|
|
- secretMobile: '',
|
|
|
- secretEmail: '',
|
|
|
- getMobile: '',
|
|
|
- getEmail: '',
|
|
|
codeErrorMsg: '',
|
|
|
- firstStepToken: '',
|
|
|
- emailSendSuccess: false,
|
|
|
- goValidPhone: false,
|
|
|
+ token: '',
|
|
|
valid: {
|
|
|
code: ''
|
|
|
},
|
|
|
@@ -169,96 +105,21 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- computed: {
|
|
|
- logged () {
|
|
|
-// console.log(this.$store.state.option.isLogin.data.content)
|
|
|
- return this.$store.state.option.isLogin.data.content
|
|
|
+ filters: {
|
|
|
+ hide: function (value) {
|
|
|
+ let reg = /^(\d{3})\d{6}(\d{2})$/
|
|
|
+ return value.replace(reg, '$1******$2')
|
|
|
}
|
|
|
},
|
|
|
- mounted () {
|
|
|
-// 验证是否登录
|
|
|
- this.$nextTick(() => {
|
|
|
- this.isLogin()
|
|
|
- // 刷新统计信息
|
|
|
- setInterval(() => {
|
|
|
- this.isLogin()
|
|
|
- }, 10000)
|
|
|
- })
|
|
|
-// 获取验证方式
|
|
|
- this.$nextTick(() => {
|
|
|
- this.getVerifyWay()
|
|
|
- })
|
|
|
- },
|
|
|
methods: {
|
|
|
-// 判断用户是否登录
|
|
|
- isLogin () {
|
|
|
- if (!this.logged.isLogin) {
|
|
|
-// 未登录跳到登录页面
|
|
|
- window.location.href = '/'
|
|
|
- }
|
|
|
- },
|
|
|
-// 获取验证方式
|
|
|
- getVerifyWay () {
|
|
|
- this.$http.get('/update/user/checkType')
|
|
|
- .then(response => {
|
|
|
- if (response.data.success) {
|
|
|
- if (!response.data.content.mobile) {
|
|
|
- this.goValidPhone = true
|
|
|
- } else {
|
|
|
- if (response.data.content.mobile) {
|
|
|
- this.hasValidPhoneWay = true
|
|
|
- this.showManualAppeal = true
|
|
|
- this.getMobile = response.data.content.mobile
|
|
|
- var reg = /^(\d{3})\d{6}(\d{2})$/
|
|
|
- this.secretMobile = this.getMobile.replace(reg, '$1******$2')
|
|
|
- }
|
|
|
- if (response.data.content.email) {
|
|
|
- this.hasValidEmailWay = true
|
|
|
- this.showManualAppeal = true
|
|
|
- this.getEmail = response.data.content.email
|
|
|
- let getEmailIndex = this.getEmail.indexOf('@')
|
|
|
- if (getEmailIndex > 3) {
|
|
|
- let len = this.getEmail.substring(3, getEmailIndex)
|
|
|
- this.secretEmail = this.getEmail.replace(len, '*')
|
|
|
- } else {
|
|
|
- this.getEmailArr = this.getEmail.split('')
|
|
|
- this.getEmailSplit = this.getEmailArr.splice(getEmailIndex, 0, '*')
|
|
|
- this.secretEmail = this.getEmailArr.join('')
|
|
|
- }
|
|
|
- }
|
|
|
- this.goValidPhone = false
|
|
|
- this.goFirstStep = true
|
|
|
- }
|
|
|
- } else {
|
|
|
- return Promise.reject(response.data)
|
|
|
- }
|
|
|
- }).catch(err => {
|
|
|
- this.$message.error(err.errMsg)
|
|
|
- })
|
|
|
- },
|
|
|
-// 没验证手机将跳转到手机验证页面
|
|
|
- goVaildPhoneStep () {
|
|
|
- this.$router.push({ path: '/validation/phoneValidation' })
|
|
|
- },
|
|
|
-// 选择方式
|
|
|
- chooseWay (flag) {
|
|
|
- if (flag === 1) {
|
|
|
- this.showPhoneValid = true
|
|
|
- } else if (flag === 2) {
|
|
|
- this.showEmailValid = true
|
|
|
- }
|
|
|
- this.goFirstStep = false
|
|
|
- },
|
|
|
-// 返回上一步
|
|
|
- goPreviousStep () {
|
|
|
- this.goFirstStep = true
|
|
|
- this.showPhoneValid = false
|
|
|
- this.showEmailValid = false
|
|
|
+ // 选择方式
|
|
|
+ chooseWay (type) {
|
|
|
+ this.$emit('stepEvent', type)
|
|
|
},
|
|
|
// 获取第一步手机验证码
|
|
|
getCheckCode () {
|
|
|
this.isShowLoading = true
|
|
|
- this.$http.get(`/update/user/check/mobile`, {params: {mobile: this.getMobile}})
|
|
|
+ this.$http.get(`/update/user/check/mobile`, {params: {mobile: this.info}})
|
|
|
.then(response => {
|
|
|
this.isShowLoading = false
|
|
|
if (response.data.success) {
|
|
|
@@ -291,7 +152,7 @@
|
|
|
if (this.codeChecked) {
|
|
|
this.isShowLoading = true
|
|
|
let param = new FormData()
|
|
|
- param.append('mobile', this.getMobile)
|
|
|
+ param.append('mobile', this.info)
|
|
|
param.append('code', this.valid.code)
|
|
|
param.append('token', this.token)
|
|
|
let config = {
|
|
|
@@ -301,11 +162,9 @@
|
|
|
.then(response => {
|
|
|
this.isShowLoading = false
|
|
|
if (response.data.success) {
|
|
|
- this.$store.commit('login/GET_TOKEN', response.data.content)
|
|
|
- this.showPhoneValid = false
|
|
|
- this.$router.push({ path: '/encrypted-setting/EncryptedSettingSecondStep' })
|
|
|
+ this.$emit('stepEvent', 'new')
|
|
|
+ this.$emit('tokenEvent', response.data.content)
|
|
|
} else {
|
|
|
- this.showPhoneValid = true
|
|
|
return Promise.reject(response.data)
|
|
|
}
|
|
|
}).catch(err => {
|
|
|
@@ -313,24 +172,6 @@
|
|
|
this.$message.error(err.errMsg)
|
|
|
})
|
|
|
}
|
|
|
- },
|
|
|
-// 第一步验证邮箱
|
|
|
- firstStepValidEmail () {
|
|
|
- this.isShowLoading = true
|
|
|
- this.$http.get(`/update/user/check/email`, {params: {email: this.getEmail, operate: 'question'}})
|
|
|
- .then(response => {
|
|
|
- this.isShowLoading = false
|
|
|
- if (response.data.success) {
|
|
|
- this.emailSendSuccess = true
|
|
|
- } else {
|
|
|
- this.emailSendSuccess = false
|
|
|
- return Promise.reject(response.data)
|
|
|
- }
|
|
|
- }).catch(err => {
|
|
|
- this.isShowLoading = false
|
|
|
- // console.log(err)
|
|
|
- this.$message.error(err.errMsg)
|
|
|
- })
|
|
|
}
|
|
|
}
|
|
|
}
|