2.3.9 历史回复列表

This commit is contained in:
2026-03-12 18:03:30 +08:00
parent 919f1ad650
commit 99b029377a
2 changed files with 49 additions and 2 deletions

View File

@@ -123,7 +123,7 @@
未启动任务 未启动任务
</div> </div>
<!-- 统计数据 --> <!-- 统计数据 -->
<div class="mt-2 pt-2 border-t border-gray-200 space-y-1"> <div class="mt-2 pt-2 border-t border-gray-200 space-y-1 relative">
<div class="flex items-center justify-between text-xs"> <div class="flex items-center justify-between text-xs">
<span class="text-gray-500">已打招呼</span> <span class="text-gray-500">已打招呼</span>
<span class="text-blue-600 font-medium">{{ greetingStats.greetingCount }} </span> <span class="text-blue-600 font-medium">{{ greetingStats.greetingCount }} </span>
@@ -134,7 +134,33 @@
</div> </div>
<div class="flex items-center justify-between text-xs"> <div class="flex items-center justify-between text-xs">
<span class="text-gray-500">已回复</span> <span class="text-gray-500">已回复</span>
<span class="text-emerald-600 font-medium">{{ greetingStats.replyCount || 0 }} </span> <div class="flex items-center gap-1">
<button @click="showReplyList" class="text-blue-500 hover:text-blue-600 hover:underline cursor-pointer" title="查看回复列表">
历史回复
</button>
<span class="text-emerald-600 font-medium">{{ greetingStats.replyCount || 0 }} </span>
</div>
</div>
<!-- 回复列表弹出框 -->
<div v-if="replyListVisible" class="absolute left-0 right-0 bottom-full mb-1 bg-white border border-gray-200 rounded-lg shadow-lg z-50 max-h-48 overflow-hidden" :style="{ maxWidth: sidebarWidth + 'px' }">
<div class="flex items-center justify-between px-3 py-2 border-b border-gray-100 bg-gray-50">
<span class="text-xs font-semibold text-gray-600">历史回复列表</span>
<button @click="replyListVisible = false" class="text-gray-400 hover:text-gray-600">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
<div class="overflow-y-auto max-h-36">
<div v-if="repliedSessions.length === 0" class="text-gray-400 text-xs text-center py-3">
暂无回复记录
</div>
<div v-else>
<div v-for="(name, index) in repliedSessions" :key="index" class="px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-50 border-b border-gray-50 last:border-0 truncate" :title="name">
{{ name }}
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -160,6 +186,26 @@ const props = defineProps({
const emit = defineEmits(['tabSwitch', 'goBack', 'stopAll']) const emit = defineEmits(['tabSwitch', 'goBack', 'stopAll'])
// 回复列表相关
const replyListVisible = ref(false)
/** @type {import('vue').Ref<string[]>} */
const repliedSessions = ref([])
// 显示回复列表
const showReplyList = async () => {
replyListVisible.value = !replyListVisible.value
if (replyListVisible.value && window.electronAPI?.getRepliedSessions) {
try {
const result = await window.electronAPI.getRepliedSessions()
// 最新的在最后,前端展示时保持原顺序(最下边是最新的)
repliedSessions.value = result || []
} catch (e) {
console.error('获取回复列表失败:', e)
repliedSessions.value = []
}
}
}
// Event handlers // Event handlers
const onTabSwitch = (id) => emit('tabSwitch', id) const onTabSwitch = (id) => emit('tabSwitch', id)
const onGoBack = () => emit('goBack') const onGoBack = () => emit('goBack')

View File

@@ -126,6 +126,7 @@ export interface ElectronAPI {
// 打招呼统计 // 打招呼统计
getGreetingStats: () => Promise<GreetingStats> getGreetingStats: () => Promise<GreetingStats>
getRepliedSessions: () => Promise<string[]>
// 获取打招呼内容 // 获取打招呼内容
fetchPrologue: () => Promise<{ success: boolean; data?: string[]; error?: string }> fetchPrologue: () => Promise<{ success: boolean; data?: string[]; error?: string }>