1. 增强内聚性
2. 添加tsconfig.json 3. 部分plugins转ts 4. 添加geek工具类 5. 微调vite配置
This commit is contained in:
parent
f0321457f6
commit
ddd3e267cf
@ -85,9 +85,12 @@ devDependencies:
|
|||||||
'@dcloudio/vite-plugin-uni':
|
'@dcloudio/vite-plugin-uni':
|
||||||
specifier: 3.0.0-3080720230703001
|
specifier: 3.0.0-3080720230703001
|
||||||
version: 3.0.0-3080720230703001(postcss@8.4.27)(vite@4.0.4)(vue@3.2.45)
|
version: 3.0.0-3080720230703001(postcss@8.4.27)(vite@4.0.4)(vue@3.2.45)
|
||||||
|
'@types/node':
|
||||||
|
specifier: ^20.5.6
|
||||||
|
version: 20.5.6
|
||||||
'@vue/tsconfig':
|
'@vue/tsconfig':
|
||||||
specifier: ^0.1.3
|
specifier: ^0.1.3
|
||||||
version: 0.1.3
|
version: 0.1.3(@types/node@20.5.6)
|
||||||
less:
|
less:
|
||||||
specifier: ^4.2.0
|
specifier: ^4.2.0
|
||||||
version: 4.2.0
|
version: 4.2.0
|
||||||
@ -102,7 +105,7 @@ devDependencies:
|
|||||||
version: 4.9.4
|
version: 4.9.4
|
||||||
vite:
|
vite:
|
||||||
specifier: 4.0.4
|
specifier: 4.0.4
|
||||||
version: 4.0.4(less@4.2.0)(sass@1.64.2)(terser@5.19.2)
|
version: 4.0.4(@types/node@20.5.6)(less@4.2.0)(sass@1.64.2)(terser@5.19.2)
|
||||||
vue-tsc:
|
vue-tsc:
|
||||||
specifier: ^1.0.24
|
specifier: ^1.0.24
|
||||||
version: 1.0.24(typescript@4.9.4)
|
version: 1.0.24(typescript@4.9.4)
|
||||||
@ -1828,7 +1831,7 @@ packages:
|
|||||||
magic-string: 0.30.2
|
magic-string: 0.30.2
|
||||||
picocolors: 1.0.0
|
picocolors: 1.0.0
|
||||||
terser: 5.19.2
|
terser: 5.19.2
|
||||||
vite: 4.0.4(less@4.2.0)(sass@1.64.2)(terser@5.19.2)
|
vite: 4.0.4(@types/node@20.5.6)(less@4.2.0)(sass@1.64.2)(terser@5.19.2)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- postcss
|
- postcss
|
||||||
- supports-color
|
- supports-color
|
||||||
@ -2258,7 +2261,7 @@ packages:
|
|||||||
engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0}
|
engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@jest/types': 27.5.1
|
'@jest/types': 27.5.1
|
||||||
'@types/node': 20.4.9
|
'@types/node': 20.5.6
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
jest-message-util: 27.5.1
|
jest-message-util: 27.5.1
|
||||||
jest-util: 27.5.1
|
jest-util: 27.5.1
|
||||||
@ -2279,7 +2282,7 @@ packages:
|
|||||||
'@jest/test-result': 27.5.1
|
'@jest/test-result': 27.5.1
|
||||||
'@jest/transform': 27.5.1
|
'@jest/transform': 27.5.1
|
||||||
'@jest/types': 27.5.1
|
'@jest/types': 27.5.1
|
||||||
'@types/node': 20.4.9
|
'@types/node': 20.5.6
|
||||||
ansi-escapes: 4.3.2
|
ansi-escapes: 4.3.2
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
emittery: 0.8.1
|
emittery: 0.8.1
|
||||||
@ -2316,7 +2319,7 @@ packages:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@jest/fake-timers': 27.5.1
|
'@jest/fake-timers': 27.5.1
|
||||||
'@jest/types': 27.5.1
|
'@jest/types': 27.5.1
|
||||||
'@types/node': 20.4.9
|
'@types/node': 20.5.6
|
||||||
jest-mock: 27.5.1
|
jest-mock: 27.5.1
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
@ -2326,7 +2329,7 @@ packages:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@jest/types': 27.5.1
|
'@jest/types': 27.5.1
|
||||||
'@sinonjs/fake-timers': 8.1.0
|
'@sinonjs/fake-timers': 8.1.0
|
||||||
'@types/node': 20.4.9
|
'@types/node': 20.5.6
|
||||||
jest-message-util: 27.5.1
|
jest-message-util: 27.5.1
|
||||||
jest-mock: 27.5.1
|
jest-mock: 27.5.1
|
||||||
jest-util: 27.5.1
|
jest-util: 27.5.1
|
||||||
@ -2355,7 +2358,7 @@ packages:
|
|||||||
'@jest/test-result': 27.5.1
|
'@jest/test-result': 27.5.1
|
||||||
'@jest/transform': 27.5.1
|
'@jest/transform': 27.5.1
|
||||||
'@jest/types': 27.5.1
|
'@jest/types': 27.5.1
|
||||||
'@types/node': 20.4.9
|
'@types/node': 20.5.6
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
collect-v8-coverage: 1.0.2
|
collect-v8-coverage: 1.0.2
|
||||||
exit: 0.1.2
|
exit: 0.1.2
|
||||||
@ -2439,7 +2442,7 @@ packages:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@types/istanbul-lib-coverage': 2.0.4
|
'@types/istanbul-lib-coverage': 2.0.4
|
||||||
'@types/istanbul-reports': 3.0.1
|
'@types/istanbul-reports': 3.0.1
|
||||||
'@types/node': 20.4.9
|
'@types/node': 20.5.6
|
||||||
'@types/yargs': 16.0.5
|
'@types/yargs': 16.0.5
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
dev: true
|
dev: true
|
||||||
@ -2980,7 +2983,7 @@ packages:
|
|||||||
/@types/graceful-fs@4.1.6:
|
/@types/graceful-fs@4.1.6:
|
||||||
resolution: {integrity: sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==}
|
resolution: {integrity: sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 20.4.9
|
'@types/node': 20.5.6
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@types/istanbul-lib-coverage@2.0.4:
|
/@types/istanbul-lib-coverage@2.0.4:
|
||||||
@ -3003,9 +3006,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==}
|
resolution: {integrity: sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@types/node@20.4.9:
|
/@types/node@20.5.6:
|
||||||
resolution: {integrity: sha512-8e2HYcg7ohnTUbHk8focoklEQYvemQmu9M/f43DZVx43kHn0tE3BY/6gSDxS7k0SprtS0NHvj+L80cGLnoOUcQ==}
|
resolution: {integrity: sha512-Gi5wRGPbbyOTX+4Y2iULQ27oUPrefaB0PxGQJnfyWN3kvEDGM3mIB5M/gQLmitZf7A9FmLeaqxD3L1CXpm3VKQ==}
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@types/prettier@2.7.3:
|
/@types/prettier@2.7.3:
|
||||||
resolution: {integrity: sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==}
|
resolution: {integrity: sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==}
|
||||||
@ -3040,7 +3042,7 @@ packages:
|
|||||||
regenerator-runtime: 0.13.11
|
regenerator-runtime: 0.13.11
|
||||||
systemjs: 6.14.1
|
systemjs: 6.14.1
|
||||||
terser: 5.19.2
|
terser: 5.19.2
|
||||||
vite: 4.0.4(less@4.2.0)(sass@1.64.2)(terser@5.19.2)
|
vite: 4.0.4(@types/node@20.5.6)(less@4.2.0)(sass@1.64.2)(terser@5.19.2)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
dev: true
|
dev: true
|
||||||
@ -3055,7 +3057,7 @@ packages:
|
|||||||
'@babel/core': 7.22.10
|
'@babel/core': 7.22.10
|
||||||
'@babel/plugin-transform-typescript': 7.22.10(@babel/core@7.22.10)
|
'@babel/plugin-transform-typescript': 7.22.10(@babel/core@7.22.10)
|
||||||
'@vue/babel-plugin-jsx': 1.1.5(@babel/core@7.22.10)
|
'@vue/babel-plugin-jsx': 1.1.5(@babel/core@7.22.10)
|
||||||
vite: 4.0.4(less@4.2.0)(sass@1.64.2)(terser@5.19.2)
|
vite: 4.0.4(@types/node@20.5.6)(less@4.2.0)(sass@1.64.2)(terser@5.19.2)
|
||||||
vue: 3.2.45
|
vue: 3.2.45
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
@ -3068,7 +3070,7 @@ packages:
|
|||||||
vite: ^4.0.0
|
vite: ^4.0.0
|
||||||
vue: ^3.2.25
|
vue: ^3.2.25
|
||||||
dependencies:
|
dependencies:
|
||||||
vite: 4.0.4(less@4.2.0)(sass@1.64.2)(terser@5.19.2)
|
vite: 4.0.4(@types/node@20.5.6)(less@4.2.0)(sass@1.64.2)(terser@5.19.2)
|
||||||
vue: 3.2.45
|
vue: 3.2.45
|
||||||
|
|
||||||
/@volar/language-core@1.0.24:
|
/@volar/language-core@1.0.24:
|
||||||
@ -3324,13 +3326,15 @@ packages:
|
|||||||
resolution: {integrity: sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ==}
|
resolution: {integrity: sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@vue/tsconfig@0.1.3:
|
/@vue/tsconfig@0.1.3(@types/node@20.5.6):
|
||||||
resolution: {integrity: sha512-kQVsh8yyWPvHpb8gIc9l/HIDiiVUy1amynLNpCy8p+FoCiZXCo6fQos5/097MmnNZc9AtseDsCrfkhqCrJ8Olg==}
|
resolution: {integrity: sha512-kQVsh8yyWPvHpb8gIc9l/HIDiiVUy1amynLNpCy8p+FoCiZXCo6fQos5/097MmnNZc9AtseDsCrfkhqCrJ8Olg==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@types/node': '*'
|
'@types/node': '*'
|
||||||
peerDependenciesMeta:
|
peerDependenciesMeta:
|
||||||
'@types/node':
|
'@types/node':
|
||||||
optional: true
|
optional: true
|
||||||
|
dependencies:
|
||||||
|
'@types/node': 20.5.6
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@webassemblyjs/ast@1.11.6:
|
/@webassemblyjs/ast@1.11.6:
|
||||||
@ -4883,7 +4887,7 @@ packages:
|
|||||||
'@jest/environment': 27.5.1
|
'@jest/environment': 27.5.1
|
||||||
'@jest/test-result': 27.5.1
|
'@jest/test-result': 27.5.1
|
||||||
'@jest/types': 27.5.1
|
'@jest/types': 27.5.1
|
||||||
'@types/node': 20.4.9
|
'@types/node': 20.5.6
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
co: 4.6.0
|
co: 4.6.0
|
||||||
dedent: 0.7.0
|
dedent: 0.7.0
|
||||||
@ -5008,7 +5012,7 @@ packages:
|
|||||||
'@jest/environment': 27.5.1
|
'@jest/environment': 27.5.1
|
||||||
'@jest/fake-timers': 27.5.1
|
'@jest/fake-timers': 27.5.1
|
||||||
'@jest/types': 27.5.1
|
'@jest/types': 27.5.1
|
||||||
'@types/node': 20.4.9
|
'@types/node': 20.5.6
|
||||||
jest-mock: 27.5.1
|
jest-mock: 27.5.1
|
||||||
jest-util: 27.5.1
|
jest-util: 27.5.1
|
||||||
jsdom: 16.7.0
|
jsdom: 16.7.0
|
||||||
@ -5026,7 +5030,7 @@ packages:
|
|||||||
'@jest/environment': 27.5.1
|
'@jest/environment': 27.5.1
|
||||||
'@jest/fake-timers': 27.5.1
|
'@jest/fake-timers': 27.5.1
|
||||||
'@jest/types': 27.5.1
|
'@jest/types': 27.5.1
|
||||||
'@types/node': 20.4.9
|
'@types/node': 20.5.6
|
||||||
jest-mock: 27.5.1
|
jest-mock: 27.5.1
|
||||||
jest-util: 27.5.1
|
jest-util: 27.5.1
|
||||||
dev: true
|
dev: true
|
||||||
@ -5042,7 +5046,7 @@ packages:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@jest/types': 27.5.1
|
'@jest/types': 27.5.1
|
||||||
'@types/graceful-fs': 4.1.6
|
'@types/graceful-fs': 4.1.6
|
||||||
'@types/node': 20.4.9
|
'@types/node': 20.5.6
|
||||||
anymatch: 3.1.3
|
anymatch: 3.1.3
|
||||||
fb-watchman: 2.0.2
|
fb-watchman: 2.0.2
|
||||||
graceful-fs: 4.2.11
|
graceful-fs: 4.2.11
|
||||||
@ -5064,7 +5068,7 @@ packages:
|
|||||||
'@jest/source-map': 27.5.1
|
'@jest/source-map': 27.5.1
|
||||||
'@jest/test-result': 27.5.1
|
'@jest/test-result': 27.5.1
|
||||||
'@jest/types': 27.5.1
|
'@jest/types': 27.5.1
|
||||||
'@types/node': 20.4.9
|
'@types/node': 20.5.6
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
co: 4.6.0
|
co: 4.6.0
|
||||||
expect: 27.5.1
|
expect: 27.5.1
|
||||||
@ -5119,7 +5123,7 @@ packages:
|
|||||||
engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0}
|
engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@jest/types': 27.5.1
|
'@jest/types': 27.5.1
|
||||||
'@types/node': 20.4.9
|
'@types/node': 20.5.6
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/jest-pnp-resolver@1.2.3(jest-resolve@27.5.1):
|
/jest-pnp-resolver@1.2.3(jest-resolve@27.5.1):
|
||||||
@ -5175,7 +5179,7 @@ packages:
|
|||||||
'@jest/test-result': 27.5.1
|
'@jest/test-result': 27.5.1
|
||||||
'@jest/transform': 27.5.1
|
'@jest/transform': 27.5.1
|
||||||
'@jest/types': 27.5.1
|
'@jest/types': 27.5.1
|
||||||
'@types/node': 20.4.9
|
'@types/node': 20.5.6
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
emittery: 0.8.1
|
emittery: 0.8.1
|
||||||
graceful-fs: 4.2.11
|
graceful-fs: 4.2.11
|
||||||
@ -5232,7 +5236,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-jZCyo6iIxO1aqUxpuBlwTDMkzOAJS4a3eYz3YzgxxVQFwLeSA7Jfq5cbqCY+JLvTDrWirgusI/0KwxKMgrdf7w==}
|
resolution: {integrity: sha512-jZCyo6iIxO1aqUxpuBlwTDMkzOAJS4a3eYz3YzgxxVQFwLeSA7Jfq5cbqCY+JLvTDrWirgusI/0KwxKMgrdf7w==}
|
||||||
engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0}
|
engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 20.4.9
|
'@types/node': 20.5.6
|
||||||
graceful-fs: 4.2.11
|
graceful-fs: 4.2.11
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
@ -5271,7 +5275,7 @@ packages:
|
|||||||
engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0}
|
engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@jest/types': 27.5.1
|
'@jest/types': 27.5.1
|
||||||
'@types/node': 20.4.9
|
'@types/node': 20.5.6
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
ci-info: 3.8.0
|
ci-info: 3.8.0
|
||||||
graceful-fs: 4.2.11
|
graceful-fs: 4.2.11
|
||||||
@ -5296,7 +5300,7 @@ packages:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@jest/test-result': 27.5.1
|
'@jest/test-result': 27.5.1
|
||||||
'@jest/types': 27.5.1
|
'@jest/types': 27.5.1
|
||||||
'@types/node': 20.4.9
|
'@types/node': 20.5.6
|
||||||
ansi-escapes: 4.3.2
|
ansi-escapes: 4.3.2
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
jest-util: 27.5.1
|
jest-util: 27.5.1
|
||||||
@ -5307,7 +5311,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==}
|
resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==}
|
||||||
engines: {node: '>= 10.13.0'}
|
engines: {node: '>= 10.13.0'}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 20.4.9
|
'@types/node': 20.5.6
|
||||||
merge-stream: 2.0.0
|
merge-stream: 2.0.0
|
||||||
supports-color: 8.1.1
|
supports-color: 8.1.1
|
||||||
dev: true
|
dev: true
|
||||||
@ -6749,7 +6753,7 @@ packages:
|
|||||||
engines: {node: '>= 0.8'}
|
engines: {node: '>= 0.8'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/vite@4.0.4(less@4.2.0)(sass@1.64.2)(terser@5.19.2):
|
/vite@4.0.4(@types/node@20.5.6)(less@4.2.0)(sass@1.64.2)(terser@5.19.2):
|
||||||
resolution: {integrity: sha512-xevPU7M8FU0i/80DMR+YhgrzR5KS2ORy1B4xcX/cXLsvnUWvfHuqMmVU6N0YiJ4JWGRJJsLCgjEzKjG9/GKoSw==}
|
resolution: {integrity: sha512-xevPU7M8FU0i/80DMR+YhgrzR5KS2ORy1B4xcX/cXLsvnUWvfHuqMmVU6N0YiJ4JWGRJJsLCgjEzKjG9/GKoSw==}
|
||||||
engines: {node: ^14.18.0 || >=16.0.0}
|
engines: {node: ^14.18.0 || >=16.0.0}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
@ -6774,6 +6778,7 @@ packages:
|
|||||||
terser:
|
terser:
|
||||||
optional: true
|
optional: true
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@types/node': 20.5.6
|
||||||
esbuild: 0.16.17
|
esbuild: 0.16.17
|
||||||
less: 4.2.0
|
less: 4.2.0
|
||||||
postcss: 8.4.27
|
postcss: 8.4.27
|
||||||
|
|||||||
1
src/env.d.ts
vendored
1
src/env.d.ts
vendored
@ -1,4 +1,5 @@
|
|||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
|
/// <reference types="@dcloudio/types" />
|
||||||
|
|
||||||
declare module '*.vue' {
|
declare module '*.vue' {
|
||||||
import { DefineComponent } from 'vue'
|
import { DefineComponent } from 'vue'
|
||||||
|
|||||||
@ -23,20 +23,20 @@
|
|||||||
|
|
||||||
<uni-section class="mb-10" title="商品列表" sub-title="commodity" type="line"></uni-section>
|
<uni-section class="mb-10" title="商品列表" sub-title="commodity" type="line"></uni-section>
|
||||||
<geek-commodity v-for="item, index in commodityList" :key="index" :price="item.price" :title="item.title"
|
<geek-commodity v-for="item, index in commodityList" :key="index" :price="item.price" :title="item.title"
|
||||||
:num="item.num" :sub-title="item.subTitle" :img="item.img" type="line" @click="modal.msg(item.title)" />
|
:sub-title="item.subTitle" :img="item.img" type="line" @click="modal.msg(item.title)" />
|
||||||
<geek-commodity v-for="item, index in commodityList" :key="index" :price="item.price" :title="item.title"
|
<geek-commodity v-for="item, index in commodityList" :key="index" :price="item.price" :title="item.title"
|
||||||
:num="item.num" :sub-title="item.subTitle" :img="item.img" type="rect" @click="modal.msg(item.title)" />
|
:sub-title="item.subTitle" :img="item.img" type="rect" @click="modal.msg(item.title)" />
|
||||||
|
|
||||||
|
|
||||||
<uni-section class="mb-10" title="订单列表" sub-title="order" type="line"></uni-section>
|
<uni-section class="mb-10" title="订单列表" sub-title="order" type="line"></uni-section>
|
||||||
<geek-order v-for="item, index in orderList" :key="index" :img="item.img" :label="item.title" :shop="item.shop"
|
<geek-order v-for="item, index in orderList" :key="index" :img="item.img" :label="item.title" :shop="item.shop"
|
||||||
:status="item.status" :price="item.price" @more="modal.msg('更多')" @again="modal.msg('再次购买')" @return="modal.msg('退换')"
|
:status="item.status" :price="item.price" @more="modal.msg('更多')" @again="modal.msg('再次购买')" @return="modal.msg('退换')"
|
||||||
@sell="modal.msg('卖了换钱')"></geek-order>
|
@sell="modal.msg('卖了换钱')" :num="item.num"></geek-order>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted } from 'vue';
|
import { ref, reactive } from 'vue';
|
||||||
import modal from '@/plugins/modal.js'
|
import modal from '@/plugins/modal'
|
||||||
|
|
||||||
const menus = reactive([
|
const menus = reactive([
|
||||||
{ icon: "/static/images/icon/rocket.png", label: '抢单' },
|
{ icon: "/static/images/icon/rocket.png", label: '抢单' },
|
||||||
|
|||||||
@ -72,6 +72,8 @@
|
|||||||
import miniActive from '../../static/json/user-healthy/6.json';
|
import miniActive from '../../static/json/user-healthy/6.json';
|
||||||
import miniActivePrecent from '../../static/json/user-healthy/7.json';
|
import miniActivePrecent from '../../static/json/user-healthy/7.json';
|
||||||
|
|
||||||
|
import Config from '../../static/js/config'
|
||||||
|
|
||||||
var _self;
|
var _self;
|
||||||
export default {
|
export default {
|
||||||
name:'user-healthy',
|
name:'user-healthy',
|
||||||
@ -94,7 +96,7 @@
|
|||||||
miniActive,
|
miniActive,
|
||||||
miniActivePrecent,
|
miniActivePrecent,
|
||||||
delayload:false,
|
delayload:false,
|
||||||
isCanvas2d:this.$Config.ISCANVAS2D,
|
isCanvas2d:Config.ISCANVAS2D,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|||||||
@ -155,7 +155,7 @@
|
|||||||
illnessDropPrecent,
|
illnessDropPrecent,
|
||||||
dataTable,
|
dataTable,
|
||||||
delayload:false,
|
delayload:false,
|
||||||
isCanvas2d:this.$Config.ISCANVAS2D
|
isCanvas2d:Config.ISCANVAS2D
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|||||||
@ -92,6 +92,8 @@
|
|||||||
import TrendData from '../../static/json/user-server/3.json';
|
import TrendData from '../../static/json/user-server/3.json';
|
||||||
import ServiceComment from '../../static/json/user-server/4.json';
|
import ServiceComment from '../../static/json/user-server/4.json';
|
||||||
import RankData from '../../static/json/user-server/5.json';
|
import RankData from '../../static/json/user-server/5.json';
|
||||||
|
|
||||||
|
import Config from '../../static/js/config'
|
||||||
export default {
|
export default {
|
||||||
name:"user-server",
|
name:"user-server",
|
||||||
props:{
|
props:{
|
||||||
@ -111,7 +113,7 @@
|
|||||||
ServiceComment,
|
ServiceComment,
|
||||||
RankData,
|
RankData,
|
||||||
isRank:true,
|
isRank:true,
|
||||||
isCanvas2d:this.$Config.ISCANVAS2D,
|
isCanvas2d:Config.ISCANVAS2D,
|
||||||
delayload: false, //延时加载图表,否则会出现图表加载完后定位错乱
|
delayload: false, //延时加载图表,否则会出现图表加载完后定位错乱
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -62,6 +62,8 @@
|
|||||||
import teamTrand from '../../static/json/wechat/5.json';
|
import teamTrand from '../../static/json/wechat/5.json';
|
||||||
import dataTable from "../../static/json/wechat/6.json"
|
import dataTable from "../../static/json/wechat/6.json"
|
||||||
|
|
||||||
|
import Config from '../../static/js/config'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name:'wechat',
|
name:'wechat',
|
||||||
props: {
|
props: {
|
||||||
@ -84,7 +86,7 @@
|
|||||||
dataTable,
|
dataTable,
|
||||||
scrollTop: 0,
|
scrollTop: 0,
|
||||||
delayload: false,
|
delayload: false,
|
||||||
isCanvas2d: this.$Config.ISCANVAS2D,
|
isCanvas2d: Config.ISCANVAS2D,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|||||||
@ -122,6 +122,8 @@
|
|||||||
import ProgressBar from "../../components/progress-bar/progress-bar.vue"
|
import ProgressBar from "../../components/progress-bar/progress-bar.vue"
|
||||||
import dataOne from '../../static/json/finance/1.json';
|
import dataOne from '../../static/json/finance/1.json';
|
||||||
import expendDetail from '../../static/json/finance/2.json';
|
import expendDetail from '../../static/json/finance/2.json';
|
||||||
|
|
||||||
|
import Config from '../../static/js/config'
|
||||||
let _now = new Date();
|
let _now = new Date();
|
||||||
let now_time = {};
|
let now_time = {};
|
||||||
now_time.year = _now.getFullYear()
|
now_time.year = _now.getFullYear()
|
||||||
@ -135,7 +137,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
info: '大便超人', //用户数据
|
info: '大便超人', //用户数据
|
||||||
scrollHeight: "600px", //数据展示体高度
|
scrollHeight: "600px", //数据展示体高度
|
||||||
isCanvas2d: this.$Config.ISCANVAS2D,
|
isCanvas2d: Config.ISCANVAS2D,
|
||||||
historyData: {},
|
historyData: {},
|
||||||
dataOne,
|
dataOne,
|
||||||
expendDetail,
|
expendDetail,
|
||||||
|
|||||||
@ -57,6 +57,8 @@ import UserOperate from "../../components/data-center/user-operate.vue"
|
|||||||
import UserHealthy from "../../components/data-center/user-healthy.vue"
|
import UserHealthy from "../../components/data-center/user-healthy.vue"
|
||||||
import UserServer from "../../components/data-center/user-server.vue"
|
import UserServer from "../../components/data-center/user-server.vue"
|
||||||
|
|
||||||
|
import Config from '../../static/js/config'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
WucTab: resolve => require(['@/components/wuc-tab/wuc-tab.vue'], resolve),
|
WucTab: resolve => require(['@/components/wuc-tab/wuc-tab.vue'], resolve),
|
||||||
@ -69,8 +71,8 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tabList: this.$Config.TABLIST, //标签头
|
tabList: Config.TABLIST, //标签头
|
||||||
timeArray: this.$Config.TIMEARRAY, //时间数组
|
timeArray: Config.TIMEARRAY, //时间数组
|
||||||
info: '大便超人', //用户数据
|
info: '大便超人', //用户数据
|
||||||
title: "数据报表中心", //标题
|
title: "数据报表中心", //标题
|
||||||
showDataTime: "today", //选中的时间
|
showDataTime: "today", //选中的时间
|
||||||
|
|||||||
@ -54,6 +54,7 @@ import RankData from '../../static/json/school/1.json';
|
|||||||
import ProductRateData from '../../static/json/school/2.json';
|
import ProductRateData from '../../static/json/school/2.json';
|
||||||
import RadarModel from '../../static/json/school/3.json';
|
import RadarModel from '../../static/json/school/3.json';
|
||||||
import friendTrand from '../../static/json/school/4.json';
|
import friendTrand from '../../static/json/school/4.json';
|
||||||
|
import Config from '../../static/js/config'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -72,7 +73,7 @@ export default {
|
|||||||
RankData,
|
RankData,
|
||||||
ProductRateData,
|
ProductRateData,
|
||||||
RadarModel,
|
RadarModel,
|
||||||
isCanvas2d: this.$Config.ISCANVAS2D,
|
isCanvas2d: Config.ISCANVAS2D,
|
||||||
delayload: false, //延时加载图表,否则会出现图表加载完后定位错乱
|
delayload: false, //延时加载图表,否则会出现图表加载完后定位错乱
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
@ -143,6 +143,7 @@ import heartRateData from "../../static/json/sport/1.json"
|
|||||||
import heartRateRangeData from "../../static/json/sport/2.json"
|
import heartRateRangeData from "../../static/json/sport/2.json"
|
||||||
import speedRankData from "../../static/json/sport/3.json"
|
import speedRankData from "../../static/json/sport/3.json"
|
||||||
import speedAndRateData from "../../static/json/sport/4.json"
|
import speedAndRateData from "../../static/json/sport/4.json"
|
||||||
|
import Config from '../../static/js/config'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -151,7 +152,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
info: '大便超人', //用户数据
|
info: '大便超人', //用户数据
|
||||||
isCanvas2d: this.$Config.ISCANVAS2D,
|
isCanvas2d: Config.ISCANVAS2D,
|
||||||
heartRateData: {},
|
heartRateData: {},
|
||||||
speedRankData: {},
|
speedRankData: {},
|
||||||
speedAndRateData: {},
|
speedAndRateData: {},
|
||||||
|
|||||||
@ -1,79 +0,0 @@
|
|||||||
|
|
||||||
const COLOR = [
|
|
||||||
"#EE6A66", "#6BC588", "#FFC300", "#24ABFD"
|
|
||||||
];
|
|
||||||
|
|
||||||
var ISCANVAS2D = true;
|
|
||||||
|
|
||||||
switch (uni.getSystemInfoSync().platform) {
|
|
||||||
case 'android':
|
|
||||||
ISCANVAS2D = true
|
|
||||||
break;
|
|
||||||
case 'ios':
|
|
||||||
ISCANVAS2D = true
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ISCANVAS2D = false
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const RESPOND = {
|
|
||||||
success: 0,
|
|
||||||
warn: 301,
|
|
||||||
error: 500,
|
|
||||||
};
|
|
||||||
|
|
||||||
const TIMEARRAY = [
|
|
||||||
{
|
|
||||||
text: '当天',
|
|
||||||
value: 'today'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '昨天',
|
|
||||||
value: 'yesterday'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '本周',
|
|
||||||
value: 'week'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '上周',
|
|
||||||
value: 'weeklast'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '本月',
|
|
||||||
value: 'month'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '上月',
|
|
||||||
value: 'monthlast'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '指定日期',
|
|
||||||
value: 'auto'
|
|
||||||
}
|
|
||||||
];
|
|
||||||
const TABLIST = [
|
|
||||||
{name:"企业微信",type:"WECHAT"},
|
|
||||||
{name:"会员运营",type:"OPERATE"},
|
|
||||||
{name:"会员健康",type:"GJJK"},
|
|
||||||
{name:"会员服务",type:"SERVICE"},
|
|
||||||
];
|
|
||||||
|
|
||||||
const CARD_MENU = [
|
|
||||||
{title:"会员报表中心",author:"howcode",img:"https://s1.ax1x.com/2023/03/31/ppRp4iV.jpg",url:"/myPackageA/pages/main/index"},
|
|
||||||
{title:"智慧教育报表中心",author:"howcode",img:"https://s1.ax1x.com/2023/03/31/ppRp5GT.jpg",url:"/myPackageA/pages/school/index"},
|
|
||||||
{title:"差旅报表中心",author:"秋云",img:"https://s1.ax1x.com/2023/03/31/ppRpfI0.jpg",url:""},
|
|
||||||
{title:"运动报表中心",author:"howcode",img:"https://s1.ax1x.com/2023/03/31/ppRpWaq.jpg",url:"/myPackageA/pages/sport/index"},
|
|
||||||
{title:"财务报表中心",author:"howcode",img:"https://s1.ax1x.com/2023/03/31/ppRpozF.jpg",url:"/myPackageA/pages/finance/index"},
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
|
||||||
COLOR,
|
|
||||||
TIMEARRAY,
|
|
||||||
TABLIST,
|
|
||||||
RESPOND,
|
|
||||||
ISCANVAS2D,
|
|
||||||
CARD_MENU
|
|
||||||
}
|
|
||||||
@ -2,7 +2,6 @@ import tab from './tab'
|
|||||||
import auth from './auth'
|
import auth from './auth'
|
||||||
import modal from './modal'
|
import modal from './modal'
|
||||||
import common from './common'
|
import common from './common'
|
||||||
import config from './config'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
install(app) {
|
install(app) {
|
||||||
@ -10,6 +9,5 @@ export default {
|
|||||||
app.config.globalProperties.$auth = auth
|
app.config.globalProperties.$auth = auth
|
||||||
app.config.globalProperties.$modal = modal
|
app.config.globalProperties.$modal = modal
|
||||||
app.config.globalProperties.$Common = common
|
app.config.globalProperties.$Common = common
|
||||||
app.config.globalProperties.$Config = config
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,31 +1,31 @@
|
|||||||
export default {
|
export default {
|
||||||
// 消息提示
|
// 消息提示
|
||||||
msg(content) {
|
msg(content:string) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: content,
|
title: content,
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 错误消息
|
// 错误消息
|
||||||
msgError(content) {
|
msgError(content:string) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: content,
|
title: content,
|
||||||
icon: 'error'
|
icon: 'error'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 成功消息
|
// 成功消息
|
||||||
msgSuccess(content) {
|
msgSuccess(content:string) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: content,
|
title: content,
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 隐藏消息
|
// 隐藏消息
|
||||||
hideMsg(content) {
|
hideMsg(content:string) {
|
||||||
uni.hideToast()
|
uni.hideToast()
|
||||||
},
|
},
|
||||||
// 弹出提示
|
// 弹出提示
|
||||||
alert(content) {
|
alert(content:string) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: content,
|
content: content,
|
||||||
@ -33,8 +33,8 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 确认窗体
|
// 确认窗体
|
||||||
confirm(content) {
|
confirm(content:string) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve:Function, reject:Function) => {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '系统提示',
|
title: '系统提示',
|
||||||
content: content,
|
content: content,
|
||||||
@ -49,7 +49,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 提示信息
|
// 提示信息
|
||||||
showToast(option) {
|
showToast(option: string | object) {
|
||||||
if (typeof option === "object") {
|
if (typeof option === "object") {
|
||||||
uni.showToast(option)
|
uni.showToast(option)
|
||||||
} else {
|
} else {
|
||||||
@ -61,10 +61,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 打开遮罩层
|
// 打开遮罩层
|
||||||
loading(content) {
|
loading(content:string) {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: content,
|
title: content
|
||||||
icon: 'none'
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 关闭遮罩层
|
// 关闭遮罩层
|
||||||
@ -1,6 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
// 关闭所有页面,打开到应用内的某个页面
|
// 关闭所有页面,打开到应用内的某个页面
|
||||||
reLaunch(url) {
|
reLaunch(url:string) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: url,
|
url: url,
|
||||||
@ -11,7 +11,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面
|
// 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面
|
||||||
switchTab(url) {
|
switchTab(url:string) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: url,
|
url: url,
|
||||||
@ -22,7 +22,7 @@ export default {
|
|||||||
}
|
}
|
||||||
,
|
,
|
||||||
// 关闭当前页面,跳转到应用内的某个页面
|
// 关闭当前页面,跳转到应用内的某个页面
|
||||||
redirectTo(url) {
|
redirectTo(url:string) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: url,
|
url: url,
|
||||||
@ -32,7 +32,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 保留当前页面,跳转到应用内的某个页面
|
// 保留当前页面,跳转到应用内的某个页面
|
||||||
navigateTo(url) {
|
navigateTo(url:string) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: url,
|
url: url,
|
||||||
129
src/utils/geek.ts
Normal file
129
src/utils/geek.ts
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
/**
|
||||||
|
* 通配符比较
|
||||||
|
* @param {*} str 待比较的字符串
|
||||||
|
* @param {*} pattern 含有*或者?通配符的字符串
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function wildcardCompare(str: string, pattern: string): boolean {
|
||||||
|
const regex = pattern.replace(/[*?]/g, (match) => {
|
||||||
|
if (match === '*') {
|
||||||
|
return '.*';
|
||||||
|
} else if (match === '?') {
|
||||||
|
return '.';
|
||||||
|
} else {
|
||||||
|
return match
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const regexPattern = new RegExp('^' + regex + '$');
|
||||||
|
return regexPattern.test(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 日期格式化
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {*} time 时间(Date对象、时间戳、时间字符串)
|
||||||
|
* @param {*} pattern 格式模板 默认'{y}-{m}-{d} {h}:{i}:{s}' y:年 m:月 d:日 h:时 i:分 s:秒 a:星期
|
||||||
|
* @returns 按照模板格式的时间字符串
|
||||||
|
*/
|
||||||
|
export function parseTime(time: string | Date | number, pattern: string) {
|
||||||
|
if (arguments.length === 0 || !time) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
|
||||||
|
let date: Date
|
||||||
|
if (typeof time === 'object') {
|
||||||
|
date = time
|
||||||
|
} else {
|
||||||
|
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
||||||
|
time = parseInt(time)
|
||||||
|
} else if (typeof time === 'string') {
|
||||||
|
time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm), '');
|
||||||
|
}
|
||||||
|
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
||||||
|
time = time * 1000
|
||||||
|
}
|
||||||
|
date = new Date(time)
|
||||||
|
}
|
||||||
|
|
||||||
|
const formatObj = {
|
||||||
|
y: date.getFullYear(),
|
||||||
|
m: date.getMonth() + 1,
|
||||||
|
d: date.getDate(),
|
||||||
|
h: date.getHours(),
|
||||||
|
i: date.getMinutes(),
|
||||||
|
s: date.getSeconds(),
|
||||||
|
a: date.getDay()
|
||||||
|
}
|
||||||
|
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result: any, key: keyof typeof formatObj) => {
|
||||||
|
let value = formatObj[key]
|
||||||
|
if (key === 'a') {
|
||||||
|
return ['日', '一', '二', '三', '四', '五', '六'][value]
|
||||||
|
}
|
||||||
|
if (result.length > 0 && value < 10) {
|
||||||
|
return '0' + value
|
||||||
|
}
|
||||||
|
return String(value || 0)
|
||||||
|
})
|
||||||
|
return time_str
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编码请求参数
|
||||||
|
* @param params 要编码的参数
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function tansParams(params:any) {
|
||||||
|
let result = ''
|
||||||
|
for (const propName of Object.keys(params)) {
|
||||||
|
const value = params[propName];
|
||||||
|
var part = encodeURIComponent(propName) + "=";
|
||||||
|
if (value !== null && typeof (value) !== "undefined") {
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
for (const key of Object.keys(value)) {
|
||||||
|
if (value[key] !== null && typeof (value[key]) !== 'undefined') {
|
||||||
|
let params = propName + '[' + key + ']';
|
||||||
|
var subPart = encodeURIComponent(params) + "=";
|
||||||
|
result += subPart + encodeURIComponent(value[key]) + "&";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
result += part + encodeURIComponent(value) + "&";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解码请求参数
|
||||||
|
* @param str 要解码的字符串
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function untansParams(str:string){
|
||||||
|
const params = {}
|
||||||
|
const pairs = decodeURIComponent(str).split('&');
|
||||||
|
for (const pair of pairs) {
|
||||||
|
if(pair == '') continue
|
||||||
|
let [k, v] = pair.split('=');
|
||||||
|
let o = undefined
|
||||||
|
if (k.indexOf('[')) {
|
||||||
|
const regex = /(\w+)\[(\w+)\]/;
|
||||||
|
const match = k.match(regex);
|
||||||
|
if (match) {
|
||||||
|
o = match[1];
|
||||||
|
k = match[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(o == undefined){
|
||||||
|
// @ts-ignore
|
||||||
|
params[k] = v
|
||||||
|
}else{
|
||||||
|
// @ts-ignore
|
||||||
|
if(params[o] == undefined)params[o] = {}
|
||||||
|
// @ts-ignore
|
||||||
|
params[o][k] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return params
|
||||||
|
}
|
||||||
@ -4,6 +4,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// 日期格式化
|
// 日期格式化
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {*} time 时间(Date对象、时间戳、时间字符串)
|
||||||
|
* @param {*} pattern 格式模板 默认'{y}-{m}-{d} {h}:{i}:{s}' y:年 m:月 d:日 h:时 i:分 s:秒 a:星期
|
||||||
|
* @returns 按照模板格式的时间字符串
|
||||||
|
*/
|
||||||
export function parseTime(time, pattern) {
|
export function parseTime(time, pattern) {
|
||||||
if (arguments.length === 0 || !time) {
|
if (arguments.length === 0 || !time) {
|
||||||
return null
|
return null
|
||||||
|
|||||||
17
tsconfig.json
Normal file
17
tsconfig.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"strict": true,
|
||||||
|
"forceConsistentCasingInFileNames":true,
|
||||||
|
"lib": ["es2015"],
|
||||||
|
"baseUrl": "./",
|
||||||
|
"paths": {
|
||||||
|
"@": [
|
||||||
|
"src"
|
||||||
|
],
|
||||||
|
"@/*": [
|
||||||
|
"src/*"
|
||||||
|
],
|
||||||
|
"vue": ["node_modules/vue"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user