@cpzxrobot/sdk 1.0.73 → 1.0.74
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 +7 -5
- package/index.ts +9 -7
- package/package.json +1 -1
- package/readme.md +1 -0
package/dist/index.js
CHANGED
|
@@ -93,11 +93,13 @@ class Cpzxrobot {
|
|
|
93
93
|
// @ts-ignore
|
|
94
94
|
this._jumpToMiniApp = window.miniapp.open;
|
|
95
95
|
// @ts-ignore
|
|
96
|
-
this.
|
|
96
|
+
this.scanQrcode = window.miniapp.scanQrcode;
|
|
97
97
|
// @ts-ignore
|
|
98
98
|
this.setTitle = window.miniapp.setTitle;
|
|
99
99
|
// @ts-ignore
|
|
100
100
|
this.saveBase64 = window.miniapp.saveBase64;
|
|
101
|
+
// @ts-ignore
|
|
102
|
+
this.vibrate = window.miniapp.vibrate;
|
|
101
103
|
this.saveBlob = this._saveBlobAsBase64;
|
|
102
104
|
}
|
|
103
105
|
else if (domain == "appassets.androidplatform.net" ||
|
|
@@ -115,7 +117,7 @@ class Cpzxrobot {
|
|
|
115
117
|
this._jumpToMiniApp = function (url) {
|
|
116
118
|
return platform.callHandler("app.openMiniapp", url);
|
|
117
119
|
};
|
|
118
|
-
this.
|
|
120
|
+
this.scanQrcode = function () {
|
|
119
121
|
return platform.callHandler("app.scanQrcode");
|
|
120
122
|
};
|
|
121
123
|
this.setTitle = function (title) {
|
|
@@ -125,6 +127,9 @@ class Cpzxrobot {
|
|
|
125
127
|
this.saveBase64 = function (base64, filename) {
|
|
126
128
|
return platform.callHandler("app.saveBase64", base64, filename);
|
|
127
129
|
};
|
|
130
|
+
this.vibrate = function (time) {
|
|
131
|
+
return platform.callHandler("app.vibrate", time);
|
|
132
|
+
};
|
|
128
133
|
this.axios = {
|
|
129
134
|
get: function (url, data) {
|
|
130
135
|
console.log(url, data);
|
|
@@ -210,9 +215,6 @@ class Cpzxrobot {
|
|
|
210
215
|
dict(dictName) {
|
|
211
216
|
return this.axios.get(`/api/v1/dict/${dictName}`);
|
|
212
217
|
}
|
|
213
|
-
scanQrcode() {
|
|
214
|
-
return this._scanQrcode();
|
|
215
|
-
}
|
|
216
218
|
//打开其他小程序
|
|
217
219
|
openMiniApp(url) {
|
|
218
220
|
this._jumpToMiniApp(url);
|
package/index.ts
CHANGED
|
@@ -32,10 +32,11 @@ export class Cpzxrobot {
|
|
|
32
32
|
_getSelectedFarmFromMiniApp!: () => any;
|
|
33
33
|
_getSelectedUnitFromMiniApp!: () => any;
|
|
34
34
|
_jumpToMiniApp!: (url: string) => any;
|
|
35
|
-
|
|
35
|
+
scanQrcode!:() => Promise<string>;
|
|
36
36
|
setTitle!: (title: string) => void;
|
|
37
37
|
saveBase64!: (base64: string, filename: string) => void;
|
|
38
38
|
saveBlob!: (blob: Blob, filename: string) => void;
|
|
39
|
+
vibrate!: (time?: number) => void;
|
|
39
40
|
assistant: AssistantGateway;
|
|
40
41
|
energy: EnergyGateway;
|
|
41
42
|
camera: CameraGateway;
|
|
@@ -121,11 +122,13 @@ export class Cpzxrobot {
|
|
|
121
122
|
// @ts-ignore
|
|
122
123
|
this._jumpToMiniApp = window.miniapp.open;
|
|
123
124
|
// @ts-ignore
|
|
124
|
-
this.
|
|
125
|
+
this.scanQrcode = window.miniapp.scanQrcode;
|
|
125
126
|
// @ts-ignore
|
|
126
127
|
this.setTitle = window.miniapp.setTitle;
|
|
127
128
|
// @ts-ignore
|
|
128
129
|
this.saveBase64 = window.miniapp.saveBase64;
|
|
130
|
+
// @ts-ignore
|
|
131
|
+
this.vibrate = window.miniapp.vibrate;
|
|
129
132
|
this.saveBlob = this._saveBlobAsBase64;
|
|
130
133
|
} else if (
|
|
131
134
|
domain == "appassets.androidplatform.net" ||
|
|
@@ -146,7 +149,7 @@ export class Cpzxrobot {
|
|
|
146
149
|
this._jumpToMiniApp = function (url: string) {
|
|
147
150
|
return platform.callHandler("app.openMiniapp", url);
|
|
148
151
|
};
|
|
149
|
-
this.
|
|
152
|
+
this.scanQrcode = function(){
|
|
150
153
|
return platform.callHandler("app.scanQrcode");
|
|
151
154
|
}
|
|
152
155
|
this.setTitle = function (title: string) {
|
|
@@ -156,6 +159,9 @@ export class Cpzxrobot {
|
|
|
156
159
|
this.saveBase64 = function (base64: string, filename: string) {
|
|
157
160
|
return platform.callHandler("app.saveBase64", base64, filename);
|
|
158
161
|
};
|
|
162
|
+
this.vibrate = function (time?: number) {
|
|
163
|
+
return platform.callHandler("app.vibrate", time);
|
|
164
|
+
};
|
|
159
165
|
this.axios = {
|
|
160
166
|
get: function (url, data) {
|
|
161
167
|
console.log(url, data);
|
|
@@ -247,10 +253,6 @@ export class Cpzxrobot {
|
|
|
247
253
|
return this.axios.get(`/api/v1/dict/${dictName}`);
|
|
248
254
|
}
|
|
249
255
|
|
|
250
|
-
scanQrcode(){
|
|
251
|
-
return this._scanQrcode();
|
|
252
|
-
}
|
|
253
|
-
|
|
254
256
|
//打开其他小程序
|
|
255
257
|
openMiniApp(url: string) {
|
|
256
258
|
this._jumpToMiniApp(url);
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -104,6 +104,7 @@ baseURL: "/"
|
|
|
104
104
|
| cpzxrobot().pigfarm.heatlamp.iotFields | 获取保温灯用于获取iot的字段列表 |
|
|
105
105
|
| cpzxrobot().pigfarm.threshold | 获取单元中特定类型的阈值信息 |
|
|
106
106
|
| cpzxrobot().scanQrcode | 调用扫码功能,获得扫码文字 |
|
|
107
|
+
| cpzxrobot().vibrate | 调用震动功能 |
|
|
107
108
|
| cpzxrobot().unit.v2.list | 获得单元列表,v2版本 |
|
|
108
109
|
| cpzxrobot().unit.v2.add | 添加单元,v2版本 |
|
|
109
110
|
| cpzxrobot().unit.v2.update | 更新单元,v2版本 |
|