From 7e694768f428b83ed462eb384c43b2ebff61f75c Mon Sep 17 00:00:00 2001 From: zhangxiaoxu123456 <zxx19900626> Date: 星期五, 29 四月 2022 17:57:50 +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