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

@@ -17,9 +17,15 @@
<button class="btn btn02" style="margin-left: 6px"></button>
</span>
</div>
<div class="return">
<div class="return">
<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>
@@ -43,7 +49,8 @@
<div class="item allbox1">
<div class="item1" style="color: #089dff">
{{
state.dataInfo.numberOfInvolved || state.dataInfo.numberOfInvolved == 0
state.dataInfo.numberOfInvolved ||
state.dataInfo.numberOfInvolved == 0
? state.dataInfo.numberOfInvolved
: "-"
}}
@@ -63,7 +70,8 @@
<div class="item allbox3">
<div class="item1" style="color: #00c6ff">
{{
state.dataInfo.numberOfBrowse || state.dataInfo.numberOfBrowse == 0
state.dataInfo.numberOfBrowse ||
state.dataInfo.numberOfBrowse == 0
? state.dataInfo.numberOfBrowse
: "-"
}}
@@ -83,12 +91,12 @@
<div class="join">
<div
v-for="(item, index) in state.dataInfo.voteStemDtoList"
v-for="(item, index) in state.dataInfo?.voteStemDtoList"
:key="index"
style="margin-bottom: 41px"
>
<div class="stem">
<div>{{ item.orderNumber }}</div>
<div>{{ index + 1 }}</div>
<div>{{ item.voteStemName }}</div>
</div>
<div class="options">
@@ -98,16 +106,43 @@
style="
width: 140px;
margin-right: 114px;
margin-bottom: 25px;">
<!-- <img
margin-bottom: 25px;
"
>
<img
v-if="value.optionPictureAddress"
style="width: 140px; height: 140px; border-radius: 8px"
:src="value.optionPictureAddress"
/> -->
/>
<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"/> -->
<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
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="opt-text">{{ value.optionName }}</div>
</label>
@@ -117,15 +152,29 @@
</div>
</div>
<div
style="width: 100%;
style="
width: 100%;
display: flex;
justify-content: center;
margin-top: 30px;">
margin-top: 30px;
"
>
<button
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':'' }"
@click="submitVote(state.dataInfo)">
{{state.dataInfo.isSubmit?'已提交':'提交'}}
: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'
: '',
}"
@click="submitVote(state.dataInfo)"
>
{{ state.dataInfo.isSubmit ? "已提交" : "提交" }}
</button>
</div>
</div>
@@ -151,11 +200,15 @@
距离结束还有&nbsp;&nbsp;
<span class="te">{{
parseInt(
dayjs(state.dataInfo?.voteEndTime).diff(dayjs(), "minute") / 60
dayjs(state.dataInfo?.voteEndTime).diff(
dayjs(),
"minute"
) / 60
)
}}</span
>&nbsp;&nbsp; 小时&nbsp;&nbsp;<span class="te">{{
dayjs(state.dataInfo?.voteEndTime).diff(dayjs(), "minute") % 60
dayjs(state.dataInfo?.voteEndTime).diff(dayjs(), "minute") %
60
}}</span
>&nbsp;&nbsp;分钟
</div>
@@ -174,7 +227,9 @@
<div
class="explaincontent"
v-html="
state.dataInfo?.voteExplain ? state.dataInfo?.voteExplain : '暂无说明'
state.dataInfo?.voteExplain
? state.dataInfo?.voteExplain
: '暂无说明'
"
></div>
</div>
@@ -187,18 +242,14 @@
</template>
<script setup>
import {useRequest,request} from "@/api/request";
import {
VOTE_DETAIL2,
VOTE_DETAIL3,
VOTE_DETAIL_SUBMIT
} from "@/api/api";
import { useRequest, request } from "@/api/request";
import { VOTE_DETAIL2, VOTE_DETAIL3, VOTE_DETAIL_SUBMIT } from "@/api/api";
import dayjs from "dayjs";
import store from "@/store";
import { ElMessage } from "element-plus";
import {useRoute,useRouter} from "vue-router/dist/vue-router";
import {computed, reactive, toRefs} from "vue";
import {useTaskPage} from "@/api/useCommon";
import { useRoute, useRouter } from "vue-router/dist/vue-router";
import { computed, reactive, toRefs } from "vue";
import { useTaskPage } from "@/api/useCommon";
// const { data } = useRequest(TASK_VOTE_DETAIL, {});
// console.log("datadatadata", data);
// const state = reactive({
@@ -206,9 +257,9 @@ import {useTaskPage} from "@/api/useCommon";
// });
// let { votedetail } = toRefs(state);
const {
query: {courseId, pName, sName, chapterOrStageId, infoId, id, btype},
query: { courseId, pName, sName, chapterOrStageId, infoId, id, btype },
} = useRoute();
const {nextPage,prevPage,hasPrev, hasNext} = useTaskPage()
const { nextPage, prevPage, hasPrev, hasNext } = useTaskPage();
const router = useRouter();
const returnclick = () => {
router.back();
@@ -222,105 +273,122 @@ const state = reactive({
const userInfo = computed(() => store.state.userInfo);
let timer = setInterval(() => {
if(userInfo.value.id){
clearInterval(timer)
console.log('获取信息传递参数',{
"chapterOrStageId": chapterOrStageId ? chapterOrStageId : 0,
"courseId": courseId,
"studentId": userInfo.value.id,
"targetId": infoId,
"type": btype
})
if (userInfo.value.id) {
clearInterval(timer);
console.log("获取信息传递参数", {
chapterOrStageId: chapterOrStageId ? chapterOrStageId : 0,
courseId: courseId,
studentId: userInfo.value.id,
targetId: infoId,
type: btype,
});
request(VOTE_DETAIL3(courseId), {}).then(res=>{
console.log(res)
state.dataInfo = res.data
}).catch(err=>{
console.log(err)
request(VOTE_DETAIL3(courseId), {})
.then((res) => {
console.log(res);
state.dataInfo = res.data;
})
.catch((err) => {
console.log(err);
});
}
}, 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) => {
// 当已经提交过时候 不让选择题目
if(state.dataInfo.isSubmit){
return
if (state.dataInfo.isSubmit) {
return;
}
console.log('当前选择题目的id及序号', order, id, dates,torder)
for(let i=0;i<dates.ballotVo.voteStemVoList[torder].optionDetailList.length;i++){
dates.ballotVo.voteStemVoList[torder].optionDetailList[i].isAnswer = false;
console.log("当前选择题目的id及序号", order, id, dates, torder);
for (
let i = 0;
i < dates.voteStemDtoList[torder].optionDetailList.length;
i++
) {
dates.voteStemDtoList[torder].optionDetailList[i].isAnswer = false;
}
dates.ballotVo.voteStemVoList[torder].optionDetailList[order].isAnswer = true;
console.log(state.dataInfo)
}
dates.voteStemDtoList[torder].optionDetailList[order].isAnswer = true;
console.log(state.dataInfo);
};
// 提交投票
const submitVote = () => {
console.log(state.dataInfo)
let nowTime = new Date().getTime()
let maxTime = new Date(state.dataInfo.voteEndTime).getTime()
let minTime = new Date(state.dataInfo.voteStartTime).getTime()
console.log(state.dataInfo);
let nowTime = new Date().getTime();
let maxTime = new Date(state.dataInfo.voteEndTime).getTime();
let minTime = new Date(state.dataInfo.voteStartTime).getTime();
console.log(nowTime, maxTime, minTime)
console.log(nowTime, maxTime, minTime);
// 当未到开始时间
if(nowTime < minTime || nowTime > maxTime) {
ElMessage.error("未到投票开始时间")
return
if (nowTime < minTime || nowTime > maxTime) {
ElMessage.error("未到投票开始时间");
return;
}
// 当已经提交过时候 不让提交即可
if(state.dataInfo.isSubmit){
return
if (state.dataInfo.isSubmit) {
return;
}
let isSubmit = true;
let isSubArr = []
for(let i=0;i<state.dataInfo.voteStemDtoList.length;i++){
for(let j=0; j<state.dataInfo.voteStemDtoList[i].optionDetailList.length;j++){
if(state.dataInfo.voteStemDtoList[i].optionDetailList[j].isAnswer){
isSubArr[i] = state.dataInfo.voteStemDtoList[i].optionDetailList[j].isAnswer
break
}else{
isSubArr[i] = false
let isSubArr = [];
console.log("state.dataInfo", state.dataInfo);
if (state.dataInfo) {
for (let i = 0; i < state.dataInfo.voteStemDtoList.length; i++) {
for (
let j = 0;
j < state.dataInfo.voteStemDtoList[i].optionDetailList.length;
j++
) {
if (state.dataInfo.voteStemDtoList[i].optionDetailList[j].isAnswer) {
isSubArr[i] =
state.dataInfo.voteStemDtoList[i].optionDetailList[j].isAnswer;
break;
} else {
isSubArr[i] = false;
}
}
}
for(let i=0; i<isSubArr.length;i++){
if(isSubArr[i]==false){
isSubmit = false
}
}
if(isSubmit==false){
ElMessage.error("请选择投票问题后进行提交")
return
for (let i = 0; i < isSubArr.length; i++) {
if (isSubArr[i] == false) {
isSubmit = false;
}
}
if (isSubmit == false) {
ElMessage.error("请选择投票问题后进行提交");
return;
}
let obj = {
"beginTime": answerTime,
"chapterOrStageId": chapterOrStageId ? chapterOrStageId : 0,
"result": JSON.stringify(state.dataInfo),
"targetId": infoId, // 项目 路径图 id
"taskId": id,
"type": btype, // 1 项目 2 路径图
"voteId": state.dataInfo.voteId
}
beginTime: answerTime,
chapterOrStageId: chapterOrStageId ? chapterOrStageId : 0,
result: JSON.stringify(state.dataInfo),
targetId: infoId, // 项目 路径图 id
taskId: id,
type: btype, // 1 项目 2 路径图
voteId: state.dataInfo.voteId,
};
console.log('我是投票提交的信息', obj)
console.log("我是投票提交的信息", obj);
useRequest(VOTE_DETAIL_SUBMIT,obj,(e)=>{
console.log(e)
request(VOTE_DETAIL3(courseId), {}).then(res=>{
console.log(res)
ElMessage.success("投票成功")
state.dataInfo = res.data
}).catch(err=>{
console.log(err)
useRequest(VOTE_DETAIL_SUBMIT, obj, (e) => {
console.log(e);
request(VOTE_DETAIL3(courseId), {})
.then((res) => {
console.log(res);
ElMessage.success("投票成功");
state.dataInfo = res.data;
})
.catch((err) => {
console.log(err);
});
// request(VOTE_DETAIL2, {
// "chapterOrStageId": chapterOrStageId ? chapterOrStageId : 0,
@@ -336,7 +404,7 @@ const submitVote = () => {
// }).catch(err=>{
// console.log(err)
// });
})
});
};
</script>
@@ -357,10 +425,10 @@ const submitVote = () => {
line-height: 24px;
position: relative;
}
.return{
.return {
position: absolute;
right: 10%;
.text{
.text {
text-align: center;
display: flex;
flex-direction: row;

View File

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

View File

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