12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- const state = () => ({
- authUserId: '',
- userInfo: {},
- accessToken: '',
- appId: '',
- accountType: '',
- clubUserId: '',
- authId: '',
- })
- const mutations = {
- // 设置用户信息
- SET_USER_INFO(state, data) {
- state.userInfo = data
- state.clubUserId = data.clubUserId
- state.authId = data.authId
- 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,
- }
|