From 160dc3a2207e460c506820ed9656d97b726f52d0 Mon Sep 17 00:00:00 2001
From: 1012414140@qq.com <1012414140@qq.com>
Date: 星期五, 26 十二月 2025 17:01:25 +0800
Subject: [PATCH] feat: 智慧停车场添加loading

---
 src/components/page/Login.vue |   40 +++++++++++++++++++++++++++++-----------
 1 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/src/components/page/Login.vue b/src/components/page/Login.vue
index 2ecaa84..ac8807a 100644
--- a/src/components/page/Login.vue
+++ b/src/components/page/Login.vue
@@ -23,9 +23,11 @@
 </template>
 
 <script>
+   import {mapMutations,mapState} from 'vuex';
     export default {
         data: function(){
             return {
+               // 鏉冮檺鑿滃崟
                 ruleForm: {
                     loginName: '',
                     password: '',
@@ -43,25 +45,41 @@
         created(){
             //this.$router.push({'path': '/home'});
         },
+        computed:{
+            ...mapState(['resultAsyncRoutes'])
 
+        },
         methods: {
+            ...mapMutations([
+            'SET_ROLELISt',
+            'SET_ROLES'
+       ]),
             submitForm(formName) {
                 this.$refs[formName].validate((valid) => {
                     if (valid) {
                         var url = this.$systemconfig.basePath + '/ffzf/user/login';
                         this.$byutil.postData(this,url,this.ruleForm,res=>{
+                          if (res.code == 0) {
                             let data = res.data;
-                          if (data) {
-                            localStorage.userId = data.id
-                            localStorage.name = data.name
-                            localStorage.type = data.type
-                            this.$router.push({'path': '/home'});
-                            // if (this._isMobile()) {
-                            //     this.$router.push({'path': '/index4'});
-                            // } else {
-                            //     this.$router.push({'path': '/index'});
-                            // }
-                        }
+                            if (data) {
+                              localStorage.userId = data.id;
+                              localStorage.name = data.name;
+                              localStorage.type = data.type;
+                              // localStorage.userRouters = JSON.stringify(this.items) ;
+                              this.SET_ROLES(data.type)
+                              this.SET_ROLELISt();  // 绛涢�夊乏渚ц彍鍗曟爮
+                              this.$router.push({'path': this.resultAsyncRoutes[0].children[0].indexUrl || '/home'});
+                              // 鑷姩璺宠浆褰撳墠鏉冮檺璺敱鐨勭涓�涓〉闈� 锛屽鏋滄壘涓嶅埌灏卞幓璺砲ome
+                              // if (this._isMobile()) {
+                              //     this.$router.push({'path': '/index4'});
+                              // } else {
+                              //     this.$router.push({'path': '/index'});
+                              // }
+                            }
+                        }else {
+                            this.$message.error(res.msg);
+                          }
+
                     })
                     } else {
                         return false;

--
Gitblit v1.9.1