@cpzxrobot/sdk 1.1.41 → 1.1.42

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.js CHANGED
@@ -127,6 +127,8 @@ class Cpzxrobot {
127
127
  // @ts-ignore
128
128
  this.vibrate = window.miniapp.vibrate;
129
129
  this.saveBlob = this._saveBlobAsBase64;
130
+ // @ts-ignore
131
+ this.getGeo = window.miniapp.getGeo;
130
132
  }
131
133
  else if (domain == "appassets.androidplatform.net" ||
132
134
  this.isIosMiniApp(window.location)) {
@@ -146,6 +148,16 @@ class Cpzxrobot {
146
148
  this.scanQrcode = function () {
147
149
  return platform.callHandler("app.scanQrcode");
148
150
  };
151
+ this.getGeo = function () {
152
+ var result = platform.callHandler("app.getGeo");
153
+ if (result.error) {
154
+ throw result.error;
155
+ }
156
+ return {
157
+ lat: result.lat,
158
+ lng: result.lng
159
+ };
160
+ };
149
161
  this.setTitle = function (title) {
150
162
  platform.callHandler("app.setTitle", title);
151
163
  };
package/index.ts CHANGED
@@ -46,6 +46,10 @@ export class Cpzxrobot {
46
46
  saveBlob!: (blob: Blob, filename: string) => void;
47
47
  scanQrcode!: () => Promise<string>;
48
48
  vibrate!: (time?: number) => void;
49
+ getGeo!: () => {
50
+ lat: number;
51
+ lng: number;
52
+ };
49
53
  assistant: AssistantGateway;
50
54
  energy: EnergyGateway;
51
55
  camera: CameraGateway;
@@ -58,6 +62,7 @@ export class Cpzxrobot {
58
62
  company: CompanyGateway = new CompanyGateway(this);
59
63
  news: NewsGateway = new NewsGateway(this);
60
64
 
65
+
61
66
  constructor(appCode: string) {
62
67
  //获取当前浏览器的域名
63
68
  this.ready = new Promise<MyAxiosInstance>((resolve, reject) => {
@@ -156,6 +161,8 @@ export class Cpzxrobot {
156
161
  // @ts-ignore
157
162
  this.vibrate = window.miniapp.vibrate;
158
163
  this.saveBlob = this._saveBlobAsBase64;
164
+ // @ts-ignore
165
+ this.getGeo = window.miniapp.getGeo;
159
166
  } else if (
160
167
  domain == "appassets.androidplatform.net" ||
161
168
  this.isIosMiniApp(window.location)
@@ -178,6 +185,16 @@ export class Cpzxrobot {
178
185
  this.scanQrcode = function () {
179
186
  return platform.callHandler("app.scanQrcode");
180
187
  }
188
+ this.getGeo = function () {
189
+ var result = platform.callHandler("app.getGeo");
190
+ if (result.error) {
191
+ throw result.error;
192
+ }
193
+ return {
194
+ lat: result.lat,
195
+ lng: result.lng
196
+ }
197
+ };
181
198
  this.setTitle = function (title: string) {
182
199
  platform.callHandler("app.setTitle", title);
183
200
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.1.41",
3
+ "version": "1.1.42",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -206,6 +206,7 @@ baseURL: "/"
206
206
  | cpzxrobot().news.list | 获得新闻列表,传入必要的分页参数 |
207
207
  | cpzxrobot().news.alarm.add | 添加报警信息 |
208
208
  | cpzxrobot().news.alarm.list | 获得报警列表,传入必要的分页参数 |
209
+ | cpzxrobot().getGeo | 获得地理位置信息 |
209
210
 
210
211
  ### 工厂信息接口
211
212