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.

110 lines
2.9 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
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. // this.$cookies.set("pictureUpdate",JSON.stringify(state.pictureUpdate));
  55. },
  56. changeRegisterState(state) {
  57. state.socialRegisterUpdate = !state.socialRegisterUpdate;
  58. // this.$cookies.set("socialRegisterUpdate",JSON.stringify(state.socialRegisterUpdate));
  59. },
  60. toggleDrawerState(state, payload) {
  61. state.drawerIsActive = payload;
  62. // this.$cookies.set("drawerIsActive",JSON.stringify(state.drawerIsActive));
  63. },
  64. toggleSearchDialogState(state,payload) {
  65. state.searchDialogIsActive = payload;
  66. // this.$cookies.set("searchDialogIsActive",JSON.stringify(state.searchDialogIsActive));
  67. },
  68. updateCurrencyValue(state, value) {
  69. state.currency = value;
  70. // this.$cookies.set("currency",JSON.stringify(state.currency));
  71. },
  72. hideSwitchPriceValue(state,payload) {
  73. state.hidePrice = payload
  74. // this.$cookies.set("hidePrice",JSON.stringify(state.hidePrice));
  75. },
  76. toggleOrgIDValue(state, value) {
  77. state.OrgID = value;
  78. // this.$cookies.set("OrgID",JSON.stringify(state.OrgID));
  79. },
  80. };
  81. // getters
  82. export const getters = {
  83. getPictureStatus(state) {
  84. // if(this.$cookies.get("pictureUpdate")!=undefined){
  85. // state.pictureUpdate = JSON.parse(this.$cookies.get("pictureUpdate"));
  86. // }
  87. return state.pictureUpdate;
  88. },
  89. getRegisterStatus(state) {
  90. return state.socialRegisterUpdate;
  91. },
  92. getDrawerStatus(state) {
  93. return state.drawerIsActive;
  94. },
  95. getSearchDialogStatus(state) {
  96. return state.searchDialogIsActive;
  97. },
  98. getCurrency(state) {
  99. return state.currency;
  100. },
  101. getHidePrice(state) {
  102. return state.hidePrice;
  103. },
  104. getOrgID(state) {
  105. return state.OrgID;
  106. },
  107. };