leisure-core 1.0.2 → 1.0.4
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/index.js +223 -0
- package/le-area/index.js +7 -0
- package/le-area/src/main.vue +112 -0
- package/le-button/index.js +7 -0
- package/le-button/src/main.vue +47 -0
- package/le-button-attach/index.js +6 -0
- package/le-button-attach/src/main.vue +171 -0
- package/le-button-msg/index.js +7 -0
- package/le-button-msg/src/main.vue +65 -0
- package/le-button-qr/index.js +7 -0
- package/le-button-qr/src/main.vue +96 -0
- package/le-date-picker/index.js +7 -0
- package/le-date-picker/src/main.vue +67 -0
- package/le-date-picker-auto/index.js +6 -0
- package/le-date-picker-auto/src/main.vue +131 -0
- package/le-dialog-container/index.js +7 -0
- package/le-dialog-container/src/main.vue +80 -0
- package/le-form/index.js +7 -0
- package/le-form/src/main.vue +13 -0
- package/le-form-item/index.js +7 -0
- package/le-form-item/src/main.vue +13 -0
- package/le-home/index.js +7 -0
- package/le-home/src/LeHeaderMenu.vue +60 -0
- package/le-home/src/main.vue +1307 -0
- package/le-home/src/sub.vue +82 -0
- package/le-image/index.js +7 -0
- package/le-image/src/main.vue +53 -0
- package/le-input/index.js +7 -0
- package/le-input/src/main.vue +15 -0
- package/le-input-advanced/index.js +7 -0
- package/le-input-advanced/src/main.vue +71 -0
- package/le-input-number/index.js +7 -0
- package/le-input-number/src/main.vue +15 -0
- package/le-input-validate/index.js +6 -0
- package/le-input-validate/src/main.vue +469 -0
- package/le-libs/js/drag.js +78 -0
- package/le-libs/js/event.js +3 -0
- package/le-libs/js/hrequest.js +76 -0
- package/le-libs/js/hrequestFile.js +151 -0
- package/le-libs/js/info.js +7 -0
- package/le-libs/js/tokens.js +13 -0
- package/le-libs/mixins/main.js +48 -0
- package/le-list/index.js +7 -0
- package/le-list/src/main.vue +645 -0
- package/le-list-form/index.js +7 -0
- package/le-list-form/src/main.vue +474 -0
- package/le-login/index.js +7 -0
- package/le-login/src/ForgotPassword.vue +613 -0
- package/le-login/src/main.vue +982 -0
- package/le-media/index.js +7 -0
- package/le-media/src/main.vue +298 -0
- package/le-media-list/index.js +7 -0
- package/le-media-list/src/main.vue +178 -0
- package/le-media-upload/index.js +7 -0
- package/le-media-upload/src/main.vue +329 -0
- package/le-menu/index.js +7 -0
- package/le-menu/src/main.vue +248 -0
- package/le-report/index.js +6 -0
- package/le-report/src/main.vue +1747 -0
- package/le-report/src/rmixins.js +30 -0
- package/le-role/index.js +7 -0
- package/le-role/src/main.vue +183 -0
- package/le-role/src/sub.vue +79 -0
- package/le-role-user/index.js +7 -0
- package/le-role-user/src/main.vue +160 -0
- package/le-role-user/src/sub.vue +90 -0
- package/le-select/index.js +7 -0
- package/le-select/src/main.vue +49 -0
- package/le-select-multi/index.js +6 -0
- package/le-select-multi/src/main.vue +816 -0
- package/le-select-option/index.js +7 -0
- package/le-select-option/src/main.vue +69 -0
- package/le-select-search/index.js +7 -0
- package/le-select-search/src/main.vue +46 -0
- package/le-span/index.js +7 -0
- package/le-span/src/main.vue +29 -0
- package/le-table-edit/index.js +6 -0
- package/le-table-edit/src/main.vue +689 -0
- package/le-theme/common/vars.css +131 -0
- package/le-theme/iconfont/iconfont.css +125 -0
- package/le-theme/iconfont/iconfont.ttf +0 -0
- package/le-theme/iconfont/iconfont.woff +0 -0
- package/le-theme/iconfont/iconfont.woff2 +0 -0
- package/le-theme/index.js +189 -0
- package/le-theme/pages/index.css +15 -0
- package/le-upload/index.js +7 -0
- package/le-upload/src/main.vue +134 -0
- package/le-upload-table/index.js +6 -0
- package/le-upload-table/src/main.vue +648 -0
- package/le-url/index.js +7 -0
- package/le-url/src/main.vue +27 -0
- package/le-video/index.js +7 -0
- package/le-video/src/main.vue +42 -0
- package/package.json +1 -6
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/* =========================================================================
|
|
2
|
+
* leisure-core 主题 CSS 变量层
|
|
3
|
+
* -------------------------------------------------------------------------
|
|
4
|
+
* 设计要点:
|
|
5
|
+
* 1. 全部使用 CSS Custom Properties,运行时可通过 LeTheme.set(name) 一键切换
|
|
6
|
+
* 2. :root 为默认皮肤(default),其它皮肤由 LeTheme 在 <html> 上覆盖变量
|
|
7
|
+
* 3. 语义化命名:--le-{role}-{state},避免直接用色值名
|
|
8
|
+
* 4. 同时覆盖 Element UI 的 primary 色族,使 type="primary" 按钮可换肤
|
|
9
|
+
* ======================================================================= */
|
|
10
|
+
|
|
11
|
+
:root {
|
|
12
|
+
/* 品牌色族 */
|
|
13
|
+
--le-color-primary: #409eff;
|
|
14
|
+
--le-color-primary-2: #2563eb;
|
|
15
|
+
--le-color-primary-light: #60a5fa;
|
|
16
|
+
--le-color-primary-light-1: #53a8ff;
|
|
17
|
+
--le-color-primary-light-9: #ecf5ff;
|
|
18
|
+
--le-color-primary-shadow: rgba(64, 158, 255, 0.25);
|
|
19
|
+
--le-color-primary-shadow-strong: rgba(64, 158, 255, 0.4);
|
|
20
|
+
--le-color-primary-shadow-soft: rgba(64, 158, 255, 0.1);
|
|
21
|
+
|
|
22
|
+
/* 功能色 */
|
|
23
|
+
--le-color-success: #10b981;
|
|
24
|
+
--le-color-success-2: #059669;
|
|
25
|
+
--le-color-success-shadow: rgba(16, 185, 129, 0.4);
|
|
26
|
+
|
|
27
|
+
/* 文本 */
|
|
28
|
+
--le-color-text-strong: #1e293b;
|
|
29
|
+
--le-color-text-regular: #64748b;
|
|
30
|
+
--le-color-text-muted: #94a3b8;
|
|
31
|
+
--le-color-text-form: #475569;
|
|
32
|
+
--le-color-input-text: #334155;
|
|
33
|
+
--le-color-on-dark: #f1f5f9;
|
|
34
|
+
|
|
35
|
+
/* 边框 */
|
|
36
|
+
--le-color-border: #e2e8f0;
|
|
37
|
+
--le-color-border-hover: #cbd5e1;
|
|
38
|
+
--le-color-border-dark: #475569;
|
|
39
|
+
|
|
40
|
+
/* 容器/卡片 */
|
|
41
|
+
--le-color-card-bg: rgba(255, 255, 255, 0.98);
|
|
42
|
+
--le-color-card-border: rgba(255, 255, 255, 0.2);
|
|
43
|
+
--le-color-card-shadow: rgba(0, 0, 0, 0.1);
|
|
44
|
+
--le-color-input-bg: #ffffff;
|
|
45
|
+
--le-color-placeholder: #94a3b8;
|
|
46
|
+
|
|
47
|
+
/* 装饰区(left-section 渐变背景) */
|
|
48
|
+
--le-color-section-bg-from: #f8fafc;
|
|
49
|
+
--le-color-section-bg-to: #f1f5f9;
|
|
50
|
+
|
|
51
|
+
/* le-home 框架色 */
|
|
52
|
+
--le-color-header-bg: #212121;
|
|
53
|
+
--le-color-aside-bg: #3a3a3a;
|
|
54
|
+
--le-color-aside-text: #ffffff;
|
|
55
|
+
--le-color-aside-active: #ffd04b;
|
|
56
|
+
--le-color-menu-bg: #3a3a3a;
|
|
57
|
+
--le-color-aside-handle-hover: rgba(74, 144, 226, 0.2);
|
|
58
|
+
--le-color-aside-handle-active: rgba(74, 144, 226, 0.4);
|
|
59
|
+
--le-color-aside-toggle-bg: #2a333a;
|
|
60
|
+
--le-color-aside-toggle-hover: #ff8e2b;
|
|
61
|
+
--le-color-contextmenu-bg: #ffffff;
|
|
62
|
+
--le-color-contextmenu-border: #cccccc;
|
|
63
|
+
--le-color-contextmenu-text: #333333;
|
|
64
|
+
--le-color-contextmenu-hover: #f2f2f2;
|
|
65
|
+
--le-color-contextmenu-shadow: rgba(0, 0, 0, 0.2);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* =========================================================================
|
|
69
|
+
* Element UI primary 色族覆盖
|
|
70
|
+
* 让 .el-button--primary 等组件跟随 --le-color-primary 切换
|
|
71
|
+
* ======================================================================= */
|
|
72
|
+
.el-button--primary {
|
|
73
|
+
background-color: var(--le-color-primary);
|
|
74
|
+
border-color: var(--le-color-primary);
|
|
75
|
+
}
|
|
76
|
+
.el-button--primary:hover,
|
|
77
|
+
.el-button--primary:focus {
|
|
78
|
+
background-color: var(--le-color-primary-light-1);
|
|
79
|
+
border-color: var(--le-color-primary-light-1);
|
|
80
|
+
}
|
|
81
|
+
.el-button--primary.is-plain {
|
|
82
|
+
color: var(--le-color-primary);
|
|
83
|
+
background-color: var(--le-color-primary-light-9);
|
|
84
|
+
border-color: var(--le-color-primary-light-1);
|
|
85
|
+
}
|
|
86
|
+
.el-tag--primary {
|
|
87
|
+
background-color: var(--le-color-primary-light-9);
|
|
88
|
+
border-color: var(--le-color-primary-light-1);
|
|
89
|
+
color: var(--le-color-primary);
|
|
90
|
+
}
|
|
91
|
+
.el-checkbox__input.is-checked .el-checkbox__inner,
|
|
92
|
+
.el-checkbox__input.is-indeterminate .el-checkbox__inner {
|
|
93
|
+
background-color: var(--le-color-primary);
|
|
94
|
+
border-color: var(--le-color-primary);
|
|
95
|
+
}
|
|
96
|
+
.el-checkbox__input.is-checked + .el-checkbox__label {
|
|
97
|
+
color: var(--le-color-primary);
|
|
98
|
+
}
|
|
99
|
+
.el-radio__input.is-checked .el-radio__inner {
|
|
100
|
+
background-color: var(--le-color-primary);
|
|
101
|
+
border-color: var(--le-color-primary);
|
|
102
|
+
}
|
|
103
|
+
.el-radio__input.is-checked + .el-radio__label {
|
|
104
|
+
color: var(--le-color-primary);
|
|
105
|
+
}
|
|
106
|
+
.el-switch.is-checked .el-switch__core {
|
|
107
|
+
border-color: var(--le-color-primary);
|
|
108
|
+
background-color: var(--le-color-primary);
|
|
109
|
+
}
|
|
110
|
+
.el-slider__bar {
|
|
111
|
+
background-color: var(--le-color-primary);
|
|
112
|
+
}
|
|
113
|
+
.el-slider__button {
|
|
114
|
+
border-color: var(--le-color-primary);
|
|
115
|
+
}
|
|
116
|
+
.el-pagination.is-background .el-pager li:not(.disabled).active {
|
|
117
|
+
background-color: var(--le-color-primary);
|
|
118
|
+
color: #fff;
|
|
119
|
+
}
|
|
120
|
+
.el-tabs__item.is-active {
|
|
121
|
+
color: var(--le-color-primary);
|
|
122
|
+
}
|
|
123
|
+
.el-tabs__active-bar {
|
|
124
|
+
background-color: var(--le-color-primary);
|
|
125
|
+
}
|
|
126
|
+
.el-link--primary {
|
|
127
|
+
color: var(--le-color-primary);
|
|
128
|
+
}
|
|
129
|
+
.el-loading-spinner .circular .path {
|
|
130
|
+
stroke: var(--le-color-primary);
|
|
131
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: "iconfont"; /* Project id 3548950 */
|
|
3
|
+
/* Color fonts */
|
|
4
|
+
src:
|
|
5
|
+
url('iconfont.woff2?t=1673227579566') format('woff2'),
|
|
6
|
+
url('iconfont.woff?t=1673227579566') format('woff'),
|
|
7
|
+
url('iconfont.ttf?t=1673227579566') format('truetype');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.iconfont {
|
|
11
|
+
font-family: "iconfont" !important;
|
|
12
|
+
font-size: 16px;
|
|
13
|
+
font-style: normal;
|
|
14
|
+
-webkit-font-smoothing: antialiased;
|
|
15
|
+
-moz-osx-font-smoothing: grayscale;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.icon-cyxiaoshouqushi:before {
|
|
19
|
+
content: "\e665";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.icon-cyshezhi:before {
|
|
23
|
+
content: "\e62b";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.icon-cyshujubaobiao:before {
|
|
27
|
+
content: "\e6ee";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.icon-cypingjia:before {
|
|
31
|
+
content: "\e60d";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.icon-cy_mendian:before {
|
|
35
|
+
content: "\e827";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.icon-cyyongjinjisuan:before {
|
|
39
|
+
content: "\e649";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.icon-cybumen:before {
|
|
43
|
+
content: "\e6b1";
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.icon-cydaoru:before {
|
|
47
|
+
content: "\e60f";
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.icon-cysucaiguanli:before {
|
|
51
|
+
content: "\e607";
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.icon-cypage-management:before {
|
|
55
|
+
content: "\e651";
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.icon-cyyonghu:before {
|
|
59
|
+
content: "\e60c";
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.icon-cypinglun:before {
|
|
63
|
+
content: "\e69b";
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.icon-cyshangpinguanli:before {
|
|
67
|
+
content: "\e6b0";
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.icon-cychengpincangku:before {
|
|
71
|
+
content: "\e60a";
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.icon-cytongjibaobiao:before {
|
|
75
|
+
content: "\e62a";
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.icon-cy-shangpinshuxing-gai-:before {
|
|
79
|
+
content: "\e675";
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.icon-cy-shangpindanwei-gai:before {
|
|
83
|
+
content: "\e678";
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.icon-cychakankucun:before {
|
|
87
|
+
content: "\e655";
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.icon-cyshuxing:before {
|
|
91
|
+
content: "\e662";
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.icon-cydingdan:before {
|
|
95
|
+
content: "\e98d";
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.icon-cywuliu:before {
|
|
99
|
+
content: "\e999";
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.icon-cyrenyuanleixing:before {
|
|
103
|
+
content: "\e61d";
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.icon-cya-ziyuan19:before {
|
|
107
|
+
content: "\eb24";
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.icon-cydengdaitishi:before {
|
|
111
|
+
content: "\e65c";
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.icon-cyhuiyuanguanli:before {
|
|
115
|
+
content: "\e628";
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.icon-cyjiaoseguanli:before {
|
|
119
|
+
content: "\e641";
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.icon-cydanwei:before {
|
|
123
|
+
content: "\e65e";
|
|
124
|
+
}
|
|
125
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import "./common/vars.css";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* leisure-core 主题服务
|
|
5
|
+
*
|
|
6
|
+
* 用法:
|
|
7
|
+
* import { LeTheme } from "leisure-core/le-theme";
|
|
8
|
+
* LeTheme.set("dark"); // 一键切换
|
|
9
|
+
* LeTheme.register("custom", {...}); // 注册自定义皮肤
|
|
10
|
+
* LeTheme.current; // 当前皮肤名
|
|
11
|
+
*
|
|
12
|
+
* 也可通过 Vue 原型方法访问(已由根 index.js 挂载):
|
|
13
|
+
* this.$leTheme.set("dark");
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const STORAGE_KEY = "le-theme";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 预置皮肤:每个皮肤是一组 CSS 变量键值对
|
|
20
|
+
* 未列出的变量自动回退到 :root 默认值
|
|
21
|
+
*/
|
|
22
|
+
const skins = {
|
|
23
|
+
default: {
|
|
24
|
+
// 默认皮肤走 :root,无需覆盖
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
dark: {
|
|
28
|
+
"--le-color-primary": "#3b82f6",
|
|
29
|
+
"--le-color-primary-2": "#1d4ed8",
|
|
30
|
+
"--le-color-primary-light": "#60a5fa",
|
|
31
|
+
"--le-color-primary-light-1": "#2563eb",
|
|
32
|
+
"--le-color-primary-light-9": "#1e3a8a",
|
|
33
|
+
"--le-color-primary-shadow": "rgba(59, 130, 246, 0.25)",
|
|
34
|
+
"--le-color-primary-shadow-strong": "rgba(59, 130, 246, 0.4)",
|
|
35
|
+
"--le-color-primary-shadow-soft": "rgba(59, 130, 246, 0.1)",
|
|
36
|
+
|
|
37
|
+
"--le-color-text-strong": "#f1f5f9",
|
|
38
|
+
"--le-color-text-regular": "#94a3b8",
|
|
39
|
+
"--le-color-text-muted": "#64748b",
|
|
40
|
+
"--le-color-text-form": "#cbd5e1",
|
|
41
|
+
"--le-color-input-text": "#f1f5f9",
|
|
42
|
+
"--le-color-on-dark": "#f1f5f9",
|
|
43
|
+
|
|
44
|
+
"--le-color-border": "#475569",
|
|
45
|
+
"--le-color-border-hover": "#64748b",
|
|
46
|
+
"--le-color-border-dark": "#334155",
|
|
47
|
+
|
|
48
|
+
"--le-color-card-bg": "rgba(30, 41, 59, 0.95)",
|
|
49
|
+
"--le-color-card-border": "rgba(255, 255, 255, 0.1)",
|
|
50
|
+
"--le-color-card-shadow": "rgba(0, 0, 0, 0.3)",
|
|
51
|
+
"--le-color-input-bg": "rgba(15, 23, 42, 0.5)",
|
|
52
|
+
"--le-color-placeholder": "#64748b",
|
|
53
|
+
|
|
54
|
+
"--le-color-section-bg-from": "rgba(30, 41, 59, 0.8)",
|
|
55
|
+
"--le-color-section-bg-to": "rgba(15, 23, 42, 0.9)",
|
|
56
|
+
|
|
57
|
+
"--le-color-header-bg": "#0f172a",
|
|
58
|
+
"--le-color-aside-bg": "#1e293b",
|
|
59
|
+
"--le-color-aside-text": "#f1f5f9",
|
|
60
|
+
"--le-color-aside-active": "#60a5fa",
|
|
61
|
+
"--le-color-menu-bg": "#1e293b",
|
|
62
|
+
"--le-color-aside-handle-hover": "rgba(59, 130, 246, 0.3)",
|
|
63
|
+
"--le-color-aside-handle-active": "rgba(59, 130, 246, 0.5)",
|
|
64
|
+
"--le-color-aside-toggle-bg": "#334155",
|
|
65
|
+
"--le-color-aside-toggle-hover": "#3b82f6",
|
|
66
|
+
"--le-color-contextmenu-bg": "#1e293b",
|
|
67
|
+
"--le-color-contextmenu-border": "#475569",
|
|
68
|
+
"--le-color-contextmenu-text": "#e2e8f0",
|
|
69
|
+
"--le-color-contextmenu-hover": "#334155",
|
|
70
|
+
"--le-color-contextmenu-shadow": "rgba(0, 0, 0, 0.5)",
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
green: {
|
|
74
|
+
"--le-color-primary": "#00b96b",
|
|
75
|
+
"--le-color-primary-2": "#009e5a",
|
|
76
|
+
"--le-color-primary-light": "#52c995",
|
|
77
|
+
"--le-color-primary-light-1": "#1cc879",
|
|
78
|
+
"--le-color-primary-light-9": "#e6f7ec",
|
|
79
|
+
"--le-color-primary-shadow": "rgba(0, 185, 107, 0.25)",
|
|
80
|
+
"--le-color-primary-shadow-strong": "rgba(0, 185, 107, 0.4)",
|
|
81
|
+
"--le-color-primary-shadow-soft": "rgba(0, 185, 107, 0.1)",
|
|
82
|
+
|
|
83
|
+
// 2026-08-26:补齐 header/aside 框架色,确保整套换肤一致
|
|
84
|
+
"--le-color-header-bg": "#14301f",
|
|
85
|
+
"--le-color-aside-bg": "#1b3d2b",
|
|
86
|
+
"--le-color-aside-text": "#f1f8f4",
|
|
87
|
+
"--le-color-aside-active": "#8effb9",
|
|
88
|
+
"--le-color-menu-bg": "#1b3d2b",
|
|
89
|
+
"--le-color-aside-handle-hover": "rgba(0, 185, 107, 0.3)",
|
|
90
|
+
"--le-color-aside-handle-active": "rgba(0, 185, 107, 0.5)",
|
|
91
|
+
"--le-color-aside-toggle-bg": "#0e2417",
|
|
92
|
+
"--le-color-aside-toggle-hover": "#00b96b",
|
|
93
|
+
|
|
94
|
+
"--le-color-contextmenu-bg": "#1b3d2b",
|
|
95
|
+
"--le-color-contextmenu-border": "#2f5d42",
|
|
96
|
+
"--le-color-contextmenu-text": "#e6f7ec",
|
|
97
|
+
"--le-color-contextmenu-hover": "#2f5d42",
|
|
98
|
+
"--le-color-contextmenu-shadow": "rgba(0, 0, 0, 0.4)",
|
|
99
|
+
|
|
100
|
+
// 文本/容器维持 default 风格
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* 应用一套皮肤到 <html>
|
|
106
|
+
* 先清除上次注入的 le-* 变量,再写入新值
|
|
107
|
+
*/
|
|
108
|
+
function applySkin(vars) {
|
|
109
|
+
const root = document.documentElement;
|
|
110
|
+
// 清除上次的覆盖
|
|
111
|
+
Array.from(root.style).forEach((k) => {
|
|
112
|
+
if (k.indexOf("--le-") === 0) root.style.removeProperty(k);
|
|
113
|
+
});
|
|
114
|
+
// 写入新值
|
|
115
|
+
Object.keys(vars).forEach((k) => {
|
|
116
|
+
root.style.setProperty(k, vars[k]);
|
|
117
|
+
});
|
|
118
|
+
// 标记当前皮肤,便于 CSS 做 [data-le-theme="dark"] 等条件样式
|
|
119
|
+
root.setAttribute("data-le-theme", LeTheme.current);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const LeTheme = {
|
|
123
|
+
/** 所有已注册皮肤名 */
|
|
124
|
+
skins: Object.keys(skins),
|
|
125
|
+
|
|
126
|
+
/** 当前皮肤名 */
|
|
127
|
+
current: "default",
|
|
128
|
+
|
|
129
|
+
/** 上次应用前的变量缓存(供回退) */
|
|
130
|
+
_applied: {},
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* 切换皮肤
|
|
134
|
+
* @param {string} name 皮肤名,未注册则回退到 default
|
|
135
|
+
*/
|
|
136
|
+
set(name) {
|
|
137
|
+
const vars = skins[name] || skins.default;
|
|
138
|
+
LeTheme.current = skins[name] ? name : "default";
|
|
139
|
+
LeTheme._applied = vars;
|
|
140
|
+
applySkin(vars);
|
|
141
|
+
try {
|
|
142
|
+
localStorage.setItem(STORAGE_KEY, LeTheme.current);
|
|
143
|
+
} catch (e) {
|
|
144
|
+
// 隐私模式或禁用 localStorage 时静默失败
|
|
145
|
+
}
|
|
146
|
+
if (typeof window !== "undefined" && window.EventBus) {
|
|
147
|
+
try {
|
|
148
|
+
window.EventBus.$emit("le-theme-change", LeTheme.current);
|
|
149
|
+
} catch (e) {
|
|
150
|
+
// EventBus 未就绪时静默忽略
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// 2026-08-26:主动派发自定义事件,让 DOM 级的 theme 变化事件监听器(如 el-menu 颜色绑定)能感知变化
|
|
154
|
+
if (typeof window !== "undefined") {
|
|
155
|
+
try {
|
|
156
|
+
window.dispatchEvent(
|
|
157
|
+
new CustomEvent("le-theme-change", { detail: LeTheme.current }),
|
|
158
|
+
);
|
|
159
|
+
} catch (e) {}
|
|
160
|
+
}
|
|
161
|
+
return LeTheme.current;
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* 注册自定义皮肤
|
|
166
|
+
* @param {string} name 皮肤名
|
|
167
|
+
* @param {Object} vars CSS 变量键值对
|
|
168
|
+
*/
|
|
169
|
+
register(name, vars) {
|
|
170
|
+
if (!name || typeof vars !== "object") return;
|
|
171
|
+
skins[name] = vars;
|
|
172
|
+
if (LeTheme.skins.indexOf(name) === -1) LeTheme.skins.push(name);
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* 启动时恢复上次皮肤
|
|
177
|
+
* 通常在 install 流程中自动调用
|
|
178
|
+
*/
|
|
179
|
+
init() {
|
|
180
|
+
let saved = "default";
|
|
181
|
+
try {
|
|
182
|
+
saved = localStorage.getItem(STORAGE_KEY) || "default";
|
|
183
|
+
} catch (e) {}
|
|
184
|
+
LeTheme.set(saved);
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export default LeTheme;
|
|
189
|
+
export { LeTheme };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="le-upload-container">
|
|
3
|
+
<el-upload
|
|
4
|
+
class="upload-demo"
|
|
5
|
+
action="#"
|
|
6
|
+
ref="le-upload"
|
|
7
|
+
:multiple="false"
|
|
8
|
+
:limit="limit"
|
|
9
|
+
:accept="accept"
|
|
10
|
+
:http-request="onHttpRequest"
|
|
11
|
+
:on-success="onUploadSuccess"
|
|
12
|
+
:on-remove="onRemove"
|
|
13
|
+
:on-change="onChange"
|
|
14
|
+
:on-exceed="onExceed"
|
|
15
|
+
:on-progress="onDispProgress"
|
|
16
|
+
:before-upload="onBeforeUpload"
|
|
17
|
+
:auto-upload="true"
|
|
18
|
+
>
|
|
19
|
+
<le-button slot="trigger" size="small" type="primary">{{
|
|
20
|
+
BtnSeText
|
|
21
|
+
}}</le-button>
|
|
22
|
+
</el-upload>
|
|
23
|
+
<div v-if="showTip" slot="tip" class="el-upload__tip tip">
|
|
24
|
+
{{ tipText }}
|
|
25
|
+
</div>
|
|
26
|
+
<el-progress
|
|
27
|
+
v-if="showProgress"
|
|
28
|
+
:percentage="pvalue"
|
|
29
|
+
:format="format"
|
|
30
|
+
style="width: 20%"
|
|
31
|
+
></el-progress>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
<script>
|
|
35
|
+
export default {
|
|
36
|
+
name: "le-upload",
|
|
37
|
+
props: {
|
|
38
|
+
limit: {
|
|
39
|
+
type: Number,
|
|
40
|
+
default: 1,
|
|
41
|
+
},
|
|
42
|
+
accept: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: ".xlsx,.xls",
|
|
45
|
+
},
|
|
46
|
+
BtnSeText: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: "1.选择excell表",
|
|
49
|
+
},
|
|
50
|
+
BtnUpText: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: "2.上传服务器",
|
|
53
|
+
},
|
|
54
|
+
showTip: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: true,
|
|
57
|
+
},
|
|
58
|
+
tipText: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: "",
|
|
61
|
+
},
|
|
62
|
+
maxSize: {
|
|
63
|
+
type: Number,
|
|
64
|
+
default: 100,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
data() {
|
|
68
|
+
return {
|
|
69
|
+
showProgress: false,
|
|
70
|
+
pvalue: 0,
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
mounted() {},
|
|
74
|
+
methods: {
|
|
75
|
+
onChange(file, fileList) {},
|
|
76
|
+
onRemove(file, fileList) {},
|
|
77
|
+
format(percentage) {
|
|
78
|
+
return percentage === 100 ? "导入完成" : `${percentage}%`;
|
|
79
|
+
},
|
|
80
|
+
onDispProgress(info) {
|
|
81
|
+
let num = ((info.loaded / info.total) * 100) | 0;
|
|
82
|
+
this.pvalue = num;
|
|
83
|
+
},
|
|
84
|
+
onExceed() {
|
|
85
|
+
this.$message.warning(`每次最多只能使用${this.limit}个文件!`);
|
|
86
|
+
},
|
|
87
|
+
onHttpRequest({ file, onProgress, onSuccess }) {
|
|
88
|
+
this.showProgress = true;
|
|
89
|
+
let formData = new FormData();
|
|
90
|
+
formData.append("file", file);
|
|
91
|
+
this.$emit(
|
|
92
|
+
"upload",
|
|
93
|
+
formData,
|
|
94
|
+
(progress) => {
|
|
95
|
+
onProgress(progress);
|
|
96
|
+
},
|
|
97
|
+
(res) => {
|
|
98
|
+
onSuccess(res);
|
|
99
|
+
},
|
|
100
|
+
(error) => {
|
|
101
|
+
this.onError(error);
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
},
|
|
105
|
+
onUploadSuccess(res) {
|
|
106
|
+
this.$message.success(res.data.info);
|
|
107
|
+
this.$refs["le-upload"].clearFiles();
|
|
108
|
+
},
|
|
109
|
+
onBeforeUpload(file) {
|
|
110
|
+
const isLimit = file.size / 1024 / 1024 < this.maxSize;
|
|
111
|
+
if (!isLimit) {
|
|
112
|
+
this.$message.error(`文件大小不能超过${this.maxSize}M`);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
onError(error) {
|
|
117
|
+
this.$refs["le-upload"].clearFiles();
|
|
118
|
+
this.showProgress = false;
|
|
119
|
+
console.log(error);
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
</script>
|
|
124
|
+
<style lang="scss" scoped>
|
|
125
|
+
.le-upload-container {
|
|
126
|
+
display: flex;
|
|
127
|
+
display: -webkit-flex;
|
|
128
|
+
align-items: center;
|
|
129
|
+
|
|
130
|
+
.tip {
|
|
131
|
+
margin-left: 10px !important;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
</style>
|