投票完成

This commit is contained in:
aixianling
2022-12-30 18:10:03 +08:00
parent 5c5997a5a8
commit e620c4d94b
2 changed files with 66 additions and 24 deletions

View File

@@ -1,10 +1,13 @@
<template>
<section class="voteDetail">
<u-parse :html="detail.endDisplay"/>
<AiItem top-label :label="detail.videoName" :border="false" labelBold>
<u-parse class="mar-b8" :html="detail.videoIntroduction"/>
<video :src="detail.videoFileUrl"/>
</AiItem>
<AiBottomBtn background="#fff">
<div flex class="pad-l32 pad-r16 pad-b16 pad-t16">
<AiHighlight class="fill color-999" content="当前票数:@v" value="21345" color="#FF6900"/>
<div class="text circle mar-l16" @click="handleVote">投票</div>
<AiHighlight class="fill color-999" content="当前票数:@v" :value="detail.voteNumber" color="#FF6900"/>
<div class="text circle mar-l16" :class="{disabled:canotVote}" @click="handleVote">投票</div>
</div>
</AiBottomBtn>
</section>
@@ -18,7 +21,8 @@ export default {
appName: "投票详情",
computed: {
...mapState(['user']),
wxCode: v => v.$route.query.code
wxCode: v => v.$route.query.code,
canotVote: v => v.detail.isVote == '0' && v.user.token
},
data() {
return {
@@ -28,10 +32,11 @@ export default {
methods: {
...mapActions(['getWechatToken', 'getCode']),
getDetail() {
this.$http.post("/app/vote/detail", null, {}).then(res => {
const {id} = this.$route.query
this.$http.post("/app/appvideoinfo/queryDetailById", null, {params: {id}, withoutToken: true}).then(res => {
if (res?.data) {
this.detail = res.data
document.title = this.detail.name
document.title = this.detail.videoName
}
})
},
@@ -43,7 +48,17 @@ export default {
}
})
} else {//已登录,直接投票
console.log("投票")
if (!this.canotVote) {
const {id} = this.$route.query
this.$http.post("/app/appvideovoteinfo/voteByVideoId", null, {
params: {id}
}).then(res => {
if (res?.code == 0) {
this.$u.toast("投票成功!")
this.getDetail()
}
})
}
}
},
},
@@ -60,5 +75,13 @@ export default {
.voteDetail {
background: #F3F6F9;
min-height: 100vh;
::v-deep.disabled {
filter: grayscale(100%);
}
::v-deep video {
width: 100%;
}
}
</style>