From ef66995ad06179a03013cb30dbd3a7cc35ded899 Mon Sep 17 00:00:00 2001 From: lixg Date: Mon, 6 Mar 2023 21:22:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E4=BF=AE=E6=94=B9=E6=8A=95=E7=A5=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/api.js | 6 ++++-- src/router/index.js | 3 ++- src/views/ballotpage/BallotPage.vue | 22 ++++++++++++++++++++-- src/views/discuss/DiscussDetail.vue | 2 +- src/views/discuss/DiscussPage.vue | 4 ++-- 5 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/api/api.js b/src/api/api.js index 023a3f6..278dc97 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -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-03-03 13:47:22 + * @LastEditTime: 2023-03-06 21:08:50 * @FilePath: /stu_h5/src/api/api.js * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -84,4 +84,6 @@ export const UPDATE_CURRENT_TASK = `/admin/student/updateCurrentTask post` export const EvaluationToLearn = '/evaluation/evaluationToLearn post' export const FILE_UPLOAD_IMG = import.meta.env.VITE_BASE_API + 'file/img' // 查询单个测评的状态 -export const QueryEvaluationTaskStatusOne = `/evaluation/queryEvaluationTaskStatusOne` \ No newline at end of file +export const QueryEvaluationTaskStatusOne = `/evaluation/queryEvaluationTaskStatusOne` +// 投票浏览和参与数目 +export const EditVoteInvolvedAndBrowse = `/vote/editVoteInvolvedAndBrowse post` \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index 7b1873d..1c2f4ca 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -2,7 +2,7 @@ * @Author: lixg lixg@dongwu-inc.com * @Date: 2023-02-08 09:50:10 * @LastEditors: lixg lixg@dongwu-inc.com - * @LastEditTime: 2023-02-19 10:36:48 + * @LastEditTime: 2023-03-06 18:36:53 * @FilePath: /stu_h5/src/router/index.js * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -23,6 +23,7 @@ const router = createRouter({ routes }) router.beforeEach((to, from, next) => { + console.log('toooooooo', to) if (!getCookie('token')) { if (import.meta.env.MODE === "development" || import.meta.env.MODE === "test") { to.path.includes('/login') ? next() : next({ path: '/login', query: { returnUrl: to.fullPath } }) diff --git a/src/views/ballotpage/BallotPage.vue b/src/views/ballotpage/BallotPage.vue index 091e629..772c7e5 100644 --- a/src/views/ballotpage/BallotPage.vue +++ b/src/views/ballotpage/BallotPage.vue @@ -177,7 +177,11 @@ import { reactive, toRefs, computed, onUnmounted, ref, watch } from "vue"; import ReturnHead from "@/components/ReturnHead.vue"; // import TitleHead from "@/components/TitleHead.vue"; import { useRequest, request } from "@/api/request"; -import { VOTE_DETAIL3, VOTE_DETAIL_SUBMIT } from "@/api/api"; +import { + VOTE_DETAIL3, + VOTE_DETAIL_SUBMIT, + EditVoteInvolvedAndBrowse, +} from "@/api/api"; import dayjs from "dayjs"; import store from "@/store"; import { ElMessage } from "element-plus"; @@ -194,7 +198,13 @@ const { data } = useRequest(VOTE_DETAIL3, { voteId: courseId, type }, (e) => { }); } }); - +// 增加浏览量 +watch(data, () => { + useRequest(EditVoteInvolvedAndBrowse, { + operationType: "2", + voteId: data.value.id, + }); +}); console.log("投票基本信息", data); //投票倒计时 let hour = ref(0); @@ -273,7 +283,15 @@ const submitVote = () => { data.value.isSubmit = !data.value.isSubmit; console.log("我是投票提交的信息", obj, data); ElMessage.success("投票成功"); + + // data.value.votesTotal = Number(data.value.votesTotal) + 1; + // data.value.numberOfBrowse = Number(data.value.numberOfBrowse) + 1; useRequest(VOTE_DETAIL_SUBMIT, obj); + // 增加参与数目 + useRequest(EditVoteInvolvedAndBrowse, { + operationType: "1", + voteId: data.value.id, + }); }; diff --git a/src/views/discuss/DiscussDetail.vue b/src/views/discuss/DiscussDetail.vue index cbfd95d..38967f4 100644 --- a/src/views/discuss/DiscussDetail.vue +++ b/src/views/discuss/DiscussDetail.vue @@ -363,7 +363,7 @@ const hfPage = ref({ //获取讨论详情 const discussInfo = ref(""); request(DISCUSS_LIST, { - type: type == 1 ? 2 : 1, + type: type, id: targetId, }) .then((e) => { diff --git a/src/views/discuss/DiscussPage.vue b/src/views/discuss/DiscussPage.vue index 423300b..4d71e11 100644 --- a/src/views/discuss/DiscussPage.vue +++ b/src/views/discuss/DiscussPage.vue @@ -37,7 +37,7 @@