超出隐藏
This commit is contained in:
		@@ -2,12 +2,24 @@
 | 
			
		||||
  <view class="page">
 | 
			
		||||
    <div class="line-bg"></div>
 | 
			
		||||
    <div class="banner-top">
 | 
			
		||||
      <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>
 | 
			
		||||
      <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>
 | 
			
		||||
      <div class="banner-info">
 | 
			
		||||
        <div class="title">{{ title }}</div>
 | 
			
		||||
        <div class="num-info">应选人{{ chooseNumber || '0' }}人</div>
 | 
			
		||||
        <div class="num-info">应选人{{ chooseNumber || "0" }}人</div>
 | 
			
		||||
        <div class="user-list">
 | 
			
		||||
          <div class="user-item user-item-title">
 | 
			
		||||
            <span>候选人</span>
 | 
			
		||||
@@ -18,20 +30,38 @@
 | 
			
		||||
          <div class="user-item" v-for="(item, index) in userList" :key="index">
 | 
			
		||||
            <span>{{ item.candidateUserName }}</span>
 | 
			
		||||
            <span>
 | 
			
		||||
                            <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>
 | 
			
		||||
              <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>
 | 
			
		||||
            <span>
 | 
			
		||||
                            <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>
 | 
			
		||||
              <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>
 | 
			
		||||
            <span>
 | 
			
		||||
                            <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>
 | 
			
		||||
              <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>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
@@ -51,106 +81,112 @@
 | 
			
		||||
  </view>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
import {mapState} from 'vuex'
 | 
			
		||||
import { mapState } from "vuex";
 | 
			
		||||
export default {
 | 
			
		||||
  computed: {
 | 
			
		||||
    ...mapState(['user']),
 | 
			
		||||
    ...mapState(["user"]),
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      detailId: '',
 | 
			
		||||
      detailId: "",
 | 
			
		||||
      userList: [],
 | 
			
		||||
      showMask: false,
 | 
			
		||||
      title: '',
 | 
			
		||||
      chooseNumber: '',
 | 
			
		||||
      partyId: '',
 | 
			
		||||
      votingInstructions: '',
 | 
			
		||||
      title: "",
 | 
			
		||||
      chooseNumber: "",
 | 
			
		||||
      partyId: "",
 | 
			
		||||
      votingInstructions: "",
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  onLoad(options) {
 | 
			
		||||
    this.detailId = options.id
 | 
			
		||||
    this.partyId = this.user.partyId
 | 
			
		||||
    this.getDetailInfo()
 | 
			
		||||
    this.detailId = options.id;
 | 
			
		||||
    this.partyId = this.user.partyId;
 | 
			
		||||
    this.getDetailInfo();
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    submitVote() {
 | 
			
		||||
      var flags = true
 | 
			
		||||
      var checkNum = 0
 | 
			
		||||
      var checkList = []
 | 
			
		||||
      var flags = true;
 | 
			
		||||
      var checkNum = 0;
 | 
			
		||||
      var checkList = [];
 | 
			
		||||
      this.userList.map((item) => {
 | 
			
		||||
        if (item.voteStatus) {
 | 
			
		||||
          checkNum++
 | 
			
		||||
          checkList.push(item)
 | 
			
		||||
          checkNum++;
 | 
			
		||||
          checkList.push(item);
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
      if (checkNum > this.chooseNumber) {
 | 
			
		||||
        uni.showToast({title: `投票人数大于应选人数,请重试`, icon: 'none'})
 | 
			
		||||
        flags = false
 | 
			
		||||
        uni.showToast({ title: `投票人数大于应选人数,请重试`, icon: "none" });
 | 
			
		||||
        flags = false;
 | 
			
		||||
      }
 | 
			
		||||
      if (checkNum < this.chooseNumber) {
 | 
			
		||||
        uni.showToast({title: `请给候选人投票`, icon: 'none'})
 | 
			
		||||
        flags = false
 | 
			
		||||
        uni.showToast({ title: `请给候选人投票`, icon: "none" });
 | 
			
		||||
        flags = false;
 | 
			
		||||
      }
 | 
			
		||||
      // if (checkNum < this.userList.length) {
 | 
			
		||||
      //   uni.showToast({title: `请给候选人投票`, icon: 'none'})
 | 
			
		||||
      //   flags = false
 | 
			
		||||
      // }
 | 
			
		||||
      
 | 
			
		||||
      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)
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
      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);
 | 
			
		||||
          }
 | 
			
		||||
        });
 | 
			
		||||
    },
 | 
			
		||||
    checkClick(index, status) {
 | 
			
		||||
      if (this.userList[index].voteStatus == status) {
 | 
			
		||||
        this.userList[index].voteStatus = ''
 | 
			
		||||
        this.userList[index].voteStatus = "";
 | 
			
		||||
      } else {
 | 
			
		||||
        this.userList[index].voteStatus = status
 | 
			
		||||
        this.userList[index].voteStatus = status;
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    closeMask() {
 | 
			
		||||
      this.showMask = false
 | 
			
		||||
      this.showMask = false;
 | 
			
		||||
    },
 | 
			
		||||
    viewMask() {
 | 
			
		||||
      this.showMask = true
 | 
			
		||||
      this.showMask = true;
 | 
			
		||||
    },
 | 
			
		||||
    getDetailInfo() {
 | 
			
		||||
      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)
 | 
			
		||||
          })
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
      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);
 | 
			
		||||
            });
 | 
			
		||||
          }
 | 
			
		||||
        });
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style lang="scss" scope>
 | 
			
		||||
 | 
			
		||||
.page {
 | 
			
		||||
  .line-bg {
 | 
			
		||||
    width: 100%;
 | 
			
		||||
    height: 12px;
 | 
			
		||||
    background-color: #E60012;
 | 
			
		||||
    background-color: #e60012;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .banner-top {
 | 
			
		||||
@@ -173,7 +209,7 @@ export default {
 | 
			
		||||
      color: #fff;
 | 
			
		||||
      font-size: 30px;
 | 
			
		||||
      z-index: 88;
 | 
			
		||||
      top: 116px;
 | 
			
		||||
      top: 137px;
 | 
			
		||||
 | 
			
		||||
      .tips-icon {
 | 
			
		||||
        width: 40px;
 | 
			
		||||
@@ -201,16 +237,21 @@ export default {
 | 
			
		||||
      width: 100%;
 | 
			
		||||
      color: #fff;
 | 
			
		||||
      padding-bottom: 136px;
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
      .title {
 | 
			
		||||
        width: 100%;
 | 
			
		||||
        font-size: 44px;
 | 
			
		||||
        font-family: PingFangSC-Semibold, PingFang SC;
 | 
			
		||||
        font-weight: 600;
 | 
			
		||||
        line-height: 60px;
 | 
			
		||||
        text-align: center;
 | 
			
		||||
        padding: 12px 0 40px 0;
 | 
			
		||||
 | 
			
		||||
        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;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .num-info {
 | 
			
		||||
@@ -272,7 +313,7 @@ export default {
 | 
			
		||||
    .btn {
 | 
			
		||||
      width: 100%;
 | 
			
		||||
      line-height: 112px;
 | 
			
		||||
      background: #E60012;
 | 
			
		||||
      background: #e60012;
 | 
			
		||||
      color: #fff;
 | 
			
		||||
      font-size: 32px;
 | 
			
		||||
      text-align: center;
 | 
			
		||||
@@ -285,7 +326,7 @@ export default {
 | 
			
		||||
    left: 0;
 | 
			
		||||
    width: 100%;
 | 
			
		||||
    height: 100%;
 | 
			
		||||
    background: rgba(0, 0, 0, .3);
 | 
			
		||||
    background: rgba(0, 0, 0, 0.3);
 | 
			
		||||
    z-index: 99;
 | 
			
		||||
 | 
			
		||||
    .mask-content {
 | 
			
		||||
@@ -323,7 +364,7 @@ export default {
 | 
			
		||||
        font-size: 28px;
 | 
			
		||||
        font-family: PingFangSC-Medium, PingFang SC;
 | 
			
		||||
        font-weight: 500;
 | 
			
		||||
        color: #1365DD;
 | 
			
		||||
        color: #1365dd;
 | 
			
		||||
        line-height: 40px;
 | 
			
		||||
        margin: 60px 0 20px 332px;
 | 
			
		||||
        text-align: center;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user