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 | 46 +++++++++++++++++++++++++++++++---------------
1 files changed, 31 insertions(+), 15 deletions(-)
diff --git a/src/components/page/Login.vue b/src/components/page/Login.vue
index de8641f..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,27 +45,41 @@
created(){
//this.$router.push({'path': '/home'});
},
+ computed:{
+ ...mapState(['resultAsyncRoutes'])
+ },
methods: {
+ ...mapMutations([
+ 'SET_ROLELISt',
+ 'SET_ROLES'
+ ]),
submitForm(formName) {
this.$refs[formName].validate((valid) => {
- //this.$byutil.setUser({username:123})
- //this.$router.push({'path': '/'});
if (valid) {
- var url = this.$systemconfig.basePath + '/user/login';
+ var url = this.$systemconfig.basePath + '/ffzf/user/login';
this.$byutil.postData(this,url,this.ruleForm,res=>{
- let data = res;
- if (data) {
- localStorage.userId = data.obj.id
- localStorage.name = data.obj.name
- localStorage.type = data.obj.type
- this.$router.push({'path': '/home'});
- // if (this._isMobile()) {
- // this.$router.push({'path': '/index4'});
- // } else {
- // this.$router.push({'path': '/index'});
- // }
- }
+ if (res.code == 0) {
+ let data = res.data;
+ 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