Merge branch 'develop' of ssh://gitlab.dongwu-inc.com:10022/BOE/fe-stu into develop

This commit is contained in:
zhangyc
2022-12-17 19:22:00 +08:00
7 changed files with 294 additions and 140 deletions

View File

@@ -39,23 +39,43 @@
<div style="margin-left: 8px">{{ data.planDto?.address }}</div>
</div>
</div>
<botton
style="background: #999"
class="btn"
@click="toSurvery"
v-if="data.planDto?.evalFlag == 0"
>
评估
</botton>
<botton
:style="{
background: `${data.isSurvery ? '#999' : 'rgb(57, 146, 249)'}`,
}"
class="btn"
@click="toSurvery"
v-if="data.planDto?.evalFlag && data.planDto?.evalFlag == 1"
>{{ data.isSurvery ? "已评估" : "评估" }}
</botton>
<div style="display: flex">
<botton
v-if="!isAllowSign"
class="btn"
style="margin-right: 20px; background: #999"
@click="signClick"
>签到
</botton>
<botton
v-if="isAllowSign"
class="btn"
style="margin-right: 20px"
:style="{
background:
data.signFlag || !isAllowSign ? '#999' : 'rgb(57, 146, 249)',
}"
@click="signClick"
>{{ data.signFlag ? "已签到" : "签到" }}
</botton>
<botton
style="background: #999"
class="btn"
@click="toSurvery"
v-if="data.planDto?.evalFlag == 0"
>
评估
</botton>
<botton
:style="{
background: `${data.isSurvery ? '#999' : 'rgb(57, 146, 249)'}`,
}"
class="btn"
@click="toSurvery"
v-if="data.planDto?.evalFlag && data.planDto?.evalFlag == 1"
>{{ data.isSurvery ? "已评估" : "评估" }}
</botton>
</div>
</div>
<!-- 基本信息 -->
@@ -228,7 +248,7 @@ const returnclick = () => {
router.back();
};
const {
query: { courseId, type },
query: { courseId, type, id: taskId },
} = useRoute();
const { data } = useRequest(STU_OFFCOURSE_DETAIL, { courseId });
@@ -240,26 +260,103 @@ const { avatar: userAvatar } = useUserInfo(
const state = reactive({
activeName: "first",
enclosure: "",
isAllowSign: false,
});
const { activeName, enclosure } = toRefs(state);
const { activeName, enclosure, isAllowSign } = toRefs(state);
const handleClick = (tab, event) => {
console.log(tab, event);
};
const download = (url) => {
window.open(url);
};
let timer = null;
//判断能否签到
function isSignClick() {
timer = setInterval(() => {
if (data.value.planDto.beforeStart && data.value.planDto.afterStart) {
//有开始前有开始后
let beginTime =
new Date(data.value.planDto.beginTime).getTime() -
data.value.planDto.beforeStart * 60 * 1000;
let endTime =
new Date(data.value.planDto.beginTime).getTime() +
data.value.planDto.afterStart * 60 * 1000;
let nowTime = new Date().getTime();
if (nowTime < endTime && nowTime > beginTime) {
state.isAllowSign = true;
} else {
state.isAllowSign = false;
}
} else if (
!data.value.planDto.beforeStart &&
!data.value.planDto.afterStart
) {
//开始前开始后都没有
state.isAllowSign = true;
} else if (
data.value.planDto.beforeStart &&
!data.value.planDto.afterStart
) {
//只有开始前无开始后
let beginTime =
new Date(data.value.planDto.beginTime).getTime() -
data.value.planDto.beforeStart * 60 * 1000;
let nowTime = new Date().getTime();
if (nowTime > beginTime) {
state.isAllowSign = true;
} else {
state.isAllowSign = false;
}
} else if (
!data.value.planDto.beforeStart &&
data.value.planDto.afterStart
) {
//无开始前有开始后
let endTime =
new Date(data.value.planDto.beginTime).getTime() +
data.value.planDto.afterStart * 60 * 1000;
let nowTime = new Date().getTime();
if (nowTime < endTime) {
state.isAllowSign = true;
} else {
state.isAllowSign = false;
}
}
console.log("isAllowSign", state.isAllowSign);
}, 1000);
}
isSignClick();
//签到
const signClick = () => {
if (data.value.signFlag) {
return;
}
console.log("data.signFlag", data.value.signFlag);
if (!isAllowSign) {
ElMessage.info("未在签到范围内");
return;
}
data.value.signFlag = 1;
ElMessage.info("签到成功");
request(TASK_BROADCAST_SIGN, { courseId: courseId, taskId, type });
};
function toSurvery() {
if (data.value.isSurvery) {
return;
}
if (data.value.planDto.evalFlag == 0) {
alert("此课程无评估");
ElMessage.info("此课程无评估");
return;
}
router.push({
path: "/surveydetail",
query: { courseId: data.value.planDto.evaluateId },
query: {
courseId: data.value.planDto.evaluateId,
pName: "面授课",
sName: data.value.planDto.name,
},
});
}
@@ -270,6 +367,8 @@ function toWork() {
courseId: data.value.workDto.workId,
id: data.value.offcourseDto.categoryId,
type,
pName: "面授课",
sName: data.value.planDto.name,
},
});
}