udxcms 1.0.28 → 1.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author:
3
3
  * @Date: 2020-11-19 12:38:02
4
- * @LastEditTime: 2025-09-29 11:08:17
4
+ * @LastEditTime: 2025-10-09 18:54:36
5
5
  * @LastEditors: lewis lewis@everylink.ai
6
6
  * @Description:
7
7
  -->
@@ -78,9 +78,7 @@
78
78
  },
79
79
  computed: {
80
80
  ...mapState('user', ['currency', 'userInfo']),
81
- currencyList() {
82
- return this.$store.state.cmsstore.currencyList || []
83
- }
81
+ ...mapState('cmsstore', ['currencyList'])
84
82
  },
85
83
  data() {
86
84
  return {
@@ -90,27 +88,50 @@
90
88
  }
91
89
  },
92
90
  created() {
93
- if (!this.currencyList.length) {
91
+ console.log('Currency component created, initial currencyList:', this.currencyList)
92
+
93
+ if (!this.currencyList || !this.currencyList.length) {
94
+ console.log('Fetching currency data...')
94
95
  getCurrency().then(res => {
95
96
  if (res.code == 200) {
96
97
  let resData = res.data
97
98
  let currencyList = resData && resData.map(v => v.currency_list)
98
- this.$store.commit('setCurrencyList', [].concat.apply([], currencyList))
99
- this.initCurreny()
99
+ console.log('Fetched currency data:', currencyList)
100
+
101
+ // 确保数据扁平化
102
+ const flatCurrencyList = [].concat.apply([], currencyList)
103
+ console.log('Flattened currency list:', flatCurrencyList)
104
+
105
+ this.$store.commit('setCurrencyList', flatCurrencyList)
106
+ console.log('After commit - store state:', this.$store.state.cmsstore)
107
+ console.log('After commit - computed currencyList:', this.currencyList)
108
+
109
+ this.$nextTick(() => {
110
+ this.initCurreny()
111
+ })
100
112
  }
101
113
  }).catch(e => console.log(e))
102
114
  } else {
115
+ console.log('Currency list already exists:', this.currencyList)
103
116
  this.initCurreny()
104
117
  }
105
118
  this.getLangList()
106
119
  this.$nextTick(() => {
107
- $Vue.$bus.$on('setLang', () => {
108
- this.setLang()
109
- })
120
+ if (typeof $Vue !== 'undefined' && $Vue.$bus) {
121
+ $Vue.$bus.$on('setLang', () => {
122
+ this.setLang()
123
+ })
124
+ }
110
125
  })
111
-
112
126
  },
113
127
  watch: {
128
+ currencyList: {
129
+ handler(newVal, oldVal) {
130
+ console.log('currencyList watch - new:', newVal, 'old:', oldVal)
131
+ },
132
+ immediate: true,
133
+ deep: true
134
+ },
114
135
  value: function(val,oldValue) {
115
136
  if (!val) {
116
137
  document.removeEventListener('click',closeFn)
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * @Author: lewis lewis@everylink.ai
3
3
  * @Date: 2025-09-17 10:50:27
4
4
  * @LastEditors: lewis lewis@everylink.ai
5
- * @LastEditTime: 2025-09-25 10:24:36
5
+ * @LastEditTime: 2025-10-09 18:53:51
6
6
  * @FilePath: /localTools/Users/apple/web-front/web-front/src/common_modules/cms-submodule/index.js
7
7
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
8
8
  */
@@ -106,75 +106,77 @@ export function init({ Vue, router, store, Parent, onComponentsRegistered, onRou
106
106
  console.log(`模块结构 - state:`, !!actualModule.state, 'mutations:', !!actualModule.mutations, 'actions:', !!actualModule.actions);
107
107
  if (actualModule.state || actualModule.mutations || actualModule.actions) {
108
108
  console.log(`注册模块 ${v} 成功`);
109
+ // 使用原始模块名,不进行小写转换
110
+ const moduleName = v === 'CmsStore' ? 'cmsstore' : v;
111
+ store.registerModule(moduleName, actualModule, { preserveState: false });
109
112
  // 特殊处理 CmsStore - 直接合并到根 store
110
- if (v === 'CmsStore') {
111
- console.log('将 CmsStore 直接合并到根 store');
112
- // 1. 直接修改根 state 来添加 cms 命名空间
113
- if (actualModule.state) {
114
- if (!store.state.cmsstore) {
115
- store.state.cmsstore = {};
116
- }
117
- Object.keys(actualModule.state).forEach(key => {
118
- store.state.cmsstore[key] = actualModule.state[key];
119
- });
120
- }
121
- // 2. 直接修改 store._mutations 来添加根级别 mutations
122
- if (actualModule.mutations) {
123
- console.log('添加根级别 mutations:', Object.keys(actualModule.mutations));
124
- console.log('当前 store._mutations:', Object.keys(store._mutations));
125
- Object.keys(actualModule.mutations).forEach(mutationName => {
126
- if (!store._mutations[mutationName]) {
127
- store._mutations[mutationName] = [];
128
- }
129
- // 添加 mutation 处理器
130
- store._mutations[mutationName].push(function (payload) {
131
- // 获取当前模块状态
132
- const moduleState = store.state.cmsstore || actualModule.state;
133
- // 调用原始 mutation
134
- return actualModule.mutations[mutationName](moduleState, payload);
135
- });
136
- console.log(`已注册 mutation: ${mutationName}`);
137
- });
138
- console.log('注册后的 store._mutations:', Object.keys(store._mutations));
139
- }
140
- // 3. 直接修改 store._actions 来添加根级别 actions
141
- if (actualModule.actions) {
142
- console.log('添加根级别 actions:', Object.keys(actualModule.actions));
143
- Object.keys(actualModule.actions).forEach(actionName => {
144
- if (!store._actions[actionName]) {
145
- store._actions[actionName] = [];
146
- }
147
- // 添加 action 处理器
148
- store._actions[actionName].push(function (payload) {
149
- // 创建正确的 context
150
- const context = {
151
- state: store.state.cmsstore || actualModule.state,
152
- rootState: store.state,
153
- commit: store.commit,
154
- dispatch: store.dispatch,
155
- getters: store.getters,
156
- rootGetters: store.getters
157
- };
158
- // 调用原始 action
159
- return actualModule.actions[actionName](context, payload);
160
- });
161
- });
162
- }
163
- // 4. 直接修改 store._wrappedGetters 来添加根级别 getters
164
- if (actualModule.getters) {
165
- console.log('添加根级别 getters:', Object.keys(actualModule.getters));
166
- Object.keys(actualModule.getters).forEach(getterName => {
167
- store._wrappedGetters[getterName] = function () {
168
- const moduleState = store.state.cmsstore || actualModule.state;
169
- return actualModule.getters[getterName](moduleState, store.getters, store.state, store.getters);
170
- };
171
- });
172
- }
173
- }
174
- else {
175
- // 其他模块按正常方式注册
176
- store.registerModule(v, actualModule, { preserveState: true });
177
- }
113
+ // if (v === 'CmsStore') {
114
+ // console.log('将 CmsStore 直接合并到根 store');
115
+ // // 1. 直接修改根 state 来添加 cms 命名空间
116
+ // if (actualModule.state) {
117
+ // if (!store.state.cmsstore) {
118
+ // store.state.cmsstore = {};
119
+ // }
120
+ // Object.keys(actualModule.state).forEach(key => {
121
+ // store.state.cmsstore[key] = actualModule.state[key];
122
+ // });
123
+ // }
124
+ // // 2. 直接修改 store._mutations 来添加根级别 mutations
125
+ // if (actualModule.mutations) {
126
+ // console.log('添加根级别 mutations:', Object.keys(actualModule.mutations));
127
+ // console.log('当前 store._mutations:', Object.keys(store._mutations));
128
+ // Object.keys(actualModule.mutations).forEach(mutationName => {
129
+ // if (!store._mutations[mutationName]) {
130
+ // store._mutations[mutationName] = [];
131
+ // }
132
+ // // 添加 mutation 处理器
133
+ // store._mutations[mutationName].push(function(payload) {
134
+ // // 获取当前模块状态
135
+ // const moduleState = store.state.cmsstore || actualModule.state;
136
+ // // 调用原始 mutation
137
+ // return actualModule.mutations[mutationName](moduleState, payload);
138
+ // });
139
+ // console.log(`已注册 mutation: ${mutationName}`);
140
+ // });
141
+ // console.log('注册后的 store._mutations:', Object.keys(store._mutations));
142
+ // }
143
+ // // 3. 直接修改 store._actions 来添加根级别 actions
144
+ // if (actualModule.actions) {
145
+ // console.log('添加根级别 actions:', Object.keys(actualModule.actions));
146
+ // Object.keys(actualModule.actions).forEach(actionName => {
147
+ // if (!store._actions[actionName]) {
148
+ // store._actions[actionName] = [];
149
+ // }
150
+ // // 添加 action 处理器
151
+ // store._actions[actionName].push(function(payload) {
152
+ // // 创建正确的 context
153
+ // const context = {
154
+ // state: store.state.cmsstore || actualModule.state,
155
+ // rootState: store.state,
156
+ // commit: store.commit,
157
+ // dispatch: store.dispatch,
158
+ // getters: store.getters,
159
+ // rootGetters: store.getters
160
+ // };
161
+ // // 调用原始 action
162
+ // return actualModule.actions[actionName](context, payload);
163
+ // });
164
+ // });
165
+ // }
166
+ // // 4. 直接修改 store._wrappedGetters 来添加根级别 getters
167
+ // if (actualModule.getters) {
168
+ // console.log('添加根级别 getters:', Object.keys(actualModule.getters));
169
+ // Object.keys(actualModule.getters).forEach(getterName => {
170
+ // store._wrappedGetters[getterName] = function() {
171
+ // const moduleState = store.state.cmsstore || actualModule.state;
172
+ // return actualModule.getters[getterName](moduleState, store.getters, store.state, store.getters);
173
+ // };
174
+ // });
175
+ // }
176
+ // } else {
177
+ // // 其他模块按正常方式注册
178
+ // store.registerModule(v, actualModule, { preserveState: true });
179
+ // }
178
180
  }
179
181
  else {
180
182
  console.warn(`模块 ${v} 结构不正确:`, actualModule);
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
13
13
  * @Author:
14
14
  * @Date: 2021-07-30 10:46:1
15
15
  * @LastEditors: lewis lewis@everylink.ai
16
- * @LastEditTime: 2025-09-24 20:51:05
16
+ * @LastEditTime: 2025-10-09 18:55:01
17
17
  */
18
18
  import { getSignleSymbolPrice } from '../api/common';
19
19
  export default {
@@ -71,7 +71,7 @@ export default {
71
71
  // state.coins = coins || [];
72
72
  // },
73
73
  setCurrencyList(state, currencyList) {
74
- state.currencyList = currencyList || [];
74
+ state.currencyList = [...currencyList];
75
75
  },
76
76
  setExplorerSets(state, explorerSets) {
77
77
  state.explorerSets = explorerSets;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "udxcms",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "description": "cms submodule",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",