mirror of
https://github.com/LifeArchiveProject/WeChatDataAnalysis.git
synced 2026-02-19 06:10:52 +08:00
feat(chat): 聊天页增加导出弹窗与进度展示
- 导出弹窗支持范围/格式/时间范围/媒体开关/文件名等参数 - 批量会话列表展示头像,提供 全部/群聊/单聊 tab 与搜索 - 导出进度使用 SSE 实时更新(失败回退轮询),提供进度条展示 - 支持任务取消与 ZIP 下载 - 隐私模式下导出同步隐私策略,且 hover 不再保持模糊
This commit is contained in:
@@ -138,6 +138,42 @@ export const useApi = () => {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 聊天记录导出(离线zip)
|
||||
const createChatExport = async (data = {}) => {
|
||||
return await request('/chat/exports', {
|
||||
method: 'POST',
|
||||
body: {
|
||||
account: data.account || null,
|
||||
scope: data.scope || 'selected',
|
||||
usernames: Array.isArray(data.usernames) ? data.usernames : [],
|
||||
format: data.format || 'json',
|
||||
start_time: data.start_time != null ? Number(data.start_time) : null,
|
||||
end_time: data.end_time != null ? Number(data.end_time) : null,
|
||||
include_hidden: !!data.include_hidden,
|
||||
include_official: !!data.include_official,
|
||||
include_media: data.include_media == null ? true : !!data.include_media,
|
||||
media_kinds: Array.isArray(data.media_kinds) ? data.media_kinds : ['image', 'emoji', 'video', 'video_thumb', 'voice', 'file'],
|
||||
allow_process_key_extract: !!data.allow_process_key_extract,
|
||||
privacy_mode: !!data.privacy_mode,
|
||||
file_name: data.file_name || null
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const getChatExport = async (exportId) => {
|
||||
if (!exportId) throw new Error('Missing exportId')
|
||||
return await request(`/chat/exports/${encodeURIComponent(String(exportId))}`)
|
||||
}
|
||||
|
||||
const listChatExports = async () => {
|
||||
return await request('/chat/exports')
|
||||
}
|
||||
|
||||
const cancelChatExport = async (exportId) => {
|
||||
if (!exportId) throw new Error('Missing exportId')
|
||||
return await request(`/chat/exports/${encodeURIComponent(String(exportId))}`, { method: 'DELETE' })
|
||||
}
|
||||
|
||||
return {
|
||||
detectWechat,
|
||||
@@ -151,6 +187,10 @@ export const useApi = () => {
|
||||
downloadChatEmoji,
|
||||
getMediaKeys,
|
||||
saveMediaKeys,
|
||||
decryptAllMedia
|
||||
decryptAllMedia,
|
||||
createChatExport,
|
||||
getChatExport,
|
||||
listChatExports,
|
||||
cancelChatExport
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user