显示最后一个加入的成员

This commit is contained in:
kuaifan 2022-03-08 19:32:32 +08:00
parent 4fb971a935
commit e1c80636ba

View File

@ -16,17 +16,15 @@
<p>{{$L('项目负责人')}}</p> <p>{{$L('项目负责人')}}</p>
</UserAvatar> </UserAvatar>
</li> </li>
<template v-if="projectUser.length > 0 && windowWidth > 980"> <template v-if="windowWidth > 980 && projectUser.length > 0" v-for="item in projectUser">
<template v-for="(item, index) in projectUser" v-if="index < projectUserShowNum"> <li v-if="item.userid === -1" class="more">
<li v-if="index + 1 == projectUserShowNum && projectUser.length > projectUserShowNum" class="more"> <ETooltip :content="$L('共' + (item.count + 1) + '个成员')">
<ETooltip :content="$L('共' + (projectUser.length + 1) + '个成员')"> <Icon type="ios-more"/>
<Icon type="ios-more"/> </ETooltip>
</ETooltip> </li>
</li> <li v-else>
<li> <UserAvatar :userid="item.userid" :size="36" :borderWitdh="2" :openDelay="0"/>
<UserAvatar :userid="item.userid" :size="36" :borderWitdh="2" :openDelay="0"/> </li>
</li>
</template>
</template> </template>
</ul> </ul>
</li> </li>
@ -590,15 +588,22 @@ export default {
}, },
projectUser() { projectUser() {
const {projectData} = this; const {projectData, windowWidth} = this;
if (!projectData.project_user) { if (!projectData.project_user) {
return []; return [];
} }
return projectData.project_user.filter(({userid}) => userid != projectData.owner_userid) let max = windowWidth > 1200 ? 8 : 3
}, let list = projectData.project_user.filter(({userid}) => userid != projectData.owner_userid)
if (list.length <= max) {
projectUserShowNum() { return list
return this.windowWidth > 1200 ? 8 : 3; }
let array = list.slice(0, max - 1);
array.push({
userid: -1,
count: list.length
})
array.push(list[list.length - 1])
return array;
}, },
allTask() { allTask() {