fix:增加项目详情当项目结束时候任务得提示及跳转到对应任务页面隐藏判断

This commit is contained in:
wyx
2022-12-29 18:34:35 +08:00
parent 6f3347cc1f
commit 247f82a04b
6 changed files with 210 additions and 71 deletions

View File

@@ -34,19 +34,37 @@
<div style="margin-left: 8px">{{ data.planDto?.address }}</div> <div style="margin-left: 8px">{{ data.planDto?.address }}</div>
</div> </div>
</div> </div>
<div style="display: flex"> <div v-if="projectStatus && projectEndTime">
<div v-if="projectStatus !==3 && new Date(projectEndTime).getTime() > new Date().getTime()" style="display: flex">
<botton class="btn" style="margin-right: 20px" :style="{
background: isAllowSign? data.signFlag ? '#999' : 'rgb(57, 146, 249)':'#999', <botton class="btn" style="margin-right: 20px" :style="{
}" @click="signClick">{{ data.signFlag ? "已签到" : "签到" }} background: isAllowSign? data.signFlag ? '#999' : 'rgb(57, 146, 249)':'#999',
</botton> }" @click="signClick">{{ data.signFlag ? "已签到" : "签到" }}
<!-- <botton style="background: #999" class="btn" @click="toSurvery" v-if="data.planDto?.evalFlag == 0"> </botton>
评估 <!-- <botton style="background: #999" class="btn" @click="toSurvery" v-if="data.planDto?.evalFlag == 0">
</botton> --> 评估
<botton v-if="data.planDto?.evalFlag !== 0" :style="{ </botton> -->
background: `${new Date(data.planDto?.beginTime).getTime() > new Date().getTime() ? '#999' : data.isSurvery ? '#999' : 'rgb(57, 146, 249)'}`, <botton v-if="data.planDto?.evalFlag !== 0" :style="{
}" class="btn" @click="toSurvery">{{ data.isSurvery ? "已评估" : "评估" }} background: `${new Date(data.planDto?.beginTime).getTime() > new Date().getTime() ? '#999' : data.isSurvery ? '#999' : 'rgb(57, 146, 249)'}`,
</botton> }" class="btn" @click="toSurvery">{{ data.isSurvery ? "已评估" : "评估" }}
</botton>
</div>
</div>
<div v-else>
<div style="display: flex">
<botton class="btn" style="margin-right: 20px" :style="{
background: isAllowSign? data.signFlag ? '#999' : 'rgb(57, 146, 249)':'#999',
}" @click="signClick">{{ data.signFlag ? "已签到" : "签到" }}
</botton>
<!-- <botton style="background: #999" class="btn" @click="toSurvery" v-if="data.planDto?.evalFlag == 0">
评估
</botton> -->
<botton v-if="data.planDto?.evalFlag !== 0" :style="{
background: `${new Date(data.planDto?.beginTime).getTime() > new Date().getTime() ? '#999' : data.isSurvery ? '#999' : 'rgb(57, 146, 249)'}`,
}" class="btn" @click="toSurvery">{{ data.isSurvery ? "已评估" : "评估" }}
</botton>
</div>
</div> </div>
</div> </div>
<!-- 基本信息 --> <!-- 基本信息 -->
@@ -81,16 +99,18 @@
<FileTypeImg :v-model="el.slice(el.indexOf('-') + 1)" :style="{width: '22px',height: '26px',marginLeft: '10px',}"></FileTypeImg> <FileTypeImg :v-model="el.slice(el.indexOf('-') + 1)" :style="{width: '22px',height: '26px',marginLeft: '10px',}"></FileTypeImg>
<div style="margin-left: 20px">{{ el.slice(el.indexOf('-') + 1) }}</div> <div style="margin-left: 20px">{{ el.slice(el.indexOf('-') + 1) }}</div>
</div> </div>
<div v-if="new Date(data.planDto.beginTime).getTime() > new Date().getTime()" class="download"> <div v-if="projectStatus !==3 && new Date(projectEndTime).getTime() > new Date().getTime()" >
<img style="width: 16px; height: 15px" src="../../assets/image/download.png" /> <div v-if="new Date(data.planDto.beginTime).getTime() > new Date().getTime()" class="download">
<div style="margin-left: 5px;color:#999;" @click="downloads(el)"> <img style="width: 16px; height: 15px" src="../../assets/image/download.png" />
下载 <div style="margin-left: 5px;color:#999;" @click="downloads(el)">
下载
</div>
</div> </div>
</div> <div v-else class="download">
<div v-else class="download"> <img style="width: 16px; height: 15px" src="../../assets/image/download.png" />
<img style="width: 16px; height: 15px" src="../../assets/image/download.png" /> <div style="margin-left: 5px" @click="download(el)">
<div style="margin-left: 5px" @click="download(el)"> 下载
下载 </div>
</div> </div>
</div> </div>
</div> </div>
@@ -109,6 +129,7 @@
<div <div
v-if="projectStatus !==3 && new Date(projectEndTime).getTime() > new Date().getTime()"
:style="{ background: new Date(data.planDto?.beginTime).getTime() > new Date().getTime() ? '#999' : '' }" :style="{ background: new Date(data.planDto?.beginTime).getTime() > new Date().getTime() ? '#999' : '' }"
class="submit" @click="toWork"> class="submit" @click="toWork">
交作业 交作业
@@ -135,6 +156,7 @@
</div> </div>
<div <div
v-if="projectStatus !==3 && new Date(projectEndTime).getTime() > new Date().getTime()"
:style="{ background: new Date(data.planDto?.beginTime).getTime() > new Date().getTime() ? '#999' : '' }" :style="{ background: new Date(data.planDto?.beginTime).getTime() > new Date().getTime() ? '#999' : '' }"
class="submit" @click="toExamItem(data.examinationDto)"> class="submit" @click="toExamItem(data.examinationDto)">
去考试 去考试
@@ -190,11 +212,12 @@ const returnclick = () => {
router.back(); router.back();
}; };
const { const {
query: { courseId, type, id: taskId }, query: { courseId, type, id: taskId, projectStatus, projectEndTime },
} = useRoute(); } = useRoute();
const { data } = useRequest(STU_OFFCOURSE_DETAIL, { courseId }); const { data } = useRequest(STU_OFFCOURSE_DETAIL, { courseId });
console.log("datadatadatadatadatadatadata", data); console.log("datadatadatadatadatadatadata", data);
console.log("项目状态字段传递", projectStatus, projectEndTime);
const teacherInfo = useUserInfo( const teacherInfo = useUserInfo(
computed(() => data.value?.planDto?.teacherId) computed(() => data.value?.planDto?.teacherId)
); );

View File

@@ -48,12 +48,27 @@
</div> </div>
</div> </div>
</div> </div>
<div v-if="dayjs().isBefore(dayjs(data?.submitEndTime)) && dayjs(data?.submitStartTime).isBefore(dayjs())"> <div v-if="projectStatus && projectEndTime">
<UploadImg v-model:value="fileList" ref="uploadRef"> <div v-if="projectStatus !==3 && new Date(projectEndTime).getTime() > new Date().getTime()" >
<button class="shangchuan" style="cursor: pointer"> <div v-if="dayjs().isBefore(dayjs(data?.submitEndTime)) && dayjs(data?.submitStartTime).isBefore(dayjs())">
上传 <UploadImg v-model:value="fileList" ref="uploadRef">
</button> <button class="shangchuan" style="cursor: pointer">
</UploadImg> 上传
</button>
</UploadImg>
</div>
</div>
</div>
<div v-else>
<div>
<div v-if="dayjs().isBefore(dayjs(data?.submitEndTime)) && dayjs(data?.submitStartTime).isBefore(dayjs())">
<UploadImg v-model:value="fileList" ref="uploadRef">
<button class="shangchuan" style="cursor: pointer">
上传
</button>
</UploadImg>
</div>
</div>
</div> </div>
<div class="uploadDetail" <div class="uploadDetail"
:style="{ display: showFileList && fileList && fileList.length > 0 ? 'block' : 'none' }" :style="{ display: showFileList && fileList && fileList.length > 0 ? 'block' : 'none' }"
@@ -118,24 +133,41 @@
<el-input disabled v-model="sbValue.content" :autosize="{ minRows: 12.5, maxRows: 12.5 }" resize="none" <el-input disabled v-model="sbValue.content" :autosize="{ minRows: 12.5, maxRows: 12.5 }" resize="none"
type="textarea" /> type="textarea" />
</div> </div>
<div v-if="projectStatus && projectEndTime">
<div v-if="projectStatus !==3 && new Date(projectEndTime).getTime() > new Date().getTime()" >
<div v-if="dayjs().isBefore(dayjs(data?.submitEndTime)) && dayjs(data?.submitStartTime).isBefore(dayjs())"> <div v-if="dayjs().isBefore(dayjs(data?.submitEndTime)) && dayjs(data?.submitStartTime).isBefore(dayjs())">
<div style="display: flex; justify-content: center"> <div style="display: flex; justify-content: center">
<button class="tijiao" @click="handleClick">{{ submitList && submitList.length > 0 ? "再次" : "" <button class="tijiao" @click="handleClick">{{ submitList && submitList.length > 0 ? "再次" : ""
}}提交</button> }}提交</button>
</div>
</div>
<div v-else>
<div style="display: flex; justify-content: center">
<button disabled class="tijiao"
style="background:#999;border-radius: 6px;cursor: not-allowed;">未到开始时间</button>
</div>
</div>
</div> </div>
</div> </div>
<div v-else> <div v-else>
<div style="display: flex; justify-content: center"> <div>
<button disabled class="tijiao" <div v-if="dayjs().isBefore(dayjs(data?.submitEndTime)) && dayjs(data?.submitStartTime).isBefore(dayjs())">
style="background:#999;border-radius: 6px;cursor: not-allowed;">未到开始时间</button> <div style="display: flex; justify-content: center">
<button class="tijiao" @click="handleClick">{{ submitList && submitList.length > 0 ? "再次" : ""
}}提交</button>
</div>
</div>
<div v-else>
<div style="display: flex; justify-content: center">
<button disabled class="tijiao"
style="background:#999;border-radius: 6px;cursor: not-allowed;">未到开始时间</button>
</div>
</div>
</div> </div>
</div> </div>
<div class=""></div> <div class=""></div>
<div class="title" style="margin-top: 0px"> <div class="title" style="margin-top: 0px">
@@ -261,7 +293,7 @@ const returnclick = () => {
router.back(); router.back();
}; };
const { const {
query: { courseId: workId, type, id: taskId, pName, sName }, query: { courseId: workId, type, id: taskId, pName, sName, projectStatus, projectEndTime},
} = useRoute(); } = useRoute();
const { data } = taskId && taskId !== 'undefined' ? useRequest(TASK_WORK_DETAIL, { workId, taskId }) : useRequest(TASK_WORK_DETAIL, { workId }); const { data } = taskId && taskId !== 'undefined' ? useRequest(TASK_WORK_DETAIL, { workId, taskId }) : useRequest(TASK_WORK_DETAIL, { workId });

View File

@@ -45,26 +45,59 @@
<div style="margin-left: 8px">{{ data?.activityAddress }}</div> <div style="margin-left: 8px">{{ data?.activityAddress }}</div>
</div> --> </div> -->
</div> </div>
<div class="threeBtn"> <div v-if="projectStatus && projectEndTime">
<botton class="btn" :style="{ <div v-if="projectStatus !==3 && new Date(projectEndTime).getTime() > new Date().getTime()" class="threeBtn">
background: `${new Date(data.liveStartTime).getTime() > new Date().getTime() ? '#999' : 'rgb(59, 191, 252)'}`, <botton class="btn" :style="{
}" @click="showClick">观看 background: `${new Date(data.liveStartTime).getTime() > new Date().getTime() ? '#999' : 'rgb(59, 191, 252)'}`,
</botton> }" @click="showClick">观看
</botton>
<botton class="btn" :style="{ <botton class="btn" :style="{
background: `${new Date(data.liveStartTime).getTime() > new Date().getTime() ? '#999' : data.signFlag ? '#999' : 'rgb(57, 146, 249)'}`, background: `${new Date(data.liveStartTime).getTime() > new Date().getTime() ? '#999' : data.signFlag ? '#999' : 'rgb(57, 146, 249)'}`,
}" @click="signClick">{{ data.signFlag ? "已签到" : "签到" }} }" @click="signClick">{{ data.signFlag ? "已签到" : "签到" }}
</botton> </botton>
<!-- <botton style="background: #999" class="btn" @click="commitClick" v-if="data.isEvaluate == 0"> <!-- <botton style="background: #999" class="btn" @click="commitClick" v-if="data.isEvaluate == 0">
评估 评估
</botton> --> </botton> -->
<botton :style="{ <botton :style="{
background: `${new Date(data.liveStartTime).getTime() > new Date().getTime() ? '#999' : data.isSurvery ? '#999' : 'rgb(57, 146, 249)'}`, background: `${new Date(data.liveStartTime).getTime() > new Date().getTime() ? '#999' : data.isSurvery ? '#999' : 'rgb(57, 146, 249)'}`,
}" class="btn" @click="commitClick" v-if="data.isEvaluate && data.isEvaluate == 1">{{ data.isSurvery ? "已评估" : }" class="btn" @click="commitClick" v-if="data.isEvaluate && data.isEvaluate == 1">{{ data.isSurvery ? "已评估" :
"评估" "评估"
}} }}
</botton> </botton>
</div>
<div v-else class="threeBtn">
<botton :style="{
background: `${new Date(data.liveStartTime).getTime() > new Date().getTime() ? '#999' : data.isSurvery ? '#999' : 'rgb(57, 146, 249)'}`,
}" class="btn" @click="commitClick" v-if="data.isEvaluate && data.isEvaluate == 1&&data.isSurvery">{{ data.isSurvery ? "已评估" :
"评估"
}}
</botton>
</div>
</div>
<div v-else>
<div class="threeBtn">
<botton class="btn" :style="{
background: `${new Date(data.liveStartTime).getTime() > new Date().getTime() ? '#999' : 'rgb(59, 191, 252)'}`,
}" @click="showClick">观看
</botton>
<botton class="btn" :style="{
background: `${new Date(data.liveStartTime).getTime() > new Date().getTime() ? '#999' : data.signFlag ? '#999' : 'rgb(57, 146, 249)'}`,
}" @click="signClick">{{ data.signFlag ? "已签到" : "签到" }}
</botton>
<!-- <botton style="background: #999" class="btn" @click="commitClick" v-if="data.isEvaluate == 0">
评估
</botton> -->
<botton :style="{
background: `${new Date(data.liveStartTime).getTime() > new Date().getTime() ? '#999' : data.isSurvery ? '#999' : 'rgb(57, 146, 249)'}`,
}" class="btn" @click="commitClick" v-if="data.isEvaluate && data.isEvaluate == 1">{{ data.isSurvery ? "已评估" :
"评估"
}}
</botton>
</div>
</div> </div>
</div> </div>
<!-- 基本信息 --> <!-- 基本信息 -->
@@ -151,7 +184,7 @@ import { ElMessage } from "element-plus";
import dayjs from "dayjs"; import dayjs from "dayjs";
const { const {
query: { courseId: liveId, id: taskId, type, pName, sName }, query: { courseId: liveId, id: taskId, type, pName, sName, projectStatus, projectEndTime },
} = useRoute(); } = useRoute();
const router = useRouter(); const router = useRouter();
const returnclick = () => { const returnclick = () => {

View File

@@ -45,10 +45,22 @@
<div style="margin-left: 8px">{{ data?.activityAddress }}</div> <div style="margin-left: 8px">{{ data?.activityAddress }}</div>
</div> </div>
</div> </div>
<botton v-if="isAllowSign" class="btn" :style="{background: data.signFlag ? '#999' : 'rgb(57, 146, 249)' }" @click="signClick" >{{ data.signFlag ? "已签到" : "签到" }} <div v-if="projectStatus && projectEndTime">
</botton> <div v-if="projectStatus !==3 && new Date(projectEndTime).getTime() > new Date().getTime()" >
<botton v-else class="btn" :style="{background: '#999' }" @click="signClick" >{{ data.signFlag ? "已签到" : "签到" }} <botton v-if="isAllowSign" class="btn" :style="{background: data.signFlag ? '#999' : 'rgb(57, 146, 249)' }" @click="signClick" >{{ data.signFlag ? "已签到" : "签到" }}
</botton> </botton>
<botton v-else class="btn" :style="{background: '#999' }" @click="signClick" >{{ data.signFlag ? "已签到" : "签到" }}
</botton>
</div>
</div>
<div v-else>
<div>
<botton v-if="isAllowSign" class="btn" :style="{background: data.signFlag ? '#999' : 'rgb(57, 146, 249)' }" @click="signClick" >{{ data.signFlag ? "已签到" : "签到" }}
</botton>
<botton v-else class="btn" :style="{background: '#999' }" @click="signClick" >{{ data.signFlag ? "已签到" : "签到" }}
</botton>
</div>
</div>
</div> </div>
<!-- 基本信息 --> <!-- 基本信息 -->
@@ -149,7 +161,7 @@ const returnclick = () => {
router.back(); router.back();
}; };
const { const {
query: { courseId: activityId, id: taskId, type, pName, sName }, query: { courseId: activityId, id: taskId, type, pName, sName, projectStatus, projectEndTime },
} = useRoute(); } = useRoute();
const state = reactive({ const state = reactive({

View File

@@ -274,6 +274,7 @@ import {
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import store from "@/store"; import store from "@/store";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
const { const {
query: { courseId, projectId }, query: { courseId, projectId },
} = useRoute(); } = useRoute();
@@ -374,9 +375,39 @@ const types = ref({
const dialogVisible = ref(false); const dialogVisible = ref(false);
const dialogVisibleTip = ref('该任务无法学习,请联系管理员进行替换!'); const dialogVisibleTip = ref('该任务无法学习,请联系管理员进行替换!');
// 判断当前任务已结束及时间意义上的结束 提示用户
function judgeTaskIsEnd(type, endTimes, status) {
// type 任务类型 endTime 结束时间 status 任务状态 (状态 0 未完成 1 已完成 2 未开始 3 已结束)
console.log(type, endTimes, status);
let isEnd = false;
let nowTime = new Date().getTime();
let endTime = new Date().getTime(endTimes);
switch (type) {
case 1:
status == 3 ? isEnd = true : nowTime > endTime ? isEnd = true : isEnd = false;
break;
case 3:
status == 3 ? isEnd = true : nowTime > endTime ? isEnd = true : isEnd = false;
break;
case 5:
status == 3 ? isEnd = true : nowTime > endTime ? isEnd = true : isEnd = false;
break;
case 7:
status == 3 ? isEnd = true : nowTime > endTime ? isEnd = true : isEnd = false;
break;
case 10:
status == 3 ? isEnd = true : nowTime > endTime ? isEnd = true : isEnd = false;
break;
}
return isEnd;
}
function toFinish(d, sName, chapterOrStageId) { function toFinish(d, sName, chapterOrStageId) {
console.log("dddddd", d, sName, chapterOrStageId); console.log("dddddd", d, sName, chapterOrStageId);
if(judgeTaskIsEnd(d.type ,data.value.endTime, data.value.status)){
ElMessage.error("当前任务已结束")
return
}
if (d.type == 2) { if (d.type == 2) {
let date1 = new Date(d.endTime).getTime(); let date1 = new Date(d.endTime).getTime();
let date2 = new Date().getTime(); let date2 = new Date().getTime();
@@ -483,7 +514,9 @@ function toFinish(d, sName, chapterOrStageId) {
courseId: d.courseId, courseId: d.courseId,
pName: data.value.name, pName: data.value.name,
sName, sName,
chapterOrStageId chapterOrStageId,
projectStatus: data.value.status?data.value.status:0, // 项目状态 -- 用于判断当前项目是否已经结束
projectEndTime: data.value.endTime?data.value.endTime:0 // 项目结束 -- 用于判断当前项目是否已经结束
}, },
}); });
} else if (typeof types.value.path[d.type] === "function") { } else if (typeof types.value.path[d.type] === "function") {

View File

@@ -296,9 +296,15 @@
data.assessmentMultipleChoiceDtoList?.length || data.assessmentMultipleChoiceDtoList?.length ||
data.assessmentSingleChoiceDtoList?.length || data.assessmentSingleChoiceDtoList?.length ||
data.assessmentScoringQuestionDtoList?.length data.assessmentScoringQuestionDtoList?.length
"> "> <div v-if="projectStatus && projectEndTime">
<div class="submit" @click="submit" :style="{ background: data.isSubmit ? '#999' : '#2478ff' }"> <div v-if="projectStatus !==3 && new Date(projectEndTime).getTime() > new Date().getTime()" class="submit" @click="submit" :style="{ background: data.isSubmit ? '#999' : '#2478ff' }">
提交 提交
</div>
</div>
<div v-else>
<div class="submit" @click="submit" :style="{ background: data.isSubmit ? '#999' : '#2478ff' }">
提交
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -334,7 +340,7 @@ import { ElMessage } from "element-plus";
import { ref } from "vue"; import { ref } from "vue";
const { const {
query: { courseId, id: taskId, infoId, type, pName, sName, chapterOrStageId }, query: { courseId, id: taskId, infoId, type, pName, sName, chapterOrStageId, projectStatus, projectEndTime },
} = useRoute(); } = useRoute();
const router = useRouter(); const router = useRouter();
const returnclick = () => { const returnclick = () => {