user.js 654 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import tools from "@/service/tools";
  2. const state = {
  3. token: uni.getStorageSync('token') || '',
  4. m_id: uni.getStorageSync('m_id') || ''
  5. }
  6. const mutations = {
  7. setToken(state, data) {
  8. state.token = data.token
  9. state.m_id = data.m_id
  10. uni.setStorageSync("token", data.token);
  11. uni.setStorageSync("m_id", data.m_id);
  12. },
  13. removeToken(state) {
  14. state.token = ''
  15. state.m_id = ''
  16. uni.removeStorageSync("token");
  17. uni.removeStorageSync("m_id");
  18. }
  19. }
  20. const actions = {
  21. async getSignInInfo(context, data) {
  22. },
  23. async login(context, data) {
  24. }
  25. }
  26. export default {
  27. namespaced: true,
  28. state,
  29. mutations,
  30. actions
  31. }