优化: 任务分页watcher+设置页确认弹窗复用+进展文档更新
- Tasks.vue: 补全 page/pageSize watcher,翻页触发后端查询(原翻页只改前端切片) - Settings.vue: 自建确认弹窗替换为 ConfirmDialog 组件,删除重复 CSS - PROGRESS.md: 更新项目速览(多Agent架构+40+工具+人设系统)
This commit is contained in:
@@ -3,17 +3,7 @@
|
||||
<Transition name="toast">
|
||||
<div v-if="toast.visible" class="toast" :class="'toast-' + toast.type">{{ toast.msg }}</div>
|
||||
</Transition>
|
||||
<Transition name="confirm">
|
||||
<div v-if="confirmState.visible" class="confirm-mask" @click.self="answerConfirm(false)">
|
||||
<div class="confirm-box">
|
||||
<div class="confirm-msg">{{ confirmState.msg }}</div>
|
||||
<div class="confirm-actions">
|
||||
<button class="btn btn-ghost btn-sm" @click="answerConfirm(false)">{{ $t('common.cancel') }}</button>
|
||||
<button class="btn btn-danger btn-sm" @click="answerConfirm(true)">{{ $t('common.delete') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
<ConfirmDialog :visible="confirmState.visible" :msg="confirmState.msg" :danger-label="$t('common.delete')" @result="answerConfirm" />
|
||||
<!-- 页面头部 -->
|
||||
<header class="page-header">
|
||||
<h1>{{ $t('settings.title') }}</h1>
|
||||
@@ -79,6 +69,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, reactive, ref, shallowRef, onMounted, onUnmounted, nextTick } from 'vue'
|
||||
import { useConfirm } from '@/composables/useConfirm'
|
||||
import ConfirmDialog from '@/components/ConfirmDialog.vue'
|
||||
import SettingsNav, { type SettingsCategory } from '@/components/settings/SettingsNav.vue'
|
||||
import ProviderPanel from '@/components/settings/ProviderPanel.vue'
|
||||
import ConnectionPanel from '@/components/settings/ConnectionPanel.vue'
|
||||
@@ -246,31 +237,7 @@ onUnmounted(() => {
|
||||
.toast-enter-active, .toast-leave-active { transition: opacity 0.2s, transform 0.2s; }
|
||||
.toast-enter-from, .toast-leave-to { opacity: 0; transform: translate(-50%, -8px); }
|
||||
|
||||
/* ===== 确认弹层 ===== */
|
||||
.confirm-mask {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 1100;
|
||||
background: rgba(0,0,0,0.5);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.confirm-box {
|
||||
background: var(--df-bg-card);
|
||||
border: 0.5px solid var(--df-border);
|
||||
border-radius: var(--df-radius-lg);
|
||||
padding: 20px;
|
||||
min-width: 280px;
|
||||
max-width: 360px;
|
||||
box-shadow: 0 8px 32px rgba(0,0,0,0.4);
|
||||
}
|
||||
.confirm-msg { font-size: 13px; color: var(--df-text); line-height: 1.5; margin-bottom: 16px; }
|
||||
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }
|
||||
.btn-danger { background: var(--df-danger); color: #fff; }
|
||||
.btn-danger:hover { filter: brightness(1.1); }
|
||||
.confirm-enter-active, .confirm-leave-active { transition: opacity 0.15s; }
|
||||
.confirm-enter-from, .confirm-leave-to { opacity: 0; }
|
||||
/* 确认弹层已替换为 ConfirmDialog 组件(不再需要自建 CSS) */
|
||||
|
||||
.page-header {
|
||||
display: flex;
|
||||
|
||||
@@ -406,6 +406,15 @@ watch(sortBy, () => {
|
||||
]).finally(() => { loading.value = false })
|
||||
})
|
||||
|
||||
// 分页翻页/改每页条数:重新查询后端
|
||||
watch([page, pageSize], () => {
|
||||
loading.value = true
|
||||
Promise.all([
|
||||
store.loadTasks(buildTaskQuery()),
|
||||
taskApi.count(buildTaskQuery()).then(n => totalTasks.value = n),
|
||||
]).finally(() => { loading.value = false })
|
||||
})
|
||||
|
||||
// Ctrl+N 新建 / Ctrl+F 搜索(桌面快捷键)
|
||||
function onKeydown(e: KeyboardEvent) {
|
||||
if ((e.ctrlKey || e.metaKey) && e.key === 'n') {
|
||||
|
||||
Reference in New Issue
Block a user