<template>
|
|
<view class="ranking-page">
|
|
<view class="back-button" @click="goBack">
|
|
<uv-icon name="arrow-left" color="#ffffff" size="20"></uv-icon>
|
|
</view>
|
|
|
|
<!-- 排行榜背景 -->
|
|
<view class="ranking-background">
|
|
<image src="/subPages/static/rank_bg.png" class="bg-image" mode="aspectFill"></image>
|
|
<!-- 返回按钮 -->
|
|
|
|
|
|
|
|
|
|
<!-- 前三名定位布局 -->
|
|
<view class="top-three">
|
|
<!-- 第二名 -->
|
|
<view class="rank-item rank-second">
|
|
<image src="@/subPages/static/second.png" class="rank-badge"></image>
|
|
<image src="@/static/默认头像.png" class="avatar"></image>
|
|
<view class="name">李潇亮</view>
|
|
<view class="score">3658积分</view>
|
|
</view>
|
|
|
|
<!-- 第一名 -->
|
|
<view class="rank-item rank-first">
|
|
<image src="/subPages/static/first.png" class="rank-badge"></image>
|
|
<image src="/static/默认头像.png" class="avatar"></image>
|
|
<view class="name">李潇亮</view>
|
|
<view class="score">4658积分</view>
|
|
</view>
|
|
|
|
<!-- 第三名 -->
|
|
<view class="rank-item rank-third">
|
|
<image src="/subPages/static/third.png" class="rank-badge"></image>
|
|
<image src="/static/默认头像.png" class="avatar"></image>
|
|
<view class="name">李潇亮</view>
|
|
<view class="score">1658积分</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 我的排名 -->
|
|
<view class="my-ranking">
|
|
<view class="my-rank-number">{{ myRanking.rank }}</view>
|
|
<view class="my-rank-label">我的排名</view>
|
|
<image :src="myRanking.avatar" class="my-avatar"></image>
|
|
<view class="my-name">{{ myRanking.name }}</view>
|
|
<view class="my-score">{{ myRanking.score }}积分</view>
|
|
</view>
|
|
|
|
<!-- 排行榜列表 -->
|
|
<view class="ranking-list">
|
|
<view class="list-item" v-for="(item, index) in rankingList" :key="index">
|
|
<view class="rank-number">{{ item.rank }}</view>
|
|
<image :src="item.avatar" class="list-avatar"></image>
|
|
<view class="user-info">
|
|
<view class="user-name">{{ item.name }}</view>
|
|
</view>
|
|
<view class="user-score">{{ item.score }}积分</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'Ranking',
|
|
data() {
|
|
return {
|
|
myRanking: {
|
|
rank: 15,
|
|
name: '李潇亮',
|
|
avatar: '/static/默认头像.png',
|
|
score: 958
|
|
},
|
|
rankingList: [
|
|
{ rank: 4, name: '李潇亮', avatar: '/static/默认头像.png', score: 958 },
|
|
{ rank: 5, name: '李潇亮', avatar: '/static/默认头像.png', score: 958 },
|
|
{ rank: 6, name: '李潇亮', avatar: '/static/默认头像.png', score: 958 },
|
|
{ rank: 7, name: '李潇亮', avatar: '/static/默认头像.png', score: 958 },
|
|
{ rank: 8, name: '李潇亮', avatar: '/static/默认头像.png', score: 958 },
|
|
{ rank: 9, name: '李潇亮', avatar: '/static/默认头像.png', score: 958 },
|
|
{ rank: 10, name: '李潇亮', avatar: '/static/默认头像.png', score: 958 }
|
|
]
|
|
}
|
|
},
|
|
onLoad() {
|
|
// 获取排行榜数据
|
|
this.getRankingData();
|
|
},
|
|
methods: {
|
|
goBack() {
|
|
uni.navigateBack();
|
|
},
|
|
getRankingData() {
|
|
// 模拟获取排行榜数据
|
|
console.log('获取排行榜数据');
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
// @import '@/uni.scss';
|
|
|
|
.ranking-page {
|
|
min-height: 100vh;
|
|
background-color: #f5f5f5;
|
|
}
|
|
|
|
.back-button {
|
|
position: absolute;
|
|
top: 60rpx;
|
|
left: 30rpx;
|
|
width: 60rpx;
|
|
height: 60rpx;
|
|
// background-color: rgba(0, 0, 0, 0.3);
|
|
// border-radius: 50%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
z-index: 10;
|
|
|
|
&:active {
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
}
|
|
}
|
|
|
|
.ranking-background {
|
|
position: relative;
|
|
width: 100%;
|
|
height: 600rpx;
|
|
|
|
.bg-image {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.back-button {
|
|
position: absolute;
|
|
top: 60rpx;
|
|
left: 30rpx;
|
|
width: 60rpx;
|
|
height: 60rpx;
|
|
// background-color: rgba(0, 0, 0, 0.3);
|
|
// border-radius: 50%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
z-index: 10;
|
|
|
|
&:active {
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.top-three {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
display: flex;
|
|
align-items: flex-end;
|
|
justify-content: center;
|
|
padding-bottom: 80rpx;
|
|
|
|
.rank-item {
|
|
position: relative;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
margin: 0 40rpx;
|
|
|
|
.rank-badge {
|
|
width: 60rpx;
|
|
height: 60rpx;
|
|
margin-bottom: 10rpx;
|
|
}
|
|
|
|
.avatar {
|
|
width: 80rpx;
|
|
height: 80rpx;
|
|
border-radius: 50%;
|
|
margin-bottom: 10rpx;
|
|
border: 4rpx solid #fff;
|
|
}
|
|
|
|
.name {
|
|
font-size: 24rpx;
|
|
color: #fff;
|
|
margin-bottom: 5rpx;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.score {
|
|
font-size: 20rpx;
|
|
color: #fff;
|
|
opacity: 0.9;
|
|
}
|
|
}
|
|
|
|
.rank-first {
|
|
transform: translateY(-40rpx);
|
|
|
|
.avatar {
|
|
width: 100rpx;
|
|
height: 100rpx;
|
|
}
|
|
|
|
.rank-badge {
|
|
width: 80rpx;
|
|
height: 80rpx;
|
|
}
|
|
}
|
|
|
|
.rank-second {
|
|
order: -1;
|
|
}
|
|
|
|
.rank-third {
|
|
order: 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
.my-ranking {
|
|
background: #e1f2ff;
|
|
border-radius: 12rpx;
|
|
margin: 20rpx 30rpx 20rpx 30rpx;
|
|
padding: 30rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
// box-shadow: 0 4rpx 12rpx rgba(20, 136, 219, 0.3);
|
|
position: relative;
|
|
z-index: 5;
|
|
|
|
.my-rank-number {
|
|
font-size: 48rpx;
|
|
font-weight: bold;
|
|
color: #000;
|
|
margin-right: 15rpx;
|
|
}
|
|
|
|
.my-rank-label {
|
|
font-size: 24rpx;
|
|
color: #1488DB;
|
|
opacity: 0.9;
|
|
margin-right: 20rpx;
|
|
}
|
|
|
|
.my-avatar {
|
|
width: 60rpx;
|
|
height: 60rpx;
|
|
border-radius: 50%;
|
|
// border: 3rpx solid #fff;
|
|
margin-right: 15rpx;
|
|
}
|
|
|
|
.my-name {
|
|
font-size: 28rpx;
|
|
color: #000;
|
|
font-weight: 500;
|
|
margin-right: 20rpx;
|
|
}
|
|
|
|
.my-score {
|
|
font-size: 28rpx;
|
|
color: #1488DB;
|
|
// font-weight: bold;
|
|
}
|
|
}
|
|
|
|
.ranking-list {
|
|
padding: 40rpx 30rpx;
|
|
background-color: #fff;
|
|
margin-top: -40rpx;
|
|
border-radius: 40rpx 40rpx 0 0;
|
|
|
|
.list-item {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 30rpx 0;
|
|
border-bottom: 1rpx solid #f0f0f0;
|
|
|
|
&:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.rank-number {
|
|
width: 60rpx;
|
|
font-size: 32rpx;
|
|
font-weight: bold;
|
|
color: #333;
|
|
text-align: center;
|
|
}
|
|
|
|
.list-avatar {
|
|
width: 80rpx;
|
|
height: 80rpx;
|
|
border-radius: 50%;
|
|
margin: 0 30rpx;
|
|
}
|
|
|
|
.user-info {
|
|
flex: 1;
|
|
|
|
.user-name {
|
|
font-size: 28rpx;
|
|
color: #333;
|
|
font-weight: 500;
|
|
}
|
|
}
|
|
|
|
.user-score {
|
|
font-size: 28rpx;
|
|
color: $uni-color-primary;
|
|
// font-weight: bold;
|
|
}
|
|
}
|
|
}
|
|
</style>
|