feat(app): scaffold Vue3 frontend (stage 1)
This commit is contained in:
5
app-frontend/.gitignore
vendored
Normal file
5
app-frontend/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
dist
|
||||||
|
node_modules
|
||||||
|
.DS_Store
|
||||||
|
.vite
|
||||||
|
|
||||||
4
app-frontend/README.md
Normal file
4
app-frontend/README.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# app-frontend
|
||||||
|
|
||||||
|
前台(用户端)Vue3 + Vite 工程,构建产物输出到 `static/app/`。
|
||||||
|
|
||||||
14
app-frontend/index.html
Normal file
14
app-frontend/index.html
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
|
||||||
|
<title>知识管理平台</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>该页面需要启用 JavaScript 才能使用。</noscript>
|
||||||
|
<div id="app"></div>
|
||||||
|
<script type="module" src="/src/main.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
2079
app-frontend/package-lock.json
generated
Normal file
2079
app-frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
25
app-frontend/package.json
Normal file
25
app-frontend/package.json
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name": "app-frontend",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@element-plus/icons-vue": "^2.3.2",
|
||||||
|
"axios": "^1.12.2",
|
||||||
|
"element-plus": "^2.11.3",
|
||||||
|
"pinia": "^3.0.3",
|
||||||
|
"socket.io-client": "^4.8.1",
|
||||||
|
"vue": "^3.5.24",
|
||||||
|
"vue-router": "^4.6.3"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vitejs/plugin-vue": "^6.0.1",
|
||||||
|
"vite": "^7.2.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
6
app-frontend/src/App.vue
Normal file
6
app-frontend/src/App.vue
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<script setup></script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<RouterView />
|
||||||
|
</template>
|
||||||
|
|
||||||
195
app-frontend/src/layouts/AppLayout.vue
Normal file
195
app-frontend/src/layouts/AppLayout.vue
Normal file
@@ -0,0 +1,195 @@
|
|||||||
|
<script setup>
|
||||||
|
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||||
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
|
import { ElMessageBox } from 'element-plus'
|
||||||
|
import { Calendar, Camera, User } from '@element-plus/icons-vue'
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
const isMobile = ref(false)
|
||||||
|
const drawerOpen = ref(false)
|
||||||
|
let mediaQuery
|
||||||
|
|
||||||
|
function syncIsMobile() {
|
||||||
|
isMobile.value = Boolean(mediaQuery?.matches)
|
||||||
|
if (!isMobile.value) drawerOpen.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
mediaQuery = window.matchMedia('(max-width: 768px)')
|
||||||
|
mediaQuery.addEventListener?.('change', syncIsMobile)
|
||||||
|
syncIsMobile()
|
||||||
|
})
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
mediaQuery?.removeEventListener?.('change', syncIsMobile)
|
||||||
|
})
|
||||||
|
|
||||||
|
const menuItems = [
|
||||||
|
{ path: '/app/accounts', label: '账号管理', icon: User },
|
||||||
|
{ path: '/app/schedules', label: '定时任务', icon: Calendar },
|
||||||
|
{ path: '/app/screenshots', label: '截图管理', icon: Camera },
|
||||||
|
]
|
||||||
|
|
||||||
|
const activeMenu = computed(() => route.path)
|
||||||
|
|
||||||
|
async function go(path) {
|
||||||
|
await router.push(path)
|
||||||
|
drawerOpen.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
async function logout() {
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm('确定退出登录吗?', '退出登录', {
|
||||||
|
confirmButtonText: '退出',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
} catch {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
window.location.href = '/login'
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<el-container class="layout-root">
|
||||||
|
<el-aside v-if="!isMobile" width="220px" class="layout-aside">
|
||||||
|
<div class="brand">
|
||||||
|
<div class="brand-title">知识管理平台</div>
|
||||||
|
<div class="brand-sub app-muted">用户中心</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-menu :default-active="activeMenu" class="aside-menu" router @select="go">
|
||||||
|
<el-menu-item v-for="item in menuItems" :key="item.path" :index="item.path">
|
||||||
|
<el-icon><component :is="item.icon" /></el-icon>
|
||||||
|
<span>{{ item.label }}</span>
|
||||||
|
</el-menu-item>
|
||||||
|
</el-menu>
|
||||||
|
</el-aside>
|
||||||
|
|
||||||
|
<el-container>
|
||||||
|
<el-header class="layout-header">
|
||||||
|
<div class="header-left">
|
||||||
|
<el-button v-if="isMobile" text class="header-menu-btn" @click="drawerOpen = true">
|
||||||
|
菜单
|
||||||
|
</el-button>
|
||||||
|
<div class="header-title">用户控制台</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="header-right">
|
||||||
|
<el-button type="primary" plain @click="logout">退出</el-button>
|
||||||
|
</div>
|
||||||
|
</el-header>
|
||||||
|
|
||||||
|
<el-main class="layout-main">
|
||||||
|
<RouterView />
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
|
||||||
|
<el-drawer v-model="drawerOpen" size="240px" :with-header="false">
|
||||||
|
<div class="drawer-brand">
|
||||||
|
<div class="brand-title">知识管理平台</div>
|
||||||
|
<div class="brand-sub app-muted">用户中心</div>
|
||||||
|
</div>
|
||||||
|
<el-menu :default-active="activeMenu" class="aside-menu" router @select="go">
|
||||||
|
<el-menu-item v-for="item in menuItems" :key="item.path" :index="item.path">
|
||||||
|
<el-icon><component :is="item.icon" /></el-icon>
|
||||||
|
<span>{{ item.label }}</span>
|
||||||
|
</el-menu-item>
|
||||||
|
</el-menu>
|
||||||
|
</el-drawer>
|
||||||
|
</el-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.layout-root {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layout-aside {
|
||||||
|
background: #ffffff;
|
||||||
|
border-right: 1px solid var(--app-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand,
|
||||||
|
.drawer-brand {
|
||||||
|
padding: 18px 16px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-title {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 800;
|
||||||
|
letter-spacing: 0.2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-sub {
|
||||||
|
margin-top: 2px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aside-menu {
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layout-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
background: rgba(246, 247, 251, 0.6);
|
||||||
|
backdrop-filter: saturate(180%) blur(10px);
|
||||||
|
border-bottom: 1px solid var(--app-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-left {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-title {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 800;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-menu-btn {
|
||||||
|
padding-left: 0;
|
||||||
|
padding-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-right {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layout-main {
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.layout-header {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
height: auto;
|
||||||
|
padding-top: 10px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-right {
|
||||||
|
width: 100%;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layout-main {
|
||||||
|
padding: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
15
app-frontend/src/main.js
Normal file
15
app-frontend/src/main.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { createApp } from 'vue'
|
||||||
|
import App from './App.vue'
|
||||||
|
|
||||||
|
import router from './router'
|
||||||
|
|
||||||
|
import { createPinia } from 'pinia'
|
||||||
|
|
||||||
|
import ElementPlus from 'element-plus'
|
||||||
|
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
||||||
|
import 'element-plus/dist/index.css'
|
||||||
|
|
||||||
|
import './style.css'
|
||||||
|
|
||||||
|
createApp(App).use(createPinia()).use(router).use(ElementPlus, { locale: zhCn }).mount('#app')
|
||||||
|
|
||||||
20
app-frontend/src/pages/AccountsPage.vue
Normal file
20
app-frontend/src/pages/AccountsPage.vue
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<template>
|
||||||
|
<el-card shadow="never" :body-style="{ padding: '16px' }" class="card">
|
||||||
|
<h2 class="title">账号管理</h2>
|
||||||
|
<div class="app-muted">阶段1:页面壳子已就绪,功能将在后续阶段迁移。</div>
|
||||||
|
</el-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.card {
|
||||||
|
border-radius: var(--app-radius);
|
||||||
|
border: 1px solid var(--app-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
margin: 0 0 6px;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
68
app-frontend/src/pages/LoginPage.vue
Normal file
68
app-frontend/src/pages/LoginPage.vue
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<script setup>
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
function goRegister() {
|
||||||
|
router.push('/register')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="auth-wrap">
|
||||||
|
<el-card shadow="never" class="auth-card" :body-style="{ padding: '22px' }">
|
||||||
|
<div class="brand">
|
||||||
|
<div class="brand-title">知识管理平台</div>
|
||||||
|
<div class="brand-sub app-muted">用户登录</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-alert
|
||||||
|
type="info"
|
||||||
|
:closable="false"
|
||||||
|
title="阶段1:仅完成前台工程与布局搭建。登录/验证码/找回密码等功能将在后续阶段迁移。"
|
||||||
|
show-icon
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<el-button type="primary" @click="goRegister">前往注册</el-button>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.auth-wrap {
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-card {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 420px;
|
||||||
|
border-radius: var(--app-radius);
|
||||||
|
border: 1px solid var(--app-border);
|
||||||
|
box-shadow: var(--app-shadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand {
|
||||||
|
margin-bottom: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-title {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-sub {
|
||||||
|
margin-top: 4px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
68
app-frontend/src/pages/RegisterPage.vue
Normal file
68
app-frontend/src/pages/RegisterPage.vue
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<script setup>
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
function goLogin() {
|
||||||
|
router.push('/login')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="auth-wrap">
|
||||||
|
<el-card shadow="never" class="auth-card" :body-style="{ padding: '22px' }">
|
||||||
|
<div class="brand">
|
||||||
|
<div class="brand-title">知识管理平台</div>
|
||||||
|
<div class="brand-sub app-muted">用户注册</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-alert
|
||||||
|
type="info"
|
||||||
|
:closable="false"
|
||||||
|
title="阶段1:仅完成前台工程与布局搭建。注册/邮箱验证等功能将在后续阶段迁移。"
|
||||||
|
show-icon
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<el-button @click="goLogin">返回登录</el-button>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.auth-wrap {
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-card {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 420px;
|
||||||
|
border-radius: var(--app-radius);
|
||||||
|
border: 1px solid var(--app-border);
|
||||||
|
box-shadow: var(--app-shadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand {
|
||||||
|
margin-bottom: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-title {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-sub {
|
||||||
|
margin-top: 4px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
68
app-frontend/src/pages/ResetPasswordPage.vue
Normal file
68
app-frontend/src/pages/ResetPasswordPage.vue
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<script setup>
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
function goLogin() {
|
||||||
|
router.push('/login')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="auth-wrap">
|
||||||
|
<el-card shadow="never" class="auth-card" :body-style="{ padding: '22px' }">
|
||||||
|
<div class="brand">
|
||||||
|
<div class="brand-title">知识管理平台</div>
|
||||||
|
<div class="brand-sub app-muted">重置密码</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-alert
|
||||||
|
type="info"
|
||||||
|
:closable="false"
|
||||||
|
title="阶段1:仅完成前台工程与布局搭建。重置密码功能将在后续阶段迁移。"
|
||||||
|
show-icon
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<el-button @click="goLogin">返回登录</el-button>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.auth-wrap {
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-card {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 420px;
|
||||||
|
border-radius: var(--app-radius);
|
||||||
|
border: 1px solid var(--app-border);
|
||||||
|
box-shadow: var(--app-shadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand {
|
||||||
|
margin-bottom: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-title {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-sub {
|
||||||
|
margin-top: 4px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
20
app-frontend/src/pages/SchedulesPage.vue
Normal file
20
app-frontend/src/pages/SchedulesPage.vue
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<template>
|
||||||
|
<el-card shadow="never" :body-style="{ padding: '16px' }" class="card">
|
||||||
|
<h2 class="title">定时任务</h2>
|
||||||
|
<div class="app-muted">阶段1:页面壳子已就绪,功能将在后续阶段迁移。</div>
|
||||||
|
</el-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.card {
|
||||||
|
border-radius: var(--app-radius);
|
||||||
|
border: 1px solid var(--app-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
margin: 0 0 6px;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
20
app-frontend/src/pages/ScreenshotsPage.vue
Normal file
20
app-frontend/src/pages/ScreenshotsPage.vue
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<template>
|
||||||
|
<el-card shadow="never" :body-style="{ padding: '16px' }" class="card">
|
||||||
|
<h2 class="title">截图管理</h2>
|
||||||
|
<div class="app-muted">阶段1:页面壳子已就绪,功能将在后续阶段迁移。</div>
|
||||||
|
</el-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.card {
|
||||||
|
border-radius: var(--app-radius);
|
||||||
|
border: 1px solid var(--app-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
margin: 0 0 6px;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
37
app-frontend/src/router/index.js
Normal file
37
app-frontend/src/router/index.js
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import { createRouter, createWebHistory } from 'vue-router'
|
||||||
|
|
||||||
|
import AppLayout from '../layouts/AppLayout.vue'
|
||||||
|
|
||||||
|
const LoginPage = () => import('../pages/LoginPage.vue')
|
||||||
|
const RegisterPage = () => import('../pages/RegisterPage.vue')
|
||||||
|
const ResetPasswordPage = () => import('../pages/ResetPasswordPage.vue')
|
||||||
|
|
||||||
|
const AccountsPage = () => import('../pages/AccountsPage.vue')
|
||||||
|
const SchedulesPage = () => import('../pages/SchedulesPage.vue')
|
||||||
|
const ScreenshotsPage = () => import('../pages/ScreenshotsPage.vue')
|
||||||
|
|
||||||
|
const routes = [
|
||||||
|
{ path: '/', redirect: '/login' },
|
||||||
|
{ path: '/login', name: 'login', component: LoginPage },
|
||||||
|
{ path: '/register', name: 'register', component: RegisterPage },
|
||||||
|
{ path: '/reset_password', name: 'reset_password', component: ResetPasswordPage },
|
||||||
|
{
|
||||||
|
path: '/app',
|
||||||
|
component: AppLayout,
|
||||||
|
children: [
|
||||||
|
{ path: '', redirect: '/app/accounts' },
|
||||||
|
{ path: 'accounts', name: 'accounts', component: AccountsPage },
|
||||||
|
{ path: 'schedules', name: 'schedules', component: SchedulesPage },
|
||||||
|
{ path: 'screenshots', name: 'screenshots', component: ScreenshotsPage },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ path: '/:pathMatch(.*)*', redirect: '/login' },
|
||||||
|
]
|
||||||
|
|
||||||
|
const router = createRouter({
|
||||||
|
history: createWebHistory(),
|
||||||
|
routes,
|
||||||
|
})
|
||||||
|
|
||||||
|
export default router
|
||||||
|
|
||||||
61
app-frontend/src/style.css
Normal file
61
app-frontend/src/style.css
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
:root {
|
||||||
|
--app-bg: #f6f7fb;
|
||||||
|
--app-text: #111827;
|
||||||
|
--app-muted: #6b7280;
|
||||||
|
--app-border: rgba(17, 24, 39, 0.08);
|
||||||
|
--app-radius: 12px;
|
||||||
|
--app-shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
|
||||||
|
|
||||||
|
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
|
||||||
|
'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
|
||||||
|
font-synthesis: none;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
html,
|
||||||
|
body,
|
||||||
|
#app {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
background: var(--app-bg);
|
||||||
|
color: var(--app-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-muted {
|
||||||
|
color: var(--app-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.el-dialog {
|
||||||
|
max-width: 92vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-form-item {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-form-item__label {
|
||||||
|
width: auto !important;
|
||||||
|
justify-content: flex-start !important;
|
||||||
|
padding: 0 0 6px !important;
|
||||||
|
line-height: 1.4;
|
||||||
|
text-align: left !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-form-item__content {
|
||||||
|
margin-left: 0 !important;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
13
app-frontend/vite.config.js
Normal file
13
app-frontend/vite.config.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import vue from '@vitejs/plugin-vue'
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [vue()],
|
||||||
|
base: './',
|
||||||
|
build: {
|
||||||
|
outDir: '../static/app',
|
||||||
|
emptyOutDir: true,
|
||||||
|
manifest: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
31
app.py
31
app.py
@@ -1241,6 +1241,37 @@ def admin_page():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"[admin_spa] 加载manifest失败: {e}")
|
logger.error(f"[admin_spa] 加载manifest失败: {e}")
|
||||||
return render_template('admin_legacy.html')
|
return render_template('admin_legacy.html')
|
||||||
|
|
||||||
|
|
||||||
|
def render_app_spa_or_legacy(legacy_template_name: str):
|
||||||
|
"""渲染前台 Vue SPA(构建产物位于 static/app),失败则回退旧模板。
|
||||||
|
|
||||||
|
说明:该函数仅负责“资源注入/回退逻辑”,不改变任何接口与业务流程。
|
||||||
|
"""
|
||||||
|
manifest_path = os.path.join(app.root_path, 'static', 'app', '.vite', 'manifest.json')
|
||||||
|
try:
|
||||||
|
with open(manifest_path, 'r', encoding='utf-8') as f:
|
||||||
|
manifest = json.load(f)
|
||||||
|
|
||||||
|
entry = manifest.get('index.html') or {}
|
||||||
|
js_file = entry.get('file')
|
||||||
|
css_files = entry.get('css') or []
|
||||||
|
|
||||||
|
if not js_file:
|
||||||
|
logger.warning(f"[app_spa] manifest缺少入口文件: {manifest_path}")
|
||||||
|
return render_template(legacy_template_name)
|
||||||
|
|
||||||
|
return render_template(
|
||||||
|
'app.html',
|
||||||
|
app_spa_js_file=f'app/{js_file}',
|
||||||
|
app_spa_css_files=[f'app/{p}' for p in css_files],
|
||||||
|
)
|
||||||
|
except FileNotFoundError:
|
||||||
|
logger.info(f"[app_spa] 未找到manifest: {manifest_path},回退旧模板: {legacy_template_name}")
|
||||||
|
return render_template(legacy_template_name)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"[app_spa] 加载manifest失败: {e}")
|
||||||
|
return render_template(legacy_template_name)
|
||||||
# ==================== 用户认证API ====================
|
# ==================== 用户认证API ====================
|
||||||
|
|
||||||
@app.route('/api/register', methods=['POST'])
|
@app.route('/api/register', methods=['POST'])
|
||||||
|
|||||||
91
static/app/.vite/manifest.json
Normal file
91
static/app/.vite/manifest.json
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
{
|
||||||
|
"index.html": {
|
||||||
|
"file": "assets/index-BDLnyqR1.js",
|
||||||
|
"name": "index",
|
||||||
|
"src": "index.html",
|
||||||
|
"isEntry": true,
|
||||||
|
"dynamicImports": [
|
||||||
|
"src/pages/LoginPage.vue",
|
||||||
|
"src/pages/RegisterPage.vue",
|
||||||
|
"src/pages/ResetPasswordPage.vue",
|
||||||
|
"src/pages/AccountsPage.vue",
|
||||||
|
"src/pages/SchedulesPage.vue",
|
||||||
|
"src/pages/ScreenshotsPage.vue"
|
||||||
|
],
|
||||||
|
"css": [
|
||||||
|
"assets/index-CZCRHVLY.css"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"src/pages/AccountsPage.vue": {
|
||||||
|
"file": "assets/AccountsPage-CDp_6M3v.js",
|
||||||
|
"name": "AccountsPage",
|
||||||
|
"src": "src/pages/AccountsPage.vue",
|
||||||
|
"isDynamicEntry": true,
|
||||||
|
"imports": [
|
||||||
|
"index.html"
|
||||||
|
],
|
||||||
|
"css": [
|
||||||
|
"assets/AccountsPage-ByA-Bv17.css"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"src/pages/LoginPage.vue": {
|
||||||
|
"file": "assets/LoginPage-CUFPnwuZ.js",
|
||||||
|
"name": "LoginPage",
|
||||||
|
"src": "src/pages/LoginPage.vue",
|
||||||
|
"isDynamicEntry": true,
|
||||||
|
"imports": [
|
||||||
|
"index.html"
|
||||||
|
],
|
||||||
|
"css": [
|
||||||
|
"assets/LoginPage-B-WqAKk4.css"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"src/pages/RegisterPage.vue": {
|
||||||
|
"file": "assets/RegisterPage-BYIu9Dvh.js",
|
||||||
|
"name": "RegisterPage",
|
||||||
|
"src": "src/pages/RegisterPage.vue",
|
||||||
|
"isDynamicEntry": true,
|
||||||
|
"imports": [
|
||||||
|
"index.html"
|
||||||
|
],
|
||||||
|
"css": [
|
||||||
|
"assets/RegisterPage-CPyuLOs6.css"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"src/pages/ResetPasswordPage.vue": {
|
||||||
|
"file": "assets/ResetPasswordPage-Ditr0QEq.js",
|
||||||
|
"name": "ResetPasswordPage",
|
||||||
|
"src": "src/pages/ResetPasswordPage.vue",
|
||||||
|
"isDynamicEntry": true,
|
||||||
|
"imports": [
|
||||||
|
"index.html"
|
||||||
|
],
|
||||||
|
"css": [
|
||||||
|
"assets/ResetPasswordPage-CErwB9tI.css"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"src/pages/SchedulesPage.vue": {
|
||||||
|
"file": "assets/SchedulesPage-B7bCm2b3.js",
|
||||||
|
"name": "SchedulesPage",
|
||||||
|
"src": "src/pages/SchedulesPage.vue",
|
||||||
|
"isDynamicEntry": true,
|
||||||
|
"imports": [
|
||||||
|
"index.html"
|
||||||
|
],
|
||||||
|
"css": [
|
||||||
|
"assets/SchedulesPage-BAj1X6GW.css"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"src/pages/ScreenshotsPage.vue": {
|
||||||
|
"file": "assets/ScreenshotsPage-DPphuiaz.js",
|
||||||
|
"name": "ScreenshotsPage",
|
||||||
|
"src": "src/pages/ScreenshotsPage.vue",
|
||||||
|
"isDynamicEntry": true,
|
||||||
|
"imports": [
|
||||||
|
"index.html"
|
||||||
|
],
|
||||||
|
"css": [
|
||||||
|
"assets/ScreenshotsPage-CmPGicmh.css"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
1
static/app/assets/AccountsPage-ByA-Bv17.css
Normal file
1
static/app/assets/AccountsPage-ByA-Bv17.css
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.card[data-v-f8df5656]{border-radius:var(--app-radius);border:1px solid var(--app-border)}.title[data-v-f8df5656]{margin:0 0 6px;font-size:16px;font-weight:800}
|
||||||
1
static/app/assets/AccountsPage-CDp_6M3v.js
Normal file
1
static/app/assets/AccountsPage-CDp_6M3v.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
import{_ as t,e as o,w as c,r,o as d,b as s}from"./index-BDLnyqR1.js";const n={};function _(l,e){const a=r("el-card");return d(),o(a,{shadow:"never","body-style":{padding:"16px"},class:"card"},{default:c(()=>[...e[0]||(e[0]=[s("h2",{class:"title"},"账号管理",-1),s("div",{class:"app-muted"},"阶段1:页面壳子已就绪,功能将在后续阶段迁移。",-1)])]),_:1})}const f=t(n,[["render",_],["__scopeId","data-v-f8df5656"]]);export{f as default};
|
||||||
1
static/app/assets/LoginPage-B-WqAKk4.css
Normal file
1
static/app/assets/LoginPage-B-WqAKk4.css
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.auth-wrap[data-v-b02cd436]{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px}.auth-card[data-v-b02cd436]{width:100%;max-width:420px;border-radius:var(--app-radius);border:1px solid var(--app-border);box-shadow:var(--app-shadow)}.brand[data-v-b02cd436]{margin-bottom:14px}.brand-title[data-v-b02cd436]{font-size:18px;font-weight:900}.brand-sub[data-v-b02cd436]{margin-top:4px;font-size:12px}.actions[data-v-b02cd436]{margin-top:16px}
|
||||||
1
static/app/assets/LoginPage-CUFPnwuZ.js
Normal file
1
static/app/assets/LoginPage-CUFPnwuZ.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
import{_,c as i,a as s,w as a,r as o,u as p,o as u,b as t,d as m}from"./index-BDLnyqR1.js";const b={class:"auth-wrap"},f={class:"actions"},g={__name:"LoginPage",setup(v){const n=p();function r(){n.push("/register")}return(x,e)=>{const c=o("el-alert"),d=o("el-button"),l=o("el-card");return u(),i("div",b,[s(l,{shadow:"never",class:"auth-card","body-style":{padding:"22px"}},{default:a(()=>[e[1]||(e[1]=t("div",{class:"brand"},[t("div",{class:"brand-title"},"知识管理平台"),t("div",{class:"brand-sub app-muted"},"用户登录")],-1)),s(c,{type:"info",closable:!1,title:"阶段1:仅完成前台工程与布局搭建。登录/验证码/找回密码等功能将在后续阶段迁移。","show-icon":""}),t("div",f,[s(d,{type:"primary",onClick:r},{default:a(()=>[...e[0]||(e[0]=[m("前往注册",-1)])]),_:1})])]),_:1})])}}},w=_(g,[["__scopeId","data-v-b02cd436"]]);export{w as default};
|
||||||
1
static/app/assets/RegisterPage-BYIu9Dvh.js
Normal file
1
static/app/assets/RegisterPage-BYIu9Dvh.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
import{_,c as i,a as s,w as a,r as o,u as p,o as u,b as t,d as m}from"./index-BDLnyqR1.js";const b={class:"auth-wrap"},f={class:"actions"},g={__name:"RegisterPage",setup(v){const n=p();function c(){n.push("/login")}return(x,e)=>{const r=o("el-alert"),l=o("el-button"),d=o("el-card");return u(),i("div",b,[s(d,{shadow:"never",class:"auth-card","body-style":{padding:"22px"}},{default:a(()=>[e[1]||(e[1]=t("div",{class:"brand"},[t("div",{class:"brand-title"},"知识管理平台"),t("div",{class:"brand-sub app-muted"},"用户注册")],-1)),s(r,{type:"info",closable:!1,title:"阶段1:仅完成前台工程与布局搭建。注册/邮箱验证等功能将在后续阶段迁移。","show-icon":""}),t("div",f,[s(l,{onClick:c},{default:a(()=>[...e[0]||(e[0]=[m("返回登录",-1)])]),_:1})])]),_:1})])}}},w=_(g,[["__scopeId","data-v-6a731624"]]);export{w as default};
|
||||||
1
static/app/assets/RegisterPage-CPyuLOs6.css
Normal file
1
static/app/assets/RegisterPage-CPyuLOs6.css
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.auth-wrap[data-v-6a731624]{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px}.auth-card[data-v-6a731624]{width:100%;max-width:420px;border-radius:var(--app-radius);border:1px solid var(--app-border);box-shadow:var(--app-shadow)}.brand[data-v-6a731624]{margin-bottom:14px}.brand-title[data-v-6a731624]{font-size:18px;font-weight:900}.brand-sub[data-v-6a731624]{margin-top:4px;font-size:12px}.actions[data-v-6a731624]{margin-top:16px}
|
||||||
1
static/app/assets/ResetPasswordPage-CErwB9tI.css
Normal file
1
static/app/assets/ResetPasswordPage-CErwB9tI.css
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.auth-wrap[data-v-8f60ffad]{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px}.auth-card[data-v-8f60ffad]{width:100%;max-width:420px;border-radius:var(--app-radius);border:1px solid var(--app-border);box-shadow:var(--app-shadow)}.brand[data-v-8f60ffad]{margin-bottom:14px}.brand-title[data-v-8f60ffad]{font-size:18px;font-weight:900}.brand-sub[data-v-8f60ffad]{margin-top:4px;font-size:12px}.actions[data-v-8f60ffad]{margin-top:16px}
|
||||||
1
static/app/assets/ResetPasswordPage-Ditr0QEq.js
Normal file
1
static/app/assets/ResetPasswordPage-Ditr0QEq.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
import{_,c as i,a as t,w as a,r as o,u as p,o as u,b as s,d as f}from"./index-BDLnyqR1.js";const m={class:"auth-wrap"},b={class:"actions"},v={__name:"ResetPasswordPage",setup(w){const n=p();function c(){n.push("/login")}return(g,e)=>{const d=o("el-alert"),r=o("el-button"),l=o("el-card");return u(),i("div",m,[t(l,{shadow:"never",class:"auth-card","body-style":{padding:"22px"}},{default:a(()=>[e[1]||(e[1]=s("div",{class:"brand"},[s("div",{class:"brand-title"},"知识管理平台"),s("div",{class:"brand-sub app-muted"},"重置密码")],-1)),t(d,{type:"info",closable:!1,title:"阶段1:仅完成前台工程与布局搭建。重置密码功能将在后续阶段迁移。","show-icon":""}),s("div",b,[t(r,{onClick:c},{default:a(()=>[...e[0]||(e[0]=[f("返回登录",-1)])]),_:1})])]),_:1})])}}},h=_(v,[["__scopeId","data-v-8f60ffad"]]);export{h as default};
|
||||||
1
static/app/assets/SchedulesPage-B7bCm2b3.js
Normal file
1
static/app/assets/SchedulesPage-B7bCm2b3.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
import{_ as t,e as o,w as c,r,o as d,b as s}from"./index-BDLnyqR1.js";const n={};function l(_,e){const a=r("el-card");return d(),o(a,{shadow:"never","body-style":{padding:"16px"},class:"card"},{default:c(()=>[...e[0]||(e[0]=[s("h2",{class:"title"},"定时任务",-1),s("div",{class:"app-muted"},"阶段1:页面壳子已就绪,功能将在后续阶段迁移。",-1)])]),_:1})}const f=t(n,[["render",l],["__scopeId","data-v-b4b9e229"]]);export{f as default};
|
||||||
1
static/app/assets/SchedulesPage-BAj1X6GW.css
Normal file
1
static/app/assets/SchedulesPage-BAj1X6GW.css
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.card[data-v-b4b9e229]{border-radius:var(--app-radius);border:1px solid var(--app-border)}.title[data-v-b4b9e229]{margin:0 0 6px;font-size:16px;font-weight:800}
|
||||||
1
static/app/assets/ScreenshotsPage-CmPGicmh.css
Normal file
1
static/app/assets/ScreenshotsPage-CmPGicmh.css
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.card[data-v-08f8d2d3]{border-radius:var(--app-radius);border:1px solid var(--app-border)}.title[data-v-08f8d2d3]{margin:0 0 6px;font-size:16px;font-weight:800}
|
||||||
1
static/app/assets/ScreenshotsPage-DPphuiaz.js
Normal file
1
static/app/assets/ScreenshotsPage-DPphuiaz.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
import{_ as t,e as o,w as c,r,o as d,b as s}from"./index-BDLnyqR1.js";const n={};function _(l,e){const a=r("el-card");return d(),o(a,{shadow:"never","body-style":{padding:"16px"},class:"card"},{default:c(()=>[...e[0]||(e[0]=[s("h2",{class:"title"},"截图管理",-1),s("div",{class:"app-muted"},"阶段1:页面壳子已就绪,功能将在后续阶段迁移。",-1)])]),_:1})}const f=t(n,[["render",_],["__scopeId","data-v-08f8d2d3"]]);export{f as default};
|
||||||
25
static/app/assets/index-BDLnyqR1.js
Normal file
25
static/app/assets/index-BDLnyqR1.js
Normal file
File diff suppressed because one or more lines are too long
1
static/app/assets/index-CZCRHVLY.css
Normal file
1
static/app/assets/index-CZCRHVLY.css
Normal file
File diff suppressed because one or more lines are too long
15
static/app/index.html
Normal file
15
static/app/index.html
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
|
||||||
|
<title>知识管理平台</title>
|
||||||
|
<script type="module" crossorigin src="./assets/index-BDLnyqR1.js"></script>
|
||||||
|
<link rel="stylesheet" crossorigin href="./assets/index-CZCRHVLY.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>该页面需要启用 JavaScript 才能使用。</noscript>
|
||||||
|
<div id="app"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
17
templates/app.html
Normal file
17
templates/app.html
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
|
||||||
|
<title>知识管理平台</title>
|
||||||
|
{% for css_file in app_spa_css_files %}
|
||||||
|
<link rel="stylesheet" href="{{ url_for('serve_static', filename=css_file) }}" />
|
||||||
|
{% endfor %}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>该页面需要启用 JavaScript 才能使用。</noscript>
|
||||||
|
<div id="app"></div>
|
||||||
|
<script type="module" src="{{ url_for('serve_static', filename=app_spa_js_file) }}"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
Reference in New Issue
Block a user