| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623 |
- <template>
- <div class="validation">
- <div class="container">
- <div class="content" v-show="goFirstStep">
- <div class="content-top">
- <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>
- </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>
- </div>
- </div>
- <div class="content-bottom">
- <span class="use">使用手机号<em>183******08</em>接收验证码</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>
- </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>183****08@qq.com</em>进行验证,有效期7天</span>
- <div class="warp"><button class="btn">发送验证请求</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>
- <form action="">
- <div class="form-group">
- <input type="text" value="问题一" class="answer form-control"/>
- <ul>
- <li>您的母亲的生日是几月几日?</li>
- <li>您最喜欢的宠物叫什么名字?</li>
- <li>您最喜欢的电影片名是什么?</li>
- <li>您的学号是?</li>
- </ul>
- </div>
- <div class="form-group">
- <input type="text" class="form-control" placeholder="答案一"/>
- </div>
- <div class="form-group">
- <input type="text" value="问题一" class="answer form-control"/>
- <ul>
- <li>您的爷爷叫什么名字?</li>
- <li>您的配偶的生日是几月几日?</li>
- <li>您最喜欢的歌手是谁?</li>
- <li>您就读的小学学校全称是?</li>
- </ul>
- </div>
- <div class="form-group">
- <input type="text" class="form-control" placeholder="答案二"/>
- </div>
- <button class="btn">提交</button>
- </form>
- </div>
- <div class="content" v-show="goSecondStep">
- <div class="content-top">
- <h3>验证手机</h3>
- <div class="step">
- <img src="/images/all/step02.png" alt=""/>
- <div class="step-item"><span class="active">账号验证</span><span class="active">新手机号码</span><span>设置完成</span></div>
- </div>
- </div>
- <div class="content-bottom">
- <div class="form-group">
- <input type="text" class="form-control" placeholder="新手机号码"/>
- </div>
- <div class="form-group">
- <input type="text" class="form-control msg" placeholder="短信验证码"/>
- <span class="msg">获取验证码</span>
- <!--<span class="msg send">已发送(54s)</span>-->
- </div>
- <button class="btn">确认</button>
- </div>
- </div>
- <div class="content" v-if="activeTab == 5">
- <div class="content-top">
- <h3>验证手机</h3>
- <div class="step">
- <img src="/images/all/step03.png" alt=""/>
- <div class="step-item"><span class="active">账号验证</span><span class="active">新手机号码</span><span class="active">设置完成</span></div>
- </div>
- </div>
- <div class="content-bottom">
- <p class="passed"><img src="/images/all/pass.png" alt=""/>设置成功</p>
- <span>及时更换最新的手机号码能极大地提高账号安全性哦!</span>
- <div class="close-btn">关闭</div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- 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,
- 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)
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .validation {
- margin: 0 auto;
- width: 100%;
- background: #eee;
- .container{
- padding-top: 50px;
- margin: 0 auto;
- width: 980px;
- text-align: center;
- .content{
- padding: 0 50px;
- margin: 50px auto 0;
- width: 100%;
- /*height: 540px;*/
- text-align: center;
- background: #fff;
- .content-top{
- height: 80px;
- line-height: 80px;
- h3{
- margin-bottom: 0;
- font-size: 24px;
- color: #000;
- border-bottom: 1px solid #dcdcdc;
- }
- .step{
- position: relative;
- margin-top: 10px;
- img{
- width: 315px;
- height: 46px;
- }
- .step-item{
- position: absolute;
- top: 45px;
- left: 265px;
- span{
- margin-right: 85px;
- font-size: 14px;
- color: #b4b4b4;
- }
- span.active {
- color: #0076ad;
- }
- }
- }
- }
- form {
- padding-bottom: 44px;
- margin-top: 152px;
- .form-group{
- position: relative;
- margin: 0 auto 16px;
- width: 360px;
- height: 44px;
- line-height: 44px;
- input{
- padding: 0 0 0 18px;
- width: 360px;
- height: 44px;
- line-height: 44px;
- font-size: 14px;
- color: #000;
- border-radius: 0;
- }
- input.answer {
- background: url("/images/all/more.png") no-repeat 325px center;
- cursor: pointer;
- }
- ul{
- display: none;
- position: absolute;
- top: 44px;
- left: 0;
- width: 360px;
- background: #fff;
- box-shadow: 0 0 5px rgba(0,0,0,.5);
- -moz-box-shadow: 0 0 5px rgba(0,0,0,.5);
- -o-box-shadow: 0 0 5px rgba(0,0,0,.5);
- -webkit-box-shadow: 0 0 5px rgba(0,0,0,.5);
- z-index: 10;
- li{
- padding-left: 18px;
- width: 100%;
- height: 30px;
- line-height: 30px;
- text-align: left;
- font-size: 14px;
- color: #000;
- cursor: pointer;
- &:hover{
- background: #0076ad;
- color: #fff;
- }
- }
- }
- span.tip{
- position: absolute;
- top: 0;
- right: -238px;
- font-size: 13px;
- color: #8c8c8c;
- a{
- font-size: 13px;
- color: #0076ad;
- }
- }
- i{
- position: absolute;
- top: 13px;
- left: 20px;
- font-size: 20px;
- color: #a0a0a0;
- }
- }
- .btn {
- margin: 34px 0 16px 0;
- width: 360px;
- height: 44px;
- line-height: 4px;
- font-size: 16px;
- color: #fff;
- background: #0076AD;
- border-radius: 3px;
- }
- }
- .content-bottom{
- margin: 155px auto 0;
- padding-bottom: 50px;
- width: 360px;
- div.warp{
- padding-bottom: 65px;
- }
- p{
- font-size: 24px;
- color: #323232;
- img{
- margin-right: 20px;
- width: 30px;
- height: 28px;
- }
- }
- p.pass{
- font-size: 24px;
- color: #e77405;
- img{
- height: 30px;
- }
- }
- p.passed {
- color: #2ab300;
- img{
- height: 30px;
- }
- }
- span{
- display: inline-block;
- margin: 15px 0 140px 0;
- font-size: 14px;
- color: #8b8b8b;
- }
- .close-btn{
- margin: 0 auto;
- width: 200px;
- height: 36px;
- line-height: 36px;
- font-size: 14px;
- text-align: center;
- color: #323232;
- border: 1px solid #d2d2d2;
- border-radius: 3px;
- cursor: pointer ;
- }
- span.use{
- display: inline-block;
- margin-bottom: 30px;
- width: 360px;
- font-size: 14px;
- color: #000;
- text-align: left;
- em{
- font-size: 14px;
- font-style: normal;
- color: #000;
- }
- }
- .form-group {
- margin: 0 auto 16px;
- position: relative;
- width: 360px;
- height: 44px;
- line-height: 44px;
- input{
- padding: 0 0 0 18px;
- width: 360px;
- height: 44px;
- line-height: 44px;
- font-size: 14px;
- color: #000;
- border-radius: 0;
- }
- input.msg{
- float: left;
- width: 210px;
- padding: 0 0 0 18px;
- height: 44px;
- line-height: 44px;
- font-size: 14px;
- color: #000;
- border-radius: 0;
- }
- span.msg{
- float: right;
- margin: 0;
- width: 130px;
- height: 44px;
- line-height: 44px;
- text-align: center ;
- font-size: 14px;
- color: #5a5a5a;
- background: #f4f4f4;
- border: 1px solid #dcdcdc;
- cursor: pointer;
- }
- span.msg.send{
- background: #d2d2d2;
- color: #fff;
- }
- }
- .btn {
- margin: 34px 0 10px 0;
- width: 360px;
- height: 44px;
- line-height: 4px;
- font-size: 16px;
- color: #fff;
- background: #0076AD;
- border-radius: 3px;
- }
- }
- .choose{
- margin: 155px auto 0;
- padding-bottom: 44px;
- div{
- padding: 0 15px;
- margin: 0 auto 16px;
- width: 360px;
- height: 60px;
- line-height: 60px;
- text-align: left;
- overflow: hidden;
- border: 1px solid #d2d2d2;
- cursor: pointer;
- &:hover,&.active{
- border-color: #0076ad;
- span{
- color: #0076ad;
- }
- i.second {
- color: #0076ad;
- }
- }
- img.first{
- float: left;
- margin: 24px 20px 0 0;
- font-size: 20px;
- color: #323232;
- }
- img.first.mob{
- margin: 22px 20px 0 5px;
- font-size: 28px;
- }
- i.second {
- float: right;
- margin: 20px 0 0 5px;
- font-size: 20px;
- color: #323232;
- }
- span{
- float: left;
- font-size: 14px;
- color: #323232;
- }
- }
- }
- a.return{
- position: absolute;
- left: 0;
- top: -15px;
- img{
- width: 34px !important;
- height: 34px !important;
- }
- }
- }
- }
- }
- </style>
|