feat:修改投票

This commit is contained in:
lixg
2023-03-06 21:22:35 +08:00
parent 089b8ab195
commit ef66995ad0
5 changed files with 29 additions and 8 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-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
*/
@@ -85,3 +85,5 @@ export const EvaluationToLearn = '/evaluation/evaluationToLearn post'
export const FILE_UPLOAD_IMG = import.meta.env.VITE_BASE_API + 'file/img'
// 查询单个测评的状态
export const QueryEvaluationTaskStatusOne = `/evaluation/queryEvaluationTaskStatusOne`
// 投票浏览和参与数目
export const EditVoteInvolvedAndBrowse = `/vote/editVoteInvolvedAndBrowse post`

View File

@@ -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 } })

View File

@@ -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,
});
};
</script>

View File

@@ -363,7 +363,7 @@ const hfPage = ref({
//获取讨论详情
const discussInfo = ref("");
request(DISCUSS_LIST, {
type: type == 1 ? 2 : 1,
type: type,
id: targetId,
})
.then((e) => {

View File

@@ -37,7 +37,7 @@
</button>
<div class="dd"></div>
<button
@click="hotPost(state.info.discussDtoList[0].id)"
@click="hotPost(info.discussDtoList[0].id)"
:class="searchType === 2 ? 'new samebtn' : 'samebtn hot'"
>
最热
@@ -433,7 +433,7 @@ watch(state.postList, () => {
color: #6e7b84;
font-size: 13px;
line-height: 24px;
max-height: 103px;
max-height: 200px;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;