| | |
| | | import Vue from 'vue' |
| | | import Vuex from 'vuex' |
| | | import { getUserInfodata } from "@/axios/api"; |
| | | import Vue from "vue"; |
| | | import Vuex from "vuex"; |
| | | // import getters from './getters' |
| | | // import actions from './actions' |
| | | // import mutations from './mutations' |
| | | |
| | | Vue.use(Vuex) |
| | | Vue.use(Vuex); |
| | | |
| | | let state = { |
| | | className: 'black', |
| | | theme:'red', |
| | | userInfo: { // 用户信息 |
| | | }, |
| | | className: "black", |
| | | theme: "red", |
| | | userInfo: window.localStorage.getItem("useInfo") |
| | | ? JSON.parse(window.localStorage.getItem("useInfo")) |
| | | : {}, |
| | | user: {}, |
| | | bankInfo: { |
| | | bankNo: '' |
| | | bankNo: "" |
| | | }, |
| | | hide: false, |
| | | select: '/home', // 菜单选择 |
| | | token: 'USER62CCF5221CD752269D47681374DD0916', |
| | | select: "/home", // 菜单选择 |
| | | token: window.localStorage.getItem("USERTOKEN") || null, |
| | | elAlertShow: false, |
| | | elAlertText: '', |
| | | elAlertText: "", |
| | | dialogVisible: false, |
| | | elAlertType: 'warning', |
| | | settingForm: { // 产品配置 |
| | | elAlertType: "warning", |
| | | settingForm: { |
| | | // 产品配置 |
| | | futuresDisplay: false, |
| | | indexDisplay: false, |
| | | kcStockDisplay: false, |
| | | stockDisplay: false |
| | | } |
| | | } |
| | | }; |
| | | |
| | | export default new Vuex.Store({ |
| | | state, |
| | | actions: {}, |
| | | actions: { |
| | | async setUseInfo({ commit }) { |
| | | let data = await getUserInfodata(); |
| | | if (data.status == 0) { |
| | | commit("SET_USE_INFO", data.data); |
| | | } else { |
| | | commit("elAlertShow", { |
| | | elAlertShow: true, |
| | | elAlertText: data.msg |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | mutations: { |
| | | SET_USE_INFO(state, useInfo) { |
| | | state.userInfo = useInfo; |
| | | window.localStorage.setItem("useInfo", JSON.stringify(useInfo)); |
| | | }, |
| | | undataToken(state, token) { |
| | | state.token = token || null; |
| | | }, |
| | | elAlertShow(state, payload) { |
| | | state.elAlertShow = payload.elAlertShow; |
| | | state.elAlertText = payload.elAlertText; |
| | | if(payload.elAlertType){ |
| | | if (payload.elAlertType) { |
| | | state.elAlertType = payload.elAlertType; |
| | | } |
| | | }, |
| | | dialogVisible(state, payload) { |
| | | state.dialogVisible = payload; |
| | | // state.dialogVisible = payload; |
| | | } |
| | | }, |
| | | getters: {} |
| | | }) |
| | | }); |