@tmsfe/tms-core 0.0.109 → 0.0.111

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": "@tmsfe/tms-core",
3
- "version": "0.0.109",
3
+ "version": "0.0.111",
4
4
  "description": "tms运行时框架",
5
5
  "repository": {
6
6
  "type": "git",
@@ -55,19 +55,19 @@ let ipLocationPromise: null | Promise<IpLocationType> = null; // ip定位请求
55
55
  */
56
56
  class Location extends LocationBase {
57
57
  /**
58
- * @desc 默认位置信息
59
- * @property {object} locForNoAuth 默认的位置信息
60
- * @property {string} locForNoAuth.privince 省份信息
61
- * @property {string} locForNoAuth.cityCode 城市编码
62
- * @property {string} locForNoAuth.cityName 城市名称
63
- * @property {string} locForNoAuth.district 地区名称
64
- * @property {string} locForNoAuth.latitude 维度
65
- * @property {string} locForNoAuth.longitude 经度
66
- * @example
67
- * const app = getApp({ allowDefault: true });
68
- * const locationManager = app.tms.getLocationManager(); // 获取位置管理器
69
- * console.log(locationManager.locForNoAuth) // 获取默认位置
70
- */
58
+ * @desc 默认位置信息
59
+ * @property {object} locForNoAuth 默认的位置信息
60
+ * @property {string} locForNoAuth.privince 省份信息
61
+ * @property {string} locForNoAuth.cityCode 城市编码
62
+ * @property {string} locForNoAuth.cityName 城市名称
63
+ * @property {string} locForNoAuth.district 地区名称
64
+ * @property {string} locForNoAuth.latitude 维度
65
+ * @property {string} locForNoAuth.longitude 经度
66
+ * @example
67
+ * const app = getApp({ allowDefault: true });
68
+ * const locationManager = app.tms.getLocationManager(); // 获取位置管理器
69
+ * console.log(locationManager.locForNoAuth) // 获取默认位置
70
+ */
71
71
  public locForNoAuth = {
72
72
  province: '广东省',
73
73
  cityCode: '440300',
@@ -133,7 +133,7 @@ class Location extends LocationBase {
133
133
 
134
134
  return Promise.reject(res);
135
135
  })
136
- .catch(err => Promise.reject(err));
136
+ .catch(err => Promise.reject(err));
137
137
 
138
138
  return userLocationCache[cacheName];
139
139
  }
@@ -175,8 +175,13 @@ class Location extends LocationBase {
175
175
  */
176
176
  getLocationDetail(showModalWhenCloseAuth = false, type = LocationType, content = '', getPoi = 0) {
177
177
  return this.getLocation(showModalWhenCloseAuth, type, content)
178
- .then((res: WxPostionType) => this.getPoiInfo(res.latitude, res.longitude, getPoi))
179
- .catch(err => Promise.reject(err));
178
+ .then(async (res: WxPostionType) => {
179
+ const res2 = await this.getPoiInfo(res.latitude, res.longitude, getPoi);
180
+ // @ts-ignore
181
+ res2.accuracy = res.accuracy;
182
+ return res2;
183
+ })
184
+ .catch(err => Promise.reject(err));
180
185
  }
181
186
 
182
187
  /**
@@ -211,8 +216,13 @@ class Location extends LocationBase {
211
216
  */
212
217
  getLocationDetailSilent(getPoi = 0, type = 'gcj02') {
213
218
  return this.getLocationSilent(type)
214
- .then((res: any) => this.getPoiInfo(res.latitude, res.longitude, getPoi))
215
- .catch(err => Promise.reject(err));
219
+ .then(async (res: WxPostionType) => {
220
+ const res2 = await this.getPoiInfo(res.latitude, res.longitude, getPoi);
221
+ // @ts-ignore
222
+ res2.accuracy = res.accuracy;
223
+ return res2;
224
+ })
225
+ .catch(err => Promise.reject(err));
216
226
  }
217
227
 
218
228
  /**
@@ -229,7 +239,7 @@ class Location extends LocationBase {
229
239
  * longitude: 116.2545454,
230
240
  * adCode: 1212144,
231
241
  * }
232
- */
242
+ */
233
243
  getUserLocation(): PostionType | undefined {
234
244
  return userLocation;
235
245
  }
@@ -327,18 +337,18 @@ class Location extends LocationBase {
327
337
  if (ipLocationPromise === null || force) {
328
338
  ipLocationPromise = new Promise((resolve, reject) => {
329
339
  request.post('basic/lbs/decodeip')
330
- .then((res) => {
331
- if (res.errCode === 0) {
332
- resolve(res.resData as IpLocationType);
333
- return;
334
- }
335
- reject({ erMsg: res.errMsg });
336
- ipLocationPromise = null;
337
- })
338
- .catch((e) => {
339
- reject(e);
340
- ipLocationPromise = null;
341
- });
340
+ .then((res) => {
341
+ if (res.errCode === 0) {
342
+ resolve(res.resData as IpLocationType);
343
+ return;
344
+ }
345
+ reject({ erMsg: res.errMsg });
346
+ ipLocationPromise = null;
347
+ })
348
+ .catch((e) => {
349
+ reject(e);
350
+ ipLocationPromise = null;
351
+ });
342
352
  });
343
353
  }
344
354
  return ipLocationPromise;