option.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. appId: '',
  16. returnUrl: '',
  17. baseUrl: '',
  18. inviteSpaceUU: '',
  19. inviteUserUU: '',
  20. fullPath: '',
  21. // 用户信息
  22. isLogin: {
  23. // 是否登录
  24. logged: false,
  25. fetching: false,
  26. data: []
  27. },
  28. // 获取用户信息
  29. userInfo: {
  30. fetching: false,
  31. data: []
  32. },
  33. // 系统设置
  34. globalOptions: {
  35. fetching: false,
  36. data: {}
  37. }
  38. })
  39. export const mutations = {
  40. SET_USER_AGENT (state, result) {
  41. state.userAgent = result
  42. },
  43. SET_MOBILE_LAYOUT (state, result) {
  44. state.isMobile = result
  45. },
  46. SET_COOKIES (state, result) {
  47. state.cookies = result || ''
  48. },
  49. SET_SESSION_ID (state, result) {
  50. state.sessionId = result || ''
  51. },
  52. UPDATE_URL (state, result) {
  53. state.url = result
  54. },
  55. SET_APPID (state, result) {
  56. state.appId = result || ''
  57. },
  58. SET_RETURNURL (state, result) {
  59. state.returnUrl = result || ''
  60. },
  61. SET_BASEURL (state, result) {
  62. state.baseUrl = result || ''
  63. },
  64. SET_INVITESPACEUU (state, result) {
  65. state.inviteSpaceUU = result || ''
  66. },
  67. SET_INVITEUSERUU (state, result) {
  68. state.inviteUserUU = result || ''
  69. },
  70. SET_INVITATIONTIME (state, result) {
  71. state.invitationTime = result || ''
  72. },
  73. SET_FULLPATH (state, result) {
  74. state.fullPath = result || ''
  75. },
  76. REQUEST_USER_INFO (state) {
  77. state.userInfo.fetching = true
  78. },
  79. REQUEST_USER_INFO_SUCCESS (state, result) {
  80. state.userInfo.data = result || {}
  81. state.userInfo.fetching = false
  82. },
  83. REQUEST_USER_INFO_FAILURE (state) {
  84. state.userInfo.fetching = true
  85. state.userInfo.data = {}
  86. },
  87. REQUEST_IS_LOGIN (state) {
  88. state.isLogin.fetching = true
  89. },
  90. REQUEST_IS_LOGIN_SUCCESS (state, result) {
  91. state.isLogin.fetching = false
  92. state.isLogin.data = result || {}
  93. state.isLogin.logged = !!(result && result.userName)
  94. },
  95. REQUEST_IS_LOGIN_FAILURE (state) {
  96. state.isLogin.fetching = false
  97. state.isLogin.data = {}
  98. },
  99. REQUEST_LOGOUT_SUCCESS (state) {
  100. state.isLogin.data = {}
  101. state.isLogin.logged = false
  102. },
  103. REQUEST_GLOBAL_OPTIONS (state) {
  104. state.globalOptions.fetching = true
  105. },
  106. REQUEST_GLOBAL_OPTIONS_SUCCESS (state, result) {
  107. state.globalOptions.fetching = false
  108. state.globalOptions.data = result
  109. },
  110. REQUEST_GLOBAL_OPTIONS_FAILURE (state) {
  111. state.globalOptions.fetching = false
  112. }
  113. }