@lambo-design/shared 1.0.0-beta.36 → 1.0.0-beta.360
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/config/config.js +20 -3
- package/config/index.js +7 -2
- package/config/locale.js +61 -0
- package/config/themes/atrovirens/atrovirens.css +590 -0
- package/config/themes/atrovirens/atrovirens.css.map +1 -0
- package/config/themes/atrovirens/atrovirens.less +681 -0
- package/config/themes/atrovirens/var.css +29 -0
- package/config/themes/atrovirens/var.css.map +1 -0
- package/config/themes/atrovirens/var.less +689 -0
- package/config/themes/blue/blue.css +590 -0
- package/config/themes/blue/blue.css.map +1 -0
- package/config/themes/blue/blue.less +684 -0
- package/config/themes/blue/var.less +692 -0
- package/config/themes/blue-208/blue-208.css +590 -0
- package/config/themes/blue-208/blue-208.css.map +1 -0
- package/config/themes/blue-208/blue-208.less +685 -0
- package/config/themes/blue-208/var.less +691 -0
- package/config/themes/blue-digital/blue-digital.css +590 -0
- package/config/themes/blue-digital/blue-digital.css.map +1 -0
- package/config/themes/blue-digital/blue-digital.less +684 -0
- package/config/themes/blue-digital/var.less +692 -0
- package/config/themes/blue-leaf/blue-leaf.css +590 -0
- package/config/themes/blue-leaf/blue-leaf.css.map +1 -0
- package/config/themes/blue-leaf/blue-leaf.less +685 -0
- package/config/themes/blue-leaf/var.less +691 -0
- package/config/themes/blue-white/blue-white.css +590 -0
- package/config/themes/blue-white/blue-white.css.map +1 -0
- package/config/themes/blue-white/blue-white.less +685 -0
- package/config/themes/blue-white/var.less +691 -0
- package/config/themes/blue-white-big/blue-white-big.css +590 -0
- package/config/themes/blue-white-big/blue-white-big.css.map +1 -0
- package/config/themes/blue-white-big/blue-white-big.less +685 -0
- package/config/themes/blue-white-big/var.less +691 -0
- package/config/themes/blue-white-tight/blue-white-tight.css +591 -0
- package/config/themes/blue-white-tight/blue-white-tight.css.map +1 -0
- package/config/themes/blue-white-tight/blue-white-tight.less +685 -0
- package/config/themes/blue-white-tight/var.less +693 -0
- package/config/themes/canglan/canglan.css +590 -0
- package/config/themes/canglan/canglan.css.map +1 -0
- package/config/themes/canglan/canglan.less +682 -0
- package/config/themes/canglan/var.less +693 -0
- package/config/themes/cuiwei/cuiwei.css +590 -0
- package/config/themes/cuiwei/cuiwei.css.map +1 -0
- package/config/themes/cuiwei/cuiwei.less +682 -0
- package/config/themes/cuiwei/var.less +691 -0
- package/config/themes/danqing/danqing.css +590 -0
- package/config/themes/danqing/danqing.css.map +1 -0
- package/config/themes/danqing/danqing.less +682 -0
- package/config/themes/danqing/danqing.wxss +576 -0
- package/config/themes/danqing/var.less +696 -0
- package/config/themes/deep/deep.css +590 -0
- package/config/themes/deep/deep.css.map +1 -0
- package/config/themes/deep/deep.less +682 -0
- package/config/themes/deep/var.less +694 -0
- package/config/themes/default/default.css +404 -57
- package/config/themes/default/default.css.map +1 -1
- package/config/themes/default/default.less +381 -16
- package/config/themes/default/var.less +390 -11
- package/config/themes/eap/eap.css +590 -0
- package/config/themes/eap/eap.css.map +1 -0
- package/config/themes/eap/eap.less +685 -0
- package/config/themes/eap/var.less +693 -0
- package/config/themes/gold/gold.css +590 -0
- package/config/themes/gold/gold.css.map +1 -0
- package/config/themes/gold/gold.less +685 -0
- package/config/themes/gold/var.css +0 -0
- package/config/themes/gold/var.css.map +0 -0
- package/config/themes/gold/var.less +386 -5
- package/config/themes/index.js +32 -4
- package/config/themes/lime/lime.css +590 -0
- package/config/themes/lime/lime.css.map +1 -0
- package/config/themes/lime/lime.less +685 -0
- package/config/themes/lime/var.less +385 -5
- package/config/themes/orange/orange.css +354 -7
- package/config/themes/orange/orange.css.map +1 -1
- package/config/themes/orange/orange.less +366 -0
- package/config/themes/orange/var.less +386 -5
- package/config/themes/red/red.css +354 -7
- package/config/themes/red/red.css.map +1 -1
- package/config/themes/red/red.less +366 -0
- package/config/themes/red/var.less +386 -5
- package/config/themes/sichuan/sichuan.css +590 -0
- package/config/themes/sichuan/sichuan.css.map +1 -0
- package/config/themes/sichuan/sichuan.less +685 -0
- package/config/themes/sichuan/var.less +691 -0
- package/config/themes/theme-atrovirens.js +572 -0
- package/config/themes/theme-b208.js +572 -0
- package/config/themes/theme-bd.js +572 -0
- package/config/themes/theme-bl.js +572 -0
- package/config/themes/theme-blue.js +572 -0
- package/config/themes/theme-bw.js +572 -0
- package/config/themes/theme-bwb.js +572 -0
- package/config/themes/theme-bwt.js +573 -0
- package/config/themes/theme-canglan.js +574 -0
- package/config/themes/theme-cuiwei.js +574 -0
- package/config/themes/theme-danqing.js +575 -0
- package/config/themes/theme-deep.js +572 -0
- package/config/themes/theme-default.js +379 -60
- package/config/themes/theme-eap.js +572 -0
- package/config/themes/theme-gold.js +327 -8
- package/config/themes/theme-lime.js +327 -8
- package/config/themes/theme-orange.js +561 -29
- package/config/themes/theme-red.js +564 -33
- package/config/themes/theme-sichuan.js +572 -0
- package/config/themes/theme-white.js +572 -0
- package/config/themes/white/var.less +692 -0
- package/config/themes/white/white.css +590 -0
- package/config/themes/white/white.css.map +1 -0
- package/config/themes/white/white.less +685 -0
- package/directives/module/print.js +1 -0
- package/directives/module/vue-print-nb/README.md +63 -0
- package/directives/module/vue-print-nb/print.js +94 -0
- package/directives/module/vue-print-nb/printarea.js +532 -0
- package/index.js +7 -1
- package/nstyles/common.less +197 -0
- package/nstyles/components/404.less +46 -0
- package/nstyles/components/button.less +34 -0
- package/nstyles/components/date-picker.less +41 -0
- package/nstyles/components/drawer.less +20 -0
- package/nstyles/components/dropdown.less +18 -0
- package/nstyles/components/excel-flow.less +72 -0
- package/nstyles/components/form.less +314 -0
- package/nstyles/components/index.less +23 -0
- package/nstyles/components/layout/collect.less +10 -0
- package/nstyles/components/layout/detail-view.less +107 -0
- package/nstyles/components/layout/full-screen.less +7 -0
- package/nstyles/components/layout/index.less +7 -0
- package/nstyles/components/layout/other-menu.less +142 -0
- package/nstyles/components/layout/page-view.less +101 -0
- package/nstyles/components/layout/sider-trigger.less +41 -0
- package/nstyles/components/layout/tags-nav.less +113 -0
- package/nstyles/components/modal.less +90 -0
- package/nstyles/components/n-button.less +131 -0
- package/nstyles/components/n-image-preview.less +131 -0
- package/nstyles/components/n-model/index.less +19 -0
- package/nstyles/components/n-model/report-index.less +43 -0
- package/nstyles/components/n-panel.less +41 -0
- package/nstyles/components/n-picker.less +37 -0
- package/nstyles/components/n-sign.less +17 -0
- package/nstyles/components/n-tooltip.less +10 -0
- package/nstyles/components/panel.less +31 -0
- package/nstyles/components/select.less +3 -0
- package/nstyles/components/sign.less +27 -0
- package/nstyles/components/table.less +523 -0
- package/nstyles/components/tree.less +166 -0
- package/nstyles/components/upload.less +174 -0
- package/nstyles/index.css +2676 -0
- package/nstyles/index.css.map +1 -0
- package/nstyles/index.less +5 -0
- package/nstyles/reset.less +73 -0
- package/nstyles/third/ag.less +226 -0
- package/nstyles/third/icons/sort-desc.svg +1 -0
- package/nstyles/third/icons/sort-up.svg +1 -0
- package/nstyles/third/icons/sorting.svg +1 -0
- package/nstyles/third/index.less +11 -0
- package/nstyles/third/view-design.less +402 -0
- package/nstyles/variables/base.less +143 -0
- package/nstyles/variables/index.less +4 -0
- package/nstyles/variables/theme/default/button.less +7 -0
- package/nstyles/variables/theme/default/common.less +60 -0
- package/nstyles/variables/theme/default/index.less +7 -0
- package/nstyles/variables/theme/default/layout.less +40 -0
- package/nstyles/variables/theme/default/table.less +37 -0
- package/nstyles/variables/theme/default/tag.less +3 -0
- package/nstyles/variables/theme/default/upload.less +3 -0
- package/nstyles/variables/theme/index.less +13 -0
- package/nstyles/variables/theme/lsv/button.less +7 -0
- package/nstyles/variables/theme/lsv/common.less +39 -0
- package/nstyles/variables/theme/lsv/index.less +5 -0
- package/nstyles/variables/theme/lsv/layout.less +21 -0
- package/nstyles/variables/theme/lsv/table.less +20 -0
- package/nstyles/variables/theme/lsv/tag.less +3 -0
- package/nstyles/variables/theme/small/button.less +7 -0
- package/nstyles/variables/theme/small/common.less +41 -0
- package/nstyles/variables/theme/small/index.less +5 -0
- package/nstyles/variables/theme/small/layout.less +21 -0
- package/nstyles/variables/theme/small/table.less +17 -0
- package/nstyles/variables/theme/small/tag.less +3 -0
- package/package.json +28 -7
- package/plugin/index.js +12 -0
- package/plugin/module/date-format.js +30 -0
- package/plugin/module/loading.js +26 -0
- package/plugin/module/warn-handler.js +11 -0
- package/styles/image/indicator-card-header.png +0 -0
- package/styles/image/inspur.png +0 -0
- package/styles/image/lan_navigator.png +0 -0
- package/styles/image/layout-header-bg-canglan.png +0 -0
- package/styles/image/layout-header-bg-cuiwei.png +0 -0
- package/styles/image/lv_navigator.png +0 -0
- package/utils/ajax/abort-controller.js +70 -0
- package/utils/ajax/cancel-reason.js +25 -0
- package/utils/ajax/cancel-token.js +83 -0
- package/utils/ajax/content-type.js +30 -0
- package/utils/ajax/headers.js +11 -0
- package/utils/ajax/interceptors.js +45 -10
- package/utils/ajax/sseFetchUtil.js +118 -0
- package/utils/ajax/throttle.js +49 -0
- package/utils/assist.js +155 -27
- package/utils/base64.js +126 -0
- package/utils/blob.js +47 -0
- package/utils/context-menu.js +264 -0
- package/utils/crypto/aes.js +23 -0
- package/utils/crypto/index.js +10 -0
- package/utils/crypto/rsa.js +23 -0
- package/utils/date.js +334 -305
- package/utils/dict/built-in-dict.js +20 -0
- package/utils/dict/index.js +191 -0
- package/utils/event.js +72 -0
- package/utils/excel.js +504 -290
- package/utils/file.js +19 -0
- package/utils/form/validate.js +29 -0
- package/utils/getChild.js +87 -0
- package/utils/half-year.js +68 -0
- package/utils/index.js +37 -0
- package/utils/json.js +44 -0
- package/utils/locale/en-US.js +179 -0
- package/utils/locale/zh-CN.js +183 -0
- package/utils/lodop.js +5 -0
- package/utils/menu/generatorDynamicRouter.js +301 -0
- package/utils/menu/index.js +426 -15
- package/utils/mime_type.js +67 -0
- package/utils/modelerUtil.js +4 -1
- package/utils/n/api.js +42 -0
- package/utils/n/date.js +57 -0
- package/utils/n/index.js +10 -0
- package/utils/n/is-type.js +176 -0
- package/utils/n/number.js +144 -0
- package/utils/n/permission-cache.js +11 -0
- package/utils/n/reuqest/axiosN.js +17 -0
- package/utils/n/reuqest/content-type.js +19 -0
- package/utils/n/reuqest/interceptors.js +95 -0
- package/utils/n/reuqest/url-params.js +12 -0
- package/utils/n/storage.js +51 -0
- package/utils/n/token.js +51 -0
- package/utils/n/user-cache.js +11 -0
- package/utils/n/user.js +34 -0
- package/utils/n/uuid.js +16 -0
- package/utils/n-generator-routers.js +208 -0
- package/utils/n-router.js +205 -0
- package/utils/n-theme.js +30 -0
- package/utils/number.js +72 -15
- package/utils/oss.js +57 -0
- package/utils/platform.js +951 -31
- package/utils/quarter.js +58 -0
- package/utils/storage.js +198 -0
- package/utils/style.js +24 -0
- package/utils/theme.js +98 -3
- package/utils/transfer-queue.js +7 -0
- package/utils/transform.js +205 -0
- package/utils/type.js +102 -0
- package/utils/util.js +795 -0
- package/utils/vForm.js +349 -0
- package/utils/validator.js +181 -0
- package/config/themes/gold/default.css +0 -243
- package/config/themes/gold/default.css.map +0 -1
- package/config/themes/gold/default.less +0 -320
- package/config/themes/lime/default.css +0 -243
- package/config/themes/lime/default.css.map +0 -1
- package/config/themes/lime/default.less +0 -320
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 兼容子窗口/Top窗口的快捷键/右键/F12禁用工具
|
|
3
|
+
* 核心:右键/F12/Ctrl+c.s 统一配置读取
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// 初始化目标窗口列表
|
|
7
|
+
let targetWindows = [];
|
|
8
|
+
function initTargetWindows() {
|
|
9
|
+
const topWin = window.top || window;
|
|
10
|
+
const selfWin = window;
|
|
11
|
+
targetWindows = topWin === selfWin ? [topWin] : [topWin, selfWin];
|
|
12
|
+
}
|
|
13
|
+
initTargetWindows();
|
|
14
|
+
|
|
15
|
+
let disabledShortcuts = [];
|
|
16
|
+
|
|
17
|
+
// 右键 禁用/启用
|
|
18
|
+
export function disableRightClick(element = document) {
|
|
19
|
+
enableRightClick();
|
|
20
|
+
targetWindows.forEach(win => {
|
|
21
|
+
const targetDoc = win.document === element.ownerDocument ? element : win.document;
|
|
22
|
+
targetDoc.addEventListener('contextmenu', preventRightClick, {
|
|
23
|
+
capture: true,
|
|
24
|
+
passive: false,
|
|
25
|
+
once: false
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// 绑定到window
|
|
29
|
+
win.addEventListener('contextmenu', preventRightClick, {
|
|
30
|
+
capture: true,
|
|
31
|
+
passive: false
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
win.addEventListener('mouseup', preventRightClickByMouseUp, {
|
|
35
|
+
capture: true,
|
|
36
|
+
passive: false
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function enableRightClick(element = document) {
|
|
42
|
+
targetWindows.forEach(win => {
|
|
43
|
+
const targetDoc = win.document === element.ownerDocument ? element : win.document;
|
|
44
|
+
targetDoc.removeEventListener('contextmenu', preventRightClick, { capture: true });
|
|
45
|
+
|
|
46
|
+
win.removeEventListener('contextmenu', preventRightClick, { capture: true });
|
|
47
|
+
|
|
48
|
+
win.removeEventListener('mouseup', preventRightClickByMouseUp, { capture: true });
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 右键核心拦截函数
|
|
54
|
+
*/
|
|
55
|
+
function preventRightClick(e) {
|
|
56
|
+
// 统一配置读取
|
|
57
|
+
const ownerDocument = e.currentTarget.ownerDocument;
|
|
58
|
+
const currentWin = (ownerDocument != null ? ownerDocument.defaultView : undefined) || e.currentTarget;
|
|
59
|
+
const top = currentWin.top;
|
|
60
|
+
const contextMenuConfig = currentWin.contextMenu || (top != null ? top.contextMenu : undefined);
|
|
61
|
+
|
|
62
|
+
if (contextMenuConfig !== '0') return;
|
|
63
|
+
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
e.stopPropagation();
|
|
66
|
+
e.stopImmediatePropagation();
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 监听mouseup事件拦截右键
|
|
72
|
+
*/
|
|
73
|
+
function preventRightClickByMouseUp(e) {
|
|
74
|
+
if (e.button !== 2) return;
|
|
75
|
+
|
|
76
|
+
const ownerDocument = e.currentTarget.ownerDocument;
|
|
77
|
+
const currentWin = (ownerDocument != null ? ownerDocument.defaultView : undefined) || e.currentTarget;
|
|
78
|
+
const top = currentWin.top;
|
|
79
|
+
const contextMenuConfig = currentWin.contextMenu || (top != null ? top.contextMenu : undefined);
|
|
80
|
+
|
|
81
|
+
if (contextMenuConfig === '0') {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
e.stopPropagation();
|
|
84
|
+
e.stopImmediatePropagation();
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// 自定义快捷键 禁用/启用
|
|
90
|
+
export function disableShortcutKeys(shortcuts = []) {
|
|
91
|
+
enableShortcutKeys();
|
|
92
|
+
disabledShortcuts = shortcuts
|
|
93
|
+
.filter(shortcut => shortcut && shortcut.trim())
|
|
94
|
+
.map(shortcut => shortcut.trim().toLowerCase().replace(/\+/g, '+'));
|
|
95
|
+
|
|
96
|
+
targetWindows.forEach(win => {
|
|
97
|
+
win.addEventListener('keydown', preventConfiguredShortcuts, { capture: true, passive: false });
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function enableShortcutKeys() {
|
|
102
|
+
targetWindows.forEach(win => {
|
|
103
|
+
win.removeEventListener('keydown', preventConfiguredShortcuts, { capture: true });
|
|
104
|
+
});
|
|
105
|
+
disabledShortcuts = [];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function preventConfiguredShortcuts(e) {
|
|
109
|
+
const currentWin = e.currentTarget;
|
|
110
|
+
|
|
111
|
+
const top = currentWin.top;
|
|
112
|
+
const shortcutKeyConfig = currentWin.shortcutKey || (top != null ? top.shortcutKey : undefined);
|
|
113
|
+
|
|
114
|
+
if (shortcutKeyConfig !== '0') return;
|
|
115
|
+
|
|
116
|
+
const pressedKeys = [];
|
|
117
|
+
if (e.ctrlKey) pressedKeys.push('ctrl');
|
|
118
|
+
if (e.shiftKey) pressedKeys.push('shift');
|
|
119
|
+
if (e.altKey) pressedKeys.push('alt');
|
|
120
|
+
pressedKeys.push(e.key.toLowerCase());
|
|
121
|
+
const pressedShortcut = pressedKeys.join('+');
|
|
122
|
+
// console.log("disabledShortcuts===", disabledShortcuts)
|
|
123
|
+
// console.log("pressedShortcut===", pressedShortcut)
|
|
124
|
+
if (disabledShortcuts.includes(pressedShortcut)) {
|
|
125
|
+
e.preventDefault();
|
|
126
|
+
e.stopPropagation();
|
|
127
|
+
e.stopImmediatePropagation();
|
|
128
|
+
// showNotification(`${pressedShortcut.toUpperCase()} 功能已被禁用`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// F12禁用/启用
|
|
133
|
+
export function disableF12(element = document) {
|
|
134
|
+
enableF12();
|
|
135
|
+
targetWindows.forEach(win => {
|
|
136
|
+
const targetElement = win.document === element.ownerDocument ? element : win.document;
|
|
137
|
+
targetElement.addEventListener('keydown', preventF12, { capture: true, passive: false });
|
|
138
|
+
win.addEventListener('keydown', preventF12, { capture: true, passive: false });
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function enableF12(element = document) {
|
|
143
|
+
targetWindows.forEach(win => {
|
|
144
|
+
const targetElement = win.document === element.ownerDocument ? element : win.document;
|
|
145
|
+
targetElement.removeEventListener('keydown', preventF12, { capture: true });
|
|
146
|
+
win.removeEventListener('keydown', preventF12, { capture: true });
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// F12拦截函数
|
|
151
|
+
function preventF12(e) {
|
|
152
|
+
|
|
153
|
+
const ownerDocument = e.currentTarget.ownerDocument;
|
|
154
|
+
const currentWin = (ownerDocument != null ? ownerDocument.defaultView : undefined) || e.currentTarget;
|
|
155
|
+
|
|
156
|
+
const top = currentWin.top;
|
|
157
|
+
const shortcutF12Config = currentWin.shortcutF12 || (top != null ? top.shortcutF12 : undefined);
|
|
158
|
+
|
|
159
|
+
if (shortcutF12Config !== '0') return;
|
|
160
|
+
|
|
161
|
+
const isF12 = e.key.toLowerCase() === 'f12' || e.keyCode === 123 || e.code === 'F12';
|
|
162
|
+
if (isF12) {
|
|
163
|
+
e.preventDefault();
|
|
164
|
+
e.stopPropagation();
|
|
165
|
+
e.stopImmediatePropagation();
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// 文字选中 禁用/启用
|
|
171
|
+
export function disableTextSelection(element = document) {
|
|
172
|
+
enableTextSelection();
|
|
173
|
+
targetWindows.forEach(win => {
|
|
174
|
+
const targetDoc = win.document === element.ownerDocument ? element : win.document;
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
targetDoc.addEventListener('selectstart', preventTextSelection, {
|
|
178
|
+
capture: true,
|
|
179
|
+
passive: false
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
targetDoc.addEventListener('mousedown', preventTextSelectionByMouseDown, {
|
|
183
|
+
capture: true,
|
|
184
|
+
passive: false
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
targetDoc.body.style.userSelect = 'none';
|
|
188
|
+
targetDoc.body.style.webkitUserSelect = 'none';
|
|
189
|
+
targetDoc.body.style.mozUserSelect = 'none';
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export function enableTextSelection(element = document) {
|
|
194
|
+
targetWindows.forEach(win => {
|
|
195
|
+
const targetDoc = win.document === element.ownerDocument ? element : win.document;
|
|
196
|
+
|
|
197
|
+
targetDoc.removeEventListener('selectstart', preventTextSelection, { capture: true });
|
|
198
|
+
targetDoc.removeEventListener('mousedown', preventTextSelectionByMouseDown, { capture: true });
|
|
199
|
+
|
|
200
|
+
targetDoc.body.style.userSelect = '';
|
|
201
|
+
targetDoc.body.style.webkitUserSelect = '';
|
|
202
|
+
targetDoc.body.style.mozUserSelect = '';
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* 文字选中拦截
|
|
208
|
+
*/
|
|
209
|
+
function preventTextSelection(e) {
|
|
210
|
+
|
|
211
|
+
const ownerDocument = e.currentTarget.ownerDocument;
|
|
212
|
+
const currentWin = (ownerDocument != null ? ownerDocument.defaultView : undefined) || e.currentTarget;
|
|
213
|
+
|
|
214
|
+
const top = currentWin.top;
|
|
215
|
+
const textSelectedConfig = currentWin.textSelected || (top != null ? top.textSelected : undefined);
|
|
216
|
+
|
|
217
|
+
if (textSelectedConfig !== '0') return;
|
|
218
|
+
|
|
219
|
+
e.preventDefault();
|
|
220
|
+
e.stopPropagation();
|
|
221
|
+
e.stopImmediatePropagation();
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* 适配一些其他浏览器的文字选中
|
|
227
|
+
*/
|
|
228
|
+
function preventTextSelectionByMouseDown(e) {
|
|
229
|
+
if (e.button !== 0) return;
|
|
230
|
+
|
|
231
|
+
const ownerDocument = e.currentTarget.ownerDocument;
|
|
232
|
+
const currentWin = (ownerDocument != null ? ownerDocument.defaultView : undefined) || e.currentTarget;
|
|
233
|
+
|
|
234
|
+
const top = currentWin.top;
|
|
235
|
+
const textSelectedConfig = currentWin.textSelected || (top != null ? top.textSelected : undefined);
|
|
236
|
+
|
|
237
|
+
if (textSelectedConfig !== '0') return;
|
|
238
|
+
|
|
239
|
+
e.preventDefault();
|
|
240
|
+
e.stopPropagation();
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function showNotification(message) {
|
|
245
|
+
const notification = document.createElement('div');
|
|
246
|
+
notification.className = 'notification';
|
|
247
|
+
notification.textContent = message;
|
|
248
|
+
notification.id = 'contextmenu';
|
|
249
|
+
let exists = document.getElementById('contextmenu')
|
|
250
|
+
if(!exists){
|
|
251
|
+
document.body.appendChild(notification);
|
|
252
|
+
|
|
253
|
+
setTimeout(() => {
|
|
254
|
+
notification.classList.add('show');
|
|
255
|
+
}, 10);
|
|
256
|
+
|
|
257
|
+
setTimeout(() => {
|
|
258
|
+
notification.classList.remove('show');
|
|
259
|
+
setTimeout(() => {
|
|
260
|
+
document.body.removeChild(notification);
|
|
261
|
+
}, 500);
|
|
262
|
+
}, 2000);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as CryptoJS from 'crypto-js';
|
|
2
|
+
|
|
3
|
+
const AES_KEY = 'gYj2iqBV5AzxC8H0';
|
|
4
|
+
const AES_IV = 'z5c8fSuHX1PxWtIg';
|
|
5
|
+
|
|
6
|
+
let aes = {
|
|
7
|
+
encrypt(message,key = AES_KEY,iv = AES_IV) {
|
|
8
|
+
return CryptoJS.AES.encrypt(message, key, {
|
|
9
|
+
mode: CryptoJS.mode.CBC,
|
|
10
|
+
padding: CryptoJS.pad.Pkcs7,
|
|
11
|
+
iv: iv
|
|
12
|
+
})
|
|
13
|
+
},
|
|
14
|
+
decrypt(ciphertext,key = AES_IV,iv = AES_IV) {
|
|
15
|
+
return CryptoJS.AES.decrypt(ciphertext, key, {
|
|
16
|
+
mode: CryptoJS.mode.CBC,
|
|
17
|
+
padding: CryptoJS.pad.Pkcs7,
|
|
18
|
+
iv: iv
|
|
19
|
+
}).toString(CryptoJS.enc.Utf8)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default aes;
|
package/utils/crypto/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import sm3 from "./sm3";
|
|
2
2
|
import md5 from "./md5";
|
|
3
|
+
import NodeRSA from "node-rsa";
|
|
4
|
+
import {Base64} from '../base64'
|
|
3
5
|
|
|
4
6
|
let crypto = {}
|
|
5
7
|
crypto.sm3 = function (s) {
|
|
@@ -35,4 +37,12 @@ crypto.md5 = function (s, add) {
|
|
|
35
37
|
return md5.MD5(s);
|
|
36
38
|
};
|
|
37
39
|
|
|
40
|
+
crypto.encodePwd = function (s,pk){
|
|
41
|
+
if (!pk) {
|
|
42
|
+
pk = `MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDD2iolFHi+6bUh+V6JPr2gFJQsC0QNsq2EwI0MAPlI5AaizBHRVMjX1H73ptuDSiT3QZh4kk74w+eDLyYj4JXo1SvvDw5w378SLhUIDzH0zrlt3oleT3kiPQxC17yM3Os/wrtHO7IC+KGo9qrg+LJFyR/fYYHcyH9i+JAejBEnJQIDAQAB`
|
|
43
|
+
}
|
|
44
|
+
let nodeRSA = new NodeRSA(pk, "pkcs8-public");
|
|
45
|
+
return Base64.encode(nodeRSA.encrypt(s, 'base64'));
|
|
46
|
+
}
|
|
47
|
+
|
|
38
48
|
export default crypto;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import NodeRSA from "node-rsa";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 默认公钥
|
|
5
|
+
* @type {string}
|
|
6
|
+
*/
|
|
7
|
+
const defaultPublicKey = `-----BEGIN PUBLIC KEY-----
|
|
8
|
+
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCyhhlApSAjPWRjzg+wSIfALbrC
|
|
9
|
+
Ti4GVBYYBjfMYKU0O9z6EGQAXSLPW+S4VYm4LKtKXuKoeF441KU2HvnGM63cTIYt
|
|
10
|
+
T4lGbTGeYfsbeWNs1u9G9J+DrfKK8HsVB1IZIqhbMf0x7KGMeoQ2SN4KtbaPIwhl
|
|
11
|
+
IPfXzuLZiCW90l+a/wIDAQAB
|
|
12
|
+
-----END PUBLIC KEY-----`;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 使用RSA算法对data进行加密
|
|
16
|
+
* @param data 要加密的内容
|
|
17
|
+
* @param publicKey 不传使用默认公钥
|
|
18
|
+
* @returns {string|Buffer}
|
|
19
|
+
*/
|
|
20
|
+
export default function rsa(data, publicKey = defaultPublicKey) {
|
|
21
|
+
let nodeRSA = new NodeRSA(publicKey, "pkcs8-public");
|
|
22
|
+
return nodeRSA.encrypt(data, "base64");
|
|
23
|
+
}
|