Version: 0.7.6.dev.260325
后端: - ♻️ 将 `taskquery` 模块迁移至 `agent2`,并完成与 `agent2` 业务链路及整体结构的正式接入 前端: - 🧱 已完成基础框架搭建,并完成了登录、注册、主页等页面并对接了对应接口;但整体功能实现仍在完善中
This commit is contained in:
371
frontend/src/views/AuthView.vue
Normal file
371
frontend/src/views/AuthView.vue
Normal file
@@ -0,0 +1,371 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
|
||||
type PanelName = 'login' | 'register'
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
const activePanel = ref<PanelName>('login')
|
||||
const loginLoading = ref(false)
|
||||
const registerLoading = ref(false)
|
||||
|
||||
const loginForm = reactive({
|
||||
username: authStore.lastUsername,
|
||||
password: '',
|
||||
})
|
||||
|
||||
const registerForm = reactive({
|
||||
username: '',
|
||||
phone_number: '',
|
||||
password: '',
|
||||
confirmPassword: '',
|
||||
})
|
||||
|
||||
const redirectPath = typeof route.query.redirect === 'string' ? route.query.redirect : '/dashboard'
|
||||
|
||||
async function submitLogin() {
|
||||
if (!loginForm.username.trim() || !loginForm.password.trim()) {
|
||||
ElMessage.warning('请填写用户名和密码')
|
||||
return
|
||||
}
|
||||
|
||||
loginLoading.value = true
|
||||
try {
|
||||
await authStore.login({
|
||||
username: loginForm.username.trim(),
|
||||
password: loginForm.password,
|
||||
})
|
||||
ElMessage.success('登录成功,欢迎回来')
|
||||
await router.push(redirectPath)
|
||||
} catch (error) {
|
||||
ElMessage.error(error instanceof Error ? error.message : '登录失败')
|
||||
} finally {
|
||||
loginLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function submitRegister() {
|
||||
if (!registerForm.username.trim() || !registerForm.phone_number.trim() || !registerForm.password.trim()) {
|
||||
ElMessage.warning('请先把注册信息填写完整')
|
||||
return
|
||||
}
|
||||
|
||||
if (!/^1\d{10}$/.test(registerForm.phone_number.trim())) {
|
||||
ElMessage.warning('请输入正确的 11 位手机号')
|
||||
return
|
||||
}
|
||||
|
||||
if (registerForm.password.length < 6) {
|
||||
ElMessage.warning('密码至少需要 6 位')
|
||||
return
|
||||
}
|
||||
|
||||
if (registerForm.password !== registerForm.confirmPassword) {
|
||||
ElMessage.warning('两次输入的密码不一致')
|
||||
return
|
||||
}
|
||||
|
||||
registerLoading.value = true
|
||||
try {
|
||||
await authStore.register({
|
||||
username: registerForm.username.trim(),
|
||||
phone_number: registerForm.phone_number.trim(),
|
||||
password: registerForm.password,
|
||||
})
|
||||
loginForm.username = registerForm.username.trim()
|
||||
loginForm.password = ''
|
||||
registerForm.password = ''
|
||||
registerForm.confirmPassword = ''
|
||||
activePanel.value = 'login'
|
||||
ElMessage.success('注册成功,请使用新账号登录')
|
||||
} catch (error) {
|
||||
ElMessage.error(error instanceof Error ? error.message : '注册失败')
|
||||
} finally {
|
||||
registerLoading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="auth-page">
|
||||
<div class="page-shell auth-layout">
|
||||
<section class="auth-brand glass-panel">
|
||||
<div class="auth-brand__badge">SmartFlow</div>
|
||||
<h1>把任务、课程与智能规划放在同一个工作台里。</h1>
|
||||
<p>
|
||||
这一版先把登录链路跑通。后面我们会在这个基础上继续接任务管理、课表总览和智能体排程能力。
|
||||
</p>
|
||||
|
||||
<div class="auth-brand__points">
|
||||
<article>
|
||||
<strong>扁平化界面</strong>
|
||||
<span>去掉多余装饰,把信息层级讲清楚。</span>
|
||||
</article>
|
||||
<article>
|
||||
<strong>登录态托管</strong>
|
||||
<span>统一管理 access token,后续接业务页面更轻松。</span>
|
||||
</article>
|
||||
<article>
|
||||
<strong>可持续扩展</strong>
|
||||
<span>路由、状态、接口层已经拆开,后面直接加页面即可。</span>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="auth-card glass-panel">
|
||||
<div class="auth-card__header">
|
||||
<div>
|
||||
<span class="auth-card__eyebrow">欢迎使用</span>
|
||||
<h2>账号入口</h2>
|
||||
</div>
|
||||
<p>先登录,再进入示例工作台。</p>
|
||||
</div>
|
||||
|
||||
<el-tabs v-model="activePanel" stretch class="auth-tabs">
|
||||
<el-tab-pane label="登录" name="login">
|
||||
<el-form label-position="top" class="auth-form" @submit.prevent="submitLogin">
|
||||
<el-form-item label="用户名">
|
||||
<el-input
|
||||
v-model="loginForm.username"
|
||||
placeholder="请输入用户名"
|
||||
size="large"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="密码">
|
||||
<el-input
|
||||
v-model="loginForm.password"
|
||||
type="password"
|
||||
placeholder="请输入密码"
|
||||
size="large"
|
||||
show-password
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-button
|
||||
type="primary"
|
||||
size="large"
|
||||
class="auth-submit"
|
||||
:loading="loginLoading"
|
||||
@click="submitLogin"
|
||||
>
|
||||
登录并进入示例页
|
||||
</el-button>
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="注册" name="register">
|
||||
<el-form label-position="top" class="auth-form" @submit.prevent="submitRegister">
|
||||
<el-form-item label="用户名">
|
||||
<el-input
|
||||
v-model="registerForm.username"
|
||||
placeholder="例如:losita"
|
||||
size="large"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="手机号">
|
||||
<el-input
|
||||
v-model="registerForm.phone_number"
|
||||
placeholder="请输入 11 位手机号"
|
||||
size="large"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="密码">
|
||||
<el-input
|
||||
v-model="registerForm.password"
|
||||
type="password"
|
||||
placeholder="建议至少 6 位"
|
||||
size="large"
|
||||
show-password
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="确认密码">
|
||||
<el-input
|
||||
v-model="registerForm.confirmPassword"
|
||||
type="password"
|
||||
placeholder="请再次输入密码"
|
||||
size="large"
|
||||
show-password
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-button
|
||||
type="primary"
|
||||
size="large"
|
||||
class="auth-submit"
|
||||
:loading="registerLoading"
|
||||
@click="submitRegister"
|
||||
>
|
||||
创建账号
|
||||
</el-button>
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.auth-page {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 32px 0;
|
||||
}
|
||||
|
||||
.auth-layout {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1.1fr) minmax(380px, 460px);
|
||||
gap: 24px;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.auth-brand,
|
||||
.auth-card {
|
||||
border-radius: 28px;
|
||||
}
|
||||
|
||||
.auth-brand {
|
||||
padding: 40px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
min-height: 680px;
|
||||
}
|
||||
|
||||
.auth-brand__badge {
|
||||
width: fit-content;
|
||||
padding: 8px 14px;
|
||||
border-radius: 999px;
|
||||
background: #e8f2ff;
|
||||
color: #1f5fbf;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.auth-brand h1 {
|
||||
margin: 24px 0 16px;
|
||||
max-width: 10em;
|
||||
font-size: clamp(36px, 5vw, 56px);
|
||||
line-height: 1.08;
|
||||
letter-spacing: -0.04em;
|
||||
color: var(--text-main);
|
||||
}
|
||||
|
||||
.auth-brand p {
|
||||
margin: 0;
|
||||
max-width: 38rem;
|
||||
color: var(--text-secondary);
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.auth-brand__points {
|
||||
display: grid;
|
||||
gap: 14px;
|
||||
margin-top: 36px;
|
||||
}
|
||||
|
||||
.auth-brand__points article {
|
||||
padding: 18px 20px;
|
||||
border-radius: 20px;
|
||||
background: rgba(255, 255, 255, 0.72);
|
||||
border: 1px solid rgba(17, 24, 39, 0.06);
|
||||
}
|
||||
|
||||
.auth-brand__points strong {
|
||||
display: block;
|
||||
font-size: 16px;
|
||||
margin-bottom: 6px;
|
||||
color: var(--text-main);
|
||||
}
|
||||
|
||||
.auth-brand__points span {
|
||||
color: var(--text-secondary);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.auth-card {
|
||||
padding: 30px 30px 24px;
|
||||
min-height: 680px;
|
||||
}
|
||||
|
||||
.auth-card__header {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.auth-card__header h2 {
|
||||
margin: 8px 0 8px;
|
||||
font-size: 30px;
|
||||
line-height: 1.15;
|
||||
letter-spacing: -0.03em;
|
||||
}
|
||||
|
||||
.auth-card__header p {
|
||||
margin: 0;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.auth-card__eyebrow {
|
||||
color: #1f5fbf;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.auth-tabs {
|
||||
--el-color-primary: var(--brand);
|
||||
}
|
||||
|
||||
.auth-form {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.auth-submit {
|
||||
width: 100%;
|
||||
margin-top: 10px;
|
||||
height: 48px;
|
||||
border-radius: 14px;
|
||||
font-weight: 600;
|
||||
border: none;
|
||||
background: linear-gradient(180deg, var(--brand) 0%, var(--brand-strong) 100%);
|
||||
}
|
||||
|
||||
@media (max-width: 1080px) {
|
||||
.auth-layout {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.auth-brand,
|
||||
.auth-card {
|
||||
min-height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.auth-page {
|
||||
padding: 16px 0;
|
||||
}
|
||||
|
||||
.auth-brand,
|
||||
.auth-card {
|
||||
padding: 22px;
|
||||
border-radius: 22px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
806
frontend/src/views/DashboardView.vue
Normal file
806
frontend/src/views/DashboardView.vue
Normal file
@@ -0,0 +1,806 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
import AssistantPanel from '@/components/dashboard/AssistantPanel.vue'
|
||||
import TaskQuadrantCard from '@/components/dashboard/TaskQuadrantCard.vue'
|
||||
import TodayTimeline from '@/components/dashboard/TodayTimeline.vue'
|
||||
import { completeTask, createTask, getTasks, undoCompleteTask } from '@/api/task'
|
||||
import { getTodaySchedule } from '@/api/schedule'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import type { TaskItem, TodayEvent } from '@/types/dashboard'
|
||||
import { formatHeaderDate } from '@/utils/date'
|
||||
|
||||
const router = useRouter()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
const pageLoading = ref(false)
|
||||
const taskLoading = ref(false)
|
||||
const scheduleLoading = ref(false)
|
||||
const createTaskLoading = ref(false)
|
||||
const logoutLoading = ref(false)
|
||||
const createTaskDialogVisible = ref(false)
|
||||
const dashboardLayoutRef = ref<HTMLElement | null>(null)
|
||||
|
||||
const tasks = ref<TaskItem[]>([])
|
||||
const todayEvents = ref<TodayEvent[]>([])
|
||||
|
||||
const sidebarWidth = ref(78)
|
||||
const assistantWidth = ref(460)
|
||||
|
||||
const taskForm = reactive<{
|
||||
title: string
|
||||
priority_group: number
|
||||
deadline_at: Date | null
|
||||
}>({
|
||||
title: '',
|
||||
priority_group: 2,
|
||||
deadline_at: null,
|
||||
})
|
||||
|
||||
const sidebarItems = [
|
||||
{ key: 'home', label: '总览', short: '总' },
|
||||
{ key: 'task', label: '任务', short: '任' },
|
||||
{ key: 'calendar', label: '日程', short: '程' },
|
||||
{ key: 'ai', label: '助手', short: 'AI' },
|
||||
]
|
||||
|
||||
const quadrantOrder = [1, 2, 3, 4] as const
|
||||
|
||||
const quadrantMeta: Record<
|
||||
(typeof quadrantOrder)[number],
|
||||
{ title: string; caption: string; tone: 'danger' | 'primary' | 'warning' | 'slate'; emptyText: string }
|
||||
> = {
|
||||
1: {
|
||||
title: '重要且紧急',
|
||||
caption: '优先处理',
|
||||
tone: 'danger',
|
||||
emptyText: '暂无需要立刻推进的事项',
|
||||
},
|
||||
2: {
|
||||
title: '重要不紧急',
|
||||
caption: '持续推进',
|
||||
tone: 'primary',
|
||||
emptyText: '这里适合放长期投入的关键任务',
|
||||
},
|
||||
3: {
|
||||
title: '简单不重要',
|
||||
caption: '顺手完成',
|
||||
tone: 'warning',
|
||||
emptyText: '暂无高频但低价值的小任务',
|
||||
},
|
||||
4: {
|
||||
title: '不简单不重要',
|
||||
caption: '谨慎投入',
|
||||
tone: 'slate',
|
||||
emptyText: '这里可以放暂缓事项或后续再评估的任务',
|
||||
},
|
||||
}
|
||||
|
||||
const pageTitleDate = computed(() => formatHeaderDate(new Date()))
|
||||
const greetingName = computed(() => authStore.lastUsername || 'SmartFlow 用户')
|
||||
const layoutStyle = computed(() => ({
|
||||
'--dashboard-sidebar-width': `${sidebarWidth.value}px`,
|
||||
'--dashboard-assistant-width': `${assistantWidth.value}px`,
|
||||
}))
|
||||
|
||||
const groupedTasks = computed(() => {
|
||||
const groups: Record<number, TaskItem[]> = {
|
||||
1: [],
|
||||
2: [],
|
||||
3: [],
|
||||
4: [],
|
||||
}
|
||||
|
||||
for (const task of tasks.value) {
|
||||
if (groups[task.priority_group]) {
|
||||
groups[task.priority_group].push(task)
|
||||
}
|
||||
}
|
||||
|
||||
for (const key of Object.keys(groups)) {
|
||||
groups[Number(key)].sort((left, right) => {
|
||||
if (left.is_completed !== right.is_completed) {
|
||||
return left.is_completed ? 1 : -1
|
||||
}
|
||||
return left.id - right.id
|
||||
})
|
||||
}
|
||||
|
||||
return groups
|
||||
})
|
||||
|
||||
async function loadTasksData() {
|
||||
taskLoading.value = true
|
||||
try {
|
||||
tasks.value = await getTasks()
|
||||
} catch (error) {
|
||||
ElMessage.warning(error instanceof Error ? error.message : '任务加载失败')
|
||||
} finally {
|
||||
taskLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function loadScheduleData() {
|
||||
scheduleLoading.value = true
|
||||
try {
|
||||
const schedules = await getTodaySchedule()
|
||||
todayEvents.value = schedules.flatMap((item) => item.events).sort((left, right) => left.order - right.order)
|
||||
} catch (error) {
|
||||
ElMessage.warning(error instanceof Error ? error.message : '今日日程加载失败')
|
||||
} finally {
|
||||
scheduleLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function loadDashboardData() {
|
||||
pageLoading.value = true
|
||||
await Promise.allSettled([loadTasksData(), loadScheduleData()])
|
||||
pageLoading.value = false
|
||||
}
|
||||
|
||||
async function handleTaskToggle(task: TaskItem) {
|
||||
try {
|
||||
if (task.is_completed) {
|
||||
const result = await undoCompleteTask(task.id)
|
||||
task.is_completed = result.is_completed
|
||||
task.status = result.status
|
||||
ElMessage.success('任务已恢复为未完成')
|
||||
return
|
||||
}
|
||||
|
||||
const result = await completeTask(task.id)
|
||||
task.is_completed = result.is_completed
|
||||
task.status = result.status
|
||||
ElMessage.success(result.already_completed ? '任务已经是完成状态' : '任务已标记为完成')
|
||||
} catch (error) {
|
||||
ElMessage.error(error instanceof Error ? error.message : '任务更新失败')
|
||||
}
|
||||
}
|
||||
|
||||
function openCreateTaskDialog() {
|
||||
taskForm.title = ''
|
||||
taskForm.priority_group = 2
|
||||
taskForm.deadline_at = null
|
||||
createTaskDialogVisible.value = true
|
||||
}
|
||||
|
||||
async function handleCreateTask() {
|
||||
if (!taskForm.title.trim()) {
|
||||
ElMessage.warning('请先填写任务标题')
|
||||
return
|
||||
}
|
||||
|
||||
createTaskLoading.value = true
|
||||
try {
|
||||
const created = await createTask({
|
||||
title: taskForm.title.trim(),
|
||||
priority_group: taskForm.priority_group,
|
||||
deadline_at: taskForm.deadline_at ? taskForm.deadline_at.toISOString() : null,
|
||||
})
|
||||
|
||||
tasks.value.unshift({
|
||||
id: created.id,
|
||||
user_id: 0,
|
||||
title: created.title,
|
||||
priority_group: created.priority_group,
|
||||
status: created.status,
|
||||
deadline: created.deadline_at ?? '',
|
||||
is_completed: false,
|
||||
})
|
||||
|
||||
createTaskDialogVisible.value = false
|
||||
ElMessage.success('任务已添加')
|
||||
} catch (error) {
|
||||
ElMessage.error(error instanceof Error ? error.message : '创建任务失败')
|
||||
} finally {
|
||||
createTaskLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleLogout() {
|
||||
logoutLoading.value = true
|
||||
|
||||
try {
|
||||
await authStore.logout()
|
||||
ElMessage.success('已安全退出登录')
|
||||
} catch (error) {
|
||||
ElMessage.warning(error instanceof Error ? `${error.message},本地登录态已清除` : '退出接口异常,本地登录态已清除')
|
||||
} finally {
|
||||
logoutLoading.value = false
|
||||
await router.push('/auth')
|
||||
}
|
||||
}
|
||||
|
||||
function handleCourseImportEntry() {
|
||||
ElMessage.info('课表导入入口已预留,下一步我可以继续把导入流程页接出来')
|
||||
}
|
||||
|
||||
function clampSidebarWidth(nextWidth: number) {
|
||||
return Math.min(110, Math.max(68, nextWidth))
|
||||
}
|
||||
|
||||
function clampAssistantWidth(nextWidth: number) {
|
||||
return Math.min(680, Math.max(380, nextWidth))
|
||||
}
|
||||
|
||||
function startResize(type: 'sidebar' | 'assistant', event: PointerEvent) {
|
||||
const layout = dashboardLayoutRef.value
|
||||
if (!layout || window.innerWidth <= 1380) {
|
||||
return
|
||||
}
|
||||
|
||||
const rect = layout.getBoundingClientRect()
|
||||
const startX = event.clientX
|
||||
const startSidebarWidth = sidebarWidth.value
|
||||
const startAssistantWidth = assistantWidth.value
|
||||
|
||||
// 1. 拖拽时先记录容器宽度和起始位置,避免每次 move 都重复读布局造成抖动。
|
||||
// 2. 中间主区域需要保留最小宽度,防止用户把左右面板拖到挤爆内容区。
|
||||
// 3. 结束时统一解绑事件,避免指针松开后仍残留拖拽状态。
|
||||
const handlePointerMove = (moveEvent: PointerEvent) => {
|
||||
const deltaX = moveEvent.clientX - startX
|
||||
const splitterTotalWidth = 20
|
||||
const minMainWidth = 760
|
||||
|
||||
if (type === 'sidebar') {
|
||||
const nextSidebarWidth = clampSidebarWidth(startSidebarWidth + deltaX)
|
||||
const maxSidebarWidth = rect.width - assistantWidth.value - splitterTotalWidth - minMainWidth
|
||||
sidebarWidth.value = Math.min(nextSidebarWidth, Math.max(68, maxSidebarWidth))
|
||||
return
|
||||
}
|
||||
|
||||
const nextAssistantWidth = clampAssistantWidth(startAssistantWidth - deltaX)
|
||||
const maxAssistantWidth = rect.width - sidebarWidth.value - splitterTotalWidth - minMainWidth
|
||||
assistantWidth.value = Math.min(nextAssistantWidth, Math.max(380, maxAssistantWidth))
|
||||
}
|
||||
|
||||
const stopResize = () => {
|
||||
window.removeEventListener('pointermove', handlePointerMove)
|
||||
window.removeEventListener('pointerup', stopResize)
|
||||
document.body.classList.remove('dashboard-resizing')
|
||||
}
|
||||
|
||||
document.body.classList.add('dashboard-resizing')
|
||||
window.addEventListener('pointermove', handlePointerMove)
|
||||
window.addEventListener('pointerup', stopResize)
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await loadDashboardData()
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
document.body.classList.remove('dashboard-resizing')
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="dashboard-page">
|
||||
<div ref="dashboardLayoutRef" class="dashboard-layout" :style="layoutStyle">
|
||||
<aside class="dashboard-sidebar">
|
||||
<div class="dashboard-sidebar__brand">S</div>
|
||||
<nav class="dashboard-sidebar__nav">
|
||||
<button
|
||||
v-for="item in sidebarItems"
|
||||
:key="item.key"
|
||||
type="button"
|
||||
class="dashboard-sidebar__nav-item"
|
||||
:class="{ 'dashboard-sidebar__nav-item--active': item.key === 'home' }"
|
||||
>
|
||||
<span>{{ item.short }}</span>
|
||||
<small>{{ item.label }}</small>
|
||||
</button>
|
||||
</nav>
|
||||
<button type="button" class="dashboard-sidebar__settings">设</button>
|
||||
</aside>
|
||||
|
||||
<div
|
||||
class="dashboard-splitter"
|
||||
role="separator"
|
||||
aria-label="调整侧边导航宽度"
|
||||
@pointerdown.prevent="startResize('sidebar', $event)"
|
||||
>
|
||||
<span class="dashboard-splitter__line" />
|
||||
</div>
|
||||
|
||||
<section class="dashboard-main">
|
||||
<header class="dashboard-topbar glass-panel">
|
||||
<div>
|
||||
<div class="dashboard-topbar__brandline">
|
||||
<strong>AI 智慧日程系统</strong>
|
||||
<span>{{ pageTitleDate }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dashboard-topbar__actions">
|
||||
<button
|
||||
type="button"
|
||||
class="dashboard-topbar__logout"
|
||||
:disabled="logoutLoading"
|
||||
@click="handleLogout"
|
||||
>
|
||||
{{ logoutLoading ? '退出中…' : '登出' }}
|
||||
</button>
|
||||
<div class="dashboard-topbar__profile">
|
||||
<strong>{{ greetingName }}</strong>
|
||||
<span>{{ greetingName.slice(0, 1).toUpperCase() }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="dashboard-content page-shell">
|
||||
<TodayTimeline :events="todayEvents" :loading="scheduleLoading || pageLoading" />
|
||||
|
||||
<div class="dashboard-actions">
|
||||
<button type="button" class="dashboard-actions__primary" @click="openCreateTaskDialog">
|
||||
添加任务
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<section class="dashboard-quadrants">
|
||||
<TaskQuadrantCard
|
||||
v-for="group in quadrantOrder"
|
||||
:key="group"
|
||||
:title="quadrantMeta[group].title"
|
||||
:caption="quadrantMeta[group].caption"
|
||||
:tone="quadrantMeta[group].tone"
|
||||
:empty-text="quadrantMeta[group].emptyText"
|
||||
:count="groupedTasks[group].length"
|
||||
:tasks="groupedTasks[group]"
|
||||
:loading="taskLoading || pageLoading"
|
||||
@toggle="handleTaskToggle"
|
||||
/>
|
||||
</section>
|
||||
|
||||
<section class="dashboard-import glass-panel">
|
||||
<div class="dashboard-import__content">
|
||||
<p class="dashboard-import__eyebrow">课程导入</p>
|
||||
<h2>导入课表</h2>
|
||||
<p>导入课表后,可以在安排日程时避开上课时间,后续我会继续把导入流程页接完整。</p>
|
||||
<button type="button" class="dashboard-import__button" @click="handleCourseImportEntry">
|
||||
开始导入
|
||||
</button>
|
||||
</div>
|
||||
<div class="dashboard-import__shape">
|
||||
<span class="dashboard-import__shape-ring" />
|
||||
<span class="dashboard-import__shape-core" />
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div
|
||||
class="dashboard-splitter"
|
||||
role="separator"
|
||||
aria-label="调整 AI 助手宽度"
|
||||
@pointerdown.prevent="startResize('assistant', $event)"
|
||||
>
|
||||
<span class="dashboard-splitter__line" />
|
||||
</div>
|
||||
|
||||
<AssistantPanel class="dashboard-assistant" />
|
||||
</div>
|
||||
|
||||
<el-dialog
|
||||
v-model="createTaskDialogVisible"
|
||||
title="添加任务"
|
||||
width="460px"
|
||||
align-center
|
||||
class="dashboard-dialog"
|
||||
>
|
||||
<el-form label-position="top">
|
||||
<el-form-item label="任务标题">
|
||||
<el-input v-model="taskForm.title" maxlength="255" placeholder="例如:完成数据库复习" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="优先级象限">
|
||||
<el-select v-model="taskForm.priority_group" class="dashboard-dialog__select">
|
||||
<el-option :value="1" label="1 - 重要且紧急" />
|
||||
<el-option :value="2" label="2 - 重要不紧急" />
|
||||
<el-option :value="3" label="3 - 简单不重要" />
|
||||
<el-option :value="4" label="4 - 不简单不重要" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="截止时间">
|
||||
<el-date-picker
|
||||
v-model="taskForm.deadline_at"
|
||||
type="datetime"
|
||||
placeholder="可选,不设置也可以"
|
||||
class="dashboard-dialog__select"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="createTaskDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="createTaskLoading" @click="handleCreateTask">保存任务</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.dashboard-page {
|
||||
height: 100vh;
|
||||
padding: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.dashboard-layout {
|
||||
--dashboard-sidebar-width: 78px;
|
||||
--dashboard-assistant-width: 460px;
|
||||
height: calc(100vh - 20px);
|
||||
display: grid;
|
||||
grid-template-columns:
|
||||
var(--dashboard-sidebar-width)
|
||||
10px
|
||||
minmax(0, 1fr)
|
||||
10px
|
||||
var(--dashboard-assistant-width);
|
||||
gap: 8px;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.dashboard-sidebar {
|
||||
height: 100%;
|
||||
border-radius: 26px;
|
||||
background: linear-gradient(180deg, #165ca8 0%, #104d8f 100%);
|
||||
padding: 16px 12px;
|
||||
display: grid;
|
||||
grid-template-rows: auto 1fr auto;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.dashboard-sidebar__brand,
|
||||
.dashboard-sidebar__settings {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border: none;
|
||||
border-radius: 16px;
|
||||
background: rgba(255, 255, 255, 0.14);
|
||||
color: #fff;
|
||||
font-weight: 800;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.dashboard-sidebar__nav {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
align-content: start;
|
||||
}
|
||||
|
||||
.dashboard-sidebar__nav-item {
|
||||
width: 54px;
|
||||
border: none;
|
||||
border-radius: 16px;
|
||||
background: transparent;
|
||||
color: rgba(255, 255, 255, 0.74);
|
||||
padding: 10px 8px;
|
||||
display: grid;
|
||||
justify-items: center;
|
||||
gap: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dashboard-sidebar__nav-item span {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 11px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.dashboard-sidebar__nav-item small {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.dashboard-sidebar__nav-item--active {
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.dashboard-splitter {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: col-resize;
|
||||
touch-action: none;
|
||||
}
|
||||
|
||||
.dashboard-splitter__line {
|
||||
width: 4px;
|
||||
height: 64px;
|
||||
border-radius: 999px;
|
||||
background: linear-gradient(180deg, rgba(145, 163, 188, 0.24), rgba(88, 124, 177, 0.4), rgba(145, 163, 188, 0.24));
|
||||
transition:
|
||||
background-color 0.18s ease,
|
||||
transform 0.18s ease;
|
||||
}
|
||||
|
||||
.dashboard-splitter:hover .dashboard-splitter__line {
|
||||
transform: scaleX(1.15);
|
||||
background: linear-gradient(180deg, rgba(104, 140, 194, 0.34), rgba(42, 108, 214, 0.62), rgba(104, 140, 194, 0.34));
|
||||
}
|
||||
|
||||
.dashboard-main {
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
display: grid;
|
||||
grid-template-rows: auto minmax(0, 1fr);
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.dashboard-topbar {
|
||||
border-radius: 24px;
|
||||
padding: 18px 22px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border: 1px solid rgba(17, 24, 39, 0.08);
|
||||
}
|
||||
|
||||
.dashboard-topbar__brandline {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.dashboard-topbar__brandline strong {
|
||||
font-size: 18px;
|
||||
color: #14233a;
|
||||
}
|
||||
|
||||
.dashboard-topbar__brandline span {
|
||||
color: #677588;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.dashboard-topbar__actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.dashboard-topbar__logout {
|
||||
min-width: 88px;
|
||||
height: 38px;
|
||||
border-radius: 13px;
|
||||
border: 1px solid rgba(28, 98, 205, 0.22);
|
||||
background: #f9fbff;
|
||||
color: #1d63cf;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dashboard-topbar__profile {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.dashboard-topbar__profile strong {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.dashboard-topbar__profile span {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
border-radius: 999px;
|
||||
background: #eef3fb;
|
||||
color: #314156;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.dashboard-content {
|
||||
width: 100%;
|
||||
max-width: none;
|
||||
min-height: 0;
|
||||
display: grid;
|
||||
gap: 14px;
|
||||
overflow: auto;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
.dashboard-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.dashboard-actions__primary {
|
||||
height: 42px;
|
||||
padding: 0 20px;
|
||||
border: none;
|
||||
border-radius: 15px;
|
||||
background: linear-gradient(180deg, #246ff1 0%, #1a5dc8 100%);
|
||||
color: #fff;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dashboard-quadrants {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.dashboard-import {
|
||||
border-radius: 26px;
|
||||
padding: 28px 30px;
|
||||
min-height: 240px;
|
||||
background: linear-gradient(135deg, #0f5ca9 0%, #0b4b89 100%);
|
||||
color: #fff;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 20px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.dashboard-import__content {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
max-width: 460px;
|
||||
}
|
||||
|
||||
.dashboard-import__eyebrow {
|
||||
margin: 0 0 8px;
|
||||
opacity: 0.76;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.dashboard-import h2 {
|
||||
margin: 0;
|
||||
font-size: 38px;
|
||||
line-height: 1.08;
|
||||
letter-spacing: -0.04em;
|
||||
}
|
||||
|
||||
.dashboard-import p {
|
||||
margin: 12px 0 22px;
|
||||
color: rgba(255, 255, 255, 0.82);
|
||||
line-height: 1.7;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.dashboard-import__button {
|
||||
height: 46px;
|
||||
padding: 0 20px;
|
||||
border: none;
|
||||
border-radius: 15px;
|
||||
background: #fff;
|
||||
color: #0d55a0;
|
||||
font-weight: 800;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dashboard-import__shape {
|
||||
position: relative;
|
||||
width: 250px;
|
||||
min-width: 250px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
.dashboard-import__shape-ring,
|
||||
.dashboard-import__shape-core {
|
||||
position: absolute;
|
||||
border-radius: 999px;
|
||||
border: 14px solid rgba(255, 255, 255, 0.92);
|
||||
}
|
||||
|
||||
.dashboard-import__shape-ring {
|
||||
width: 168px;
|
||||
height: 168px;
|
||||
right: 22px;
|
||||
bottom: 10px;
|
||||
}
|
||||
|
||||
.dashboard-import__shape-core {
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
right: 0;
|
||||
bottom: 2px;
|
||||
}
|
||||
|
||||
.dashboard-assistant {
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
align-self: stretch;
|
||||
}
|
||||
|
||||
.dashboard-dialog :deep(.el-dialog) {
|
||||
border-radius: 24px;
|
||||
}
|
||||
|
||||
.dashboard-dialog__select {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media (max-width: 1640px) {
|
||||
.dashboard-layout {
|
||||
--dashboard-assistant-width: 430px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1380px) {
|
||||
.dashboard-layout {
|
||||
height: calc(100vh - 20px);
|
||||
grid-template-columns: 78px minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.dashboard-splitter {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.dashboard-assistant {
|
||||
grid-column: 2;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 980px) {
|
||||
.dashboard-layout {
|
||||
height: auto;
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.dashboard-sidebar {
|
||||
height: auto;
|
||||
grid-template-columns: auto 1fr auto;
|
||||
grid-template-rows: none;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.dashboard-sidebar__nav {
|
||||
grid-auto-flow: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.dashboard-main,
|
||||
.dashboard-assistant {
|
||||
grid-column: auto;
|
||||
}
|
||||
|
||||
.dashboard-quadrants {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.dashboard-import {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.dashboard-page {
|
||||
height: auto;
|
||||
padding: 8px;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.dashboard-topbar {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.dashboard-topbar__actions,
|
||||
.dashboard-topbar__brandline {
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user