Files
dvcp_v2_wxcp_app/src/project/fengdu/AppVote/AppVote.vue

154 lines
3.4 KiB
Vue
Raw Normal View History

2022-12-29 14:35:15 +08:00
<template>
<section class="AppVote">
2022-12-30 18:10:03 +08:00
<AiGroup noBorder description class="mar-b32">
<u-parse :html="detail.preface"/>
2022-12-29 14:35:15 +08:00
</AiGroup>
2022-12-30 18:10:03 +08:00
<div class="voteItem" flex @click="handleDetail(row.id)" v-for="row in list" :key="row.id">
2022-12-29 14:35:15 +08:00
<div class="fill">
2022-12-30 18:10:03 +08:00
<b class="mar-b16" v-text="row.videoName"/>
<div class="color-999 line3" v-text="row.videoIntroduction"/>
2022-12-29 14:35:15 +08:00
</div>
2023-01-03 10:17:47 +08:00
<div class="thumb">
<img :src="row.imageFileUrl"/>
2022-12-30 18:10:03 +08:00
<span v-text="`${row.voteNumber}票`"/>
2022-12-29 14:35:15 +08:00
</div>
</div>
2022-12-30 18:10:03 +08:00
<AiGroup noBorder description>
<u-parse :html="detail.ending"/>
2022-12-29 14:35:15 +08:00
</AiGroup>
2023-01-03 15:12:00 +08:00
<u-gap height="160"/>
2023-01-03 17:13:48 +08:00
<weixin-login :autoShow="!user.token" :visible.sync="wxLogin" content="投票需要您授权您的微信信息" @login="getList"/>
2022-12-29 14:35:15 +08:00
</section>
</template>
<script>
2023-01-03 15:06:38 +08:00
import {mapState} from "vuex"
2023-01-03 17:13:48 +08:00
import WeixinLogin from "./component/weixinLogin";
2023-01-03 15:06:38 +08:00
2022-12-29 14:35:15 +08:00
export default {
name: "AppVote",
2023-01-03 15:06:38 +08:00
components: {WeixinLogin},
2023-01-05 08:47:40 +08:00
appName: "“微视频”大赛",
2022-12-29 14:35:15 +08:00
data() {
return {
2022-12-30 18:10:03 +08:00
detail: {},
2023-01-03 16:20:23 +08:00
list: [],
2023-01-05 08:42:25 +08:00
wxLogin: 0,
current: 1,
total: 0
2022-12-29 14:35:15 +08:00
}
},
2023-01-03 15:06:38 +08:00
computed: {
...mapState(['user']),
},
2022-12-29 14:35:15 +08:00
methods: {
2023-01-05 08:42:25 +08:00
getDetail(retry = false) {
2022-12-30 18:10:03 +08:00
this.$http.post("/app/appvideovoteconfig/queryDetailByCorpId", null, {
2023-01-05 08:42:25 +08:00
withoutToken: !this.user.token || retry
2022-12-30 18:10:03 +08:00
}).then(res => {
if (res?.data) {
this.detail = res.data
}
2023-01-04 14:01:49 +08:00
}).catch(() => !retry && this.getList(true))
2022-12-29 14:35:15 +08:00
},
2023-01-05 08:42:25 +08:00
getList() {
const {current, total, list} = this
if (current == 1 || list.length < total) {
current == 1 && (this.list = [])
this.$http.post("/app/appvideoinfo/list", null, {
withoutToken: true,
params: {current}
}).then(res => {
if (res?.data) {
this.list = [this.list, res.data.records].flat().filter(Boolean)
this.total = res.data.total
}
})
}
},
2022-12-29 14:35:15 +08:00
handleDetail(id) {
2023-01-03 17:13:48 +08:00
if (!this.user.token) this.wxLogin++
2023-01-03 16:20:23 +08:00
else uni.navigateTo({url: './voteDetail?id=' + id})
2022-12-29 14:35:15 +08:00
}
},
2022-12-30 18:10:03 +08:00
onShow() {
this.getDetail()
this.getList()
2022-12-29 14:35:15 +08:00
},
2023-01-05 08:42:25 +08:00
onReachBottom() {
this.current++
this.getList()
}
2022-12-29 14:35:15 +08:00
}
</script>
<style lang="scss" scoped>
.AppVote {
min-height: 100vh;
background: #fff;
2022-12-30 18:10:03 +08:00
.AiGroup {
width: 100%;
padding-right: 32px;
box-sizing: border-box;
}
2022-12-29 14:35:15 +08:00
.voteItem {
height: 240px;
border: 1px solid #CCCCCC;
border-radius: 16px;
margin: 0 32px 24px;
padding: 24px;
box-sizing: border-box;
font-family: PingFangSC;
2022-12-30 18:10:03 +08:00
align-items: flex-start;
2022-12-29 14:35:15 +08:00
b {
font-size: 34px;
color: #333333;
display: block;
line-height: 48px;
2023-01-03 15:10:38 +08:00
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
2022-12-29 14:35:15 +08:00
}
.line3 {
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}
.thumb {
position: relative;
flex-shrink: 0;
margin-left: 24px;
width: 192px;
height: 192px;
border-radius: 8px;
overflow: hidden;
background-repeat: no-repeat;
background-size: 100%;
background-color: #eee;
& > span {
position: absolute;
right: 0;
top: 0;
padding: 0 8px;
line-height: 44px;
background: #FF883C;
color: #fff;
2023-01-03 10:17:47 +08:00
z-index: 2;
}
& > img {
width: 100%;
height: 100%;
2022-12-29 14:35:15 +08:00
}
}
}
}
</style>