@cpzxrobot/sdk 1.3.1 → 1.3.2

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.
@@ -2,12 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PlatformInterface = void 0;
4
4
  class PlatformInterface {
5
- getToken() {
6
- throw new Error("Method not implemented.");
7
- }
8
- setToken(token) {
9
- throw new Error("Method not implemented.");
10
- }
11
5
  //define constructor(token: string, appCode: string) {
12
6
  constructor(appCode, baseURL) {
13
7
  this.appCode = appCode;
@@ -12,7 +12,6 @@ class UserGateway extends Object {
12
12
  }
13
13
  async selectUnit(unit) {
14
14
  if ((typeof unit === "string") || (typeof unit === "number")) {
15
- var axios = await this.context.ready;
16
15
  var resp = await this.context.unit.get(unit);
17
16
  this.context.platform.setSelectedUnit(resp.data);
18
17
  }
@@ -82,7 +81,7 @@ class UserGateway extends Object {
82
81
  };
83
82
  }
84
83
  return axios.get("/api/v2/user/role/mypermission", {
85
- params
84
+ args
86
85
  });
87
86
  }
88
87
  async delete(id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,13 +1,6 @@
1
1
  import { Factory, MyAxiosInstance, Unit } from "./types";
2
2
 
3
3
  export abstract class PlatformInterface {
4
- getToken(): string {
5
- throw new Error("Method not implemented.");
6
- }
7
- setToken(token: string) {
8
- throw new Error("Method not implemented.");
9
- }
10
-
11
4
  appCode: string;
12
5
  baseURL: string;
13
6
 
@@ -16,7 +9,8 @@ export abstract class PlatformInterface {
16
9
  this.appCode = appCode;
17
10
  this.baseURL = baseURL;
18
11
  }
19
-
12
+ abstract getToken(): string;
13
+ abstract setToken(token: string): void;
20
14
  abstract getSelectedFarmFromMiniApp(): Promise<any>;
21
15
  abstract getSelectedUnitFromMiniApp(): Promise<any>;
22
16
  abstract jumpToMiniApp(url: string): Promise<void>;
@@ -34,6 +28,6 @@ export abstract class PlatformInterface {
34
28
  abstract setProgress(precentage: number): void;
35
29
  abstract getAxiosFromMiniApp(): MyAxiosInstance;
36
30
  abstract ready(): Promise<boolean>;
37
- abstract setSelectedUnit(unit: Unit|String|Number): void;
38
- abstract setSelectedFarm(farm: Factory|String|Number): void;
31
+ abstract setSelectedUnit(unit: Unit | String | Number): void;
32
+ abstract setSelectedFarm(farm: Factory | String | Number): void;
39
33
  }
package/types.d.ts CHANGED
@@ -366,6 +366,7 @@ class Cpzxrobot {
366
366
  // _getSelectedUnitFromMiniApp: () => Promise<Unit>;
367
367
  openMiniApp: (url: string) => void;
368
368
  on: (event: string, callback: (data: any) => void) => void;
369
+ setTitle: (title: string) => void;
369
370
  // setTitle: (title: string) => void;
370
371
  // saveBase64: (base64: string, filename: string) => void;
371
372
  // saveBlob: (blob: Blob, filename: string) => void;
package/user_gateway.ts CHANGED
@@ -15,7 +15,6 @@ export class UserGateway extends Object {
15
15
 
16
16
  public async selectUnit(unit: Unit | String | Number) {
17
17
  if ((typeof unit === "string") || (typeof unit === "number")) {
18
- var axios = await this.context.ready;
19
18
  var resp = await this.context.unit.get(unit);
20
19
  this.context.platform.setSelectedUnit(resp.data);
21
20
  } else {
@@ -104,7 +103,7 @@ export class UserGateway extends Object {
104
103
  };
105
104
  }
106
105
  return axios.get("/api/v2/user/role/mypermission", {
107
- params
106
+ args
108
107
  });
109
108
  }
110
109