2025-05-01 21:38:35 +08:00
|
|
|
<script setup>
|
2025-05-26 16:28:13 +08:00
|
|
|
import { computed } from "vue";
|
2025-05-27 12:38:39 +08:00
|
|
|
import Avatar from "@/components/Avatar.vue";
|
2025-05-01 21:38:35 +08:00
|
|
|
const props = defineProps({
|
|
|
|
|
showRank: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
2025-05-26 16:28:13 +08:00
|
|
|
user: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: () => ({
|
2025-05-27 12:38:39 +08:00
|
|
|
nickName: "",
|
|
|
|
|
lvl: 0,
|
|
|
|
|
points: 0,
|
|
|
|
|
rankLvl: 0,
|
|
|
|
|
lvlPoints: 0,
|
2025-05-26 16:28:13 +08:00
|
|
|
}),
|
|
|
|
|
},
|
2025-05-01 21:38:35 +08:00
|
|
|
});
|
|
|
|
|
const containerWidth = computed(() => (props.showRank ? "72vw" : "100vw"));
|
|
|
|
|
const toUserPage = () => {
|
|
|
|
|
// 获取当前页面路径
|
|
|
|
|
const pages = getCurrentPages();
|
|
|
|
|
const currentPage = pages[pages.length - 1];
|
2025-05-26 16:28:13 +08:00
|
|
|
|
2025-05-01 21:38:35 +08:00
|
|
|
// 如果当前不是用户页面才进行跳转
|
2025-05-26 16:28:13 +08:00
|
|
|
if (currentPage.route !== "pages/user") {
|
2025-05-01 21:38:35 +08:00
|
|
|
uni.navigateTo({
|
|
|
|
|
url: "/pages/user",
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<view class="container" :style="{ width: containerWidth }">
|
2025-05-27 12:38:39 +08:00
|
|
|
<Avatar frame="true" src="../static/avatar.png" :onClick="toUserPage" />
|
2025-05-01 21:38:35 +08:00
|
|
|
<view class="user-details">
|
|
|
|
|
<view class="user-name">
|
2025-05-26 16:28:13 +08:00
|
|
|
<text>{{ user.nickName }}</text>
|
2025-05-01 21:38:35 +08:00
|
|
|
<image src="../static/vip1.png" mode="widthFix" />
|
|
|
|
|
</view>
|
|
|
|
|
<view class="user-stats">
|
|
|
|
|
<text class="level-tag">钻石1级</text>
|
2025-05-26 16:28:13 +08:00
|
|
|
<text class="level-tag">{{ user.lvl }}</text>
|
2025-05-01 21:38:35 +08:00
|
|
|
<view class="rank-tag">
|
|
|
|
|
<view :style="{ width: '40%' }" />
|
2025-05-26 16:28:13 +08:00
|
|
|
<text>{{ user.lvl }}/{{ user.lvlPoints }}</text>
|
2025-05-01 21:38:35 +08:00
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-if="showRank === true" class="rank-info">
|
|
|
|
|
<image src="../static/global-rank.png" mode="widthFix" />
|
|
|
|
|
<text>本赛季全国</text>
|
|
|
|
|
<text class="rank-number"
|
|
|
|
|
>第<text :style="{ color: '#ffd700' }"
|
2025-05-26 16:28:13 +08:00
|
|
|
>{{ user.points }}/{{ user.rankLvl }}</text
|
2025-05-01 21:38:35 +08:00
|
|
|
>名</text
|
|
|
|
|
>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.container {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
width: 72vw;
|
|
|
|
|
padding-left: 15px;
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.user-details {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
padding-left: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.user-name {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
margin-bottom: 5px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.user-name > image {
|
|
|
|
|
margin-left: 5px;
|
2025-05-08 22:05:53 +08:00
|
|
|
width: 20px;
|
2025-05-01 21:38:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.user-stats {
|
|
|
|
|
display: flex;
|
|
|
|
|
gap: 5px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.level-tag {
|
|
|
|
|
text-align: center;
|
|
|
|
|
line-height: 16px;
|
|
|
|
|
}
|
|
|
|
|
.level-tag:first-child {
|
|
|
|
|
width: 45px;
|
|
|
|
|
background: #5f51ff;
|
|
|
|
|
}
|
|
|
|
|
.level-tag:nth-child(2) {
|
|
|
|
|
width: 30px;
|
|
|
|
|
background: #09c504;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.level-tag,
|
|
|
|
|
.rank-tag {
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
font-size: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.rank-tag {
|
|
|
|
|
position: relative;
|
|
|
|
|
background-color: #00000038;
|
|
|
|
|
width: 56px;
|
|
|
|
|
height: 16px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.rank-tag > view:first-child {
|
|
|
|
|
background: #ffa711;
|
|
|
|
|
height: 100%;
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.rank-tag > text {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 5px;
|
|
|
|
|
line-height: 16px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.rank-info {
|
|
|
|
|
text-align: left;
|
|
|
|
|
font-size: 10px;
|
|
|
|
|
position: relative;
|
|
|
|
|
color: #b3b3b3;
|
|
|
|
|
padding-left: 8px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.rank-info > image {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: -8px;
|
|
|
|
|
left: -8px;
|
|
|
|
|
width: 90px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.rank-number {
|
|
|
|
|
display: block;
|
|
|
|
|
}
|
|
|
|
|
</style>
|