ykt-team-wxapp/pages/team/team-detail.vue

220 lines
6.4 KiB
Vue
Raw Normal View History

2026-01-20 19:36:49 +08:00
<template>
2026-04-02 18:09:06 +08:00
<full-page :pageStyle="pageStyle">
<view v-if="team" class="detail-wrapper">
<view class="linear-bg">
<view class="flex items-center pt-15 px-15">
<view class="flex-shrink-0 mr-10">
<group-avatar :size="128" :avatarList="avatarList" />
</view>
<view class="w-0 flex-grow">
<view class="name-title text-lg font-semibold text-dark truncate">{{ team.name }}</view>
<view class="corp-title text-sm text-gray truncate">{{ corpName }}</view>
</view>
2026-01-20 19:36:49 +08:00
</view>
2026-04-02 18:09:06 +08:00
<view v-if="team.teamTroduce" class="px-15 leading-normal text-base text-blue">
{{ team.teamTroduce }}
</view>
<view class="pt-15"></view>
<image v-if="teammate.leaders.length" class="block mt-30 mx-auto icon-role" src="/static/teamleader.svg">
</image>
<view v-for="i in teammate.leaders" :key="i._id" class="mt-15 flex flex-col items-center">
<view class="ablum text-center p-10 flex flex-col items-center rounded-sm"
:class="friendlyMember[i.userid] ? 'ablum-pb' : ''" @click="toHomePage(i.userid)">
<image class="avatar mb-10" :src="i.avatar || '/static/default-avatar.png'"></image>
<view class="text-lg text-dark font-semibold">{{ i.anotherName }}</view>
<view class="mt-5 text-base text-gray">
2026-01-21 10:35:08 +08:00
{{ memberJob[i.userid] }}
2026-01-20 19:36:49 +08:00
</view>
2026-04-02 18:09:06 +08:00
<view v-if="friendlyMember[i.userid]" class="friend-bottom" @click.stop="toFriend(i.userid)">
可加好友
2026-01-20 19:36:49 +08:00
</view>
</view>
2026-04-02 18:09:06 +08:00
<view class="mt-15 border-box w-full px-15 leading-normal text-base text-blue">
个人介绍: {{ i.memberTroduce || '暂无介绍' }}
2026-01-20 19:36:49 +08:00
</view>
</view>
2026-04-02 18:09:06 +08:00
<image v-if="teammate.members.length" class="block mt-30 mx-auto icon-role" src="/static/teammate.svg"></image>
<view v-for="i in teammate.members" :key="i._id" class="mt-15 flex flex-col items-center">
<view class="ablum text-center p-10 flex flex-col items-center rounded-sm"
:class="friendlyMember[i.userid] ? 'ablum-pb' : ''" @click="toHomePage(i.userid)">
<image class="avatar mb-10" :src="i.avatar || '/static/default-avatar.png'"></image>
<view class="w-full text-lg text-dark font-semibold truncate px-10">{{ i.anotherName }}</view>
<view class="w-full mt-5 text-base text-gray truncate px-10">
2026-01-21 10:35:08 +08:00
{{ memberJob[i.userid] }}
2026-01-20 19:36:49 +08:00
</view>
2026-04-02 18:09:06 +08:00
<view v-if="friendlyMember[i.userid]" class="friend-bottom" @click.stop="toFriend(i.userid)">
可加好友
2026-01-20 19:36:49 +08:00
</view>
</view>
2026-04-02 18:09:06 +08:00
<view class="mt-15 border-box w-full px-15 leading-normal text-base text-blue">
个人介绍: {{ i.memberTroduce || '暂无介绍' }}
2026-01-20 19:36:49 +08:00
</view>
</view>
</view>
2026-04-02 18:09:06 +08:00
</view>
2026-03-20 09:57:08 +08:00
</full-page>
2026-01-20 19:36:49 +08:00
</template>
<script setup>
2026-01-21 10:35:08 +08:00
import { computed, ref, watch } from 'vue';
2026-01-20 19:36:49 +08:00
import { onLoad, onShow } from '@dcloudio/uni-app';
2026-01-21 10:35:08 +08:00
import useJob from '@/hooks/useJob';
2026-01-20 19:36:49 +08:00
import api from '@/utils/api';
import groupAvatar from '@/components/group-avatar.vue';
2026-03-20 09:57:08 +08:00
import FullPage from '@/components/full-page.vue';
2026-01-20 19:36:49 +08:00
2026-04-02 18:09:06 +08:00
const pageStyle = "background: linear-gradient(180deg, #065BD6 15.05%, #F6FAFA 95.37%) 0 0/100% 562rpx no-repeat, #F6FAFA;";
2026-01-20 19:36:49 +08:00
const corpId = ref('');
const teamId = ref('');
const team = ref(null);
const corpName = ref('');
2026-02-08 16:15:24 +08:00
const showAllIntroduce = ref(false);
2026-01-21 10:35:08 +08:00
const { memberJob, memberList: list } = useJob();
2026-01-20 19:36:49 +08:00
const memberList = computed(() => team.value && Array.isArray(team.value.memberList) ? team.value.memberList : [])
2026-02-08 10:41:41 +08:00
const avatarList = computed(() => memberList.value.map(i => i.avatar || '/static/default-avatar.png').filter(Boolean))
2026-01-20 19:36:49 +08:00
const teammate = computed(() => {
const memberLeaderList = team.value && Array.isArray(team.value.memberLeaderList) ? team.value.memberLeaderList : [];
return memberList.value.reduce((data, item) => {
if (memberLeaderList.includes(item.userid)) {
data.leaders.push(item)
} else {
data.members.push(item)
}
return data
}, { leaders: [], members: [] })
})
const friendlyMember = computed(() => {
const friendlyMembers = team.value && Array.isArray(team.value.friendlyMembers) ? team.value.friendlyMembers : [];
return friendlyMembers.reduce((data, item) => {
data[item] = true;
return data
}, {})
})
function toFriend(userid) {
uni.navigateTo({ url: `/pages/team/friend?corpId=${corpId.value}&userid=${userid}` })
}
function toHomePage(userid) {
2026-01-21 10:35:08 +08:00
uni.navigateTo({ url: `/pages/team/homepage?corpId=${corpId.value}&userid=${userid}&showQrcode=${friendlyMember.value[userid] ? 'YES' : ''}` })
2026-01-20 19:36:49 +08:00
}
async function getTeam() {
const res = await api('getTeamData', { teamId: teamId.value, corpId: corpId.value });
if (res && res.data) {
team.value = res.data;
} else {
toast(res?.message || '获取团队信息失败')
}
}
onLoad(options => {
corpId.value = options.corpId;
teamId.value = options.teamId;
2026-04-02 18:09:06 +08:00
console.clear()
console.log(options.corpName)
console.log(decodeURIComponent(options.corpName || ''))
2026-01-20 19:36:49 +08:00
corpName.value = decodeURIComponent(options.corpName || '');
})
onShow(() => {
if (teamId.value && corpId.value) {
getTeam()
}
});
2026-01-21 10:35:08 +08:00
watch(memberList, n => {
list.value = n
}, { immediate: true })
2026-01-20 19:36:49 +08:00
</script>
<style>
page {
background: white;
overflow: auto;
}
.min-w-100 {
min-width: 200rpx;
}
.avatar {
2026-04-02 18:09:06 +08:00
width: 216rpx;
height: 240rpx;
2026-01-20 19:36:49 +08:00
}
2026-02-04 09:16:36 +08:00
.pre-wrap {
white-space: pre-wrap;
}
2026-04-02 18:09:06 +08:00
.detail-wrapper {
transform: translateY(200rpx);
background: #F5FAFF;
border-top-left-radius: 24rpx;
border-top-right-radius: 24rpx;
min-height: calc(100vh - 200rpx);
padding-bottom: 80rpx;
overflow: hidden;
}
.name-title {
height: 64rpx;
line-height: 64rpx;
}
.corp-title {
height: 44rpx;
line-height: 44rpx;
}
.text-blue {
color: #516276;
}
.linear-bg {
background: linear-gradient(180deg, #ffffff 0%, #f5faff 100%);
}
.icon-role {
margin-bottom: 30rpx;
width: 280rpx;
height: 60rpx;
}
.ablum {
width: 336rpx;
box-sizing: border-box;
border: 1rpx solid #9BB7D8;
}
.ablum-pb {
position: relative;
padding-bottom: 64rpx;
}
.mt-5 {
margin-top: 10rpx;
}
.friend-bottom {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 48rpx;
text-align: center;
line-height: 48rpx;
font-size: 24rpx;
color: #fff;
font-weight: bold;
background: #065BD6;
}
.mt-30 {
margin-top: 60rpx;
}
2026-01-20 19:36:49 +08:00
</style>