app.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * app基本信息
  3. *
  4. */
  5. const state = {
  6. user: {},
  7. organization: {},
  8. project: {},
  9. codeNumber: 60,
  10. identity: {}
  11. }
  12. const mutations = {
  13. CHANGE_USER: (state, user) => {
  14. state.user = user;
  15. },
  16. CHANGE_ORGANIZATION: (state, organization) => {
  17. state.organization = organization;
  18. },
  19. CHANGE_PROJECT: (state, project) => {
  20. state.project = project;
  21. },
  22. CHANGE_CODENUMBER: (state, num) => {
  23. state.codeNumber = num;
  24. },
  25. CHANGE_IDENTITY: (state, identity) => {
  26. state.identity = identity;
  27. }
  28. }
  29. const actions = {
  30. changeUser({
  31. commit
  32. }, user) {
  33. commit('CHANGE_USER', user);
  34. },
  35. changeOrganization({
  36. commit
  37. }, organization) {
  38. commit('CHANGE_ORGANIZATION', organization);
  39. },
  40. changeProject({
  41. commit,
  42. }, project) {
  43. commit('CHANGE_PROJECT', project);
  44. },
  45. changeCodeNumber({
  46. commit,
  47. }, num) {
  48. commit('CHANGE_CODENUMBER', num < 0 ? 60 : num);
  49. },
  50. changeIdentity({
  51. commit,
  52. }, identity) {
  53. commit('CHANGE_IDENTITY', identity);
  54. },
  55. }
  56. export default {
  57. namespaced: true,
  58. state,
  59. mutations,
  60. actions
  61. }