|
|
@ -4,40 +4,40 @@ |
|
|
<view v-for="(item, index) in electionList" :key="index" class="election-item"> |
|
|
<view v-for="(item, index) in electionList" :key="index" class="election-item"> |
|
|
<view class="year-title"> |
|
|
<view class="year-title"> |
|
|
<view class="headpart"> |
|
|
<view class="headpart"> |
|
|
<text class="title">{{ item.title }}</text> |
|
|
<text class="title">{{ item.vote_title }}</text> |
|
|
<view |
|
|
<view |
|
|
class="type" |
|
|
class="type" |
|
|
:style=" |
|
|
:style=" |
|
|
item.type == '投票中' |
|
|
item.vote_title == 1 |
|
|
? 'background: #DBEAFE;color: #3B82F6;' |
|
|
? 'background: #DBEAFE;color: #3B82F6;' |
|
|
: item.type == '当选' |
|
|
: item.vote_title == 2 |
|
|
? 'background: #DCFCE7;color: #10B981' |
|
|
? 'background: #DCFCE7;color: #10B981' |
|
|
: 'background: #F3F4F6;color: #4B5563' |
|
|
: 'background: #F3F4F6;color: #4B5563' |
|
|
" |
|
|
" |
|
|
> |
|
|
> |
|
|
{{ item.type }} |
|
|
{{ item.vote_title==1?'未开始':(item.vote_title==2?'进行中':'已结束') }} |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="flex-center-between" style="display: flex"> |
|
|
<view class="flex-center-between" style="display: flex" v-show="expandedStates[index]"> |
|
|
<view style="display: grid"> |
|
|
<view style="display: grid"> |
|
|
<view |
|
|
<view |
|
|
v-for="(candidate, cIndex) in item.candidates.slice(0, expandedStates[index] ? item.candidates.length : 1)" |
|
|
v-for="(candidate, cIndex) in item.candidate.slice(0, expandedStates[index] ? cIndex : 1)" |
|
|
:key="cIndex" |
|
|
:key="cIndex" |
|
|
class="candidate-item" |
|
|
class="candidate-item" |
|
|
> |
|
|
> |
|
|
<view class="info-section"> |
|
|
<view class="info-section"> |
|
|
<view style="display: flex; align-items: center"> |
|
|
<view style="display: flex; align-items: center"> |
|
|
<img style="width: 96rpx; height: 96rpx; border-radius: 50%" :src="item.img" alt="" /> |
|
|
<img style="width: 96rpx; height: 96rpx; border-radius: 50%" :src="item.photo" alt="" /> |
|
|
<view style="margin-left: 24rpx; display: grid"> |
|
|
<view style="margin-left: 24rpx; display: grid"> |
|
|
<text class="name">{{ candidate.name }}</text> |
|
|
<text class="name">{{ candidate.name }}</text> |
|
|
<text class="college">{{ candidate.college }}</text> |
|
|
<text class="college">{{ candidate.position }}</text> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view style="display: flex; margin-top: 24rpx"> |
|
|
<view style="display: flex; margin-top: 24rpx;font-family: Roboto;font-size: 14px;color: #4B5563;"> |
|
|
我的选择: |
|
|
我的选择: |
|
|
<view :class="['choice-tag', choiceClass(candidate.choice)]"> |
|
|
<view :class="['choice-tag', choiceClass(candidate.vote_result)]"> |
|
|
{{ choiceText(candidate.choice) }} |
|
|
{{ choiceText(candidate.vote_result) }} |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
@ -84,9 +84,9 @@ const choiceClass = (choice) => { |
|
|
switch (choice) { |
|
|
switch (choice) { |
|
|
case 1: |
|
|
case 1: |
|
|
return 'agree' |
|
|
return 'agree' |
|
|
case 0: |
|
|
|
|
|
return 'oppose' |
|
|
|
|
|
case 2: |
|
|
case 2: |
|
|
|
|
|
return 'oppose' |
|
|
|
|
|
case 3: |
|
|
return 'abstain' |
|
|
return 'abstain' |
|
|
default: |
|
|
default: |
|
|
return '' |
|
|
return '' |
|
|
@ -97,8 +97,8 @@ const choiceText = (choice) => { |
|
|
return ( |
|
|
return ( |
|
|
{ |
|
|
{ |
|
|
1: '同意', |
|
|
1: '同意', |
|
|
0: '反对', |
|
|
2: '反对', |
|
|
2: '弃权' |
|
|
3: '弃权' |
|
|
}[choice] || '' |
|
|
}[choice] || '' |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
@ -114,16 +114,14 @@ const getList = async () => { |
|
|
limit: pageSize.value |
|
|
limit: pageSize.value |
|
|
} |
|
|
} |
|
|
// 模拟接口请求(替换为你的真实接口) |
|
|
// 模拟接口请求(替换为你的真实接口) |
|
|
const mockData = await getMyvote(param).then((res)=> { |
|
|
const mockData = await getMyvote(param) |
|
|
console.log(res,66666666666); |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// 处理数据 |
|
|
// 处理数据 |
|
|
// electionList.value = [...electionList.value, ...mockData] |
|
|
electionList.value = [...electionList.value, ...mockData.data.data] |
|
|
electionList.value.push(mockData) |
|
|
// electionList.value.push(mockData) |
|
|
|
|
|
|
|
|
// 判断是否还有数据 |
|
|
// 判断是否还有数据 |
|
|
// noMoreData.value = mockData.length < pageSize.value |
|
|
noMoreData.value = mockData.data.data.length < pageSize.value |
|
|
} finally { |
|
|
} finally { |
|
|
loading.value = false |
|
|
loading.value = false |
|
|
} |
|
|
} |
|
|
@ -173,7 +171,7 @@ onShow(() => { |
|
|
.title { |
|
|
.title { |
|
|
font-family: Roboto; |
|
|
font-family: Roboto; |
|
|
font-size: 32rpx; |
|
|
font-size: 32rpx; |
|
|
font-weight: 500; |
|
|
font-weight: 800; |
|
|
letter-spacing: normal; |
|
|
letter-spacing: normal; |
|
|
color: #000000; |
|
|
color: #000000; |
|
|
} |
|
|
} |
|
|
|