2022-10-21 10:53:24 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view class="page">
|
|
|
|
|
|
<div class="line-bg"></div>
|
|
|
|
|
|
<div class="banner-top">
|
2022-10-27 10:43:07 +08:00
|
|
|
|
<image
|
|
|
|
|
|
src="https://cdn.cunwuyun.cn/img/election-banner.png"
|
|
|
|
|
|
class="banner-img"
|
|
|
|
|
|
></image>
|
|
|
|
|
|
<span class="tips" @click="viewMask()"
|
|
|
|
|
|
><image
|
|
|
|
|
|
src="https://cdn.cunwuyun.cn/img/explain-icon.png"
|
|
|
|
|
|
class="tips-icon"
|
|
|
|
|
|
></image
|
|
|
|
|
|
>投票说明</span
|
|
|
|
|
|
>
|
|
|
|
|
|
<image
|
|
|
|
|
|
src="https://cdn.cunwuyun.cn/img/party-icon.png"
|
|
|
|
|
|
class="party-icon"
|
|
|
|
|
|
></image>
|
2022-10-21 10:53:24 +08:00
|
|
|
|
<div class="banner-info">
|
|
|
|
|
|
<div class="title">{{ title }}</div>
|
2022-10-27 10:43:07 +08:00
|
|
|
|
<div class="num-info">应选人{{ chooseNumber || "0" }}人</div>
|
2022-10-21 10:53:24 +08:00
|
|
|
|
<div class="user-list">
|
|
|
|
|
|
<div class="user-item user-item-title">
|
|
|
|
|
|
<span>候选人</span>
|
|
|
|
|
|
<span>赞成</span>
|
|
|
|
|
|
<span>反对</span>
|
|
|
|
|
|
<span>弃权</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="user-item" v-for="(item, index) in userList" :key="index">
|
|
|
|
|
|
<span>{{ item.candidateUserName }}</span>
|
|
|
|
|
|
<span>
|
2022-10-27 10:43:07 +08:00
|
|
|
|
<image
|
|
|
|
|
|
:src="
|
|
|
|
|
|
item.voteStatus == '0'
|
|
|
|
|
|
? 'https://cdn.cunwuyun.cn/img/circle-check.png'
|
|
|
|
|
|
: 'https://cdn.cunwuyun.cn/img/circle-icon.png'
|
|
|
|
|
|
"
|
|
|
|
|
|
class="check-icon"
|
|
|
|
|
|
@click="checkClick(index, '0')"
|
|
|
|
|
|
></image>
|
|
|
|
|
|
</span>
|
2022-10-21 10:53:24 +08:00
|
|
|
|
<span>
|
2022-10-27 10:43:07 +08:00
|
|
|
|
<image
|
|
|
|
|
|
:src="
|
|
|
|
|
|
item.voteStatus == '1'
|
|
|
|
|
|
? 'https://cdn.cunwuyun.cn/img/circle-check.png'
|
|
|
|
|
|
: 'https://cdn.cunwuyun.cn/img/circle-icon.png'
|
|
|
|
|
|
"
|
|
|
|
|
|
class="check-icon"
|
|
|
|
|
|
@click="checkClick(index, '1')"
|
|
|
|
|
|
></image>
|
|
|
|
|
|
</span>
|
2022-10-21 10:53:24 +08:00
|
|
|
|
<span>
|
2022-10-27 10:43:07 +08:00
|
|
|
|
<image
|
|
|
|
|
|
:src="
|
|
|
|
|
|
item.voteStatus == '2'
|
|
|
|
|
|
? 'https://cdn.cunwuyun.cn/img/circle-check.png'
|
|
|
|
|
|
: 'https://cdn.cunwuyun.cn/img/circle-icon.png'
|
|
|
|
|
|
"
|
|
|
|
|
|
class="check-icon"
|
|
|
|
|
|
@click="checkClick(index, '2')"
|
|
|
|
|
|
></image>
|
|
|
|
|
|
</span>
|
2022-10-21 10:53:24 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="btn-bottom">
|
|
|
|
|
|
<div class="btn" @click="submitVote()">提交投票</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<view class="mask" v-if="showMask">
|
|
|
|
|
|
<view class="mask-content">
|
|
|
|
|
|
<view class="mask-title">投票说明</view>
|
2022-10-26 17:25:10 +08:00
|
|
|
|
<!-- <view class="mask-text">1、本次选举采用无记名投票方式,差额选举的办法</view>
|
|
|
|
|
|
<view class="mask-text">2、选举工作由选举委员会主持,未尽事宜由选举委员会研究决定。</view> -->
|
|
|
|
|
|
<view class="mask-text">{{ votingInstructions }}</view>
|
2022-10-21 10:53:24 +08:00
|
|
|
|
<view class="mask-btn" @click="closeMask()">关闭</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script>
|
2022-10-27 10:43:07 +08:00
|
|
|
|
import { mapState } from "vuex";
|
2022-10-21 10:53:24 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
computed: {
|
2022-10-27 10:43:07 +08:00
|
|
|
|
...mapState(["user"]),
|
2022-10-21 10:53:24 +08:00
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
2022-10-27 10:43:07 +08:00
|
|
|
|
detailId: "",
|
2022-10-21 10:53:24 +08:00
|
|
|
|
userList: [],
|
|
|
|
|
|
showMask: false,
|
2022-10-27 10:43:07 +08:00
|
|
|
|
title: "",
|
|
|
|
|
|
chooseNumber: "",
|
|
|
|
|
|
partyId: "",
|
|
|
|
|
|
votingInstructions: "",
|
2022-10-21 10:53:24 +08:00
|
|
|
|
};
|
|
|
|
|
|
},
|
|
|
|
|
|
onLoad(options) {
|
2022-10-27 10:43:07 +08:00
|
|
|
|
this.detailId = options.id;
|
|
|
|
|
|
this.partyId = this.user.partyId;
|
|
|
|
|
|
this.getDetailInfo();
|
2022-10-21 10:53:24 +08:00
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
submitVote() {
|
2022-10-27 10:43:07 +08:00
|
|
|
|
var flags = true;
|
|
|
|
|
|
var checkNum = 0;
|
|
|
|
|
|
var checkList = [];
|
2022-10-21 10:53:24 +08:00
|
|
|
|
this.userList.map((item) => {
|
|
|
|
|
|
if (item.voteStatus) {
|
2022-10-27 10:43:07 +08:00
|
|
|
|
checkNum++;
|
|
|
|
|
|
checkList.push(item);
|
2022-10-21 10:53:24 +08:00
|
|
|
|
}
|
2022-10-27 10:43:07 +08:00
|
|
|
|
});
|
2022-10-21 10:53:24 +08:00
|
|
|
|
|
|
|
|
|
|
if (checkNum > this.chooseNumber) {
|
2022-10-27 10:43:07 +08:00
|
|
|
|
uni.showToast({ title: `投票人数大于应选人数,请重试`, icon: "none" });
|
|
|
|
|
|
flags = false;
|
2022-10-21 10:53:24 +08:00
|
|
|
|
}
|
2022-10-26 17:25:10 +08:00
|
|
|
|
if (checkNum < this.chooseNumber) {
|
2022-10-27 10:43:07 +08:00
|
|
|
|
uni.showToast({ title: `请给候选人投票`, icon: "none" });
|
|
|
|
|
|
flags = false;
|
2022-10-21 10:53:24 +08:00
|
|
|
|
}
|
2022-10-26 17:25:10 +08:00
|
|
|
|
// if (checkNum < this.userList.length) {
|
|
|
|
|
|
// uni.showToast({title: `请给候选人投票`, icon: 'none'})
|
|
|
|
|
|
// flags = false
|
|
|
|
|
|
// }
|
2022-10-27 10:43:07 +08:00
|
|
|
|
|
|
|
|
|
|
if (!flags) return;
|
|
|
|
|
|
this.$instance
|
|
|
|
|
|
.post("/app/appgeneralelectioninfo/vote", checkList)
|
|
|
|
|
|
.then((res) => {
|
|
|
|
|
|
if (res.code == 0) {
|
|
|
|
|
|
uni.showToast({ title: "投票成功!" });
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
|
uni.navigateBack({
|
|
|
|
|
|
delta: 1,
|
|
|
|
|
|
});
|
|
|
|
|
|
}, 1000);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2022-10-21 10:53:24 +08:00
|
|
|
|
},
|
|
|
|
|
|
checkClick(index, status) {
|
|
|
|
|
|
if (this.userList[index].voteStatus == status) {
|
2022-10-27 10:43:07 +08:00
|
|
|
|
this.userList[index].voteStatus = "";
|
2022-10-21 10:53:24 +08:00
|
|
|
|
} else {
|
2022-10-27 10:43:07 +08:00
|
|
|
|
this.userList[index].voteStatus = status;
|
2022-10-21 10:53:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
closeMask() {
|
2022-10-27 10:43:07 +08:00
|
|
|
|
this.showMask = false;
|
2022-10-21 10:53:24 +08:00
|
|
|
|
},
|
|
|
|
|
|
viewMask() {
|
2022-10-27 10:43:07 +08:00
|
|
|
|
this.showMask = true;
|
2022-10-21 10:53:24 +08:00
|
|
|
|
},
|
|
|
|
|
|
getDetailInfo() {
|
2022-10-27 10:43:07 +08:00
|
|
|
|
this.$instance
|
|
|
|
|
|
.post(
|
|
|
|
|
|
`/app/appgeneralelectioninfo/queryDetailById?id=${this.detailId}`,
|
|
|
|
|
|
null
|
|
|
|
|
|
)
|
|
|
|
|
|
.then((res) => {
|
|
|
|
|
|
if (res.data) {
|
|
|
|
|
|
this.votingInstructions = res.data.votingInstructions;
|
|
|
|
|
|
this.chooseNumber = res.data.chooseNumber;
|
|
|
|
|
|
this.title = res.data.title;
|
|
|
|
|
|
res.data.candidateUsers.map((item) => {
|
|
|
|
|
|
var info = {
|
|
|
|
|
|
candidateUserId: item.id,
|
|
|
|
|
|
candidateUserName: item.name,
|
|
|
|
|
|
electionId: this.detailId,
|
|
|
|
|
|
voteStatus: "",
|
|
|
|
|
|
voterUserId: this.partyId,
|
|
|
|
|
|
};
|
|
|
|
|
|
this.userList.push(info);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2022-10-21 10:53:24 +08:00
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
};
|
|
|
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scope>
|
|
|
|
|
|
.page {
|
|
|
|
|
|
.line-bg {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 12px;
|
2022-10-27 10:43:07 +08:00
|
|
|
|
background-color: #e60012;
|
2022-10-21 10:53:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.banner-top {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 340px;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
|
|
|
|
.banner-img {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 340px;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
z-index: 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.tips {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
right: 42px;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
font-size: 30px;
|
|
|
|
|
|
z-index: 88;
|
2022-10-27 10:43:07 +08:00
|
|
|
|
top: 137px;
|
2022-10-21 10:53:24 +08:00
|
|
|
|
|
|
|
|
|
|
.tips-icon {
|
|
|
|
|
|
width: 40px;
|
|
|
|
|
|
height: 40px;
|
|
|
|
|
|
vertical-align: text-top;
|
|
|
|
|
|
margin-right: 8px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.party-icon {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
z-index: 3;
|
|
|
|
|
|
width: 140px;
|
|
|
|
|
|
height: 140px;
|
|
|
|
|
|
left: 50%;
|
|
|
|
|
|
margin-left: -70rpx;
|
|
|
|
|
|
top: 180px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.banner-info {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
z-index: 2;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
padding-bottom: 136px;
|
2022-10-27 10:43:07 +08:00
|
|
|
|
|
2022-10-21 10:53:24 +08:00
|
|
|
|
|
|
|
|
|
|
.title {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
font-size: 44px;
|
|
|
|
|
|
font-family: PingFangSC-Semibold, PingFang SC;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
text-align: center;
|
2022-10-27 10:43:07 +08:00
|
|
|
|
padding: 12px 0 10px 0;
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
display: -webkit-box;
|
|
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
|
|
-webkit-line-clamp: 2;
|
2022-10-21 10:53:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.num-info {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
font-size: 36px;
|
|
|
|
|
|
font-family: PingFangSC-Semibold, PingFang SC;
|
|
|
|
|
|
line-height: 50px;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
margin-bottom: 80px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.user-list {
|
|
|
|
|
|
width: 710px;
|
|
|
|
|
|
background: #fff;
|
|
|
|
|
|
border-radius: 24px 24px 0 0;
|
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
|
|
|
|
|
|
|
.user-item {
|
|
|
|
|
|
width: 688px;
|
|
|
|
|
|
height: 112px;
|
|
|
|
|
|
line-height: 112px;
|
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
|
border-bottom: 2px solid #eee;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
font-size: 32px;
|
|
|
|
|
|
color: #666;
|
|
|
|
|
|
|
|
|
|
|
|
span {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
|
|
|
|
.check-icon {
|
|
|
|
|
|
width: 40px;
|
|
|
|
|
|
height: 40px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.user-item:nth-last-of-type(1) {
|
|
|
|
|
|
border-bottom: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.user-item-title {
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
font-size: 34px;
|
|
|
|
|
|
padding-top: 88px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.btn-bottom {
|
|
|
|
|
|
position: fixed;
|
|
|
|
|
|
bottom: 0;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
z-index: 9;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
|
|
|
|
.btn {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
line-height: 112px;
|
2022-10-27 10:43:07 +08:00
|
|
|
|
background: #e60012;
|
2022-10-21 10:53:24 +08:00
|
|
|
|
color: #fff;
|
|
|
|
|
|
font-size: 32px;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.mask {
|
|
|
|
|
|
position: fixed;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
2022-10-27 10:43:07 +08:00
|
|
|
|
background: rgba(0, 0, 0, 0.3);
|
2022-10-21 10:53:24 +08:00
|
|
|
|
z-index: 99;
|
|
|
|
|
|
|
|
|
|
|
|
.mask-content {
|
|
|
|
|
|
width: 560px;
|
|
|
|
|
|
height: 680px;
|
|
|
|
|
|
background: #fff;
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
border: 2px solid rgba(151, 151, 151, 1);
|
|
|
|
|
|
margin: 200px auto 0;
|
|
|
|
|
|
padding: 48px 48px 0;
|
|
|
|
|
|
box-sizing: border-box;
|
2022-10-28 09:46:14 +08:00
|
|
|
|
|
2022-10-21 10:53:24 +08:00
|
|
|
|
|
|
|
|
|
|
.mask-title {
|
|
|
|
|
|
font-size: 32px;
|
|
|
|
|
|
font-family: PingFangSC-Medium, PingFang SC;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
line-height: 44px;
|
|
|
|
|
|
margin-bottom: 36px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.mask-text {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
line-height: 44px;
|
|
|
|
|
|
font-size: 28px;
|
2022-10-28 09:46:14 +08:00
|
|
|
|
height: 460px;
|
2022-10-21 10:53:24 +08:00
|
|
|
|
font-family: PingFangSC-Medium, PingFang SC;
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
word-break: break-all;
|
2022-10-28 09:46:14 +08:00
|
|
|
|
overflow-y: scroll;
|
2022-10-21 10:53:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.mask-btn {
|
|
|
|
|
|
width: 128px;
|
|
|
|
|
|
height: 40px;
|
|
|
|
|
|
font-size: 28px;
|
|
|
|
|
|
font-family: PingFangSC-Medium, PingFang SC;
|
|
|
|
|
|
font-weight: 500;
|
2022-10-27 10:43:07 +08:00
|
|
|
|
color: #1365dd;
|
2022-10-21 10:53:24 +08:00
|
|
|
|
line-height: 40px;
|
2022-10-28 09:46:14 +08:00
|
|
|
|
margin: 30px 0 20px 332px;
|
2022-10-21 10:53:24 +08:00
|
|
|
|
text-align: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|