option.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. //币别
  45. currency: '',
  46. messageType: '',
  47. showMobileFooter: true
  48. })
  49. export const mutations = {
  50. SET_USER_AGENT (state, result) {
  51. state.userAgent = result
  52. },
  53. SET_MOBILE_LAYOUT (state, result) {
  54. state.isMobile = result
  55. },
  56. SET_COOKIES (state, result) {
  57. state.cookies = result || ''
  58. },
  59. ADD_COOKIES (state, result) {
  60. state.cookies += result || ''
  61. },
  62. SET_SESSION_ID (state, result) {
  63. state.sessionId = result || ''
  64. },
  65. UPDATE_URL (state, result) {
  66. state.url = result
  67. },
  68. REQUEST_USER_INFO (state) {
  69. state.user.fetching = true
  70. },
  71. REQUEST_USER_INFO_SUCCESS (state, result) {
  72. state.user.fetching = false
  73. state.user.data = result || {}
  74. state.user.logged = result && result.userName
  75. },
  76. REQUEST_USER_INFO_FAILURE (state) {
  77. state.user.fetching = false
  78. state.user.data = {}
  79. },
  80. REQUEST_COUNTER (state) {
  81. state.counter.fetching = true
  82. },
  83. REQUEST_COUNTER_SUCCESS (state, result) {
  84. state.counter.fetching = false
  85. state.counter.data = result || {}
  86. },
  87. REQUEST_COUNTER_FAILURE (state) {
  88. state.counter.fetching = false
  89. state.counter.data = {}
  90. },
  91. REQUEST_ADMIN_INFO (state) {
  92. state.infoWithAdmin.fetching = true
  93. },
  94. REQUEST_ADMIN_INFO_SUCCESS (state, result) {
  95. state.infoWithAdmin.fetching = false
  96. state.infoWithAdmin.data = result || {}
  97. },
  98. REQUEST_ADMIN_INFO_FAILURE (state) {
  99. state.user.fetching = false
  100. state.infoWithAdmin.data = {}
  101. },
  102. REQUEST_LOGOUT_SUCCESS (state) {
  103. state.user.data = {}
  104. state.user.logged = false
  105. },
  106. REQUEST_GLOBAL_OPTIONS (state) {
  107. state.globalOptions.fetching = true
  108. },
  109. REQUEST_GLOBAL_OPTIONS_SUCCESS (state, result) {
  110. state.globalOptions.fetching = false
  111. state.globalOptions.data = result
  112. },
  113. REQUEST_GLOBAL_OPTIONS_FAILURE (state) {
  114. state.globalOptions.fetching = false
  115. },
  116. REQUEST_STORE_STATUS (state) {
  117. state.storeStatus.fetching = true
  118. },
  119. REQUEST_STORE_STATUS_SUCCESS(state, result) {
  120. state.storeStatus.fetching = false
  121. state.storeStatus.data = result
  122. },
  123. REQUEST_STORE_STATUS_FAILURE (state) {
  124. state.storeStatus.fetching = false
  125. state.storeStatus.data = {}
  126. },
  127. REQUEST_WECHATINFO_STATUS (state) {
  128. state.wechatInfo.fetching = true
  129. },
  130. REQUEST_WECHATINFO_STATUS_SUCCESS(state, result) {
  131. state.wechatInfo.fetching = false
  132. state.wechatInfo.data = result
  133. },
  134. REQUEST_WECHATINFO_STATUS_FAILURE (state) {
  135. state.wechatInfo.fetching = false
  136. },
  137. SET_CURRENCY (state, result) {
  138. state.currency = result.data || 'RMB'
  139. },
  140. GET_MESSAGETYPE (state, result) {
  141. state.messageType = result || ''
  142. },
  143. SET_SHOW_MOBILE_FOOTER (state, result) {
  144. state.showMobileFooter = result
  145. }
  146. }