user.js 859 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. const state = () => ({
  2. authUserId: '',
  3. userInfo: {},
  4. accessToken: '',
  5. appId: '',
  6. accountType: '',
  7. clubUserId: ''
  8. })
  9. const mutations = {
  10. // 设置用户信息
  11. SET_USER_INFO(state, data) {
  12. state.userInfo = data
  13. state.clubUserId = data.clubUserId
  14. state.accessToken = data.accessToken
  15. },
  16. // 设置appId
  17. SET_APPID(state, appId) {
  18. state.appId = appId
  19. },
  20. // 设置供应商id
  21. SET_AUTH_USER_ID(state, authUserId) {
  22. state.authUserId = authUserId
  23. },
  24. // 微信公众号状态
  25. SET_ACCOUNT_TYPE(state, accountType) {
  26. state.accountType = accountType
  27. },
  28. }
  29. const actions = {
  30. // 退出登录
  31. logout({ commit }) {
  32. commit('SET_USER_INFO', {})
  33. },
  34. // 用户登录
  35. login({ commit }, data) {
  36. commit('SET_USER_INFO', data)
  37. },
  38. }
  39. export default {
  40. namespaced: true,
  41. state,
  42. mutations,
  43. actions,
  44. }