mock测试

This commit is contained in:
dong 2023-07-04 11:12:12 +08:00
parent e149b0764a
commit d53972584c
2 changed files with 45 additions and 0 deletions

22
src/api/PlatformApi.ts Normal file
View File

@ -0,0 +1,22 @@
import { api } from 'src/boot/axios';
const PublishUriBase = '/mock/platform/status/3';
export function mockApi(data: {
emergstop?: boolean;
trainberth?: boolean;
close?: boolean;
upHold?: boolean;
downHold?: boolean;
upOccHold?: boolean;
downOccHold?: boolean;
psdOpen?: boolean;
psdCut?: boolean;
upSkipstop?: boolean;
downSkipstop?: boolean;
upTrainSkipstop?: boolean;
downTrainSkipstop?: boolean;
id?: string;
}) {
return api.post(`${PublishUriBase}`, data);
}

View File

@ -15,6 +15,7 @@ import {
JlGraphic, JlGraphic,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
import { DisplayObject, FederatedMouseEvent } from 'pixi.js'; import { DisplayObject, FederatedMouseEvent } from 'pixi.js';
// import { mockApi } from 'src/api/PlatformApi';
export class PlatformData extends GraphicDataBase implements IPlatformData { export class PlatformData extends GraphicDataBase implements IPlatformData {
constructor(data?: graphicData.Platform) { constructor(data?: graphicData.Platform) {
@ -296,6 +297,28 @@ export class PlatformOperateInteraction extends GraphicInteractionPlugin<Platfor
platform.states.upHold = true; platform.states.upHold = true;
platform.states.upOccHold = true; platform.states.upOccHold = true;
platform.doRepaint(); platform.doRepaint();
// mockApi({
// emergstop: false,
// trainberth: false,
// close: false,
// upHold: false,
// upOccHold: false,
// downOccHold: false,
// psdOpen: false,
// psdCut: false,
// upSkipstop: false,
// downSkipstop: false,
// upTrainSkipstop: false,
// downTrainSkipstop: false,
// downHold: true,
// id: platform.id,
// })
// .then((res) => {
// console.log(res, '---res--');
// })
// .catch((err) => {
// console.log(err, '---err---');
// });
}; };
removeHoldrConfig.handler = () => { removeHoldrConfig.handler = () => {
platform.states.upHold = false; platform.states.upHold = false;