补充观看教学视频路由跳转功能,检测页面微调
This commit is contained in:
@@ -1,24 +1,35 @@
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import router from '@/routers'
|
||||
import type { DetectionLockHolder } from '@/stores/modules/detectionLock'
|
||||
import mittBus, { STOP_DETECTION_TIMER_EVENT } from '@/utils/mittBus'
|
||||
|
||||
const stopDetectionTimer = () => {
|
||||
mittBus.emit(STOP_DETECTION_TIMER_EVENT)
|
||||
}
|
||||
|
||||
const goResourceManage = async () => {
|
||||
if (router.hasRoute('resourceManage')) {
|
||||
await router.push({ name: 'resourceManage' })
|
||||
return
|
||||
}
|
||||
await router.push('/resourceManage')
|
||||
}
|
||||
|
||||
/**
|
||||
* S1:他人正在做检测,自己抢锁被挡
|
||||
* S1: 他人正在做检测, 自己抢锁被挡
|
||||
*/
|
||||
export const showLockBusyDialog = (holder: DetectionLockHolder) => {
|
||||
ElMessageBox.confirm(
|
||||
`「${holder.holderUserName}」正在做检测,请稍后。`,
|
||||
'检测进行中',
|
||||
{
|
||||
confirmButtonText: '观看检测视频教学',
|
||||
cancelButtonText: '我知道了',
|
||||
type: 'warning',
|
||||
distinguishCancelAndClose: true,
|
||||
customClass: 'detection-lock-busy-dialog'
|
||||
}
|
||||
)
|
||||
stopDetectionTimer()
|
||||
|
||||
ElMessageBox.confirm(`「${holder.holderUserName}」正在做检测,请稍后。`, '检测进行中', {
|
||||
confirmButtonText: '观看检测视频教学',
|
||||
cancelButtonText: '我知道了',
|
||||
type: 'warning',
|
||||
distinguishCancelAndClose: true,
|
||||
customClass: 'detection-lock-busy-dialog'
|
||||
})
|
||||
.then(() => {
|
||||
// 视频教学跳转 URL 暂未配置,先用 Toast 兜底
|
||||
ElMessage.info('视频教学功能开发中,敬请期待')
|
||||
return goResourceManage()
|
||||
})
|
||||
.catch(() => {
|
||||
// 用户点了"我知道了"或关闭,什么都不做
|
||||
@@ -26,16 +37,18 @@ export const showLockBusyDialog = (holder: DetectionLockHolder) => {
|
||||
}
|
||||
|
||||
/**
|
||||
* S2:未开始检测就调中间接口
|
||||
* S2: 未开始检测就调中间接口
|
||||
*/
|
||||
export const showLockNotStartedToast = () => {
|
||||
ElMessage.warning('请先点击"开始检测"按钮启动本轮检测')
|
||||
}
|
||||
|
||||
/**
|
||||
* S3:自己暂停超 10 分钟,被 WS 推 STOP_TIMEOUT 强制结束
|
||||
* S3: 自己暂停超 10 分钟, 被 WS 推 STOP_TIMEOUT 强制结束
|
||||
*/
|
||||
export const showPauseTimeoutDialog = () => {
|
||||
stopDetectionTimer()
|
||||
|
||||
ElMessageBox.alert('暂停超过 10 分钟未恢复,系统已自动结束本次检测。\n\n如需继续,请重新发起检测。', '本次检测已结束', {
|
||||
confirmButtonText: '我知道了',
|
||||
type: 'warning'
|
||||
@@ -43,24 +56,22 @@ export const showPauseTimeoutDialog = () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* S4:被管理员强制释放
|
||||
* - holder 为 null → 强释后无人接手
|
||||
* - holder 非 null → 强释后被别人立刻抢占
|
||||
* S4: 被管理员强制释放
|
||||
* - holder 为 null: 强释后无人接手
|
||||
* - holder 非 null: 强释后被别人立刻抢占
|
||||
*/
|
||||
export const showForceReleasedDialog = (holder: DetectionLockHolder | null) => {
|
||||
stopDetectionTimer()
|
||||
|
||||
if (holder) {
|
||||
ElMessageBox.confirm(
|
||||
`当前「${holder.holderUserName}」正在做检测,您无法继续检测,请稍后。`,
|
||||
'检测已被中止',
|
||||
{
|
||||
confirmButtonText: '观看检测视频教学',
|
||||
cancelButtonText: '我知道了',
|
||||
type: 'warning',
|
||||
distinguishCancelAndClose: true
|
||||
}
|
||||
)
|
||||
ElMessageBox.confirm(`当前「${holder.holderUserName}」正在做检测,您无法继续检测,请稍后。`, '检测已被中止', {
|
||||
confirmButtonText: '观看检测视频教学',
|
||||
cancelButtonText: '我知道了',
|
||||
type: 'warning',
|
||||
distinguishCancelAndClose: true
|
||||
})
|
||||
.then(() => {
|
||||
ElMessage.info('视频教学功能开发中,敬请期待')
|
||||
return goResourceManage()
|
||||
})
|
||||
.catch(() => {})
|
||||
} else {
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
import mitt from "mitt";
|
||||
|
||||
const mittBus = mitt();
|
||||
export const STOP_DETECTION_TIMER_EVENT = "stopDetectionTimer";
|
||||
|
||||
type MittBusEvents = {
|
||||
openThemeDrawer: undefined;
|
||||
[STOP_DETECTION_TIMER_EVENT]: undefined;
|
||||
};
|
||||
|
||||
const mittBus = mitt<MittBusEvents>();
|
||||
export default mittBus;
|
||||
|
||||
Reference in New Issue
Block a user