@smart100/spu-web-plugin 0.0.29 → 0.0.30

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@smart100/spu-web-plugin",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "dev": "npm run build:types && rollup -c -w",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@amap/amap-jsapi-loader": "^1.0.1",
41
- "@smart100/wxworksuite-plugin": "^0.0.8",
41
+ "@smart100/wxworksuite-plugin": "^0.0.9",
42
42
  "axios": "^1.6.0",
43
43
  "co": "^4.6.0",
44
44
  "dayjs": "^1.11.10",
package/src/index.ts CHANGED
@@ -9,7 +9,7 @@ import { initAxios, spuAxios, axios } from './axios'
9
9
  import { initSpuConfig, spuConfig } from './spuConfig'
10
10
  import { globalConfig } from './globalConfig'
11
11
  import { downloadService, uploadService } from './oss'
12
- import { getUniqueid, functionCheck } from './utils'
12
+ import { getUniqueid, functionCheck, setTitle } from './utils'
13
13
  import urlquery from './urlquery'
14
14
  import AMapLoader from './AMapLoader'
15
15
  import login from './login'
@@ -39,6 +39,9 @@ const globalOptions: any = {
39
39
  }
40
40
 
41
41
  const install = (app: any, options: any) => {
42
+
43
+ urlquery.init()
44
+
42
45
  // console.log(app)
43
46
  // console.log(app.version)
44
47
  merge(globalOptions, options)
@@ -62,10 +65,8 @@ const install = (app: any, options: any) => {
62
65
  // }
63
66
 
64
67
  initStorageProxy(globalOptions)
65
-
66
68
  initAxios(globalOptions)
67
69
  initSpuConfig(globalOptions)
68
- urlquery.init()
69
70
 
70
71
  // 安装企微第三方应用插件
71
72
  WxworksuitePluginInstall({
@@ -162,6 +163,7 @@ export {
162
163
  getUniqueid,
163
164
  getUuid,
164
165
  functionCheck,
166
+ setTitle,
165
167
  AMapLoader,
166
168
  getToken,
167
169
  getTokenExpires,
package/src/location.ts CHANGED
@@ -2,7 +2,6 @@ import AMapLoader from './AMapLoader'
2
2
  import { cloneDeep } from 'lodash-es'
3
3
  import urlquery from './urlquery'
4
4
 
5
-
6
5
  type Location = {
7
6
  longitude: string;
8
7
  latitude: string;
@@ -18,7 +17,6 @@ let lastLocation: Location = null
18
17
  let runing = false
19
18
  let locationPromise: Promise<Location>
20
19
 
21
-
22
20
  const init = async () => {
23
21
  if (!AMap) {
24
22
  AMap = await AMapLoader.load({
@@ -58,7 +56,15 @@ const getAmapLocation = async (): Promise<Location> => {
58
56
 
59
57
  const getSpuLocation = async (): Promise<Location> => {
60
58
  return new Promise((resolve, reject) => {
59
+ let isload = false
60
+ setTimeout(() => {
61
+ if (!isload) {
62
+ console.error('getSpuLocation timeout 100000')
63
+ resolve(null)
64
+ }
65
+ }, 10000)
61
66
  window.Native.getLocation((result: any, error: any, status: any) => {
67
+ isload = true
62
68
  // console.log('getLocation result', result)
63
69
  // console.log('getLocation error', error)
64
70
  // console.log('getLocation status', status)
@@ -154,7 +160,6 @@ const getLocationPromise = async (): Promise<Location> => {
154
160
 
155
161
 
156
162
  const getLocation = async () => {
157
- await init()
158
163
  // debugger
159
164
  // 缓存30秒
160
165
  if (datetime && Date.now() - datetime <= 30000 && lastLocation && !runing) {