You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
2.2 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. // state
  2. export const state = () => ({
  3. pictureUpdate: false,
  4. drawerIsActive: false,
  5. searchDialogIsActive: false,
  6. socialRegisterUpdate: false,
  7. currency: "NTD",
  8. hidePrice:false,
  9. OrgID: 'TE',
  10. });
  11. // actions
  12. export const actions = {
  13. updatePicture({ commit }) {
  14. commit("changePicture");
  15. },
  16. updateRegister({ commit }) {
  17. commit("changeRegisterState");
  18. },
  19. toggleDrawer({ commit }, value) {
  20. commit("toggleDrawerState",value);
  21. },
  22. toggleSearchDialog({ commit },value) {
  23. commit("toggleSearchDialogState",value);
  24. },
  25. updateCurrency({ commit }, value) {
  26. commit("updateCurrencyValue", (value = value));
  27. },
  28. hideSwitchPrice({ commit }, value) {
  29. commit("hideSwitchPriceValue", value);
  30. },
  31. toggleOrgID({ commit }) {
  32. return new Promise((resolve, reject) => {
  33. this.$axios
  34. .get(`/trending/api/index/GetOrgID`)
  35. .then((response) => {
  36. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  37. let data = response.data.DATA.rel
  38. if(data){
  39. commit("toggleOrgIDValue",data);
  40. }
  41. }
  42. resolve();
  43. })
  44. .catch((error) =>
  45. reject(error)
  46. );
  47. })
  48. },
  49. };
  50. // mutations
  51. export const mutations = {
  52. changePicture(state) {
  53. state.pictureUpdate = !state.pictureUpdate;
  54. },
  55. changeRegisterState(state) {
  56. state.socialRegisterUpdate = !state.socialRegisterUpdate;
  57. },
  58. toggleDrawerState(state, payload) {
  59. state.drawerIsActive = payload;
  60. },
  61. toggleSearchDialogState(state,payload) {
  62. state.searchDialogIsActive = payload;
  63. },
  64. updateCurrencyValue(state, value) {
  65. state.currency = value;
  66. },
  67. hideSwitchPriceValue(state,payload) {
  68. state.hidePrice = payload
  69. },
  70. toggleOrgIDValue(state, value) {
  71. state.OrgID = value;
  72. },
  73. };
  74. // getters
  75. export const getters = {
  76. getPictureStatus(state) {
  77. return state.pictureUpdate;
  78. },
  79. getRegisterStatus(state) {
  80. return state.socialRegisterUpdate;
  81. },
  82. getDrawerStatus(state) {
  83. return state.drawerIsActive;
  84. },
  85. getSearchDialogStatus(state) {
  86. return state.searchDialogIsActive;
  87. },
  88. getCurrency(state) {
  89. return state.currency;
  90. },
  91. getHidePrice(state) {
  92. return state.hidePrice;
  93. },
  94. getOrgID(state) {
  95. return state.OrgID;
  96. },
  97. };