Sfoglia il codice sorgente

登录增加手机cookies

lichao 3 anni fa
parent
commit
590a06b96e
1 ha cambiato i file con 15 aggiunte e 7 eliminazioni
  1. 15 7
      src/views/login/index.vue

+ 15 - 7
src/views/login/index.vue

@@ -151,7 +151,7 @@ export default {
             url: '/login',
             method: 'post',
             data: this.loginForm
-          }).then(res => {
+          }).then(async res => {
             // console.log(res.data.token);
             // localStorage.setItem('companyName', this.company_name);
             if (res.data.code === 500){
@@ -160,12 +160,20 @@ export default {
             }else {
               Cookies.set("username",this.loginForm.username);
               Cookies.set('TokenKey', res.data.token)
-              if (this.fromPath === '/stock') {
-                this.$router.push({ path: this.redirect || '/stock' });
-              } else {
-                this.$router.push({ path: this.redirect || '/' });
-              }
-              this.loading = false;
+
+              request({
+                url: '/system/user/profile',
+                method: 'get',
+              }).then(response => {
+                console.log(response)
+                Cookies.set("phone", encrypt(response.data.data.phonenumber), { expires: 30 })
+                if (this.fromPath === '/stock') {
+                  this.$router.push({ path: this.redirect || '/stock' });
+                } else {
+                  this.$router.push({ path: this.redirect || '/' });
+                }
+                this.loading = false;
+              })
             }
           }).catch(err => {
             console.log(err);