@smart100/spu-web-plugin 0.0.24 → 0.0.26
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/dist/index.d.ts +27 -25
- package/dist/spu-web-plugin.mjs +26274 -17147
- package/package.json +6 -4
- package/src/apaasSpuTrack.ts +5 -4
- package/src/axios.ts +4 -4
- package/src/components/expandexp/index.ts +30 -29
- package/src/core.js +7 -230
- package/src/index.ts +115 -7
- package/src/login.ts +242 -62
- package/src/oss/downloadService.ts +5 -5
- package/src/oss/servtoken.ts +1 -1
- package/src/oss/uploadService.ts +7 -6
- package/src/package/ali-oss/aliyun-oss-sdk.js +25121 -25121
- package/src/package/ali-oss/aliyun-oss-sdk.min.js +14 -14
- package/src/package/ali-oss/package.json +162 -162
- package/src/spuConfig.ts +2 -2
- package/src/storageProxy.ts +1 -3
- package/src/test.ts +4 -2
- package/src/types/global.d.ts +0 -8
- package/src/types/index.d.ts +95 -0
- package/src/types/shims-lib.d.ts +1 -0
- package/src/utils.ts +2 -2
- package/src/install.ts +0 -80
- package/src/tenantInfo.ts +0 -74
|
@@ -1,162 +1,162 @@
|
|
|
1
|
-
{
|
|
2
|
-
"_args": [
|
|
3
|
-
[
|
|
4
|
-
"ali-oss@5.3.2",
|
|
5
|
-
"c:\\code\\ImageDoDown"
|
|
6
|
-
]
|
|
7
|
-
],
|
|
8
|
-
"_from": "ali-oss@5.3.2",
|
|
9
|
-
"_id": "ali-oss@5.3.2",
|
|
10
|
-
"_inBundle": false,
|
|
11
|
-
"_integrity": "sha1-ESWQYsg4ECFJvWJsrA6CtROrvcE=",
|
|
12
|
-
"_location": "/ali-oss",
|
|
13
|
-
"_phantomChildren": {},
|
|
14
|
-
"_requested": {
|
|
15
|
-
"type": "version",
|
|
16
|
-
"registry": true,
|
|
17
|
-
"raw": "ali-oss@5.3.2",
|
|
18
|
-
"name": "ali-oss",
|
|
19
|
-
"escapedName": "ali-oss",
|
|
20
|
-
"rawSpec": "5.3.2",
|
|
21
|
-
"saveSpec": null,
|
|
22
|
-
"fetchSpec": "5.3.2"
|
|
23
|
-
},
|
|
24
|
-
"_requiredBy": [
|
|
25
|
-
"/"
|
|
26
|
-
],
|
|
27
|
-
"_resolved": "https://registry.npm.taobao.org/ali-oss/download/ali-oss-5.3.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fali-oss%2Fdownload%2Fali-oss-5.3.2.tgz",
|
|
28
|
-
"_spec": "5.3.2",
|
|
29
|
-
"_where": "c:\\code\\ImageDoDown",
|
|
30
|
-
"author": {
|
|
31
|
-
"name": "dead_horse"
|
|
32
|
-
},
|
|
33
|
-
"browser": {
|
|
34
|
-
"lib/client.js": "./dist/aliyun-oss-sdk.js",
|
|
35
|
-
"mime": "./shims/mime.js",
|
|
36
|
-
"urllib": "./shims/xhr.js",
|
|
37
|
-
"utility": "./shims/utility.js",
|
|
38
|
-
"crypto": "./shims/crypto/crypto.js",
|
|
39
|
-
"fs": false,
|
|
40
|
-
"child_process": false
|
|
41
|
-
},
|
|
42
|
-
"bugs": {
|
|
43
|
-
"url": "https://github.com/aliyun/oss-nodejs-sdk/issues"
|
|
44
|
-
},
|
|
45
|
-
"dependencies": {
|
|
46
|
-
"address": "^1.0.0",
|
|
47
|
-
"agentkeepalive": "^3.4.1",
|
|
48
|
-
"any-promise": "^1.3.0",
|
|
49
|
-
"bowser": "^1.6.0",
|
|
50
|
-
"co": "^4.6.0",
|
|
51
|
-
"co-defer": "^1.0.0",
|
|
52
|
-
"co-gather": "^0.0.1",
|
|
53
|
-
"co-priority-queue": "^1.0.3",
|
|
54
|
-
"copy-to": "^2.0.1",
|
|
55
|
-
"dateformat": "^2.0.0",
|
|
56
|
-
"debug": "^2.2.0",
|
|
57
|
-
"destroy": "^1.0.4",
|
|
58
|
-
"end-or-error": "^1.0.1",
|
|
59
|
-
"get-ready": "^1.0.0",
|
|
60
|
-
"humanize-ms": "^1.2.0",
|
|
61
|
-
"is-type-of": "^1.0.0",
|
|
62
|
-
"jstoxml": "^0.2.3",
|
|
63
|
-
"merge-descriptors": "^1.0.1",
|
|
64
|
-
"mime": "^1.3.4",
|
|
65
|
-
"mz-modules": "^2.1.0",
|
|
66
|
-
"platform": "^1.3.1",
|
|
67
|
-
"sdk-base": "^2.0.1",
|
|
68
|
-
"stream-http": "2.8.2",
|
|
69
|
-
"stream-wormhole": "^1.0.4",
|
|
70
|
-
"urllib": "^2.17.1",
|
|
71
|
-
"utility": "^1.8.0",
|
|
72
|
-
"xml2js": "^0.4.16"
|
|
73
|
-
},
|
|
74
|
-
"description": "aliyun oss(object storage service) node client",
|
|
75
|
-
"devDependencies": {
|
|
76
|
-
"aliasify": "^2.0.0",
|
|
77
|
-
"autod": "^2.6.1",
|
|
78
|
-
"babel-plugin-transform-runtime": "^6.8.0",
|
|
79
|
-
"babel-preset-es2015": "^6.24.1",
|
|
80
|
-
"babel-register": "^6.26.0",
|
|
81
|
-
"babel-runtime": "^6.6.1",
|
|
82
|
-
"babelify": "^7.3.0",
|
|
83
|
-
"beautify-benchmark": "^0.2.4",
|
|
84
|
-
"benchmark": "^2.1.1",
|
|
85
|
-
"bluebird": "^3.1.5",
|
|
86
|
-
"browserify": "^13.3.0",
|
|
87
|
-
"co-fs": "^1.2.0",
|
|
88
|
-
"co-mocha": "^1.2.1",
|
|
89
|
-
"crypto-js": "^3.1.9-1",
|
|
90
|
-
"eslint": "^4.18.1",
|
|
91
|
-
"eslint-config-airbnb": "^16.1.0",
|
|
92
|
-
"eslint-plugin-import": "^2.9.0",
|
|
93
|
-
"eslint-plugin-jsx-a11y": "^6.0.3",
|
|
94
|
-
"eslint-plugin-react": "^7.7.0",
|
|
95
|
-
"filereader": "^0.10.3",
|
|
96
|
-
"git-pre-hooks": "^1.2.0",
|
|
97
|
-
"istanbul": "^0.4.3",
|
|
98
|
-
"karma": "^1.7.1",
|
|
99
|
-
"karma-browserify": "^5.1.1",
|
|
100
|
-
"karma-chrome-launcher": "^2.2.0",
|
|
101
|
-
"karma-firefox-launcher": "^1.0.1",
|
|
102
|
-
"karma-ie-launcher": "^1.0.0",
|
|
103
|
-
"karma-mocha": "^1.3.0",
|
|
104
|
-
"karma-safari-launcher": "^1.0.0",
|
|
105
|
-
"mm": "^2.0.0",
|
|
106
|
-
"mocha": "^3.5.3",
|
|
107
|
-
"promise-polyfill": "^6.0.2",
|
|
108
|
-
"should": "^11.0.0",
|
|
109
|
-
"sinon": "^1.17.7",
|
|
110
|
-
"standard-version": "^4.4.0",
|
|
111
|
-
"stream-equal": "^1.1.0",
|
|
112
|
-
"thunk-mocha": "^1.0.3",
|
|
113
|
-
"timemachine": "^0.3.0",
|
|
114
|
-
"uglify-js": "^2.8.29",
|
|
115
|
-
"watchify": "^3.9.0"
|
|
116
|
-
},
|
|
117
|
-
"engines": {
|
|
118
|
-
"node": ">=8"
|
|
119
|
-
},
|
|
120
|
-
"files": [
|
|
121
|
-
"lib",
|
|
122
|
-
"shims",
|
|
123
|
-
"dist"
|
|
124
|
-
],
|
|
125
|
-
"git-pre-hooks": {
|
|
126
|
-
"pre-release": "npm run build-dist",
|
|
127
|
-
"post-release": [
|
|
128
|
-
"npm run publish-to-npm",
|
|
129
|
-
"npm run publish-to-cdn"
|
|
130
|
-
]
|
|
131
|
-
},
|
|
132
|
-
"homepage": "https://github.com/aliyun/oss-nodejs-sdk",
|
|
133
|
-
"keywords": [
|
|
134
|
-
"oss",
|
|
135
|
-
"client",
|
|
136
|
-
"file",
|
|
137
|
-
"aliyun"
|
|
138
|
-
],
|
|
139
|
-
"license": "MIT",
|
|
140
|
-
"main": "lib/client.js",
|
|
141
|
-
"name": "ali-oss",
|
|
142
|
-
"publishConfig": {
|
|
143
|
-
"tag": "latest-5"
|
|
144
|
-
},
|
|
145
|
-
"repository": {
|
|
146
|
-
"type": "git",
|
|
147
|
-
"url": "git://github.com/aliyun/oss-nodejs-sdk.git"
|
|
148
|
-
},
|
|
149
|
-
"scripts": {
|
|
150
|
-
"autod": "autod",
|
|
151
|
-
"browser-test": "npm run build-test && karma start",
|
|
152
|
-
"build-change-log": "standard-version",
|
|
153
|
-
"build-dist": "node browser-build.js > dist/aliyun-oss-sdk.js && MINIFY=1 node browser-build.js > dist/aliyun-oss-sdk.min.js",
|
|
154
|
-
"build-test": "node browser-build.js > test/browser/build/aliyun-oss-sdk.js && node task/browser-test-build.js > test/browser/build/tests.js",
|
|
155
|
-
"jshint": "jshint .",
|
|
156
|
-
"publish-to-cdn": "node publish.js",
|
|
157
|
-
"publish-to-npm": "node publish-npm-check.js && npm publish",
|
|
158
|
-
"test": "mocha -t 60000 -r thunk-mocha -r should test/node/*.test.js",
|
|
159
|
-
"test-cov": "istanbul cover node_modules/.bin/_mocha -- -t 60000 -r thunk-mocha -r should test/node/*.test.js"
|
|
160
|
-
},
|
|
161
|
-
"version": "5.3.2"
|
|
162
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"_args": [
|
|
3
|
+
[
|
|
4
|
+
"ali-oss@5.3.2",
|
|
5
|
+
"c:\\code\\ImageDoDown"
|
|
6
|
+
]
|
|
7
|
+
],
|
|
8
|
+
"_from": "ali-oss@5.3.2",
|
|
9
|
+
"_id": "ali-oss@5.3.2",
|
|
10
|
+
"_inBundle": false,
|
|
11
|
+
"_integrity": "sha1-ESWQYsg4ECFJvWJsrA6CtROrvcE=",
|
|
12
|
+
"_location": "/ali-oss",
|
|
13
|
+
"_phantomChildren": {},
|
|
14
|
+
"_requested": {
|
|
15
|
+
"type": "version",
|
|
16
|
+
"registry": true,
|
|
17
|
+
"raw": "ali-oss@5.3.2",
|
|
18
|
+
"name": "ali-oss",
|
|
19
|
+
"escapedName": "ali-oss",
|
|
20
|
+
"rawSpec": "5.3.2",
|
|
21
|
+
"saveSpec": null,
|
|
22
|
+
"fetchSpec": "5.3.2"
|
|
23
|
+
},
|
|
24
|
+
"_requiredBy": [
|
|
25
|
+
"/"
|
|
26
|
+
],
|
|
27
|
+
"_resolved": "https://registry.npm.taobao.org/ali-oss/download/ali-oss-5.3.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fali-oss%2Fdownload%2Fali-oss-5.3.2.tgz",
|
|
28
|
+
"_spec": "5.3.2",
|
|
29
|
+
"_where": "c:\\code\\ImageDoDown",
|
|
30
|
+
"author": {
|
|
31
|
+
"name": "dead_horse"
|
|
32
|
+
},
|
|
33
|
+
"browser": {
|
|
34
|
+
"lib/client.js": "./dist/aliyun-oss-sdk.js",
|
|
35
|
+
"mime": "./shims/mime.js",
|
|
36
|
+
"urllib": "./shims/xhr.js",
|
|
37
|
+
"utility": "./shims/utility.js",
|
|
38
|
+
"crypto": "./shims/crypto/crypto.js",
|
|
39
|
+
"fs": false,
|
|
40
|
+
"child_process": false
|
|
41
|
+
},
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/aliyun/oss-nodejs-sdk/issues"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"address": "^1.0.0",
|
|
47
|
+
"agentkeepalive": "^3.4.1",
|
|
48
|
+
"any-promise": "^1.3.0",
|
|
49
|
+
"bowser": "^1.6.0",
|
|
50
|
+
"co": "^4.6.0",
|
|
51
|
+
"co-defer": "^1.0.0",
|
|
52
|
+
"co-gather": "^0.0.1",
|
|
53
|
+
"co-priority-queue": "^1.0.3",
|
|
54
|
+
"copy-to": "^2.0.1",
|
|
55
|
+
"dateformat": "^2.0.0",
|
|
56
|
+
"debug": "^2.2.0",
|
|
57
|
+
"destroy": "^1.0.4",
|
|
58
|
+
"end-or-error": "^1.0.1",
|
|
59
|
+
"get-ready": "^1.0.0",
|
|
60
|
+
"humanize-ms": "^1.2.0",
|
|
61
|
+
"is-type-of": "^1.0.0",
|
|
62
|
+
"jstoxml": "^0.2.3",
|
|
63
|
+
"merge-descriptors": "^1.0.1",
|
|
64
|
+
"mime": "^1.3.4",
|
|
65
|
+
"mz-modules": "^2.1.0",
|
|
66
|
+
"platform": "^1.3.1",
|
|
67
|
+
"sdk-base": "^2.0.1",
|
|
68
|
+
"stream-http": "2.8.2",
|
|
69
|
+
"stream-wormhole": "^1.0.4",
|
|
70
|
+
"urllib": "^2.17.1",
|
|
71
|
+
"utility": "^1.8.0",
|
|
72
|
+
"xml2js": "^0.4.16"
|
|
73
|
+
},
|
|
74
|
+
"description": "aliyun oss(object storage service) node client",
|
|
75
|
+
"devDependencies": {
|
|
76
|
+
"aliasify": "^2.0.0",
|
|
77
|
+
"autod": "^2.6.1",
|
|
78
|
+
"babel-plugin-transform-runtime": "^6.8.0",
|
|
79
|
+
"babel-preset-es2015": "^6.24.1",
|
|
80
|
+
"babel-register": "^6.26.0",
|
|
81
|
+
"babel-runtime": "^6.6.1",
|
|
82
|
+
"babelify": "^7.3.0",
|
|
83
|
+
"beautify-benchmark": "^0.2.4",
|
|
84
|
+
"benchmark": "^2.1.1",
|
|
85
|
+
"bluebird": "^3.1.5",
|
|
86
|
+
"browserify": "^13.3.0",
|
|
87
|
+
"co-fs": "^1.2.0",
|
|
88
|
+
"co-mocha": "^1.2.1",
|
|
89
|
+
"crypto-js": "^3.1.9-1",
|
|
90
|
+
"eslint": "^4.18.1",
|
|
91
|
+
"eslint-config-airbnb": "^16.1.0",
|
|
92
|
+
"eslint-plugin-import": "^2.9.0",
|
|
93
|
+
"eslint-plugin-jsx-a11y": "^6.0.3",
|
|
94
|
+
"eslint-plugin-react": "^7.7.0",
|
|
95
|
+
"filereader": "^0.10.3",
|
|
96
|
+
"git-pre-hooks": "^1.2.0",
|
|
97
|
+
"istanbul": "^0.4.3",
|
|
98
|
+
"karma": "^1.7.1",
|
|
99
|
+
"karma-browserify": "^5.1.1",
|
|
100
|
+
"karma-chrome-launcher": "^2.2.0",
|
|
101
|
+
"karma-firefox-launcher": "^1.0.1",
|
|
102
|
+
"karma-ie-launcher": "^1.0.0",
|
|
103
|
+
"karma-mocha": "^1.3.0",
|
|
104
|
+
"karma-safari-launcher": "^1.0.0",
|
|
105
|
+
"mm": "^2.0.0",
|
|
106
|
+
"mocha": "^3.5.3",
|
|
107
|
+
"promise-polyfill": "^6.0.2",
|
|
108
|
+
"should": "^11.0.0",
|
|
109
|
+
"sinon": "^1.17.7",
|
|
110
|
+
"standard-version": "^4.4.0",
|
|
111
|
+
"stream-equal": "^1.1.0",
|
|
112
|
+
"thunk-mocha": "^1.0.3",
|
|
113
|
+
"timemachine": "^0.3.0",
|
|
114
|
+
"uglify-js": "^2.8.29",
|
|
115
|
+
"watchify": "^3.9.0"
|
|
116
|
+
},
|
|
117
|
+
"engines": {
|
|
118
|
+
"node": ">=8"
|
|
119
|
+
},
|
|
120
|
+
"files": [
|
|
121
|
+
"lib",
|
|
122
|
+
"shims",
|
|
123
|
+
"dist"
|
|
124
|
+
],
|
|
125
|
+
"git-pre-hooks": {
|
|
126
|
+
"pre-release": "npm run build-dist",
|
|
127
|
+
"post-release": [
|
|
128
|
+
"npm run publish-to-npm",
|
|
129
|
+
"npm run publish-to-cdn"
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
"homepage": "https://github.com/aliyun/oss-nodejs-sdk",
|
|
133
|
+
"keywords": [
|
|
134
|
+
"oss",
|
|
135
|
+
"client",
|
|
136
|
+
"file",
|
|
137
|
+
"aliyun"
|
|
138
|
+
],
|
|
139
|
+
"license": "MIT",
|
|
140
|
+
"main": "lib/client.js",
|
|
141
|
+
"name": "ali-oss",
|
|
142
|
+
"publishConfig": {
|
|
143
|
+
"tag": "latest-5"
|
|
144
|
+
},
|
|
145
|
+
"repository": {
|
|
146
|
+
"type": "git",
|
|
147
|
+
"url": "git://github.com/aliyun/oss-nodejs-sdk.git"
|
|
148
|
+
},
|
|
149
|
+
"scripts": {
|
|
150
|
+
"autod": "autod",
|
|
151
|
+
"browser-test": "npm run build-test && karma start",
|
|
152
|
+
"build-change-log": "standard-version",
|
|
153
|
+
"build-dist": "node browser-build.js > dist/aliyun-oss-sdk.js && MINIFY=1 node browser-build.js > dist/aliyun-oss-sdk.min.js",
|
|
154
|
+
"build-test": "node browser-build.js > test/browser/build/aliyun-oss-sdk.js && node task/browser-test-build.js > test/browser/build/tests.js",
|
|
155
|
+
"jshint": "jshint .",
|
|
156
|
+
"publish-to-cdn": "node publish.js",
|
|
157
|
+
"publish-to-npm": "node publish-npm-check.js && npm publish",
|
|
158
|
+
"test": "mocha -t 60000 -r thunk-mocha -r should test/node/*.test.js",
|
|
159
|
+
"test-cov": "istanbul cover node_modules/.bin/_mocha -- -t 60000 -r thunk-mocha -r should test/node/*.test.js"
|
|
160
|
+
},
|
|
161
|
+
"version": "5.3.2"
|
|
162
|
+
}
|
package/src/spuConfig.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { spuAxios } from './
|
|
1
|
+
import { spuAxios } from './index'
|
|
2
2
|
import { cloneDeep } from 'lodash-es'
|
|
3
3
|
|
|
4
4
|
let modulekey = ''
|
|
@@ -85,7 +85,7 @@ class SpuConfig {
|
|
|
85
85
|
// }
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
function initSpuConfig (options:
|
|
88
|
+
function initSpuConfig (options: any) {
|
|
89
89
|
modulekey = options.modulekey
|
|
90
90
|
}
|
|
91
91
|
|
package/src/storageProxy.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// import { globalOptions } from './install'
|
|
2
|
-
|
|
3
1
|
let STORAGENAMESPACE = ''
|
|
4
2
|
|
|
5
3
|
class StorageProxy {
|
|
@@ -38,7 +36,7 @@ class StorageProxy {
|
|
|
38
36
|
const lsProxy: StorageProxy = new StorageProxy('local')
|
|
39
37
|
const ssProxy: StorageProxy = new StorageProxy('session')
|
|
40
38
|
|
|
41
|
-
function initStorageProxy (options:
|
|
39
|
+
function initStorageProxy (options: any) {
|
|
42
40
|
STORAGENAMESPACE = options.storageproxyprefix || options.modulekey
|
|
43
41
|
}
|
|
44
42
|
|
package/src/test.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// import { loadding } from './components/loadding'
|
|
2
2
|
// import { lsProxy } from './storageProxy'
|
|
3
|
-
// import login from './login'
|
|
4
3
|
// import core, { Module } from './core'
|
|
4
|
+
import { globalOptions, axios, getUser, getToken, getRefreshToken, getTokenExpires, Module } from './index'
|
|
5
|
+
import { get, cloneDeep } from 'lodash-es'
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
|
|
8
|
+
async function initTest (options: any) {
|
|
7
9
|
// console.log('initTest')
|
|
8
10
|
// loadding.open()
|
|
9
11
|
|
package/src/types/global.d.ts
CHANGED
|
@@ -2,14 +2,6 @@ interface IAny {
|
|
|
2
2
|
[param: string]: any
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
interface SPUWebPluginOptions {
|
|
6
|
-
modulekey: string;
|
|
7
|
-
modulename: string;
|
|
8
|
-
moduleversion: string;
|
|
9
|
-
storageproxyprefix?: string
|
|
10
|
-
router?: any;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
5
|
type StorageType = 'storage' | 'storage-1d' | 'storage-3m' | 'storage-1y'
|
|
14
6
|
|
|
15
7
|
enum StorageEnum {
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// import type { App } from 'vue'
|
|
2
|
+
// import type { AxiosInstance } from 'axios'
|
|
3
|
+
|
|
4
|
+
interface IAMapLoader {
|
|
5
|
+
load: (options?: {
|
|
6
|
+
plugins?: Array<string>
|
|
7
|
+
AMapUI?: {
|
|
8
|
+
plugins?: Array<string>
|
|
9
|
+
}
|
|
10
|
+
}) => Promise<any>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type StorageType = 'storage' | 'storage-1d' | 'storage-3m' | 'storage-1y'
|
|
14
|
+
|
|
15
|
+
type Cope = { width?: number, height?: number } | string | boolean
|
|
16
|
+
|
|
17
|
+
interface IDownload {
|
|
18
|
+
type?: 'att' | 'img',
|
|
19
|
+
source: string,
|
|
20
|
+
datetime: string | number,
|
|
21
|
+
storagetype?: StorageType,
|
|
22
|
+
cope?: Cope,
|
|
23
|
+
filename?: string, // 下载文件名
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface IDownloadService {
|
|
27
|
+
getUrl: (options: IDownload) => Promise<any>
|
|
28
|
+
downloadFile: (options: IDownload) => Promise<any>
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface IUpload {
|
|
32
|
+
type?: 'att' | 'img',
|
|
33
|
+
file: File,
|
|
34
|
+
source?: string,
|
|
35
|
+
datetime?: string | number,
|
|
36
|
+
storagetype?: StorageType,
|
|
37
|
+
onprogress?: (p: number, _checkpoint?: any) => void
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface IUploadService {
|
|
41
|
+
upload: (options: IUpload) => Promise<any>
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// interface ISPUWebPluginOptions {
|
|
45
|
+
// modulekey: string
|
|
46
|
+
// modulename: string
|
|
47
|
+
// moduleversion: string
|
|
48
|
+
// storageproxyprefix?: string
|
|
49
|
+
// router?: any
|
|
50
|
+
// }
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
interface ISPUWebPlugin {
|
|
54
|
+
// install (app: App, option: ISPUWebPluginOptions): void
|
|
55
|
+
install (app: any, option: any): void
|
|
56
|
+
// install: any
|
|
57
|
+
version: string
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
declare const SPUWebPlugin: ISPUWebPlugin
|
|
61
|
+
|
|
62
|
+
export default SPUWebPlugin
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
export const globalOptions: any
|
|
66
|
+
export const lsProxy: any
|
|
67
|
+
export const ssProxy: any
|
|
68
|
+
export const getLocation: () => Promise<{
|
|
69
|
+
longitude: string
|
|
70
|
+
latitude: string
|
|
71
|
+
address: string
|
|
72
|
+
[propName: string]: any
|
|
73
|
+
} | null>
|
|
74
|
+
export const getDistance: (p1: [number, number], p2: [number, number]) => Promise<any>
|
|
75
|
+
export const spuAxios: any
|
|
76
|
+
export const apaasAxios: any
|
|
77
|
+
export const axios: any
|
|
78
|
+
export const spuConfig: any
|
|
79
|
+
export const downloadService: IDownloadService
|
|
80
|
+
export const uploadService: IUploadService
|
|
81
|
+
export const getUniqueid: () => string
|
|
82
|
+
export const getUuid: () => string
|
|
83
|
+
export const functionCheck: (functioncode?: string) => boolean
|
|
84
|
+
export const AMapLoader: IAMapLoader
|
|
85
|
+
export const getToken: () => string
|
|
86
|
+
export const getTokenExpires: () => string
|
|
87
|
+
export const getRefreshToken: () => string
|
|
88
|
+
export const getUser: (key?: string) => any
|
|
89
|
+
export const checkLogin: () => boolean
|
|
90
|
+
export const singleLogin: any
|
|
91
|
+
export const startRefreshtoken: any
|
|
92
|
+
export const Module: any
|
|
93
|
+
export const components: any
|
|
94
|
+
export const expandexp: (options: any) => void
|
|
95
|
+
export const wxworkSuite: any
|
package/src/types/shims-lib.d.ts
CHANGED
package/src/utils.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { getUser } from './index'
|
|
2
2
|
|
|
3
3
|
const isIOS = () => {
|
|
4
4
|
const ua = navigator.userAgent
|
|
@@ -16,7 +16,7 @@ const getUniqueid = () => {
|
|
|
16
16
|
|
|
17
17
|
const functionCheck = (functioncode?: string): boolean => {
|
|
18
18
|
if (!functioncode) return false
|
|
19
|
-
const functioncodes =
|
|
19
|
+
const functioncodes = getUser('functioncodes') || []
|
|
20
20
|
// console.log(functioncodes)
|
|
21
21
|
// debugger
|
|
22
22
|
const check = functioncodes.includes(functioncode)
|
package/src/install.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { initStorageProxy } from './storageProxy'
|
|
2
|
-
import login from './login'
|
|
3
|
-
import { initAxios } from './axios'
|
|
4
|
-
import urlquery from './urlquery'
|
|
5
|
-
import { initSpuConfig } from './spuConfig'
|
|
6
|
-
import { initApaasSpuTrack } from './apaasSpuTrack'
|
|
7
|
-
import { WxworksuitePluginInstall } from '@smart100/wxworksuite-plugin'
|
|
8
|
-
import { merge } from 'lodash-es'
|
|
9
|
-
import { initTest } from './test'
|
|
10
|
-
|
|
11
|
-
const globalOptions: SPUWebPluginOptions = {
|
|
12
|
-
modulekey: 'demospu',
|
|
13
|
-
modulename: 'demospu',
|
|
14
|
-
moduleversion: 'v1.0',
|
|
15
|
-
storageproxyprefix: '',
|
|
16
|
-
router: null
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const install = (app: any, options: SPUWebPluginOptions) => {
|
|
20
|
-
// console.log(app)
|
|
21
|
-
// console.log(app.version)
|
|
22
|
-
merge(globalOptions, options)
|
|
23
|
-
console.log('@smart100/spu-web-plugin start!')
|
|
24
|
-
console.log('options', options)
|
|
25
|
-
console.log('globalOptions', globalOptions)
|
|
26
|
-
|
|
27
|
-
// if (install.installed) return
|
|
28
|
-
// install.installed = true
|
|
29
|
-
// debugger
|
|
30
|
-
|
|
31
|
-
// if (app) {
|
|
32
|
-
// const version = Number(app.version.split('.')[0])
|
|
33
|
-
// if (version < 3) {
|
|
34
|
-
// console.error('This plugin requires Vue 3')
|
|
35
|
-
// return false
|
|
36
|
-
// }
|
|
37
|
-
// } else {
|
|
38
|
-
// console.error('This plugin requires Vue App Instance')
|
|
39
|
-
// }
|
|
40
|
-
|
|
41
|
-
initStorageProxy(globalOptions)
|
|
42
|
-
initAxios(globalOptions)
|
|
43
|
-
initSpuConfig(globalOptions)
|
|
44
|
-
initApaasSpuTrack()
|
|
45
|
-
urlquery.init()
|
|
46
|
-
login.startRefreshtoken()
|
|
47
|
-
// 安装企微第三方应用插件
|
|
48
|
-
WxworksuitePluginInstall({
|
|
49
|
-
getToken: login.getToken.bind(login)
|
|
50
|
-
})
|
|
51
|
-
initTest(globalOptions)
|
|
52
|
-
|
|
53
|
-
if (globalOptions.router) {
|
|
54
|
-
globalOptions.router.beforeEach(async (to: any, from: any, next: any) => {
|
|
55
|
-
// console.log(from)
|
|
56
|
-
// console.log(to)
|
|
57
|
-
// const isInitVisit = from.path === '/' && from.name === undefined // 路由初始化访问
|
|
58
|
-
// console.log('isInitVisit', isInitVisit)
|
|
59
|
-
|
|
60
|
-
// 自动登录
|
|
61
|
-
if (to.query.token) {
|
|
62
|
-
const singleLoginRes = await login.singleLogin(to.query)
|
|
63
|
-
next({
|
|
64
|
-
path: to.path,
|
|
65
|
-
params: to.params,
|
|
66
|
-
query: singleLoginRes.query
|
|
67
|
-
})
|
|
68
|
-
} else {
|
|
69
|
-
next()
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
} else {
|
|
73
|
-
console.error('@smart100/spu-web-plugin require a vue-router instance.')
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export {
|
|
78
|
-
install,
|
|
79
|
-
globalOptions
|
|
80
|
-
}
|
package/src/tenantInfo.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { axios } from './axios'
|
|
2
|
-
import cloudServ from './cloudServ'
|
|
3
|
-
import { lsProxy } from './storageProxy'
|
|
4
|
-
|
|
5
|
-
class TenantInfo {
|
|
6
|
-
async get (tenantCode?: string) {
|
|
7
|
-
try {
|
|
8
|
-
const tenants: null | ITenantInfo[] = await axios.get('/api/auth/tenantlist', {}).then((res: any) => {
|
|
9
|
-
// debugger
|
|
10
|
-
return res?.data?.tenants
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
// debugger
|
|
14
|
-
|
|
15
|
-
if (tenants && tenants.length) {
|
|
16
|
-
if (!tenantCode) {
|
|
17
|
-
return tenants[0]
|
|
18
|
-
} else {
|
|
19
|
-
const res =
|
|
20
|
-
tenants.find((item) => {
|
|
21
|
-
return item.code === tenantCode
|
|
22
|
-
}) || null
|
|
23
|
-
return res
|
|
24
|
-
}
|
|
25
|
-
} else {
|
|
26
|
-
return null
|
|
27
|
-
}
|
|
28
|
-
} catch (e) {
|
|
29
|
-
throw new Error((e as any).errorMsg)
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
format (tenant: ITenantInfo) {
|
|
34
|
-
if (!tenant) {
|
|
35
|
-
return null
|
|
36
|
-
}
|
|
37
|
-
const cloundTagMap = ['storage', 'storage-1d', 'storage-1y', 'storage-3m']
|
|
38
|
-
const result: NormalizedCloudServ = {}
|
|
39
|
-
for (const keyItem of cloundTagMap) {
|
|
40
|
-
const cloudServ = tenant.cloudserv[keyItem as StorageEnum]
|
|
41
|
-
if (cloudServ) {
|
|
42
|
-
result[keyItem as StorageEnum] = {
|
|
43
|
-
cloudserv_storage_provider: cloudServ.provider,
|
|
44
|
-
cloudserv_storage_storagebucket: cloudServ.storagebucket,
|
|
45
|
-
cloudserv_storage_storageendpoint: cloudServ.storageendpoint,
|
|
46
|
-
cloudserv_storage_storageurl: cloudServ.storageurl,
|
|
47
|
-
cloudserv_storage_accesskeyid: cloudServ.accesskeyid,
|
|
48
|
-
cloudserv_storage_region: cloudServ.region
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (Object.keys(result).length === 0) {
|
|
53
|
-
return null
|
|
54
|
-
}
|
|
55
|
-
return result
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async getAndSave (tenantCode?: string) {
|
|
59
|
-
const tenant: ITenantInfo | null = await this.get(tenantCode)
|
|
60
|
-
if (!tenant) {
|
|
61
|
-
lsProxy.removeItem('tenant')
|
|
62
|
-
cloudServ.remove()
|
|
63
|
-
return
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
lsProxy.setItem('tenant', JSON.stringify(tenant))
|
|
67
|
-
const normalizedTenant = this.format(tenant)
|
|
68
|
-
if (normalizedTenant) {
|
|
69
|
-
cloudServ.set(normalizedTenant)
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export default new TenantInfo()
|