|
|
@@ -1,46 +1,76 @@
|
|
|
<template>
|
|
|
<div class="validation">
|
|
|
<div class="container">
|
|
|
- <div class="content" v-if="activeTab == 0">
|
|
|
+ <div class="content" v-show="goFirstStep">
|
|
|
<div class="content-top">
|
|
|
- <h3>验证手机</h3>
|
|
|
+ <h3 @click="getVerifyWay">验证手机</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="choose">
|
|
|
- <div class="active"><img src="/images/all/icon01.png" alt="" class="first mob"/><span>通过验证手机</span><i class="fa fa-angle-right second"></i></div>
|
|
|
- <div><img src="/images/all/icon02.png" alt="" class="first"/><span>通过验证邮箱</span><i class="fa fa-angle-right second"></i></div>
|
|
|
- <div><img src="/images/all/icon03.png" alt="" class="first"/><span>通过验证密保</span><i class="fa fa-angle-right second"></i></div>
|
|
|
- <div><img src="/images/all/icon04.png" alt="" class="first"/><span>通过人工申诉</span><i class="fa fa-angle-right second"></i></div>
|
|
|
+ <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-if="activeTab == 1">
|
|
|
+ <div class="content" v-show="showPhoneValid">
|
|
|
<div class="content-top">
|
|
|
<h3>验证手机</h3>
|
|
|
<div class="step">
|
|
|
- <img src="/images/all/step02.png" alt=""/>
|
|
|
+ <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>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="content-bottom">
|
|
|
<span class="use">使用手机号<em>183******08</em>接收验证码</span>
|
|
|
- <div class="form-group">
|
|
|
- <input type="text" class="form-control msg" placeholder="短信验证码"/>
|
|
|
- <span class="msg">获取验证码</span>
|
|
|
- <!--<span class="msg send">已发送(54s)</span>-->
|
|
|
+ <div>
|
|
|
+ <el-form :model="valid" :rules="rules" ref="valid" label-width="100px" class="demo-ruleForm">
|
|
|
+ <el-form-item prop="code">
|
|
|
+ <el-input type="text" v-model="valid.code"
|
|
|
+ v-bind:class="{ active: codeErrorChecked }"
|
|
|
+ auto-complete="off" class="msg"
|
|
|
+ placeholder="短信验证码"></el-input>
|
|
|
+ <el-button type="primary" class="code"
|
|
|
+ v-show="sendAccountCode"
|
|
|
+ @click="getCheckCode"
|
|
|
+ :disabled="getCodeBtnIsDisabled">获取验证码</el-button>
|
|
|
+ <el-button type="primary" v-show="!sendAccountCode" class="code code-send">已发送({{account_time}}s)</el-button>
|
|
|
+ <!--<span v-show="codeErrorChecked" class="tip codeError-tip" >验证码输入错误</span>-->
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <a class="btn finish">下一步</a>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
</div>
|
|
|
- <button class="btn">下一步</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="content" v-if="activeTab == 2">
|
|
|
+ <div class="content" v-show="showEmailValid">
|
|
|
<div class="content-top">
|
|
|
<h3>验证手机</h3>
|
|
|
<div class="step">
|
|
|
- <img src="/images/all/step02.png" alt=""/>
|
|
|
+ <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">
|
|
|
@@ -48,12 +78,13 @@
|
|
|
<div class="warp"><button class="btn">发送验证请求</button></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="content" v-if="activeTab == 3">
|
|
|
+ <div class="content" v-show="showQuestionsValid">
|
|
|
<div class="content-top">
|
|
|
<h3>验证手机</h3>
|
|
|
<div class="step">
|
|
|
- <img src="/images/all/step03.png" alt=""/>
|
|
|
+ <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>
|
|
|
<form action="">
|
|
|
@@ -84,11 +115,11 @@
|
|
|
<button class="btn">提交</button>
|
|
|
</form>
|
|
|
</div>
|
|
|
- <div class="content" v-if="activeTab == 4">
|
|
|
+ <div class="content" v-show="goSecondStep">
|
|
|
<div class="content-top">
|
|
|
<h3>验证手机</h3>
|
|
|
<div class="step">
|
|
|
- <img src="/images/all/step03.png" alt=""/>
|
|
|
+ <img src="/images/all/step02.png" alt=""/>
|
|
|
<div class="step-item"><span class="active">账号验证</span><span class="active">新手机号码</span><span>设置完成</span></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -126,8 +157,167 @@
|
|
|
export default {
|
|
|
name: 'validation',
|
|
|
data () {
|
|
|
+ var validateCode = (rule, value, callback) => {
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('请填写正确的验证码'))
|
|
|
+ this.codeErrorChecked = false
|
|
|
+ this.codeChecked = false
|
|
|
+ } else {
|
|
|
+ if (this.enterprise.code !== '') {
|
|
|
+ if (this.token !== '') {
|
|
|
+ if (this.enterprise.code !== '' && this.enterprise.mobile !== '') {
|
|
|
+ let param = new FormData()
|
|
|
+ param.append('mobile', this.enterprise.mobile)
|
|
|
+ param.append('code', this.enterprise.code)
|
|
|
+ param.append('token', this.token)
|
|
|
+ let config = {
|
|
|
+ headers: {'Content-Type': 'multipart/form-data'}
|
|
|
+ }
|
|
|
+ this.$http.post(`/sso/personal/register/checkCode`, param, config)
|
|
|
+ .then(response => {
|
|
|
+ if (response.data.success) {
|
|
|
+ this.codeChecked = true
|
|
|
+ this.codeErrorChecked = false
|
|
|
+ } else {
|
|
|
+ this.codeErrorChecked = true
|
|
|
+ this.codeChecked = false
|
|
|
+ return Promise.reject(response.data)
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.$message.error(err.errMsg)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {}
|
|
|
+ }
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }
|
|
|
return {
|
|
|
- activeTab: 0
|
|
|
+ activeTab: 0,
|
|
|
+ goFirstStep: true,
|
|
|
+ goSecondStep: false,
|
|
|
+ hasValidPhoneWay: false,
|
|
|
+ hasValidQuestionsWay: false,
|
|
|
+ hasValidEmailWay: false,
|
|
|
+ showManualAppeal: false,
|
|
|
+ showPhoneValid: false,
|
|
|
+ showEmailValid: false,
|
|
|
+ showQuestionsValid: false,
|
|
|
+ sendAccountCode: false,
|
|
|
+ account_time: 0,
|
|
|
+ getCodeBtnIsDisabled: true,
|
|
|
+ valid: {
|
|
|
+ code: ''
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ code: [
|
|
|
+ {validator: validateCode, trigger: 'blur'}
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ logged () {
|
|
|
+// console.log(this.$store.state.option.isLogin.data.content.isLogin)
|
|
|
+ return this.$store.state.option.isLogin.data.content
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 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 = '/'
|
|
|
+ }
|
|
|
+ },
|
|
|
+// 获取验证方式
|
|
|
+ getVerifyWay () {
|
|
|
+ this.$http.get('/update/user/checkType').then(response => {
|
|
|
+ console.log(response.data)
|
|
|
+ if (response.data.success) {
|
|
|
+ if (!response.data.content) {
|
|
|
+ this.goSecondStep = true
|
|
|
+ this.goFirstStep = false
|
|
|
+ this.showManualAppeal = false
|
|
|
+ } else {
|
|
|
+ if (response.data.content.mobile) {
|
|
|
+ this.hasValidPhoneWay = true
|
|
|
+ this.showManualAppeal = true
|
|
|
+ }
|
|
|
+ if (response.data.content.questions) {
|
|
|
+ this.hasValidQuestionsWay = true
|
|
|
+ this.showManualAppeal = true
|
|
|
+ }
|
|
|
+ if (response.data.content.email) {
|
|
|
+ this.hasValidEmailWay = true
|
|
|
+ this.showManualAppeal = true
|
|
|
+ }
|
|
|
+ this.goSecondStep = false
|
|
|
+ this.goFirstStep = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+// 选择方式
|
|
|
+ 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.$http.get(`/update/user/check/mobile`, {params: {mobile: this.passwordRest.mobile}})
|
|
|
+ .then(response => {
|
|
|
+ this.token = response.data.content.token
|
|
|
+ if (this.token !== '') {
|
|
|
+ this.$message({
|
|
|
+ message: '验证码已经发送到您的手机,请注意查收',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.sendAccountCode = false
|
|
|
+ this.account_time = 60
|
|
|
+ var accountTime = setInterval(() => {
|
|
|
+ this.account_time--
|
|
|
+ if (this.account_time <= 0) {
|
|
|
+ this.sendAccountCode = true
|
|
|
+ clearInterval(accountTime)
|
|
|
+ }
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.$message.error(err.errMsg)
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|