gc_i18n 1.1.5 → 1.1.7
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.
- package/lang/index.json +5 -0
- package/lib/gc_i18n.css +1 -1
- package/lib/gc_i18n.js +547 -538
- package/lib/gc_i18n.umd.cjs +8 -8
- package/package.json +1 -1
- package/packages/components/config.vue +40 -26
- package/packages/index.js +13 -11
- package/src/view/test.vue +1 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script lang="jsx">
|
|
2
2
|
import _ from "lodash-es";
|
|
3
3
|
import { getAllTranslate, getLanguages, saveTranslate } from "../libs/service";
|
|
4
|
-
import { Message
|
|
5
|
-
import { convertArrayToObject } from "../libs/utils";
|
|
4
|
+
import { Message } from "view-ui-plus";
|
|
6
5
|
|
|
7
6
|
export default {
|
|
8
7
|
data() {
|
|
@@ -31,14 +30,9 @@ export default {
|
|
|
31
30
|
let arr =
|
|
32
31
|
this.type === "pageData"
|
|
33
32
|
? [
|
|
34
|
-
{
|
|
35
|
-
title: "字典键",
|
|
36
|
-
width: 150,
|
|
37
|
-
key: "dictKey"
|
|
38
|
-
},
|
|
39
33
|
{
|
|
40
34
|
title: "状态",
|
|
41
|
-
width:
|
|
35
|
+
width: 80,
|
|
42
36
|
key: "icon",
|
|
43
37
|
fixed: "left",
|
|
44
38
|
render: (h, { row }) => {
|
|
@@ -59,13 +53,19 @@ export default {
|
|
|
59
53
|
</span>
|
|
60
54
|
);
|
|
61
55
|
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
title: "关键词",
|
|
59
|
+
fixed: "left",
|
|
60
|
+
width: 80,
|
|
61
|
+
key: "dictKey"
|
|
62
62
|
}
|
|
63
63
|
]
|
|
64
64
|
: [
|
|
65
65
|
{
|
|
66
|
-
title: "
|
|
66
|
+
title: "状态",
|
|
67
67
|
fixed: "left",
|
|
68
|
-
width:
|
|
68
|
+
width: 80,
|
|
69
69
|
key: "page",
|
|
70
70
|
render: (h, { row }) => {
|
|
71
71
|
return h(
|
|
@@ -74,6 +74,12 @@ export default {
|
|
|
74
74
|
row.page === "common" ? "全局" : row.page
|
|
75
75
|
);
|
|
76
76
|
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
title: "关键词",
|
|
80
|
+
fixed: "left",
|
|
81
|
+
width: 80,
|
|
82
|
+
key: "dictKey"
|
|
77
83
|
}
|
|
78
84
|
];
|
|
79
85
|
_.map(this.languages, (lang) => {
|
|
@@ -81,7 +87,7 @@ export default {
|
|
|
81
87
|
|
|
82
88
|
return arr.push({
|
|
83
89
|
title: lang.name,
|
|
84
|
-
|
|
90
|
+
width: 290,
|
|
85
91
|
key,
|
|
86
92
|
render: (h, { row, index }) => {
|
|
87
93
|
const data = row[key];
|
|
@@ -119,6 +125,13 @@ export default {
|
|
|
119
125
|
translationKeys: Array
|
|
120
126
|
},
|
|
121
127
|
methods: {
|
|
128
|
+
inputSearch() {
|
|
129
|
+
if (this.type === "pageData") {
|
|
130
|
+
this.getPageData();
|
|
131
|
+
} else {
|
|
132
|
+
this.search();
|
|
133
|
+
}
|
|
134
|
+
},
|
|
122
135
|
closeModal() {
|
|
123
136
|
this.searchText = "";
|
|
124
137
|
this.type = "pageData";
|
|
@@ -218,12 +231,16 @@ export default {
|
|
|
218
231
|
if (commonData) {
|
|
219
232
|
arr.push({ ...commonData, page: this.name, common: true });
|
|
220
233
|
} else {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
234
|
+
if (this.searchText) {
|
|
235
|
+
return;
|
|
236
|
+
} else {
|
|
237
|
+
arr.push({
|
|
238
|
+
dictKey: key,
|
|
239
|
+
page: this.name,
|
|
240
|
+
"zh-CN": key,
|
|
241
|
+
localhost: true
|
|
242
|
+
});
|
|
243
|
+
}
|
|
227
244
|
}
|
|
228
245
|
}
|
|
229
246
|
});
|
|
@@ -246,6 +263,7 @@ export default {
|
|
|
246
263
|
const res = await getAllTranslate(
|
|
247
264
|
{
|
|
248
265
|
appCode: this.appCode,
|
|
266
|
+
page: "common",
|
|
249
267
|
searchBlur: this.searchText,
|
|
250
268
|
commaSeparatedLangs: _.map(this.languages, "code").toString(),
|
|
251
269
|
firstResult: 0,
|
|
@@ -336,17 +354,14 @@ export default {
|
|
|
336
354
|
></Table
|
|
337
355
|
></TabPane>
|
|
338
356
|
<template #extra>
|
|
339
|
-
<div
|
|
340
|
-
class="extra"
|
|
341
|
-
v-if="type === 'data'"
|
|
342
|
-
>
|
|
357
|
+
<div class="extra">
|
|
343
358
|
<Input
|
|
344
359
|
prefix="ios-search"
|
|
345
360
|
placeholder="请输入搜索内容"
|
|
346
361
|
v-model="searchText"
|
|
347
362
|
clearable
|
|
348
|
-
@on-enter="
|
|
349
|
-
@on-clear="
|
|
363
|
+
@on-enter="inputSearch"
|
|
364
|
+
@on-clear="inputSearch"
|
|
350
365
|
/>
|
|
351
366
|
</div>
|
|
352
367
|
</template>
|
|
@@ -406,9 +421,8 @@ export default {
|
|
|
406
421
|
}
|
|
407
422
|
.gc_i18n_tabs {
|
|
408
423
|
padding-top: 5px;
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
margin-bottom: 1px !important;
|
|
424
|
+
:deep(.ivu-tabs-bar) {
|
|
425
|
+
margin-bottom: 0px !important;
|
|
412
426
|
}
|
|
413
427
|
.ivu-tabs-content {
|
|
414
428
|
position: relative;
|
package/packages/index.js
CHANGED
|
@@ -46,18 +46,19 @@ export default class I18n {
|
|
|
46
46
|
// 初始化 i18n 实例
|
|
47
47
|
this.initI18n(options);
|
|
48
48
|
|
|
49
|
-
// 路由首次加载完成后设置语言
|
|
50
|
-
this.router
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
49
|
+
// // 路由首次加载完成后设置语言
|
|
50
|
+
// this.router
|
|
51
|
+
// .isReady()
|
|
52
|
+
// .then(async () => {
|
|
53
|
+
// // await this.setLanguage(this.locale);
|
|
54
|
+
// this.createModal();
|
|
55
|
+
// })
|
|
56
|
+
// .catch((error) => {
|
|
57
|
+
// console.error("路由首次加载出错:", error);
|
|
58
|
+
// });
|
|
59
59
|
|
|
60
60
|
keyboardJS.bind("shift > t", (e) => {
|
|
61
|
+
this.configInstance = this.createModal(this.name);
|
|
61
62
|
// 打开弹窗
|
|
62
63
|
this.configInstance.openModal({ name: this.name });
|
|
63
64
|
});
|
|
@@ -85,6 +86,7 @@ export default class I18n {
|
|
|
85
86
|
this.configInstance && this.configInstance.closeModal();
|
|
86
87
|
this.name = to.name;
|
|
87
88
|
token && this.setToken(token);
|
|
89
|
+
|
|
88
90
|
if (this.loadI18n) {
|
|
89
91
|
await this.setLanguage(language || this.locale);
|
|
90
92
|
// this.createModal(to.name);
|
|
@@ -239,7 +241,7 @@ export default class I18n {
|
|
|
239
241
|
createModal(name) {
|
|
240
242
|
this.modalLoad = true;
|
|
241
243
|
// 创建 config 组件的实例
|
|
242
|
-
|
|
244
|
+
return createApp(configVue, {
|
|
243
245
|
appCode: this.appCode,
|
|
244
246
|
token: this.token,
|
|
245
247
|
setLanguage: this.setLanguage.bind(this, this.locale),
|