@peng_kai/kit 0.2.1 → 0.2.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/admin/components/text/index.ts +2 -0
- package/admin/components/text/src/Hash.vue +20 -15
- package/admin/components/text/src/IP.vue +21 -0
- package/admin/components/upload/src/PictureCardUpload.vue +5 -1
- package/admin/styles/classCover.scss +16 -0
- package/package.json +94 -92
- package/utils/index.ts +21 -0
|
@@ -2,6 +2,7 @@ import Hash from './src/Hash.vue';
|
|
|
2
2
|
import Amount from './src/Amount.vue';
|
|
3
3
|
import Datetime from './src/Datetime.vue';
|
|
4
4
|
import Duration from './src/Duration.vue';
|
|
5
|
+
import IP from './src/IP.vue';
|
|
5
6
|
|
|
6
7
|
export { createTagGetter } from './src/createTagGetter';
|
|
7
8
|
|
|
@@ -10,4 +11,5 @@ export const Text = {
|
|
|
10
11
|
Amount,
|
|
11
12
|
Datetime,
|
|
12
13
|
Duration,
|
|
14
|
+
IP,
|
|
13
15
|
};
|
|
@@ -9,20 +9,25 @@ defineOptions({
|
|
|
9
9
|
inheritAttrs: false,
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
const props = withDefaults(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
)
|
|
12
|
+
const props = withDefaults(defineProps<{
|
|
13
|
+
/** Hash */
|
|
14
|
+
hash: string
|
|
15
|
+
/** 是否脱敏 */
|
|
16
|
+
hide?: boolean
|
|
17
|
+
/** 链名 */
|
|
18
|
+
chain?: string
|
|
19
|
+
/** Hash 类型 */
|
|
20
|
+
type?: HashType
|
|
21
|
+
/** 当 Hash 为空时显示 */
|
|
22
|
+
empty?: string
|
|
23
|
+
/** 脱敏 hash 两端字符串的长度 */
|
|
24
|
+
bothLen?: number
|
|
25
|
+
}>(), {
|
|
26
|
+
hide: true,
|
|
27
|
+
type: 'transaction',
|
|
28
|
+
empty: '-',
|
|
29
|
+
bothLen: 6,
|
|
30
|
+
});
|
|
26
31
|
|
|
27
32
|
const href = computed(() => {
|
|
28
33
|
const { hash, chain, type } = props;
|
|
@@ -33,7 +38,7 @@ const href = computed(() => {
|
|
|
33
38
|
});
|
|
34
39
|
const text = computed(() => {
|
|
35
40
|
if (props.hash)
|
|
36
|
-
return props.hide ? desensitize(props.hash) : props.hash;
|
|
41
|
+
return props.hide ? desensitize(props.hash, props.bothLen) : props.hash;
|
|
37
42
|
else
|
|
38
43
|
return props.empty;
|
|
39
44
|
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { TypographyLink as ATypographyLink } from 'ant-design-vue';
|
|
3
|
+
|
|
4
|
+
withDefaults(defineProps<{
|
|
5
|
+
ip?: string
|
|
6
|
+
empty?: string
|
|
7
|
+
}>(), {
|
|
8
|
+
empty: '-',
|
|
9
|
+
});
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<ATypographyLink
|
|
14
|
+
v-if="$props.ip"
|
|
15
|
+
:href="`https://www.ip138.com/iplookup.php?ip=${$props.ip}&action=2`"
|
|
16
|
+
:copyable="{ text: $props.ip, tooltip: false }" target="_blank"
|
|
17
|
+
>
|
|
18
|
+
<span v-bind="$attrs" class="font-mono">{{ $props.ip }}</span>
|
|
19
|
+
</ATypographyLink>
|
|
20
|
+
<span v-else v-bind="$attrs" class="font-mono">{{ $props.empty }}</span>
|
|
21
|
+
</template>
|
|
@@ -27,6 +27,8 @@ const props = withDefaults(
|
|
|
27
27
|
cardSize?: string
|
|
28
28
|
/** 允许的图片后缀 */
|
|
29
29
|
allowExts?: string[]
|
|
30
|
+
/** 禁用 */
|
|
31
|
+
disabled?: boolean
|
|
30
32
|
}>(),
|
|
31
33
|
{
|
|
32
34
|
modelValue: () => [],
|
|
@@ -34,6 +36,7 @@ const props = withDefaults(
|
|
|
34
36
|
rowCount: 'auto-fill',
|
|
35
37
|
cardSize: '90px',
|
|
36
38
|
allowExts: () => ['jpg', 'jpeg', 'png', 'gif', 'apng', 'webp', 'svg'],
|
|
39
|
+
disabled: false,
|
|
37
40
|
},
|
|
38
41
|
);
|
|
39
42
|
const emits = defineEmits<{
|
|
@@ -68,7 +71,8 @@ function beforeUpload(file: UploadFile) {
|
|
|
68
71
|
<div :class="{ 'w-fit': typeof props.rowCount === 'number' }">
|
|
69
72
|
<AUpload
|
|
70
73
|
v-model:fileList="fileList" class="pic-card-upload" listType="picture-card" multiple :maxCount="$props.maxCount"
|
|
71
|
-
:beforeUpload="beforeUpload" :customRequest="createAwsS3Request($props.awsS3, $props.rootDir)"
|
|
74
|
+
:disabled="props.disabled" :beforeUpload="beforeUpload" :customRequest="createAwsS3Request($props.awsS3, $props.rootDir)"
|
|
75
|
+
@preview="handlePreview"
|
|
72
76
|
>
|
|
73
77
|
<i v-if="fileList.length < props.maxCount" class="i-ant-design:plus-outlined text-26px text-$antd-colorTextTertiary" />
|
|
74
78
|
</AUpload>
|
|
@@ -223,26 +223,41 @@
|
|
|
223
223
|
--padding-size: 22px;
|
|
224
224
|
|
|
225
225
|
pointer-events: all;
|
|
226
|
+
background-color: var(--antd-colorBgElevated);
|
|
226
227
|
|
|
227
228
|
@media bp-lt-mobilel {
|
|
228
229
|
--padding-size: 16px;
|
|
229
230
|
}
|
|
230
231
|
|
|
231
232
|
.ant-card-head {
|
|
233
|
+
position: relative;
|
|
232
234
|
min-height: 56px;
|
|
233
235
|
padding: 0 var(--padding-size);
|
|
236
|
+
background-color: var(--antd-colorBgElevated);
|
|
237
|
+
border-bottom: 1px solid var(--antd-colorBorderSecondary);
|
|
234
238
|
|
|
235
239
|
@media bp-lt-mobilel {
|
|
236
240
|
min-height: 51px;
|
|
237
241
|
}
|
|
238
242
|
}
|
|
239
243
|
|
|
244
|
+
.ant-tabs-nav {
|
|
245
|
+
&::before {
|
|
246
|
+
display: none;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
240
250
|
.ant-card-body {
|
|
241
251
|
height: var(--body-height, auto);
|
|
242
252
|
min-height: var(--min-body-height, auto);
|
|
243
253
|
max-height: var(--max-body-height, auto);
|
|
244
254
|
padding: var(--padding-size);
|
|
245
255
|
overflow-y: auto;
|
|
256
|
+
background-color: var(--antd-colorBgElevated);
|
|
257
|
+
|
|
258
|
+
&:has(+ .ant-card-actions) {
|
|
259
|
+
border-radius: 0;
|
|
260
|
+
}
|
|
246
261
|
}
|
|
247
262
|
|
|
248
263
|
.ant-card-extra .close-btn {
|
|
@@ -295,6 +310,7 @@
|
|
|
295
310
|
justify-content: flex-end !important;
|
|
296
311
|
min-height: 56px;
|
|
297
312
|
padding: 0 var(--padding-size);
|
|
313
|
+
background-color: var(--antd-colorBgElevated);
|
|
298
314
|
|
|
299
315
|
> li {
|
|
300
316
|
width: auto !important;
|
package/package.json
CHANGED
|
@@ -1,92 +1,94 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@peng_kai/kit",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
5
|
-
"description": "",
|
|
6
|
-
"author": "",
|
|
7
|
-
"license": "ISC",
|
|
8
|
-
"keywords": [],
|
|
9
|
-
"main": "index.js",
|
|
10
|
-
"scripts": {
|
|
11
|
-
"dev:js": "tsx ./admin/scripts/deploy.ts",
|
|
12
|
-
"lint": "eslint .",
|
|
13
|
-
"lint:fix": "eslint . --fix"
|
|
14
|
-
},
|
|
15
|
-
"peerDependencies": {
|
|
16
|
-
"ant-design-vue": "4.1.2",
|
|
17
|
-
"vue": "3.4.21",
|
|
18
|
-
"vue-router": "4.3.0"
|
|
19
|
-
},
|
|
20
|
-
"dependencies": {
|
|
21
|
-
"@aws-sdk/client-s3": "^3.525.0",
|
|
22
|
-
"@aws-sdk/lib-storage": "^3.525.1",
|
|
23
|
-
"@babel/generator": "^7.23.6",
|
|
24
|
-
"@babel/parser": "^7.24.0",
|
|
25
|
-
"@babel/traverse": "^7.24.0",
|
|
26
|
-
"@babel/types": "^7.24.0",
|
|
27
|
-
"@ckeditor/ckeditor5-vue": "^5.1.0",
|
|
28
|
-
"@tanstack/vue-query": "^5.25.0",
|
|
29
|
-
"@vueuse/components": "^10.9.0",
|
|
30
|
-
"@vueuse/core": "^10.9.0",
|
|
31
|
-
"@vueuse/router": "^10.9.0",
|
|
32
|
-
"a-calc": "^1.3.11",
|
|
33
|
-
"ant-design-vue": "^4.1.2",
|
|
34
|
-
"archiver": "^6.0.2",
|
|
35
|
-
"axios": "^1.6.7",
|
|
36
|
-
"bignumber.js": "^9.1.2",
|
|
37
|
-
"chokidar": "^3.6.0",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"vue
|
|
49
|
-
"vue-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"@ckeditor/ckeditor5-
|
|
54
|
-
"@ckeditor/ckeditor5-
|
|
55
|
-
"@ckeditor/ckeditor5-
|
|
56
|
-
"@ckeditor/ckeditor5-
|
|
57
|
-
"@ckeditor/ckeditor5-
|
|
58
|
-
"@ckeditor/ckeditor5-
|
|
59
|
-
"@ckeditor/ckeditor5-
|
|
60
|
-
"@ckeditor/ckeditor5-
|
|
61
|
-
"@ckeditor/ckeditor5-
|
|
62
|
-
"@ckeditor/ckeditor5-
|
|
63
|
-
"@ckeditor/ckeditor5-
|
|
64
|
-
"@ckeditor/ckeditor5-
|
|
65
|
-
"@ckeditor/ckeditor5-
|
|
66
|
-
"@ckeditor/ckeditor5-
|
|
67
|
-
"@ckeditor/ckeditor5-html-
|
|
68
|
-
"@ckeditor/ckeditor5-
|
|
69
|
-
"@ckeditor/ckeditor5-
|
|
70
|
-
"@ckeditor/ckeditor5-
|
|
71
|
-
"@ckeditor/ckeditor5-
|
|
72
|
-
"@ckeditor/ckeditor5-
|
|
73
|
-
"@ckeditor/ckeditor5-
|
|
74
|
-
"@ckeditor/ckeditor5-
|
|
75
|
-
"@ckeditor/ckeditor5-
|
|
76
|
-
"@ckeditor/ckeditor5-
|
|
77
|
-
"@ckeditor/ckeditor5-
|
|
78
|
-
"@ckeditor/ckeditor5-
|
|
79
|
-
"@ckeditor/ckeditor5-
|
|
80
|
-
"@ckeditor/ckeditor5-
|
|
81
|
-
"@ckeditor/ckeditor5-
|
|
82
|
-
"@ckeditor/ckeditor5-
|
|
83
|
-
"@
|
|
84
|
-
"@
|
|
85
|
-
"@types/
|
|
86
|
-
"@types/
|
|
87
|
-
"@types/
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
|
|
92
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@peng_kai/kit",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.2.3",
|
|
5
|
+
"description": "",
|
|
6
|
+
"author": "",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"keywords": [],
|
|
9
|
+
"main": "index.js",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev:js": "tsx ./admin/scripts/deploy.ts",
|
|
12
|
+
"lint": "eslint .",
|
|
13
|
+
"lint:fix": "eslint . --fix"
|
|
14
|
+
},
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"ant-design-vue": "4.1.2",
|
|
17
|
+
"vue": "3.4.21",
|
|
18
|
+
"vue-router": "4.3.0"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@aws-sdk/client-s3": "^3.525.0",
|
|
22
|
+
"@aws-sdk/lib-storage": "^3.525.1",
|
|
23
|
+
"@babel/generator": "^7.23.6",
|
|
24
|
+
"@babel/parser": "^7.24.0",
|
|
25
|
+
"@babel/traverse": "^7.24.0",
|
|
26
|
+
"@babel/types": "^7.24.0",
|
|
27
|
+
"@ckeditor/ckeditor5-vue": "^5.1.0",
|
|
28
|
+
"@tanstack/vue-query": "^5.25.0",
|
|
29
|
+
"@vueuse/components": "^10.9.0",
|
|
30
|
+
"@vueuse/core": "^10.9.0",
|
|
31
|
+
"@vueuse/router": "^10.9.0",
|
|
32
|
+
"a-calc": "^1.3.11",
|
|
33
|
+
"ant-design-vue": "^4.1.2",
|
|
34
|
+
"archiver": "^6.0.2",
|
|
35
|
+
"axios": "^1.6.7",
|
|
36
|
+
"bignumber.js": "^9.1.2",
|
|
37
|
+
"chokidar": "^3.6.0",
|
|
38
|
+
"crypto-js": "^4.2.0",
|
|
39
|
+
"dayjs": "^1.11.10",
|
|
40
|
+
"echarts": "^5.4.3",
|
|
41
|
+
"execa": "^8.0.1",
|
|
42
|
+
"fast-glob": "^3.3.2",
|
|
43
|
+
"localstorage-slim": "^2.7.0",
|
|
44
|
+
"lodash-es": "^4.17.21",
|
|
45
|
+
"nprogress": "^0.2.0",
|
|
46
|
+
"pinia": "^2.1.7",
|
|
47
|
+
"tsx": "^4.7.1",
|
|
48
|
+
"vue": "^3.4.21",
|
|
49
|
+
"vue-i18n": "^9.10.1",
|
|
50
|
+
"vue-router": "^4.3.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@ckeditor/ckeditor5-adapter-ckfinder": "^41.1.0",
|
|
54
|
+
"@ckeditor/ckeditor5-alignment": "^41.1.0",
|
|
55
|
+
"@ckeditor/ckeditor5-autoformat": "^41.1.0",
|
|
56
|
+
"@ckeditor/ckeditor5-basic-styles": "^41.1.0",
|
|
57
|
+
"@ckeditor/ckeditor5-block-quote": "^41.1.0",
|
|
58
|
+
"@ckeditor/ckeditor5-build-classic": "^41.1.0",
|
|
59
|
+
"@ckeditor/ckeditor5-code-block": "^41.1.0",
|
|
60
|
+
"@ckeditor/ckeditor5-document-outline": "^41.1.0",
|
|
61
|
+
"@ckeditor/ckeditor5-editor-classic": "^41.1.0",
|
|
62
|
+
"@ckeditor/ckeditor5-essentials": "^41.1.0",
|
|
63
|
+
"@ckeditor/ckeditor5-font": "^41.1.0",
|
|
64
|
+
"@ckeditor/ckeditor5-heading": "^41.1.0",
|
|
65
|
+
"@ckeditor/ckeditor5-highlight": "^41.1.0",
|
|
66
|
+
"@ckeditor/ckeditor5-horizontal-line": "^41.1.0",
|
|
67
|
+
"@ckeditor/ckeditor5-html-embed": "^41.1.0",
|
|
68
|
+
"@ckeditor/ckeditor5-html-support": "^41.1.0",
|
|
69
|
+
"@ckeditor/ckeditor5-image": "^41.1.0",
|
|
70
|
+
"@ckeditor/ckeditor5-import-word": "^41.1.0",
|
|
71
|
+
"@ckeditor/ckeditor5-indent": "^41.1.0",
|
|
72
|
+
"@ckeditor/ckeditor5-link": "^41.1.0",
|
|
73
|
+
"@ckeditor/ckeditor5-list": "^41.1.0",
|
|
74
|
+
"@ckeditor/ckeditor5-media-embed": "^41.1.0",
|
|
75
|
+
"@ckeditor/ckeditor5-paragraph": "^41.1.0",
|
|
76
|
+
"@ckeditor/ckeditor5-remove-format": "^41.1.0",
|
|
77
|
+
"@ckeditor/ckeditor5-show-blocks": "^41.1.0",
|
|
78
|
+
"@ckeditor/ckeditor5-source-editing": "^41.1.0",
|
|
79
|
+
"@ckeditor/ckeditor5-table": "^41.1.0",
|
|
80
|
+
"@ckeditor/ckeditor5-theme-lark": "^41.1.0",
|
|
81
|
+
"@ckeditor/ckeditor5-typing": "^41.1.0",
|
|
82
|
+
"@ckeditor/ckeditor5-upload": "^41.1.0",
|
|
83
|
+
"@ckeditor/ckeditor5-word-count": "^41.1.0",
|
|
84
|
+
"@peng_kai/lint": "^0.1.0",
|
|
85
|
+
"@types/archiver": "^6.0.2",
|
|
86
|
+
"@types/crypto-js": "^4.2.2",
|
|
87
|
+
"@types/lodash-es": "^4.17.12",
|
|
88
|
+
"@types/node": "18.19.15",
|
|
89
|
+
"@types/nprogress": "^0.2.3",
|
|
90
|
+
"type-fest": "^4.11.1",
|
|
91
|
+
"typescript": "^5.4.2",
|
|
92
|
+
"vue-component-type-helpers": "^2.0.6"
|
|
93
|
+
}
|
|
94
|
+
}
|
package/utils/index.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import CryptoJS from 'crypto-js';
|
|
2
|
+
import { at as objAt } from 'lodash-es';
|
|
3
|
+
|
|
1
4
|
export { desensitize, randomString } from './string';
|
|
2
5
|
export { getScanBrowser, openScanBrowser } from './blockchain';
|
|
3
6
|
export { override } from './object';
|
|
@@ -67,3 +70,21 @@ export function createSelfKeyProxy<T extends object>() {
|
|
|
67
70
|
},
|
|
68
71
|
});
|
|
69
72
|
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 加密密钥
|
|
76
|
+
* @param a 密码
|
|
77
|
+
* @param b 密钥段所在位置
|
|
78
|
+
* @returns 加密后的密码
|
|
79
|
+
*/
|
|
80
|
+
export function encryptPassword(a: string, b: string[]) {
|
|
81
|
+
const c = objAt(window, b).map((i: any) => i()).join('');
|
|
82
|
+
const key = CryptoJS.enc.Utf8.parse(c);
|
|
83
|
+
const srcs = CryptoJS.enc.Utf8.parse(a);
|
|
84
|
+
const encrypted = CryptoJS.AES.encrypt(srcs, key, {
|
|
85
|
+
mode: CryptoJS.mode.ECB,
|
|
86
|
+
padding: CryptoJS.pad.Pkcs7,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
return encrypted.toString();
|
|
90
|
+
}
|