mooho-base-admin-plus 0.4.0 → 0.4.3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mooho-base-admin-plus",
3
3
  "description": "MOOHO basic framework for admin by Vue3",
4
- "version": "0.4.0",
4
+ "version": "0.4.3",
5
5
  "author": "jinyifan <jinyifan@mooho.com.cn>",
6
6
  "dotnetVersion": "1.4.0",
7
7
  "license": "MIT",
package/public/setting.js CHANGED
@@ -38,21 +38,8 @@ window.setting = {
38
38
  // 默认语言
39
39
  default: 'zh-CN',
40
40
  // 是否根据用户电脑配置自动设置语言(仅第一次有效)
41
- auto: false,
41
+ auto: true,
42
42
  // 切换语言时是否刷新页面
43
- refresh: true,
44
- // 支持的语言列表
45
- list: [
46
- {
47
- locale: 'zh-CN',
48
- language: '简体中文'
49
- },
50
- {
51
- locale: 'en-US',
52
- language: 'English'
53
- }
54
- ],
55
- // 是否通过远程接口来获取 i81n 文件
56
- remote: false
43
+ refresh: true
57
44
  }
58
45
  };
@@ -402,7 +402,7 @@
402
402
  </div>
403
403
  </template>
404
404
  <div class="i-table-no-border">
405
- <Table :columns="parpamColumns" :data="params" stripe size="small" no-data-text="暂无数据...">
405
+ <Table :columns="parpamColumns" :data="params" stripe size="small">
406
406
  <template #command="{ index }">
407
407
  <Button size="small" :title="$t('Front_Btn_Edit')" type="primary" ghost custom-icon="fa fa-edit" @click="paramEdit(params[index], index)"></Button>
408
408
  <Button size="small" :title="$t('Front_Btn_Up')" type="primary" ghost custom-icon="fa fa-chevron-up" @click="upParam(params[index], index)"></Button>
@@ -197,7 +197,7 @@
197
197
  </div>
198
198
  </template>
199
199
  <div class="i-table-no-border">
200
- <Table :columns="parpamColumns" :data="params" stripe size="small" no-data-text="暂无数据...">
200
+ <Table :columns="parpamColumns" :data="params" stripe size="small">
201
201
  <template #command="{ index }">
202
202
  <Button size="small" :title="$t('Front_Btn_Edit')" type="primary" ghost custom-icon="fa fa-edit" @click="paramEdit(params[index], index)"></Button>
203
203
  <Button size="small" :title="$t('Front_Btn_Up')" type="primary" ghost custom-icon="fa fa-chevron-up" @click="upParam(params[index], index)"></Button>
@@ -106,7 +106,6 @@
106
106
  :show-summary="tableView.showSummary"
107
107
  :summary-method="summaryMethod"
108
108
  :page-size-opts="pageSizeOpts"
109
- no-data-text="暂无数据..."
110
109
  @on-column-width-resize="columnWidthResize"
111
110
  @on-sort-change="sortChange"
112
111
  @on-selection-change="onSelectionChange"
package/src/index.js CHANGED
@@ -163,9 +163,9 @@ Object.keys(files).forEach(key => {
163
163
  // 第一次进入时,取菜单数据用于更新
164
164
  let isFirstRouteChange = true;
165
165
 
166
- const created = async vue => {
166
+ const created = async app => {
167
167
  // 加载多语言
168
- await store.dispatch('admin/i18n/load', vue);
168
+ await store.dispatch('admin/i18n/load', app);
169
169
  // 初始化动态路由
170
170
  //let dynamicRoutes = await dynamicRouter.init(router, pages, layout);
171
171
  // 处理路由 得到每一级的路由设置
@@ -54,15 +54,15 @@
54
54
  return newItems;
55
55
  },
56
56
  // 第一级,默认是 menu/header.js 中的第一项
57
- title() {
58
- return Setting.info.title;
59
- },
60
57
  topItem() {
61
- return Setting.layout.showI18n ? this.$t('Front_Label_Setting_Info_Title') : Setting.info.title;
58
+ return this.header.find(item => item.name === this.headerName);
62
59
  },
63
60
  // 得到所有侧边菜单,并转为平级,查询图标及显示对应内容
64
61
  allSiderMenu() {
65
62
  return flattenSiderMenu(this.menuSider, []);
63
+ },
64
+ title() {
65
+ return Setting.layout.showI18n ? this.$t('Front_Label_Setting_Info_Title') : Setting.info.title;
66
66
  }
67
67
  },
68
68
  data() {
@@ -120,7 +120,7 @@
120
120
  </div>
121
121
  </template>
122
122
  <div class="i-table-no-border">
123
- <Table :columns="parpamColumns" :data="params" stripe size="small" no-data-text="暂无数据...">
123
+ <Table :columns="parpamColumns" :data="params" stripe size="small">
124
124
  <template #command="{ row, index }">
125
125
  <Button size="small" :title="$t('Front_Btn_Edit')" type="primary" ghost custom-icon="fa fa-edit" @click="paramEdit(row, index)"></Button>
126
126
  <Button size="small" :title="$t('Front_Btn_Up')" type="primary" ghost custom-icon="fa fa-chevron-up" @click="upParam(row, index)"></Button>
package/src/setting.js CHANGED
@@ -31,20 +31,7 @@ const Setting = {
31
31
  // 是否根据用户电脑配置自动设置语言(仅第一次有效)
32
32
  auto: false,
33
33
  // 切换语言时是否刷新页面
34
- refresh: false,
35
- // 支持的语言列表
36
- list: [
37
- {
38
- locale: 'zh-CN',
39
- language: '简体中文'
40
- },
41
- {
42
- locale: 'en-US',
43
- language: 'English'
44
- }
45
- ],
46
- // 是否通过远程接口来获取 i81n 文件
47
- remote: false
34
+ refresh: false
48
35
  },
49
36
  /**
50
37
  * 打印控件
@@ -67,12 +67,11 @@ export default {
67
67
  if (confirm) {
68
68
  swal
69
69
  .fire({
70
- title: '确定要退出吗?\r\nAre you sure to logout?',
70
+ title: window.$t('Front_Msg_Sure_To_Logout'),
71
71
  icon: 'question',
72
72
  showCancelButton: true,
73
- confirmButtonText: '确定 OK',
74
- confirmButtonColor: '#2d8cf0',
75
- cancelButtonText: '取消 Cancel'
73
+ confirmButtonText: window.$t('Front_Btn_OK'),
74
+ cancelButtonText: window.$t('Front_Btn_Cancel')
76
75
  })
77
76
  .then(result => {
78
77
  if (result.value) {
@@ -50,7 +50,7 @@ export default {
50
50
  * @description 加载语言
51
51
  * @param {Object} state vuex state
52
52
  */
53
- async load({ state }) {
53
+ async load({ state }, app) {
54
54
  let locale;
55
55
 
56
56
  const db = util.db.get(
@@ -85,10 +85,9 @@ export default {
85
85
  db.set(savedLocaleKey, locale).write();
86
86
  }
87
87
  state.locale = locale;
88
- i18n.locale = locale;
88
+ app.config.globalProperties.$i18n.locale = locale;
89
89
 
90
90
  // 导入 View UI Plus 语言包
91
- //const ViewUIPlusLocale = require.context('view-ui-plus/dist/locale', false, /.+-.+.js$/);
92
91
  const ViewUIPlusLocale = import.meta.globEager('../../../../i18n/locale/*-*.js');
93
92
 
94
93
  let res = await i18nTextApi.getAll();
@@ -100,26 +99,11 @@ export default {
100
99
 
101
100
  if (currentLocale.i.locale === lanCode) {
102
101
  res[lanCode]['text'].i = currentLocale.i;
103
- // console.log('currentLocale', currentLocale);
104
-
105
- // Object.keys(currentLocale.i).forEach(key => {
106
- // console.log('key', key, currentLocale.i[key]);
107
- // res[lanCode]['text'][key] = currentLocale.i[key];
108
- // });
109
102
  }
110
103
  });
111
104
 
112
- // if (currentLocale.i.locale === lanCode) {
113
- // Object.keys(currentLocale).forEach(key => {
114
- // res[lanCode]['text'][key] = currentLocale[key];
115
- // });
116
- // }
117
-
118
- //languages[lanCode] = res[lanCode]['text'];
119
105
  state.languages[lanCode] = res[lanCode].name;
120
106
 
121
- //console.log('languages', lanCode, res[lanCode]['text']);
122
-
123
107
  i18n.global.setLocaleMessage(lanCode, res[lanCode]['text']);
124
108
  }
125
109
  }
package/test/main.js CHANGED
@@ -33,7 +33,7 @@ const app = createApp({
33
33
  // mixins: [mixinApp],
34
34
  render: () => h(App),
35
35
  created() {
36
- created(this);
36
+ created(app);
37
37
 
38
38
  // 将根实例存全局,可在特殊场景下调用
39
39
  if (window) {
@@ -1,50 +0,0 @@
1
- // 默认布局使用的多语言
2
-
3
- export default {
4
- 'zh-CN': {
5
- basicLayout: {
6
- search: {
7
- placeholder: '搜索...',
8
- cancel: '取消'
9
- },
10
- user: {
11
- center: '个人中心',
12
- setting: '设置',
13
- logOut: '退出登录'
14
- },
15
- logout: {
16
- confirmTitle: '退出登录确认',
17
- confirmContent: '您确定退出登录当前账户吗?打开的标签页和个人设置将会保存。'
18
- },
19
- tabs: {
20
- left: '关闭左侧',
21
- right: '关闭右侧',
22
- other: '关闭其它',
23
- all: '全部关闭'
24
- }
25
- }
26
- },
27
- 'en-US': {
28
- basicLayout: {
29
- search: {
30
- placeholder: 'Search...',
31
- cancel: 'Cancel'
32
- },
33
- user: {
34
- center: 'My home',
35
- setting: 'Setting',
36
- logOut: 'Log out'
37
- },
38
- logout: {
39
- confirmTitle: 'Logout confirmation',
40
- confirmContent: 'Are you sure you are logged out of your current account? Open tabs and personal settings will be saved.'
41
- },
42
- tabs: {
43
- left: 'Close left',
44
- right: 'Close right',
45
- other: 'Close other',
46
- all: 'Close all'
47
- }
48
- }
49
- }
50
- };