mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-06-12 13:19:31 +08:00
feat: 优化投票功能,调整API
This commit is contained in:
+18
-1
@@ -260,7 +260,7 @@
|
||||
const tempItems = res.items.map(item => {
|
||||
item.spec.disabled = true
|
||||
item.spec.isVoted = this.fnCalcIsVoted(item.metadata.name)
|
||||
|
||||
item.spec._state = this.handleCalcVoteState(item)
|
||||
item.spec.options.map((option, index) => {
|
||||
|
||||
option.checked = this.fnCalcIsChecked(item.metadata.name, option)
|
||||
@@ -326,6 +326,23 @@
|
||||
const checked = data.selected.includes(option.id)
|
||||
return checked
|
||||
},
|
||||
handleCalcVoteState(vote) {
|
||||
if (vote.spec.timeLimit !== 'custom') {
|
||||
return vote.spec.hasEnd ? "已结束" : "进行中"
|
||||
}
|
||||
|
||||
const nowTime = new Date().getTime()
|
||||
const startTime = new Date(vote.spec.startDate).getTime()
|
||||
const endTime = new Date(vote.spec.endDate).getTime()
|
||||
|
||||
if (nowTime < startTime) {
|
||||
return "未开始"
|
||||
}
|
||||
if (nowTime < endTime) {
|
||||
return "进行中"
|
||||
}
|
||||
return vote.spec.hasEnd ? "已结束" : "进行中"
|
||||
},
|
||||
//跳转详情
|
||||
fnToDetail(item) {
|
||||
if (this.calcAuditModeEnabled) return;
|
||||
|
||||
Reference in New Issue
Block a user