From aef1b51e94579387b13f54d0417bd2ebafc24ffe Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Tue, 24 Feb 2026 16:56:48 +0800
Subject: [PATCH] feat:过滤登录用户
---
uniapps/work-app/src/pages/voiceCall/index.vue | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/uniapps/work-app/src/pages/voiceCall/index.vue b/uniapps/work-app/src/pages/voiceCall/index.vue
index 455e4bd..6bab0fa 100644
--- a/uniapps/work-app/src/pages/voiceCall/index.vue
+++ b/uniapps/work-app/src/pages/voiceCall/index.vue
@@ -43,11 +43,13 @@
<script setup>
import { getStatusBarHeight } from '@/utils/common';
-
+import { useUserStore } from "@/store/index.js"
const topMargin = getStatusBarHeight()
import { getPhoneBookListApi } from '@/api/voiceCall/index.js'
import { onShow } from '@dcloudio/uni-app'
import defaultAvatar from '/static/images/defaultAvatar.svg'
+ const userStore = useUserStore()
+ const userId = userStore.userInfo.new_userInfo.userId
// 联系人数据
const contacts = ref([])
const defaultParam = ref({
@@ -73,14 +75,18 @@
getPhoneBookListApi(params).then(res => {
const response = res.data.data
+ // 过滤掉与当前登录用户userId一致的联系人
+ const filteredRecords = response.records.filter(contact => {
+ return contact.userId && String(contact.userId) !== String(userId)
+ })
if (defaultParam.value.current === 1) {
- contacts.value = response.records
+ contacts.value = filteredRecords
} else {
- contacts.value = [...contacts.value, ...response.records]
+ contacts.value = [...contacts.value, ...filteredRecords]
}
// 判断是否还有更多数据
- if (response.records.length < defaultParam.value.size || response.current >= response.pages) {
+ if (filteredRecords.length < defaultParam.value.size || response.current >= response.pages) {
hasMore.value = false
} else {
hasMore.value = true
--
Gitblit v1.9.3