@cpzxrobot/sdk 1.3.9 → 1.3.11

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.
@@ -7,13 +7,14 @@ class MobilePlatform {
7
7
  this.token = "";
8
8
  this.appCode = "";
9
9
  this.baseURL = "";
10
+ this.port = null;
10
11
  // @ts-ignore
11
12
  this.platform = window.flutter_inappwebview;
12
13
  window.addEventListener('message', (event) => {
13
14
  if (event.data == 'capturePort') {
14
- const port = event.ports[0];
15
- if (port != null) {
16
- port.onmessage = (event) => {
15
+ this.port = event.ports[0];
16
+ if (this.port != null) {
17
+ this.port.onmessage = (event) => {
17
18
  if (event.data.id != undefined) {
18
19
  const callback = this.sseCallbacks[event.data.id];
19
20
  callback === null || callback === void 0 ? void 0 : callback(event.data.data);
@@ -280,6 +280,18 @@ class ProjectGateway extends Object {
280
280
  return this.context.ready.then((axios) => {
281
281
  return axios.get(`/api/v2/coremde-sale/project/stage/details?projectId=${projectId}`);
282
282
  });
283
+ },
284
+ // 根据项目ID获取阶段模板
285
+ type: (projectId) => {
286
+ return this.context.ready.then((axios) => {
287
+ return axios.get(`/api/v2/coremde-sale/project/stage/type/${projectId}`);
288
+ });
289
+ },
290
+ // 批量保存项目阶段
291
+ batchAdd: (stages) => {
292
+ return this.context.ready.then((axios) => {
293
+ return axios.post(`/api/v2/coremde-sale/project/stage/batchAdd`, stages);
294
+ });
283
295
  }
284
296
  };
285
297
  }
@@ -9,6 +9,7 @@ export class MobilePlatform implements PlatformInterface {
9
9
  token: string = "";
10
10
  appCode: string = "";
11
11
  baseURL: string = "";
12
+ private port: MessagePort | null = null;
12
13
 
13
14
  constructor() {
14
15
  // @ts-ignore
@@ -16,9 +17,9 @@ export class MobilePlatform implements PlatformInterface {
16
17
 
17
18
  window.addEventListener('message', (event) => {
18
19
  if (event.data == 'capturePort') {
19
- const port = event.ports[0];
20
- if (port != null) {
21
- port.onmessage = (event: MessageEvent) => {
20
+ this.port = event.ports[0];
21
+ if (this.port != null) {
22
+ this.port.onmessage = (event: MessageEvent) => {
22
23
  if (event.data.id != undefined) {
23
24
  const callback = this.sseCallbacks[event.data.id];
24
25
  callback?.(event.data.data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.3.9",
3
+ "version": "1.3.11",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -357,6 +357,18 @@ export class ProjectGateway extends Object {
357
357
  return this.context.ready.then((axios) => {
358
358
  return axios.get(`/api/v2/coremde-sale/project/stage/details?projectId=${projectId}`);
359
359
  });
360
+ },
361
+ // 根据项目ID获取阶段模板
362
+ type: (projectId: number) => {
363
+ return this.context.ready.then((axios) => {
364
+ return axios.get(`/api/v2/coremde-sale/project/stage/type/${projectId}`);
365
+ });
366
+ },
367
+ // 批量保存项目阶段
368
+ batchAdd: (stages: any[]) => {
369
+ return this.context.ready.then((axios) => {
370
+ return axios.post(`/api/v2/coremde-sale/project/stage/batchAdd`, stages);
371
+ });
360
372
  }
361
373
  }
362
374
  }