@cpzxrobot/sdk 1.2.98 → 1.2.99

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.
@@ -6,6 +6,11 @@ class UnitGateway extends Object {
6
6
  super();
7
7
  this.context = context;
8
8
  }
9
+ get(id) {
10
+ return this.context.ready.then((axios) => {
11
+ return axios.get(`/api/v1/unit/${id}`);
12
+ });
13
+ }
9
14
  get config() {
10
15
  return {
11
16
  add: (unit, type, config) => {
@@ -13,6 +13,7 @@ class UserGateway extends Object {
13
13
  async selectUnit(unit) {
14
14
  if ((typeof unit === "string") || (typeof unit === "number")) {
15
15
  var axios = await this.context.ready;
16
+ unit = await this.context.unit.get(unit);
16
17
  this.context.platform.setSelectedUnit(unit);
17
18
  }
18
19
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.2.98",
3
+ "version": "1.2.99",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/unit_gateway.ts CHANGED
@@ -6,6 +6,12 @@ export class UnitGateway extends Object {
6
6
  super();
7
7
  this.context = context;
8
8
  }
9
+
10
+ get(id: number|string) {
11
+ return this.context.ready.then((axios) => {
12
+ return axios.get(`/api/v1/unit/${id}`);
13
+ });
14
+ }
9
15
  get config() {
10
16
  return {
11
17
  add: (
package/user_gateway.ts CHANGED
@@ -16,6 +16,7 @@ export class UserGateway extends Object {
16
16
  public async selectUnit(unit: Unit | String | Number) {
17
17
  if ((typeof unit === "string") || (typeof unit === "number")) {
18
18
  var axios = await this.context.ready;
19
+ unit = await this.context.unit.get(unit);
19
20
  this.context.platform.setSelectedUnit(unit);
20
21
  } else {
21
22
  this.context.platform.setSelectedUnit(unit);