|
|
@@ -1,48 +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 v-show="hasValidQuestionsWay"
|
|
|
- @click="chooseWay(3)">
|
|
|
- <img src="/images/all/icon03.png" alt="" class="first"/>
|
|
|
- <span>通过验证密保</span><i class="fa fa-angle-right second"></i>
|
|
|
- </div>
|
|
|
- <div v-show="showManualAppeal"
|
|
|
- @click="goAccountAppeal()">
|
|
|
- <img src="/images/all/icon04.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">
|
|
|
@@ -65,62 +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 class="content" v-show="showQuestionsValid">
|
|
|
- <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>
|
|
|
- <el-form :model="validQuestion" :rules="rulesQuestion" ref="valid" label-width="100px" class="demo-ruleForm">
|
|
|
- <el-form-item class="questions">
|
|
|
- <span class="question">问题:{{question1}}</span>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="answer1">
|
|
|
- <el-input type="text" v-model="validQuestion.answer1"
|
|
|
- auto-complete="off"
|
|
|
- placeholder="答案一"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item class="questions">
|
|
|
- <span class="question">问题:{{question2}}</span>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="answer2">
|
|
|
- <el-input type="text" v-model="validQuestion.answer2"
|
|
|
- auto-complete="off"
|
|
|
- placeholder="答案二"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <a class="btn finish"
|
|
|
- :disabled="!answer1SecondChecked || !answer2SecondChecked"
|
|
|
- @click="validQuestionSubmit">提交</a>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
<loading v-show="isShowLoading"/>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -133,8 +46,9 @@
|
|
|
components: {
|
|
|
Loading
|
|
|
},
|
|
|
+ props: ['info'],
|
|
|
data () {
|
|
|
-// 第一步校验验证码
|
|
|
+ // 第一步校验验证码
|
|
|
var validateFirstCode = (rule, value, callback) => {
|
|
|
if (value === '') {
|
|
|
callback(new Error('请填写正确的验证码'))
|
|
|
@@ -143,9 +57,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 = {
|
|
|
@@ -174,181 +88,39 @@
|
|
|
callback()
|
|
|
}
|
|
|
}
|
|
|
-// 第二步验证密保
|
|
|
- var validateSecondAnswer1 = (rule, value, callback) => {
|
|
|
- if (value === '') {
|
|
|
- callback(new Error('请填写正确的答案'))
|
|
|
- this.answer1SecondChecked = false
|
|
|
- } else {
|
|
|
- if (this.validQuestion.answer1 !== '') {
|
|
|
- this.answer1SecondChecked = true
|
|
|
- }
|
|
|
- callback()
|
|
|
- }
|
|
|
- }
|
|
|
- var validateSecondAnswer2 = (rule, value, callback) => {
|
|
|
- if (value === '') {
|
|
|
- callback(new Error('请填写正确的答案'))
|
|
|
- this.answer2SecondChecked = false
|
|
|
- } else {
|
|
|
- if (this.validQuestion.answer2 !== '') {
|
|
|
- this.answer2SecondChecked = true
|
|
|
- }
|
|
|
- callback()
|
|
|
- }
|
|
|
- }
|
|
|
return {
|
|
|
isShowLoading: false,
|
|
|
- goFirstStep: true,
|
|
|
- hasValidPhoneWay: false,
|
|
|
- hasValidQuestionsWay: false,
|
|
|
- hasValidEmailWay: false,
|
|
|
- showManualAppeal: false,
|
|
|
- showQuestionsValid: false,
|
|
|
- showEmailValid: false,
|
|
|
- showPhoneValid: false,
|
|
|
sendAccountCode: true,
|
|
|
account_time: 0,
|
|
|
codeErrorChecked: false,
|
|
|
codeChecked: false,
|
|
|
- secretMobile: '',
|
|
|
- secretEmail: '',
|
|
|
- getMobile: '',
|
|
|
- getEmail: '',
|
|
|
- getQuestions: '',
|
|
|
- question1: '',
|
|
|
- question2: '',
|
|
|
- sort1: '',
|
|
|
- sort2: '',
|
|
|
codeErrorMsg: '',
|
|
|
- firstStepToken: '',
|
|
|
- answer1SecondChecked: false,
|
|
|
- answer2SecondChecked: false,
|
|
|
- emailSendSuccess: false,
|
|
|
+ token: '',
|
|
|
valid: {
|
|
|
code: ''
|
|
|
},
|
|
|
- validQuestion: {
|
|
|
- answer1: '',
|
|
|
- answer2: ''
|
|
|
- },
|
|
|
rules: {
|
|
|
code: [
|
|
|
{validator: validateFirstCode, trigger: 'blur'}
|
|
|
]
|
|
|
- },
|
|
|
- rulesQuestion: {
|
|
|
- answer1: [
|
|
|
- {validator: validateSecondAnswer1, trigger: 'blur'}
|
|
|
- ],
|
|
|
- answer2: [
|
|
|
- {validator: validateSecondAnswer2, trigger: 'blur'}
|
|
|
- ]
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- 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) {
|
|
|
-// console.log(this.logged.isLogin)
|
|
|
-// 未登录跳到登录页面
|
|
|
- window.location.href = '/'
|
|
|
- }
|
|
|
+ // 选择方式
|
|
|
+ chooseWay (type) {
|
|
|
+ this.$emit('stepEvent', type)
|
|
|
},
|
|
|
-// 获取验证方式
|
|
|
- getVerifyWay () {
|
|
|
- this.$http.get('/update/user/checkType')
|
|
|
- .then(response => {
|
|
|
- if (response.data.success) {
|
|
|
- if (!response.data.content) {
|
|
|
- this.showManualAppeal = 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.questions) {
|
|
|
- this.hasValidQuestionsWay = true
|
|
|
- this.showManualAppeal = true
|
|
|
- this.getQuestions = response.data.content.questions
|
|
|
- this.question1 = this.getQuestions[0].question || ''
|
|
|
- this.question2 = this.getQuestions[1].question || ''
|
|
|
- this.sort1 = this.getQuestions[0].sort || ''
|
|
|
- this.sort2 = this.getQuestions[1].sort || ''
|
|
|
- }
|
|
|
- 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.goFirstStep = true
|
|
|
- }
|
|
|
- } else {
|
|
|
- return Promise.reject(response.data)
|
|
|
- }
|
|
|
- }).catch(err => {
|
|
|
- this.$message.error(err.errMsg)
|
|
|
- })
|
|
|
- },
|
|
|
-// 选择方式
|
|
|
- chooseWay (flag) {
|
|
|
- if (flag === 1) {
|
|
|
- this.showPhoneValid = true
|
|
|
- } else if (flag === 2) {
|
|
|
- this.showEmailValid = true
|
|
|
- } else if (flag === 3) {
|
|
|
- this.showQuestionsValid = true
|
|
|
- }
|
|
|
- this.goFirstStep = false
|
|
|
- },
|
|
|
-// 跳转到人工申诉页面
|
|
|
- goAccountAppeal () {
|
|
|
- window.location.href = '/appeals/accountAppeal'
|
|
|
- },
|
|
|
-// 返回上一步
|
|
|
- goPreviousStep () {
|
|
|
- this.goFirstStep = true
|
|
|
- this.showPhoneValid = false
|
|
|
- this.showEmailValid = false
|
|
|
- this.showQuestionsValid = false
|
|
|
- },
|
|
|
-// 获取第一步手机验证码
|
|
|
+ // 获取第一步手机验证码
|
|
|
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) {
|
|
|
@@ -376,12 +148,12 @@
|
|
|
this.$message.error(err.errMsg)
|
|
|
})
|
|
|
},
|
|
|
-// 手机号验证下一步
|
|
|
+ // 手机号验证下一步
|
|
|
goNextStep () {
|
|
|
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 = {
|
|
|
@@ -391,58 +163,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: '/validation/phoneValidationSecondStep' })
|
|
|
- } else {
|
|
|
- this.showPhoneValid = true
|
|
|
- return Promise.reject(response.data)
|
|
|
- }
|
|
|
- }).catch(err => {
|
|
|
- this.isShowLoading = false
|
|
|
- this.$message.error(err.errMsg)
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
-// 第一步验证邮箱
|
|
|
- firstStepValidEmail () {
|
|
|
- this.isShowLoading = true
|
|
|
- this.$http.get(`/update/user/check/email`, {params: {email: this.getEmail, operate: 'mobile'}})
|
|
|
- .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)
|
|
|
- })
|
|
|
- },
|
|
|
-// 第一步验证密保提交
|
|
|
- validQuestionSubmit () {
|
|
|
- if (this.answer1SecondChecked && this.answer2SecondChecked) {
|
|
|
- this.isShowLoading = true
|
|
|
- let param = new FormData()
|
|
|
- let answer = []
|
|
|
- answer.push({'answer': this.validQuestion.answer1, 'sort': this.sort1}, {'answer': this.validQuestion.answer2, 'sort': this.sort2})
|
|
|
- let answers = JSON.stringify(answer)
|
|
|
- param.append('answers', answers)
|
|
|
- let config = {
|
|
|
- headers: {'Content-Type': 'multipart/form-data'}
|
|
|
- }
|
|
|
- this.$http.post(`/update/user/check/question`, param, config)
|
|
|
- .then(response => {
|
|
|
- this.isShowLoading = false
|
|
|
- if (response.data.success) {
|
|
|
- this.$store.commit('login/GET_TOKEN', response.data.content.token)
|
|
|
- this.showQuestionsValid = false
|
|
|
- this.$router.push({ path: '/validation/phoneValidationSecondStep' })
|
|
|
+ this.$emit('stepEvent', 'new')
|
|
|
+ this.$emit('tokenEvent', response.data.content)
|
|
|
} else {
|
|
|
- this.showQuestionsValid = true
|
|
|
return Promise.reject(response.data)
|
|
|
}
|
|
|
}).catch(err => {
|