前言
项目地址
本项目是为开发一套容器化的开发、运行、测试环境,用以支持Web开发、程序设计等课程的实验教学。
教师端
发布通知
const releaseNotice = (curr: CurriculumDataIf) => {
releaseNoticeForm.content = '';
releaseNoticeForm.title = '';
releaseNoticeForm.id = curr.id;
releaseNoticeForm.idx = curriculumData.value.findIndex((x) => x.id === curr.id);
releaseNoticeFormVisible.value = true;
}
const ConfirmReleaseNotice = () => {
let param = new FormData();
param.append('orgId', releaseNoticeForm.id);
param.append('name', releaseNoticeForm.title);
param.append('desc', releaseNoticeForm.content);
request('weblab/message/createMessage', param)
.then(res => {
console.log(res);
if (res.data.msg == 'success') {
releaseNoticeFormVisible.value = false;
curriculumData.value[releaseNoticeForm.idx].notice.push({
id: res.data.pkg,
title: releaseNoticeForm.title,
content: releaseNoticeForm.content,
createTime: getFormDate(),
lastModifyTime: getFormDate()
})
}
})
}
删除通知
const DeleteNotice = (notice: NoticeDataIF, curriculum: CurriculumDataIf) => {
ElMessageBox.confirm('将删除该通知,继续?', 'Warning',
{
confirmButtonText: 'OK',
cancelButtonText: 'Cancel',
type: 'warning',
})
.then(() => {
let param = new FormData();
param.append('id', notice.id);
request('weblab/message/deleteMessageById', param)
.then(res => {
console.log(res);
if (res.data.msg == 'success')
curriculum.notice = curriculum.notice.filter(item => item != notice);
})
})
}
发布作业
const releaseHW = (curr: CurriculumDataIf) => {
releaseHWForm.content = '';
releaseHWForm.id = curr.id;
releaseHWForm.idx = curriculumData.value.findIndex((x) => x.id === curr.id);
releaseHWFormVisible.value = true;
}
const ConfirmReleaseHW = () => {
const date = releaseHWForm.ddl;
let param = new FormData();
param.append('organizationId', releaseHWForm.id);
param.append('name', '');
param.append('desc', releaseHWForm.content);
param.append('beginTime', '');
param.append('endTime', `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`)
request('weblab/lab/createLab', param)
.then(res => {
console.log(res);
if (res.data.msg == 'success') {
const data = res.data.pkg;
curriculumData.value[releaseHWForm.idx].homework.push({
id: data.id,
ddl: data.endTime,
content: data.description
})
}
})
releaseHWFormVisible.value = false;
}
更改作业内容
const UpdateHW = (hw: HomeworkDataIF, curriculum: CurriculumDataIf) => {
updateHWForm.content = '';
// updateHWForm.ddl=new Date();
updateHWForm.id = hw.id;
updateHWForm.hwIdx = curriculum.homework.findIndex((x) => x.id === hw.id);
updateHWForm.currIdx = curriculumData.value.findIndex(x => x.id == curriculum.id);
updateHWFormVisible.value = true;
}
const ConfirmUpdateHW = () => {
const date = updateHWForm.ddl;
let param = new FormData();
param.append('id', updateHWForm.id);
param.append('name', '');
param.append('desc', updateHWForm.content);
param.append('beginTime', '');
param.append('endTime', `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`)
request('weblab/lab/updateLab', param)
.then(res => {
console.log(res);
if (res.data.msg == 'success') {
const data = res.data.pkg;
curriculumData.value[updateHWForm.currIdx].homework[updateHWForm.hwIdx] = {
id: data.id,
ddl: data.endTime,
content: data.description
}
}
})
updateHWFormVisible.value = false;
}
删除作业
const DeleteHW = (hw: HomeworkDataIF, curriculum: CurriculumDataIf) => {
ElMessageBox.confirm('将删除该作业,继续?', 'Warning',
{
confirmButtonText: 'OK',
cancelButtonText: 'Cancel',
type: 'warning',
})
.then(() => {
let param = new FormData();
param.append('id', hw.id);
request('weblab/lab/deleteLab', param)
.then(res => {
console.log(res);
if (res.data.msg == 'success')
curriculum.homework = curriculum.homework.filter(item => item != hw);
})
})
}
学生端
查看作业
const checkHWDetail = (hw: hwDataIF) => {
if (hw.project.length == 0) {
let param = new FormData();
param.append('labId', hw.id);
request('weblab/lab/getProjectList', param)
.then(res => {
console.log(res);
if (res.data.msg == 'success') {
const data=res.data.pkg;
for(let d of data){
const proIdx=projectData.value.findIndex(x=>x.id==d.id);
hw.project.push(projectData.value[proIdx]);
}
}
})
}
showHWDetail.value = true;
choseLab.value = hw;
}
提交作业
const submitProject = () => {
console.log(choseProject.value);
let param = new FormData();
param.append('labId', choseLab.value!.id);
param.append('projectId', choseProject.value);
request('weblab/lab/addProjectIntoLab', param)
.then(res => {
console.log(res);
if (res.data.msg == 'success') {
const proIdx = projectData.value.findIndex(x => x.id == choseProject.value);
choseLab.value?.project.push(projectData.value[proIdx]);
console.log(homeworkTableData.value)
choseProjectFormVisible.value = false
}
})
}