吉安感知网项目-前端
张含笑
2026-02-24 aef1b51e94579387b13f54d0417bd2ebafc24ffe
feat:过滤登录用户
1 files modified
14 ■■■■ changed files
uniapps/work-app/src/pages/voiceCall/index.vue 14 ●●●● patch | view | raw | blame | history
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