@smart100/spu-web-plugin 0.0.23 → 0.0.25

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.
@@ -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 './axios'
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: SPUWebPluginOptions) {
88
+ function initSpuConfig (options: any) {
89
89
  modulekey = options.modulekey
90
90
  }
91
91
 
@@ -1,5 +1,3 @@
1
- // import { globalOptions } from './install'
2
-
3
1
  let STORAGENAMESPACE = ''
4
2
 
5
3
  class StorageProxy {
@@ -38,8 +36,8 @@ class StorageProxy {
38
36
  const lsProxy: StorageProxy = new StorageProxy('local')
39
37
  const ssProxy: StorageProxy = new StorageProxy('session')
40
38
 
41
- function initStorageProxy (options: SPUWebPluginOptions) {
42
- STORAGENAMESPACE = options.modulekey
39
+ function initStorageProxy (options: any) {
40
+ STORAGENAMESPACE = options.storageproxyprefix || options.modulekey
43
41
  }
44
42
 
45
43
  export {
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
- async function initTest (options: SPUWebPluginOptions) {
7
+
8
+ async function initTest (options: any) {
7
9
  // console.log('initTest')
8
10
  // loadding.open()
9
11
 
@@ -2,13 +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
- router?: any;
10
- }
11
-
12
5
  type StorageType = 'storage' | 'storage-1d' | 'storage-3m' | 'storage-1y'
13
6
 
14
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
@@ -8,6 +8,7 @@ declare module 'co'
8
8
  declare module 'uuid'
9
9
 
10
10
 
11
+ declare module '*.js'
11
12
  declare module '*.svg'
12
13
  declare module '*.png'
13
14
  declare module '*.jpg'
package/src/utils.ts CHANGED
@@ -1,25 +1,10 @@
1
- import login from './login'
1
+ import { getUser } from './index'
2
2
 
3
3
  const isIOS = () => {
4
4
  const ua = navigator.userAgent
5
5
  return /(iPhone|iPad|iPod|IOS)/i.test(ua)
6
6
  }
7
7
 
8
- // 是否企微软件内 包括电脑端和APP端
9
- const isWxwork = () => {
10
- return navigator.userAgent.indexOf('wxwork') >= 0
11
- }
12
-
13
- // 是否在电脑端企微软件内
14
- const isWxworkPc = () => {
15
- return isWxwork() && navigator.userAgent.indexOf('Mobile') === -1
16
- }
17
-
18
- // 是否在企微APP内
19
- const isWxworkApp = () => {
20
- return isWxwork() && navigator.userAgent.indexOf('Mobile') >= 0
21
- }
22
-
23
8
  // 生成唯一id
24
9
  const getUniqueid = () => {
25
10
  const random = Math.ceil(Math.random() * 100000)
@@ -31,7 +16,7 @@ const getUniqueid = () => {
31
16
 
32
17
  const functionCheck = (functioncode?: string): boolean => {
33
18
  if (!functioncode) return false
34
- const functioncodes = login.getUser('functioncodes') || []
19
+ const functioncodes = getUser('functioncodes') || []
35
20
  // console.log(functioncodes)
36
21
  // debugger
37
22
  const check = functioncodes.includes(functioncode)
@@ -40,9 +25,6 @@ const functionCheck = (functioncode?: string): boolean => {
40
25
 
41
26
  export {
42
27
  isIOS,
43
- isWxwork,
44
- isWxworkPc,
45
- isWxworkApp,
46
28
  getUniqueid,
47
29
  functionCheck
48
30
  }
package/src/install.ts DELETED
@@ -1,79 +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
- router: null
16
- }
17
-
18
- const install = (app: any, options: SPUWebPluginOptions) => {
19
- // console.log(app)
20
- // console.log(app.version)
21
- merge(globalOptions, options)
22
- console.log('@smart100/spu-web-plugin start!')
23
- console.log('options', options)
24
- console.log('globalOptions', globalOptions)
25
-
26
- // if (install.installed) return
27
- // install.installed = true
28
- // debugger
29
-
30
- // if (app) {
31
- // const version = Number(app.version.split('.')[0])
32
- // if (version < 3) {
33
- // console.error('This plugin requires Vue 3')
34
- // return false
35
- // }
36
- // } else {
37
- // console.error('This plugin requires Vue App Instance')
38
- // }
39
-
40
- initStorageProxy(globalOptions)
41
- initAxios(globalOptions)
42
- initSpuConfig(globalOptions)
43
- initApaasSpuTrack()
44
- urlquery.init()
45
- login.startRefreshtoken()
46
- // 安装企微第三方应用插件
47
- WxworksuitePluginInstall({
48
- getToken: login.getToken.bind(login)
49
- })
50
- initTest(globalOptions)
51
-
52
- if (globalOptions.router) {
53
- globalOptions.router.beforeEach(async (to: any, from: any, next: any) => {
54
- // console.log(from)
55
- // console.log(to)
56
- // const isInitVisit = from.path === '/' && from.name === undefined // 路由初始化访问
57
- // console.log('isInitVisit', isInitVisit)
58
-
59
- // 自动登录
60
- if (to.query.token) {
61
- const singleLoginRes = await login.singleLogin(to.query)
62
- next({
63
- path: to.path,
64
- params: to.params,
65
- query: singleLoginRes.query
66
- })
67
- } else {
68
- next()
69
- }
70
- })
71
- } else {
72
- console.error('@smart100/spu-web-plugin require a vue-router instance.')
73
- }
74
- }
75
-
76
- export {
77
- install,
78
- globalOptions
79
- }