data.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. const data = {
  2. state: {
  3. hasLogin: false,
  4. userInfo:{},
  5. is_bind:false,
  6. configList:[],
  7. filedList:[],
  8. org:{}
  9. },
  10. getters:{
  11. getHasLogin(state,getters){
  12. return state.hasLogin
  13. },
  14. getUserInfo(state,getters){
  15. return state.userInfo
  16. },
  17. getBind(state,getters){
  18. return state.is_bind
  19. },
  20. getConfigList(state,getters){
  21. return state.configList
  22. }
  23. },
  24. mutations: {
  25. setHasLogin(state, newState){
  26. state.is_bind = newState.is_bind
  27. state.userInfo = newState.userInfo
  28. state.hasLogin = true
  29. console.log('state.is_bind',state.is_bind)
  30. uni.setStorageSync('userInfo',newState)
  31. },
  32. setIsBand(state, newState){
  33. state.is_bind = newState.is_bind
  34. state.userInfo = newState.userInfo
  35. },
  36. setLogout(state){
  37. state.userInfo = {}
  38. state.hasLogin = false
  39. state.is_bind = false
  40. uni.clearStorageSync('userInfo')
  41. },
  42. setConfigList(state, newState){
  43. state.configList = newState.configList
  44. },
  45. setFiledList(state, newState){
  46. state.filedList = newState.filedList
  47. },
  48. setOrg(state, newState){
  49. state.org = newState.org
  50. },
  51. },
  52. actions: { // 使用actions,通过mutations更改state的值
  53. // handleSetNum2({ commit }, data) {
  54. // commit('setNum2', data)
  55. // }
  56. }
  57. }
  58. export default data