@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/package.json CHANGED
@@ -1,19 +1,18 @@
1
1
  {
2
2
  "name": "@smart100/spu-web-plugin",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "dev": "rollup -c -w",
7
- "build": "rollup -c",
8
- "build1": "rollup -c --environment NODE_ENV:production",
9
- "test": "echo \"Error: no test specified\" && exit 1"
7
+ "build": "rollup -c && npm run build:types",
8
+ "build:types": "node script/build-types.js"
10
9
  },
11
10
  "author": "tarymee",
12
11
  "type": "module",
13
- "browser": "dist/spu-web-plugin.umd.js",
14
- "main": "dist/spu-web-plugin.cjs",
12
+ "browser1": "dist/spu-web-plugin.umd.js",
13
+ "main1": "dist/spu-web-plugin.cjs",
15
14
  "module": "dist/spu-web-plugin.mjs",
16
- "types": "src/types/index.d.ts",
15
+ "types": "dist/index.d.ts",
17
16
  "files": [
18
17
  "dist",
19
18
  "src"
package/src/index.ts CHANGED
@@ -4,6 +4,10 @@ import { lsProxy, ssProxy } from './storageProxy'
4
4
  import { getLocation, getDistance } from './location'
5
5
  import { spuAxios, apaasAxios } from './axios'
6
6
  import { downloadService, uploadService } from './oss'
7
+ import { getUniqueid } from './utils'
8
+ import AMapLoader from './AMapLoader'
9
+ import login from './login'
10
+ import { v4 as uuid } from 'uuid'
7
11
  // import { downloadService } from './oss'
8
12
 
9
13
  // class SPUWebPlugin {
@@ -18,6 +22,14 @@ const SPUWebPlugin = {
18
22
  version
19
23
  }
20
24
 
25
+
26
+ const getToken = login.getToken.bind(login)
27
+ const getTokenExpires = login.getTokenExpires.bind(login)
28
+ const getRefreshToken = login.getRefreshToken.bind(login)
29
+ const getUser = login.getUser.bind(login)
30
+ const checkLogin = login.checkLogin.bind(login)
31
+
32
+
21
33
  export {
22
34
  SPUWebPlugin as default,
23
35
  lsProxy,
@@ -27,5 +39,13 @@ export {
27
39
  spuAxios,
28
40
  apaasAxios,
29
41
  downloadService,
30
- uploadService
42
+ uploadService,
43
+ getUniqueid,
44
+ uuid,
45
+ AMapLoader,
46
+ getToken,
47
+ getTokenExpires,
48
+ getRefreshToken,
49
+ getUser,
50
+ checkLogin
31
51
  }
package/src/location.ts CHANGED
@@ -181,6 +181,25 @@ const getDistance = async (p1: [number, number], p2: [number, number]) => {
181
181
  return AMap.GeometryUtil.distance(p1, p2)
182
182
  }
183
183
 
184
+
185
+ // // 两个经纬度距离计算
186
+ // function getDistance (latlng1, latlng2) {
187
+ // console.log(latlng1)
188
+ // console.log(latlng2)
189
+ // const lng1 = Number(latlng1[0])
190
+ // const lat1 = Number(latlng1[1])
191
+ // const lng2 = Number(latlng2[0])
192
+ // const lat2 = Number(latlng2[1])
193
+ // const radLat1 = (lat1 * Math.PI) / 180.0
194
+ // const radLat2 = (lat2 * Math.PI) / 180.0
195
+ // const a = radLat1 - radLat2
196
+ // const b = (lng1 * Math.PI) / 180.0 - (lng2 * Math.PI) / 180.0
197
+ // let s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)))
198
+ // s = s * 6378.137 // EARTH_RADIUS
199
+ // s = Math.round(s * 10000) / 10000
200
+ // return s * 1000
201
+ // }
202
+
184
203
  export {
185
204
  getLocation,
186
205
  getDistance
@@ -60,6 +60,15 @@ const getContentType = (suffix: string) => {
60
60
 
61
61
 
62
62
  type Cope = { width?: number, height?: number } | string | boolean
63
+ interface IDownload {
64
+ type?: 'att' | 'img',
65
+ source: string,
66
+ datetime: string | number,
67
+ storagetype?: StorageType,
68
+ cope?: Cope
69
+ }
70
+
71
+
63
72
 
64
73
  const getNormalizeAliOssCope = (cope?: Cope) => {
65
74
  let copeObj = ''
@@ -83,13 +92,7 @@ const getNormalizeAliOssCope = (cope?: Cope) => {
83
92
  }
84
93
 
85
94
 
86
- interface IDownload {
87
- type?: 'att' | 'img',
88
- source: string,
89
- datetime: string | number,
90
- storagetype?: StorageType,
91
- cope?: Cope
92
- }
95
+
93
96
 
94
97
  // 根据文件信息最后生成一个云文件服务可以用的链接http://xxxxx.xxx.jpg
95
98
  const getUrl = async ({