| | |
| | | |
| | | <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({ |
| | |
| | | |
| | | 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 |