mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-06-12 21:29:31 +08:00
fix: 修复投票状态显示问题
This commit is contained in:
@@ -3,113 +3,32 @@
|
||||
<view class="vote-card-head flex">
|
||||
<view class="left flex flex-center w-full">
|
||||
<view class="flex-shrink">
|
||||
<tm-tags v-if="vote.spec.type==='single'" color="light-blue" :shadow="0" rounded size="s"
|
||||
model="fill">单选</tm-tags>
|
||||
<tm-tags v-else-if="vote.spec.type==='multiple'" color="light-blue" :shadow="0" rounded size="s"
|
||||
model="fill">多选</tm-tags>
|
||||
<tm-tags v-else-if="vote.spec.type==='pk'" color="light-blue" :shadow="0" rounded size="s"
|
||||
model="fill">双选PK</tm-tags>
|
||||
<tm-tags color="light-blue" :shadow="0" rounded size="s" model="fill">{{ vote.spec._uh_type}}</tm-tags>
|
||||
</view>
|
||||
<view class="title text-overflow">
|
||||
{{ vote.spec.title }}
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="false" class="flex-shrink right flex flex-end">
|
||||
<tm-tags v-if="vote.spec.hasEnded" color="red" rounded :shadow="0" size="s" model="text">已结束</tm-tags>
|
||||
<tm-tags v-else color="green" rounded size="s" :shadow="0" model="text">进行中</tm-tags>
|
||||
</view>
|
||||
</view>
|
||||
<view class="vote-card-body w-full">
|
||||
|
||||
<view v-if="vote.spec.remark" class="remark text-overflow-2 text-size-s">
|
||||
{{vote.spec.remark}}
|
||||
</view>
|
||||
|
||||
<template v-if="showOptions">
|
||||
<!-- 单选 -->
|
||||
<view v-if="vote.spec.type==='single'" class="single">
|
||||
<tm-groupradio @change="onOptionRadioChange">
|
||||
<tm-radio v-for="(option,optionIndex) in vote.spec.options" :key="optionIndex" dense
|
||||
:disabled="vote.spec.disabled" v-model="option.checked" :extendData="option">
|
||||
<template v-slot:default="{checkData}">
|
||||
<tm-button :shadow="0" :theme="checkData.checked?'light-blue':'grey-lighten-3'"
|
||||
:plan="false" :block="true" class="w-full" size="m" :height="72">
|
||||
<view class="flex flex-between w-full">
|
||||
<text class="text-align-left text-overflow"> {{ checkData.extendData.title }}
|
||||
</text>
|
||||
<text class="flex-shrink"> {{checkData.extendData.percent }}% </text>
|
||||
</view>
|
||||
</tm-button>
|
||||
</template>
|
||||
</tm-radio>
|
||||
</tm-groupradio>
|
||||
</view>
|
||||
|
||||
<!-- 多选 -->
|
||||
<view v-else-if="vote.spec.type==='multiple'" class="multiple">
|
||||
<tm-groupcheckbox @change="onOptionCheckboxChange">
|
||||
<tm-checkbox v-for="(option,optionIndex) in vote.spec.options" :key="optionIndex" dense
|
||||
:disabled="vote.spec.disabled" v-model="option.checked" :extendData="option">
|
||||
<template v-slot:default="{checkData}">
|
||||
<tm-button :shadow="0" :theme="checkData.checked?'light-blue':'grey-lighten-3'"
|
||||
:plan="false" :block="true" class="w-full" size="m" :height="72">
|
||||
<view class="flex flex-between w-full">
|
||||
<text class="text-align-left text-overflow"> {{ checkData.extendData.title }}
|
||||
</text>
|
||||
<text class="flex-shrink"> {{checkData.extendData.percent }}% </text>
|
||||
</view>
|
||||
</tm-button>
|
||||
</template>
|
||||
</tm-checkbox>
|
||||
</tm-groupcheckbox>
|
||||
</view>
|
||||
|
||||
<!-- PK -->
|
||||
<view v-else-if="vote.spec.type==='pk'" class="pk">
|
||||
<tm-groupradio @change="onOptionPkChange">
|
||||
<tm-radio v-for="(option,optionIndex) in vote.spec.options" :key="optionIndex" dense
|
||||
:disabled="vote.spec.disabled" v-model="option.checked" :extendData="option"
|
||||
class="radio-item" :class="[optionIndex==0?'radio-left':'radio-right']"
|
||||
:style="{width:option.percent + '%'}">
|
||||
<template v-slot:default="{checkData}">
|
||||
<view class="option-item"
|
||||
:class="[optionIndex==0?'option-item-left':'option-item-right']">
|
||||
{{checkData.extendData.percent }}%
|
||||
</view>
|
||||
</template>
|
||||
</tm-radio>
|
||||
</tm-groupradio>
|
||||
<view class="option-foot w-full flex flex-between">
|
||||
<view v-for="(option,optionIndex) in vote.spec.options" :key="optionIndex">
|
||||
<view v-if="optionIndex==0" class="left flex-1 flex-shrink text-overflow">
|
||||
{{option.title}}
|
||||
</view>
|
||||
<view v-else class="right flex-1 flex-shrink text-overflow text-align-right">
|
||||
{{option.title}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
<view class="vote-card-foot flex flex-between">
|
||||
<view class="left flex">
|
||||
<tm-tags v-if="vote.spec._state=='已结束'" color="red" size="s" rounded :shadow="0"
|
||||
model="text">已结束</tm-tags>
|
||||
<tm-tags v-else-if="vote.spec._state=='未开始'" color="orange" size="s" rounded :shadow="0"
|
||||
model="text">未开始</tm-tags>
|
||||
<tm-tags v-else-if="vote.spec._state=='进行中'" color="green" size="s" rounded :shadow="0"
|
||||
model="text">进行中</tm-tags>
|
||||
|
||||
<tm-tags :color="vote.spec._uh_state.color" size="s" rounded :shadow="0"
|
||||
model="text">{{vote.spec._uh_state.state}}</tm-tags>
|
||||
|
||||
<tm-tags v-if="vote.spec.isVoted" color="blue" rounded size="s" model="text">已投票</tm-tags>
|
||||
|
||||
<tm-tags v-if="vote.spec.timeLimit==='permanent'" color="grey-darken-2" rounded size="s"
|
||||
model="text">结束:永久有效 </tm-tags>
|
||||
model="text">结束时间:永久有效 </tm-tags>
|
||||
<tm-tags v-else color="grey-darken-2" rounded size="s" model="text">
|
||||
<template
|
||||
v-if="vote.spec._state=='未开始'">开始:{{ {d: vote.spec.startDate, f: 'yyyy-MM-dd HH:mm'} | formatTime }}
|
||||
v-if="vote.spec._uh_state.state=='未开始'">开始时间:{{ {d: vote.spec.startDate, f: 'yyyy-MM-dd HH:mm'} | formatTime }}
|
||||
</template>
|
||||
<template v-else>结束:{{ {d: vote.spec.endDate, f: 'yyyy-MM-dd HH:mm'} | formatTime }}
|
||||
<template v-else>结束时间:{{ {d: vote.spec.endDate, f: 'yyyy-MM-dd HH:mm'} | formatTime }}
|
||||
</template>
|
||||
</tm-tags>
|
||||
</view>
|
||||
@@ -129,6 +48,7 @@
|
||||
import tmCheckbox from '@/tm-vuetify/components/tm-checkbox/tm-checkbox.vue';
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
|
||||
|
||||
export default {
|
||||
name: "VoteCard",
|
||||
options: {
|
||||
@@ -156,17 +76,6 @@
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onOptionRadioChange(e) {
|
||||
console.log("onOptionRadioChange", e)
|
||||
},
|
||||
onOptionCheckboxChange(e) {
|
||||
console.log("onOptionCheckboxChange", e)
|
||||
},
|
||||
onOptionPkChange(e) {
|
||||
console.log("onOptionPkChange", e)
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user