2025-09-24 22:32:06 +08:00
|
|
|
|
<view style="height: 80vh; padding-bottom: 100rpx;">
|
2025-09-27 17:24:52 +08:00
|
|
|
|
<a>{{url}}</a>
|
2025-09-25 01:18:30 +08:00
|
|
|
|
<scroll-view
|
|
|
|
|
|
class="scroll-container"
|
|
|
|
|
|
scroll-y="true"
|
|
|
|
|
|
enable-flex="true"
|
|
|
|
|
|
show-scrollbar="true"
|
|
|
|
|
|
enhanced="true"
|
|
|
|
|
|
scroll-with-animation="true"
|
2025-09-27 17:24:52 +08:00
|
|
|
|
refresher-enabled="true"
|
|
|
|
|
|
refresher-triggered="{{refresherTriggered}}"
|
|
|
|
|
|
refresher-threshold="80"
|
|
|
|
|
|
refresher-default-style="black"
|
|
|
|
|
|
refresher-background="#f5f5f5"
|
|
|
|
|
|
bindrefresherpulling="onRefresherPulling"
|
|
|
|
|
|
bindrefresherrefresh="onRefresherRefresh"
|
|
|
|
|
|
bindrefresherrestore="onRefresherRestore"
|
2025-09-25 01:18:30 +08:00
|
|
|
|
>
|
|
|
|
|
|
<view class="cards-container">
|
|
|
|
|
|
<block wx:for="{{processedCardsData}}" wx:for-item="card" wx:key="article_id">
|
2025-09-27 17:24:52 +08:00
|
|
|
|
<view class="voting-card">
|
|
|
|
|
|
<!-- 卡片头部 -->
|
|
|
|
|
|
<view class="card-header" bindtap="goToDetail" data-id="{{card.article_id}}">
|
2025-09-25 01:18:30 +08:00
|
|
|
|
<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>
|
2025-09-27 17:24:52 +08:00
|
|
|
|
<text class="user-status">({{card.vote_type === 'single' ? '单选' : '多选'}})</text>
|
2025-09-25 01:18:30 +08:00
|
|
|
|
</view>
|
2025-09-23 19:10:14 +08:00
|
|
|
|
</view>
|
2025-09-27 17:24:52 +08:00
|
|
|
|
<view class="vote-status">{{card.user_has_voted ? '已投票' : (card.is_ended ? '已结束' : '进行中')}}</view>
|
2025-09-23 19:10:14 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
|
2025-09-25 01:18:30 +08:00
|
|
|
|
<view class="divider"></view>
|
2025-09-23 19:10:14 +08:00
|
|
|
|
|
2025-09-27 17:24:52 +08:00
|
|
|
|
<!-- 投票标题与已投票提示 -->
|
|
|
|
|
|
<view class="vote-title-section" bindtap="goToDetail" data-id="{{card.article_id}}">
|
|
|
|
|
|
<text class="vote-title">{{card.article_title}} </text>
|
|
|
|
|
|
<text class="voted-tip" wx:if="{{card.user_has_voted}}">• 您已投票</text>
|
2025-09-25 01:18:30 +08:00
|
|
|
|
<text class="vote-desc"></text>
|
2025-08-09 17:41:14 +08:00
|
|
|
|
</view>
|
2025-09-23 19:10:14 +08:00
|
|
|
|
|
2025-09-27 17:24:52 +08:00
|
|
|
|
<!-- 投票选项列表:合并class表达式,避免多{{}}拆分 -->
|
2025-09-25 01:18:30 +08:00
|
|
|
|
<view class="options-container">
|
|
|
|
|
|
<block wx:for="{{card.options}}" wx:for-item="option" wx:key="id">
|
|
|
|
|
|
<view
|
2025-09-27 17:24:52 +08:00
|
|
|
|
class="option-item {{(card.user_has_voted && option.is_voted) ? 'selected voted-option' : (option.isSelected ? 'selected' : '')}} {{(card.is_ended || card.user_has_voted) ? 'disabled-option' : ''}}"
|
|
|
|
|
|
bindtap="{{(card.is_ended || card.user_has_voted) ? '' : 'selectOption'}}"
|
2025-09-25 01:18:30 +08:00
|
|
|
|
data-card-id="{{card.article_id}}"
|
2025-09-27 17:24:52 +08:00
|
|
|
|
data-option-id="{{option.id}}"
|
|
|
|
|
|
>
|
2025-09-25 01:18:30 +08:00
|
|
|
|
<view class="option-info">
|
|
|
|
|
|
<view class="option-icon bg-gray">
|
2025-09-27 17:24:52 +08:00
|
|
|
|
<text class="iconfont">{{(card.user_has_voted && option.is_voted) ? '✓' : (option.isSelected ? '✓' : '○')}}</text>
|
2025-09-25 01:18:30 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
<view class="option-details">
|
2025-09-27 17:24:52 +08:00
|
|
|
|
<text class="option-name">
|
|
|
|
|
|
{{option.name}}
|
|
|
|
|
|
<text class="your-selection" wx:if="{{card.user_has_voted && option.is_voted}}">(您的选择)</text>
|
|
|
|
|
|
</text>
|
2025-09-25 01:18:30 +08:00
|
|
|
|
<text class="option-desc"></text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
2025-09-27 17:24:52 +08:00
|
|
|
|
<view class="option-action-btn">AI</view>
|
2025-09-25 01:18:30 +08:00
|
|
|
|
|
2025-09-27 17:24:52 +08:00
|
|
|
|
<text class="option-percent">{{option.percentage || 0}}%</text>
|
2025-09-25 01:18:30 +08:00
|
|
|
|
|
|
|
|
|
|
<view class="progress-bar">
|
2025-09-27 17:24:52 +08:00
|
|
|
|
<view class="progress-value" style="width: {{(option.percentage || 0) + '%'}}"></view>
|
2025-09-25 01:18:30 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
|
2025-09-27 17:24:52 +08:00
|
|
|
|
<view class="vote-indicator {{(card.user_has_voted && option.is_voted) || option.isSelected ? 'show' : ''}}">
|
2025-09-25 01:18:30 +08:00
|
|
|
|
<text class="iconfont icon-check-circle"></text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</block>
|
2025-09-23 19:10:14 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
|
2025-09-27 17:24:52 +08:00
|
|
|
|
<!-- 投票统计信息 -->
|
|
|
|
|
|
<view class="vote-stats" bindtap="goToDetail" data-id="{{card.article_id}}">
|
|
|
|
|
|
<text class="stats-text">已有 {{card.total_voters || 0}} 人参与投票</text>
|
2025-09-25 01:18:30 +08:00
|
|
|
|
<text class="stats-text">{{card.is_ended ? '已结束' : '剩余 ' + card.end_time}}</text>
|
2025-09-23 19:10:14 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
|
2025-09-27 17:24:52 +08:00
|
|
|
|
<!-- 投票提交按钮 -->
|
2025-09-25 01:18:30 +08:00
|
|
|
|
<button
|
2025-09-27 17:24:52 +08:00
|
|
|
|
class="vote-btn {{(card.is_ended || card.user_has_voted) ? 'vote-btn-disabled' : ''}}"
|
|
|
|
|
|
disabled="{{card.is_ended || card.user_has_voted}}"
|
2025-09-25 01:18:30 +08:00
|
|
|
|
bindtap="submitVote"
|
2025-09-27 17:24:52 +08:00
|
|
|
|
data-card-id="{{card.article_id}}"
|
|
|
|
|
|
>
|
2025-09-25 01:18:30 +08:00
|
|
|
|
<text class="iconfont icon-thumbs-up"></text>
|
2025-09-27 17:24:52 +08:00
|
|
|
|
<text class="btn-text">{{card.user_has_voted ? '已提交投票' : (card.is_ended ? '投票结束' : '投我一票')}}</text>
|
2025-09-25 01:18:30 +08:00
|
|
|
|
</button>
|
2025-08-09 17:41:14 +08:00
|
|
|
|
</view>
|
2025-09-25 01:18:30 +08:00
|
|
|
|
</block>
|
2025-08-09 17:41:14 +08:00
|
|
|
|
</view>
|
2025-09-25 01:18:30 +08:00
|
|
|
|
</scroll-view>
|
|
|
|
|
|
</view>
|