@peng_kai/kit 0.2.2 → 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.
@@ -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
  };
@@ -26,6 +26,7 @@ const props = withDefaults(defineProps<{
26
26
  hide: true,
27
27
  type: 'transaction',
28
28
  empty: '-',
29
+ bothLen: 6,
29
30
  });
30
31
 
31
32
  const href = computed(() => {
@@ -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>
package/package.json CHANGED
@@ -1,92 +1,94 @@
1
- {
2
- "name": "@peng_kai/kit",
3
- "type": "module",
4
- "version": "0.2.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
- "dayjs": "^1.11.10",
39
- "echarts": "^5.4.3",
40
- "execa": "^8.0.1",
41
- "fast-glob": "^3.3.2",
42
- "localstorage-slim": "^2.7.0",
43
- "lodash-es": "^4.17.21",
44
- "nprogress": "^0.2.0",
45
- "pinia": "^2.1.7",
46
- "tsx": "^4.7.1",
47
- "vue": "^3.4.21",
48
- "vue-i18n": "^9.10.1",
49
- "vue-router": "^4.3.0"
50
- },
51
- "devDependencies": {
52
- "@ckeditor/ckeditor5-adapter-ckfinder": "^41.1.0",
53
- "@ckeditor/ckeditor5-alignment": "^41.1.0",
54
- "@ckeditor/ckeditor5-autoformat": "^41.1.0",
55
- "@ckeditor/ckeditor5-basic-styles": "^41.1.0",
56
- "@ckeditor/ckeditor5-block-quote": "^41.1.0",
57
- "@ckeditor/ckeditor5-build-classic": "^41.1.0",
58
- "@ckeditor/ckeditor5-code-block": "^41.1.0",
59
- "@ckeditor/ckeditor5-document-outline": "^41.1.0",
60
- "@ckeditor/ckeditor5-editor-classic": "^41.1.0",
61
- "@ckeditor/ckeditor5-essentials": "^41.1.0",
62
- "@ckeditor/ckeditor5-font": "^41.1.0",
63
- "@ckeditor/ckeditor5-heading": "^41.1.0",
64
- "@ckeditor/ckeditor5-highlight": "^41.1.0",
65
- "@ckeditor/ckeditor5-horizontal-line": "^41.1.0",
66
- "@ckeditor/ckeditor5-html-embed": "^41.1.0",
67
- "@ckeditor/ckeditor5-html-support": "^41.1.0",
68
- "@ckeditor/ckeditor5-image": "^41.1.0",
69
- "@ckeditor/ckeditor5-import-word": "^41.1.0",
70
- "@ckeditor/ckeditor5-indent": "^41.1.0",
71
- "@ckeditor/ckeditor5-link": "^41.1.0",
72
- "@ckeditor/ckeditor5-list": "^41.1.0",
73
- "@ckeditor/ckeditor5-media-embed": "^41.1.0",
74
- "@ckeditor/ckeditor5-paragraph": "^41.1.0",
75
- "@ckeditor/ckeditor5-remove-format": "^41.1.0",
76
- "@ckeditor/ckeditor5-show-blocks": "^41.1.0",
77
- "@ckeditor/ckeditor5-source-editing": "^41.1.0",
78
- "@ckeditor/ckeditor5-table": "^41.1.0",
79
- "@ckeditor/ckeditor5-theme-lark": "^41.1.0",
80
- "@ckeditor/ckeditor5-typing": "^41.1.0",
81
- "@ckeditor/ckeditor5-upload": "^41.1.0",
82
- "@ckeditor/ckeditor5-word-count": "^41.1.0",
83
- "@peng_kai/lint": "^0.1.0",
84
- "@types/archiver": "^6.0.2",
85
- "@types/lodash-es": "^4.17.12",
86
- "@types/node": "18.19.15",
87
- "@types/nprogress": "^0.2.3",
88
- "type-fest": "^4.11.1",
89
- "typescript": "^5.4.2",
90
- "vue-component-type-helpers": "^2.0.6"
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
+ }