|
|
- <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="topThree[1].headImage || '/static/默认头像.png'" class="avatar"></image>
- <view class="name">{{ topThree[1].nickName }}</view>
- <view class="score">{{ topThree[1].score }}积分</view>
- </view>
-
- <!-- 第一名 -->
- <view class="rank-item rank-first">
- <image src="/subPages/static/first.png" class="rank-badge"></image>
- <image :src="topThree[0].headImage || '/static/默认头像.png'" class="avatar"></image>
- <view class="name">{{ topThree[0].nickName }}</view>
- <view class="score">{{ topThree[0].score }}积分</view>
- </view>
-
- <!-- 第三名 -->
- <view class="rank-item rank-third">
- <image src="/subPages/static/third.png" class="rank-badge"></image>
- <image :src="topThree[2].headImage || '/static/默认头像.png'" class="avatar"></image>
- <view class="name">{{ topThree[2].nickName }}</view>
- <view class="score">{{ topThree[2].score }}积分</view>
- </view>
- </view>
- </view>
-
- <!-- 我的排名 -->
- <view class="my-ranking" v-if="myRanking.rank !== null || myRanking.rank !== undefined">
- <view class="my-rank-number">{{ myRanking.rank }}</view>
- <view class="my-rank-label">我的排名</view>
- <image :src="myRanking.headImage" class="my-avatar"></image>
- <view class="my-name">{{ myRanking.nickName }}</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.headImage || '/static/默认头像.png'" class="list-avatar"></image>
- <view class="user-info">
- <view class="user-name">{{ item.nickName }}</view>
- </view>
- <view class="user-score">{{ item.score }}积分</view>
- </view>
- </view>
- </view>
- </template>
-
- <script>
- import MixinList from '@/mixins/list.js'
- export default {
- mixins: [MixinList],
- name: 'Ranking',
- data() {
- return {
- pageSize: 12,
- mixinListApi: 'score.queryScoreRank',
- mixinListConfig: {
- extraDataPath: 'result.myScore',
- responsePath: 'result.scoreList.records'
- }
- }
- },
- computed: {
- myRanking() {
- return this.extraData
- },
- rankingList() {
- return this.list.slice(3)
- },
- topThree() {
- return this.list.slice(0, 3)
- },
- },
- methods: {
- mixinSetParams() {
- const params = {
- pageNo: this.pageNo,
- pageSize: this.pageSize
- }
- if (uni.getStorageSync('token')){
- params['token'] = uni.getStorageSync('token')
- }
- return params
- },
- goBack() {
- uni.navigateBack();
- }
- }
- }
- </script>
-
- <style lang="scss" scoped>
- // @import '@/uni.scss';
-
- .ranking-page {
- min-height: 100vh;
- background-color: #f5f5f5;
- }
-
- .back-button {
- position: fixed;
- top: 70rpx;
- left: 40rpx;
- width: 70rpx;
- height: 70rpx;
- // 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: #1488DB;
- opacity: 0.9;
- }
- }
-
- .rank-first {
- transform: translateY(-80rpx);
-
- .avatar {
- width: 100rpx;
- height: 100rpx;
- }
-
- .rank-badge {
- width: 80rpx;
- height: 80rpx;
- }
- }
-
- .rank-second {
- order: -1;
- transform: translateY(-40rpx);
- }
-
- .rank-third {
- order: 1;
- transform: translateY(-40rpx);
- }
- }
- }
-
- .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 140rpx;
- 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>
|