feat:修改投票

This commit is contained in:
lixg
2023-03-01 20:00:59 +08:00
parent bbb3c67cb7
commit 2546f61f04
7 changed files with 47 additions and 89 deletions

View File

@@ -2,7 +2,7 @@
* @Author: lixg lixg@dongwu-inc.com
* @Date: 2023-01-13 11:42:48
* @LastEditors: lixg lixg@dongwu-inc.com
* @LastEditTime: 2023-02-27 15:35:34
* @LastEditTime: 2023-03-01 19:07:28
* @FilePath: /stu_h5/src/api/api.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
@@ -48,8 +48,9 @@ export const DISCUSS_LIST = '/discussSubmit/taskList'
export const DISCUSS_DETAIL = '/discussSubmit/detail'
export const DISCUSS_SUBMIT_REVIEW_LIST = '/discussSubmit/queryDiscussSubmitAndReview'
export const VOTE_DETAIL2 = `/vote/queryVoteById`
export const VOTE_DETAIL3 = voteId => `/vote/queryVoteById?voteId=${voteId}`
// 投票详情接口
export const VOTE_DETAIL_SUBMIT = `/voteSubmit/vote/commit post`
export const VOTE_DETAIL_SUBMIT = `voteSubmit/vote/commit post`
// 讨论模块
// -- 根据讨论的Id查询讨论发表的帖子

View File

@@ -47,7 +47,7 @@ const visiable = ref(true);
// const back = ref("require('@/assets/images/pathdetails/pathDetailBack.png')");
const imageAttrs = {
"路径图背景-1671015331292.png": {
路径图背景: {
width: 1437,
height: 594,
positions: [

View File

@@ -124,7 +124,7 @@
:style="{
backgroundColor: elem.isAnswer ? '#ddd' : '#2478ff',
}"
@click="choiceQuestion(key, elem.optionId, data, index)"
@click="choiceQuestion(item, elem)"
>
投票
</button>
@@ -177,7 +177,7 @@ import { reactive, toRefs, computed, onUnmounted, ref } from "vue";
import ReturnHead from "@/components/ReturnHead.vue";
// import TitleHead from "@/components/TitleHead.vue";
import { useRequest, request } from "@/api/request";
import { VOTE_DETAIL2, VOTE_DETAIL_SUBMIT } from "@/api/api";
import { VOTE_DETAIL3, VOTE_DETAIL_SUBMIT } from "@/api/api";
import dayjs from "dayjs";
import store from "@/store";
import { ElMessage } from "element-plus";
@@ -187,13 +187,7 @@ const {
query: { courseId, chapterOrStageId, infoId, id, btype },
} = useRoute();
const userInfo = computed(() => store.state.userInfo);
const { data } = useRequest(VOTE_DETAIL2, {
// chapterOrStageId: chapterOrStageId ? chapterOrStageId : 0,
voteId: courseId,
// studentId: userInfo.value.id,
// targetId: infoId,
// type: btype,
});
const { data } = useRequest(VOTE_DETAIL3(courseId), {});
console.log("投票基本信息", data);
//投票倒计时
let hour = ref(0);
@@ -224,22 +218,14 @@ onUnmounted(() => {
// 答题时间
const answerTime = dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss");
// 选择题目
const choiceQuestion = (order, id, dates, torder) => {
console.log("dates", dates);
const choiceQuestion = (item, value) => {
// 当已经提交过时候 不让选择题目
if (data.value.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;
}
dates.ballotVo.voteStemVoList[torder].optionDetailList[order].isAnswer = true;
console.log(data);
console.log("value", value);
item.optionDetailList?.forEach((t) => (t.isAnswer = false));
value.isAnswer = true;
};
// 提交投票
const submitVote = () => {
@@ -258,35 +244,11 @@ const submitVote = () => {
if (data.value.isSubmit) {
return;
}
data.value.isSubmit = true;
let isSubmit = true;
let isSubArr = [];
console.log(
" data.ballotVo.voteStemVoList",
data.value.ballotVo.voteStemVoList
);
for (let i = 0; i < data.value.ballotVo.voteStemVoList.length; i++) {
for (
let j = 0;
j < data.value.ballotVo.voteStemVoList[i].optionDetailList.length;
j++
) {
if (data.value.ballotVo.voteStemVoList[i].optionDetailList[j].isAnswer) {
isSubArr[i] =
data.value.ballotVo.voteStemVoList[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) {
if (
data.value.voteStemDtoList.some((t) =>
t.optionDetailList.every((s) => !s.isAnswer)
)
) {
ElMessage.error("请选择投票问题后进行提交");
return;
}
@@ -298,30 +260,13 @@ const submitVote = () => {
targetId: infoId, // 项目 路径图 id
taskId: id,
type: btype, // 1 项目 2 路径图
voteId: data.value.voteId,
voteId: data.value.id,
voteName: data.value.voteName,
};
console.log("我是投票提交的信息", obj);
useRequest(VOTE_DETAIL_SUBMIT, obj, (e) => {
console.log("eeeeeee", e);
request(VOTE_DETAIL2, {
chapterOrStageId: chapterOrStageId ? chapterOrStageId : 0,
courseId: courseId,
studentId: userInfo.value.id,
targetId: infoId,
type: btype,
taskId: id,
})
.then((res) => {
console.log("投票结果", res);
ElMessage.success("投票成功");
data.value = res.data;
})
.catch((err) => {
console.log(err);
});
});
data.value.isSubmit = !data.value.isSubmit;
console.log("我是投票提交的信息", obj, data);
ElMessage.success("投票成功");
useRequest(VOTE_DETAIL_SUBMIT, obj);
};
</script>

View File

@@ -71,13 +71,13 @@ import ReturnHead from "@/components/ReturnHead.vue";
import { computed, reactive, toRefs, onUnmounted, ref } from "vue";
import img from "@/assets/image/uploadimg.png";
import { request, useRequest } from "@/api/request";
import { EVALUATION_DETAIL, STUDY_RECORD } from "@/api/api";
import { EVALUATION_DETAIL, STUDY_RECORD, EvaluationToLearn } from "@/api/api";
import { useRoute } from "vue-router/dist/vue-router";
import { useRouter } from "vue-router";
import { useUserInfo } from "@/api/utils";
import { ElMessage } from "element-plus";
import dayjs from "dayjs";
import store from "@/store";
const {
query: {
courseId: evaluationId,
@@ -120,10 +120,11 @@ onUnmounted(() => {
clearInterval(timer);
});
const goOuterChain = () => {
console.log("点击去查看");
request(EvaluationToLearn, {
businessType: btype == 1 ? "project" : "learningpath",
chapterId: chapterOrStageId,
courseId: courseId,
courseId: evaluationId,
quizKid: data.value.evaluationTypeId,
routerOrProjectId: infoId,
studentId: userInfo.value.id,
@@ -131,11 +132,11 @@ const goOuterChain = () => {
})
.then((res) => {
console.log(res);
if (res.code == 200) {
let jumpUrl = res.data.quizUrl;
// 此处写跳转url
window.open(jumpUrl, "_top");
}
// if (res.code == 200) {
// let jumpUrl = res.data.quizUrl;
// // 此处写跳转url
// window.open(jumpUrl, "_top");
// }
})
.catch((err) => {
console.log(err);

View File

@@ -2,7 +2,7 @@
* @Author: lixg lixg@dongwu-inc.com
* @Date: 2023-02-06 18:26:23
* @LastEditors: lixg lixg@dongwu-inc.com
* @LastEditTime: 2023-02-19 18:16:49
* @LastEditTime: 2023-03-01 18:27:31
* @FilePath: /stu_h5/src/views/examination/ExternalExam.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
@@ -28,8 +28,8 @@
<div class="btnbox">考试说明</div>
<div class="e_form">
{{
state.datainfo.externalExplain
? state.datainfo.externalExplain
state.datainfo.examinationExplain
? state.datainfo.examinationExplain
: "暂无考试说明"
}}
</div>

View File

@@ -2,7 +2,7 @@
* @Author: lixg lixg@dongwu-inc.com
* @Date: 2023-01-19 14:59:34
* @LastEditors: lixg lixg@dongwu-inc.com
* @LastEditTime: 2023-03-01 14:42:05
* @LastEditTime: 2023-03-01 18:03:05
* @FilePath: /stu_h5/src/views/pathmap/LevelList.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
@@ -27,7 +27,7 @@
<div style="width: 100%; display: flex; justify-content: center">
<div class="levelItem" :style="{ height: listheight }">
<PathDetailImage
img="https://u-pre.boe.com/upload/路径图背景-1671015331292.png"
:img="data?.picUrl"
:routerId="routerId"
></PathDetailImage>
</div>

View File

@@ -428,6 +428,17 @@ function toFinish(d) {
pid: routerId,
name: d.name,
});
// 项目任务 直接跳转项目详情
if (d.type == 13) {
// 此处判断跳转项目详情界面
router.push({
path: "/projectdetails",
query: {
projectId: d.courseId,
},
});
return;
}
const path =
typeof TASK_TYPES.path[d.type] === "string"
? TASK_TYPES.path[d.type]