Files
toutoukan_front/miniprogram/pages/home/home.wxml
2025-09-26 01:02:43 +08:00

91 lines
3.5 KiB
Plaintext

<view style="height: 80vh; padding-bottom: 100rpx;">
<scroll-view
class="scroll-container"
scroll-y="true"
enable-flex="true"
show-scrollbar="true"
enhanced="true"
scroll-with-animation="true"
>
<view class="cards-container">
<block wx:for="{{processedCardsData}}" wx:for-item="card" wx:key="article_id">
<view class="voting-card"
>
<view class="card-header"
bindtap="goToDetail"
data-id="{{card.article_id}}"
>
<view class="user-info">
<image src="https://picsum.photos/id/100/200/200" mode="widthFix" class="avatar" alt="用户头像"></image>
<view class="user-details">
<text class="username">{{card.publisher_id}}</text>
<text class="user-status">发起人</text>
</view>
</view>
<view class="vote-status">{{card.is_ended ? '已结束' : '进行中'}}</view>
</view>
<view class="divider"></view>
<view class="vote-title-section" bindtap="goToDetail"
data-id="{{card.article_id}}">
<text class="vote-title">{{card.article_title}} ({{card.vote_type === 'single' ? '单选' : '多选'}})</text>
<text class="vote-desc"></text>
</view>
<view class="options-container">
<block wx:for="{{card.options}}" wx:for-item="option" wx:key="id">
<view
class="option-item {{option.isSelected ? 'selected' : ''}} {{card.is_ended ? 'disabled-option' : ''}}"
bindtap="selectOption"
data-card-id="{{card.article_id}}"
data-option-id="{{option.id}}">
<view class="option-info">
<view class="option-icon bg-gray">
<text class="iconfont icon-default"></text>
</view>
<view class="option-details">
<text class="option-name">{{option.name}}</text>
<text class="option-desc"></text>
</view>
</view>
<view class="option-action-btn">
AI
</view>
<text class="option-percent">{{option.percentage}}%</text>
<view class="progress-bar">
<view class="progress-value" style="width: {{option.percentage + '%'}}"></view>
</view>
<view class="vote-indicator {{option.isSelected ? 'show' : ''}}">
<text class="iconfont icon-check-circle"></text>
</view>
</view>
</block>
</view>
<view class="vote-stats"
bindtap="goToDetail"
data-id="{{card.article_id}}"
>
<text class="stats-text">已有 {{card.total_voters}} 人参与投票</text>
<text class="stats-text">{{card.is_ended ? '已结束' : '剩余 ' + card.end_time}}</text>
</view>
<button
class="vote-btn {{card.is_ended ? 'vote-btn-ended' : ''}}"
disabled="{{card.is_ended}}"
bindtap="submitVote"
data-card-id="{{card.article_id}}">
<text class="iconfont icon-thumbs-up"></text>
<text class="btn-text">{{card.is_ended ? '投票结束' : '投我一票'}}</text>
</button>
</view>
</block>
</view>
</scroll-view>
</view>