option.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * 全局设置
  3. */
  4. export const state = () => ({
  5. userAgent: '',
  6. // 是否移动端
  7. isMobile: false,
  8. // 身份token
  9. cookies: '',
  10. // 用户身份SessionId
  11. sessionId: '',
  12. // 正式系统地址
  13. url: 'http://218.17.158.219:9090/platform-b2c',
  14. // 用户信息
  15. user: {
  16. // 是否登录
  17. logged: false,
  18. fetching: false,
  19. data: {}
  20. },
  21. // 系统设置
  22. globalOptions: {
  23. fetching: false,
  24. data: {}
  25. },
  26. storeStatus: {
  27. fetching: false,
  28. data: {}
  29. },
  30. infoWithAdmin: {
  31. fetching: false,
  32. data: {}
  33. },
  34. // 微信用户信息
  35. wechatInfo: {
  36. fetching: false,
  37. data: {}
  38. },
  39. messageType: '',
  40. showMobileFooter: true
  41. })
  42. export const mutations = {
  43. SET_USER_AGENT (state, result) {
  44. state.userAgent = result
  45. },
  46. SET_MOBILE_LAYOUT (state, result) {
  47. state.isMobile = result
  48. },
  49. SET_COOKIES (state, result) {
  50. state.cookies = result || ''
  51. },
  52. ADD_COOKIES (state, result) {
  53. state.cookies += result || ''
  54. },
  55. SET_SESSION_ID (state, result) {
  56. state.sessionId = result || ''
  57. },
  58. UPDATE_URL (state, result) {
  59. state.url = result
  60. },
  61. REQUEST_USER_INFO (state) {
  62. state.user.fetching = true
  63. },
  64. REQUEST_USER_INFO_SUCCESS (state, result) {
  65. state.user.fetching = false
  66. state.user.data = result || {}
  67. state.user.logged = result && result.userName
  68. },
  69. REQUEST_USER_INFO_FAILURE (state) {
  70. state.user.fetching = false
  71. state.user.data = {}
  72. },
  73. REQUEST_ADMIN_INFO (state) {
  74. state.infoWithAdmin.fetching = true
  75. },
  76. REQUEST_ADMIN_INFO_SUCCESS (state, result) {
  77. state.infoWithAdmin.fetching = false
  78. state.infoWithAdmin.data = result || {}
  79. },
  80. REQUEST_ADMIN_INFO_FAILURE (state) {
  81. state.user.fetching = false
  82. state.infoWithAdmin.data = {}
  83. },
  84. REQUEST_LOGOUT_SUCCESS (state) {
  85. state.user.data = {}
  86. state.user.logged = false
  87. },
  88. REQUEST_GLOBAL_OPTIONS (state) {
  89. state.globalOptions.fetching = true
  90. },
  91. REQUEST_GLOBAL_OPTIONS_SUCCESS (state, result) {
  92. state.globalOptions.fetching = false
  93. state.globalOptions.data = result
  94. },
  95. REQUEST_GLOBAL_OPTIONS_FAILURE (state) {
  96. state.globalOptions.fetching = false
  97. },
  98. REQUEST_STORE_STATUS (state) {
  99. state.storeStatus.fetching = true
  100. },
  101. REQUEST_STORE_STATUS_SUCCESS(state, result) {
  102. state.storeStatus.fetching = false
  103. state.storeStatus.data = result
  104. },
  105. REQUEST_STORE_STATUS_FAILURE (state) {
  106. state.storeStatus.fetching = false
  107. state.storeStatus.data = {}
  108. },
  109. REQUEST_WECHATINFO_STATUS (state) {
  110. state.wechatInfo.fetching = true
  111. },
  112. REQUEST_WECHATINFO_STATUS_SUCCESS(state, result) {
  113. state.wechatInfo.fetching = false
  114. state.wechatInfo.data = result
  115. },
  116. REQUEST_WECHATINFO_STATUS_FAILURE (state) {
  117. state.wechatInfo.fetching = false
  118. },
  119. GET_MESSAGETYPE (state, result) {
  120. state.messageType = result || ''
  121. },
  122. SET_SHOW_MOBILE_FOOTER (state, result) {
  123. state.showMobileFooter = result
  124. }
  125. }