山东大学软件学院项目实训weblab-16

前言

项目地址
本项目是为开发一套容器化的开发、运行、测试环境,用以支持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
      }
    })

}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值