This commit is contained in:
yanran200730
2022-01-07 15:41:59 +08:00
parent bfc8a6ddc3
commit 8c8b8637ce

View File

@@ -42,10 +42,24 @@
</div>
<div v-else-if="data.type == 1" class="comments">
<span class="totalCount">
<span class="total">{{ data.voteType === '1' ? '投票清单(可多选)' : '投票清单' }}</span>
<span class="rightCount">
<u-icon name="clock" v-if="data.status === '0'"></u-icon>
<u-count-down v-if="data.status === '0'" :timestamp="timestamp" separator="zh" show-days show-hours show-minutes show-seconds></u-count-down>
<span style="color: #999" v-else>已截止</span>
</span>
</span>
<div class="comments-vote">
<div class="vote-item" v-for="(item, index) in data.voteList" :key="index">
<span>{{ item.content }}</span>
<i>{{ item.count }}</i>
<em :style="{width: item.percentage}"></em>
</div>
</div>
</div>
<div class="bottomInput" v-if="isAnnouncer && data.status === '0'">
<div class="bottomInput" v-if="isAnnouncer && data.status === '0' && data.type === '0'">
<div class="leftInput" @click="showBottomInput = true">我来说两句...</div>
</div>
@@ -124,6 +138,19 @@ export default {
if (discussTime >= nowTime) {
this.timestamp = discussTime - nowTime
}
if (res.data.voteType === '1') {
const total = Object.values(res.data.statistic).reduce((x, y) => {
return x + y
})
this.data.voteList = res.data.voteItems.map(v => {
return {
...v,
count: res.data.statistic[v.item],
percentage: (res.data.statistic[v.item] / total) * 100 + '%'
}
})
}
}
})
},
@@ -320,6 +347,46 @@ export default {
padding: 0 32px 20px;
font-size: 28px;
background: #fff;
.vote-item {
display: flex;
position: relative;
align-items: center;
justify-content: space-between;
height: 64px;
line-height: 64px;
margin-bottom: 16px;
padding: 0 32px;
background: #FFFFFF;
border-radius: 8px;
overflow: hidden;
border: 1px solid #95CBFF;
em {
position: absolute;
left: 0;
top: 0;
z-index: 0;
height: 100%;
background: #DCE8F4;
}
span {
position: relative;
z-index: 1;
color: #5B84B3;
font-size: 28px;
}
i {
position: relative;
z-index: 1;
font-style: normal;
color: #5B84B3;
font-size: 28px;
}
}
.totalCount {
display: flex;
justify-content: space-between;