一个接口中有两个数组,
审核认证成功时调用user_and_community_people_relate
,
审核认证失败或待审核时调用community_people_room_Apply
首先得将两个数组合并成一个数组,在获取其中的审核认证,失败,待认证的字段编码进行判断
<div v-if="item.is_community_people" style="width: 80rpx;height: 30rpx;background-color: #FABF13;color: #FFFFFF;font-size: 22rpx;text-align: center;margin-left: 11rpx;">
认证
</div>
<div v-if="(!item.is_community_people)&&(item.community_people.review_status==0)" style="width: 80rpx;height: 30rpx;background: #fcd86f;color: #FFFFFF;font-size: 22rpx;text-align: center;margin-left: 11rpx;">
待认证
</div>
<div v-if="(!item.is_community_people)&&(item.community_people.review_status==2)" style="width: 100rpx;height: 30rpx;background: #cccccc;;color: #FFFFFF;font-size: 22rpx;text-align: center;margin-left: 11rpx;">
认证失败
</div>
认证成功时is_community_people:true,
认证失败或待认证时 is_community_people:false,
concat() 方法用于连接两个或多个数组
methods:{
// 家庭成员列表接口
getApiPortalCommunityRoomGetMemberByRoom() {
this.$api.apiPortal_communityRoom_getMemberByRoom({
community_room_id: this.community_room_id
}, res => {
let community_people_room_records = res.ret.community_people_room_records.map(function(data){
return {
is_community_people:true,
id:data.id,
community_people:data.community_people,
rel_house_holder_str:data.rel_house_holder_str,
live_start_at:data.live_start_at
}
}); //认证成功
let community_people_room_Apply = res.ret.community_people_room_Apply.map(function(data){
return {
is_community_people:false,
id:data.id,
community_people:data,
rel_house_holder_str:data.rel_house_holder_str,
live_start_at:data.live_start_at
}
}); //认证失败/待认证
let HomeList=community_people_room_records.concat(community_people_room_Apply)
// this.households = res.ret.community_people_room_records //community_people_room_records表中是认证成功的
this.households =HomeList //community_people_room_records表中是认证成功的
console.log("家庭成员列表接口0001", this.households)
})
},
}
网友评论