12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import {
- reqLogin
- } from "@/request/api.js";
- import cloneDeep from 'lodash/cloneDeep'
- const stateReset = {
- loginInfo: {}, //当前登录用户信息
- };
- const state = cloneDeep(stateReset);
- const getters = {};
- const mutations = {
- // 重置数据
- resetVxLogin(state) {
- Object.assign(state, cloneDeep(stateReset))
- },
- // 登录
- vxLogin(state, args) {
- state.loginInfo = args || {};
- },
- // 修改当前登录用户信息
- changeLoginInfo(state, args) {
- state.loginInfo.user = args || {};
- },
- };
- const actions = {
- // 登录
- async vxLogin({
- commit
- }, args) {
- let result = await reqLogin(args);
- if (result.status == 200) {
- commit("vxLogin", result.user);
- }
- return result;
- },
- };
- export default {
- namespaced: true,
- state,
- getters,
- mutations,
- actions,
- };
|