Browse Source

忘记密码和重置密码组件合并

hangb 7 years ago
parent
commit
632455becc

+ 1 - 1
components/mobile/reset/stepMobile.vue

@@ -99,7 +99,7 @@
         }
       },
       // 验证信息
-      sureAccount (type) {
+      sureAccount () {
         if (this.state.token !== 'success') {
           this.downToast('请确认填写部分是否有误')
         } else {

+ 0 - 712
components/reset/ChangePasswordChooseStyle.vue

@@ -1,712 +0,0 @@
-<template>
-  <div class="validation">
-    <div class="container">
-      <div class="content" v-show="goFirstStep">
-        <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="hasValidPasswordWay"
-               @click="chooseWay(1)">
-            <img src="/images/all/icon03.png" alt="" class="first mob"/>
-            <span>通过登录密码</span><i class="fa fa-angle-right second"></i>
-          </div>
-          <div v-show="hasValidPhoneWay"
-               @click="chooseWay(2)">
-            <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(3)">
-            <img src="/images/all/icon02.png" alt="" class="first"/>
-            <span>通过验证邮箱</span><i class="fa fa-angle-right second"></i>
-          </div>
-          <!--修改密码隐藏人工申诉入口-->
-          <!--<div v-show="showManualAppeal"-->
-               <!--@click="goPasswordSetAppeal">-->
-            <!--<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="showPasswordValid">
-        <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">
-          <div>
-            <el-form :model="valid1" :rules="rules1" ref="valid1" label-width="100px" class="demo-ruleForm" style="margin-top: 0;">
-              <el-form-item prop="password">
-                <el-input type="password" v-model="valid1.password"
-                          auto-complete="off"
-                          placeholder="请输入当前密码"></el-input>
-              </el-form-item>
-              <el-form-item>
-                <a class="btn finish"
-                   :disabled="!oldPasswordChecked"
-                   @click="goPasswordNextStep">下一步</a>
-              </el-form-item>
-            </el-form>
-          </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 href="" class="return"><img src="/images/all/return.png" alt=""/></a>
-          </div>
-        </div>
-        <div class="content-bottom">
-          <span class="use">使用手机号<em>{{secretMobile}}</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">
-                <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">获取验证码</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" >{{codeErrorMsg}}</span>
-              </el-form-item>
-              <el-form-item>
-                <a class="btn finish"
-                   :disabled="!codeChecked"
-                   @click="goNextStep">下一步</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>{{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>
-      <loading v-show="isShowLoading"/>
-    </div>
-  </div>
-</template>
-
-<script>
-  import Loading from '~components/common/loading/Loading.vue'
-  export default {
-    name: 'validation',
-    components: {
-      Loading
-    },
-    data () {
-//      第一步校验验证码
-      var validateFirstCode = (rule, value, callback) => {
-        if (value === '') {
-          callback(new Error('请填写正确的验证码'))
-          this.codeErrorChecked = false
-          this.codeChecked = false
-        } else {
-          if (this.valid.code !== '') {
-            if (this.token) {
-              if (this.valid.code !== '' && this.getMobile !== '') {
-                let param = new FormData()
-                param.append('mobile', this.getMobile)
-                param.append('code', this.valid.code)
-                param.append('token', this.token)
-                let config = {
-                  headers: {'Content-Type': 'multipart/form-data'}
-                }
-                this.$http.post(`/sso/resetPwd/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.codeErrorMsg = err.errMsg
-                    this.codeErrorChecked = true
-                    this.codeChecked = false
-                  })
-              }
-            } else {
-              callback(new Error('请先获取验证码'))
-            }
-          }
-          callback()
-        }
-      }
-//      第一步验证原密码
-      var validateFirstPassword = (rule, value, callback) => {
-        if (value === '') {
-          callback(new Error('请填写原密码'))
-          this.oldPasswordChecked = false
-        } else {
-          if (this.valid1.password !== '') {
-            if (this.valid1.password.length >= 20) {
-              callback(new Error('密码长度不超过20个字符'))
-              this.oldPasswordChecked = false
-            } else {
-              this.oldPasswordChecked = true
-            }
-          }
-          callback()
-        }
-      }
-      return {
-        isShowLoading: false,
-        goFirstStep: true,
-        showManualAppeal: false,
-        hasValidPasswordWay: true,
-        hasValidPhoneWay: false,
-        hasValidEmailWay: false,
-        showPasswordValid: false,
-        showPhoneValid: false,
-        showEmailValid: false,
-        sendAccountCode: true,
-        account_time: 0,
-        codeErrorChecked: false,
-        oldPasswordChecked: false,
-        codeChecked: false,
-        secretMobile: '',
-        secretEmail: '',
-        getMobile: '',
-        getEmail: '',
-        codeErrorMsg: '',
-        firstStepToken: '',
-        emailSendSuccess: false,
-        valid: {
-          code: ''
-        },
-        valid1: {
-          password: ''
-        },
-        rules: {
-          code: [
-            {validator: validateFirstCode, trigger: 'blur'}
-          ]
-        },
-        rules1: {
-          password: [
-            {validator: validateFirstPassword, trigger: 'blur'}
-          ]
-        }
-      }
-    },
-    computed: {
-      logged () {
-//        console.log(this.$store.state.option.isLogin.data.content)
-        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) {
-//          未登录跳到登录页面
-          window.location.href = '/'
-        }
-      },
-//      获取验证方式
-      getVerifyWay () {
-        this.$http.get('/sso/resetPwd/checkType/update')
-          .then(response => {
-            if (response.data.success) {
-              if (!response.data.content) {
-                this.hasValidPhoneWay = false
-                this.hasValidEmailWay = false
-              } else {
-                if (response.data.content.mobile) {
-                  this.hasValidPhoneWay = 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.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.showManualAppeal = true
-              this.hasValidPasswordWay = true
-            } else {
-              return Promise.reject(response.data)
-            }
-          }).catch(err => {
-            this.$message.error(err.errMsg)
-          })
-      },
-//      选择方式
-      chooseWay (flag) {
-        if (flag === 1) {
-          this.showPasswordValid = true
-        } else if (flag === 2) {
-          this.showPhoneValid = true
-        } else if (flag === 3) {
-          this.showEmailValid = true
-        }
-        this.goFirstStep = false
-      },
-//      跳转到人工申诉页面
-      goPasswordSetAppeal () {
-        window.location.href = '/appeals/passwordRestAppeal'
-      },
-//      获取第一步手机验证码
-      getCheckCode () {
-        this.isShowLoading = true
-        this.$http.get(`/sso/resetPwd/check/mobile`)
-          .then(response => {
-            this.isShowLoading = false
-            if (response.data.success) {
-              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)
-              }
-            } else {
-              return Promise.reject(response.data)
-            }
-          }).catch(err => {
-            this.isShowLoading = false
-            this.$message.error(err.errMsg)
-          })
-      },
-//      原密码验证
-      goPasswordNextStep () {
-        if (this.oldPasswordChecked) {
-          this.isShowLoading = true
-          let param = new FormData()
-          param.append('password', this.valid1.password)
-          let config = {
-            headers: {'Content-Type': 'multipart/form-data'}
-          }
-          this.$http.post(`/sso/resetPwd/check/password`, param, config)
-            .then(response => {
-              this.isShowLoading = false
-              if (response.data.success) {
-                this.$store.commit('login/GET_TOKEN', response.data.content.token)
-                this.$router.push({ path: '/reset/passwordResetValidQuestion' })
-              } else {
-                return Promise.reject(response.data)
-              }
-            }).catch(err => {
-              this.isShowLoading = false
-              this.$message.error(err.errMsg)
-            })
-        }
-      },
-//      手机号验证下一步
-      goNextStep () {
-        if (this.codeChecked) {
-          this.isShowLoading = true
-          let param = new FormData()
-          param.append('code', this.valid.code)
-          param.append('token', this.token)
-          let config = {
-            headers: {'Content-Type': 'multipart/form-data'}
-          }
-          this.$http.post(`/sso/resetPwd/check/mobile`, param, config)
-            .then(response => {
-              this.isShowLoading = false
-              if (response.data.success) {
-                this.$store.commit('login/GET_TOKEN', response.data.content.token)
-                this.showPhoneValid = false
-                this.$router.push({ path: '/reset/passwordResetValidQuestion' })
-              } 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(`/sso/resetPwd/check/email`)
-          .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)
-          })
-      }
-    }
-  }
-</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 {
-            margin-top: 150px;
-            padding-bottom: 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;
-                }
-              }
-              span.tip.codeError-tip{
-                position: absolute;
-                top: 3px;
-                left: 378px;
-                width: 200px;
-                text-align: left;
-                color: #ff4949;
-                font-size: 12px;
-              }
-              i{
-                position: absolute;
-                top: 13px;
-                left: 20px;
-                font-size: 20px;
-                color: #a0a0a0;
-              }
-            .btn {
-              margin: 34px 0 16px 0;
-              width: 360px;
-              height: 44px;
-              line-height: 44px;
-              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;
-              font-size: 14px;
-              color: #8b8b8b;
-            }
-            span.close-tip{
-              margin: 15px 0 140px 0;
-            }
-            .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: 44px;
-              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>

+ 407 - 0
components/reset/PasswordStepBefore.vue

@@ -0,0 +1,407 @@
+<template>
+  <div class="validation">
+    <div class="container">
+      <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>
+            <a  @click="chooseWay('select')" class="return"><img src="/images/all/return.png" alt=""/></a>
+          </div>
+        </div>
+        <div class="content-bottom">
+          <div>
+            <el-form :model="valid1" :rules="rules1" ref="valid1" label-width="100px" class="demo-ruleForm" style="margin-top: 0;">
+              <el-form-item prop="password">
+                <el-input type="password" v-model="valid1.password"
+                          auto-complete="off"
+                          placeholder="请输入当前密码"></el-input>
+              </el-form-item>
+              <el-form-item>
+                <a class="btn finish"
+                   :disabled="!oldPasswordChecked"
+                   @click="goPasswordNextStep">下一步</a>
+              </el-form-item>
+            </el-form>
+          </div>
+        </div>
+      </div>
+      <loading v-show="isShowLoading"/>
+    </div>
+  </div>
+</template>
+
+<script>
+  import Loading from '~components/common/loading/Loading.vue'
+  export default {
+    name: 'validation',
+    components: {
+      Loading
+    },
+    data () {
+//      第一步验证原密码
+      var validateFirstPassword = (rule, value, callback) => {
+        if (value === '') {
+          callback(new Error('请填写原密码'))
+          this.oldPasswordChecked = false
+        } else {
+          if (this.valid1.password !== '') {
+            if (this.valid1.password.length >= 20) {
+              callback(new Error('密码长度不超过20个字符'))
+              this.oldPasswordChecked = false
+            } else {
+              this.oldPasswordChecked = true
+            }
+          }
+          callback()
+        }
+      }
+      return {
+        isShowLoading: false,
+        oldPasswordChecked: false,
+        valid1: {
+          password: ''
+        },
+        rules1: {
+          password: [
+            {validator: validateFirstPassword, trigger: 'blur'}
+          ]
+        }
+      }
+    },
+    methods: {
+      // 选择方式
+      chooseWay (type) {
+        this.$emit('stepEvent', type)
+      },
+      // 原密码验证
+      goPasswordNextStep () {
+        if (this.oldPasswordChecked) {
+          this.isShowLoading = true
+          let param = new FormData()
+          param.append('password', this.valid1.password)
+          let config = {
+            headers: {'Content-Type': 'multipart/form-data'}
+          }
+          this.$http.post(`/sso/resetPwd/check/password`, param, config)
+            .then(response => {
+              this.isShowLoading = false
+              if (response.data.success) {
+                this.$emit('stepEvent', 'new')
+                this.$emit('tokenEvent', response.data.content.token)
+              } else {
+                return Promise.reject(response.data)
+              }
+            }).catch(err => {
+              this.isShowLoading = false
+              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 {
+            margin-top: 150px;
+            padding-bottom: 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;
+                }
+              }
+              span.tip.codeError-tip{
+                position: absolute;
+                top: 3px;
+                left: 378px;
+                width: 200px;
+                text-align: left;
+                color: #ff4949;
+                font-size: 12px;
+              }
+              i{
+                position: absolute;
+                top: 13px;
+                left: 20px;
+                font-size: 20px;
+                color: #a0a0a0;
+              }
+            .btn {
+              margin: 34px 0 16px 0;
+              width: 360px;
+              height: 44px;
+              line-height: 44px;
+              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;
+              font-size: 14px;
+              color: #8b8b8b;
+            }
+            span.close-tip{
+              margin: 15px 0 140px 0;
+            }
+            .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: 44px;
+              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>

+ 381 - 0
components/reset/PasswordStepEmail.vue

@@ -0,0 +1,381 @@
+<template>
+  <div class="validation">
+    <div class="container">
+      <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>
+            <a  @click="chooseWay('select')" class="return"><img src="/images/all/return.png" alt=""/></a>
+          </div>
+        </div>
+        <div class="content-bottom">
+          <span class="use">使用电子邮箱<em>{{info| hide}}</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>
+      <loading v-show="isShowLoading"/>
+    </div>
+  </div>
+</template>
+
+<script>
+  import Loading from '~components/common/loading/Loading.vue'
+  export default {
+    name: 'validation',
+    components: {
+      Loading
+    },
+    props: ['info'],
+    data () {
+      return {
+        isShowLoading: false,
+        emailSendSuccess: false
+      }
+    },
+    filters: {
+      hide: function (value) {
+        let getEmailIndex = value.indexOf('@')
+        if (getEmailIndex > 3) {
+          let len = value.substring(3, getEmailIndex)
+          value = value.replace(len, '***')
+        }
+        return value
+      }
+    },
+    methods: {
+      // 选择方式
+      chooseWay (type) {
+        this.$emit('stepEvent', type)
+      },
+      // 第一步验证邮箱
+      firstStepValidEmail () {
+        this.isShowLoading = true
+        this.$http.get(`/sso/resetPwd/check/email`)
+          .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
+            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 {
+            margin-top: 150px;
+            padding-bottom: 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;
+                }
+              }
+              span.tip.codeError-tip{
+                position: absolute;
+                top: 3px;
+                left: 378px;
+                width: 200px;
+                text-align: left;
+                color: #ff4949;
+                font-size: 12px;
+              }
+              i{
+                position: absolute;
+                top: 13px;
+                left: 20px;
+                font-size: 20px;
+                color: #a0a0a0;
+              }
+            .btn {
+              margin: 34px 0 16px 0;
+              width: 360px;
+              height: 44px;
+              line-height: 44px;
+              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;
+              font-size: 14px;
+              color: #8b8b8b;
+            }
+            span.close-tip{
+              margin: 15px 0 140px 0;
+            }
+            .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: 44px;
+              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>

+ 1 - 1
components/reset/ForgetPasswordValidationAccount.vue → components/reset/PasswordStepFirst.vue

@@ -98,7 +98,7 @@
             .then(response => {
               this.isShowLoading = false
               if (response.data.success) {
-                this.$router.push({ path: '/reset/forgetPasswordChooseStyle' })
+                this.$emit('stepEvent', 'select')
               } else {
                 this.changeCaptcha()
                 return Promise.reject(response.data)

+ 22 - 148
components/reset/ForgetPasswordChooseStyle.vue → components/reset/PasswordStepMobile.vue

@@ -1,43 +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="showManualAppeal"-->
-               <!--@click="goPasswordSetAppeal">-->
-            <!--<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 href="" 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">
@@ -60,27 +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>
       <loading v-show="isShowLoading"/>
     </div>
   </div>
@@ -93,6 +46,7 @@
     components: {
       Loading
     },
+    props: ['info'],
     data () {
 //      第一步校验验证码
       var validateFirstCode = (rule, value, callback) => {
@@ -103,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 = {
@@ -122,14 +76,13 @@
                       return Promise.reject(response.data)
                     }
                   }).catch(err => {
-                    this.codeErrorChecked = true
                     this.codeErrorMsg = err.errMsg
+                    this.codeErrorChecked = true
+                    this.codeChecked = false
                   })
               }
             } else {
               callback(new Error('请先获取验证码'))
-              this.codeErrorChecked = false
-              this.codeChecked = false
             }
           }
           callback()
@@ -137,23 +90,12 @@
       }
       return {
         isShowLoading: false,
-        goFirstStep: true,
-        showManualAppeal: false,
-        hasValidPhoneWay: false,
-        hasValidEmailWay: false,
-        showPhoneValid: false,
-        showEmailValid: false,
         sendAccountCode: true,
         account_time: 0,
         codeErrorChecked: false,
+        oldPasswordChecked: false,
         codeChecked: false,
-        secretMobile: '',
-        secretEmail: '',
-        getMobile: '',
-        getEmail: '',
-        codeErrorMsg: '',
-        firstStepToken: '',
-        emailSendSuccess: false,
+        token: '',
         valid: {
           code: ''
         },
@@ -164,66 +106,18 @@
         }
       }
     },
-    mounted () {
-//      获取验证方式
-      this.$nextTick(() => {
-        this.getVerifyWay()
-      })
+    filters: {
+      hide: function (value) {
+        let reg = /^(\d{3})\d{6}(\d{2})$/
+        return value.replace(reg, '$1******$2')
+      }
     },
     methods: {
-//      获取验证方式
-      getVerifyWay () {
-        this.$http.get('/sso/resetPwd/checkType/reset')
-          .then(response => {
-            if (response.data.success) {
-              if (!response.data.content) {
-                this.hasValidPhoneWay = false
-                this.hasValidEmailWay = false
-              } else {
-                if (response.data.content.mobile) {
-                  this.hasValidPhoneWay = 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.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.showManualAppeal = 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
+      // 选择方式
+      chooseWay (type) {
+        this.$emit('stepEvent', type)
       },
-//      跳转到人工申诉页面
-      goPasswordSetAppeal () {
-        window.location.href = '/appeals/passwordRestAppeal'
-      },
-      //      获取第一步手机验证码
+      // 获取第一步手机验证码
       getCheckCode () {
         this.isShowLoading = true
         this.$http.get(`/sso/resetPwd/check/mobile`)
@@ -254,7 +148,7 @@
             this.$message.error(err.errMsg)
           })
       },
-//      手机号验证下一步
+      // 手机号验证下一步
       goNextStep () {
         if (this.codeChecked) {
           this.isShowLoading = true
@@ -268,11 +162,9 @@
             .then(response => {
               this.isShowLoading = false
               if (response.data.success) {
-                this.$store.commit('login/GET_TOKEN', response.data.content.token)
-                this.showPhoneValid = false
-                this.$router.push({ path: '/reset/passwordResetValidQuestion' })
+                this.$emit('stepEvent', 'security')
+                this.$emit('tokenEvent', response.data.content.token)
               } else {
-                this.showPhoneValid = true
                 return Promise.reject(response.data)
               }
             }).catch(err => {
@@ -280,24 +172,6 @@
               this.$message.error(err.errMsg)
             })
         }
-      },
-//      第一步验证邮箱
-      firstStepValidEmail () {
-        this.isShowLoading = true
-        this.$http.get(`/sso/resetPwd/check/email`)
-          .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)
-          })
       }
     }
   }

+ 4 - 29
components/reset/PasswordResetNewPassword.vue → components/reset/PasswordStepNew.vue

@@ -46,6 +46,7 @@
     components: {
       Loading
     },
+    props: ['tokenId'],
     data () {
 //      验证密保
       var validatePassword = (rule, value, callback) => {
@@ -166,24 +167,13 @@
         }
       }
     },
-    computed: {
-      firstStepToken () {
-        return this.$store.state.login.token.data
-      }
-    },
-    mounted () {
-//      获取邮箱token
-      this.$nextTick(() => {
-        this.getEmailLinkToken()
-      })
-    },
     methods: {
       passwordSubmit () {
         if (this.passwordChecked && this.confirmChecked) {
           this.isShowLoading = true
           let param = new FormData()
           param.append('password', this.newPassword.password)
-          param.append('token', this.firstStepToken)
+          param.append('token', this.$route.query.token ? this.$route.query.token : this.tokenId)
           let config = {
             headers: {'Content-Type': 'multipart/form-data'}
           }
@@ -191,7 +181,8 @@
             .then(response => {
               this.isShowLoading = false
               if (response.data.success) {
-                this.$router.push({ path: '/reset/passwordResetSetSuccess' })
+                this.$emit('stepEvent', 'last')
+                this.$emit('lastEvent', 'new')
               } else {
                 return Promise.reject(response.data)
               }
@@ -200,22 +191,6 @@
               this.$message.error(err.errMsg)
             })
         }
-      },
-      //      获得邮箱token
-      getEmailLinkToken () {
-        var url = window.location.search
-        var request = {}
-        if (url.indexOf('?' !== -1)) {
-          var str = url.substr(1)
-          var strs = str.split('&')
-          for (var i = 0; i < strs.length; i++) {
-            request[strs[i].split('=')[0]] = decodeURI(strs[i].split('=')[1])
-          }
-        }
-        this.Token = request['token'] || ''
-        if (this.Token) {
-          this.$store.commit('login/GET_TOKEN', this.Token)
-        }
       }
     }
   }

+ 7 - 31
components/reset/PasswordResetValidQuestion.vue → components/reset/PasswordStepSecurity.vue

@@ -47,6 +47,7 @@
     components: {
       Loading
     },
+    props: ['tokenId'],
     data () {
 //      验证密保
       var validateSecondAnswer1 = (rule, value, callback) => {
@@ -80,6 +81,7 @@
         id2: '',
         answer1SecondChecked: false,
         answer2SecondChecked: false,
+        questionToken: '',
         validQuestion: {
           answer1: '',
           answer2: ''
@@ -94,47 +96,21 @@
         }
       }
     },
-    computed: {
-      firstStepToken () {
-        return this.$store.state.login.token.data
-      }
-    },
     mounted () {
-//      获取邮箱token
-      this.$nextTick(() => {
-        this.getEmailLinkToken()
-      })
       //      获取密保问题
       this.$nextTick(() => {
         this.getQuestion()
       })
     },
     methods: {
-//      获得邮箱token
-      getEmailLinkToken () {
-        var url = window.location.search
-        var request = {}
-        if (url.indexOf('?' !== -1)) {
-          var str = url.substr(1)
-          var strs = str.split('&')
-          for (var i = 0; i < strs.length; i++) {
-            request[strs[i].split('=')[0]] = decodeURI(strs[i].split('=')[1])
-          }
-        }
-        this.Token = request['token'] || ''
-        if (this.Token) {
-          this.$store.commit('login/GET_TOKEN', this.Token)
-        }
-      },
 //      获取密保问题
       getQuestion () {
-        this.$http.get('/sso/resetPwd/check/question', {params: {token: this.firstStepToken}})
+        this.$http.get('/sso/resetPwd/check/question', {params: {token: this.tokenId}})
           .then(response => {
             if (response.data.success) {
               if (response.data.content.questions.length === 0) {
-                this.$router.push({ path: '/reset/passwordResetNewPassword' })
+                this.$emit('stepEvent', 'new')
               }
-              // console.log(response.data.content.questions)
               this.getQuestions = response.data.content.questions
               this.question1 = this.getQuestions[0].question
               this.question2 = this.getQuestions[1].question
@@ -158,7 +134,7 @@
           let answers = JSON.stringify(answer)
           param.append('answers', answers)
           param.append('token', this.questionToken)
-          param.append('pageToken', this.firstStepToken)
+          param.append('pageToken', this.tokenId)
           let config = {
             headers: {'Content-Type': 'multipart/form-data'}
           }
@@ -166,8 +142,8 @@
             .then(response => {
               this.isShowLoading = false
               if (response.data.success) {
-                this.$store.commit('login/GET_TOKEN', response.data.content.token)
-                this.$router.push({ path: '/reset/passwordResetNewPassword' })
+                this.$emit('stepEvent', 'new')
+                this.$emit('tokenEvent', response.data.content.token)
               } else {
                 return Promise.reject(response.data)
               }

+ 410 - 0
components/reset/PasswordStepSelect.vue

@@ -0,0 +1,410 @@
+
+<template>
+  <div class="validation">
+    <div class="container">
+      <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-if="$store.state.option.isLogin.data.content.isLogin"
+               @click="chooseWay('before')">
+            <img src="/images/all/icon03.png" alt="" class="first mob"/>
+            <span>通过登录密码</span><i class="fa fa-angle-right second"></i>
+          </div>
+          <div v-show="hasValidPhoneWay"
+               @click="chooseWay('mobile')">
+            <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('email')">
+            <img src="/images/all/icon02.png" alt="" class="first"/>
+            <span>通过验证邮箱</span><i class="fa fa-angle-right second"></i>
+          </div>
+          <!--修改密码隐藏人工申诉入口-->
+          <!--<div v-show="showManualAppeal"-->
+          <!--@click="goPasswordSetAppeal">-->
+          <!--<img src="/images/all/icon04.png" alt="" class="first"/>-->
+          <!--<span>通过人工申诉</span><i class="fa fa-angle-right second"></i>-->
+          <!--</div>-->
+        </div>
+      </div>
+      <loading v-show="isShowLoading"/>
+    </div>
+  </div>
+</template>
+
+<script>
+  import Loading from '~components/common/loading/Loading.vue'
+  export default {
+    name: 'validation',
+    components: {
+      Loading
+    },
+    data () {
+      return {
+        isShowLoading: false,
+        hasValidPhoneWay: false,
+        hasValidEmailWay: false,
+        mobile: '',
+        email: ''
+      }
+    },
+    mounted () {
+      // 获取验证方式
+      this.$nextTick(() => {
+        this.getVerifyWay()
+      })
+    },
+    methods: {
+      // 选择验证方式
+      chooseWay (type) {
+        this.$emit('stepEvent', type)
+        if (type === 'mobile') {
+          this.$emit('setDataEvent', this.mobile)
+        } else if (type === 'email') {
+          this.$emit('setDataEvent', this.email)
+        }
+      },
+      // 获取验证方式
+      getVerifyWay () {
+        console.log(this.$store.state.option.isLogin)
+        this.$http.get('/sso/resetPwd/checkType/' + (this.$store.state.option.isLogin.data.content.isLogin ? 'update' : 'reset'))
+          .then(response => {
+            if (response.data.success) {
+              console.log(response.data)
+              if (!response.data.content) {
+                this.hasValidPhoneWay = false
+                this.hasValidEmailWay = false
+              } else {
+                if (response.data.content.mobile) {
+                  this.hasValidPhoneWay = true
+                  this.mobile = response.data.content.mobile
+                }
+                if (response.data.content.email) {
+                  this.hasValidEmailWay = true
+                  this.email = response.data.content.email
+                }
+              }
+            } else {
+              return Promise.reject(response.data)
+            }
+          }).catch(err => {
+            this.$message.error(err.errMsg)
+          })
+      },
+      // 跳转到人工申诉页面
+      goPasswordSetAppeal () {
+        window.location.href = '/appeals/passwordRestAppeal'
+      }
+    }
+  }
+</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 {
+    margin-top: 150px;
+    padding-bottom: 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;
+  }
+  }
+  span.tip.codeError-tip{
+    position: absolute;
+    top: 3px;
+    left: 378px;
+    width: 200px;
+    text-align: left;
+    color: #ff4949;
+    font-size: 12px;
+  }
+  i{
+    position: absolute;
+    top: 13px;
+    left: 20px;
+    font-size: 20px;
+    color: #a0a0a0;
+  }
+  .btn {
+    margin: 34px 0 16px 0;
+    width: 360px;
+    height: 44px;
+    line-height: 44px;
+    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;
+    font-size: 14px;
+    color: #8b8b8b;
+  }
+  span.close-tip{
+    margin: 15px 0 140px 0;
+  }
+  .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: 44px;
+    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>

+ 0 - 0
components/reset/PasswordResetSetSuccess.vue → components/reset/PasswordStepSuccess.vue


+ 9 - 7
components/reset/index.js

@@ -1,8 +1,10 @@
-import ForgetPasswordValidationAccount from './ForgetPasswordValidationAccount.vue'
-import ForgetPasswordChooseStyle from './ForgetPasswordChooseStyle.vue'
-import PasswordResetValidQuestion from './PasswordResetValidQuestion.vue'
-import PasswordResetNewPassword from './PasswordResetNewPassword.vue'
-import PasswordResetSetSuccess from './PasswordResetSetSuccess.vue'
-import ChangePasswordChooseStyle from './ChangePasswordChooseStyle.vue'
+import PasswordStepFirst from './PasswordStepFirst.vue'
+import PasswordStepSelect from './PasswordStepSelect.vue'
+import PasswordStepBefore from './PasswordStepBefore.vue'
+import PasswordStepMobile from './PasswordStepMobile.vue'
+import PasswordStepEmail from './PasswordStepEmail.vue'
+import PasswordStepSecurity from './PasswordStepSecurity.vue'
+import PasswordStepNew from './PasswordStepNew.vue'
+import PasswordStepSuccess from './PasswordStepSuccess.vue'
 
-export { ForgetPasswordValidationAccount, ForgetPasswordChooseStyle, PasswordResetValidQuestion, PasswordResetNewPassword, PasswordResetSetSuccess, ChangePasswordChooseStyle }
+export { PasswordStepFirst, PasswordStepSelect, PasswordStepBefore, PasswordStepMobile, PasswordStepEmail, PasswordStepSecurity, PasswordStepNew, PasswordStepSuccess }

+ 0 - 17
pages/reset/changePasswordChooseStyle.vue

@@ -1,17 +0,0 @@
-<template>
-  <div>
-    <accountCenter-header/>
-    <changePassword-chooseStyle/>
-  </div>
-</template>
-<script>
-  import AccountCenterHeader from '~components/default/AccountCenterHeader.vue'
-  import ChangePasswordChooseStyle from '~components/reset/ChangePasswordChooseStyle.vue'
-  export default {
-    layout: 'default',
-    components: {
-      AccountCenterHeader,
-      ChangePasswordChooseStyle
-    }
-  }
-</script>

+ 0 - 17
pages/reset/forgetPasswordChooseStyle.vue

@@ -1,17 +0,0 @@
-<template>
-  <div>
-    <accountCenter-header/>
-    <forgetPassword-chooseStyle/>
-  </div>
-</template>
-<script>
-  import AccountCenterHeader from '~components/default/AccountCenterHeader.vue'
-  import ForgetPasswordChooseStyle from '~components/reset/ForgetPasswordChooseStyle.vue'
-  export default {
-    layout: 'default',
-    components: {
-      AccountCenterHeader,
-      ForgetPasswordChooseStyle
-    }
-  }
-</script>

+ 20 - 4
pages/reset/forgetPasswordValidationAccount.vue

@@ -13,13 +13,20 @@
     </template>
     <template v-else>
       <accountCenter-header/>
-      <forgetPassword-validationAccount/>
+      <password-stepFirst v-if="step === 'first'" @stepEvent="setStep"/>
+      <password-stepSelect v-if="step === 'select'" @stepEvent="setStep" @setDataEvent="setInfo"/>
+      <password-stepBefore v-if="step === 'before'" @stepEvent="setStep" @tokenEvent="loadToken"/>
+      <password-stepMobile v-if="step === 'mobile'" @stepEvent="setStep" @tokenEvent="loadToken" :info="info"/>
+      <password-stepEmail v-if="step === 'email'" @stepEvent="setStep" :info="info"/>
+      <password-stepSecurity v-if="step === 'security'" @stepEvent="setStep" @tokenEvent="loadToken" :tokenId="tokenId"/>
+      <password-StepNew v-if="step === 'new'" @stepEvent="setStep" @lastEvent="setStepLast" :stepLast="stepLast" :tokenId="tokenId"/>
+      <password-stepSuccess v-if="step === 'last'" @stepEvent="setStep" :stepLast="stepLast"/>
     </template>
   </div>
 </template>
 <script>
   import AccountCenterHeader from '~components/default/AccountCenterHeader.vue'
-  import ForgetPasswordValidationAccount from '~components/reset/ForgetPasswordValidationAccount.vue'
+  import { PasswordStepFirst, PasswordStepSelect, PasswordStepBefore, PasswordStepMobile, PasswordStepEmail, PasswordStepSecurity, PasswordStepNew, PasswordStepSuccess } from '~components/reset'
   import {StepFirst, StepSelect, StepBefore, StepEmail, StepMobile, StepAppeal, StepNew, StepSecurity, StepLast} from '~components/mobile/reset'
   export default {
     layout (context) {
@@ -39,7 +46,14 @@
     },
     components: {
       AccountCenterHeader,
-      ForgetPasswordValidationAccount,
+      PasswordStepFirst,
+      PasswordStepSelect,
+      PasswordStepBefore,
+      PasswordStepMobile,
+      PasswordStepEmail,
+      PasswordStepSecurity,
+      PasswordStepNew,
+      PasswordStepSuccess,
       StepFirst,
       StepSelect,
       StepNew,
@@ -51,9 +65,11 @@
       StepAppeal
     },
     mounted () {
+      console.log('logged', this.logged)
       if (this.$route.query.token) {
         this.step = 'security'
-      } else if (this.logged) {
+        this.$router.push('/reset/forgetPasswordValidationAccount?token=' + this.$route.query.token)
+      } else if (this.logged.isLogin) {
         this.step = 'select'
       } else {
         this.step = 'first'

+ 0 - 17
pages/reset/passwordResetNewPassword.vue

@@ -1,17 +0,0 @@
-<template>
-  <div>
-    <accountCenter-header/>
-    <passwordReset-newPassword/>
-  </div>
-</template>
-<script>
-  import AccountCenterHeader from '~components/default/AccountCenterHeader.vue'
-  import PasswordResetNewPassword from '~components/reset/PasswordResetNewPassword.vue'
-  export default {
-    layout: 'default',
-    components: {
-      AccountCenterHeader,
-      PasswordResetNewPassword
-    }
-  }
-</script>

+ 0 - 17
pages/reset/passwordResetSetSuccess.vue

@@ -1,17 +0,0 @@
-<template>
-  <div>
-    <accountCenter-header/>
-    <passwordReset-setSuccess/>
-  </div>
-</template>
-<script>
-  import AccountCenterHeader from '~components/default/AccountCenterHeader.vue'
-  import PasswordResetSetSuccess from '~components/reset/PasswordResetSetSuccess.vue'
-  export default {
-    layout: 'default',
-    components: {
-      AccountCenterHeader,
-      PasswordResetSetSuccess
-    }
-  }
-</script>

+ 0 - 22
pages/reset/passwordResetValidQuestion.vue

@@ -1,22 +0,0 @@
-<template>
-  <div>
-    <accountCenter-header/>
-    <passwordReset-validQuestion/>
-  </div>
-</template>
-<script>
-  import AccountCenterHeader from '~components/default/AccountCenterHeader.vue'
-  import PasswordResetValidQuestion from '~components/reset/PasswordResetValidQuestion.vue'
-  export default {
-    layout: 'default',
-    mounted () {
-      if (this.$store.state.option.isMobile) {
-        this.$router.push('/reset/forgetPasswordValidationAccount?token=' + this.$route.query.token)
-      }
-    },
-    components: {
-      AccountCenterHeader,
-      PasswordResetValidQuestion
-    }
-  }
-</script>