feat:初始化工程

This commit is contained in:
2026-07-26 20:40:32 +08:00
commit 875350cc56
34 changed files with 5521 additions and 0 deletions

5
.eslintrc.cjs Normal file
View File

@@ -0,0 +1,5 @@
module.exports = {
extends: [
'./node_modules/vue3-eslint'
]
}

24
.gitignore vendored Normal file
View File

@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

3
.vscode/extensions.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar"]
}

5
README.md Normal file
View File

@@ -0,0 +1,5 @@
# Vue 3 + TypeScript + Vite
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).

13
index.html Normal file
View File

@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>AI智能学习助手</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

27
package.json Normal file
View File

@@ -0,0 +1,27 @@
{
"name": "study-agent-ui",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc -b && vite build",
"preview": "vite preview"
},
"dependencies": {
"element-plus": "^2.14.3",
"pinia": "^4.0.2",
"vue": "^3.5.39",
"vue-router": "^5.2.0",
"vue3-eslint": "git+https://gitee.com/Cxx0822/vue3-eslint"
},
"devDependencies": {
"@types/node": "^24.13.2",
"@vitejs/plugin-vue": "^6.0.7",
"@vue/tsconfig": "^0.9.1",
"sass": "^1.102.0",
"typescript": "~6.0.2",
"vite": "^8.1.1",
"vue-tsc": "^3.3.5"
}
}

4417
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

1
public/favicon.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.3 KiB

24
public/icons.svg Normal file
View File

@@ -0,0 +1,24 @@
<svg xmlns="http://www.w3.org/2000/svg">
<symbol id="bluesky-icon" viewBox="0 0 16 17">
<g clip-path="url(#bluesky-clip)"><path fill="#08060d" d="M7.75 7.735c-.693-1.348-2.58-3.86-4.334-5.097-1.68-1.187-2.32-.981-2.74-.79C.188 2.065.1 2.812.1 3.251s.241 3.602.398 4.13c.52 1.744 2.367 2.333 4.07 2.145-2.495.37-4.71 1.278-1.805 4.512 3.196 3.309 4.38-.71 4.987-2.746.608 2.036 1.307 5.91 4.93 2.746 2.72-2.746.747-4.143-1.747-4.512 1.702.189 3.55-.4 4.07-2.145.156-.528.397-3.691.397-4.13s-.088-1.186-.575-1.406c-.42-.19-1.06-.395-2.741.79-1.755 1.24-3.64 3.752-4.334 5.099"/></g>
<defs><clipPath id="bluesky-clip"><path fill="#fff" d="M.1.85h15.3v15.3H.1z"/></clipPath></defs>
</symbol>
<symbol id="discord-icon" viewBox="0 0 20 19">
<path fill="#08060d" d="M16.224 3.768a14.5 14.5 0 0 0-3.67-1.153c-.158.286-.343.67-.47.976a13.5 13.5 0 0 0-4.067 0c-.128-.306-.317-.69-.476-.976A14.4 14.4 0 0 0 3.868 3.77C1.546 7.28.916 10.703 1.231 14.077a14.7 14.7 0 0 0 4.5 2.306q.545-.748.965-1.587a9.5 9.5 0 0 1-1.518-.74q.191-.14.372-.293c2.927 1.369 6.107 1.369 8.999 0q.183.152.372.294-.723.437-1.52.74.418.838.963 1.588a14.6 14.6 0 0 0 4.504-2.308c.37-3.911-.63-7.302-2.644-10.309m-9.13 8.234c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.894 0 1.614.82 1.599 1.82.001 1-.705 1.82-1.6 1.82m5.91 0c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.893 0 1.614.82 1.599 1.82 0 1-.706 1.82-1.6 1.82"/>
</symbol>
<symbol id="documentation-icon" viewBox="0 0 21 20">
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="m15.5 13.333 1.533 1.322c.645.555.967.833.967 1.178s-.322.623-.967 1.179L15.5 18.333m-3.333-5-1.534 1.322c-.644.555-.966.833-.966 1.178s.322.623.966 1.179l1.534 1.321"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M17.167 10.836v-4.32c0-1.41 0-2.117-.224-2.68-.359-.906-1.118-1.621-2.08-1.96-.599-.21-1.349-.21-2.848-.21-2.623 0-3.935 0-4.983.369-1.684.591-3.013 1.842-3.641 3.428C3 6.449 3 7.684 3 10.154v2.122c0 2.558 0 3.838.706 4.726q.306.383.713.671c.76.536 1.79.64 3.581.66"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M3 10a2.78 2.78 0 0 1 2.778-2.778c.555 0 1.209.097 1.748-.047.48-.129.854-.503.982-.982.145-.54.048-1.194.048-1.749a2.78 2.78 0 0 1 2.777-2.777"/>
</symbol>
<symbol id="github-icon" viewBox="0 0 19 19">
<path fill="#08060d" fill-rule="evenodd" d="M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844" clip-rule="evenodd"/>
</symbol>
<symbol id="social-icon" viewBox="0 0 20 20">
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M12.5 6.667a4.167 4.167 0 1 0-8.334 0 4.167 4.167 0 0 0 8.334 0"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M2.5 16.667a5.833 5.833 0 0 1 8.75-5.053m3.837.474.513 1.035c.07.144.257.282.414.309l.93.155c.596.1.736.536.307.965l-.723.73a.64.64 0 0 0-.152.531l.207.903c.164.715-.213.991-.84.618l-.872-.52a.63.63 0 0 0-.577 0l-.872.52c-.624.373-1.003.094-.84-.618l.207-.903a.64.64 0 0 0-.152-.532l-.723-.729c-.426-.43-.289-.864.306-.964l.93-.156a.64.64 0 0 0 .412-.31l.513-1.034c.28-.562.735-.562 1.012 0"/>
</symbol>
<symbol id="x-icon" viewBox="0 0 19 19">
<path fill="#08060d" fill-rule="evenodd" d="M1.893 1.98c.052.072 1.245 1.769 2.653 3.77l2.892 4.114c.183.261.333.48.333.486s-.068.089-.152.183l-.522.593-.765.867-3.597 4.087c-.375.426-.734.834-.798.905a1 1 0 0 0-.118.148c0 .01.236.017.664.017h.663l.729-.83c.4-.457.796-.906.879-.999a692 692 0 0 0 1.794-2.038c.034-.037.301-.34.594-.675l.551-.624.345-.392a7 7 0 0 1 .34-.374c.006 0 .93 1.306 2.052 2.903l2.084 2.965.045.063h2.275c1.87 0 2.273-.003 2.266-.021-.008-.02-1.098-1.572-3.894-5.547-2.013-2.862-2.28-3.246-2.273-3.266.008-.019.282-.332 2.085-2.38l2-2.274 1.567-1.782c.022-.028-.016-.03-.65-.03h-.674l-.3.342a871 871 0 0 1-1.782 2.025c-.067.075-.405.458-.75.852a100 100 0 0 1-.803.91c-.148.172-.299.344-.99 1.127-.304.343-.32.358-.345.327-.015-.019-.904-1.282-1.976-2.808L6.365 1.85H1.8zm1.782.91 8.078 11.294c.772 1.08 1.413 1.973 1.425 1.984.016.017.241.02 1.05.017l1.03-.004-2.694-3.766L7.796 5.75 5.722 2.852l-1.039-.004-1.039-.004z" clip-rule="evenodd"/>
</symbol>
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

10
src/App.vue Normal file
View File

@@ -0,0 +1,10 @@
<template>
<router-view />
</template>
<script setup lang="ts">
</script>
<style lang="scss">
@use '@/styles/index.module.scss';
</style>

Binary file not shown.

BIN
src/assets/hero.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

1
src/assets/vite.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 8.5 KiB

1
src/assets/vue.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>

After

Width:  |  Height:  |  Size: 496 B

View File

@@ -0,0 +1,135 @@
<template>
<el-dialog v-model="libraryStore.fileDetailDialogVisible"
:title="libraryStore.currentFile.name" center
width="90%" destroy-on-close class="file-dialog">
<el-splitter>
<el-splitter-panel size="50%">
<div class="raw-file">
<div v-if="libraryStore.currentFile.type === 'pdf'" class="preview">
<p>原文预览</p>
</div>
<div v-else class="preview-box">
<p>原文预览</p>
</div>
</div>
</el-splitter-panel>
<el-splitter-panel size="50%">
<div class="section">
<div class="section-title">
<el-icon><EditPen /></el-icon>
生成题目{{ libraryStore.currentFile.questions?.length || 0 }}
</div>
<div v-for="(q, i) in libraryStore.currentFile.questions" :key="i" class="question-card">
<div class="q-header">
<span class="q-num">Q{{ i + 1 }}</span>
<el-tag size="small" type="primary" effect="dark">{{ q.type }}</el-tag>
</div>
<div class="q-body">{{ q.stem }}</div>
<ul v-if="q.options" class="q-options">
<li v-for="opt in q.options" :key="opt">{{ opt }}</li>
</ul>
<div class="q-answer">
<span class="label">答案</span>{{ q.answer }}
</div>
</div>
</div>
</el-splitter-panel>
</el-splitter>
<template #footer>
<el-button @click="libraryStore.fileDetailDialogVisible = false">关闭</el-button>
<el-button type="primary" @click="libraryStore.fileDetailDialogVisible = false">开始练习</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { EditPen } from '@element-plus/icons-vue'
import { useLibraryStore } from '@/stores/library.ts'
const libraryStore = useLibraryStore()
</script>
<style lang="scss">
.file-dialog {
.raw-file {
height: 100%;
padding: 10px;
.preview {
height: 100%;
padding: 10px;
background: #f8fafc;
border: 2px dashed #e2e8f0;
}
}
/* 知识点 + 题目 */
.section {
padding: 10px;
display: flex;
flex-direction: column;
gap: 10px;
.section-title {
align-self: center;
display: flex;
align-items: center;
gap: 6px;
font-size: 14px;
font-weight: 600;
color: #1e293b;
}
.question-card {
background: #f8fafc;
border-radius: 8px;
padding: 10px;
display: flex;
flex-direction: column;
gap: 5px;
.q-header {
display: flex;
align-items: center;
gap: 8px;
.q-num {
font-weight: 700;
color: #14b8a6;
}
}
.q-body {
font-size: 14px;
color: #1e293b;
}
.q-options {
list-style: none;
padding: 0;
margin: 0 0 8px;
li {
padding: 3px 0;
font-size: 13px;
color: #475569;
}
}
.q-answer {
font-size: 13px;
color: #16a34a;
font-weight: 600;
.label {
color: #64748b;
font-weight: 400;
}
}
}
}
}
</style>

View File

@@ -0,0 +1,66 @@
<template>
<el-dialog v-model="libraryStore.fileDialogVisible"
title="新增资料" center destroy-on-close>
<el-form ref="ruleFormRef" :model="libraryStore.currentFile"
:rules="rules" label-width="auto">
<el-form-item label="学科" prop="subject">
<el-select v-model="libraryStore.currentFile.subject"
multiple filterable allow-create
placeholder="请输入或选择学科名称" style="width: 240px">
<el-option v-for="(item, index) in subjectOptions"
:key="index" :label="item" :value="item"/>
</el-select>
</el-form-item>
<el-form-item label="模块" prop="module">
<el-select v-model="libraryStore.currentFile.module"
multiple filterable allow-create
placeholder="请输入或选择模块名称" style="width: 240px">
<el-option v-for="(item, index) in subjectOptions"
:key="index" :label="item" :value="item"/>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="libraryStore.fileDialogVisible = false">取消</el-button>
<el-button type="primary" @click="submitForm(ruleFormRef)">确认</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { useLibraryStore } from '@/stores/library.ts'
import type { FormInstance } from 'element-plus'
const libraryStore = useLibraryStore()
const ruleFormRef = ref<FormInstance>()
const subjectOptions = ['中医学', '公务员']
const rules = {
subject: [
{ required: true, message: '请输入学科名称', trigger: 'blur' }
],
module: [
{ required: true, message: '请输入模块名称', trigger: 'blur' }
]
}
const submitForm = async (formEl: FormInstance | undefined) => {
if (!formEl) return
await formEl.validate((valid, fields) => {
if (valid) {
libraryStore.fileDialogVisible = false
} else {
console.log('请先输入信息')
}
})
}
</script>
<style lang="scss">
</style>

View File

@@ -0,0 +1,37 @@
<template>
<div class="file-list">
<div v-for="file in libraryStore.fileList" :key="file.id" class="file-card card-item">
<div class="file-info" @click="viewDetailClick(file)">
<div class="file-icon" :class="file.iconClass">
<el-icon v-if="file.type === 'image'" ><Picture /></el-icon>
<el-icon v-else><Document /></el-icon>
</div>
<div class="file-text">
<div class="file-name">{{ file.name }}</div>
<div class="file-meta">{{ file.size }} · {{ file.time }}</div>
</div>
</div>
<div class="card-actions">
<el-button type="primary" :icon="Edit">编辑</el-button>
<el-button type="danger" :icon="Delete">删除</el-button>
</div>
</div>
<el-empty v-if="!libraryStore.fileList.length" description="该模块暂无文件" :image-size="80" />
</div>
</template>
<script setup lang="ts">
import { Delete, Edit, Picture, Document } from '@element-plus/icons-vue'
import { useLibraryStore } from '@/stores/library.ts'
import type { ILibraryFile } from '@/types/library.ts'
const libraryStore = useLibraryStore()
const viewDetailClick = (file: ILibraryFile) => {
libraryStore.currentFile = file
libraryStore.fileDetailDialogVisible = true
}
</script>

View File

@@ -0,0 +1,31 @@
<template>
<div class="filter-bar card-item">
<div class="filter-row">
<span class="filter-label">学科</span>
<el-segmented v-model="libraryStore.selectedSubject" :options="subjectOptions"/>
</div>
<div class="filter-row">
<span class="filter-label">模块</span>
<el-segmented v-model="libraryStore.selectedModule" :options="moduleOptions"/>
</div>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { useLibraryStore } from '@/stores/library.ts'
const libraryStore = useLibraryStore()
const subjectOptions = computed(() => {
return libraryStore.subjectTree.map((s) => ({ label: s.name, value: s.id }))
})
const moduleOptions = computed(() => {
const node = libraryStore.subjectTree.find((s) => s.id === libraryStore.selectedSubject)
return (node?.children || []).map((m) => ({
label: m.name,
value: m.id
}))
})
</script>

175
src/layout/index.vue Normal file
View File

@@ -0,0 +1,175 @@
<template>
<el-container class="layout-container">
<!-- 侧边栏 -->
<el-aside :width="isCollapse ? '64px' : '150px'" class="aside">
<!-- Logo -->
<div class="logo">
<span v-if="!isCollapse">🧠 智能学习助手</span>
<span v-else>🧠</span>
</div>
<!-- 菜单 -->
<el-menu
:default-active="route.path"
:collapse="isCollapse"
:collapse-transition="false"
router
class="side-menu"
>
<el-menu-item index="/library">
<el-icon><Reading /></el-icon>
<template #title>知识库</template>
</el-menu-item>
<el-menu-item index="/practice">
<el-icon><Aim /></el-icon>
<template #title>训练场</template>
</el-menu-item>
<el-menu-item index="/exam">
<el-icon><EditPen /></el-icon>
<template #title>考试中心</template>
</el-menu-item>
<el-menu-item index="/mistakes">
<el-icon><Notebook /></el-icon>
<template #title>错题本</template>
</el-menu-item>
<el-menu-item index="/stats">
<el-icon><DataLine /></el-icon>
<template #title>数据统计</template>
</el-menu-item>
</el-menu>
</el-aside>
<el-container>
<!-- 顶部栏 -->
<el-header class="header">
<div class="header-left">
<!-- 折叠按钮 -->
<el-icon class="collapse-btn" @click="isCollapse = !isCollapse">
<Fold v-if="!isCollapse" />
<Expand v-else />
</el-icon>
<!-- 面包屑 -->
<el-breadcrumb separator="/">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>{{ route.meta.title }}</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="header-right">
<!-- 通知铃铛 -->
<el-badge :value="3">
<el-icon :size="18"><Bell /></el-icon>
</el-badge>
<!-- 用户信息 -->
<el-dropdown>
<el-avatar :size="32" class="avatar"></el-avatar>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item>个人中心</el-dropdown-item>
<el-dropdown-item>设置</el-dropdown-item>
<el-dropdown-item divided @click="handleLogout">退出登录</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</el-header>
<!-- 主内容区 -->
<el-main class="main">
<router-view v-slot="{ Component }">
<transition name="fade" mode="out-in">
<component :is="Component" />
</transition>
</router-view>
</el-main>
</el-container>
</el-container>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { ElMessageBox } from 'element-plus'
import { Reading, Aim, EditPen, Notebook, DataLine, Fold, Expand, Bell } from '@element-plus/icons-vue'
const route = useRoute()
const router = useRouter()
const isCollapse = ref(false)
// 退出登录
const handleLogout = () => {
ElMessageBox.confirm('确定要退出登录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
router.push('/login')
}).catch(() => {})
}
</script>
<style lang="scss">
.layout-container {
height: 100vh;
/* 侧边栏 */
.aside {
background: #ffffff;
border-right: 1px solid #e2e8f0;
transition: width 0.3s;
overflow: hidden;
.logo {
height: 56px;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
font-weight: 600;
color: #14b8a6;
border-bottom: 1px solid #e2e8f0;
}
.side-menu {
border-right: none;
}
}
/* 顶部 */
.header {
background: #ffffff;
border-bottom: 1px solid #e2e8f0;
display: flex;
align-items: center;
justify-content: space-between;
height: 56px;
padding: 0 20px;
cursor: pointer;
.header-left {
display: flex;
align-items: center;
gap: 16px;
}
.header-right {
display: flex;
align-items: center;
gap: 16px;
.avatar {
background: #ccfbf1;
color: #14b8a6;
font-weight: 600;
}
}
}
/* 主内容 */
.main {
background: #f0fdfa;
padding: 20px;
}
}
</style>

24
src/main.ts Normal file
View File

@@ -0,0 +1,24 @@
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
// 引入路由
import router from './router'
// 引入element-ui组件
import ElementPlus from 'element-plus'
import 'element-plus/theme-chalk/src/index.scss'
import 'element-plus/theme-chalk/dark/css-vars.css'
import 'dayjs/locale/zh-cn'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
// 创建Vue3实例
const app = createApp(App)
// 使用路由
app.use(router)
// 使用Pinia 需要ts 4.5以上
app.use(createPinia())
// 使用Element UI Plus
app.use(ElementPlus, { locale: zhCn })
// 挂载到根组件上
app.mount('#app')

49
src/router/index.ts Normal file
View File

@@ -0,0 +1,49 @@
import { createRouter, createWebHistory } from 'vue-router'
import Layout from '../layout/index.vue'
const routes = [
{
path: '/',
component: Layout,
redirect: '/library',
children: [
{
path: 'library',
name: 'Library',
component: () => import('@/views/Library.vue'),
meta: { title: '知识库' }
},
{
path: 'practice',
name: 'Practice',
component: () => import('@/views/Practice.vue'),
meta: { title: '训练场' }
},
{
path: 'exam',
name: 'Exam',
component: () => import('@/views/Exam.vue'),
meta: { title: '考试' }
},
{
path: 'mistakes',
name: 'Mistakes',
component: () => import('@/views/Mistakes.vue'),
meta: { title: '错题本' }
},
{
path: 'stats',
name: 'Stats',
component: () => import('@/views/Stats.vue'),
meta: { title: '统计' }
}
]
}
]
const router = createRouter({
history: createWebHistory(),
routes
})
export default router

96
src/stores/library.ts Normal file
View File

@@ -0,0 +1,96 @@
import { defineStore } from 'pinia'
import type { ILibraryFile, ITreeNode } from '@/types/library.ts'
export const useLibraryStore = defineStore('library', {
state: () => ({
selectedSubject: 1,
selectedModule: 101,
subjectTree: [
{
id: 1,
name: '中医学',
children: [
{ id: 101, name: '中医基础理论' },
{ id: 102, name: '中医诊断学' },
{ id: 103, name: '中药学' },
{ id: 104, name: '方剂学' },
{ id: 105, name: '中医内科学' },
{ id: 106, name: '中医外科学' },
{ id: 107, name: '中医妇科学' },
{ id: 108, name: '中医儿科学' },
{ id: 109, name: '针灸学' },
{ id: 110, name: '推拿学' },
{ id: 111, name: '中医骨伤科学' },
{ id: 112, name: '黄帝内经' },
{ id: 113, name: '伤寒论' },
{ id: 114, name: '金匮要略' },
{ id: 115, name: '温病学' },
{ id: 116, name: '中医养生学' }
]
},
{
id: 2,
name: '公务员',
children: [
{ id: 201, name: '言语理解与表达' },
{ id: 202, name: '数量关系' },
{ id: 203, name: '判断推理' },
{ id: 204, name: '资料分析' },
{ id: 205, name: '常识判断' },
{ id: 206, name: '申论写作' },
{ id: 207, name: '公文写作' },
{ id: 208, name: '公共基础知识' },
{ id: 209, name: '面试技巧' },
{ id: 210, name: '时政热点' },
{ id: 211, name: '法律基础' }
]
}
] as ITreeNode[],
fileList: [] as ILibraryFile[],
currentFile: {} as ILibraryFile,
fileDetailDialogVisible: false,
fileDialogVisible: false
}),
actions: {
queryFileList() {
this.fileList = [
{
id: 1,
subject: '中医学',
module: '中医基础理疗',
name: '向量代数.pdf',
size: '2.4 MB',
time: '2分钟前',
type: 'pdf',
iconClass: 'icon-pdf',
questions: [
{ type: '选择题', stem: '设 a=(1,2,3), b=(2,-1,1),求 a·b = ?', options: ['A. 3', 'B. 5', 'C. 7', 'D. 9'], answer: 'A' },
{ type: '计算题', stem: '求过点 P(1,0,2) 且法向量为 n=(2,1,-1) 的平面方程', answer: '2x + y - z = 0' }
]
},
{
id: 2,
subject: '中医学',
module: '中医基础理疗',
name: '向量代数精讲.png',
size: '156 MB',
time: '3小时前',
type: 'image',
iconClass: 'icon-image'
}
]
},
getEmptyFile(): ILibraryFile {
return {
iconClass: '',
id: 0,
module: '',
name: '',
size: '',
subject: '',
time: '',
type: ''
}
}
}
})

View File

@@ -0,0 +1,10 @@
@use 'element-plus/theme-chalk/src/common/var.scss' with (
$colors: (
'primary': (
'base': #009FA8, // 设置你的主题色
),
)
);
// 也可以在此引入其他 Element Plus 样式
//@use 'element-plus/theme-chalk/src/index.scss' as *;

View File

@@ -0,0 +1,90 @@
body {
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
font-family: CustomFont, sans-serif;
}
*,
*:before,
*:after {
box-sizing: border-box;
}
a:focus,
a:active {
outline: none;
}
a,
a:focus,
a:hover {
cursor: pointer;
color: inherit;
text-decoration: none;
}
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#app {
height: 100%;
}
html {
font-size: 16px;
}
span, input {
font-family: 'CustomFont', serif;
}
// 明亮主题变量
:root {
// 基础颜色
--color-bg: #F5F5F5;
--color-card-bg: #FFFFFF;
--color-record-card-bg: #F5F5DC;
--color-border-bg: #FFFFFF;
--color-text: #000000;
}
// 暗黑主题变量
.dark {
--color-bg: #000000;
--color-card-bg: #000000;
--color-record-card-bg: #4C4D4F;
--color-border-bg: #4C4D4F;
--color-text: #FFFFFF;
}
::view-transition-old(root),
::view-transition-new(root) {
animation: none;
}
.dark::view-transition-old(root) {
z-index: 9999;
}
.card-item {
padding: 14px 18px;
background-color: #FFFFFF;
border: 1px solid #FFFFFF;
border-radius: 10px;
}
@media (max-width: 1280px) {
html {
font-size: 13px;
}
}
@font-face {
font-family: 'CustomFont';
src: url('@/assets/font/custom.woff2') format('truetype');
font-weight: normal;
font-style: normal;
}

24
src/types/library.ts Normal file
View File

@@ -0,0 +1,24 @@
export interface ITreeNode {
id: number;
name: string;
children?: ITreeNode[];
}
export interface ILibraryFileQuestion {
type: string;
stem: string;
options?: string[];
answer: string;
}
export interface ILibraryFile {
id: number;
subject: string;
module: string;
name: string;
size: string;
time: string;
type: string;
iconClass: string;
questions?: ILibraryFileQuestion[];
}

11
src/views/Exam.vue Normal file
View File

@@ -0,0 +1,11 @@
<template>
<div>
<h2>考试中心</h2>
<p style="color:#94a3b8;margin-top:8px;">按学科进行综合检验模拟真实考试环境</p>
<el-divider />
<el-empty description="考试页面 - 待开发" />
</div>
</template>
<script setup lang="ts">
</script>

126
src/views/Library.vue Normal file
View File

@@ -0,0 +1,126 @@
<template>
<div class="library-view">
<!-- 标题行 -->
<div class="page-header">
<div>
<h2 class="page-title">知识库</h2>
<p class="page-subtitle">管理学习资料查看 AI 解析结果</p>
</div>
<el-button type="primary" :icon="Plus" @click="addFileClick">新增资料</el-button>
</div>
<library-filter />
<library-file-list />
<library-file-dialog />
<library-file-detail-dialog />
</div>
</template>
<script setup lang="ts">
import LibraryFilter from '@/components/Library/LibraryFilter.vue'
import LibraryFileList from '@/components/Library/LibraryFileList.vue'
import LibraryFileDialog from '@/components/Library/LibraryFileDialog.vue'
import LibraryFileDetailDialog from '@/components/Library/LibraryFileDetailDialog.vue'
import { useLibraryStore } from '@/stores/library.ts'
import { Plus } from '@element-plus/icons-vue'
import { onMounted } from 'vue'
const libraryStore = useLibraryStore()
onMounted(() => {
libraryStore.queryFileList()
})
const addFileClick = () => {
libraryStore.currentFile = libraryStore.getEmptyFile()
libraryStore.fileDialogVisible = true
}
</script>
<style lang="scss">
.library-view {
display: flex;
flex-direction: column;
gap: 10px;
/* 标题行 */
.page-header {
display: flex;
justify-content: space-between;
align-items: center;
.page-title {
font-size: 22px;
font-weight: 700;
color: #0f172a;
}
.page-subtitle {
font-size: 13px;
color: #94a3b8;
}
}
/* 筛选栏 */
.filter-bar {
display: flex;
flex-direction: column;
gap: 12px;
.filter-row {
display: flex;
align-items: center;
gap: 10px;
}
}
/* 文件列表 */
.file-list {
display: flex;
flex-direction: column;
gap: 10px;
.file-card {
display: flex;
justify-content: space-between;
align-items: center;
.file-info {
display: flex;
align-items: center;
gap: 12px;
cursor: pointer;
.file-icon {
width: 42px;
height: 42px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
font-size: 20px;
flex-shrink: 0;
}
.icon-pdf { background: #fee2e2; }
.icon-image { background: #dbeafe; }
.file-name {
font-size: 14px;
font-weight: 600;
color: #1e293b;
}
.file-meta {
font-size: 12px;
color: #94a3b8;
margin-top: 2px;
}
}
}
}
}
</style>

11
src/views/Mistakes.vue Normal file
View File

@@ -0,0 +1,11 @@
<template>
<div>
<h2>错题本</h2>
<p style="color:#94a3b8;margin-top:8px;">回顾错题查漏补缺</p>
<el-divider />
<el-empty description="错题本页面 - 待开发" />
</div>
</template>
<script setup lang="ts">
</script>

11
src/views/Practice.vue Normal file
View File

@@ -0,0 +1,11 @@
<template>
<div>
<h2>训练场</h2>
<p style="color:#94a3b8;margin-top:8px;">专项练习巩固知识点</p>
<el-divider />
<el-empty description="训练场页面 - 待开发" />
</div>
</template>
<script setup lang="ts">
</script>

11
src/views/Stats.vue Normal file
View File

@@ -0,0 +1,11 @@
<template>
<div>
<h2>学习统计</h2>
<p style="color:#94a3b8;margin-top:8px;">追踪你的学习进度和效果</p>
<el-divider />
<el-empty description="统计页面 - 待开发" />
</div>
</template>
<script setup lang="ts">
</script>

23
tsconfig.app.json Normal file
View File

@@ -0,0 +1,23 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"types": ["vite/client"],
"allowArbitraryExtensions": true,
/* Linting */
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
// 设置 @ 路径
"baseUrl": ".",
"paths": {
"@/*": [
"src/*"
]
}
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
}

7
tsconfig.json Normal file
View File

@@ -0,0 +1,7 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
}

23
tsconfig.node.json Normal file
View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "es2023",
"lib": ["ES2023"],
"types": ["node"],
"skipLibCheck": true,
/* Bundler mode */
"module": "nodenext",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true
},
"include": ["vite.config.ts"]
}

30
vite.config.ts Normal file
View File

@@ -0,0 +1,30 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue()
],
css: {
preprocessorOptions: {
scss: {
additionalData: '@use "@/styles/element/index.module.scss" as *;'
}
}
},
resolve: {
// 配置路径别名
alias: {
'@': path.resolve(__dirname, './src')
}
},
server: {
port: 5174,
// 服务器代理 服务器没有部署Nginx的情况下使用
proxy: {
}
}
})