udxcms 1.0.28 → 1.0.30

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-10 11:44:39
5
5
  * @LastEditors: lewis lewis@everylink.ai
6
6
  * @Description:
7
7
  -->
@@ -90,27 +90,50 @@
90
90
  }
91
91
  },
92
92
  created() {
93
- if (!this.currencyList.length) {
93
+ console.log('Currency component created, initial currencyList:', this.currencyList)
94
+
95
+ if (!this.currencyList || !this.currencyList.length) {
96
+ console.log('Fetching currency data...')
94
97
  getCurrency().then(res => {
95
98
  if (res.code == 200) {
96
99
  let resData = res.data
97
100
  let currencyList = resData && resData.map(v => v.currency_list)
98
- this.$store.commit('setCurrencyList', [].concat.apply([], currencyList))
99
- this.initCurreny()
101
+ console.log('Fetched currency data:', currencyList)
102
+
103
+ // 确保数据扁平化
104
+ const flatCurrencyList = [].concat.apply([], currencyList)
105
+ console.log('Flattened currency list:', flatCurrencyList)
106
+
107
+ this.$store.commit('setCurrencyList', flatCurrencyList)
108
+ console.log('After commit - store state:', this.$store.state.cmsstore)
109
+ console.log('After commit - computed currencyList:', this.currencyList)
110
+
111
+ this.$nextTick(() => {
112
+ this.initCurreny()
113
+ })
100
114
  }
101
115
  }).catch(e => console.log(e))
102
116
  } else {
117
+ console.log('Currency list already exists:', this.currencyList)
103
118
  this.initCurreny()
104
119
  }
105
120
  this.getLangList()
106
121
  this.$nextTick(() => {
107
- $Vue.$bus.$on('setLang', () => {
108
- this.setLang()
109
- })
122
+ if (typeof $Vue !== 'undefined' && $Vue.$bus) {
123
+ $Vue.$bus.$on('setLang', () => {
124
+ this.setLang()
125
+ })
126
+ }
110
127
  })
111
-
112
128
  },
113
129
  watch: {
130
+ currencyList: {
131
+ handler(newVal, oldVal) {
132
+ console.log('currencyList watch - new:', newVal, 'old:', oldVal)
133
+ },
134
+ immediate: true,
135
+ deep: true
136
+ },
114
137
  value: function(val,oldValue) {
115
138
  if (!val) {
116
139
  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-10 11:43:20
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,78 @@ 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
+ // TODO失去了数据响应式
112
+ store.registerModule(moduleName, actualModule, { preserveState: true });
109
113
  // 特殊处理 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
- }
114
+ // if (v === 'CmsStore') {
115
+ // console.log('将 CmsStore 直接合并到根 store');
116
+ // // 1. 直接修改根 state 来添加 cms 命名空间
117
+ // if (actualModule.state) {
118
+ // if (!store.state.cmsstore) {
119
+ // store.state.cmsstore = {};
120
+ // }
121
+ // Object.keys(actualModule.state).forEach(key => {
122
+ // store.state.cmsstore[key] = actualModule.state[key];
123
+ // });
124
+ // }
125
+ // // 2. 直接修改 store._mutations 来添加根级别 mutations
126
+ // if (actualModule.mutations) {
127
+ // console.log('添加根级别 mutations:', Object.keys(actualModule.mutations));
128
+ // console.log('当前 store._mutations:', Object.keys(store._mutations));
129
+ // Object.keys(actualModule.mutations).forEach(mutationName => {
130
+ // if (!store._mutations[mutationName]) {
131
+ // store._mutations[mutationName] = [];
132
+ // }
133
+ // // 添加 mutation 处理器
134
+ // store._mutations[mutationName].push(function(payload) {
135
+ // // 获取当前模块状态
136
+ // const moduleState = store.state.cmsstore || actualModule.state;
137
+ // // 调用原始 mutation
138
+ // return actualModule.mutations[mutationName](moduleState, payload);
139
+ // });
140
+ // console.log(`已注册 mutation: ${mutationName}`);
141
+ // });
142
+ // console.log('注册后的 store._mutations:', Object.keys(store._mutations));
143
+ // }
144
+ // // 3. 直接修改 store._actions 来添加根级别 actions
145
+ // if (actualModule.actions) {
146
+ // console.log('添加根级别 actions:', Object.keys(actualModule.actions));
147
+ // Object.keys(actualModule.actions).forEach(actionName => {
148
+ // if (!store._actions[actionName]) {
149
+ // store._actions[actionName] = [];
150
+ // }
151
+ // // 添加 action 处理器
152
+ // store._actions[actionName].push(function(payload) {
153
+ // // 创建正确的 context
154
+ // const context = {
155
+ // state: store.state.cmsstore || actualModule.state,
156
+ // rootState: store.state,
157
+ // commit: store.commit,
158
+ // dispatch: store.dispatch,
159
+ // getters: store.getters,
160
+ // rootGetters: store.getters
161
+ // };
162
+ // // 调用原始 action
163
+ // return actualModule.actions[actionName](context, payload);
164
+ // });
165
+ // });
166
+ // }
167
+ // // 4. 直接修改 store._wrappedGetters 来添加根级别 getters
168
+ // if (actualModule.getters) {
169
+ // console.log('添加根级别 getters:', Object.keys(actualModule.getters));
170
+ // Object.keys(actualModule.getters).forEach(getterName => {
171
+ // store._wrappedGetters[getterName] = function() {
172
+ // const moduleState = store.state.cmsstore || actualModule.state;
173
+ // return actualModule.getters[getterName](moduleState, store.getters, store.state, store.getters);
174
+ // };
175
+ // });
176
+ // }
177
+ // } else {
178
+ // // 其他模块按正常方式注册
179
+ // store.registerModule(v, actualModule, { preserveState: true });
180
+ // }
178
181
  }
179
182
  else {
180
183
  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.30",
4
4
  "description": "cms submodule",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",