投票完成

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,19 +1,19 @@
<template> <template>
<section class="AppVote"> <section class="AppVote">
<AiGroup title="前置图文" noBorder description> <AiGroup noBorder description class="mar-b32">
<u-parse :html="detail.frontDisplay"/> <u-parse :html="detail.preface"/>
</AiGroup> </AiGroup>
<div class="voteItem" flex @click="handleDetail(1)"> <div class="voteItem" flex @click="handleDetail(row.id)" v-for="row in list" :key="row.id">
<div class="fill"> <div class="fill">
<b class="mar-b8" v-text="`月落乌啼霜满天`"/> <b class="mar-b16" v-text="row.videoName"/>
<div class="color-999 line3" v-text="`微信公众号是开发者或商家在微信公众平台上申请的应用账号该帐号与QQ账号互通该帐号与账号互通…`"/> <div class="color-999 line3" v-text="row.videoIntroduction"/>
</div> </div>
<div class="thumb"> <div class="thumb" :style="{backgroundImage:row.imageFileUrl}">
<span v-text="`12345票`"/> <span v-text="`${row.voteNumber}票`"/>
</div> </div>
</div> </div>
<AiGroup title="结尾图文" noBorder description> <AiGroup noBorder description>
<u-parse :html="detail.endDisplay"/> <u-parse :html="detail.ending"/>
</AiGroup> </AiGroup>
</section> </section>
</template> </template>
@@ -24,26 +24,38 @@ export default {
appName: "公众投票", appName: "公众投票",
data() { data() {
return { return {
detail: {} detail: {},
list: []
} }
}, },
methods: { methods: {
getDetail() { getDetail() {
this.$http.post("/app/vote/detail", null, {}) this.$http.post("/app/appvideovoteconfig/queryDetailByCorpId", null, {
withoutToken: true
}).then(res => {
if (res?.data) {
this.detail = res.data
}
})
}, },
getList() { getList() {
this.$http.post("/app/vote/list", null, {}) this.$http.post("/app/appvideoinfo/list", null, {
withoutToken: true,
param: {size: 20}
}).then(res => {
if (res?.data) {
this.list = res.data.records
}
})
}, },
handleDetail(id) { handleDetail(id) {
uni.navigateTo({url: './voteDetail?id=' + id}) uni.navigateTo({url: './voteDetail?id=' + id})
} }
}, },
created() { onShow() {
// this.getDetail() this.getDetail()
// this.getList() this.getList()
}, },
} }
</script> </script>
@@ -52,6 +64,12 @@ export default {
min-height: 100vh; min-height: 100vh;
background: #fff; background: #fff;
.AiGroup {
width: 100%;
padding-right: 32px;
box-sizing: border-box;
}
.voteItem { .voteItem {
height: 240px; height: 240px;
border: 1px solid #CCCCCC; border: 1px solid #CCCCCC;
@@ -60,6 +78,7 @@ export default {
padding: 24px; padding: 24px;
box-sizing: border-box; box-sizing: border-box;
font-family: PingFangSC; font-family: PingFangSC;
align-items: flex-start;
b { b {
font-size: 34px; font-size: 34px;

View File

@@ -1,10 +1,13 @@
<template> <template>
<section class="voteDetail"> <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"> <AiBottomBtn background="#fff">
<div flex class="pad-l32 pad-r16 pad-b16 pad-t16"> <div flex class="pad-l32 pad-r16 pad-b16 pad-t16">
<AiHighlight class="fill color-999" content="当前票数:@v" value="21345" color="#FF6900"/> <AiHighlight class="fill color-999" content="当前票数:@v" :value="detail.voteNumber" color="#FF6900"/>
<div class="text circle mar-l16" @click="handleVote">投票</div> <div class="text circle mar-l16" :class="{disabled:canotVote}" @click="handleVote">投票</div>
</div> </div>
</AiBottomBtn> </AiBottomBtn>
</section> </section>
@@ -18,7 +21,8 @@ export default {
appName: "投票详情", appName: "投票详情",
computed: { computed: {
...mapState(['user']), ...mapState(['user']),
wxCode: v => v.$route.query.code wxCode: v => v.$route.query.code,
canotVote: v => v.detail.isVote == '0' && v.user.token
}, },
data() { data() {
return { return {
@@ -28,10 +32,11 @@ export default {
methods: { methods: {
...mapActions(['getWechatToken', 'getCode']), ...mapActions(['getWechatToken', 'getCode']),
getDetail() { 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) { if (res?.data) {
this.detail = res.data this.detail = res.data
document.title = this.detail.name document.title = this.detail.videoName
} }
}) })
}, },
@@ -43,7 +48,17 @@ export default {
} }
}) })
} else {//已登录,直接投票 } 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 { .voteDetail {
background: #F3F6F9; background: #F3F6F9;
min-height: 100vh; min-height: 100vh;
::v-deep.disabled {
filter: grayscale(100%);
}
::v-deep video {
width: 100%;
}
} }
</style> </style>