|
|
@ -6,8 +6,29 @@ import { ref } from 'vue'; |
|
|
|
//候选人 |
|
|
|
const candidates = ref([]) |
|
|
|
const first = ref(); |
|
|
|
first.value = { |
|
|
|
id: 1, |
|
|
|
name: "tom", |
|
|
|
avatar: "../assets/头像框.png", |
|
|
|
votes: 100, |
|
|
|
voted: false |
|
|
|
} |
|
|
|
const second = ref(); |
|
|
|
second.value = { |
|
|
|
id: 2, |
|
|
|
name: "tom", |
|
|
|
avatar: "../assets/头像框.png", |
|
|
|
votes: 100, |
|
|
|
voted: false |
|
|
|
} |
|
|
|
const third = ref(); |
|
|
|
third.value = { |
|
|
|
id: 3, |
|
|
|
name: "tom", |
|
|
|
avatar: "../assets/头像框.png", |
|
|
|
votes: 100, |
|
|
|
voted: false |
|
|
|
} |
|
|
|
//后七名 |
|
|
|
const backCandidates = ref([ |
|
|
|
{ |
|
|
@ -15,48 +36,55 @@ const backCandidates = ref([ |
|
|
|
name: "tom", |
|
|
|
avatar: "../assets/头像框.png", |
|
|
|
votes: 100, |
|
|
|
status: 0 |
|
|
|
voted: true |
|
|
|
|
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 5, |
|
|
|
name: "tom", |
|
|
|
avatar: "../assets/头像框.png", |
|
|
|
votes: 100 |
|
|
|
votes: 100, |
|
|
|
voted: true |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 6, |
|
|
|
name: "tom", |
|
|
|
avatar: "../assets/头像框.png", |
|
|
|
votes: 100 |
|
|
|
votes: 100, |
|
|
|
voted: true |
|
|
|
} |
|
|
|
, |
|
|
|
{ |
|
|
|
id: 7, |
|
|
|
name: "tom", |
|
|
|
avatar: "../assets/头像框.png", |
|
|
|
votes: 100 |
|
|
|
votes: 100, |
|
|
|
voted: false |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 8, |
|
|
|
name: "tom", |
|
|
|
avatar: "../assets/头像框.png", |
|
|
|
votes: 100 |
|
|
|
votes: 100, |
|
|
|
voted: true |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 9, |
|
|
|
name: "tom", |
|
|
|
avatar: "../assets/头像框.png", |
|
|
|
votes: 100 |
|
|
|
votes: 100, |
|
|
|
voted: true |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 10, |
|
|
|
name: "tom", |
|
|
|
avatar: "../assets/头像框.png", |
|
|
|
votes: 100 |
|
|
|
votes: 100, |
|
|
|
voted: false |
|
|
|
} |
|
|
|
|
|
|
|
]) |
|
|
|
let key = 10017; |
|
|
|
//加载候选人 |
|
|
|
function loadCandidates(jwcode) { |
|
|
|
CanApi.getCandidates(jwcode).then(result => { |
|
|
@ -77,10 +105,10 @@ function loadCandidates(jwcode) { |
|
|
|
console.log("候选人:", backCandidates.value); |
|
|
|
}) |
|
|
|
} |
|
|
|
loadCandidates(10015); |
|
|
|
loadCandidates(key); |
|
|
|
//投票 |
|
|
|
const voter = ref({ |
|
|
|
jwCode: 10015, |
|
|
|
jwCode: key, |
|
|
|
candidateJwCode: 20010, |
|
|
|
name: "小辉" |
|
|
|
}) |
|
|
@ -93,9 +121,10 @@ function vote(code) { |
|
|
|
|
|
|
|
if (result.code == 10000) { |
|
|
|
ElMessage.success(result.msg); |
|
|
|
loadCandidates(10013); |
|
|
|
loadCandidates(key); |
|
|
|
} else { |
|
|
|
ElMessage.error(result.msg) |
|
|
|
loadCandidates(key); |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
@ -137,7 +166,7 @@ function vote(code) { |
|
|
|
<!-- 头像图片 --> |
|
|
|
<img class="cover2" src="../assets/image.png"> |
|
|
|
<!-- 投票按钮 --> |
|
|
|
<div class="one-button2" v-if="second.votes==false" @click="vote(first.jwCode)">投票</div> |
|
|
|
<div class="one-button2" v-if="second.voted == false" @click="vote(second.jwCode)">投票</div> |
|
|
|
<div class="buttoned2" v-else @click="vote(second.jwCode)">已投票</div> |
|
|
|
<!-- 有多少人投票 --> |
|
|
|
<div class="votes2">已有{{ second.votes }}人投票</div> |
|
|
@ -149,8 +178,9 @@ function vote(code) { |
|
|
|
<!-- 头像框 --> |
|
|
|
<div class="avatar-box1"></div> |
|
|
|
<!-- 头像图片 --> |
|
|
|
<img class="cover1" src="../assets/image.png"> |
|
|
|
<!-- 投票按钮 --> |
|
|
|
<div class="one-button1" v-if="first.votes==false" @click="vote(first.jwCode)">投票</div> |
|
|
|
<div class="one-button1" v-if="first.voted == false" @click="vote(first.jwCode)">投票</div> |
|
|
|
<div class="buttoned1" v-else @click="vote(first.jwCode)">已投票</div> |
|
|
|
<!-- 有多少人投票 --> |
|
|
|
<div class="votes1">已有{{ first.votes }}人投票</div> |
|
|
@ -162,8 +192,9 @@ function vote(code) { |
|
|
|
<!-- 头像框 --> |
|
|
|
<div class="avatar-box3"></div> |
|
|
|
<!-- 头像图片 --> |
|
|
|
<img class="cover3" src="../assets/image.png"> |
|
|
|
<!-- 投票按钮 --> |
|
|
|
<div class="one-button3" v-if="third.votes==false" @click="vote(third.jwCode)">投票</div> |
|
|
|
<div class="one-button3" v-if="third.voted == false" @click="vote(third.jwCode)">投票</div> |
|
|
|
<div class="buttoned3" v-else @click="vote(third.jwCode)">已投票</div> |
|
|
|
<!-- 有多少人投票 --> |
|
|
|
<div class="votes3">已有{{ third.votes }}人投票</div> |
|
|
@ -179,7 +210,7 @@ function vote(code) { |
|
|
|
<!-- 排名 --> |
|
|
|
<div class="num">{{ index + 4 }}</div> |
|
|
|
<!-- 头像 --> |
|
|
|
<img class="list-avatar" :src="backCandidate.avatar"> |
|
|
|
<img class="list-avatar" src="../assets/image.png"> |
|
|
|
<!-- 投票数 --> |
|
|
|
<div class="votes">已有{{ backCandidate.votes }}人投票</div> |
|
|
|
<!-- 投票按钮 --> |
|
|
@ -224,6 +255,7 @@ function vote(code) { |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@media (max-width:750px) { |
|
|
|
.container { |
|
|
|
background-image: url('../assets/bg.png'); |
|
|
@ -306,35 +338,38 @@ function vote(code) { |
|
|
|
height: 30%; |
|
|
|
margin-left: auto; |
|
|
|
margin-right: auto; |
|
|
|
margin-top: 20%; |
|
|
|
margin-top: 25%; |
|
|
|
} |
|
|
|
|
|
|
|
.yiersan { |
|
|
|
margin-top: 9%; |
|
|
|
width: 100%; |
|
|
|
} |
|
|
|
|
|
|
|
.avatar-box2 { |
|
|
|
background-image: url(../assets/头像框.png); |
|
|
|
position: absolute; |
|
|
|
background-size: contain; |
|
|
|
background-repeat: no-repeat; |
|
|
|
left: 9%; |
|
|
|
top: -9%; |
|
|
|
top: -8%; |
|
|
|
width: 25%; |
|
|
|
height: 20%; |
|
|
|
} |
|
|
|
|
|
|
|
.cover2 { |
|
|
|
position: absolute; |
|
|
|
left: 11.5%; |
|
|
|
top: -5.5%; |
|
|
|
width: 20%; |
|
|
|
height: 14%; |
|
|
|
top: -6%; |
|
|
|
width: 19%; |
|
|
|
height: 12%; |
|
|
|
border-radius: 50%; |
|
|
|
} |
|
|
|
|
|
|
|
.one-button2 { |
|
|
|
position: absolute; |
|
|
|
left: 9%; |
|
|
|
top: 5%; |
|
|
|
top: 3%; |
|
|
|
width: 22%; |
|
|
|
height: 3.5%; |
|
|
|
border-radius: 20px 20px 20px 20px; |
|
|
@ -344,13 +379,16 @@ function vote(code) { |
|
|
|
font-weight: 700; |
|
|
|
font-size: 1.4rem; |
|
|
|
color: #E8160C; |
|
|
|
text-align: center; |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
align-items: center; |
|
|
|
cursor: pointer; |
|
|
|
} |
|
|
|
|
|
|
|
.buttoned2 { |
|
|
|
position: absolute; |
|
|
|
left: 9%; |
|
|
|
top: 5%; |
|
|
|
top: 3%; |
|
|
|
width: 22%; |
|
|
|
height: 3.5%; |
|
|
|
border-radius: 20px 20px 20px 20px; |
|
|
@ -358,15 +396,18 @@ function vote(code) { |
|
|
|
/* 文字 */ |
|
|
|
font-weight: 700; |
|
|
|
font-size: 1.4rem; |
|
|
|
text-align: center; |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
align-items: center; |
|
|
|
cursor: pointer; |
|
|
|
background: #EEEEEE; |
|
|
|
color: #999999; |
|
|
|
} |
|
|
|
|
|
|
|
.votes2 { |
|
|
|
position: absolute; |
|
|
|
left: 11%; |
|
|
|
top: 9%; |
|
|
|
top: 7%; |
|
|
|
width: 25%; |
|
|
|
height: 3%; |
|
|
|
font-family: Alibaba PuHuiTi; |
|
|
@ -384,7 +425,7 @@ function vote(code) { |
|
|
|
height: 15%; |
|
|
|
position: absolute; |
|
|
|
left: 14%; |
|
|
|
top: 15%; |
|
|
|
top: 12%; |
|
|
|
/* z-index: 999; */ |
|
|
|
} |
|
|
|
|
|
|
@ -395,31 +436,44 @@ function vote(code) { |
|
|
|
background-repeat: no-repeat; |
|
|
|
position: absolute; |
|
|
|
left: 38%; |
|
|
|
top: -12%; |
|
|
|
top: -11%; |
|
|
|
width: 25%; |
|
|
|
height: 20%; |
|
|
|
} |
|
|
|
|
|
|
|
.cover1 { |
|
|
|
position: absolute; |
|
|
|
|
|
|
|
left: 41%; |
|
|
|
top: -9.5%; |
|
|
|
width: 19%; |
|
|
|
height: 12%; |
|
|
|
border-radius: 50%; |
|
|
|
} |
|
|
|
|
|
|
|
.one-button1 { |
|
|
|
position: absolute; |
|
|
|
left: 39%; |
|
|
|
top: 2%; |
|
|
|
top: 0%; |
|
|
|
width: 22%; |
|
|
|
height: 3.5%; |
|
|
|
border-radius: 20px 20px 20px 20px; |
|
|
|
background: linear-gradient(81deg, #FFE89C, #FFC040); |
|
|
|
border: #FA765D solid 2px; |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
align-items: center; |
|
|
|
/* 文字 */ |
|
|
|
font-weight: 700; |
|
|
|
font-size: 1.4rem; |
|
|
|
color: #E8160C; |
|
|
|
text-align: center; |
|
|
|
cursor: pointer; |
|
|
|
} |
|
|
|
|
|
|
|
.buttoned1 { |
|
|
|
position: absolute; |
|
|
|
left: 39%; |
|
|
|
top: 2%; |
|
|
|
top: 0%; |
|
|
|
width: 22%; |
|
|
|
height: 3.5%; |
|
|
|
border-radius: 20px 20px 20px 20px; |
|
|
@ -427,7 +481,9 @@ function vote(code) { |
|
|
|
/* 文字 */ |
|
|
|
font-weight: 700; |
|
|
|
font-size: 1.4rem; |
|
|
|
text-align: center; |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
align-items: center; |
|
|
|
cursor: pointer; |
|
|
|
background: #EEEEEE; |
|
|
|
color: #999999; |
|
|
@ -436,8 +492,8 @@ function vote(code) { |
|
|
|
.votes1 { |
|
|
|
|
|
|
|
position: absolute; |
|
|
|
left: 43.5%; |
|
|
|
top: 6%; |
|
|
|
left: 43%; |
|
|
|
top: 4%; |
|
|
|
width: 25; |
|
|
|
height: 3; |
|
|
|
font-family: Alibaba PuHuiTi; |
|
|
@ -453,7 +509,7 @@ function vote(code) { |
|
|
|
background-repeat: no-repeat; |
|
|
|
position: absolute; |
|
|
|
left: 47%; |
|
|
|
top: 12%; |
|
|
|
top: 9.5%; |
|
|
|
width: 5%; |
|
|
|
height: 15%; |
|
|
|
/* z-index: 999; */ |
|
|
@ -465,16 +521,25 @@ function vote(code) { |
|
|
|
background-repeat: no-repeat; |
|
|
|
position: absolute; |
|
|
|
left: 68%; |
|
|
|
top: -9%; |
|
|
|
top: -8%; |
|
|
|
width: 25%; |
|
|
|
height: 20%; |
|
|
|
} |
|
|
|
|
|
|
|
.cover3 { |
|
|
|
position: absolute; |
|
|
|
left: 71%; |
|
|
|
top: -6%; |
|
|
|
width: 19%; |
|
|
|
height: 12%; |
|
|
|
border-radius: 50%; |
|
|
|
} |
|
|
|
|
|
|
|
.one-button3 { |
|
|
|
|
|
|
|
position: absolute; |
|
|
|
left: 69%; |
|
|
|
top: 5%; |
|
|
|
top: 3%; |
|
|
|
width: 22%; |
|
|
|
height: 3.5%; |
|
|
|
border-radius: 20px 20px 20px 20px; |
|
|
@ -484,13 +549,16 @@ function vote(code) { |
|
|
|
font-weight: 700; |
|
|
|
font-size: 1.4rem; |
|
|
|
color: #E8160C; |
|
|
|
text-align: center; |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
align-items: center; |
|
|
|
cursor: pointer; |
|
|
|
} |
|
|
|
|
|
|
|
.buttoned3 { |
|
|
|
position: absolute; |
|
|
|
left: 69%; |
|
|
|
top: 5%; |
|
|
|
top: 3%; |
|
|
|
width: 22%; |
|
|
|
height: 3.5%; |
|
|
|
border-radius: 20px 20px 20px 20px; |
|
|
@ -498,15 +566,18 @@ function vote(code) { |
|
|
|
/* 文字 */ |
|
|
|
font-weight: 700; |
|
|
|
font-size: 1.4rem; |
|
|
|
text-align: center; |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
align-items: center; |
|
|
|
cursor: pointer; |
|
|
|
background: #EEEEEE; |
|
|
|
color: #999999; |
|
|
|
} |
|
|
|
|
|
|
|
.votes3 { |
|
|
|
position: absolute; |
|
|
|
left: 70.5%; |
|
|
|
top: 9%; |
|
|
|
left: 72%; |
|
|
|
top: 7%; |
|
|
|
width: 25%; |
|
|
|
height: 3%; |
|
|
|
font-family: Alibaba PuHuiTi; |
|
|
@ -523,7 +594,7 @@ function vote(code) { |
|
|
|
background-repeat: no-repeat; |
|
|
|
position: absolute; |
|
|
|
left: 75%; |
|
|
|
top: 15%; |
|
|
|
top: 12%; |
|
|
|
width: 7%; |
|
|
|
height: 15%; |
|
|
|
/* z-index: 999; */ |
|
|
@ -579,7 +650,7 @@ function vote(code) { |
|
|
|
height: 18%; |
|
|
|
border-radius: 50%; |
|
|
|
/* 圆形头像 */ |
|
|
|
/* margin-right: 2%; */ |
|
|
|
margin-right: 2%; |
|
|
|
} |
|
|
|
|
|
|
|
.votes { |
|
|
@ -612,10 +683,13 @@ function vote(code) { |
|
|
|
font-weight: 700; |
|
|
|
font-size: 1.3rem; |
|
|
|
color: #E8160C; |
|
|
|
text-align: center; |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
align-items: center; |
|
|
|
letter-spacing: 1%; |
|
|
|
margin-right: 2%; |
|
|
|
margin-right: 4%; |
|
|
|
} |
|
|
|
|
|
|
|
.list-button2 { |
|
|
|
background: #EEEEEE; |
|
|
|
color: #999999; |
|
|
@ -633,8 +707,9 @@ function vote(code) { |
|
|
|
|
|
|
|
text-align: center; |
|
|
|
letter-spacing: 1%; |
|
|
|
margin-right: 2%; |
|
|
|
margin-right: 4%; |
|
|
|
} |
|
|
|
|
|
|
|
.list-button:hover { |
|
|
|
background-color: #e6b800; |
|
|
|
/* 鼠标悬停时的背景颜色 */ |
|
|
|