Files
shoot-miniprograms/src/components/PlayerSeats.vue

129 lines
2.7 KiB
Vue
Raw Normal View History

2025-06-04 16:26:07 +08:00
<script setup>
2026-02-05 10:35:12 +08:00
import Avatar from "@/components/Avatar.vue";
2025-06-16 22:43:39 +08:00
const props = defineProps({
total: {
type: Number,
default: 10,
},
2025-06-04 16:26:07 +08:00
players: {
type: Array,
default: () => [],
},
});
2025-06-16 22:43:39 +08:00
const seats = new Array(props.total).fill(1);
2025-06-04 16:26:07 +08:00
</script>
<template>
<view class="players">
<view v-for="(_, index) in seats" :key="index">
<image src="../static/player-bg.png" mode="widthFix" />
2026-02-05 10:35:12 +08:00
<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>
2025-06-04 16:26:07 +08:00
<view v-else class="player-unknow">
<image src="../static/question-mark.png" mode="widthFix" />
</view>
2025-07-15 17:10:41 +08:00
<text v-if="players[index] && players[index].name">{{
players[index].name
}}</text>
2025-06-04 16:26:07 +08:00
<text v-else :style="{ color: '#fff9' }">虚位以待</text>
2026-02-05 10:35:12 +08:00
<view v-if="index === 0" class="founder">管理员</view>
2025-06-04 16:26:07 +08:00
<image
:src="`../static/player-${index + 1}.png`"
mode="widthFix"
class="player-bg"
/>
</view>
</view>
</template>
<style scoped>
.players {
display: flex;
flex-wrap: wrap;
2025-06-16 22:43:39 +08:00
justify-content: flex-start;
-moz-column-gap: 20px;
column-gap: 14px;
2025-06-04 16:26:07 +08:00
margin-bottom: 20px;
font-size: 14px;
2025-06-16 22:43:39 +08:00
padding: 0 14px;
2025-06-04 16:26:07 +08:00
}
.players > view {
2025-06-16 22:43:39 +08:00
width: calc(50% - 7px);
2025-06-04 16:26:07 +08:00
display: flex;
align-items: center;
position: relative;
color: #fff;
2025-06-16 22:43:39 +08:00
height: 100px;
2025-06-04 16:26:07 +08:00
overflow: hidden;
}
.players > view > image:first-child {
width: 100%;
position: absolute;
z-index: -1;
}
2026-02-05 10:35:12 +08:00
.avatar {
display: flex;
flex-direction: column;
align-items: center;
padding: 0 24rpx;
margin-top: 16rpx;
}
.avatar > text {
background-color: #2c261fb3;
2026-02-05 18:06:55 +08:00
border: 1rpx solid #a3793f66;
2026-02-05 10:35:12 +08:00
color: #fed847;
font-size: 16rpx;
border-radius: 20rpx;
width: 70rpx;
text-align: center;
margin-top: -16rpx;
position: relative;
height: 28rpx;
line-height: 28rpx;
2025-06-04 16:26:07 +08:00
}
2025-06-16 22:43:39 +08:00
.players > view > text:nth-child(3) {
width: 20vw;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
2025-06-04 16:26:07 +08:00
.founder {
position: absolute;
background-color: #fed847;
2025-06-17 12:01:44 +08:00
top: 6px;
2025-06-04 16:26:07 +08:00
color: #000;
2025-06-16 22:43:39 +08:00
font-size: 10px;
2025-06-04 16:26:07 +08:00
padding: 2px 5px;
border-top-left-radius: 10px;
border-bottom-right-radius: 10px;
}
.player-bg {
position: absolute;
width: 52px;
right: 0;
}
.player-unknow {
width: 40px;
height: 40px;
2026-02-05 10:35:12 +08:00
margin: 0 24rpx;
2025-06-04 16:26:07 +08:00
border: 1px solid #fff3;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
background-color: #69686866;
}
.player-unknow > image {
width: 40%;
}
</style>