123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- const state = () => ({
- authUserId: '',
- userInfo: {},
- accessToken: '',
- appId: '',
- accountType: '',
- })
- const mutations = {
- // 设置用户信息
- SET_USER_INFO(state, data) {
- state.userInfo = data
- state.accessToken = data.accessToken
- },
- // 设置appId
- SET_APPID(state, appId) {
- state.appId = appId
- },
- // 设置供应商id
- SET_AUTH_USER_ID(state, authUserId) {
- state.authUserId = authUserId
- },
- // 微信公众号状态
- SET_ACCOUNT_TYPE(state, accountType) {
- state.accountType = accountType
- },
- }
- const actions = {
- // 退出登录
- logout({ commit }) {
- commit('SET_USER_INFO', {})
- },
- // 用户登录
- login({ commit }, data) {
- commit('SET_USER_INFO', data)
- },
- }
- export default {
- namespaced: true,
- state,
- mutations,
- actions,
- }
|