feat:合并

This commit is contained in:
lixg
2023-02-25 11:02:57 +08:00
parent b752524308
commit 01d7849da7
3 changed files with 224 additions and 154 deletions

View File

@@ -19,7 +19,13 @@
</div> </div>
<div class="return"> <div class="return">
<div style="display: flex" @click="returnclick"> <div style="display: flex" @click="returnclick">
<el-button style="color:#0073FB"> <img class="img2" style="margin-right:11px;cursor: pointer;" src="../../assets/image/return.png" />返回</el-button> <el-button style="color: #0073fb">
<img
class="img2"
style="margin-right: 11px; cursor: pointer"
src="../../assets/image/return.png"
/>返回</el-button
>
</div> </div>
</div> </div>
</div> </div>
@@ -43,7 +49,8 @@
<div class="item allbox1"> <div class="item allbox1">
<div class="item1" style="color: #089dff"> <div class="item1" style="color: #089dff">
{{ {{
state.dataInfo.numberOfInvolved || state.dataInfo.numberOfInvolved == 0 state.dataInfo.numberOfInvolved ||
state.dataInfo.numberOfInvolved == 0
? state.dataInfo.numberOfInvolved ? state.dataInfo.numberOfInvolved
: "-" : "-"
}} }}
@@ -63,7 +70,8 @@
<div class="item allbox3"> <div class="item allbox3">
<div class="item1" style="color: #00c6ff"> <div class="item1" style="color: #00c6ff">
{{ {{
state.dataInfo.numberOfBrowse || state.dataInfo.numberOfBrowse == 0 state.dataInfo.numberOfBrowse ||
state.dataInfo.numberOfBrowse == 0
? state.dataInfo.numberOfBrowse ? state.dataInfo.numberOfBrowse
: "-" : "-"
}} }}
@@ -83,12 +91,12 @@
<div class="join"> <div class="join">
<div <div
v-for="(item, index) in state.dataInfo.voteStemDtoList" v-for="(item, index) in state.dataInfo?.voteStemDtoList"
:key="index" :key="index"
style="margin-bottom: 41px" style="margin-bottom: 41px"
> >
<div class="stem"> <div class="stem">
<div>{{ item.orderNumber }}</div> <div>{{ index + 1 }}</div>
<div>{{ item.voteStemName }}</div> <div>{{ item.voteStemName }}</div>
</div> </div>
<div class="options"> <div class="options">
@@ -98,16 +106,43 @@
style=" style="
width: 140px; width: 140px;
margin-right: 114px; margin-right: 114px;
margin-bottom: 25px;"> margin-bottom: 25px;
<!-- <img "
>
<img
v-if="value.optionPictureAddress"
style="width: 140px; height: 140px; border-radius: 8px" style="width: 140px; height: 140px; border-radius: 8px"
:src="value.optionPictureAddress" :src="value.optionPictureAddress"
/> --> />
<div class="radio"> <div class="radio">
<label @click="choiceQuestion(key,value.optionId,state.dataInfo,index)"> <label
@click="
choiceQuestion(key, value.id, state.dataInfo, index)
"
>
<!-- <input type="radio" name="one" value="right"/> --> <!-- <input type="radio" name="one" value="right"/> -->
<div v-if="value.isAnswer" style="width:10px;height:10px;background:#4a9cf8;position:relative;left:15px;border-radius:10px;"></div> <div
<div v-else style="width:10px;height:10px;background:#fff;position:relative;left:15px;border-radius:10px;"></div> v-if="value.isAnswer"
style="
width: 10px;
height: 10px;
background: #4a9cf8;
position: relative;
left: 15px;
border-radius: 10px;
"
></div>
<div
v-else
style="
width: 10px;
height: 10px;
background: #fff;
position: relative;
left: 15px;
border-radius: 10px;
"
></div>
<div class="option"></div> <div class="option"></div>
<div class="opt-text">{{ value.optionName }}</div> <div class="opt-text">{{ value.optionName }}</div>
</label> </label>
@@ -117,15 +152,29 @@
</div> </div>
</div> </div>
<div <div
style="width: 100%; style="
width: 100%;
display: flex; display: flex;
justify-content: center; justify-content: center;
margin-top: 30px;"> margin-top: 30px;
"
>
<button <button
class="submitbtn btn01" class="submitbtn btn01"
:style="{background: (new Date().getTime() > new Date(state.dataInfo.voteEndTime).getTime() || new Date().getTime() < new Date(state.dataInfo.voteStartTime).getTime() )? '#ccc' : state.dataInfo.isSubmit?'#ccc':'' }" :style="{
@click="submitVote(state.dataInfo)"> background:
{{state.dataInfo.isSubmit?'已提交':'提交'}} new Date().getTime() >
new Date(state.dataInfo.voteEndTime).getTime() ||
new Date().getTime() <
new Date(state.dataInfo.voteStartTime).getTime()
? '#ccc'
: state.dataInfo.isSubmit
? '#ccc'
: '',
}"
@click="submitVote(state.dataInfo)"
>
{{ state.dataInfo.isSubmit ? "已提交" : "提交" }}
</button> </button>
</div> </div>
</div> </div>
@@ -151,11 +200,15 @@
距离结束还有&nbsp;&nbsp; 距离结束还有&nbsp;&nbsp;
<span class="te">{{ <span class="te">{{
parseInt( parseInt(
dayjs(state.dataInfo?.voteEndTime).diff(dayjs(), "minute") / 60 dayjs(state.dataInfo?.voteEndTime).diff(
dayjs(),
"minute"
) / 60
) )
}}</span }}</span
>&nbsp;&nbsp; 小时&nbsp;&nbsp;<span class="te">{{ >&nbsp;&nbsp; 小时&nbsp;&nbsp;<span class="te">{{
dayjs(state.dataInfo?.voteEndTime).diff(dayjs(), "minute") % 60 dayjs(state.dataInfo?.voteEndTime).diff(dayjs(), "minute") %
60
}}</span }}</span
>&nbsp;&nbsp;分钟 >&nbsp;&nbsp;分钟
</div> </div>
@@ -174,7 +227,9 @@
<div <div
class="explaincontent" class="explaincontent"
v-html=" v-html="
state.dataInfo?.voteExplain ? state.dataInfo?.voteExplain : '暂无说明' state.dataInfo?.voteExplain
? state.dataInfo?.voteExplain
: '暂无说明'
" "
></div> ></div>
</div> </div>
@@ -188,11 +243,7 @@
<script setup> <script setup>
import { useRequest, request } from "@/api/request"; import { useRequest, request } from "@/api/request";
import { import { VOTE_DETAIL2, VOTE_DETAIL3, VOTE_DETAIL_SUBMIT } from "@/api/api";
VOTE_DETAIL2,
VOTE_DETAIL3,
VOTE_DETAIL_SUBMIT
} from "@/api/api";
import dayjs from "dayjs"; import dayjs from "dayjs";
import store from "@/store"; import store from "@/store";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
@@ -208,7 +259,7 @@ import {useTaskPage} from "@/api/useCommon";
const { const {
query: { courseId, pName, sName, chapterOrStageId, infoId, id, btype }, query: { courseId, pName, sName, chapterOrStageId, infoId, id, btype },
} = useRoute(); } = useRoute();
const {nextPage,prevPage,hasPrev, hasNext} = useTaskPage() const { nextPage, prevPage, hasPrev, hasNext } = useTaskPage();
const router = useRouter(); const router = useRouter();
const returnclick = () => { const returnclick = () => {
router.back(); router.back();
@@ -223,104 +274,121 @@ const userInfo = computed(() => store.state.userInfo);
let timer = setInterval(() => { let timer = setInterval(() => {
if (userInfo.value.id) { if (userInfo.value.id) {
clearInterval(timer) clearInterval(timer);
console.log('获取信息传递参数',{ console.log("获取信息传递参数", {
"chapterOrStageId": chapterOrStageId ? chapterOrStageId : 0, chapterOrStageId: chapterOrStageId ? chapterOrStageId : 0,
"courseId": courseId, courseId: courseId,
"studentId": userInfo.value.id, studentId: userInfo.value.id,
"targetId": infoId, targetId: infoId,
"type": btype type: btype,
}) });
request(VOTE_DETAIL3(courseId), {}).then(res=>{ request(VOTE_DETAIL3(courseId), {})
console.log(res) .then((res) => {
state.dataInfo = res.data console.log(res);
}).catch(err=>{ state.dataInfo = res.data;
console.log(err) })
.catch((err) => {
console.log(err);
}); });
} }
}, 500); }, 500);
console.log('我是获取的投票基本信息', state.dataInfo) console.log("我是获取的投票基本信息", state.dataInfo);
// 答题时间 // 答题时间
const answerTime = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss'); const answerTime = dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss");
// 选择题目 // 选择题目
const choiceQuestion = (order, id, dates, torder) => { const choiceQuestion = (order, id, dates, torder) => {
// 当已经提交过时候 不让选择题目 // 当已经提交过时候 不让选择题目
if (state.dataInfo.isSubmit) { if (state.dataInfo.isSubmit) {
return return;
} }
console.log('当前选择题目的id及序号', order, id, dates,torder) console.log("当前选择题目的id及序号", order, id, dates, torder);
for(let i=0;i<dates.ballotVo.voteStemVoList[torder].optionDetailList.length;i++){ for (
dates.ballotVo.voteStemVoList[torder].optionDetailList[i].isAnswer = false; let i = 0;
} i < dates.voteStemDtoList[torder].optionDetailList.length;
dates.ballotVo.voteStemVoList[torder].optionDetailList[order].isAnswer = true; i++
console.log(state.dataInfo) ) {
dates.voteStemDtoList[torder].optionDetailList[i].isAnswer = false;
} }
dates.voteStemDtoList[torder].optionDetailList[order].isAnswer = true;
console.log(state.dataInfo);
};
// 提交投票 // 提交投票
const submitVote = () => { const submitVote = () => {
console.log(state.dataInfo) console.log(state.dataInfo);
let nowTime = new Date().getTime() let nowTime = new Date().getTime();
let maxTime = new Date(state.dataInfo.voteEndTime).getTime() let maxTime = new Date(state.dataInfo.voteEndTime).getTime();
let minTime = new Date(state.dataInfo.voteStartTime).getTime() let minTime = new Date(state.dataInfo.voteStartTime).getTime();
console.log(nowTime, maxTime, minTime) console.log(nowTime, maxTime, minTime);
// 当未到开始时间 // 当未到开始时间
if (nowTime < minTime || nowTime > maxTime) { if (nowTime < minTime || nowTime > maxTime) {
ElMessage.error("未到投票开始时间") ElMessage.error("未到投票开始时间");
return return;
} }
// 当已经提交过时候 不让提交即可 // 当已经提交过时候 不让提交即可
if (state.dataInfo.isSubmit) { if (state.dataInfo.isSubmit) {
return return;
} }
let isSubmit = true; let isSubmit = true;
let isSubArr = [] let isSubArr = [];
console.log("state.dataInfo", state.dataInfo);
if (state.dataInfo) {
for (let i = 0; i < state.dataInfo.voteStemDtoList.length; i++) { for (let i = 0; i < state.dataInfo.voteStemDtoList.length; i++) {
for(let j=0; j<state.dataInfo.voteStemDtoList[i].optionDetailList.length;j++){ for (
let j = 0;
j < state.dataInfo.voteStemDtoList[i].optionDetailList.length;
j++
) {
if (state.dataInfo.voteStemDtoList[i].optionDetailList[j].isAnswer) { if (state.dataInfo.voteStemDtoList[i].optionDetailList[j].isAnswer) {
isSubArr[i] = state.dataInfo.voteStemDtoList[i].optionDetailList[j].isAnswer isSubArr[i] =
break state.dataInfo.voteStemDtoList[i].optionDetailList[j].isAnswer;
break;
} else { } else {
isSubArr[i] = false isSubArr[i] = false;
} }
} }
} }
}
for (let i = 0; i < isSubArr.length; i++) { for (let i = 0; i < isSubArr.length; i++) {
if (isSubArr[i] == false) { if (isSubArr[i] == false) {
isSubmit = false isSubmit = false;
} }
} }
if (isSubmit == false) { if (isSubmit == false) {
ElMessage.error("请选择投票问题后进行提交") ElMessage.error("请选择投票问题后进行提交");
return return;
} }
let obj = { let obj = {
"beginTime": answerTime, beginTime: answerTime,
"chapterOrStageId": chapterOrStageId ? chapterOrStageId : 0, chapterOrStageId: chapterOrStageId ? chapterOrStageId : 0,
"result": JSON.stringify(state.dataInfo), result: JSON.stringify(state.dataInfo),
"targetId": infoId, // 项目 路径图 id targetId: infoId, // 项目 路径图 id
"taskId": id, taskId: id,
"type": btype, // 1 项目 2 路径图 type: btype, // 1 项目 2 路径图
"voteId": state.dataInfo.voteId voteId: state.dataInfo.voteId,
} };
console.log('我是投票提交的信息', obj) console.log("我是投票提交的信息", obj);
useRequest(VOTE_DETAIL_SUBMIT, obj, (e) => { useRequest(VOTE_DETAIL_SUBMIT, obj, (e) => {
console.log(e) console.log(e);
request(VOTE_DETAIL3(courseId), {}).then(res=>{ request(VOTE_DETAIL3(courseId), {})
console.log(res) .then((res) => {
ElMessage.success("投票成功") console.log(res);
state.dataInfo = res.data ElMessage.success("投票成功");
}).catch(err=>{ state.dataInfo = res.data;
console.log(err) })
.catch((err) => {
console.log(err);
}); });
// request(VOTE_DETAIL2, { // request(VOTE_DETAIL2, {
// "chapterOrStageId": chapterOrStageId ? chapterOrStageId : 0, // "chapterOrStageId": chapterOrStageId ? chapterOrStageId : 0,
@@ -336,7 +404,7 @@ const submitVote = () => {
// }).catch(err=>{ // }).catch(err=>{
// console.log(err) // console.log(err)
// }); // });
}) });
}; };
</script> </script>

View File

@@ -157,7 +157,8 @@ const handleClick = (tab, event) => {
console.log("附件", tab, event); console.log("附件", tab, event);
}; };
const download = (url) => { const download = (url) => {
window.open(url); console.log('下载url',url)
// window.open(url);
}; };
const downloads = (url) => { const downloads = (url) => {
ElMessage.warning("未在有效时间范围内,请耐心等待!"); ElMessage.warning("未在有效时间范围内,请耐心等待!");

View File

@@ -157,6 +157,7 @@ const handleClick = (tab, event) => {
console.log("附件", tab, event); console.log("附件", tab, event);
}; };
const download = (url) => { const download = (url) => {
// console.log('下载url',url)
window.open(url); window.open(url);
}; };
const downloads = (url) => { const downloads = (url) => {