1
0
tükörképe a: 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:
小莫唐尼
2025-08-21 19:32:22 +08:00
szülő 5606e8c59f
commit 31ade9908a
8 fájl változott, egészen pontosan 474 új sor hozzáadva és 227 régi sor törölve
+18 -1
Fájl megtekintése
@@ -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;