修复已知问题

This commit is contained in:
bobobobo
2026-01-29 00:27:31 +08:00
parent 990f2df972
commit 41c1e5ba89
36 changed files with 1353 additions and 169 deletions

View File

@@ -33,6 +33,8 @@
const isBlack = ref(false)
/** 点击备注弹框 */
const showRemark = ref(false)
/** 好友详情进入状态C2C 个人 GROUP 群组 */
const isDetailState = ref('')
/** 点击查看头像 */
const onViewAvatar = url => {
uni.previewImage({
@@ -87,8 +89,11 @@
})
}
/** 获取好友信息 */
const getFriendInfo = async () => {
/**
* 获取好友信息
* @param state 99 为自己
*/
const getFriendInfo = async state => {
loading.value = true
showLoading()
if (isDetail.value) {
@@ -97,10 +102,10 @@
})
.then(res => {
const data = res.data.friendList[0]
friendInfo.value = data.profile
friendInfo.value = { ...data.profile, cbType: 'C2C' }
confirmRemark.value = data.remark
remark.value = data.remark
console.log('好友信息==', data)
console.log('好友信息==', friendInfo.value)
})
.finally(() => {
loading.value = false
@@ -111,7 +116,10 @@
userIDList: [userId.value]
})
.then(res => {
friendInfo.value = res.data[0]
friendInfo.value = {
...res.data[0],
cbType: state == 99 ? 'me' : 'C2C'
}
console.log('获取好友信息成功', friendInfo.value)
})
.finally(() => {
@@ -291,31 +299,38 @@
/** 发送消息 */
const onSendMessage = () => {
if (isDetailState.value == 'C2C') {
navigateBack()
return
}
const data =
friendInfo.value?.cbType === 'group'
? `GROUP${friendInfo.value?.groupID}`
: `C2C${friendInfo.value.userID}`
TUIConversationService.switchConversation(data).then(() => {
TUIGlobal?.navigateTo({
url: `/TUIKit/components/TUIChat/index`
url: `/TUIKit/components/TUIChat/index?type=${
isDetailState.value == 'GROUP' ? 'GROUP' : ''
}`
})
})
}
onLoad(e => {
isDetailState.value = e?.state || ''
userId.value = e?.id || ''
/** type: 不传为添加 1 为详情页 9 为群信息 */
/** type: 不传为添加 1 为详情页 9 为群信息 99 为自己 */
if (e?.type == 9) {
uni.setNavigationBarTitle({
title: '群聊信息'
})
getGroupInfo()
} else {
isDetail.value = e?.type == 1 || false
isDetail.value = ['1'].includes(e?.type) || false
uni.setNavigationBarTitle({
title: isDetail.value ? '好友信息' : '发送好友申请'
})
getFriendInfo()
getFriendInfo(e?.type)
}
})
</script>
@@ -334,18 +349,23 @@
<uni-icons v-else type="contact-filled" size="80"></uni-icons>
<view class="right-box">
<text>{{ friendInfo.nick || '未知名称' }}</text>
<text v-if="!friendInfo?.cbType == 'group'">
<text v-if="friendInfo?.cbType !== 'group'">
手机号: {{ friendInfo.userID }}
</text>
<text v-if="!friendInfo?.cbType == 'group'">
<text v-if="friendInfo?.cbType !== 'group'">
个性签名: {{ friendInfo.selfSignature || '暂无个性签名' }}
</text>
<text v-else>ID: {{ friendInfo.groupID }}</text>
<text v-else>
ID: {{ friendInfo.groupID || friendInfo.userID }}
</text>
</view>
</view>
<!-- 验证信息输入 -->
<view v-if="!isDetail" class="input-wrapper">
<view
v-if="!isDetail && friendInfo.cbType !== 'me'"
class="input-wrapper"
>
<text class="title">请填写验证信息</text>
<textarea
v-model="verificationInfo"
@@ -357,7 +377,7 @@
<!-- 备注 -->
<view
v-if="!friendInfo?.cbType == 'group' && !isDetail"
v-if="!['group', 'me'].includes(friendInfo?.cbType) && !isDetail"
class="remark"
>
<text>备注名</text>
@@ -370,13 +390,33 @@
</view>
<!-- 发送申请按钮 -->
<view v-if="!isDetail" class="send-btn" @tap="submit">
<view
v-if="!isDetail && friendInfo.cbType !== 'me'"
class="send-btn"
@tap="submit"
>
<text>发送申请</text>
</view>
<!-- 去朋友圈 -->
<view
v-if="friendInfo?.cbType == 'me'"
class="remark"
@click="
navigateTo('/pages/discover/dynamic/dynamic', {
id: friendInfo.userID
})
"
>
<text>朋友圈</text>
<view style="display: flex; align-items: center">
<uni-icons type="right" color="#999999" size="36rpx"></uni-icons>
</view>
</view>
<!-- 修改好友信息======================== -->
<view
v-if="!friendInfo?.cbType == 'group' && isDetail"
v-if="friendInfo?.cbType !== 'group' && isDetail"
class="remark"
@click="showRemark = true"
>
@@ -391,15 +431,14 @@
</view>
</view>
<view
v-if="!friendInfo?.cbType == 'group' && isDetail"
v-if="friendInfo?.cbType !== 'group' && isDetail"
class="remark"
>
<text>加入黑名单</text>
<SwitchBar :value="isBlack" @click="switchChange" />
</view>
<view
v-if="!friendInfo?.cbType == 'group' && isDetail"
v-if="friendInfo?.cbType !== 'group' && isDetail"
class="send-btn"
@tap="onDeleteFriend"
>

View File

@@ -7,7 +7,9 @@
TUIFriendService,
TUIGroupService
} from '@tencentcloud/chat-uikit-engine-lite'
import { useAuthUser } from '../../composables/useAuthUser'
const { tencentUserSig } = useAuthUser()
const { showLoading, hideLoading } = useUI()
const loading = ref(false)
const searchValue = ref('')
@@ -97,7 +99,10 @@
}
const onAdd = item => {
navigateTo('/pages/adduser/details', { id: item.userID })
navigateTo('/pages/adduser/details', {
id: item.userID,
type: item.userID == tencentUserSig.value.userId ? '99' : ''
})
}
const onDetails = (item, state) => {
@@ -155,8 +160,10 @@
<text>{{ item.nick || '未知名称' }}</text>
<text>{{ item.userID }}</text>
</view>
<text v-if="isFriend" class="tag">已添加</text>
<button v-else @click.stop="onAdd(item)">添加</button>
<view v-if="item.userID !== tencentUserSig.userId">
<text v-if="isFriend" class="tag">添加</text>
<button v-else @click.stop="onAdd(item)">添加</button>
</view>
</view>
</view>
<!-- 群列表 -->
@@ -180,7 +187,8 @@
<text>{{ item.name || '未知名称' }}</text>
<text>{{ item.groupID }}</text>
</view>
<text class="tag-but">群聊</text>
<!-- <text class="tag-but">群聊</text> -->
<button style="background: #828bff">群聊</button>
<!-- <text v-if="isFriend" class="tag">已添加</text>
<button v-else @click.stop="onAdd(item)">添加</button> -->
</view>