提交 84a24482 authored 作者: 王鹏飞's avatar 王鹏飞

投票增加限制

上级 2c1c5478
public/favicon.ico

16.6 KB | W: | H:

public/favicon.ico

2.0 KB | W: | H:

public/favicon.ico
public/favicon.ico
public/favicon.ico
public/favicon.ico
  • 2-up
  • Swipe
  • Onion skin
......@@ -180,7 +180,7 @@ export default {
.logo {
width: 136px;
height: 44px;
background: url('~@/assets/img/logo.png') no-repeat;
background: url('https://zws-imgs-pub.ezijing.com/pc/base/logo.svg') no-repeat;
background-size: contain;
}
.login-hd {
......
......@@ -45,14 +45,25 @@ export default {
}
},
methods: {
handSubmit() {
async handSubmit() {
const ids = this.list.reduce((results, item) => {
item.candidate.forEach(user => {
user.checked && results.push(user.id)
})
return results
}, [])
this.handleRequest(ids)
const hasVote = await this.checkVote()
if (hasVote) {
this.$toast('你已经投过票了')
} else {
this.handleRequest(ids)
}
},
// 检测是否投票
checkVote() {
return api.checkVote().then(response => {
return response.flag
})
},
handleRequest(ids) {
api.addVote(ids).then(response => {
......@@ -61,6 +72,8 @@ export default {
this.$nextTick(() => {
this.$refs.countDown.start()
})
} else {
this.$toast(response.message)
}
})
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论