显示已准备状态

This commit is contained in:
kron
2026-02-05 10:35:12 +08:00
parent 7f73f3ebb3
commit 93c549109f
2 changed files with 92 additions and 120 deletions

View File

@@ -1,4 +1,6 @@
<script setup>
import Avatar from "@/components/Avatar.vue";
const props = defineProps({
total: {
type: Number,
@@ -16,11 +18,16 @@ const seats = new Array(props.total).fill(1);
<view class="players">
<view v-for="(_, index) in seats" :key="index">
<image src="../static/player-bg.png" mode="widthFix" />
<image
v-if="players[index] && players[index].name"
:src="players[index].avatar || '../static/user-icon.png'"
mode="widthFix"
/>
<view v-if="players[index] && players[index].name" class="avatar">
<Avatar
:src="players[index].avatar || '../static/user-icon.png'"
:size="40"
/>
<text
:style="{ opacity: players[index] && !!players[index].state ? 1 : 0 }"
>已准备</text
>
</view>
<view v-else class="player-unknow">
<image src="../static/question-mark.png" mode="widthFix" />
</view>
@@ -28,7 +35,7 @@ const seats = new Array(props.total).fill(1);
players[index].name
}}</text>
<text v-else :style="{ color: '#fff9' }">虚位以待</text>
<view v-if="index === 0" class="founder">创建者</view>
<view v-if="index === 0" class="founder">管理员</view>
<image
:src="`../static/player-${index + 1}.png`"
mode="widthFix"
@@ -63,13 +70,25 @@ const seats = new Array(props.total).fill(1);
position: absolute;
z-index: -1;
}
.players > view > image:nth-child(2) {
width: 40px;
height: 40px;
min-height: 40px;
margin: 0 10px;
border: 1px solid #fff;
border-radius: 50%;
.avatar {
display: flex;
flex-direction: column;
align-items: center;
padding: 0 24rpx;
margin-top: 16rpx;
}
.avatar > text {
background-color: #2c261fb3;
border-color: #a3793f66;
color: #fed847;
font-size: 16rpx;
border-radius: 20rpx;
width: 70rpx;
text-align: center;
margin-top: -16rpx;
position: relative;
height: 28rpx;
line-height: 28rpx;
}
.players > view > text:nth-child(3) {
width: 20vw;
@@ -95,7 +114,7 @@ const seats = new Array(props.total).fill(1);
.player-unknow {
width: 40px;
height: 40px;
margin: 0 10px;
margin: 0 24rpx;
border: 1px solid #fff3;
border-radius: 50%;
display: flex;