mooho-base-admin-plus 0.1.24 → 0.1.28
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/dist/mooho-base-admin-plus.es.js +138726 -0
- package/dist/mooho-base-admin-plus.umd.js +124 -0
- package/dist/style.css +1 -1
- package/package.json +2 -3
- package/src/api/customModel.js +1 -1
- package/src/api/dataSource.js +1 -1
- package/src/api/dataView.js +1 -1
- package/src/api/dictType.js +1 -1
- package/src/api/model.js +1 -1
- package/src/api/permission.js +1 -1
- package/src/api/process.js +1 -1
- package/src/api/system.js +1 -1
- package/src/components/view/form-setting-layout.vue +1 -1
- package/src/components/view/view-form-draggable.vue +1 -1
- package/src/i18n/locale/en-US.js +1 -1
- package/src/i18n/locale/lang.js +1 -1
- package/src/i18n/locale/zh-CN.js +1 -1
- package/src/i18n/locale.js +2 -2
- package/src/index.js +2 -2
- package/src/layouts/basic-layout/header-breadcrumb/index.vue +2 -2
- package/src/layouts/basic-layout/mixins/click-item.js +21 -21
- package/src/layouts/basic-layout/mixins/sider-menu-badge.js +13 -13
- package/src/layouts/basic-layout/mixins/translate-title.js +11 -11
- package/src/layouts/basic-layout/tabs/index.vue +2 -2
- package/src/layouts/basic-layout/water-mark/index.vue +29 -29
- package/src/libs/random_str.js +10 -10
- package/src/libs/request/index.js +1 -1
- package/src/libs/system/index.js +2 -2
- package/src/libs/util.db.js +9 -11
- package/src/libs/water-mark.js +44 -44
- package/src/plugins/log/index.js +25 -0
- package/src/router/index.js +1 -1
- package/src/store/modules/admin/modules/db.js +5 -5
- package/src/store/modules/admin/modules/layout.js +1 -1
- package/src/store/modules/admin/modules/log.js +2 -2
- package/src/store/modules/admin/modules/menu.js +4 -4
- package/src/store/modules/admin/modules/page.js +3 -3
- package/src/styles/common.less +47 -47
- package/src/styles/default/index.less +6 -6
- package/src/styles/font/demo.css +539 -539
- package/src/styles/font/demo_index.html +372 -372
- package/src/styles/font/icon-demo/demo.css +539 -539
- package/src/styles/font/icon-demo/demo_index.html +423 -423
- package/src/styles/font/icon-demo/iconfont.css +61 -61
- package/src/styles/font/icon-demo/iconfont.svg +59 -59
- package/src/styles/font/iconfont.css +47 -47
- package/src/styles/font/iconfont.json +65 -65
- package/src/styles/font/ionicons.svg +869 -869
- package/src/styles/index.less +7 -7
- package/src/styles/layout/basic-layout/layout.less +527 -527
- package/src/styles/layout/basic-layout/menu.less +274 -274
- package/src/styles/layout/index.less +2 -2
- package/src/styles/setting.less +6 -6
- package/vite.config.js +19 -19
- package/dist/mooho-base-admin-plus.min.js +0 -94
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mooho-base-admin-plus",
|
|
3
3
|
"description": "MOOHO basic framework for admin by Vue3",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.28",
|
|
5
5
|
"author": "jinyifan <jinyifan@mooho.com.cn>",
|
|
6
6
|
"dotnetVersion": "1.3.97",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"private": false,
|
|
9
|
-
"main": "./dist/mooho-base-admin-plus.
|
|
10
|
-
"module": "./src/index.js",
|
|
9
|
+
"main": "./dist/mooho-base-admin-plus.es.js",
|
|
11
10
|
"scripts": {
|
|
12
11
|
"dev": "vite --open",
|
|
13
12
|
"build": "vite build",
|
package/src/api/customModel.js
CHANGED
package/src/api/dataSource.js
CHANGED
package/src/api/dataView.js
CHANGED
package/src/api/dictType.js
CHANGED
package/src/api/model.js
CHANGED
package/src/api/permission.js
CHANGED
package/src/api/process.js
CHANGED
package/src/api/system.js
CHANGED
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
import columnEdit from './column-edit.vue';
|
|
88
88
|
import columnSelect from './column-select.vue';
|
|
89
89
|
import viewFormDraggable from './view-form-draggable.vue';
|
|
90
|
-
import
|
|
90
|
+
import draggable from 'vuedraggable';
|
|
91
91
|
import enumApi from '../../api/enum';
|
|
92
92
|
|
|
93
93
|
export default {
|
|
@@ -365,7 +365,7 @@
|
|
|
365
365
|
import richEditor from '../richEditor/index.vue';
|
|
366
366
|
import uploadAttachment from '../upload/upload-attachment.vue';
|
|
367
367
|
import uploadImage from '../upload/upload-image.vue';
|
|
368
|
-
import
|
|
368
|
+
import draggable from 'vuedraggable';
|
|
369
369
|
import dateFormat from 'date-fns/format';
|
|
370
370
|
|
|
371
371
|
export default {
|
package/src/i18n/locale/en-US.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./lang.js";const t={i:{locale:"en-US",select:{placeholder:"Select",noMatch:"No matching data",loading:"Loading"},table:{noDataText:"No Data",noFilteredDataText:"No filter data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum"},datepicker:{selectDate:"Select date",selectTime:"Select time",startTime:"Start Time",endTime:"End Time",clear:"Clear",ok:"OK",datePanelLabel:"[mmmm] [yyyy]",month:"Month",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",year:"Year",weekStartDay:"0",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},months:{m1:"Jan",m2:"Feb",m3:"Mar",m4:"Apr",m5:"May",m6:"Jun",m7:"Jul",m8:"Aug",m9:"Sep",m10:"Oct",m11:"Nov",m12:"Dec"}},transfer:{titles:{source:"Source",target:"Target"},filterPlaceholder:"Search here",notFoundText:"Not Found"},modal:{okText:"OK",cancelText:"Cancel"},poptip:{okText:"OK",cancelText:"Cancel"},page:{prev:"Previous Page",next:"Next Page",total:"Total",item:"item",items:"items",prev5:"Previous 5 Pages",next5:"Next 5 Pages",page:"/page",goto:"Goto",p:""},rate:{star:"Star",stars:"Stars"},time:{before:" ago",after:" after",just:"just now",seconds:" seconds",minutes:" minutes",hours:" hours",days:" days"},tree:{emptyText:"No Data"}}};e(t);export{t as default};
|
|
1
|
+
import{s as e}from"./lang.js";const t={i:{locale:"en-US",select:{placeholder:"Select",noMatch:"No matching data",loading:"Loading"},table:{noDataText:"No Data",noFilteredDataText:"No filter data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum"},datepicker:{selectDate:"Select date",selectTime:"Select time",startTime:"Start Time",endTime:"End Time",clear:"Clear",ok:"OK",datePanelLabel:"[mmmm] [yyyy]",month:"Month",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",year:"Year",weekStartDay:"0",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},months:{m1:"Jan",m2:"Feb",m3:"Mar",m4:"Apr",m5:"May",m6:"Jun",m7:"Jul",m8:"Aug",m9:"Sep",m10:"Oct",m11:"Nov",m12:"Dec"}},transfer:{titles:{source:"Source",target:"Target"},filterPlaceholder:"Search here",notFoundText:"Not Found"},modal:{okText:"OK",cancelText:"Cancel"},poptip:{okText:"OK",cancelText:"Cancel"},page:{prev:"Previous Page",next:"Next Page",total:"Total",item:"item",items:"items",prev5:"Previous 5 Pages",next5:"Next 5 Pages",page:"/page",goto:"Goto",p:""},rate:{star:"Star",stars:"Stars"},time:{before:" ago",after:" after",just:"just now",seconds:" seconds",minutes:" minutes",hours:" hours",days:" days"},tree:{emptyText:"No Data"}}};e(t);export{t as default};
|
package/src/i18n/locale/lang.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=typeof window!="undefined";function n(i){e&&typeof window.viewuiplus!="undefined"&&("langs"in viewuiplus||(viewuiplus.langs={}),viewuiplus.langs[i.i.locale]=i)}export{n as s};
|
|
1
|
+
const e=typeof window!="undefined";function n(i){e&&typeof window.viewuiplus!="undefined"&&("langs"in viewuiplus||(viewuiplus.langs={}),viewuiplus.langs[i.i.locale]=i)}export{n as s};
|
package/src/i18n/locale/zh-CN.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./lang.js";const t={i:{locale:"zh-CN",select:{placeholder:"\u8BF7\u9009\u62E9",noMatch:"\u65E0\u5339\u914D\u6570\u636E",loading:"\u52A0\u8F7D\u4E2D"},table:{noDataText:"\u6682\u65E0\u6570\u636E",noFilteredDataText:"\u6682\u65E0\u7B5B\u9009\u7ED3\u679C",confirmFilter:"\u7B5B\u9009",resetFilter:"\u91CD\u7F6E",clearFilter:"\u5168\u90E8",sumText:"\u5408\u8BA1"},datepicker:{selectDate:"\u9009\u62E9\u65E5\u671F",selectTime:"\u9009\u62E9\u65F6\u95F4",startTime:"\u5F00\u59CB\u65F6\u95F4",endTime:"\u7ED3\u675F\u65F6\u95F4",clear:"\u6E05\u7A7A",ok:"\u786E\u5B9A",datePanelLabel:"[yyyy\u5E74] [m\u6708]",month:"\u6708",month1:"1 \u6708",month2:"2 \u6708",month3:"3 \u6708",month4:"4 \u6708",month5:"5 \u6708",month6:"6 \u6708",month7:"7 \u6708",month8:"8 \u6708",month9:"9 \u6708",month10:"10 \u6708",month11:"11 \u6708",month12:"12 \u6708",year:"\u5E74",weekStartDay:"0",weeks:{sun:"\u65E5",mon:"\u4E00",tue:"\u4E8C",wed:"\u4E09",thu:"\u56DB",fri:"\u4E94",sat:"\u516D"},months:{m1:"1\u6708",m2:"2\u6708",m3:"3\u6708",m4:"4\u6708",m5:"5\u6708",m6:"6\u6708",m7:"7\u6708",m8:"8\u6708",m9:"9\u6708",m10:"10\u6708",m11:"11\u6708",m12:"12\u6708"}},transfer:{titles:{source:"\u6E90\u5217\u8868",target:"\u76EE\u7684\u5217\u8868"},filterPlaceholder:"\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",notFoundText:"\u5217\u8868\u4E3A\u7A7A"},modal:{okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88"},poptip:{okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88"},page:{prev:"\u4E0A\u4E00\u9875",next:"\u4E0B\u4E00\u9875",total:"\u5171",item:"\u6761",items:"\u6761",prev5:"\u5411\u524D 5 \u9875",next5:"\u5411\u540E 5 \u9875",page:"\u6761/\u9875",goto:"\u8DF3\u81F3",p:"\u9875"},rate:{star:"\u661F",stars:"\u661F"},time:{before:"\u524D",after:"\u540E",just:"\u521A\u521A",seconds:"\u79D2",minutes:"\u5206\u949F",hours:"\u5C0F\u65F6",days:"\u5929"},tree:{emptyText:"\u6682\u65E0\u6570\u636E"}}};e(t);export{t as default};
|
|
1
|
+
import{s as e}from"./lang.js";const t={i:{locale:"zh-CN",select:{placeholder:"\u8BF7\u9009\u62E9",noMatch:"\u65E0\u5339\u914D\u6570\u636E",loading:"\u52A0\u8F7D\u4E2D"},table:{noDataText:"\u6682\u65E0\u6570\u636E",noFilteredDataText:"\u6682\u65E0\u7B5B\u9009\u7ED3\u679C",confirmFilter:"\u7B5B\u9009",resetFilter:"\u91CD\u7F6E",clearFilter:"\u5168\u90E8",sumText:"\u5408\u8BA1"},datepicker:{selectDate:"\u9009\u62E9\u65E5\u671F",selectTime:"\u9009\u62E9\u65F6\u95F4",startTime:"\u5F00\u59CB\u65F6\u95F4",endTime:"\u7ED3\u675F\u65F6\u95F4",clear:"\u6E05\u7A7A",ok:"\u786E\u5B9A",datePanelLabel:"[yyyy\u5E74] [m\u6708]",month:"\u6708",month1:"1 \u6708",month2:"2 \u6708",month3:"3 \u6708",month4:"4 \u6708",month5:"5 \u6708",month6:"6 \u6708",month7:"7 \u6708",month8:"8 \u6708",month9:"9 \u6708",month10:"10 \u6708",month11:"11 \u6708",month12:"12 \u6708",year:"\u5E74",weekStartDay:"0",weeks:{sun:"\u65E5",mon:"\u4E00",tue:"\u4E8C",wed:"\u4E09",thu:"\u56DB",fri:"\u4E94",sat:"\u516D"},months:{m1:"1\u6708",m2:"2\u6708",m3:"3\u6708",m4:"4\u6708",m5:"5\u6708",m6:"6\u6708",m7:"7\u6708",m8:"8\u6708",m9:"9\u6708",m10:"10\u6708",m11:"11\u6708",m12:"12\u6708"}},transfer:{titles:{source:"\u6E90\u5217\u8868",target:"\u76EE\u7684\u5217\u8868"},filterPlaceholder:"\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",notFoundText:"\u5217\u8868\u4E3A\u7A7A"},modal:{okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88"},poptip:{okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88"},page:{prev:"\u4E0A\u4E00\u9875",next:"\u4E0B\u4E00\u9875",total:"\u5171",item:"\u6761",items:"\u6761",prev5:"\u5411\u524D 5 \u9875",next5:"\u5411\u540E 5 \u9875",page:"\u6761/\u9875",goto:"\u8DF3\u81F3",p:"\u9875"},rate:{star:"\u661F",stars:"\u661F"},time:{before:"\u524D",after:"\u540E",just:"\u521A\u521A",seconds:"\u79D2",minutes:"\u5206\u949F",hours:"\u5C0F\u65F6",days:"\u5929"},tree:{emptyText:"\u6682\u65E0\u6570\u636E"}}};e(t);export{t as default};
|
package/src/i18n/locale.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 自动配置各类语言包
|
|
3
3
|
* */
|
|
4
|
-
import
|
|
4
|
+
import { merge } from 'lodash';
|
|
5
5
|
import Setting from '../setting';
|
|
6
6
|
//import { I18nList } from '../api/i18n';
|
|
7
7
|
|
|
@@ -95,7 +95,7 @@ export async function loadRemoteLocaleMessages(i18n) {
|
|
|
95
95
|
const nativeMessages = loadNativeLocaleMessages();
|
|
96
96
|
//const remoteMessages = await I18nList();
|
|
97
97
|
const remoteMessages = [];
|
|
98
|
-
const messages =
|
|
98
|
+
const messages = merge({}, nativeMessages, remoteMessages);
|
|
99
99
|
Object.keys(messages).forEach(key => {
|
|
100
100
|
i18n.global.setLocaleMessage(key, messages[key]);
|
|
101
101
|
});
|
package/src/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import plugins from './plugins';
|
|
|
18
18
|
import store from './store';
|
|
19
19
|
|
|
20
20
|
// ViewUIPlus
|
|
21
|
-
import
|
|
21
|
+
import ViewUIPlus from 'view-ui-plus';
|
|
22
22
|
|
|
23
23
|
// 菜单和路由
|
|
24
24
|
import router from './router';
|
|
@@ -119,7 +119,7 @@ const install = function (app) {
|
|
|
119
119
|
//if (window) window.$t = (key, value) => i18n.t(key, value);
|
|
120
120
|
|
|
121
121
|
app.use(plugins);
|
|
122
|
-
app.use(ViewUIPlus
|
|
122
|
+
app.use(ViewUIPlus, {
|
|
123
123
|
i18n
|
|
124
124
|
});
|
|
125
125
|
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import iMenuHeadTitle from '../menu-head/title.vue';
|
|
20
20
|
import { on, off } from 'view-ui-plus/src/utils/dom';
|
|
21
21
|
import { findComponentUpward, getStyle } from 'view-ui-plus/src/utils/assist';
|
|
22
|
-
import
|
|
22
|
+
import { throttle } from 'lodash';
|
|
23
23
|
import Setting from '../../../setting';
|
|
24
24
|
|
|
25
25
|
export default {
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
112
|
mounted() {
|
|
113
|
-
this.handleResize =
|
|
113
|
+
this.handleResize = throttle(this.handleCheckWidth, 100, { leading: false });
|
|
114
114
|
on(window, 'resize', this.handleResize);
|
|
115
115
|
this.handleGetWidth();
|
|
116
116
|
this.handleCheckWidth();
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { findComponentUpward } from 'view-ui-plus/src/utils/assist';
|
|
2
|
-
import { mapState } from 'vuex';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
computed: {
|
|
6
|
-
...mapState('admin/layout', ['menuSiderReload', 'menuHeaderReload'])
|
|
7
|
-
},
|
|
8
|
-
methods: {
|
|
9
|
-
handleClick(path, type = 'sider') {
|
|
10
|
-
const current = this.$route.path;
|
|
11
|
-
if (current === path) {
|
|
12
|
-
if (type === 'sider' && this.menuSiderReload) this.handleReload();
|
|
13
|
-
else if (type === 'header' && this.menuHeaderReload) this.handleReload();
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
handleReload() {
|
|
17
|
-
const $layout = findComponentUpward(this, 'BasicLayout');
|
|
18
|
-
if ($layout) $layout.handleReload();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
1
|
+
import { findComponentUpward } from 'view-ui-plus/src/utils/assist';
|
|
2
|
+
import { mapState } from 'vuex';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
computed: {
|
|
6
|
+
...mapState('admin/layout', ['menuSiderReload', 'menuHeaderReload'])
|
|
7
|
+
},
|
|
8
|
+
methods: {
|
|
9
|
+
handleClick(path, type = 'sider') {
|
|
10
|
+
const current = this.$route.path;
|
|
11
|
+
if (current === path) {
|
|
12
|
+
if (type === 'sider' && this.menuSiderReload) this.handleReload();
|
|
13
|
+
else if (type === 'header' && this.menuHeaderReload) this.handleReload();
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
handleReload() {
|
|
17
|
+
const $layout = findComponentUpward(this, 'BasicLayout');
|
|
18
|
+
if ($layout) $layout.handleReload();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { mapState } from 'vuex';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
computed: {
|
|
5
|
-
...mapState('admin/menu', ['siderMenuBadge']),
|
|
6
|
-
badgeData() {
|
|
7
|
-
let data = null;
|
|
8
|
-
const siderMenuBadge = this.siderMenuBadge.find(item => item.path === this.menu.path);
|
|
9
|
-
if (siderMenuBadge) data = siderMenuBadge;
|
|
10
|
-
return data;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
};
|
|
1
|
+
import { mapState } from 'vuex';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
computed: {
|
|
5
|
+
...mapState('admin/menu', ['siderMenuBadge']),
|
|
6
|
+
badgeData() {
|
|
7
|
+
let data = null;
|
|
8
|
+
const siderMenuBadge = this.siderMenuBadge.find(item => item.path === this.menu.path);
|
|
9
|
+
if (siderMenuBadge) data = siderMenuBadge;
|
|
10
|
+
return data;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
methods: {
|
|
3
|
-
tTitle(title) {
|
|
4
|
-
if (title && title.indexOf('$t:') === 0) {
|
|
5
|
-
return this.$t(title.split('$t:')[1]);
|
|
6
|
-
} else {
|
|
7
|
-
return title;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
};
|
|
1
|
+
export default {
|
|
2
|
+
methods: {
|
|
3
|
+
tTitle(title) {
|
|
4
|
+
if (title && title.indexOf('$t:') === 0) {
|
|
5
|
+
return this.$t(title.split('$t:')[1]);
|
|
6
|
+
} else {
|
|
7
|
+
return title;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
};
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
|
|
51
51
|
import { getAllSiderMenu } from '../../../libs/system';
|
|
52
52
|
|
|
53
|
-
import
|
|
53
|
+
import { cloneDeep } from 'lodash';
|
|
54
54
|
import random from '../../../libs/random_str';
|
|
55
55
|
|
|
56
56
|
export default {
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
}
|
|
174
174
|
},
|
|
175
175
|
handleDragDrop(name, newName, a, b) {
|
|
176
|
-
let opened =
|
|
176
|
+
let opened = cloneDeep(this.opened);
|
|
177
177
|
opened.splice(b, 1, ...opened.splice(a, 1, opened[b]));
|
|
178
178
|
this.updateOpened({ opened });
|
|
179
179
|
},
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :style="styles" v-if="waterMark.show"></div>
|
|
3
|
-
</template>
|
|
4
|
-
<script>
|
|
5
|
-
import { mapState } from 'vuex';
|
|
6
|
-
import getWaterMarkCanvas from '../../../libs/water-mark';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
name: 'i-water-mark',
|
|
10
|
-
computed: {
|
|
11
|
-
...mapState('admin/layout', ['waterMark']),
|
|
12
|
-
styles() {
|
|
13
|
-
const url = getWaterMarkCanvas(this.waterMark.text, this.waterMark.options);
|
|
14
|
-
return {
|
|
15
|
-
width: '100%',
|
|
16
|
-
height: '100%',
|
|
17
|
-
position: 'absolute',
|
|
18
|
-
top: '0',
|
|
19
|
-
left: '0',
|
|
20
|
-
'z-index': '2000',
|
|
21
|
-
'background-size': '320px',
|
|
22
|
-
'background-repeat': 'repeat',
|
|
23
|
-
'background-image': `url(${url})`,
|
|
24
|
-
'pointer-events': 'none'
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div :style="styles" v-if="waterMark.show"></div>
|
|
3
|
+
</template>
|
|
4
|
+
<script>
|
|
5
|
+
import { mapState } from 'vuex';
|
|
6
|
+
import getWaterMarkCanvas from '../../../libs/water-mark';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
name: 'i-water-mark',
|
|
10
|
+
computed: {
|
|
11
|
+
...mapState('admin/layout', ['waterMark']),
|
|
12
|
+
styles() {
|
|
13
|
+
const url = getWaterMarkCanvas(this.waterMark.text, this.waterMark.options);
|
|
14
|
+
return {
|
|
15
|
+
width: '100%',
|
|
16
|
+
height: '100%',
|
|
17
|
+
position: 'absolute',
|
|
18
|
+
top: '0',
|
|
19
|
+
left: '0',
|
|
20
|
+
'z-index': '2000',
|
|
21
|
+
'background-size': '320px',
|
|
22
|
+
'background-repeat': 'repeat',
|
|
23
|
+
'background-image': `url(${url})`,
|
|
24
|
+
'pointer-events': 'none'
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
</script>
|
package/src/libs/random_str.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// 生成随机字符串
|
|
2
|
-
export default function (len = 32) {
|
|
3
|
-
const $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
|
|
4
|
-
const maxPos = $chars.length;
|
|
5
|
-
let str = '';
|
|
6
|
-
for (let i = 0; i < len; i++) {
|
|
7
|
-
str += $chars.charAt(Math.floor(Math.random() * maxPos));
|
|
8
|
-
}
|
|
9
|
-
return str;
|
|
10
|
-
}
|
|
1
|
+
// 生成随机字符串
|
|
2
|
+
export default function (len = 32) {
|
|
3
|
+
const $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
|
|
4
|
+
const maxPos = $chars.length;
|
|
5
|
+
let str = '';
|
|
6
|
+
for (let i = 0; i < len; i++) {
|
|
7
|
+
str += $chars.charAt(Math.floor(Math.random() * maxPos));
|
|
8
|
+
}
|
|
9
|
+
return str;
|
|
10
|
+
}
|
package/src/libs/system/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 系统内置方法集,正常情况下您不应该修改或移除此文件
|
|
3
3
|
* */
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import { cloneDeep } from 'lodash';
|
|
6
6
|
import Setting from '../../setting';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -139,7 +139,7 @@ function flattenSiderMenu(menuList, newList) {
|
|
|
139
139
|
menuList.forEach(menu => {
|
|
140
140
|
let newMenu = {};
|
|
141
141
|
for (let i in menu) {
|
|
142
|
-
if (i !== 'children') newMenu[i] =
|
|
142
|
+
if (i !== 'children') newMenu[i] = cloneDeep(menu[i]);
|
|
143
143
|
}
|
|
144
144
|
newList.push(newMenu);
|
|
145
145
|
menu.children && flattenSiderMenu(menu.children, newList);
|
package/src/libs/util.db.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import low from 'lowdb';
|
|
2
|
+
import LocalStorage from 'lowdb/adapters/LocalStorage';
|
|
3
|
+
import Setting from '../setting';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const adapter = new LocalStorage(`admin-plus-${Setting.appID}`);
|
|
6
|
+
const db = low(adapter);
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const db = {};
|
|
8
|
+
db.defaults({
|
|
9
|
+
sys: {},
|
|
10
|
+
database: {}
|
|
11
|
+
}).write();
|
|
14
12
|
|
|
15
13
|
export default db;
|
package/src/libs/water-mark.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description 生成水印
|
|
3
|
-
* */
|
|
4
|
-
export default function getWaterMarkCanvas(text, options) {
|
|
5
|
-
const canvas = document.createElement('canvas');
|
|
6
|
-
const ctx = canvas.getContext('2d');
|
|
7
|
-
const canvasWidth = 400;
|
|
8
|
-
const canvasHeight = 400;
|
|
9
|
-
canvas.width = canvasWidth;
|
|
10
|
-
canvas.height = canvasHeight;
|
|
11
|
-
ctx.textAlign = 'center';
|
|
12
|
-
ctx.textBaseline = 'bottom';
|
|
13
|
-
ctx.globalAlpha = options.globalAlpha || 0.1;
|
|
14
|
-
ctx.font = options.font || '20px Microsoft Yahei';
|
|
15
|
-
|
|
16
|
-
ctx.translate(canvasWidth / 2, canvasHeight / 2);
|
|
17
|
-
ctx.rotate(options.rotateAngle || -0.4);
|
|
18
|
-
|
|
19
|
-
ctx.translate((-canvasWidth / 2) * 1.2, (-canvasHeight / 2) * 1.2);
|
|
20
|
-
|
|
21
|
-
const waterMarkText = [];
|
|
22
|
-
const chunkWidth = options.chunkWidth || 400;
|
|
23
|
-
const chunkHeight = options.chunkHeight || 120;
|
|
24
|
-
const horizontalChunkCount = 0;
|
|
25
|
-
const verticalChunkCount = 1;
|
|
26
|
-
|
|
27
|
-
for (let j = 0, initY = chunkHeight / 2, indent = 0; j <= verticalChunkCount; j += 1) {
|
|
28
|
-
indent = parseInt(j % 2);
|
|
29
|
-
|
|
30
|
-
for (let i = 0, initX = chunkWidth / 2; i <= horizontalChunkCount; i += 1) {
|
|
31
|
-
waterMarkText.push({
|
|
32
|
-
text,
|
|
33
|
-
x: i * chunkWidth + indent * initX,
|
|
34
|
-
y: j * chunkHeight + initY
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
waterMarkText.forEach(item => {
|
|
40
|
-
ctx.fillText(item.text, item.x, item.y);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
return ctx.canvas.toDataURL();
|
|
44
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @description 生成水印
|
|
3
|
+
* */
|
|
4
|
+
export default function getWaterMarkCanvas(text, options) {
|
|
5
|
+
const canvas = document.createElement('canvas');
|
|
6
|
+
const ctx = canvas.getContext('2d');
|
|
7
|
+
const canvasWidth = 400;
|
|
8
|
+
const canvasHeight = 400;
|
|
9
|
+
canvas.width = canvasWidth;
|
|
10
|
+
canvas.height = canvasHeight;
|
|
11
|
+
ctx.textAlign = 'center';
|
|
12
|
+
ctx.textBaseline = 'bottom';
|
|
13
|
+
ctx.globalAlpha = options.globalAlpha || 0.1;
|
|
14
|
+
ctx.font = options.font || '20px Microsoft Yahei';
|
|
15
|
+
|
|
16
|
+
ctx.translate(canvasWidth / 2, canvasHeight / 2);
|
|
17
|
+
ctx.rotate(options.rotateAngle || -0.4);
|
|
18
|
+
|
|
19
|
+
ctx.translate((-canvasWidth / 2) * 1.2, (-canvasHeight / 2) * 1.2);
|
|
20
|
+
|
|
21
|
+
const waterMarkText = [];
|
|
22
|
+
const chunkWidth = options.chunkWidth || 400;
|
|
23
|
+
const chunkHeight = options.chunkHeight || 120;
|
|
24
|
+
const horizontalChunkCount = 0;
|
|
25
|
+
const verticalChunkCount = 1;
|
|
26
|
+
|
|
27
|
+
for (let j = 0, initY = chunkHeight / 2, indent = 0; j <= verticalChunkCount; j += 1) {
|
|
28
|
+
indent = parseInt(j % 2);
|
|
29
|
+
|
|
30
|
+
for (let i = 0, initX = chunkWidth / 2; i <= horizontalChunkCount; i += 1) {
|
|
31
|
+
waterMarkText.push({
|
|
32
|
+
text,
|
|
33
|
+
x: i * chunkWidth + indent * initX,
|
|
34
|
+
y: j * chunkHeight + initY
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
waterMarkText.forEach(item => {
|
|
40
|
+
ctx.fillText(item.text, item.x, item.y);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return ctx.canvas.toDataURL();
|
|
44
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import store from '../../store';
|
|
2
|
+
import util from '../../libs/util';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
install(app) {
|
|
6
|
+
// 快速打印 log
|
|
7
|
+
app.config.globalProperties.$log = {
|
|
8
|
+
...util.log,
|
|
9
|
+
push(data) {
|
|
10
|
+
if (typeof data === 'string') {
|
|
11
|
+
// 如果传递来的数据是字符串
|
|
12
|
+
// 赋值给 message 字段
|
|
13
|
+
// 为了方便使用
|
|
14
|
+
// eg: this.$log.push('foo text')
|
|
15
|
+
store.dispatch('admin/log/push', {
|
|
16
|
+
message: data
|
|
17
|
+
});
|
|
18
|
+
} else if (typeof data === 'object') {
|
|
19
|
+
// 如果传递来的数据是对象
|
|
20
|
+
store.dispatch('admin/log/push', data);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
};
|
package/src/router/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRouter, createWebHistory, createWebHashHistory, createMemoryHistory } from 'vue-router';
|
|
2
|
-
import
|
|
2
|
+
import ViewUIPlus from 'view-ui-plus';
|
|
3
3
|
import util from '../libs/util';
|
|
4
4
|
import Setting from '../setting';
|
|
5
5
|
import store from '../store/index';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* */
|
|
5
5
|
import util from '../../../../libs/util';
|
|
6
6
|
import router from '../../../../router';
|
|
7
|
-
import
|
|
7
|
+
import { cloneDeep } from 'lodash';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @description 检查路径是否存在 不存在的话初始化
|
|
@@ -64,7 +64,7 @@ export default {
|
|
|
64
64
|
get(context, { dbName = 'database', path = '', defaultValue = '', user = false }) {
|
|
65
65
|
return new Promise(resolve => {
|
|
66
66
|
resolve(
|
|
67
|
-
|
|
67
|
+
cloneDeep(
|
|
68
68
|
util.db
|
|
69
69
|
.get(
|
|
70
70
|
pathInit({
|
|
@@ -175,7 +175,7 @@ export default {
|
|
|
175
175
|
path: `$page.${router.app.$route[basis]}.$data`,
|
|
176
176
|
user,
|
|
177
177
|
validator: () => false,
|
|
178
|
-
defaultValue:
|
|
178
|
+
defaultValue: cloneDeep(instance.$data)
|
|
179
179
|
})
|
|
180
180
|
)
|
|
181
181
|
);
|
|
@@ -191,14 +191,14 @@ export default {
|
|
|
191
191
|
pageGet(context, { instance, basis = 'fullPath', user = false }) {
|
|
192
192
|
return new Promise(resolve => {
|
|
193
193
|
resolve(
|
|
194
|
-
|
|
194
|
+
cloneDeep(
|
|
195
195
|
util.db
|
|
196
196
|
.get(
|
|
197
197
|
pathInit({
|
|
198
198
|
dbName: 'database',
|
|
199
199
|
path: `$page.${router.app.$route[basis]}.$data`,
|
|
200
200
|
user,
|
|
201
|
-
defaultValue:
|
|
201
|
+
defaultValue: cloneDeep(instance.$data)
|
|
202
202
|
})
|
|
203
203
|
)
|
|
204
204
|
.value()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { get } from 'lodash';
|
|
2
2
|
import dateFormat from 'date-fns/format';
|
|
3
3
|
import util from '../../../../libs/util';
|
|
4
4
|
|
|
@@ -50,7 +50,7 @@ export default {
|
|
|
50
50
|
// 当前的 token
|
|
51
51
|
token: util.cookies.get('token'),
|
|
52
52
|
// 当前地址
|
|
53
|
-
url:
|
|
53
|
+
url: get(window, 'location.href', ''),
|
|
54
54
|
// 用户设置
|
|
55
55
|
...meta
|
|
56
56
|
}
|