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 * @Author: lixg lixg@dongwu-inc.com
* @Date: 2023-01-13 11:42:48 * @Date: 2023-01-13 11:42:48
* @LastEditors: lixg lixg@dongwu-inc.com * @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 * @FilePath: /stu_h5/src/api/api.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @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_DETAIL = '/discussSubmit/detail'
export const DISCUSS_SUBMIT_REVIEW_LIST = '/discussSubmit/queryDiscussSubmitAndReview' export const DISCUSS_SUBMIT_REVIEW_LIST = '/discussSubmit/queryDiscussSubmitAndReview'
export const VOTE_DETAIL2 = `/vote/queryVoteById` 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查询讨论发表的帖子 // -- 根据讨论的Id查询讨论发表的帖子

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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