|
@@ -8,9 +8,9 @@ let continueBusinessFlow = '';
|
|
const businessFlowMiddlewareLogic: Middleware =
|
|
const businessFlowMiddlewareLogic: Middleware =
|
|
(store) => (next) => (action: PayloadAction<string>) => {
|
|
(store) => (next) => (action: PayloadAction<string>) => {
|
|
//const result = next(action);
|
|
//const result = next(action);
|
|
- console.log(
|
|
|
|
- `[businessFlowMiddleware] Action dispatched: ${action.type} ${action.payload}`
|
|
|
|
- );
|
|
|
|
|
|
+ // console.log(
|
|
|
|
+ // `[businessFlowMiddleware] Action dispatched: ${action.type} ${action.payload}`
|
|
|
|
+ // );
|
|
if (action.type !== setBusinessFlow.type) {
|
|
if (action.type !== setBusinessFlow.type) {
|
|
return next(action); // Only handle setBusinessFlow actions
|
|
return next(action); // Only handle setBusinessFlow actions
|
|
}
|
|
}
|
|
@@ -40,12 +40,23 @@ const businessFlowMiddlewareLogic: Middleware =
|
|
unprepare();
|
|
unprepare();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (isExitingExam(action.payload, currentKey)) {
|
|
|
|
|
|
+ if (
|
|
|
|
+ isExitingExam(action.payload, currentKey) &&
|
|
|
|
+ action.payload !== 'exitExamCompleted' &&
|
|
|
|
+ action.payload !== 'exitExamSuspended'
|
|
|
|
+ ) {
|
|
|
|
+ console.log(
|
|
|
|
+ `[businessFlowMiddleware] Exiting exam flow to go to : ${action.payload}`
|
|
|
|
+ );
|
|
const exposureStatus = store.getState().bodyPositionList.exposureStatus;
|
|
const exposureStatus = store.getState().bodyPositionList.exposureStatus;
|
|
|
|
+ console.log(
|
|
|
|
+ `[businessFlowMiddleware] Exposure status: ${exposureStatus}`
|
|
|
|
+ );
|
|
if (exposureStatus === 'Half Exposed') {
|
|
if (exposureStatus === 'Half Exposed') {
|
|
- store.dispatch(setFeedbackOpen(true));
|
|
|
|
|
|
+ store.dispatch(setFeedbackOpen(true)); //显示反馈框
|
|
// store.dispatch({ type: 'SET_CONTINUE_BUSINESS_FLOW', payload: currentKey });
|
|
// store.dispatch({ type: 'SET_CONTINUE_BUSINESS_FLOW', payload: currentKey });
|
|
continueBusinessFlow = action.payload; // 保存退出检查时,要去哪个业务流程
|
|
continueBusinessFlow = action.payload; // 保存退出检查时,要去哪个业务流程
|
|
|
|
+ return; //阻止退出exam
|
|
} else if (exposureStatus === 'Fully Exposed') {
|
|
} else if (exposureStatus === 'Fully Exposed') {
|
|
// Notify backend
|
|
// Notify backend
|
|
console.log(
|
|
console.log(
|
|
@@ -65,14 +76,14 @@ const businessFlowMiddlewareLogic: Middleware =
|
|
`[businessFlowMiddleware] Notifying backend for ${action.payload}`
|
|
`[businessFlowMiddleware] Notifying backend for ${action.payload}`
|
|
);
|
|
);
|
|
// todo 把所有未曝光的体位从study删除掉--服务端和slice。
|
|
// todo 把所有未曝光的体位从study删除掉--服务端和slice。
|
|
- return next({ ...action, type: continueBusinessFlow });
|
|
|
|
|
|
+ return next({ ...action, payload: continueBusinessFlow });
|
|
}
|
|
}
|
|
if (action.payload === 'exitExamSuspended') {
|
|
if (action.payload === 'exitExamSuspended') {
|
|
// Notify backend with different interfaces for completed and suspended 暂时不通知后端
|
|
// Notify backend with different interfaces for completed and suspended 暂时不通知后端
|
|
console.log(
|
|
console.log(
|
|
`[businessFlowMiddleware] Notifying backend for ${action.payload}`
|
|
`[businessFlowMiddleware] Notifying backend for ${action.payload}`
|
|
);
|
|
);
|
|
- return next({ ...action, type: continueBusinessFlow });
|
|
|
|
|
|
+ return next({ ...action, payload: continueBusinessFlow });
|
|
}
|
|
}
|
|
next(action);
|
|
next(action);
|
|
};
|
|
};
|