app.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * app基本信息
  3. *
  4. */
  5. const state = {
  6. user: {},
  7. organization: {},
  8. project: {},
  9. codeNumber: 60,
  10. identity: {},
  11. coordinates: '116.38,39.9',
  12. activeCity: {
  13. cityName: '北京市',
  14. cityCode: '110100'
  15. }
  16. }
  17. const mutations = {
  18. CHANGE_USER: (state, user) => {
  19. state.user = user;
  20. },
  21. CHANGE_ORGANIZATION: (state, organization) => {
  22. state.organization = organization;
  23. },
  24. CHANGE_PROJECT: (state, project) => {
  25. state.project = project;
  26. },
  27. CHANGE_CODENUMBER: (state, num) => {
  28. state.codeNumber = num;
  29. },
  30. CHANGE_IDENTITY: (state, identity) => {
  31. state.identity = identity;
  32. },
  33. CHANGE_COORDINATES: (state, coordinates) => {
  34. state.coordinates = coordinates;
  35. },
  36. CHANGE_ACTIVECITY: (state, activeCity) => {
  37. state.activeCity = activeCity;
  38. },
  39. }
  40. const actions = {
  41. changeUser({
  42. commit
  43. }, user) {
  44. commit('CHANGE_USER', user);
  45. },
  46. changeOrganization({
  47. commit
  48. }, organization) {
  49. commit('CHANGE_ORGANIZATION', organization);
  50. },
  51. changeProject({
  52. commit,
  53. }, project) {
  54. commit('CHANGE_PROJECT', project);
  55. },
  56. changeCodeNumber({
  57. commit,
  58. }, num) {
  59. commit('CHANGE_CODENUMBER', num < 0 ? 60 : num);
  60. },
  61. changeIdentity({
  62. commit,
  63. }, identity) {
  64. commit('CHANGE_IDENTITY', identity);
  65. },
  66. changeCoordinates({
  67. commit,
  68. }, coordinates) {
  69. commit('CHANGE_COORDINATES', coordinates);
  70. },
  71. changeActiveCity({
  72. commit,
  73. }, activeCity) {
  74. commit('CHANGE_ACTIVECITY', activeCity);
  75. },
  76. }
  77. export default {
  78. namespaced: true,
  79. state,
  80. mutations,
  81. actions
  82. }