From 89f1ca8bc589aaa6f4909ebef4493063b240a3d1 Mon Sep 17 00:00:00 2001
From: zhangxiaoxu123456 <zxx19900626>
Date: 星期一, 18 四月 2022 17:40:51 +0800
Subject: [PATCH] 创业担保贷款接口
---
src/store/modules/user.js | 53 ++++++++++++++++++++++-------------------------------
1 files changed, 22 insertions(+), 31 deletions(-)
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 9ec679d..342d66f 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -1,42 +1,33 @@
/**
* 鐢ㄦ埛鐧诲綍缁勪欢
*/
-
-
+import {login} from '@/api/index'
+import {getStore,setStore} from "../../libs/store";
const user = {
state: {
- menus: [
- {
- icon: "sound",
- index: "/index",
- title: "瑙嗛绠$悊",
- subs: [
- {
- icon: "area-chart",
- index: "index",
- title: "Dashboard",
- },
- ],
- },
- {
- icon: "setting",
- index: "/wechat",
- title: "绯荤粺",
- subs: [
- {
- icon: "setting",
- index: "admin_user",
- title: "甯愬彿绠$悊",
- },
- ],
- }
- ]
+ token: getStore('token') || ''
},
mutations: {
- SET_MENUS: (state, action) => {
- // state.menus = !state.isCollapse
- },
+ SET_TOKEN: (state, token) => {
+ state.token = token
+ console.log(token,'token----set')
+ setStore('token',state.token)
+ }
+ },
+ actions: {
+ login({commit}, userInfo) {
+ return new Promise((resolve, reject) => {
+ login(userInfo).then(response => {
+ console.log('response----',response)
+ commit('SET_TOKEN',response.obj.token)
+ resolve()
+ }).catch(error => {
+ reject(error)
+ })
+ })
+ }
+
}
}
export default user;
--
Gitblit v1.9.1