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.
@@ -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, Modal } from "view-ui-plus";
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: 90,
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: 150,
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
- fixed: lang.name === "中文" ? "left" : "",
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
- arr.push({
222
- dictKey: key,
223
- page: this.name,
224
- "zh-CN": key,
225
- localhost: true
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="search"
349
- @on-clear="search"
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
- .ivu-tabs-bar {
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
- .isReady()
52
- .then(async () => {
53
- // await this.setLanguage(this.locale);
54
- this.createModal();
55
- })
56
- .catch((error) => {
57
- console.error("路由首次加载出错:", error);
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
- this.configInstance = createApp(configVue, {
244
+ return createApp(configVue, {
243
245
  appCode: this.appCode,
244
246
  token: this.token,
245
247
  setLanguage: this.setLanguage.bind(this, this.locale),
package/src/view/test.vue CHANGED
@@ -3,4 +3,5 @@
3
3
  <template>
4
4
  <h1>首页</h1>
5
5
  <h1>测试</h1>
6
+ <h1>页面独有</h1>
6
7
  </template>