|
|
@ -300,6 +300,8 @@ if (param.token) { |
|
|
|
Cookies.set('sand-resultAnnouncementTime', param.resultAnnouncementTime ?? ''); |
|
|
|
Cookies.set('sand-resultAnnouncementTime', param.resultAnnouncementTime ?? ''); |
|
|
|
Cookies.set('sand-curriculumName', param.curriculumName ?? ''); |
|
|
|
Cookies.set('sand-curriculumName', param.curriculumName ?? ''); |
|
|
|
Cookies.set('sand-stopTime', param.stopTime ?? ''); |
|
|
|
Cookies.set('sand-stopTime', param.stopTime ?? ''); |
|
|
|
|
|
|
|
Cookies.set('sand-userId', param.userId ?? ''); |
|
|
|
|
|
|
|
Cookies.set('sand-account', param.account ?? ''); |
|
|
|
Cookies.set('sand-admin', param.admin ?? ''); // 从中台进来的标识 |
|
|
|
Cookies.set('sand-admin', param.admin ?? ''); // 从中台进来的标识 |
|
|
|
Cookies.remove('sand-submit'); |
|
|
|
Cookies.remove('sand-submit'); |
|
|
|
router.replace(route.path); |
|
|
|
router.replace(route.path); |
|
|
@ -319,6 +321,8 @@ if (param.token) { |
|
|
|
param.resultAnnouncementTime = Cookies.get('sand-resultAnnouncementTime'); |
|
|
|
param.resultAnnouncementTime = Cookies.get('sand-resultAnnouncementTime'); |
|
|
|
param.curriculumName = Cookies.get('sand-curriculumName'); |
|
|
|
param.curriculumName = Cookies.get('sand-curriculumName'); |
|
|
|
param.stopTime = Cookies.get('sand-stopTime'); |
|
|
|
param.stopTime = Cookies.get('sand-stopTime'); |
|
|
|
|
|
|
|
param.userId = Cookies.get('sand-userId'); |
|
|
|
|
|
|
|
param.account = Cookies.get('sand-account'); |
|
|
|
isSubmit.value = Cookies.get('sand-submit') === 'true'; |
|
|
|
isSubmit.value = Cookies.get('sand-submit') === 'true'; |
|
|
|
} |
|
|
|
} |
|
|
|
if (param.projectId) param.projectId = +param.projectId; |
|
|
|
if (param.projectId) param.projectId = +param.projectId; |
|
|
@ -412,12 +416,15 @@ const getAssStatus = async () => { |
|
|
|
if (!isSubmit.value) { |
|
|
|
if (!isSubmit.value) { |
|
|
|
const { data } = await getDetailById(param.assessmentId); |
|
|
|
const { data } = await getDetailById(param.assessmentId); |
|
|
|
const done = data ? data.status === 2 : false; // 状态(0、待开始 1、进行中 2、已结束) |
|
|
|
const done = data ? data.status === 2 : false; // 状态(0、待开始 1、进行中 2、已结束) |
|
|
|
// 如果考核已结束,则清除查询考核状态的定时器,并且自动提交 |
|
|
|
// 如果考核已结束,自动提交 |
|
|
|
if (done) { |
|
|
|
if (done) { |
|
|
|
// this.$alert('考核时间已到,系统已自动交卷', '提示', { |
|
|
|
|
|
|
|
// confirmButtonText: '确定', |
|
|
|
|
|
|
|
// }); |
|
|
|
|
|
|
|
submit(); |
|
|
|
submit(); |
|
|
|
|
|
|
|
ElMessageBox.alert(`考核时间已到,系统已自动交卷`, '提示', { |
|
|
|
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
|
|
|
callback: (action: Action) => { |
|
|
|
|
|
|
|
logout(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
@ -434,9 +441,12 @@ const getCompetitionStatus = async () => { |
|
|
|
const now = await getNow(); |
|
|
|
const now = await getNow(); |
|
|
|
// 如果已经结束 |
|
|
|
// 如果已经结束 |
|
|
|
if (now >= endTime) { |
|
|
|
if (now >= endTime) { |
|
|
|
// this.$alert('竞赛时间已到,系统已自动交卷', '提示', { |
|
|
|
ElMessageBox.alert(`竞赛时间已到,系统已自动交卷`, '提示', { |
|
|
|
// confirmButtonText: '确定', |
|
|
|
confirmButtonText: '确定', |
|
|
|
// }); |
|
|
|
callback: (action: Action) => { |
|
|
|
|
|
|
|
logout(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}); |
|
|
|
submit(); |
|
|
|
submit(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// 没结束,则显示倒计时 |
|
|
|
// 没结束,则显示倒计时 |
|
|
@ -533,12 +543,16 @@ const submit = async () => { |
|
|
|
|
|
|
|
|
|
|
|
// 非练习 |
|
|
|
// 非练习 |
|
|
|
per.value && |
|
|
|
per.value && |
|
|
|
ElMessageBox.alert(`提交成功${param.resultsDetails == 0 && param.resultAnnouncementTime != 0 ? ',成绩将在' + param.resultAnnouncementTime + '小时后发布,请去参赛信息模块查看' : ''}`, '提示', { |
|
|
|
ElMessageBox.alert( |
|
|
|
confirmButtonText: '确定', |
|
|
|
`提交成功${param.resultsDetails == 0 && param.resultAnnouncementTime != 0 ? ',成绩将在' + param.resultAnnouncementTime + '小时后发布,请去参赛信息模块查看' : ''}`, |
|
|
|
callback: (action: Action) => { |
|
|
|
'提示', |
|
|
|
logout(); |
|
|
|
{ |
|
|
|
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
|
|
|
callback: (action: Action) => { |
|
|
|
|
|
|
|
logout(); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
.catch(() => { |
|
|
|
submiting.value = false; |
|
|
|
submiting.value = false; |
|
|
@ -598,6 +612,46 @@ const getEntryTime = async () => { |
|
|
|
if (!now) now = await getNow(); |
|
|
|
if (!now) now = await getNow(); |
|
|
|
entryTime.value = now; |
|
|
|
entryTime.value = now; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// websocket获取考核及竞赛信息,用于自动提交 |
|
|
|
|
|
|
|
// socket连接成功 |
|
|
|
|
|
|
|
const open = () => { |
|
|
|
|
|
|
|
console.log('socket连接成功'); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
// socket连接失败 |
|
|
|
|
|
|
|
const error = () => { |
|
|
|
|
|
|
|
console.log('连接错误'); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
// 接收消息 |
|
|
|
|
|
|
|
const getMessage = (msg) => { |
|
|
|
|
|
|
|
console.log('==websocket接收数据=='); |
|
|
|
|
|
|
|
console.log(JSON.parse(msg.data)); |
|
|
|
|
|
|
|
const { content } = JSON.parse(msg.data); |
|
|
|
|
|
|
|
// 1赛事、2创业、3考核、4模型。-号拼接携带id |
|
|
|
|
|
|
|
if (content == 1) { |
|
|
|
|
|
|
|
getCompetitionStatus(); |
|
|
|
|
|
|
|
} else if (content.includes('3-')) { |
|
|
|
|
|
|
|
// 考核:3-考核id |
|
|
|
|
|
|
|
getAssStatus(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
// 关闭socket |
|
|
|
|
|
|
|
const close = () => { |
|
|
|
|
|
|
|
console.log('socket已经关闭'); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
// 初始化socket |
|
|
|
|
|
|
|
const initSocket = () => { |
|
|
|
|
|
|
|
// 实例化socket |
|
|
|
|
|
|
|
const socket = new WebSocket(`ws://${location.host}/nakadai/websocket/${param.userId}/${param.account}`); |
|
|
|
|
|
|
|
// this.socket = new WebSocket(`ws://121.37.12.51:9100/nakadai/websocket/${id}/${account}`) |
|
|
|
|
|
|
|
// 监听socket连接 |
|
|
|
|
|
|
|
socket.onopen = open; |
|
|
|
|
|
|
|
// 监听socket错误信息 |
|
|
|
|
|
|
|
socket.onerror = error; |
|
|
|
|
|
|
|
// 监听socket消息 |
|
|
|
|
|
|
|
socket.onmessage = getMessage; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
onMounted(() => { |
|
|
|
getLevel.value = inject('getLevel'); // 关卡页面获取关卡方法 |
|
|
|
getLevel.value = inject('getLevel'); // 关卡页面获取关卡方法 |
|
|
|
per.value = param.assessmentId ? 1 : param.competitionId ? 2 : 0; |
|
|
|
per.value = param.assessmentId ? 1 : param.competitionId ? 2 : 0; |
|
|
@ -605,10 +659,12 @@ onMounted(() => { |
|
|
|
param.cid && getEntryTime(); |
|
|
|
param.cid && getEntryTime(); |
|
|
|
|
|
|
|
|
|
|
|
if (param.assessmentId) { |
|
|
|
if (param.assessmentId) { |
|
|
|
|
|
|
|
initSocket(); |
|
|
|
getAssList(); |
|
|
|
getAssList(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
param.cid && getList(); |
|
|
|
param.cid && getList(); |
|
|
|
if (param.competitionId) { |
|
|
|
if (param.competitionId) { |
|
|
|
|
|
|
|
initSocket(); |
|
|
|
getCompetitionStatus(); |
|
|
|
getCompetitionStatus(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|