@smart100/spu-web-plugin 1.0.16 → 1.0.17

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 CHANGED
@@ -123,7 +123,7 @@ export const getServToken: () => Promise<{
123
123
  securitytoken: string
124
124
  expiration: string
125
125
  }>
126
- export const getCloudServ: () => any
126
+ export const getCloudServ: (type?: StorageType) => any
127
127
  export const getUniqueid: () => string
128
128
  export const getUuid: () => string
129
129
  export const functionCheck: (functioncode?: string) => boolean
@@ -1,4 +1,4 @@
1
- var version = "1.0.16";
1
+ var version = "1.0.17";
2
2
 
3
3
  /** Detect free variable `global` from Node.js. */
4
4
  var freeGlobal$2 = typeof global == 'object' && global && global.Object === Object && global;
@@ -18066,66 +18066,67 @@ var getLocationPromise = /*#__PURE__*/function () {
18066
18066
  location = _context17.sent;
18067
18067
  case 6:
18068
18068
  if (location) {
18069
- _context17.next = 10;
18070
- break;
18071
- }
18072
- _context17.next = 9;
18073
- return getLocationByNavigator();
18074
- case 9:
18075
- location = _context17.sent;
18076
- case 10:
18077
- if (location) {
18078
- _context17.next = 35;
18069
+ _context17.next = 31;
18079
18070
  break;
18080
18071
  }
18081
18072
  if (!(mapService.type === 'amap')) {
18082
- _context17.next = 21;
18073
+ _context17.next = 17;
18083
18074
  break;
18084
18075
  }
18085
- _context17.next = 14;
18076
+ _context17.next = 10;
18086
18077
  return getLocationByAMap();
18087
- case 14:
18078
+ case 10:
18088
18079
  location = _context17.sent;
18089
18080
  if (!(!location && isuseiplocarion)) {
18090
- _context17.next = 19;
18081
+ _context17.next = 15;
18091
18082
  break;
18092
18083
  }
18093
- _context17.next = 18;
18084
+ _context17.next = 14;
18094
18085
  return getCityLocationByAMap();
18095
- case 18:
18086
+ case 14:
18096
18087
  location = _context17.sent;
18097
- case 19:
18098
- _context17.next = 35;
18088
+ case 15:
18089
+ _context17.next = 31;
18099
18090
  break;
18100
- case 21:
18091
+ case 17:
18101
18092
  if (!(mapService.type === 'tencent' && isuseiplocarion)) {
18102
- _context17.next = 27;
18093
+ _context17.next = 23;
18103
18094
  break;
18104
18095
  }
18105
- _context17.next = 24;
18096
+ _context17.next = 20;
18106
18097
  return getIPLocationByTMap();
18107
- case 24:
18098
+ case 20:
18108
18099
  location = _context17.sent;
18109
- _context17.next = 35;
18100
+ _context17.next = 31;
18110
18101
  break;
18111
- case 27:
18102
+ case 23:
18112
18103
  if (!(mapService.type === 'baidu')) {
18113
- _context17.next = 35;
18104
+ _context17.next = 31;
18114
18105
  break;
18115
18106
  }
18116
- _context17.next = 30;
18107
+ _context17.next = 26;
18117
18108
  return getLocationByBMap();
18118
- case 30:
18109
+ case 26:
18119
18110
  location = _context17.sent;
18120
18111
  if (!(!location && isuseiplocarion)) {
18112
+ _context17.next = 31;
18113
+ break;
18114
+ }
18115
+ _context17.next = 30;
18116
+ return getCityLocationByBMap();
18117
+ case 30:
18118
+ location = _context17.sent;
18119
+ case 31:
18120
+ if (location) {
18121
18121
  _context17.next = 35;
18122
18122
  break;
18123
18123
  }
18124
18124
  _context17.next = 34;
18125
- return getCityLocationByBMap();
18125
+ return getLocationByNavigator();
18126
18126
  case 34:
18127
18127
  location = _context17.sent;
18128
18128
  case 35:
18129
+ // location = null
18129
18130
  // 开发模式下为了方便测试提供虚拟定位
18130
18131
  if (!location && urlquery.isvirtuallocation) {
18131
18132
  location = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smart100/spu-web-plugin",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "dev": "npm run build:types && rollup -c -w",
package/src/map/index.ts CHANGED
@@ -95,20 +95,19 @@ const getLocationByNavigator = async (): Promise<Location> => {
95
95
  }
96
96
 
97
97
  // ipaas ip 定位
98
- const getIPLocationByIpaas = async (
99
- ip?: string
100
- ): Promise<Location> => {
98
+ const getIPLocationByIpaas = async (ip?: string): Promise<Location> => {
101
99
  console.log('getIPLocationByIpaas start...')
102
100
  return new Promise((resolve, reject) => {
103
101
  const AMapKey = getAMapKey()
104
102
 
105
- axios.post(
106
- 'https://silkroad.wxchina.com/api/openapi/publishEvent?topic=xw-listener&subtopic=xw-listener&apicaseid=6684389338001815271',
107
- {
108
- key: AMapKey.key, // 好像不传也没问题 因为key是在ipaas那边设置的
109
- ip: ip || ''
110
- }
111
- )
103
+ axios
104
+ .post(
105
+ 'https://silkroad.wxchina.com/api/openapi/publishEvent?topic=xw-listener&subtopic=xw-listener&apicaseid=6684389338001815271',
106
+ {
107
+ key: AMapKey.key, // 好像不传也没问题 因为key是在ipaas那边设置的
108
+ ip: ip || ''
109
+ }
110
+ )
112
111
  .then((res: any) => {
113
112
  // console.log(res)
114
113
  // debugger
@@ -134,7 +133,8 @@ const getIPLocationByIpaas = async (
134
133
  console.error('getIPLocationByIpaas fail')
135
134
  resolve(null)
136
135
  }
137
- }).catch((err: any) => {
136
+ })
137
+ .catch((err: any) => {
138
138
  console.error(err)
139
139
  console.error('getIPLocationByIpaas fail')
140
140
  resolve(null)
@@ -150,12 +150,15 @@ const getAddressByIpaas = async (position: Location): Promise<string> => {
150
150
  if (position) {
151
151
  try {
152
152
  const AMapKey = getAMapKey()
153
- const result = await axios.post('https://silkroad.wxchina.com/api/openapi/publishEvent?topic=xw-listener&subtopic=xw-listener&apicaseid=6684389338001809906', {
154
- longitude: position.longitude,
155
- latitude: position.latitude,
156
- key: AMapKey.key
157
- // extensions: 'all'
158
- })
153
+ const result = await axios.post(
154
+ 'https://silkroad.wxchina.com/api/openapi/publishEvent?topic=xw-listener&subtopic=xw-listener&apicaseid=6684389338001809906',
155
+ {
156
+ longitude: position.longitude,
157
+ latitude: position.latitude,
158
+ key: AMapKey.key
159
+ // extensions: 'all'
160
+ }
161
+ )
159
162
  // console.log(result)
160
163
  const address = result?.data?.formatted_address
161
164
  if (address) {
@@ -484,11 +487,6 @@ const getLocationPromise = async (isuseiplocarion = false): Promise<Location> =>
484
487
  location = await getLocationByNative()
485
488
  }
486
489
 
487
- if (!location) {
488
- location = await getLocationByNavigator()
489
- }
490
- // location = null
491
-
492
490
  if (!location) {
493
491
  if (mapService.type === 'amap') {
494
492
  location = await getLocationByAMap()
@@ -509,6 +507,11 @@ const getLocationPromise = async (isuseiplocarion = false): Promise<Location> =>
509
507
  }
510
508
  }
511
509
 
510
+ if (!location) {
511
+ location = await getLocationByNavigator()
512
+ }
513
+ // location = null
514
+
512
515
  // 开发模式下为了方便测试提供虚拟定位
513
516
  if (!location && urlquery.isvirtuallocation) {
514
517
  location = {
@@ -123,7 +123,7 @@ export const getServToken: () => Promise<{
123
123
  securitytoken: string
124
124
  expiration: string
125
125
  }>
126
- export const getCloudServ: () => any
126
+ export const getCloudServ: (type?: StorageType) => any
127
127
  export const getUniqueid: () => string
128
128
  export const getUuid: () => string
129
129
  export const functionCheck: (functioncode?: string) => boolean