option.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. counter: {
  23. fetching: false,
  24. data: {}
  25. },
  26. // 系统设置
  27. globalOptions: {
  28. fetching: false,
  29. data: {}
  30. },
  31. storeStatus: {
  32. fetching: false,
  33. data: {}
  34. },
  35. infoWithAdmin: {
  36. fetching: false,
  37. data: {}
  38. },
  39. // 微信用户信息
  40. wechatInfo: {
  41. fetching: false,
  42. data: {}
  43. },
  44. messageType: '',
  45. showMobileFooter: true
  46. })
  47. export const mutations = {
  48. SET_USER_AGENT (state, result) {
  49. state.userAgent = result
  50. },
  51. SET_MOBILE_LAYOUT (state, result) {
  52. state.isMobile = result
  53. },
  54. SET_COOKIES (state, result) {
  55. state.cookies = result || ''
  56. },
  57. ADD_COOKIES (state, result) {
  58. state.cookies += result || ''
  59. },
  60. SET_SESSION_ID (state, result) {
  61. state.sessionId = result || ''
  62. },
  63. UPDATE_URL (state, result) {
  64. state.url = result
  65. },
  66. REQUEST_USER_INFO (state) {
  67. state.user.fetching = true
  68. },
  69. REQUEST_USER_INFO_SUCCESS (state, result) {
  70. state.user.fetching = false
  71. state.user.data = result || {}
  72. state.user.logged = result && result.userName
  73. },
  74. REQUEST_USER_INFO_FAILURE (state) {
  75. state.user.fetching = false
  76. state.user.data = {}
  77. },
  78. REQUEST_COUNTER (state) {
  79. state.counter.fetching = true
  80. },
  81. REQUEST_COUNTER_SUCCESS (state, result) {
  82. state.counter.fetching = false
  83. state.counter.data = result || {}
  84. },
  85. REQUEST_COUNTER_FAILURE (state) {
  86. state.counter.fetching = false
  87. state.counter.data = {}
  88. },
  89. REQUEST_ADMIN_INFO (state) {
  90. state.infoWithAdmin.fetching = true
  91. },
  92. REQUEST_ADMIN_INFO_SUCCESS (state, result) {
  93. state.infoWithAdmin.fetching = false
  94. state.infoWithAdmin.data = result || {}
  95. },
  96. REQUEST_ADMIN_INFO_FAILURE (state) {
  97. state.user.fetching = false
  98. state.infoWithAdmin.data = {}
  99. },
  100. REQUEST_LOGOUT_SUCCESS (state) {
  101. state.user.data = {}
  102. state.user.logged = false
  103. },
  104. REQUEST_GLOBAL_OPTIONS (state) {
  105. state.globalOptions.fetching = true
  106. },
  107. REQUEST_GLOBAL_OPTIONS_SUCCESS (state, result) {
  108. state.globalOptions.fetching = false
  109. state.globalOptions.data = result
  110. },
  111. REQUEST_GLOBAL_OPTIONS_FAILURE (state) {
  112. state.globalOptions.fetching = false
  113. },
  114. REQUEST_STORE_STATUS (state) {
  115. state.storeStatus.fetching = true
  116. },
  117. REQUEST_STORE_STATUS_SUCCESS(state, result) {
  118. state.storeStatus.fetching = false
  119. state.storeStatus.data = result
  120. },
  121. REQUEST_STORE_STATUS_FAILURE (state) {
  122. state.storeStatus.fetching = false
  123. state.storeStatus.data = {}
  124. },
  125. REQUEST_WECHATINFO_STATUS (state) {
  126. state.wechatInfo.fetching = true
  127. },
  128. REQUEST_WECHATINFO_STATUS_SUCCESS(state, result) {
  129. state.wechatInfo.fetching = false
  130. state.wechatInfo.data = result
  131. },
  132. REQUEST_WECHATINFO_STATUS_FAILURE (state) {
  133. state.wechatInfo.fetching = false
  134. },
  135. GET_MESSAGETYPE (state, result) {
  136. state.messageType = result || ''
  137. },
  138. SET_SHOW_MOBILE_FOOTER (state, result) {
  139. state.showMobileFooter = result
  140. }
  141. }