rating detail

This commit is contained in:
zzc
2026-05-07 15:57:39 +08:00
parent d40cc64fa8
commit 84ae386223
3 changed files with 730 additions and 2 deletions

View File

@@ -3,12 +3,20 @@
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "祝福 壁纸 头像",
"navigationBarTitleText": "全民评分",
"enablePullDownRefresh": true,
"navigationStyle": "custom",
"backgroundColor": "#FFFFFF"
}
},
{
"path": "pages/rating/index",
"style": {
"navigationBarTitleText": "全民评分",
"navigationStyle": "custom",
"enablePullDownRefresh": true
}
},
{
"path": "pages/mine/help",
"style": {

View File

@@ -55,7 +55,12 @@
<!-- 排行榜列表 -->
<view class="rank-list">
<view class="rank-item" v-for="(item, index) in topic.items" :key="item.id">
<view
class="rank-item"
v-for="(item, index) in topic.items"
:key="item.id"
@tap="goToRating(topic.id, item.id)"
>
<text class="rank-num" :class="'rank-' + (index + 1)">{{ index + 1 }}</text>
<image class="item-avatar" :src="item.avatar" mode="aspectFill"></image>
<text class="item-name">{{ item.name }}</text>
@@ -190,6 +195,12 @@ const mockData = [
const topicList = ref([...mockData]);
const goToRating = (topicId, itemId) => {
uni.navigateTo({
url: `/pages/rating/index?topicId=${topicId}&itemId=${itemId}`
});
};
const handleLogin = () => {
if (!userInfo.value.nickName) {
uni.$emit("show-login-popup");

709
pages/rating/index.vue Normal file
View File

@@ -0,0 +1,709 @@
<template>
<view class="page-container">
<!-- 自定义导航栏 -->
<view class="nav-bar" :style="{ paddingTop: statusBarHeight + 'px' }">
<view class="nav-content">
<view class="nav-back" @tap="goBack">
<text class="back-icon"></text>
</view>
<view class="nav-logo-wrap">
<image class="nav-logo" src="/static/images/default-avatar.png" mode="aspectFill" />
</view>
<text class="nav-title">全民评分</text>
</view>
</view>
<!-- 顶部占位 -->
<view :style="{ height: statusBarHeight + 44 + 'px' }"></view>
<view class="content-wrap">
<!-- 头部信息 -->
<view class="topic-header">
<text class="topic-title">{{ topicData.title }}</text>
<view class="topic-stats">
<text class="stat-icon fire-icon"></text>
<text class="stat-text">热度 {{ topicData.heat }}</text>
<text class="stat-text margin-left">{{ topicData.participants }}人参与</text>
</view>
</view>
<!-- AI 实时观察 -->
<view class="ai-observe">
<view class="ai-header">
<text class="ai-icon"></text>
<text class="ai-title">AI 实时观察</text>
</view>
<text class="ai-content">{{ topicData.aiSummary }}</text>
</view>
<!-- 领奖台 (Top 3) -->
<view class="podium-section">
<!-- 第二名 -->
<view class="podium-item rank-2">
<view class="avatar-wrap">
<image class="avatar" :src="topicData.top3[1].avatar" mode="aspectFill" />
<text class="rank-badge badge-2">2</text>
</view>
<view class="info-box box-2">
<text class="name">{{ topicData.top3[1].name }}</text>
<text class="score">分数 {{ topicData.top3[1].score }}</text>
</view>
</view>
<!-- 第一名 -->
<view class="podium-item rank-1">
<view class="avatar-wrap">
<image class="avatar avatar-1" :src="topicData.top3[0].avatar" mode="aspectFill" />
<text class="rank-badge badge-1">1</text>
</view>
<view class="info-box box-1">
<text class="name name-1">{{ topicData.top3[0].name }}</text>
<text class="score score-1">分数 {{ topicData.top3[0].score }}</text>
</view>
</view>
<!-- 第三名 -->
<view class="podium-item rank-3">
<view class="avatar-wrap">
<image class="avatar" :src="topicData.top3[2].avatar" mode="aspectFill" />
<text class="rank-badge badge-3">3</text>
</view>
<view class="info-box box-3">
<text class="name">{{ topicData.top3[2].name }}</text>
<text class="score">分数 {{ topicData.top3[2].score }}</text>
</view>
</view>
</view>
<!-- 评分项列表 -->
<view class="rating-list">
<view class="rating-card" v-for="(item, index) in ratingItems" :key="item.id">
<view class="card-header">
<image class="item-avatar" :src="item.avatar" mode="aspectFill" />
<text class="item-name">{{ item.name }}</text>
<view class="rank-tag" v-if="item.rank <= 3">NO.{{ item.rank }}</view>
<view class="flex-spacer"></view>
<text class="item-score">{{ item.score }}</text>
</view>
<view class="quote-box">
<text class="quote-text">{{ item.quote }}</text>
</view>
<view class="action-group">
<view
class="action-item"
v-for="(action, aIndex) in actions"
:key="aIndex"
:class="{ active: item.userAction === action.value }"
@tap="handleAction(item, action.value)"
>
<view class="action-icon-wrap" :class="'icon-' + action.value">
<text class="emoji">{{ action.emoji }}</text>
</view>
<text class="action-name">{{ action.label }}</text>
</view>
</view>
</view>
</view>
<!-- 热门锐评 -->
<view class="comments-section">
<view class="section-header">
<text class="comment-icon"></text>
<text class="section-title">热门锐评</text>
</view>
<view class="comment-input-box">
<text class="edit-icon"></text>
<text class="placeholder">发表你的锐评...</text>
</view>
<view class="comment-list">
<view class="comment-item" v-for="comment in comments" :key="comment.id">
<view class="comment-user">
<image class="comment-avatar" :src="comment.avatar" mode="aspectFill" />
<text class="comment-name">{{ comment.name }}</text>
<text class="comment-time">{{ comment.time }}</text>
</view>
<view class="comment-content">
<text>{{ comment.content }}</text>
</view>
</view>
</view>
</view>
<!-- 加载更多 -->
<view class="load-more">
<text>{{ loading ? '加载中...' : (hasMore ? '上拉加载更多' : '没有更多了') }}</text>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue';
import { getStatusBarHeight } from "@/utils/system";
import { onPullDownRefresh, onReachBottom, onLoad } from "@dcloudio/uni-app";
// 状态栏高度处理
const statusBarHeight = ref(getStatusBarHeight() || 44);
const loading = ref(false);
const hasMore = ref(true);
const goBack = () => {
uni.navigateBack({
delta: 1
});
};
// 模拟页面数据
const topicData = ref({
title: '你心中的千古一帝',
heat: '98.2w',
participants: '23万',
aiSummary: '当前讨论聚焦于"开疆拓土"与"民生治理"的权重对比。唐太宗凭借高频的"六合一统"评价暂时领跑,而秦始皇的"制度基石"标签正在快速攀升。',
top3: [
{ id: 1, name: '李世民', score: '9.8', avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=11' },
{ id: 2, name: '秦始皇', score: '9.5', avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=12' },
{ id: 3, name: '康熙', score: '9.2', avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=13' }
]
});
const actions = [
{ label: '离谱', value: 'terrible', emoji: '👎' },
{ label: '一般', value: 'bad', emoji: '😐' },
{ label: '不错', value: 'ok', emoji: '🙂' },
{ label: '很强', value: 'good', emoji: '🔥' },
{ label: '封神', value: 'god', emoji: '👑' }
];
const mockRatingItems = [
{
id: 1,
rank: 1,
name: '李世民',
avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=11',
score: '9.8',
quote: '六合一统,文治武功,除了儿子不行没毛病。',
userAction: 'god'
},
{
id: 2,
rank: 2,
name: '秦始皇',
avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=12',
score: '9.5',
quote: '两千年来,我们都还在用他设计的制度版本。',
userAction: ''
}
];
const ratingItems = ref([...mockRatingItems]);
const mockComments = [
{
id: 1,
name: '史学家阿强',
avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=c1',
time: '刚刚',
content: '李世民唯一缺点是儿子太抽象。他在位时那种包容力和大局观,放眼整个历史都是炸裂的存在。'
},
{
id: 2,
name: '逻辑帝',
avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=c2',
time: '2小时前',
content: '秦始皇是开辟者李世民是完善者。一个是0到1的惊天动地一个是1到100的极致巅峰。'
}
];
const comments = ref([...mockComments]);
const handleAction = (item, actionValue) => {
item.userAction = item.userAction === actionValue ? '' : actionValue;
};
// 下拉刷新
onPullDownRefresh(() => {
setTimeout(() => {
ratingItems.value = [...mockRatingItems];
comments.value = [...mockComments];
hasMore.value = true;
uni.stopPullDownRefresh();
}, 1000);
});
// 上拉加载更多
onReachBottom(() => {
if (!hasMore.value || loading.value) return;
loading.value = true;
setTimeout(() => {
const moreComments = mockComments.map(c => ({...c, id: c.id + comments.value.length}));
comments.value.push(...moreComments);
loading.value = false;
if (comments.value.length >= 10) {
hasMore.value = false;
}
}, 1000);
});
</script>
<style lang="scss" scoped>
.page-container {
min-height: 100vh;
background-color: #fafbfe; /* 浅蓝灰色背景 */
padding-bottom: 120rpx; /* 留出底部 tabBar 空间 */
}
/* 导航栏 */
.nav-bar {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 100;
background-color: rgba(250, 251, 254, 0.95);
backdrop-filter: blur(20rpx);
}
.nav-content {
height: 44px;
display: flex;
align-items: center;
padding: 0 32rpx;
}
.nav-back {
padding: 10rpx 24rpx 10rpx 0;
display: flex;
align-items: center;
}
.back-icon {
width: 40rpx;
height: 40rpx;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'%3E%3C/polyline%3E%3C/svg%3E");
background-size: cover;
}
.nav-logo-wrap {
width: 56rpx;
height: 56rpx;
border-radius: 50%;
background: linear-gradient(135deg, #001f3f, #0088a9);
display: flex;
align-items: center;
justify-content: center;
margin-right: 16rpx;
}
.nav-logo {
width: 48rpx;
height: 48rpx;
border-radius: 50%;
}
.nav-title {
font-size: 32rpx;
font-weight: bold;
color: #2953ff;
}
.content-wrap {
padding: 24rpx 32rpx;
}
/* 头部信息 */
.topic-header {
margin-bottom: 32rpx;
margin-top: 16rpx;
}
.topic-title {
font-size: 46rpx;
font-weight: 800;
color: #111;
display: block;
margin-bottom: 20rpx;
letter-spacing: 2rpx;
}
.topic-stats {
display: flex;
align-items: center;
}
.stat-icon.fire-icon {
width: 26rpx;
height: 26rpx;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%232953ff'%3E%3Cpath d='M19.48 13.03c-.02-.19-.13-.36-.29-.46-.17-.11-.38-.13-.56-.05-.98.42-2.12.3-2.92-.31-1.07-.81-1.55-2.22-1.28-3.75.12-.66.1-1.32-.06-1.97-.24-.95-1.1-1.6-2.09-1.58-1 .02-1.83.74-2 1.72-.25 1.55-.95 2.94-2 4.02-1.38 1.41-2.05 3.39-1.85 5.4.2 2.05 1.42 3.86 3.25 4.82 1.37.72 2.94 1.01 4.5.83 2.74-.32 5.06-2.28 5.86-4.95.23-.75.29-1.52.19-2.28-.06-.5-.21-.99-.41-1.45l-.34-.99zm-4.98 6.47c-1.37 0-2.5-1.13-2.5-2.5s1.13-2.5 2.5-2.5 2.5 1.13 2.5 2.5-1.13 2.5-2.5 2.5z'/%3E%3C/svg%3E");
background-size: cover;
margin-right: 12rpx;
}
.stat-text {
font-size: 24rpx;
color: #2953ff;
font-weight: 500;
}
.stat-text.margin-left {
margin-left: 32rpx;
color: #555;
font-weight: normal;
}
/* AI 实时观察 */
.ai-observe {
background: #ffffff;
border: 2rpx solid rgba(77, 68, 241, 0.2);
border-radius: 24rpx;
padding: 28rpx;
margin-bottom: 50rpx;
box-shadow: 0 8rpx 24rpx rgba(77, 68, 241, 0.03);
}
.ai-header {
display: flex;
align-items: center;
margin-bottom: 16rpx;
}
.ai-icon {
width: 32rpx;
height: 32rpx;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234d44f1'%3E%3Cpath d='M12 2l2.4 5.6L20 10l-5.6 2.4L12 18l-2.4-5.6L4 10l5.6-2.4L12 2zm0 0'/%3E%3C/svg%3E");
background-size: cover;
margin-right: 12rpx;
}
.ai-title {
font-size: 28rpx;
font-weight: bold;
color: #4d44f1;
}
.ai-content {
font-size: 26rpx;
color: #444;
line-height: 1.6;
}
/* 领奖台 (Top 3) */
.podium-section {
display: flex;
justify-content: center;
align-items: flex-end;
height: 360rpx;
margin-bottom: 50rpx;
gap: 16rpx;
}
.podium-item {
display: flex;
flex-direction: column;
align-items: center;
position: relative;
}
.avatar-wrap {
position: relative;
z-index: 2;
margin-bottom: -44rpx; /* 将头像下移,覆盖在底座上 */
}
.avatar {
width: 120rpx;
height: 120rpx;
border-radius: 50%;
border: 4rpx solid #fff;
box-shadow: 0 8rpx 16rpx rgba(0,0,0,0.1);
background-color: #eee;
}
.avatar-1 {
width: 140rpx;
height: 140rpx;
border-color: #ffd700; /* 冠军金边 */
border-width: 6rpx;
}
.rank-badge {
position: absolute;
bottom: 4rpx;
right: -8rpx;
width: 36rpx;
height: 36rpx;
border-radius: 50%;
color: #111;
font-size: 22rpx;
font-weight: 900;
display: flex;
align-items: center;
justify-content: center;
border: 4rpx solid #fff;
}
.badge-1 { background-color: #ffd700; width: 44rpx; height: 44rpx; right: -10rpx; bottom: 0; font-size: 26rpx; }
.badge-2 { background-color: #e2e8f0; }
.badge-3 { background-color: #e2e8f0; }
.info-box {
width: 200rpx;
display: flex;
flex-direction: column;
align-items: center;
padding-top: 56rpx;
padding-bottom: 24rpx;
border-radius: 20rpx;
}
.box-1 {
width: 220rpx;
height: 190rpx;
background: linear-gradient(180deg, #6c5ce7 0%, #5a48eb 100%);
color: #fff;
box-shadow: 0 12rpx 32rpx rgba(108, 92, 231, 0.3);
}
.box-2 {
height: 150rpx;
background-color: #e4e7f3;
}
.box-3 {
height: 130rpx;
background-color: #eef1f8;
}
.name {
font-size: 30rpx;
font-weight: bold;
color: #333;
margin-bottom: 8rpx;
}
.name-1 {
color: #fff;
font-size: 34rpx;
}
.score {
font-size: 24rpx;
color: #888;
}
.score-1 {
color: rgba(255,255,255,0.8);
}
/* 评分项列表 */
.rating-list {
margin-bottom: 40rpx;
}
.rating-card {
background-color: #fff;
border-radius: 32rpx;
padding: 32rpx;
margin-bottom: 32rpx;
box-shadow: 0 4rpx 24rpx rgba(0,0,0,0.02);
}
.card-header {
display: flex;
align-items: center;
margin-bottom: 24rpx;
}
.item-avatar {
width: 90rpx;
height: 90rpx;
border-radius: 20rpx;
margin-right: 24rpx;
background-color: #eee;
}
.item-name {
font-size: 36rpx;
font-weight: bold;
color: #111;
margin-right: 16rpx;
}
.rank-tag {
background-color: #eef1ff;
color: #2953ff;
font-size: 22rpx;
font-weight: bold;
padding: 4rpx 16rpx;
border-radius: 10rpx;
}
.flex-spacer {
flex: 1;
}
.item-score {
font-size: 48rpx;
font-weight: 900;
color: #2953ff;
font-family: 'DIN Alternate', sans-serif;
}
.quote-box {
background-color: #f9fafe;
border-radius: 0 20rpx 20rpx 20rpx;
padding: 24rpx 28rpx;
margin-bottom: 36rpx;
border-left: 6rpx solid #c9d4ff;
}
.quote-text {
font-size: 30rpx;
color: #555;
font-style: italic;
line-height: 1.5;
}
.action-group {
display: flex;
justify-content: space-between;
padding: 0 10rpx;
}
.action-item {
display: flex;
flex-direction: column;
align-items: center;
}
.action-icon-wrap {
width: 88rpx;
height: 88rpx;
border-radius: 50%;
background-color: #f5f6fa;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 12rpx;
transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.emoji {
font-size: 44rpx;
}
.action-name {
font-size: 24rpx;
color: #999;
}
.action-item.active .action-icon-wrap {
background-color: #eef1ff;
transform: scale(1.15);
box-shadow: 0 8rpx 16rpx rgba(41, 83, 255, 0.15);
}
.action-item.active .action-name {
color: #2953ff;
font-weight: bold;
}
/* 热门锐评 */
.comments-section {
margin-bottom: 40rpx;
}
.section-header {
display: flex;
align-items: center;
margin-bottom: 32rpx;
}
.comment-icon {
width: 40rpx;
height: 40rpx;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232953ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'%3E%3C/path%3E%3C/svg%3E");
background-size: cover;
margin-right: 12rpx;
}
.section-title {
font-size: 36rpx;
font-weight: bold;
color: #111;
}
.comment-input-box {
background-color: #f0f2f7;
border-radius: 20rpx;
padding: 24rpx 32rpx;
display: flex;
align-items: center;
margin-bottom: 40rpx;
}
.edit-icon {
width: 36rpx;
height: 36rpx;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23666'%3E%3Cpath d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z'/%3E%3C/svg%3E");
background-size: cover;
margin-right: 16rpx;
}
.placeholder {
font-size: 28rpx;
color: #888;
}
.comment-list {
display: flex;
flex-direction: column;
gap: 24rpx;
}
.comment-item {
background-color: #f5f7fb;
border-radius: 28rpx;
padding: 28rpx;
}
.comment-user {
display: flex;
align-items: center;
margin-bottom: 20rpx;
}
.comment-avatar {
width: 56rpx;
height: 56rpx;
border-radius: 50%;
margin-right: 16rpx;
background-color: #eee;
}
.comment-name {
font-size: 28rpx;
font-weight: bold;
color: #333;
margin-right: 16rpx;
}
.comment-time {
font-size: 24rpx;
color: #999;
}
.comment-content {
font-size: 30rpx;
color: #333;
line-height: 1.6;
}
.load-more {
text-align: center;
padding: 30rpx 0;
color: #999;
font-size: 24rpx;
}
</style>