Parcourir la source

登录接口调用,返回token

chuwuya il y a 2 ans
Parent
commit
767b7d3dc0
1 fichiers modifiés avec 36 ajouts et 0 suppressions
  1. 36 0
      src/views/login/index.vue

+ 36 - 0
src/views/login/index.vue

@@ -119,12 +119,43 @@ export default {
     //     }
     // },
     methods: {
+<<<<<<< HEAD
         //登录验证
+=======
+        // handleLogin() {
+        //     if (this.loginForm.vertification.toLowerCase() != this.identifyCode.toLowerCase()) {
+        //         this.$message.error('请输入正确的验证码!');
+        //         this.refreshCode();
+        //     } else {
+        //         this.$refs.loginForm.validate(valid => {
+        //             if (valid) {
+        //                 this.loading = true;
+        //                 this.$store.dispatch('/user/login', this.loginForm).then((res) => {
+        //                     if (res.data.code == 200) {
+        //                         let Authorization = res.data.token;
+        //                         localStorage.setItem('Authorization', Authorization);
+        //                         this.$message.success('登录成功');
+        //                         this.$router.push({ path: '/home' });
+        //                         this.loading = false;
+        //                     } else {
+        //                         this.$message.error(res.data.message);
+        //                     }
+        //                 }).catch(() => {
+        //                     this.loading = false;
+        //                 })
+        //             } else {
+        //                 return false;
+        //             }
+        //         })
+        //     }
+        // },
+>>>>>>> f2592fbd23bf8a79deef6b89beed89927235991e
         handleLogin() {
             if (this.loginForm.vertification.toLowerCase() != this.identifyCode.toLowerCase()) {
                 this.$message.error('请输入正确的验证码!');
                 this.refreshCode();
             } else {
+<<<<<<< HEAD
                 this.$refs.loginForm.validate(valid => {
                     if (valid) {
                         this.loading = true;
@@ -143,6 +174,11 @@ export default {
                         return false;
                     }
                 })
+=======
+                if (this.loginForm.username === 'user001' && this.loginForm.password === '123456') {
+                    this.$router.push('/home');
+                }
+>>>>>>> f2592fbd23bf8a79deef6b89beed89927235991e
             }
         },
         //验证码刷新