This commit is contained in:
2025-12-10 15:18:16 +08:00
parent 58d5c52a45
commit 460a97d758
5 changed files with 6 additions and 6 deletions

View File

@@ -14,7 +14,7 @@ export function searchUsers(keyword: string, limit = 20) {
return request.get<User[]>('/contacts/search', { keyword, limit })
}
// 添加好友(发送申请)
// 添加好友.html(发送申请)
export function addFriend(data: { to_user_id: string; message?: string }) {
return request.post<void>('/contacts/add-friend', data)
}

View File

@@ -194,7 +194,7 @@ function switchTab(name: string) {
<!--const { isDark } = useTheme()-->
<!--const appStore = useAppStore()-->
<!--// 核心修改:移除 image 路径,改用 Wot-UI 内置 Icon name-->
<!--// 核心修改:移除 image 路径,改用 Wot-UI设计 内置 Icon name-->
<!--// 如果需要自定义 SVG,可以使用 custom-icon 插槽-->
<!--const list = computed(() => [-->
<!-- {-->

View File

@@ -111,7 +111,7 @@ import type { User } from '@/types/api'
const toast = useToast(); const message = useMessage(); const { isDark } = useTheme();
const keyword = ref(''); const loading = ref(false); const searched = ref(false); const results = ref<User[]>([]);
async function doSearch() { if (!keyword.value.trim()) { toast.show('请输入搜索内容'); return } loading.value = true; searched.value = true; try { results.value = await contactApi.searchUsers(keyword.value.trim()) } catch (error) { console.error('搜索失败:', error); toast.error('搜索失败') } finally { loading.value = false } }
async function addFriend(user: User) { try { const { value } = await message.prompt({ title: '添加好友', inputPlaceholder: '请输入验证消息', inputValue: '你好,我是...' }); await contactApi.addFriend({ to_user_id: user.id, message: value || '' }); toast.success('申请已发送') } catch (e: any) { if (e !== 'cancel') { toast.error('发送失败') } } }
async function addFriend(user: User) { try { const { value } = await message.prompt({ title: '添加好友.html', inputPlaceholder: '请输入验证消息', inputValue: '你好,我是...' }); await contactApi.addFriend({ to_user_id: user.id, message: value || '' }); toast.success('申请已发送') } catch (e: any) { if (e !== 'cancel') { toast.error('发送失败') } } }
function scanQrCode() { uni.scanCode({ onlyFromCamera: false, success: (res) => { console.log('扫码结果:', res.result); toast.show('扫码功能开发中') }, fail: () => { toast.error('扫码失败') } }) }
</script>

View File

@@ -206,7 +206,7 @@ const themeText = computed(() => {
const plusMenuActions = [
{ name: '创建群聊', value: 'createGroup' },
{ name: '添加好友', value: 'addFriend' },
{ name: '添加好友.html', value: 'addFriend' },
{ name: '扫一扫', value: 'scan' }
]
@@ -248,7 +248,7 @@ function goChat(item: Conversation) {
}
function handleLongPress(item: Conversation) { selectedConv.value = item; showConvActions.value = true }
async function onConvActionSelect(event: any) {
// Wot-UI select 事件通常返回 { item, index },或者直接是 detail 对象
// Wot-UI设计 select 事件通常返回 { item, index },或者直接是 detail 对象
// 防御性获取 item
const action = event.item || event

View File

@@ -177,7 +177,7 @@ const { isDark } = useTheme()
const toast = useToast()
const messageBox = useMessage()
// --- UI 状态 (新增) ---
// --- UI设计 状态 (新增) ---
const navOpacity = ref(0)
const iconColor = computed(() => {
// 当导航栏变白时,图标变黑;否则为白色