浏览代码

1、提交PC注册验证码

shenjj 7 年之前
父节点
当前提交
1bfdf22837
共有 3 个文件被更改,包括 99 次插入11 次删除
  1. 4 0
      assets/scss/common.scss
  2. 47 6
      components/register/EnterpriseRegistration.vue
  3. 48 5
      components/register/PersonalRegistration.vue

+ 4 - 0
assets/scss/common.scss

@@ -906,3 +906,7 @@ form .questions .el-form-item__content span.question {
   background-color: #f5f5f5;
   background-color: #f5f5f5;
   border-radius: 4px;
   border-radius: 4px;
 }
 }
+
+.code-input2 {
+  width: 92px !important;
+}

+ 47 - 6
components/register/EnterpriseRegistration.vue

@@ -18,10 +18,31 @@
                                     auto-complete="off"
                                     auto-complete="off"
                                     class="msg"
                                     class="msg"
                                     placeholder="短信验证码"></el-input>
                                     placeholder="短信验证码"></el-input>
-              <el-button type="primary" class="code"
-                         v-show="sendEnterpriseCode"
-                         @click="getCheckCode"
-                         :disabled="getCodeBtnIsDisabled">获取验证码</el-button>
+
+              <!--<el-button type="primary" class="code"-->
+                         <!--v-show="sendEnterpriseCode"-->
+                         <!--@click="getCheckCode"-->
+                         <!--:disabled="getCodeBtnIsDisabled">获取验证码</el-button>-->
+              <el-popover
+                placement="top"
+                width="300"
+                v-model="visible2">
+                <div>
+                  <el-input type="text"
+                            v-model="ImgCode"
+                            auto-complete="off"
+                            class="code-input2"></el-input>
+                  <img  id="captchaImage2" class="code-img" src="/sso/login/checkCode"/>
+                  <a class="code-click" @click="getCode"  style="font-size: 12px">看不清换一张</a>
+                </div>
+                <div style="text-align: right; margin: 0">
+                  <el-button size="mini" type="text" @click="visible2 = false">取消</el-button>
+                  <el-button type="primary" size="mini" @click="getCheckCode">确定</el-button>
+                </div>
+                <el-button type="primary" class="code"
+                           v-show="sendEnterpriseCode" slot="reference" :disabled="getCodeBtnIsDisabled">获取验证码</el-button>
+              </el-popover>
+
               <el-button type="primary"  v-show="!sendEnterpriseCode" class="code code-send">已发送({{enterprise_time}}s)</el-button>
               <el-button type="primary"  v-show="!sendEnterpriseCode" class="code code-send">已发送({{enterprise_time}}s)</el-button>
               <span v-show="codeErrorChecked" class="codeError-tip">{{codeErrorMsg}}</span>
               <span v-show="codeErrorChecked" class="codeError-tip">{{codeErrorMsg}}</span>
             </el-form-item>
             </el-form-item>
@@ -113,7 +134,7 @@
       <loading v-show="isShowLoading"/>
       <loading v-show="isShowLoading"/>
     </div>
     </div>
     <!--尾部-->
     <!--尾部-->
-    <div v-html="loginStyle.footUrl" class="footer"></div>
+    <!--<div v-html="loginStyle.footUrl" class="footer"></div>-->
   </div>
   </div>
 </template>
 </template>
 
 
@@ -465,6 +486,8 @@
         }
         }
       }
       }
       return {
       return {
+        visible2: false,
+        ImgCode: '',
 //        企业注册第一步
 //        企业注册第一步
         enterprise: {
         enterprise: {
           mobile: '',
           mobile: '',
@@ -559,9 +582,15 @@
 //      获取链接
 //      获取链接
       this.$nextTick(() => {
       this.$nextTick(() => {
         this.getUrl()
         this.getUrl()
+        this.getCode()
       })
       })
     },
     },
     methods: {
     methods: {
+      //    获取验证码
+      getCode () {
+        let imgSrc = document.getElementById('captchaImage2')
+        imgSrc.setAttribute('src', '/sso/resetPwd/checkCaptcha?timestamp=' + (new Date()).valueOf())
+      },
       // 获取链接
       // 获取链接
       getUrl () {
       getUrl () {
         var url = window.location.search
         var url = window.location.search
@@ -589,11 +618,20 @@
 //      获取校验码
 //      获取校验码
       getCheckCode () {
       getCheckCode () {
         this.isShowLoading = true
         this.isShowLoading = true
-        this.$http.get(`/sso/userspace/register/checkCode`, {params: {mobile: this.enterprise.mobile, timestamp: new Date().getTime() + ''}})
+        this.$http.get(`/sso/userspace/register/checkCode`, {params: {mobile: this.enterprise.mobile, timestamp: new Date().getTime() + '', code: this.ImgCode}})
           .then(response => {
           .then(response => {
             this.isShowLoading = false
             this.isShowLoading = false
             if (response.data) {
             if (response.data) {
               this.token = response.data.token
               this.token = response.data.token
+              if (response.data.errMsg) {
+                this.$message({
+                  message: response.data.errMsg,
+                  type: 'error'
+                })
+                this.ImgCode = ''
+                this.getCode()
+                return
+              }
               if (this.token !== '') {
               if (this.token !== '') {
                 this.$message({
                 this.$message({
                   message: '验证码已经发送到您的手机,请注意查收',
                   message: '验证码已经发送到您的手机,请注意查收',
@@ -601,6 +639,8 @@
                 })
                 })
                 this.sendEnterpriseCode = false
                 this.sendEnterpriseCode = false
                 this.enterprise_time = 60
                 this.enterprise_time = 60
+                this.visible2 = false
+                this.ImgCode = ''
                 var enterpriseTime = setInterval(() => {
                 var enterpriseTime = setInterval(() => {
                   this.enterprise_time--
                   this.enterprise_time--
                   if (this.enterprise_time <= 0) {
                   if (this.enterprise_time <= 0) {
@@ -608,6 +648,7 @@
                     clearInterval(enterpriseTime)
                     clearInterval(enterpriseTime)
                   }
                   }
                 }, 1000)
                 }, 1000)
+                this.getCode()
               }
               }
             } else {
             } else {
               return Promise.reject(response.data)
               return Promise.reject(response.data)

+ 48 - 5
components/register/PersonalRegistration.vue

@@ -36,10 +36,33 @@
             <el-form-item prop="code">
             <el-form-item prop="code">
               <el-input type="text" v-model="item.code"
               <el-input type="text" v-model="item.code"
                         v-bind:class="{ active: codeErrorChecked }" auto-complete="off" class="msg" placeholder="短信验证码"></el-input>
                         v-bind:class="{ active: codeErrorChecked }" auto-complete="off" class="msg" placeholder="短信验证码"></el-input>
-              <el-button type="primary" class="code"
-                         v-show="sendPersonalCode"
-                         @click="getCheckCode"
-                         :disabled="this.checkMobile">获取验证码</el-button>
+
+              <el-popover
+                placement="top"
+                width="300"
+                v-model="visible2">
+                <div>
+                  <el-input type="text"
+                            v-model="ImgCode"
+                            auto-complete="off"
+                            class="code-input2"></el-input>
+                  <img  id="captchaImage2" class="code-img" src="/sso/login/checkCode"/>
+                  <a class="code-click" @click="getCode"  style="font-size: 12px">看不清换一张</a>
+                </div>
+                <div style="text-align: right; margin: 0">
+                  <el-button size="mini" type="text" @click="visible2 = false">取消</el-button>
+                  <el-button type="primary" size="mini" @click="getCheckCode">确定</el-button>
+                </div>
+                <el-button type="primary" class="code"
+                           v-show="sendPersonalCode" slot="reference" :disabled="this.checkMobile">获取验证码</el-button>
+              </el-popover>
+
+
+              <!--<el-button type="primary" class="code"-->
+                         <!--v-show="sendPersonalCode"-->
+                         <!--@click="getCheckCode"-->
+                         <!--:disabled="this.checkMobile">获取验证码</el-button>-->
+
               <el-button type="primary"  v-show="!sendPersonalCode" class="code code-send">已发送({{personal_time}}s)</el-button>
               <el-button type="primary"  v-show="!sendPersonalCode" class="code code-send">已发送({{personal_time}}s)</el-button>
               <span v-show="codeErrorChecked" class="codeError-tip">{{codeErrorMsg}}</span>
               <span v-show="codeErrorChecked" class="codeError-tip">{{codeErrorMsg}}</span>
             </el-form-item>
             </el-form-item>
@@ -303,6 +326,8 @@
         }
         }
       }
       }
       return {
       return {
+        ImgCode: '',
+        visible2: false,
         item: {
         item: {
           vipName: '',
           vipName: '',
           password: '',
           password: '',
@@ -358,6 +383,7 @@
 //      获取链接
 //      获取链接
       this.$nextTick(() => {
       this.$nextTick(() => {
         this.getUrl()
         this.getUrl()
+        this.getCode()
       })
       })
     },
     },
     computed: {
     computed: {
@@ -514,21 +540,37 @@
 //        let { data } = await this.$http.get(`/sso/personal/register/checkCode`, {params: {mobile: this.item.mobile}})
 //        let { data } = await this.$http.get(`/sso/personal/register/checkCode`, {params: {mobile: this.item.mobile}})
 //        this.token = data.token
 //        this.token = data.token
 //      },
 //      },
+      //    获取验证码
+      getCode () {
+        let imgSrc = document.getElementById('captchaImage2')
+        imgSrc.setAttribute('src', '/sso/resetPwd/checkCaptcha?timestamp=' + (new Date()).valueOf())
+      },
       getCheckCode () {
       getCheckCode () {
         this.isShowLoading = true
         this.isShowLoading = true
 //        this.getCode()
 //        this.getCode()
-        this.$http.get(`/sso/personal/register/checkCode`, {params: {mobile: this.item.mobile, timestamp: new Date().getTime() + ''}})
+        this.$http.get(`/sso/personal/register/checkCode`, {params: {mobile: this.item.mobile, timestamp: new Date().getTime() + '', code: this.ImgCode}})
           .then(response => {
           .then(response => {
             this.isShowLoading = false
             this.isShowLoading = false
             if (response.data) {
             if (response.data) {
               this.token = response.data.token
               this.token = response.data.token
+              if (response.data.errMsg) {
+                this.$message({
+                  message: response.data.errMsg,
+                  type: 'error'
+                })
+                this.ImgCode = ''
+                this.getCode()
+                return
+              }
               if (this.token !== '') {
               if (this.token !== '') {
                 this.$message({
                 this.$message({
                   message: '验证码已经发送到您的手机,请注意查收',
                   message: '验证码已经发送到您的手机,请注意查收',
                   type: 'success'
                   type: 'success'
                 })
                 })
                 this.sendPersonalCode = false
                 this.sendPersonalCode = false
+                this.visible2 = false
                 this.personal_time = 60
                 this.personal_time = 60
+                this.ImgCode = ''
                 var personalTime = setInterval(() => {
                 var personalTime = setInterval(() => {
                   this.personal_time--
                   this.personal_time--
                   if (this.personal_time <= 0) {
                   if (this.personal_time <= 0) {
@@ -536,6 +578,7 @@
                     clearInterval(personalTime)
                     clearInterval(personalTime)
                   }
                   }
                 }, 1000)
                 }, 1000)
+                this.getCode()
               }
               }
             } else {
             } else {
               return Promise.reject(response.data)
               return Promise.reject(response.data)