Browse Source

返回分析角度

master
zhangjiming 5 months ago
parent
commit
a701009248
  1. 14
      src/routes/auth.ts
  2. 10
      src/routes/measure.ts
  3. 26
      src/types/wsTypes.ts

14
src/routes/auth.ts

@ -9,11 +9,11 @@ router.post("/login", async (req, res) => {
loginFlag: true,
loginUser: {
id: 0,
account: "Demo",
nickname: "Demo",
password: "Demo",
account: "admin",
nickname: "admin",
password: "",
userRole: "Admin",
isBuiltInUser: false,
isBuiltInUser: true,
},
};
@ -24,15 +24,15 @@ router.post("/login", async (req, res) => {
});
await delay(200);
res.json({
status: 0,
data: {
id: 3, //数据主键id
createTime: "2025-03-03 17:51:13", //数据创建时间
updateTime: "2025-03-03 19:22:35", //数据更新时间
account: "test001", //用户账户
nickname: "测试账户001", //用户昵称
account: "admin", //用户账户
nickname: "admin", //用户昵称
password: null,
usrRole: "Admin", //用户角色,可用值:User,Admin,Dev
isBuiltInUser: false, //是否内置用户(内置用户不可删除)

10
src/routes/measure.ts

@ -68,7 +68,15 @@ router.post("/analyze-measurement", async (req, res) => {
// },
// });
// }, 2000);
res.json({ status: 0 });
res.json({ status: 0, data: {
angles: [
{ x: 9.949007022412, y: -0.1650166186941, degree: 80, describe: "80°"},
{ x: 25.35, y: -2.184814802617, degree: 60, describe: "60°" },
{ x: -9.949007022412, y: -0.1650166186941, degree: 100, describe: "100°" },
{ x: -25.35, y: -2.184814802617, degree: 120, describe: "120°" },
]
}});
});
router.post("/save-report", async (req, res) => {

26
src/types/wsTypes.ts

@ -18,8 +18,15 @@ export type TrackRecordSig = {
};
export const defaultContext: ContextMessage["data"] = {
loginFlag: false,
loginUser: {},
loginFlag: true,
loginUser: {
id: 3, //数据主键id
account: "test001", //用户账户
nickname: "测试账户001", //用户昵称
userRole: "User", //用户角色,可用值:User,Admin,Dev
isBuiltInUser: false, //是否内置用户(内置用户不可删除)
},
newMeasureAfterSave: false,
};
export type ContextMessage = {
@ -34,8 +41,23 @@ export type ContextMessage = {
userRole: "Admin" | "User" | "Dev";
isBuiltInUser: boolean;
}>;
newMeasureAfterSave: boolean;
};
path: "/deviceContext";
};
export type MeasureState = {
messageType: "EVENT";
data: {
taskStatus: "IDLE" | "MEASURING" | "WAITING_FOR_MEASURING" | "FINISHED";
measureSideCnt: 0 | 1 | 2; //已测量数量,0,1,2 最多两边(左边和右边)
isMeasuringLeftEnd: boolean; //测量左侧完成
isMeasuringRightEnd: boolean; //测量右侧完成
motionlessSigFlag: boolean; //滑轮质心是否静止
inStartMeasuringPos: boolean; //是否在允许开始测量的位置
// profileRecordDescription: null; //用户填写的新测量信息
};
path: "/measurement-task/get-task-state";
};
export type Datagram = TrackRecordSig | TaskState | ContextMessage;
Loading…
Cancel
Save