ykt-team-wxapp/pages/home/team-head.vue

261 lines
6.1 KiB
Vue
Raw Normal View History

2026-01-20 19:36:49 +08:00
<template>
<view>
2026-02-03 10:45:54 +08:00
<view :style="{ height: statusBarHeight }" class="status-bar"></view>
<view class="relative z-3 flex items-center px-15 py-12 header-bar">
2026-01-20 19:36:49 +08:00
<view class="flex-shrink-0 mr-5">
2026-02-04 15:23:57 +08:00
<group-avatar :size="120" :avatarList="currentTeam ? currentTeam.avatarList : []" />
2026-01-20 19:36:49 +08:00
</view>
2026-02-03 17:02:39 +08:00
<view class="w-0 flex-grow">
2026-02-03 10:45:54 +08:00
<view class="flex items-center mb-10">
2026-02-03 15:42:32 +08:00
<view class="team-name flex-shrink-0">{{ team.name }}</view>
2026-02-04 15:23:57 +08:00
<view v-if="teams.length > 1" class="flex-shrink-0 flex items-center switch-btn ml-10"
@click="showDropDown = true">
<image class="switch-icon" src="/static/home/switch-team.png" mode="aspectFit"></image>
2026-01-20 19:36:49 +08:00
</view>
</view>
2026-02-04 15:23:57 +08:00
<view v-if="currentTeam" class="text-base text-white truncate">
{{ currentTeam.corpName }}
</view>
2026-01-20 19:36:49 +08:00
</view>
2026-02-04 15:23:57 +08:00
<view v-if="menuButtonInfo && menuButtonInfo.width > 0" class="flex-shrink-0" :style="{
width: menuButtonInfo.width + 'px',
height: menuButtonInfo.height + 'px',
}">
2026-01-20 19:36:49 +08:00
</view>
</view>
<view class="relative">
<view v-if="showDropDown" class="team-dropdown py-12 bg-white shadow-lg">
2026-02-03 17:02:39 +08:00
<scroll-view scroll-y="true" style="max-height: 50vh">
2026-01-20 19:36:49 +08:00
<view class="px-15">
2026-02-04 15:23:57 +08:00
<view v-for="item in teams" :key="item.teamId" class="mb-10 p-10 flex items-center bg-gray rounded-sm"
@click="select(item)">
2026-02-03 17:02:39 +08:00
<view class="flex-shrink-0 mr-5 rounded-circle">
2026-01-20 19:36:49 +08:00
<group-avatar :size="96" :avatarList="item.avatarList" />
</view>
<view class="w-0 flex-grow mr-5">
2026-02-04 15:23:57 +08:00
<view class="mb-5 text-lg font-semibold text-dark">
{{ item.name }}
</view>
<view class="text-base text-gray leading-normal">
{{ item.corpName }}
</view>
2026-01-20 19:36:49 +08:00
</view>
<view class="flex">
2026-02-04 15:23:57 +08:00
<image class="check-icon" :src="team && team.teamId === item.teamId
? '/static/form/checked.svg'
: '/static/form/uncheck.svg'
">
2026-01-20 19:36:49 +08:00
</image>
</view>
</view>
</view>
</scroll-view>
</view>
</view>
2026-02-04 15:23:57 +08:00
<view v-if="qrcode && qrcode.guide" class="team-introduce-wrapper">
2026-02-03 10:45:54 +08:00
<view class="team-introduce flex items-center">
2026-02-03 15:42:32 +08:00
<!-- 顶部小三角形 -->
<view class="triangle-wrapper">
<view class="team-triangle"></view>
</view>
2026-02-04 15:23:57 +08:00
<image class="laba-icon flex-shrink-0" src="/static/home/speaker-intro.png" mode="aspectFit"></image>
<view class="introduce-text flex-grow line-clamp-2">
{{ qrcode.guide }}
</view>
2026-02-03 10:45:54 +08:00
</view>
2026-01-20 19:36:49 +08:00
</view>
</view>
<view v-if="showDropDown" class="mask" @click="showDropDown = false"></view>
</template>
<script setup>
2026-02-03 17:02:39 +08:00
import { computed, ref, onMounted, watch } from "vue";
2026-01-20 19:36:49 +08:00
2026-02-03 17:02:39 +08:00
import groupAvatar from "@/components/group-avatar.vue";
2026-01-20 19:36:49 +08:00
2026-02-03 17:02:39 +08:00
const statusBarHeight = ref("50px");
2026-01-20 19:36:49 +08:00
const menuButtonInfo = ref(null);
2026-02-03 17:02:39 +08:00
const showDropDown = ref(false);
2026-01-20 19:36:49 +08:00
2026-02-03 17:02:39 +08:00
const emits = defineEmits(["changeTeam"]);
2026-01-20 19:36:49 +08:00
const props = defineProps({
team: {
type: Object,
2026-02-03 17:02:39 +08:00
default: () => ({}),
2026-01-20 19:36:49 +08:00
},
teams: {
type: Array,
2026-02-03 17:02:39 +08:00
default: () => [],
},
});
2026-01-20 19:36:49 +08:00
2026-02-03 17:02:39 +08:00
const currentTeam = computed(() =>
props.teams.find((i) => props.team && i.teamId === props.team.teamId)
);
2026-02-04 15:23:57 +08:00
const qrcode = computed(() => {
const qrcodes = props.team && Array.isArray(props.team.qrcodes) ? props.team.qrcodes : [];
return qrcodes[0] || ''
})
2026-01-20 19:36:49 +08:00
2026-01-21 10:35:08 +08:00
function select(team) {
2026-02-03 17:02:39 +08:00
emits("changeTeam", team);
showDropDown.value = false;
2026-01-21 10:35:08 +08:00
}
2026-02-03 17:02:39 +08:00
watch(
() => props.teams,
(teams) => {
if (
teams.length &&
!(
currentTeam.value &&
teams.some((i) => i.teamId === currentTeam.value.teamId)
)
) {
emits("changeTeam", teams[0]);
}
2026-01-20 19:36:49 +08:00
}
2026-02-03 17:02:39 +08:00
);
2026-01-20 19:36:49 +08:00
onMounted(() => {
const win = uni.getWindowInfo();
if (win && win.statusBarHeight > 0) {
2026-02-03 17:02:39 +08:00
statusBarHeight.value = win.statusBarHeight + "px";
2026-01-20 19:36:49 +08:00
}
menuButtonInfo.value = uni.getMenuButtonBoundingClientRect();
2026-02-03 17:02:39 +08:00
});
2026-01-20 19:36:49 +08:00
</script>
<style scoped>
2026-02-03 10:45:54 +08:00
.status-bar {
background: transparent;
2026-02-03 09:59:49 +08:00
}
2026-02-03 10:45:54 +08:00
.header-bar {
background: transparent;
}
.laba-icon {
2026-02-03 09:59:49 +08:00
width: 48rpx;
height: 48rpx;
2026-02-03 15:42:32 +08:00
margin-left: 12rpx;
margin-right: 12rpx;
}
.team-name {
color: #ffffff;
font-size: 36rpx;
font-style: normal;
font-weight: 600;
line-height: normal;
2026-02-03 09:59:49 +08:00
}
2026-02-03 10:45:54 +08:00
.switch-icon {
width: 40rpx;
height: 40rpx;
}
2026-02-03 09:59:49 +08:00
.switch-btn {
padding: 4rpx;
}
2026-02-03 10:45:54 +08:00
.ml-10 {
margin-left: 12rpx;
}
.team-introduce-wrapper {
padding: 0 30rpx;
margin-top: 20rpx;
margin-bottom: 30rpx;
position: relative;
z-index: 2;
}
2026-02-03 09:59:49 +08:00
.team-introduce {
2026-02-03 15:42:32 +08:00
width: 690rpx;
min-height: 111rpx;
box-sizing: border-box;
2026-02-04 15:23:57 +08:00
background: linear-gradient(186deg,
rgba(255, 255, 255, 0.4) 13.34%,
rgba(255, 255, 255, 0.6) 99.17%);
2026-02-03 09:59:49 +08:00
border-radius: 16rpx;
2026-02-03 15:42:32 +08:00
padding: 20rpx 20rpx 20rpx 0;
2026-02-03 09:59:49 +08:00
position: relative;
2026-02-03 15:42:32 +08:00
overflow: visible;
}
.triangle-wrapper {
position: absolute;
top: -12rpx;
left: 60rpx;
width: 24rpx;
height: 12rpx;
overflow: hidden;
z-index: 10;
transform: translateX(-50%);
2026-02-03 10:45:54 +08:00
}
2026-02-03 15:42:32 +08:00
.team-triangle {
2026-02-03 10:45:54 +08:00
position: absolute;
2026-02-03 15:42:32 +08:00
left: 50%;
bottom: -10rpx;
width: 16rpx;
height: 16rpx;
2026-02-04 15:23:57 +08:00
background: linear-gradient(186deg,
rgba(255, 255, 255, 0.4) 13.34%,
rgba(255, 255, 255, 0.6) 99.17%);
2026-02-03 15:42:32 +08:00
transform: translateX(-50%) rotate(45deg);
}
.introduce-text {
max-width: 594rpx;
color: #000000;
font-size: 24rpx;
font-style: normal;
font-weight: 400;
line-height: normal;
2026-02-03 10:45:54 +08:00
}
.line-clamp-2 {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
overflow: hidden;
}
.leading-relaxed {
line-height: 1.6;
2026-01-20 19:36:49 +08:00
}
.check-icon {
width: 40rpx;
height: 40rpx;
}
.mask {
position: fixed;
2026-02-03 16:11:28 +08:00
z-index: 99;
2026-01-20 19:36:49 +08:00
left: 0;
top: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.3);
}
.z-3 {
2026-02-03 16:11:28 +08:00
z-index: 101;
2026-01-20 19:36:49 +08:00
}
.team-dropdown {
position: absolute;
left: 0;
right: 0;
top: 0;
2026-02-03 16:11:28 +08:00
z-index: 100;
2026-01-20 19:36:49 +08:00
border-bottom-left-radius: 16rpx;
border-bottom-right-radius: 16rpx;
}
2026-02-03 17:02:39 +08:00
.rounded-circle {
border-radius: 50%;
}
2026-01-20 19:36:49 +08:00
</style>