fix:增加签到

This commit is contained in:
lixg
2022-12-17 17:48:03 +08:00
parent 0e01c8de18
commit 3c2bf0116b
4 changed files with 245 additions and 107 deletions

View File

@@ -29,23 +29,43 @@
<div style="margin-left: 8px">{{ data.planDto?.address }}</div> <div style="margin-left: 8px">{{ data.planDto?.address }}</div>
</div> </div>
</div> </div>
<botton <div style="display: flex">
style="background: #999" <botton
class="btn" v-if="!isAllowSign"
@click="toSurvery" class="btn"
v-if="data.planDto?.evalFlag == 0" style="margin-right: 20px; background: #999"
> @click="signClick"
评估 >签到
</botton> </botton>
<botton <botton
:style="{ v-if="isAllowSign"
background: `${data.isSurvery ? '#999' : 'rgb(57, 146, 249)'}`, class="btn"
}" style="margin-right: 20px"
class="btn" :style="{
@click="toSurvery" background:
v-if="data.planDto?.evalFlag && data.planDto?.evalFlag == 1" data.signFlag || !isAllowSign ? '#999' : 'rgb(57, 146, 249)',
>{{ data.isSurvery ? "已评估" : "评估" }} }"
</botton> @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> </div>
<!-- 基本信息 --> <!-- 基本信息 -->
@@ -218,7 +238,7 @@ const returnclick = () => {
router.back(); router.back();
}; };
const { const {
query: { courseId, type }, query: { courseId, type, id: taskId },
} = useRoute(); } = useRoute();
const { data } = useRequest(STU_OFFCOURSE_DETAIL, { courseId }); const { data } = useRequest(STU_OFFCOURSE_DETAIL, { courseId });
@@ -230,26 +250,103 @@ const { avatar: userAvatar } = useUserInfo(
const state = reactive({ const state = reactive({
activeName: "first", activeName: "first",
enclosure: "", enclosure: "",
isAllowSign: false,
}); });
const { activeName, enclosure } = toRefs(state); const { activeName, enclosure, isAllowSign } = toRefs(state);
const handleClick = (tab, event) => { const handleClick = (tab, event) => {
console.log(tab, event); console.log(tab, event);
}; };
const download = (url) => { const download = (url) => {
window.open(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() { function toSurvery() {
if (data.value.isSurvery) { if (data.value.isSurvery) {
return; return;
} }
if (data.value.planDto.evalFlag == 0) { if (data.value.planDto.evalFlag == 0) {
alert("此课程无评估"); ElMessage.info("此课程无评估");
return; return;
} }
router.push({ router.push({
path: "/surveydetail", path: "/surveydetail",
query: { courseId: data.value.planDto.evaluateId }, query: {
courseId: data.value.planDto.evaluateId,
pName: "面授课",
sName: data.value.planDto.name,
},
}); });
} }
@@ -260,6 +357,8 @@ function toWork() {
courseId: data.value.workDto.workId, courseId: data.value.workDto.workId,
id: data.value.offcourseDto.categoryId, id: data.value.offcourseDto.categoryId,
type, type,
pName: "面授课",
sName: data.value.planDto.name,
}, },
}); });
} }

View File

@@ -28,7 +28,7 @@
</div> </div>
<!-- 面包屑导航 --> <!-- 面包屑导航 -->
<div class="debateTitle" style="color: #fff"> <div class="debateTitle" style="color: #fff">
作业管理者进阶腾飞班 - 中级管理者作业 作业 {{ data?.workName }}
</div> </div>
<!-- 详细信息 --> <!-- 详细信息 -->
<div class="detailinfo"> <div class="detailinfo">
@@ -285,6 +285,7 @@ const {
} = useRoute(); } = useRoute();
const { data } = useRequest(TASK_WORK_DETAIL, { workId, taskId }); const { data } = useRequest(TASK_WORK_DETAIL, { workId, taskId });
console.log("data", data);
const { data: submitList } = useRequest(TASK_WORK_SUBMIT_LIST, { const { data: submitList } = useRequest(TASK_WORK_SUBMIT_LIST, {
workerId: workId, workerId: workId,
}); });

View File

@@ -220,13 +220,17 @@ const commitClick = () => {
return; return;
} }
if (data.value.isEvaluate == 0) { if (data.value.isEvaluate == 0) {
alert("此直播无评估"); ElMessage.info("此直播无评估");
return; return;
} }
router.push({ router.push({
path: "/surveydetail", path: "/surveydetail",
query: { courseId: data.value.assessmentId }, query: {
courseId: data.value.assessmentId,
pName: "直播",
sName: data.value.liveName,
},
}); });
}; };

View File

@@ -2,16 +2,16 @@
<div class="surveydetail" style="padding: 30px"> <div class="surveydetail" style="padding: 30px">
<!-- 面包屑导航 --> <!-- 面包屑导航 -->
<div <div
style="display: flex; align-items: center; justify-content: space-between" style="display: flex; align-items: center; justify-content: space-between"
> >
<div class="crumb"> <div class="crumb">
<div>{{ pName }}</div> <div>{{ pName }}</div>
<div style="margin-left: 6px; margin-right: 6px">/</div> <div style="margin-left: 6px; margin-right: 6px">/</div>
<div>{{ sName }}</div> <div>{{ sName }}</div>
<div style="margin-left: 6px; margin-right: 6px">/</div> <div style="margin-left: 6px; margin-right: 6px">/</div>
<div style="font-weight: 700; font-size: 16px">调研详情</div> <div style="font-weight: 700; font-size: 16px">评估详情</div>
</div> </div>
<!-- <!--
<div class="prevnext"> <div class="prevnext">
<div class="prev"> <div class="prev">
<img <img
@@ -28,40 +28,41 @@
/> />
</div>--> </div>-->
<div class="return"> <div class="return">
<div style="display: flex" @click="returnclick"> <div style="display: flex" @click="returnclick">
<img <img
class="img2" style="margin-right:22px;" class="img2"
src="../../assets/image/return.png" style="margin-right: 22px"
/> src="../../assets/image/return.png"
<div class="text">返回</div> />
<div class="text" style="color: #fff">返回</div>
</div> </div>
</div> </div>
</div> </div>
<!-- 面包屑导航 --> <!-- 面包屑导航 -->
<!-- 标题 --> <!-- 标题 -->
<div class="title">调研管理者进阶腾飞班 - 培训阶段性调研</div> <div class="title">评估管理者进阶腾飞班 - 培训阶段性调研</div>
<!-- 标题 --> <!-- 标题 -->
<!-- 基本信息 --> <!-- 基本信息 -->
<div class="bascinfo"> <div class="bascinfo">
<div> <div>
<div <div
class="question" class="question"
v-for="(value, index) in data.assessmentScoringQuestionDtoList" v-for="(value, index) in data.assessmentScoringQuestionDtoList"
:key="index" :key="index"
:style="{ 'margin-top': index === 0 ? '57px' : '41px' }" :style="{ 'margin-top': index === 0 ? '57px' : '41px' }"
> >
<div class="text">{{ value.assessmentScTitle }}</div> <div class="text">{{ value.assessmentScTitle }}</div>
<div class="answer"> <div class="answer">
<div class="answerL">完全没用</div> <div class="answerL">完全没用</div>
<div class="answerC"> <div class="answerC">
<div <div
class="answerCitem" class="answerCitem"
v-for="(item, key) in Array.from( v-for="(item, key) in Array.from(
{ length: value.assessmentMaxScore }, { length: value.assessmentMaxScore },
(k, i) => i (k, i) => i
)" )"
:key="key" :key="key"
:style="{ :style="{
'margin-left': key === 0 ? '15px' : '10px', 'margin-left': key === 0 ? '15px' : '10px',
background: background:
value.selectAnswer === item value.selectAnswer === item
@@ -72,10 +73,10 @@
? '#fff' ? '#fff'
: 'rgba(86, 163, 249, 1)', : 'rgba(86, 163, 249, 1)',
}" }"
@click=" @click="
() => { () => {
if(data.isSubmit){ if (data.isSubmit) {
return return;
} }
value.selectAnswer = item; value.selectAnswer = item;
} }
@@ -88,21 +89,29 @@
</div> </div>
</div> </div>
<div <div
class="question" class="question"
style="margin-top: 41px" style="margin-top: 41px"
v-if="data.assessmentSingleChoiceDtoList && data.assessmentSingleChoiceDtoList.length" v-if="
data.assessmentSingleChoiceDtoList &&
data.assessmentSingleChoiceDtoList.length
"
> >
<div class="text">{{ data.assessmentSingleChoiceDtoList[0]?.singleStemName }}</div> <div class="text">
{{ data.assessmentSingleChoiceDtoList[0]?.singleStemName }}
</div>
<div <div
v-for="(value, index) in data.assessmentSingleChoiceDtoList" v-for="(value, index) in data.assessmentSingleChoiceDtoList"
:key="index" :key="index"
style="display: flex; align-items: center" style="display: flex; align-items: center"
:style="{'margin-top': index === 0 ? '29px' : '22px',cursor: 'pointer'}" :style="{
@click=" 'margin-top': index === 0 ? '29px' : '22px',
cursor: 'pointer',
}"
@click="
() => { () => {
if(data.isSubmit){ if (data.isSubmit) {
return return;
} }
data.assessmentSingleChoiceDtoList.forEach((e) => { data.assessmentSingleChoiceDtoList.forEach((e) => {
e.select = false; e.select = false;
}); });
@@ -111,63 +120,83 @@
" "
> >
<img <img
style="width: 19px; height: 18px; cursor: pointer" style="width: 19px; height: 18px; cursor: pointer"
:src="value.select ? checkbox : checkbox2" :src="value.select ? checkbox : checkbox2"
/> />
<div class="people">{{ value.singleOptionName }}</div> <div class="people">{{ value.singleOptionName }}</div>
</div> </div>
</div> </div>
<div <div
class="question" class="question"
style="margin-top: 41px" style="margin-top: 41px"
v-if="data.assessmentMultipleChoiceDtoList && data.assessmentMultipleChoiceDtoList.length" v-if="
data.assessmentMultipleChoiceDtoList &&
data.assessmentMultipleChoiceDtoList.length
"
> >
<div class="text">{{ data.assessmentMultipleChoiceDtoList[0]?.multipleStemName }}</div> <div class="text">
{{ data.assessmentMultipleChoiceDtoList[0]?.multipleStemName }}
</div>
<div <div
v-for="(value, index) in data.assessmentMultipleChoiceDtoList" v-for="(value, index) in data.assessmentMultipleChoiceDtoList"
:key="index" :key="index"
style="display: flex; align-items: center" style="display: flex; align-items: center"
:style="{ :style="{
'margin-top': index === 0 ? '29px' : '22px', 'margin-top': index === 0 ? '29px' : '22px',
cursor: 'pointer', cursor: 'pointer',
}" }"
@click="() => { @click="
if(data.isSubmit){ () => {
return if (data.isSubmit) {
return;
} }
value.select = !value.select value.select = !value.select;
}" }
"
> >
<img <img
style="width: 19px; height: 18px; cursor: pointer" style="width: 19px; height: 18px; cursor: pointer"
:src="value.select ? checkbox : checkbox2" :src="value.select ? checkbox : checkbox2"
/> />
<div class="people">{{ value.multipleOptionName }}</div> <div class="people">{{ value.multipleOptionName }}</div>
</div> </div>
</div> </div>
<div <div
class="question" class="question"
style="margin-top: 41px" style="margin-top: 41px"
v-for="(item, i) in data.assessmentEssayQuestionDtoList" v-for="(item, i) in data.assessmentEssayQuestionDtoList"
:key="i" :key="i"
> >
<div class="text">{{ item.assessmentQaTitle }}</div> <div class="text">{{ item.assessmentQaTitle }}</div>
<div style="width: 713px; margin-top: 31px; position: relative"> <div style="width: 713px; margin-top: 31px; position: relative">
<el-input <el-input
v-model="item.content" v-model="item.content"
:autosize="{ minRows: 5, maxRows: 5 }" :autosize="{ minRows: 5, maxRows: 5 }"
resize="none" resize="none"
maxlength="200" maxlength="200"
type="textarea" type="textarea"
:readonly="!!data.isSubmit" :readonly="!!data.isSubmit"
/> />
<div class="words">{{ item.content?.length || 0 }}/200</div> <div class="words">{{ item.content?.length || 0 }}/200</div>
</div> </div>
</div> </div>
<div style="display: flex; justify-content: center" <div
v-if="data.assessmentEssayQuestionDtoList?.length || data.assessmentMultipleChoiceDtoList?.length || data.assessmentSingleChoiceDtoList?.length || data.assessmentScoringQuestionDtoList?.length"> style="display: flex; justify-content: center"
<div class="submit" @click="submit" :style="{background: data.isSubmit?'#999':'#2478ff'}">提交</div> v-if="
data.assessmentEssayQuestionDtoList?.length ||
data.assessmentMultipleChoiceDtoList?.length ||
data.assessmentSingleChoiceDtoList?.length ||
data.assessmentScoringQuestionDtoList?.length
"
>
<div
class="submit"
@click="submit"
:style="{ background: data.isSubmit ? '#999' : '#2478ff' }"
>
提交
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -178,28 +207,33 @@
<script setup> <script setup>
import checkbox from "@/assets/image/checkbox.png"; import checkbox from "@/assets/image/checkbox.png";
import checkbox2 from "@/assets/image/checkbox2.png"; import checkbox2 from "@/assets/image/checkbox2.png";
import {useRoute} from "vue-router/dist/vue-router"; import { useRoute, useRouter } from "vue-router/dist/vue-router";
import {request, usePage, useRequest} from "@/api/request"; import { request, usePage, useRequest } from "@/api/request";
import { import { ASSESSMENT_QUERY, ASSESSMENT_SUBMIT } from "@/api/api";
ASSESSMENT_QUERY, import { ElMessage } from "element-plus";
ASSESSMENT_SUBMIT,
} from "@/api/api";
import {ElMessage} from "element-plus";
const { const {
query: {courseId, id: taskId, type, pName, sName}, query: { courseId, id: taskId, type, pName, sName },
} = useRoute(); } = useRoute();
const router = useRouter();
const {data} = useRequest(ASSESSMENT_QUERY(courseId), {id: courseId}); const returnclick = () => {
router.back();
};
const { data } = useRequest(ASSESSMENT_QUERY(courseId), { id: courseId });
console.log("data", data);
function submit() { function submit() {
if (data.value.isSubmit) { if (data.value.isSubmit) {
return return;
} }
data.value.isSubmit = !data.value.isSubmit data.value.isSubmit = !data.value.isSubmit;
request(ASSESSMENT_SUBMIT, {assessmentId: courseId, taskId, type, result: JSON.stringify(data.value)}) request(ASSESSMENT_SUBMIT, {
assessmentId: courseId,
taskId,
type,
result: JSON.stringify(data.value),
});
ElMessage.info("提交成功"); ElMessage.info("提交成功");
router.back() router.back();
} }
</script> </script>
<style lang="scss"> <style lang="scss">
@@ -210,14 +244,14 @@ function submit() {
font-size: 14px; font-size: 14px;
line-height: 24px; line-height: 24px;
} }
.return{ .return {
position: absolute; position: absolute;
right: 10%; right: 10%;
.text{ .text {
text-align: center; text-align: center;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
} }
} }
.prevnext { .prevnext {