@smart100/spu-web-plugin 0.0.3 → 0.0.5
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/README.md +1 -0
- package/dist/index.d.ts +95 -0
- package/dist/spu-web-plugin.mjs +2 -2
- package/package.json +6 -7
- package/src/index.ts +21 -1
- package/src/location.ts +19 -0
- package/src/oss/downloadService.ts +10 -7
- 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/types/index.d.ts +79 -13
- package/src/utils.ts +17 -1
|
@@ -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/types/index.d.ts
CHANGED
|
@@ -1,27 +1,93 @@
|
|
|
1
1
|
import type { App } from 'vue'
|
|
2
2
|
// import type { AxiosInstance } from 'axios'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
interface ISPUWebPluginOptions {
|
|
5
|
+
modulekey: string
|
|
6
|
+
modulename: string
|
|
7
|
+
moduleversion: string
|
|
8
|
+
router: any
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface IAMapLoader {
|
|
12
|
+
load: (options?: {
|
|
13
|
+
plugins?: Array<string>
|
|
14
|
+
AMapUI?: {
|
|
15
|
+
plugins?: Array<string>
|
|
16
|
+
}
|
|
17
|
+
}) => Promise<any>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
type Cope = { width?: number, height?: number } | string | boolean
|
|
22
|
+
|
|
23
|
+
interface IDownload {
|
|
24
|
+
type?: 'att' | 'img',
|
|
25
|
+
source: string,
|
|
26
|
+
datetime: string | number,
|
|
27
|
+
storagetype?: StorageType,
|
|
28
|
+
cope?: Cope
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface IDownloadService {
|
|
32
|
+
getUrl: ({
|
|
33
|
+
type = 'img',
|
|
34
|
+
source = '',
|
|
35
|
+
datetime = '',
|
|
36
|
+
storagetype = 'storage',
|
|
37
|
+
cope = ''
|
|
38
|
+
}: IDownload) => Promise<any>
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
interface IUpload {
|
|
43
|
+
type?: 'att' | 'img',
|
|
44
|
+
file: File,
|
|
45
|
+
source?: string,
|
|
46
|
+
datetime?: string | number,
|
|
47
|
+
storagetype?: StorageType,
|
|
48
|
+
onprogress?: (p: number, _checkpoint?: IAny) => void
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface IUploadService {
|
|
52
|
+
upload: ({
|
|
53
|
+
type = 'img',
|
|
54
|
+
file,
|
|
55
|
+
source = '',
|
|
56
|
+
datetime = '',
|
|
57
|
+
storagetype = 'storage',
|
|
58
|
+
onprogress,
|
|
59
|
+
}: IUpload) => Promise<any>
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
type Location = {
|
|
64
|
+
longitude: string
|
|
65
|
+
latitude: string
|
|
66
|
+
address: string
|
|
67
|
+
[propName: string]: any
|
|
68
|
+
} | null
|
|
69
|
+
|
|
10
70
|
|
|
11
71
|
export const lsProxy: any
|
|
12
72
|
export const ssProxy: any
|
|
13
|
-
export const getLocation:
|
|
14
|
-
export const getDistance: any
|
|
73
|
+
export const getLocation: () => Promise<Location>
|
|
74
|
+
export const getDistance: (p1: [number, number], p2: [number, number]) => Promise<any>
|
|
15
75
|
export const spuAxios: any
|
|
16
76
|
// export const spuAxios: AxiosInstance
|
|
17
|
-
// export const spuAxios: IAny
|
|
18
77
|
export const apaasAxios: any
|
|
19
|
-
export const downloadService:
|
|
20
|
-
export const uploadService:
|
|
21
|
-
|
|
78
|
+
export const downloadService: IDownloadService
|
|
79
|
+
export const uploadService: IUploadService
|
|
80
|
+
export const getUniqueid: () => string
|
|
81
|
+
export const uuid: () => string
|
|
82
|
+
export const AMapLoader: IAMapLoader
|
|
83
|
+
export const getToken: () => string
|
|
84
|
+
export const getTokenExpires: () => string
|
|
85
|
+
export const getRefreshToken: () => string
|
|
86
|
+
export const getUser: (key?: string) => any
|
|
87
|
+
export const checkLogin: () => boolean
|
|
22
88
|
|
|
23
89
|
interface ISPUWebPlugin {
|
|
24
|
-
install (app: App, option:
|
|
90
|
+
install (app: App, option: ISPUWebPluginOptions): void
|
|
25
91
|
// install: any
|
|
26
92
|
version: string
|
|
27
93
|
}
|
package/src/utils.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
const isIOS = () => {
|
|
2
|
+
const ua = navigator.userAgent
|
|
3
|
+
return /(iPhone|iPad|iPod|IOS)/i.test(ua)
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
// 是否企微软件内 包括电脑端和APP端
|
|
2
7
|
const isInWxwork = () => {
|
|
3
8
|
return navigator.userAgent.indexOf('wxwork') >= 0
|
|
@@ -13,8 +18,19 @@ const isInAppWxwork = () => {
|
|
|
13
18
|
return isInWxwork() && navigator.userAgent.indexOf('Mobile') >= 0
|
|
14
19
|
}
|
|
15
20
|
|
|
21
|
+
// 生成唯一id
|
|
22
|
+
const getUniqueid = () => {
|
|
23
|
+
const random = Math.ceil(Math.random() * 100000)
|
|
24
|
+
// TODO:生成的id不能以0开头,在数据库存储转换长整型会被消除,导致唯一编码错误存储
|
|
25
|
+
// TODO: 不能与服务端返回的idarray在未来产生重叠,用9开头(应该够用许多年了?)
|
|
26
|
+
return `9${Date.now()}${random}`
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
16
30
|
export {
|
|
31
|
+
isIOS,
|
|
17
32
|
isInWxwork,
|
|
18
33
|
isInPcWxwork,
|
|
19
|
-
isInAppWxwork
|
|
34
|
+
isInAppWxwork,
|
|
35
|
+
getUniqueid
|
|
20
36
|
}
|