瀏覽代碼

处理新账户中心与商城的登入注册交互问题

Administrator 7 年之前
父節點
當前提交
275f17613b

+ 6 - 0
assets/scss/mobileCommon.scss

@@ -1,3 +1,9 @@
+.fade-enter-active, .fade-leave-active {
+  transition: opacity 2.5s
+}
+.fade-enter, .fade-leave-active {
+  opacity: 0
+}
 .mobile{
   padding:0 15px;
   min-height:100vh;

+ 5 - 3
components/login/Login.vue

@@ -292,7 +292,6 @@
           }
           this.$http.post('/sso/login', param, config)
             .then(response => {
-              this.isShowLoading = false
               if (response.data.success) {
                 if (response.data.content.spaces) {
 //                   弹框让用户选择企业
@@ -306,12 +305,14 @@
                     a += (n + '=' + param[n] + '&')
                   }
                   for (let i in response.data.content.loginUrls) {
-                    this.$jsonp(`${response.data.content.loginUrls[i]}`, {param: a.substr(0, a.length - 1)}, function (err, data) {
+                    this.$jsonp(`${response.data.content.loginUrls[i]}?` + a.substr(0, a.length - 1), function (err, data) {
                       if (err) throw err
                       console.log(data)
                     })
                   }
-                  window.location.href = response.data.content.returnUrl || 'http://www.ubtob.com'
+                  setTimeout(function () {
+                    window.location.href = response.data.content.returnUrl || 'http://www.ubtob.com'
+                  }, 3000)
                 }
               } else {
                 this.$message.error(response.data)
@@ -345,6 +346,7 @@
       },
       chooseOneEnterprise (flag, spaceUU) {
         this.login.spaceUU = spaceUU
+        this.dialogVisible = false
         this.isLogin(flag)
       }
     }

+ 6 - 2
components/mobile/loginMobile.vue

@@ -65,6 +65,7 @@
     methods: {
       selectEnterprise (flag, type) {
         this.login.spaceUU = type
+        this.popupVisible = flag
         this.toLogin(flag)
       },
       jump () {
@@ -151,11 +152,14 @@
                   a += (n + '=' + param[n] + '&')
                 }
                 for (let i in response.data.content.loginUrls) {
-                  this.$jsonp(`${response.data.content.loginUrls[i]}`, {param: a.substr(0, a.length - 1)}, function (err) {
+                  this.$jsonp(`${response.data.content.loginUrls[i]}?` + a.substr(0, a.length - 1), function (err) {
                     if (err) throw err
                   })
                 }
-                window.location.href = response.data.content.returnUrl || 'http://www.ubtob.com'
+                this.$indicator.open('跳转中...')
+                setTimeout(function () {
+                  window.location.href = response.data.content.returnUrl || 'http://www.ubtob.com'
+                }, 3000)
               }
             } else {
               this.login.password = ''

+ 12 - 0
components/mobile/registerEnterprise/index.vue

@@ -149,6 +149,7 @@
         let reg = /^1[0-9]{10}$/
         if (!this.step1.mobile) {
           this.downToast('请先填写手机号')
+          this.state.mobile = 'error'
         } else {
           if (!reg.test(this.step1.mobile)) {
             this.downToast('请填写正确的手机号')
@@ -162,6 +163,7 @@
       validateCode () {
         if (!this.step1.token) {
           this.downToast('请先填写验证码')
+          this.state.token = 'error'
         } else {
           if (!this.step1.mobile) {
             this.downToast('请先填写正确的手机号码')
@@ -266,6 +268,7 @@
       validateSpaceName () {
         if (!this.step2.spaceName) {
           this.downToast('请填写企业名称')
+          this.state.spaceName = 'error'
         } else {
           if (this.step2.spaceName.length > 20) {
             this.downToast('输入长度过长,限定20个字符以内')
@@ -288,6 +291,7 @@
         let reg = /^[A-Za-z0-9]+$/
         if (!this.step2.businessCode) {
           this.downToast('请填写营业执照号')
+          this.state.businessCode = 'error'
         } else {
           if (!reg.test(this.step2.businessCode)) {
             this.downToast('请填写正确的营业执照号')
@@ -309,6 +313,7 @@
       validateVipName () {
         if (!this.step2.vipName) {
           this.downToast('请填写管理员姓名')
+          this.state.vipName = 'error'
         } else {
           if (this.step2.vipName.length > 20) {
             this.downToast('输入长度请限制在20个字符以内')
@@ -340,12 +345,16 @@
         let reg2 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z]))|((?=.*[0-9])(?=.*[A-Z]))).*$/
         if (!this.step2.password) {
           this.downToast('请输入密码')
+          this.state.password = 'error'
         } else {
           if (!reg2.test(this.step2.password)) {
             this.downToast('密码须为8-20字符的英文、数字混合')
             this.state.password = 'warning'
           } else {
             this.state.password = 'success'
+            if (this.step2.confirm) {
+              this.validateConfirm()
+            }
           }
         }
       },
@@ -353,6 +362,7 @@
       validatePasswordTipHas () {
         if (!this.step2.password) {
           this.downToast('请输入密码')
+          this.state.password = 'error'
         } else {
           this.state.password = 'success'
         }
@@ -361,6 +371,7 @@
       validateConfirm () {
         if (!this.step2.confirm) {
           this.downToast('请再次输入密码')
+          this.state.confirm = 'error'
         } else {
           if (this.step2.confirm === this.step2.password) {
             this.state.confirm = 'success'
@@ -375,6 +386,7 @@
         let reg = /^([\w-])+(\.\w+)*@([\w-])+((\.\w{2,3}){1,3})$/
         if (!this.step2.email) {
           this.downToast('请填写联系邮箱信息')
+          this.state.email = 'error'
         } else {
           if (!reg.test(this.step2.email)) {
             this.downToast('请输入正确的邮箱地址格式')

+ 8 - 0
components/mobile/registerPersonal/index.vue

@@ -94,6 +94,7 @@
         let count = this.vipName.length
         if (count === 0) {
           this.downToast('会员名不能为空')
+          this.state.vipName = 'error'
         } else if (count < 2 || count > 20) {
           this.downToast('请填写合适的会员名称,2~20个字符')
           this.state.vipName = 'warning'
@@ -123,17 +124,22 @@
         let reg2 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z]))|((?=.*[0-9])(?=.*[A-Z]))).*$/
         if (!this.password) {
           this.downToast('请输入密码')
+          this.state.password = 'error'
         } else if (!reg2.test(this.password)) {
           this.downToast('密码须为8-20字符的英文、数字混合')
           this.state.password = 'warning'
         } else {
           this.state.password = 'success'
+          if (this.confirm) {
+            this.codePassword()
+          }
         }
       },
       // 验证密码的确认信息
       codePassword () {
         if (!this.confirm) {
           this.downToast('请再次输入密码')
+          this.state.confirm = 'error'
         } else if (this.confirm !== this.password) {
           this.downToast('两次输入密码不一致!')
           this.state.confirm = 'warning'
@@ -146,6 +152,7 @@
         let reg = /^1([0-9]{10})$/
         if (!this.mobile) {
           this.downToast('请输入手机号')
+          this.state.mobile = 'error'
         } else if (!reg.test(this.mobile)) {
           this.downToast('请填写正确的手机号码')
           this.state.mobile = 'warning'
@@ -167,6 +174,7 @@
       codeToken () {
         if (!this.token) {
           this.downToast('请先填写验证码')
+          this.state.token = 'error'
         } else {
           if (!this.mobile) {
             this.downToast('请先填写正确的手机号码')

+ 10 - 0
components/mobile/reset/stepAppeal.vue

@@ -125,6 +125,7 @@
           let reg = /^1[0-9]{10}$/
           if (!this.valid.mobile) {
             this.downToast('请先填写手机号')
+            this.state.mobile = 'error'
           } else {
             if (!reg.test(this.valid.mobile)) {
               this.downToast('请填写正确的手机号')
@@ -138,6 +139,7 @@
         validateCode () {
           if (!this.valid.token) {
             this.downToast('请先填写验证码')
+            this.state.token = 'error'
           } else {
             if (!this.valid.mobile) {
               this.downToast('请先填写正确的手机号码')
@@ -230,12 +232,16 @@
           let reg2 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z]))|((?=.*[0-9])(?=.*[A-Z]))).*$/
           if (!this.valid.password) {
             this.downToast('请输入密码')
+            this.state.password = 'error'
           } else {
             if (!reg2.test(this.valid.password)) {
               this.downToast('密码须为8-20字符的英文、数字混合')
               this.state.password = 'warning'
             } else {
               this.state.password = 'success'
+              if (this.valid.confirm) {
+                this.validateConfirm()
+              }
             }
           }
         },
@@ -243,6 +249,7 @@
         validateConfirm () {
           if (!this.valid.confirm) {
             this.downToast('请再次输入密码')
+            this.state.confirm = 'error'
           } else {
             if (this.valid.confirm === this.valid.password) {
               this.state.confirm = 'success'
@@ -256,6 +263,7 @@
         validateContactName () {
           if (!this.valid.contactName) {
             this.downToast('请填写您的姓名')
+            this.state.contactName = 'error'
           } else {
             if (this.valid.contactName.length > 20) {
               this.downToast('输入长度过长,限定20个字符以内')
@@ -270,6 +278,7 @@
           let reg = /^1[0-9]{10}$/
           if (!this.valid.contactTel) {
             this.downToast('请填写联系电话')
+            this.state.contactTel = 'error'
           } else {
             if (!reg.test(this.valid.contactTel)) {
               this.downToast('请填写正确的联系电话')
@@ -284,6 +293,7 @@
           let reg = /^([\w-])+(\.\w+)*@([\w-])+((\.\w{2,3}){1,3})$/
           if (!this.valid.contactEmail) {
             this.downToast('请填写联系电子邮箱')
+            this.state.contactEmail = 'error'
           } else {
             if (!reg.test(this.valid.contactEmail)) {
               this.downToast('请输入正确的邮箱地址格式')

+ 1 - 0
components/mobile/reset/stepBefore.vue

@@ -45,6 +45,7 @@
         hasPassword () {
           if (!this.password) {
             this.downToast('请填写当前密码')
+            this.state.password = 'error'
           } else {
             this.state.password = 'success'
           }

+ 2 - 0
components/mobile/reset/stepFirst.vue

@@ -60,6 +60,7 @@
           let reg = /^1[0-9]{10}$/
           if (!this.valid.mobile) {
             this.downToast('请先填写手机号 ')
+            this.state.mobile = 'error'
           } else {
             if (reg.test(this.valid.mobile)) {
               this.state.mobile = 'success'
@@ -73,6 +74,7 @@
         validateCode () {
           if (!this.valid.captcha) {
             this.downToast('请填写验证码信息')
+            this.state.captcha = 'error'
           } else {
             this.state.captcha = 'success'
           }

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

@@ -54,6 +54,7 @@
       validateCode () {
         if (!this.token) {
           this.downToast('请填写验证码信息')
+          this.state.token = 'error'
         } else {
           this.state.token = 'success'
         }

+ 18 - 5
components/mobile/reset/stepNew.vue

@@ -72,11 +72,28 @@
         }
       },
       // 验证新密码
-      validPasswordTip () {},
+      validPasswordTip () {
+        let reg2 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z]))|((?=.*[0-9])(?=.*[A-Z]))).*$/
+        if (!this.news.password) {
+          this.downToast('请输入密码')
+          this.state.password = 'error'
+        } else {
+          if (!reg2.test(this.news.password)) {
+            this.downToast('密码须为8-20字符的英文、数字混合')
+            this.state.password = 'warning'
+          } else {
+            this.state.password = 'success'
+            if (this.news.confirm) {
+              this.validConfirm()
+            }
+          }
+        }
+      },
       // 验证密码是否一致
       validConfirm () {
         if (!this.news.confirm) {
           this.downToast('请再次输入密码')
+          this.state.confirm = 'error'
         } else {
           if (this.news.confirm === this.news.password) {
             this.state.confirm = 'success'
@@ -114,7 +131,3 @@
     }
   }
 </script>
-
-<style scoped type="text/scss" lang="scss">
-
-</style>

+ 26 - 2
components/mobile/reset/stepSelect.vue

@@ -5,7 +5,7 @@
     </div>
     <div>
       <ul class="select-item">
-        <li class="item" @click="jump('before')">
+        <li class="item" @click="jump('before')" v-if="$store.state.option.isLogin.data.content.isLogin">
           <img src="/images/all/icon03.png">
           <span>通过登录密码</span>
           <i class="fa fa-angle-right second"></i>
@@ -15,7 +15,7 @@
           <span>通过验证手机</span>
           <i class="fa fa-angle-right second"></i>
         </li>
-        <li class="item" @click="jump('email')">
+        <li class="item" @click="jump('email')" v-if="hasEmail">
           <img src="/images/all/icon02.png">
           <span>通过验证邮箱</span>
           <i class="fa fa-angle-right second"></i>
@@ -33,9 +33,33 @@
 <script>
   export default {
     name: 'step-two',
+    data () {
+      return {
+        hasEmail: false
+      }
+    },
+    mounted () {
+      this.$nextTick(() => {
+        this.getVerifyWay()
+      })
+    },
     methods: {
       jump (type) {
         this.$emit('stepEvent', type)
+      },
+      // 获取验证方式
+      getVerifyWay () {
+        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.email) {
+                this.hasEmail = true
+              }
+            }
+          }).catch(err => {
+            console.log(err)
+          })
       }
     }
   }

+ 6 - 1
nuxt.config.js

@@ -6,6 +6,10 @@ module.exports = {
   router: {
     middleware: 'check-auth'
   },
+  transition: {
+    name: 'fade',
+    mode: 'out-in'
+  },
   /*
   ** Headers of the page
   */
@@ -74,7 +78,8 @@ module.exports = {
     ]
   },
   css: [
-   {src: '~assets/scss/app.scss', lang: 'scss'}
+    {src: '~assets/scss/mobileCommon.scss', lang: 'scss'},
+    {src: '~assets/scss/app.scss', lang: 'scss'}
   ],
   dev: !isProdMode,
   env: {

+ 13 - 1
pages/logquit/index.vue

@@ -20,7 +20,19 @@
     },
     methods: {
       logquit () {
-        this.$store.dispatch('logout')
+        this.$http.get('/sso/login/logout', {params: this.$route.query})
+          .then(response => {
+            if (response.data.success) {
+              window.location.href = `${response.data.content.returnURL}`
+              for (let i = 0; i < response.data.content.logoutUrls.length; i++) {
+                if (response.data.content.logoutUrls[i]) {
+                  this.$jsonp(`${response.data.content.logoutUrls[i]}`, function (err) {
+                    if (err) throw err
+                  })
+                }
+              }
+            }
+          })
       }
     }
   }

+ 6 - 2
pages/reset/forgetPasswordValidationAccount.vue

@@ -25,9 +25,13 @@
     layout (context) {
       return context.store.state.option.isMobile ? 'mobile' : 'default'
     },
+    transition: {
+      name: 'fade',
+      mode: 'out-in'
+    },
     data () {
       return {
-        step: 'select',
+        step: 'first',
         stepLast: 'new'
       }
     },
@@ -45,7 +49,7 @@
       StepAppeal
     },
     mounted () {
-      if (this.$store.state.option.isLogin.data.isLogin) {
+      if (this.$store.state.option.isLogin.data.content.isLogin) {
         this.step = 'select'
       }
     },

+ 1 - 8
store/index.js

@@ -51,13 +51,6 @@ export const actions = {
         commit('option/REQUEST_USER_INFO_FAILURE', err)
       })
   },
-  // 用户退出
-  logout ({ commit }) {
-    return axios.get('/sso/login/logout')
-    .then(response => {
-      commit('option/REQUEST_LOGOUT_SUCCESS', response.data)
-    })
-  },
   // 获取成员列表信息
   loadMemberList ({ commit }, params = {}) {
     commit('cloudCenter/REQUEST_MEMBER')
@@ -119,7 +112,7 @@ export const actions = {
   // 获取密保问题
   loadQuestion ({commit}, params = {}) {
     commit('option/REQUEST_ISSUE')
-    return this.$http.get('/sso/resetPwd/check/question', {params})
+    return axios.get.get('/sso/resetPwd/check/question', {params})
       .then(response => {
         commit('option/GET_ISSUE_SUCCESS', response.data)
       }, err => {