Compare commits

..

39 Commits

Author SHA1 Message Date
900457574f update
Some checks are pending
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Waiting to run
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Waiting to run
2026-05-07 08:40:48 -06:00
3c24f2cd9e fix
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-07 08:20:49 -06:00
8aca538fbf fix
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-07 08:02:38 -06:00
4d78bf990f update
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-07 07:52:55 -06:00
fa1d166a48 add username for ai analysis
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-07 07:34:18 -06:00
f38af4f1fe revert color
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-07 07:04:18 -06:00
92cd3cd15e update
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-07 06:54:51 -06:00
5aa852acbc fix
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-07 06:44:56 -06:00
6a31a47c5d fix flowchart
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-07 06:09:05 -06:00
c11c3cf226 fix mermaid
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-07 03:42:38 -06:00
c5a367622c revert
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-07 02:39:29 -06:00
4ecd7bb229 fix3
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-07 02:27:09 -06:00
73884a075b fix again
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-07 02:16:02 -06:00
ecb91f5ca8 fix
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-07 01:56:10 -06:00
7d8eff4ee8 fix
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-07 01:46:43 -06:00
67a44d7637 fix
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-07 00:48:16 -06:00
b05423bd89 test
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-07 00:34:52 -06:00
99603ce87e update
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-07 00:21:21 -06:00
4c9d379d0c test
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-07 00:12:31 -06:00
da75f50798 styling mermaid
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-06 21:36:20 -06:00
ed3e9322b2 update
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-06 20:39:08 -06:00
97917164ea update
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-05 09:54:52 -06:00
59f3747496 fix
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-05 07:27:06 -06:00
86cc5cc500 fix 2026-05-05 07:26:47 -06:00
e8b9a190ec fix update
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-05 07:23:40 -06:00
507d77a576 fix in mobile
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-05 05:53:59 -06:00
22b9405ed2 fix
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-04 11:06:25 -06:00
711c446f74 update
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-04 11:00:07 -06:00
e6e4d71b1c fix UI
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-03 10:22:03 -06:00
6ae879ba80 update
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-05-02 09:11:00 -06:00
9137a12dc9 fix
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-04-27 04:07:09 -06:00
f4b9f34ec8 fix
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-04-27 03:56:16 -06:00
0ca1a142a4 fix: use mcqAnswer.value in template delete handler
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-04-24 02:06:38 -06:00
5c9972315c feat: update exercise manager to support multi-answer checkboxes
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 02:04:07 -06:00
9afb57a9ed feat: rewrite ExerciseMcq for multi-select with partial feedback 2026-04-24 02:01:35 -06:00
21a3ff322b feat: update ExerciseMcqData.answer type to number[] 2026-04-24 02:00:38 -06:00
942ff0a739 update
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
Co-authored-by: Copilot <copilot@github.com>
2026-04-23 18:24:15 -06:00
30f71c5db2 add fills
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
2026-04-23 13:48:36 -06:00
f00dab9c6d fix: address code review issues in interactive exercises
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled
- ExerciseSort: replace unbounded shuffle recursion with deterministic swap
- ExerciseManager: add sortQuestion field so sort exercises have custom questions
- index.vue: use Promise.allSettled so exercise fetch failure doesn't break lesson content
- ExerciseManager: guard mcqAnswer index after option deletion

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 06:35:45 -06:00
55 changed files with 1446 additions and 771 deletions

1
.browserslistrc Normal file
View File

@@ -0,0 +1 @@
chrome >= 90

View File

@@ -29,7 +29,7 @@ jobs:
with:
node-version: 24
cache: npm
- run: npm ci
- run: npm install
- run: npm run ${{ matrix.build_command }}
env:
CI: false

127
README.md
View File

@@ -1,126 +1 @@
# OJ Next
基于 Vue 3 + TypeScript 的在线判题系统前端项目。
## 项目特性
- 🎯 **现代化技术栈** - Vue 3 + TypeScript + Vite
- 📊 **数据可视化** - 丰富的图表和统计功能
- 🎨 **流程图编辑器** - 内置 FlowchartEditor 组件
- 📱 **响应式设计** - 支持多端适配
-**高性能** - 优化的组件和状态管理
## 核心组件
### FlowchartEditor 流程图编辑器
一个功能完整的流程图编辑器组件,支持:
- 🎯 **拖拽创建节点** - 从工具栏拖拽节点到画布
- 🔗 **节点连接** - 支持节点间的连线操作
- ✏️ **节点编辑** - 双击节点进行文本编辑
- 📋 **节点操作** - 复制、删除、批量操作
- ↩️ **撤销重做** - 完整的历史记录管理
- ⌨️ **键盘快捷键** - Ctrl+Z/Ctrl+Y 撤销重做Delete 删除
- 💾 **自动保存** - 本地缓存,防止数据丢失
- 🎨 **多种节点类型** - 开始、输入、处理、判断、循环、输出、结束
- 🖱️ **交互优化** - 流畅的拖拽体验和视觉反馈
**核心特性**
- 基于 Vue Flow 构建,性能优异
- 模块化设计,易于扩展
- 响应式布局,支持多端适配
- 完整的 TypeScript 支持
详细文档:[FlowchartEditor 文档](./docs/FlowchartEditor.md)
## 技术栈
- **Vue 3** - 渐进式 JavaScript 框架
- **TypeScript** - JavaScript 的超集
- **Rsbuild** - 基于 Rspack 的构建工具
- **Vue Flow** - 流程图组件库
- **Composition API** - Vue 3 组合式 API
- **Naive UI** - Vue 3 组件库
- **Chart.js** - 图表可视化库
- **CodeMirror** - 代码编辑器
- **Yjs** - 实时协作框架
## 项目结构
```
src/
├── shared/ # 共享组件和工具
│ ├── components/
│ │ └── FlowchartEditor/ # 流程图编辑器
│ │ ├── index.vue # 主组件
│ │ ├── CustomNode.vue # 自定义节点
│ │ ├── Toolbar.vue # 工具栏
│ │ ├── NodeHandles.vue # 节点操作
│ │ ├── NodeActions.vue # 节点动作
│ │ ├── useCache.ts # 缓存管理
│ │ ├── useDnD.ts # 拖拽处理
│ │ ├── useFlowOperations.ts # 流程操作
│ │ ├── useHistory.ts # 历史记录
│ │ └── useNodeStyles.ts # 节点样式
│ ├── composables/ # 组合式函数
│ ├── layout/ # 布局组件
│ ├── store/ # 状态管理
│ └── themes/ # 主题配置
├── oj/ # 主要业务组件
│ ├── ai/ # AI分析模块
│ ├── problem/ # 题目相关
│ ├── contest/ # 竞赛相关
│ ├── submission/ # 提交相关
│ └── store/ # 业务状态管理
├── admin/ # 管理后台组件
└── utils/ # 工具函数
```
## 开发指南
### 安装依赖
```bash
npm install
```
### 启动开发服务器
```bash
npm start
# 或
npm run start
```
### 构建生产版本
```bash
npm run build
```
### 构建测试环境版本
```bash
npm run build:test
```
### 构建预发布版本
```bash
npm run build:staging
```
## 文档
- [FlowchartEditor 流程图编辑器](./docs/FlowchartEditor.md)
- [图表组件说明](./docs/图表.md)
- [API 接口对比分析](./docs/API接口对比分析.md)
## 贡献
欢迎提交 Issue 和 Pull Request
## 许可证
MIT License
oj.xuyue.cc

465
package-lock.json generated
View File

@@ -8,7 +8,7 @@
"name": "oj-next",
"version": "1.8.0",
"dependencies": {
"@codemirror/autocomplete": "^6.20.1",
"@codemirror/autocomplete": "^6.20.2",
"@codemirror/lang-cpp": "^6.0.3",
"@codemirror/lang-python": "^6.2.1",
"@vue-flow/background": "^1.3.2",
@@ -17,11 +17,11 @@
"@vue-flow/minimap": "^1.5.4",
"@vue-flow/node-resizer": "^1.5.1",
"@vue-flow/node-toolbar": "^1.1.1",
"@vueuse/core": "^14.2.1",
"@vueuse/router": "^14.2.1",
"@vueuse/core": "^14.3.0",
"@vueuse/router": "^14.3.0",
"@wangeditor-next/editor": "^5.7.0",
"@wangeditor-next/editor-for-vue": "^5.1.14",
"axios": "^1.15.0",
"axios": "^1.16.0",
"canvas-confetti": "^1.9.4",
"chart.js": "^4.5.1",
"codemirror": "^6.0.2",
@@ -29,29 +29,30 @@
"date-fns": "^4.1.0",
"fflate": "^0.8.2",
"highlight.js": "^11.11.1",
"md-editor-v3": "^6.4.2",
"md-editor-v3": "^6.5.0",
"mermaid": "^11.14.0",
"naive-ui": "^2.44.1",
"nanoid": "^5.1.7",
"nanoid": "^5.1.11",
"normalize.css": "^8.0.1",
"pinia": "^3.0.4",
"skulpt": "^1.2.0",
"vue": "^3.5.32",
"vue": "^3.5.34",
"vue-chartjs": "^5.3.3",
"vue-codemirror": "^6.1.1",
"vue-router": "^5.0.4",
"vue-router": "^5.0.6",
"y-codemirror.next": "^0.3.5",
"y-webrtc": "^10.3.0",
"yjs": "^13.6.30"
},
"devDependencies": {
"@iconify/vue": "^5.0.0",
"@iconify/vue": "^5.0.1",
"@rsbuild/core": "^1.7.5",
"@rsbuild/plugin-vue": "^1.2.7",
"@types/canvas-confetti": "^1.9.0",
"@types/node": "^25.6.0",
"prettier": "^3.8.2",
"typescript": "^6.0.2",
"@vue/tsconfig": "^0.9.1",
"prettier": "^3.8.3",
"typescript": "^6.0.3",
"unplugin-auto-import": "^21.0.0",
"unplugin-vue-components": "^32.0.0"
}
@@ -113,9 +114,9 @@
}
},
"node_modules/@babel/parser": {
"version": "7.29.2",
"resolved": "https://registry.npmmirror.com/@babel/parser/-/parser-7.29.2.tgz",
"integrity": "sha512-4GgRzy/+fsBa72/RZVJmGKPmZu9Byn8o4MoLpmNe1m8ZfYnz5emHLQz3U4gLud6Zwl0RZIcgiLD7Uq7ySFuDLA==",
"version": "7.29.3",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.3.tgz",
"integrity": "sha512-b3ctpQwp+PROvU/cttc4OYl4MzfJUWy6FZg+PMXfzmt/+39iHVF0sDfqay8TQM3JA2EUOyKcFZt75jWriQijsA==",
"license": "MIT",
"dependencies": {
"@babel/types": "^7.29.0"
@@ -193,9 +194,9 @@
"license": "Apache-2.0"
},
"node_modules/@codemirror/autocomplete": {
"version": "6.20.1",
"resolved": "https://registry.npmmirror.com/@codemirror/autocomplete/-/autocomplete-6.20.1.tgz",
"integrity": "sha512-1cvg3Vz1dSSToCNlJfRA2WSI4ht3K+WplO0UMOgmUYPivCyy2oueZY6Lx7M9wThm7SDUBViRmuT+OG/i8+ON9A==",
"version": "6.20.2",
"resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.20.2.tgz",
"integrity": "sha512-G5FPkgIiLjOgZMjqVjvuKQ1rGPtHogLldJr33eFJdVLtmwY+giGrlv/ewljLz6b9BSQLkjxuwBc6g6omDM+YxQ==",
"license": "MIT",
"dependencies": {
"@codemirror/language": "^6.0.0",
@@ -596,29 +597,6 @@
"vue": "^3.0.11"
}
},
"node_modules/@emnapi/core": {
"version": "1.9.2",
"resolved": "https://registry.npmmirror.com/@emnapi/core/-/core-1.9.2.tgz",
"integrity": "sha512-UC+ZhH3XtczQYfOlu3lNEkdW/p4dsJ1r/bP7H8+rhao3TTTMO1ATq/4DdIi23XuGoFY+Cz0JmCbdVl0hz9jZcA==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@emnapi/wasi-threads": "1.2.1",
"tslib": "^2.4.0"
}
},
"node_modules/@emnapi/runtime": {
"version": "1.9.2",
"resolved": "https://registry.npmmirror.com/@emnapi/runtime/-/runtime-1.9.2.tgz",
"integrity": "sha512-3U4+MIWHImeyu1wnmVygh5WlgfYDtyf0k8AbLhMFxOipihf6nrWC4syIm/SwEeec0mNSafiiNnMJwbza/Is6Lw==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@emnapi/wasi-threads": {
"version": "1.2.1",
"resolved": "https://registry.npmmirror.com/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
@@ -659,9 +637,9 @@
}
},
"node_modules/@iconify/vue": {
"version": "5.0.0",
"resolved": "https://registry.npmmirror.com/@iconify/vue/-/vue-5.0.0.tgz",
"integrity": "sha512-C+KuEWIF5nSBrobFJhT//JS87OZ++QDORB6f2q2Wm6fl2mueSTpFBeBsveK0KW9hWiZ4mNiPjsh6Zs4jjdROSg==",
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/@iconify/vue/-/vue-5.0.1.tgz",
"integrity": "sha512-aumwwooJlFJ5H5qYWB6ZTAyM0C8hpfcSVLB9/a3qnH1GGvIJ+FEbpEs4s/HfErYe/M5qZeLjwmESR5fFm3lXEw==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -671,7 +649,7 @@
"url": "https://github.com/sponsors/cyberalien"
},
"peerDependencies": {
"vue": ">=3"
"vue": ">=3.0.0"
}
},
"node_modules/@jridgewell/gen-mapping": {
@@ -982,26 +960,12 @@
"@module-federation/sdk": "0.22.0"
}
},
"node_modules/@napi-rs/wasm-runtime": {
"version": "1.0.7",
"resolved": "https://registry.npmmirror.com/@napi-rs/wasm-runtime/-/wasm-runtime-1.0.7.tgz",
"integrity": "sha512-SeDnOO0Tk7Okiq6DbXmmBODgOAb9dp9gjlphokTUxmt8U3liIP1ZsozBahH69j/RJv+Rfs6IwUKHTgQYJ/HBAw==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@emnapi/core": "^1.5.0",
"@emnapi/runtime": "^1.5.0",
"@tybys/wasm-util": "^0.10.1"
}
},
"node_modules/@rsbuild/core": {
"version": "1.7.5",
"resolved": "https://registry.npmmirror.com/@rsbuild/core/-/core-1.7.5.tgz",
"resolved": "https://registry.npmjs.org/@rsbuild/core/-/core-1.7.5.tgz",
"integrity": "sha512-i37urpoV4y9NSsGiUOuLdoI42KJ5h4gAZ8EG8Ilmsond3bxoAoOCu7YvC+1pJ7p+r16suVPW8cki891ZKHOoXQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@rspack/core": "~1.7.10",
"@rspack/lite-tapable": "~1.1.0",
@@ -1016,27 +980,22 @@
"node": ">=18.12.0"
}
},
"node_modules/@rsbuild/plugin-vue": {
"version": "1.2.7",
"resolved": "https://registry.npmmirror.com/@rsbuild/plugin-vue/-/plugin-vue-1.2.7.tgz",
"integrity": "sha512-epDSChyeR4U+gwq2vfTARV9hbfrmdFTdmhBWIcv7MFyckn3yxJhweJVwdx14Wf3d8s1p4XZzDpqmphDyvX443Q==",
"node_modules/@rsbuild/core/node_modules/@napi-rs/wasm-runtime": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.0.7.tgz",
"integrity": "sha512-SeDnOO0Tk7Okiq6DbXmmBODgOAb9dp9gjlphokTUxmt8U3liIP1ZsozBahH69j/RJv+Rfs6IwUKHTgQYJ/HBAw==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"rspack-vue-loader": "^17.5.0"
},
"peerDependencies": {
"@rsbuild/core": "^1.0.0 || ^2.0.0-0"
},
"peerDependenciesMeta": {
"@rsbuild/core": {
"optional": true
}
"@emnapi/core": "^1.5.0",
"@emnapi/runtime": "^1.5.0",
"@tybys/wasm-util": "^0.10.1"
}
},
"node_modules/@rspack/binding": {
"node_modules/@rsbuild/core/node_modules/@rspack/binding": {
"version": "1.7.11",
"resolved": "https://registry.npmmirror.com/@rspack/binding/-/binding-1.7.11.tgz",
"resolved": "https://registry.npmjs.org/@rspack/binding/-/binding-1.7.11.tgz",
"integrity": "sha512-2MGdy2s2HimsDT444Bp5XnALzNRxuBNc7y0JzyuqKbHBywd4x2NeXyhWXXoxufaCFu5PBc9Qq9jyfjW2Aeh06Q==",
"dev": true,
"license": "MIT",
@@ -1053,9 +1012,9 @@
"@rspack/binding-win32-x64-msvc": "1.7.11"
}
},
"node_modules/@rspack/binding-darwin-arm64": {
"node_modules/@rsbuild/core/node_modules/@rspack/binding-darwin-arm64": {
"version": "1.7.11",
"resolved": "https://registry.npmmirror.com/@rspack/binding-darwin-arm64/-/binding-darwin-arm64-1.7.11.tgz",
"resolved": "https://registry.npmjs.org/@rspack/binding-darwin-arm64/-/binding-darwin-arm64-1.7.11.tgz",
"integrity": "sha512-oduECiZVqbO5zlVw+q7Vy65sJFth99fWPTyucwvLJJtJkPL5n17Uiql2cYP6Ijn0pkqtf1SXgK8WjiKLG5bIig==",
"cpu": [
"arm64"
@@ -1067,9 +1026,9 @@
"darwin"
]
},
"node_modules/@rspack/binding-darwin-x64": {
"node_modules/@rsbuild/core/node_modules/@rspack/binding-darwin-x64": {
"version": "1.7.11",
"resolved": "https://registry.npmmirror.com/@rspack/binding-darwin-x64/-/binding-darwin-x64-1.7.11.tgz",
"resolved": "https://registry.npmjs.org/@rspack/binding-darwin-x64/-/binding-darwin-x64-1.7.11.tgz",
"integrity": "sha512-a1+TtTE9ap6RalgFi7FGIgkJP6O4Vy6ctv+9WGJy53E4kuqHR0RygzaiVxCI/GMc/vBT9vY23hyrpWb3d1vtXA==",
"cpu": [
"x64"
@@ -1081,9 +1040,9 @@
"darwin"
]
},
"node_modules/@rspack/binding-linux-arm64-gnu": {
"node_modules/@rsbuild/core/node_modules/@rspack/binding-linux-arm64-gnu": {
"version": "1.7.11",
"resolved": "https://registry.npmmirror.com/@rspack/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.7.11.tgz",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.7.11.tgz",
"integrity": "sha512-P0QrGRPbTWu6RKWfN0bDtbnEps3rXH0MWIMreZABoUrVmNQKtXR6e73J3ub6a+di5s2+K0M2LJ9Bh2/H4UsDUA==",
"cpu": [
"arm64"
@@ -1095,9 +1054,9 @@
"linux"
]
},
"node_modules/@rspack/binding-linux-arm64-musl": {
"node_modules/@rsbuild/core/node_modules/@rspack/binding-linux-arm64-musl": {
"version": "1.7.11",
"resolved": "https://registry.npmmirror.com/@rspack/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.7.11.tgz",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.7.11.tgz",
"integrity": "sha512-6ky7R43VMjWwmx3Yx7Jl7faLBBMAgMDt+/bN35RgwjiPgsIByz65EwytUVuW9rikB43BGHvA/eqlnjLrUzNBqw==",
"cpu": [
"arm64"
@@ -1109,9 +1068,9 @@
"linux"
]
},
"node_modules/@rspack/binding-linux-x64-gnu": {
"node_modules/@rsbuild/core/node_modules/@rspack/binding-linux-x64-gnu": {
"version": "1.7.11",
"resolved": "https://registry.npmmirror.com/@rspack/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.7.11.tgz",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.7.11.tgz",
"integrity": "sha512-cuOJMfCOvb2Wgsry5enXJ3iT1FGUjdPqtGUBVupQlEG4ntSYsQ2PtF4wIDVasR3wdxC5nQbipOrDiN/u6fYsdQ==",
"cpu": [
"x64"
@@ -1123,9 +1082,9 @@
"linux"
]
},
"node_modules/@rspack/binding-linux-x64-musl": {
"node_modules/@rsbuild/core/node_modules/@rspack/binding-linux-x64-musl": {
"version": "1.7.11",
"resolved": "https://registry.npmmirror.com/@rspack/binding-linux-x64-musl/-/binding-linux-x64-musl-1.7.11.tgz",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-musl/-/binding-linux-x64-musl-1.7.11.tgz",
"integrity": "sha512-CoK37hva4AmHGh3VCsQXmGr40L36m1/AdnN5LEjUX6kx5rEH7/1nEBN6Ii72pejqDVvk9anEROmPDiPw10tpFg==",
"cpu": [
"x64"
@@ -1137,9 +1096,9 @@
"linux"
]
},
"node_modules/@rspack/binding-wasm32-wasi": {
"node_modules/@rsbuild/core/node_modules/@rspack/binding-wasm32-wasi": {
"version": "1.7.11",
"resolved": "https://registry.npmmirror.com/@rspack/binding-wasm32-wasi/-/binding-wasm32-wasi-1.7.11.tgz",
"resolved": "https://registry.npmjs.org/@rspack/binding-wasm32-wasi/-/binding-wasm32-wasi-1.7.11.tgz",
"integrity": "sha512-OtrmnPUVJMxjNa3eDMfHyPdtlLRmmp/aIm0fQHlAOATbZvlGm12q7rhPW5BXTu1yh+1rQ1/uqvz+SzKEZXuJaQ==",
"cpu": [
"wasm32"
@@ -1151,9 +1110,9 @@
"@napi-rs/wasm-runtime": "1.0.7"
}
},
"node_modules/@rspack/binding-win32-arm64-msvc": {
"node_modules/@rsbuild/core/node_modules/@rspack/binding-win32-arm64-msvc": {
"version": "1.7.11",
"resolved": "https://registry.npmmirror.com/@rspack/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.7.11.tgz",
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.7.11.tgz",
"integrity": "sha512-lObFW6e5lCWNgTBNwT//yiEDbsxm9QG4BYUojqeXxothuzJ/L6ibXz6+gLMvbOvLGV3nKgkXmx8GvT9WDKR0mA==",
"cpu": [
"arm64"
@@ -1165,9 +1124,9 @@
"win32"
]
},
"node_modules/@rspack/binding-win32-ia32-msvc": {
"node_modules/@rsbuild/core/node_modules/@rspack/binding-win32-ia32-msvc": {
"version": "1.7.11",
"resolved": "https://registry.npmmirror.com/@rspack/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.7.11.tgz",
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.7.11.tgz",
"integrity": "sha512-0pYGnZd8PPqNR68zQ8skamqNAXEA1sUfXuAdYcknIIRq2wsbiwFzIc0Pov1cIfHYab37G7sSIPBiOUdOWF5Ivw==",
"cpu": [
"ia32"
@@ -1179,9 +1138,9 @@
"win32"
]
},
"node_modules/@rspack/binding-win32-x64-msvc": {
"node_modules/@rsbuild/core/node_modules/@rspack/binding-win32-x64-msvc": {
"version": "1.7.11",
"resolved": "https://registry.npmmirror.com/@rspack/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.7.11.tgz",
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.7.11.tgz",
"integrity": "sha512-EeQXayoQk/uBkI3pdoXfQBXNIUrADq56L3s/DFyM2pJeUDrWmhfIw2UFIGkYPTMSCo8F2JcdcGM32FGJrSnU0Q==",
"cpu": [
"x64"
@@ -1193,9 +1152,9 @@
"win32"
]
},
"node_modules/@rspack/core": {
"node_modules/@rsbuild/core/node_modules/@rspack/core": {
"version": "1.7.11",
"resolved": "https://registry.npmmirror.com/@rspack/core/-/core-1.7.11.tgz",
"resolved": "https://registry.npmjs.org/@rspack/core/-/core-1.7.11.tgz",
"integrity": "sha512-rsD9b+Khmot5DwCMiB3cqTQo53ioPG3M/A7BySu8+0+RS7GCxKm+Z+mtsjtG/vsu4Tn2tcqCdZtA3pgLoJB+ew==",
"dev": true,
"license": "MIT",
@@ -1216,6 +1175,24 @@
}
}
},
"node_modules/@rsbuild/plugin-vue": {
"version": "1.2.7",
"resolved": "https://registry.npmmirror.com/@rsbuild/plugin-vue/-/plugin-vue-1.2.7.tgz",
"integrity": "sha512-epDSChyeR4U+gwq2vfTARV9hbfrmdFTdmhBWIcv7MFyckn3yxJhweJVwdx14Wf3d8s1p4XZzDpqmphDyvX443Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"rspack-vue-loader": "^17.5.0"
},
"peerDependencies": {
"@rsbuild/core": "^1.0.0 || ^2.0.0-0"
},
"peerDependenciesMeta": {
"@rsbuild/core": {
"optional": true
}
}
},
"node_modules/@rspack/lite-tapable": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@rspack/lite-tapable/-/lite-tapable-1.1.0.tgz",
@@ -1225,10 +1202,11 @@
},
"node_modules/@swc/helpers": {
"version": "0.5.21",
"resolved": "https://registry.npmmirror.com/@swc/helpers/-/helpers-0.5.21.tgz",
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.21.tgz",
"integrity": "sha512-jI/VAmtdjB/RnI8GTnokyX7Ug8c+g+ffD6QRLa6XQewtnGyukKkKSk3wLTM3b5cjt1jNh9x0jfVlagdN2gDKQg==",
"dev": true,
"license": "Apache-2.0",
"peer": true,
"dependencies": {
"tslib": "^2.8.0"
}
@@ -1240,9 +1218,9 @@
"license": "MIT"
},
"node_modules/@tybys/wasm-util": {
"version": "0.10.1",
"resolved": "https://registry.npmmirror.com/@tybys/wasm-util/-/wasm-util-0.10.1.tgz",
"integrity": "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==",
"version": "0.10.2",
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.2.tgz",
"integrity": "sha512-RoBvJ2X0wuKlWFIjrwffGw1IqZHKQqzIchKaadZZfnNpsAYp2mM0h36JtPCjNDAHGgYez/15uMBpfGwchhiMgg==",
"dev": true,
"license": "MIT",
"optional": true,
@@ -1901,13 +1879,13 @@
}
},
"node_modules/@vue/compiler-core": {
"version": "3.5.32",
"resolved": "https://registry.npmmirror.com/@vue/compiler-core/-/compiler-core-3.5.32.tgz",
"integrity": "sha512-4x74Tbtqnda8s/NSD6e1Dr5p1c8HdMU5RWSjMSUzb8RTcUQqevDCxVAitcLBKT+ie3o0Dl9crc/S/opJM7qBGQ==",
"version": "3.5.34",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.34.tgz",
"integrity": "sha512-s9cLyK5mLcvZ4Agva5QgRsQyLKvts9WbU9DB6NqiZkkGEdwmcEiylj5Jbwkp680drF/NNCV8OlAJSe+yMLxaJw==",
"license": "MIT",
"dependencies": {
"@babel/parser": "^7.29.2",
"@vue/shared": "3.5.32",
"@babel/parser": "^7.29.3",
"@vue/shared": "3.5.34",
"entities": "^7.0.1",
"estree-walker": "^2.0.2",
"source-map-js": "^1.2.1"
@@ -1915,7 +1893,7 @@
},
"node_modules/@vue/compiler-core/node_modules/entities": {
"version": "7.0.1",
"resolved": "https://registry.npmmirror.com/entities/-/entities-7.0.1.tgz",
"resolved": "https://registry.npmjs.org/entities/-/entities-7.0.1.tgz",
"integrity": "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==",
"license": "BSD-2-Clause",
"engines": {
@@ -1927,34 +1905,34 @@
},
"node_modules/@vue/compiler-core/node_modules/estree-walker": {
"version": "2.0.2",
"resolved": "https://registry.npmmirror.com/estree-walker/-/estree-walker-2.0.2.tgz",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
"license": "MIT"
},
"node_modules/@vue/compiler-dom": {
"version": "3.5.32",
"resolved": "https://registry.npmmirror.com/@vue/compiler-dom/-/compiler-dom-3.5.32.tgz",
"integrity": "sha512-ybHAu70NtiEI1fvAUz3oXZqkUYEe5J98GjMDpTGl5iHb0T15wQYLR4wE3h9xfuTNA+Cm2f4czfe8B4s+CCH57Q==",
"version": "3.5.34",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.34.tgz",
"integrity": "sha512-EbF/T++k0e2MMZlJsBhzK8Sgwt0HcIPOhzn1CTB/lv6sQcyk+OWf8YeiLxZp3ro7MbbLcAfAJ6sEvjFWuNgUCw==",
"license": "MIT",
"dependencies": {
"@vue/compiler-core": "3.5.32",
"@vue/shared": "3.5.32"
"@vue/compiler-core": "3.5.34",
"@vue/shared": "3.5.34"
}
},
"node_modules/@vue/compiler-sfc": {
"version": "3.5.32",
"resolved": "https://registry.npmmirror.com/@vue/compiler-sfc/-/compiler-sfc-3.5.32.tgz",
"integrity": "sha512-8UYUYo71cP/0YHMO814TRZlPuUUw3oifHuMR7Wp9SNoRSrxRQnhMLNlCeaODNn6kNTJsjFoQ/kqIj4qGvya4Xg==",
"version": "3.5.34",
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.34.tgz",
"integrity": "sha512-D/ihr6uZeIt6r+pVZf46RWT1fAsLFMbUP7k8G1VkiiWexriED9GrX3echHd4Abbt17zjlfiFJ8z7a3BxZOPNjg==",
"license": "MIT",
"dependencies": {
"@babel/parser": "^7.29.2",
"@vue/compiler-core": "3.5.32",
"@vue/compiler-dom": "3.5.32",
"@vue/compiler-ssr": "3.5.32",
"@vue/shared": "3.5.32",
"@babel/parser": "^7.29.3",
"@vue/compiler-core": "3.5.34",
"@vue/compiler-dom": "3.5.34",
"@vue/compiler-ssr": "3.5.34",
"@vue/shared": "3.5.34",
"estree-walker": "^2.0.2",
"magic-string": "^0.30.21",
"postcss": "^8.5.8",
"postcss": "^8.5.14",
"source-map-js": "^1.2.1"
}
},
@@ -1965,13 +1943,13 @@
"license": "MIT"
},
"node_modules/@vue/compiler-ssr": {
"version": "3.5.32",
"resolved": "https://registry.npmmirror.com/@vue/compiler-ssr/-/compiler-ssr-3.5.32.tgz",
"integrity": "sha512-Gp4gTs22T3DgRotZ8aA/6m2jMR+GMztvBXUBEUOYOcST+giyGWJ4WvFd7QLHBkzTxkfOt8IELKNdpzITLbA2rw==",
"version": "3.5.34",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.34.tgz",
"integrity": "sha512-cDtTHKibkThKGHH1SP+WdccquNRYQDFH6rRjQCqT9G2ltFAfoR5pUftpab/z+aM5mW9HLLVQW7hfKKQe/1GBeQ==",
"license": "MIT",
"dependencies": {
"@vue/compiler-dom": "3.5.32",
"@vue/shared": "3.5.32"
"@vue/compiler-dom": "3.5.34",
"@vue/shared": "3.5.34"
}
},
"node_modules/@vue/devtools-api": {
@@ -2008,65 +1986,84 @@
}
},
"node_modules/@vue/reactivity": {
"version": "3.5.32",
"resolved": "https://registry.npmmirror.com/@vue/reactivity/-/reactivity-3.5.32.tgz",
"integrity": "sha512-/ORasxSGvZ6MN5gc+uE364SxFdJ0+WqVG0CENXaGW58TOCdrAW76WWaplDtECeS1qphvtBZtR+3/o1g1zL4xPQ==",
"version": "3.5.34",
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.34.tgz",
"integrity": "sha512-y9XDjCEuBp+98k+UL5dbYkh57AHU4o6cxZedOPXw3bmrZZYLQsVHguGurq7hVrPCSrQtrnz1f9dssyFr+dMXfQ==",
"license": "MIT",
"dependencies": {
"@vue/shared": "3.5.32"
"@vue/shared": "3.5.34"
}
},
"node_modules/@vue/runtime-core": {
"version": "3.5.32",
"resolved": "https://registry.npmmirror.com/@vue/runtime-core/-/runtime-core-3.5.32.tgz",
"integrity": "sha512-pDrXCejn4UpFDFmMd27AcJEbHaLemaE5o4pbb7sLk79SRIhc6/t34BQA7SGNgYtbMnvbF/HHOftYBgFJtUoJUQ==",
"version": "3.5.34",
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.34.tgz",
"integrity": "sha512-mKeBYvu8tcMSLhypAHBmriUFfWXKTCF/23Z4jiCoYK3UtWepkliViNLuR90V9XOyD62mUxs9p1jsrpK3CCGIzw==",
"license": "MIT",
"dependencies": {
"@vue/reactivity": "3.5.32",
"@vue/shared": "3.5.32"
"@vue/reactivity": "3.5.34",
"@vue/shared": "3.5.34"
}
},
"node_modules/@vue/runtime-dom": {
"version": "3.5.32",
"resolved": "https://registry.npmmirror.com/@vue/runtime-dom/-/runtime-dom-3.5.32.tgz",
"integrity": "sha512-1CDVv7tv/IV13V8Nip1k/aaObVbWqRlVCVezTwx3K07p7Vxossp5JU1dcPNhJk3w347gonIUT9jQOGutyJrSVQ==",
"version": "3.5.34",
"resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.34.tgz",
"integrity": "sha512-e8kZzERmCwUnBRVsgSQlAfrfU2rGoy0FFKPBXSlfEjc/O3KfA7QP0t1/2ZylrbchjmIKB4dPTd07A6WPr0eOrg==",
"license": "MIT",
"dependencies": {
"@vue/reactivity": "3.5.32",
"@vue/runtime-core": "3.5.32",
"@vue/shared": "3.5.32",
"@vue/reactivity": "3.5.34",
"@vue/runtime-core": "3.5.34",
"@vue/shared": "3.5.34",
"csstype": "^3.2.3"
}
},
"node_modules/@vue/server-renderer": {
"version": "3.5.32",
"resolved": "https://registry.npmmirror.com/@vue/server-renderer/-/server-renderer-3.5.32.tgz",
"integrity": "sha512-IOjm2+JQwRFS7W28HNuJeXQle9KdZbODFY7hFGVtnnghF51ta20EWAZJHX+zLGtsHhaU6uC9BGPV52KVpYryMQ==",
"version": "3.5.34",
"resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.34.tgz",
"integrity": "sha512-nHxmJoTrKsmrkbILRhkC9gY1G3moZbJTqCzDd7DOOzG5KH9oeJ0Unqrff5f9v0pW//jES05ZkJcNtfE8JjOIew==",
"license": "MIT",
"dependencies": {
"@vue/compiler-ssr": "3.5.32",
"@vue/shared": "3.5.32"
"@vue/compiler-ssr": "3.5.34",
"@vue/shared": "3.5.34"
},
"peerDependencies": {
"vue": "3.5.32"
"vue": "3.5.34"
}
},
"node_modules/@vue/shared": {
"version": "3.5.32",
"resolved": "https://registry.npmmirror.com/@vue/shared/-/shared-3.5.32.tgz",
"integrity": "sha512-ksNyrmRQzWJJ8n3cRDuSF7zNNontuJg1YHnmWRJd2AMu8Ij2bqwiiri2lH5rHtYPZjj4STkNcgcmiQqlOjiYGg==",
"version": "3.5.34",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.34.tgz",
"integrity": "sha512-24uqU4OIiX29ryC3MeWid/Xf2fa2EFRUVLb77nRhk+UrTVrh/XiGtFAFmJBAtBRbjwNdsPRP+jj/OL27Eg1NDA==",
"license": "MIT"
},
"node_modules/@vue/tsconfig": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/@vue/tsconfig/-/tsconfig-0.9.1.tgz",
"integrity": "sha512-buvjm+9NzLCJL29KY1j1991YYJ5e6275OiK+G4jtmfIb+z4POywbdm0wXusT9adVWqe0xqg70TbI7+mRx4uU9w==",
"dev": true,
"license": "MIT",
"peerDependencies": {
"typescript": ">= 5.8",
"vue": "^3.4.0"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
},
"vue": {
"optional": true
}
}
},
"node_modules/@vueuse/core": {
"version": "14.2.1",
"resolved": "https://registry.npmjs.org/@vueuse/core/-/core-14.2.1.tgz",
"integrity": "sha512-3vwDzV+GDUNpdegRY6kzpLm4Igptq+GA0QkJ3W61Iv27YWwW/ufSlOfgQIpN6FZRMG0mkaz4gglJRtq5SeJyIQ==",
"version": "14.3.0",
"resolved": "https://registry.npmjs.org/@vueuse/core/-/core-14.3.0.tgz",
"integrity": "sha512-aHfz47g0ZhMtTVHmIzMVpJy8ePhhOy68GY5bv110+5DVtZ+W7BsOx+m61UNQqfrWyPztIHIanWa3E2tib3NFIw==",
"license": "MIT",
"peer": true,
"dependencies": {
"@types/web-bluetooth": "^0.0.21",
"@vueuse/metadata": "14.2.1",
"@vueuse/shared": "14.2.1"
"@vueuse/metadata": "14.3.0",
"@vueuse/shared": "14.3.0"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
@@ -2076,21 +2073,21 @@
}
},
"node_modules/@vueuse/metadata": {
"version": "14.2.1",
"resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-14.2.1.tgz",
"integrity": "sha512-1ButlVtj5Sb/HDtIy1HFr1VqCP4G6Ypqt5MAo0lCgjokrk2mvQKsK2uuy0vqu/Ks+sHfuHo0B9Y9jn9xKdjZsw==",
"version": "14.3.0",
"resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-14.3.0.tgz",
"integrity": "sha512-BwxmbAzwAVF50+MW57GXOUEV61nFBGnlBvrTqj49PqWJu3uw7hdu72ztXeZ33RdZtDY6kO+bfCAE1PCn88Tktw==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/@vueuse/router": {
"version": "14.2.1",
"resolved": "https://registry.npmjs.org/@vueuse/router/-/router-14.2.1.tgz",
"integrity": "sha512-SbZfJe+qn5bj78zNOXT4nYbnp8OIFMyAsdcJb4Y0y9vXi1TsOfglF+YIazi5DPO2lk6/ZukpN5DEQe6KrNOjMw==",
"version": "14.3.0",
"resolved": "https://registry.npmjs.org/@vueuse/router/-/router-14.3.0.tgz",
"integrity": "sha512-MK7YETFDPyDDF9aSP4W3TzUIHLZ+uq0n/t4VMxOP39e0qGbCZ21ZRsGE93ML84teKtCtPDlN+73CTk2e3xVl9w==",
"license": "MIT",
"dependencies": {
"@vueuse/shared": "14.2.1"
"@vueuse/shared": "14.3.0"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
@@ -2101,9 +2098,9 @@
}
},
"node_modules/@vueuse/shared": {
"version": "14.2.1",
"resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-14.2.1.tgz",
"integrity": "sha512-shTJncjV9JTI4oVNyF1FQonetYAiTBd+Qj7cY89SWbXSkx7gyhrgtEdF2ZAVWS1S3SHlaROO6F2IesJxQEkZBw==",
"version": "14.3.0",
"resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-14.3.0.tgz",
"integrity": "sha512-bZpge9eSXwa4ToSiqJ7j6KRwhAsneMFoSz3LMWKQDkqimm3D/tbFlrklrs/IOqC8tEcYmXQZJ6N0UrjhBirVCg==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/antfu"
@@ -2351,12 +2348,12 @@
"license": "MIT"
},
"node_modules/axios": {
"version": "1.15.0",
"resolved": "https://registry.npmmirror.com/axios/-/axios-1.15.0.tgz",
"integrity": "sha512-wWyJDlAatxk30ZJer+GeCWS209sA42X+N5jU2jy6oHTp7ufw8uzUTVFBX9+wTfAlhiJXGS0Bq7X6efruWjuK9Q==",
"version": "1.16.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.16.0.tgz",
"integrity": "sha512-6hp5CwvTPlN2A31g5dxnwAX0orzM7pmCRDLnZSX772mv8WDqICwFjowHuPs04Mc8deIld1+ejhtaMn5vp6b+1w==",
"license": "MIT",
"dependencies": {
"follow-redirects": "^1.15.11",
"follow-redirects": "^1.16.0",
"form-data": "^4.0.5",
"proxy-from-env": "^2.1.0"
}
@@ -3255,9 +3252,9 @@
}
},
"node_modules/dompurify": {
"version": "3.3.3",
"resolved": "https://registry.npmmirror.com/dompurify/-/dompurify-3.3.3.tgz",
"integrity": "sha512-Oj6pzI2+RqBfFG+qOaOLbFXLQ90ARpcGG6UePL82bJLtdsa6CYJD7nmiU8MW9nQNOtCHV3lZ/Bzq1X0QYbBZCA==",
"version": "3.4.2",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.2.tgz",
"integrity": "sha512-lHeS9SA/IKeIFFyYciHBr2n0v1VMPlSj843HdLOwjb2OxNwdq9Xykxqhk+FE42MzAdHvInbAolSE4mhahPpjXA==",
"license": "(MPL-2.0 OR Apache-2.0)",
"optionalDependencies": {
"@types/trusted-types": "^2.0.7"
@@ -3473,9 +3470,9 @@
"license": "MIT"
},
"node_modules/follow-redirects": {
"version": "1.15.11",
"resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.11.tgz",
"integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==",
"version": "1.16.0",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz",
"integrity": "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==",
"funding": [
{
"type": "individual",
@@ -3770,9 +3767,9 @@
}
},
"node_modules/jiti": {
"version": "2.6.1",
"resolved": "https://registry.npmmirror.com/jiti/-/jiti-2.6.1.tgz",
"integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==",
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz",
"integrity": "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==",
"dev": true,
"license": "MIT",
"bin": {
@@ -3924,15 +3921,15 @@
}
},
"node_modules/lodash": {
"version": "4.17.23",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz",
"integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==",
"version": "4.18.1",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz",
"integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==",
"license": "MIT"
},
"node_modules/lodash-es": {
"version": "4.17.23",
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.23.tgz",
"integrity": "sha512-kVI48u3PZr38HdYz98UmfPnXl2DXrpdctLrFLCd3kOx1xUkOmpFPx7gCWWM5MPkL/fD8zb+Ph0QzjGFs4+hHWg==",
"version": "4.18.1",
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.18.1.tgz",
"integrity": "sha512-J8xewKD/Gk22OZbhpOVSwcs60zhd95ESDwezOFuA3/099925PdHJ7OFHNTGtajL3AlZkykD32HykiMo+BIBI8A==",
"license": "MIT"
},
"node_modules/lodash.camelcase": {
@@ -4074,9 +4071,9 @@
}
},
"node_modules/md-editor-v3": {
"version": "6.4.2",
"resolved": "https://registry.npmmirror.com/md-editor-v3/-/md-editor-v3-6.4.2.tgz",
"integrity": "sha512-Jz2eYHTWpcxjakU7+2I2E9soiintAJ1NAFkXbhZYNUD1W/y52RidsjdmQRyf1YQH2pGXZyVLsHJm/mW99kA7LA==",
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/md-editor-v3/-/md-editor-v3-6.5.0.tgz",
"integrity": "sha512-GhGhPebfJeOrFuybFMUZRM6GzLMhu7Sg03MWLwO6tuIKMkRN71/SeTbLYYzY95qpaMbXDMWKlTkj3UNf9Bz4dg==",
"license": "MIT",
"dependencies": {
"@codemirror/autocomplete": "^6.18.7",
@@ -4145,6 +4142,19 @@
"uuid": "^11.1.0"
}
},
"node_modules/mermaid/node_modules/uuid": {
"version": "11.1.1",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.1.tgz",
"integrity": "sha512-vIYxrBCC/N/K+Js3qSN88go7kIfNPssr/hHCesKCQNAjmgvYS2oqr69kIufEG+O4+PfezOH4EbIeHCfFov8ZgQ==",
"funding": [
"https://github.com/sponsors/broofa",
"https://github.com/sponsors/ctavan"
],
"license": "MIT",
"bin": {
"uuid": "dist/esm/bin/uuid"
}
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
@@ -4261,9 +4271,9 @@
"license": "MIT"
},
"node_modules/nanoid": {
"version": "5.1.7",
"resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-5.1.7.tgz",
"integrity": "sha512-ua3NDgISf6jdwezAheMOk4mbE1LXjm1DfMUDMuJf4AqxLFK3ccGpgWizwa5YV7Yz9EpXwEaWoRXSb/BnV0t5dQ==",
"version": "5.1.11",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.1.11.tgz",
"integrity": "sha512-v+KEsUv2ps74PaSKv0gHTxTCgMXOIfBEbaqa6w6ISIGC7ZsvHN4N9oJ8d4cmf0n5oTzQz2SLmThbQWhjd/8eKg==",
"funding": [
{
"type": "github",
@@ -4328,14 +4338,14 @@
},
"node_modules/picocolors": {
"version": "1.1.1",
"resolved": "https://registry.npmmirror.com/picocolors/-/picocolors-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
"license": "ISC"
},
"node_modules/picomatch": {
"version": "4.0.3",
"resolved": "https://registry.npmmirror.com/picomatch/-/picomatch-4.0.3.tgz",
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz",
"integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
"license": "MIT",
"engines": {
"node": ">=12"
@@ -4394,9 +4404,9 @@
}
},
"node_modules/postcss": {
"version": "8.5.8",
"resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.5.8.tgz",
"integrity": "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==",
"version": "8.5.14",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.14.tgz",
"integrity": "sha512-SoSL4+OSEtR99LHFZQiJLkT59C5B1amGO1NzTwj7TT1qCUgUO6hxOvzkOYxD+vMrXBM3XJIKzokoERdqQq/Zmg==",
"funding": [
{
"type": "opencollective",
@@ -4422,9 +4432,9 @@
}
},
"node_modules/postcss/node_modules/nanoid": {
"version": "3.3.11",
"resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.11.tgz",
"integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
"version": "3.3.12",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz",
"integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==",
"funding": [
{
"type": "github",
@@ -4450,9 +4460,9 @@
}
},
"node_modules/prettier": {
"version": "3.8.2",
"resolved": "https://registry.npmmirror.com/prettier/-/prettier-3.8.2.tgz",
"integrity": "sha512-8c3mgTe0ASwWAJK+78dpviD+A8EqhndQPUBpNUIPt6+xWlIigCwfN01lWr9MAede4uqXGTEKeQWTvzb3vjia0Q==",
"version": "3.8.3",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.3.tgz",
"integrity": "sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==",
"dev": true,
"license": "MIT",
"bin": {
@@ -4735,7 +4745,7 @@
},
"node_modules/source-map-js": {
"version": "1.2.1",
"resolved": "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.2.1.tgz",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
"license": "BSD-3-Clause",
"engines": {
@@ -4867,9 +4877,9 @@
"license": "ISC"
},
"node_modules/typescript": {
"version": "6.0.2",
"resolved": "https://registry.npmmirror.com/typescript/-/typescript-6.0.2.tgz",
"integrity": "sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==",
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz",
"integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==",
"devOptional": true,
"license": "Apache-2.0",
"peer": true,
@@ -5045,19 +5055,6 @@
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
"license": "MIT"
},
"node_modules/uuid": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz",
"integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==",
"funding": [
"https://github.com/sponsors/broofa",
"https://github.com/sponsors/ctavan"
],
"license": "MIT",
"bin": {
"uuid": "dist/esm/bin/uuid"
}
},
"node_modules/vdirs": {
"version": "0.1.8",
"resolved": "https://registry.npmmirror.com/vdirs/-/vdirs-0.1.8.tgz",
@@ -5132,17 +5129,17 @@
"license": "MIT"
},
"node_modules/vue": {
"version": "3.5.32",
"resolved": "https://registry.npmmirror.com/vue/-/vue-3.5.32.tgz",
"integrity": "sha512-vM4z4Q9tTafVfMAK7IVzmxg34rSzTFMyIe0UUEijUCkn9+23lj0WRfA83dg7eQZIUlgOSGrkViIaCfqSAUXsMw==",
"version": "3.5.34",
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.34.tgz",
"integrity": "sha512-WdLBG9gm02OgJIG9axd5Hpx0TFLdzVgfG2evFFu8Rur5O/IoGc5cMjnjh3tPL6GnRGsYvUhBSKVPYVcxRKpMCA==",
"license": "MIT",
"peer": true,
"dependencies": {
"@vue/compiler-dom": "3.5.32",
"@vue/compiler-sfc": "3.5.32",
"@vue/runtime-dom": "3.5.32",
"@vue/server-renderer": "3.5.32",
"@vue/shared": "3.5.32"
"@vue/compiler-dom": "3.5.34",
"@vue/compiler-sfc": "3.5.34",
"@vue/runtime-dom": "3.5.34",
"@vue/server-renderer": "3.5.34",
"@vue/shared": "3.5.34"
},
"peerDependencies": {
"typescript": "*"
@@ -5180,9 +5177,9 @@
}
},
"node_modules/vue-router": {
"version": "5.0.4",
"resolved": "https://registry.npmmirror.com/vue-router/-/vue-router-5.0.4.tgz",
"integrity": "sha512-lCqDLCI2+fKVRl2OzXuzdSWmxXFLQRxQbmHugnRpTMyYiT+hNaycV0faqG5FBHDXoYrZ6MQcX87BvbY8mQ20Bg==",
"version": "5.0.6",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-5.0.6.tgz",
"integrity": "sha512-9+kmUTGbKMyW9Asoy98IXXYIzrTMT7JDAdpDDeEkorHvybpUvBI2wsrSM5jFOXrFydpzRFJ9vAh+80DN2PGu9w==",
"license": "MIT",
"peer": true,
"dependencies": {
@@ -5418,9 +5415,9 @@
}
},
"node_modules/yaml": {
"version": "2.8.2",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.2.tgz",
"integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==",
"version": "2.8.4",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.4.tgz",
"integrity": "sha512-ml/JPOj9fOQK8RNnWojA67GbZ0ApXAUlN2UQclwv2eVgTgn7O9gg9o7paZWKMp4g0H3nTLtS9LVzhkpOFIKzog==",
"license": "ISC",
"bin": {
"yaml": "bin.mjs"

View File

@@ -10,7 +10,7 @@
"fmt": "prettier --write src *.ts"
},
"dependencies": {
"@codemirror/autocomplete": "^6.20.1",
"@codemirror/autocomplete": "^6.20.2",
"@codemirror/lang-cpp": "^6.0.3",
"@codemirror/lang-python": "^6.2.1",
"@vue-flow/background": "^1.3.2",
@@ -19,11 +19,11 @@
"@vue-flow/minimap": "^1.5.4",
"@vue-flow/node-resizer": "^1.5.1",
"@vue-flow/node-toolbar": "^1.1.1",
"@vueuse/core": "^14.2.1",
"@vueuse/router": "^14.2.1",
"@vueuse/core": "^14.3.0",
"@vueuse/router": "^14.3.0",
"@wangeditor-next/editor": "^5.7.0",
"@wangeditor-next/editor-for-vue": "^5.1.14",
"axios": "^1.15.0",
"axios": "^1.16.0",
"canvas-confetti": "^1.9.4",
"chart.js": "^4.5.1",
"codemirror": "^6.0.2",
@@ -31,29 +31,30 @@
"date-fns": "^4.1.0",
"fflate": "^0.8.2",
"highlight.js": "^11.11.1",
"md-editor-v3": "^6.4.2",
"md-editor-v3": "^6.5.0",
"mermaid": "^11.14.0",
"naive-ui": "^2.44.1",
"nanoid": "^5.1.7",
"nanoid": "^5.1.11",
"normalize.css": "^8.0.1",
"pinia": "^3.0.4",
"skulpt": "^1.2.0",
"vue": "^3.5.32",
"vue": "^3.5.34",
"vue-chartjs": "^5.3.3",
"vue-codemirror": "^6.1.1",
"vue-router": "^5.0.4",
"vue-router": "^5.0.6",
"y-codemirror.next": "^0.3.5",
"y-webrtc": "^10.3.0",
"yjs": "^13.6.30"
},
"devDependencies": {
"@iconify/vue": "^5.0.0",
"@iconify/vue": "^5.0.1",
"@rsbuild/core": "^1.7.5",
"@rsbuild/plugin-vue": "^1.2.7",
"@types/canvas-confetti": "^1.9.0",
"@types/node": "^25.6.0",
"prettier": "^3.8.2",
"typescript": "^6.0.2",
"@vue/tsconfig": "^0.9.1",
"prettier": "^3.8.3",
"typescript": "^6.0.3",
"unplugin-auto-import": "^21.0.0",
"unplugin-vue-components": "^32.0.0"
}

View File

@@ -4,7 +4,7 @@ import AutoImport from "unplugin-auto-import/rspack"
import Components from "unplugin-vue-components/rspack"
import { NaiveUiResolver } from "unplugin-vue-components/resolvers"
export default defineConfig(({ envMode }) => {
const config: ReturnType<typeof defineConfig> = defineConfig(({ envMode }) => {
const { publicVars, rawPublicVars } = loadEnv({
cwd: process.cwd(),
mode: envMode,
@@ -20,6 +20,7 @@ export default defineConfig(({ envMode }) => {
ws: true,
changeOrigin: true,
}
return {
plugins: [pluginVue()],
tools: {
@@ -96,3 +97,5 @@ export default defineConfig(({ envMode }) => {
},
}
})
export default config

View File

@@ -54,7 +54,7 @@ async function submit() {
const api = {
"admin announcement create": createAnnouncement,
"admin announcement edit": editAnnouncement,
}[<string>route.name]
}[route.name as string]
try {
await api!(announcement)
if (route.name === "admin announcement create") {

View File

@@ -263,13 +263,15 @@ export function setTutorialVisibility(id: number, is_public: boolean) {
}
export async function getAdminExercises(tutorialId: number) {
const res = await http.get("admin/exercise", { params: { tutorial_id: tutorialId } })
const res = await http.get("admin/exercise", {
params: { tutorial_id: tutorialId },
})
return res.data as Exercise[]
}
export async function createExercise(data: {
tutorial_id: number
type: "mcq" | "sort"
type: "mcq" | "sort" | "fill"
data: object
order: number
}) {
@@ -279,7 +281,7 @@ export async function createExercise(data: {
export async function updateExercise(data: {
id: number
type: "mcq" | "sort"
type: "mcq" | "sort" | "fill"
data: object
order: number
}) {

View File

@@ -97,7 +97,7 @@ async function submit() {
const api = {
"admin contest create": createContest,
"admin contest edit": editContest,
}[<string>route.name]
}[route.name as string]
try {
await api!(contest)
if (route.name === "admin contest create") {

View File

@@ -33,7 +33,7 @@ const columns: DataTableColumn<AdminProblemFiltered>[] = [
render: (row) =>
h(AddButton, {
problemID: row.id,
contestID: <string>route.params.contestID,
contestID: route.params.contestID as string,
onAdded: () => emit("change"),
}),
width: 60,

View File

@@ -44,7 +44,7 @@ const title = computed(
"admin problem edit": "编辑题目",
"admin contest problem create": "新建比赛题目",
"admin contest problem edit": "编辑比赛题目",
})[<string>route.name],
})[route.name as string],
)
const isAIGenerating = ref(false)
@@ -136,7 +136,6 @@ async function getProblemDetail() {
}
try {
const { data } = await getProblem(props.problemID)
toggleReady(true)
problem.value.id = data.id
problem.value._id = data._id
problem.value.title = data.title
@@ -189,6 +188,7 @@ async function getProblemDetail() {
})
// 标签
tags.value.select = data.tags
toggleReady(true)
} catch (error) {
message.error("获取题目失败")
router.push({ name: "admin problem list" })
@@ -358,7 +358,7 @@ async function submit() {
"admin problem edit": editProblem,
"admin contest problem create": createContestProblem,
"admin contest problem edit": editContestProblem,
}[<string>route.name]
}[route.name as string]
if (
route.name === "admin contest problem create" ||
route.name === "admin contest problem edit"

View File

@@ -23,7 +23,7 @@ const title = computed(
({
"admin problem list": "题目列表",
"admin contest problem list": "比赛题目列表",
})[<string>route.name],
})[route.name as string],
)
const isContestProblemList = computed(
() => route.name === "admin contest problem list",

View File

@@ -1,5 +1,10 @@
<script setup lang="ts">
import { Exercise, ExerciseMcqData, ExerciseSortData } from "utils/types"
import {
Exercise,
ExerciseMcqData,
ExerciseSortData,
ExerciseFillData,
} from "utils/types"
import {
getAdminExercises,
createExercise,
@@ -14,15 +19,19 @@ const dialog = useDialog()
const exercises = ref<Exercise[]>([])
const showForm = ref(false)
const editingId = ref<number | null>(null)
const formType = ref<"mcq" | "sort">("mcq")
const formType = ref<"mcq" | "sort" | "fill">("mcq")
const formOrder = ref(0)
const mcqQuestion = ref("")
const mcqOptions = ref(["", ""])
const mcqAnswer = ref(0)
const mcqAnswer = ref<number[]>([])
const sortQuestion = ref("")
const sortCode = ref("")
const fillQuestion = ref("")
const fillCode = ref("")
async function load() {
exercises.value = await getAdminExercises(props.tutorialId)
}
@@ -35,8 +44,11 @@ function openCreate() {
formOrder.value = exercises.value.length
mcqQuestion.value = ""
mcqOptions.value = ["", ""]
mcqAnswer.value = 0
mcqAnswer.value = []
sortQuestion.value = ""
sortCode.value = ""
fillQuestion.value = ""
fillCode.value = ""
showForm.value = true
}
@@ -48,29 +60,62 @@ function openEdit(ex: Exercise) {
const d = ex.data as ExerciseMcqData
mcqQuestion.value = d.question
mcqOptions.value = [...d.options]
mcqAnswer.value = d.answer
} else {
mcqAnswer.value = [...d.answer]
} else if (ex.type === "sort") {
const d = ex.data as ExerciseSortData
sortQuestion.value = d.question
sortCode.value = d.lines.join("\n")
} else {
const d = ex.data as ExerciseFillData
fillQuestion.value = d.question
fillCode.value = d.code
}
showForm.value = true
}
function toggleAnswer(i: number) {
const idx = mcqAnswer.value.indexOf(i)
if (idx === -1) mcqAnswer.value.push(i)
else mcqAnswer.value.splice(idx, 1)
}
async function save() {
const data =
formType.value === "mcq"
? { question: mcqQuestion.value, options: mcqOptions.value, answer: mcqAnswer.value }
: {
question: "将下列代码行排列为正确顺序",
lines: sortCode.value.split("\n").filter((l) => l.trim() !== ""),
}
if (formType.value === "mcq" && mcqAnswer.value.length === 0) {
message.error("请至少勾选一个正确答案")
return
}
let data: Record<string, unknown>
if (formType.value === "mcq") {
data = {
question: mcqQuestion.value || "下面选项中正确是哪个?",
options: mcqOptions.value,
answer: mcqAnswer.value,
}
} else if (formType.value === "sort") {
data = {
question: sortQuestion.value || "将下列代码行排列为正确顺序",
lines: sortCode.value.split("\n").filter((l) => l.trim() !== ""),
}
} else {
data = { question: fillQuestion.value, code: fillCode.value }
}
try {
if (editingId.value) {
await updateExercise({ id: editingId.value, type: formType.value, data, order: formOrder.value })
await updateExercise({
id: editingId.value,
type: formType.value,
data,
order: formOrder.value,
})
message.success("练习题已更新")
} else {
await createExercise({ tutorial_id: props.tutorialId, type: formType.value, data, order: formOrder.value })
await createExercise({
tutorial_id: props.tutorialId,
type: formType.value,
data,
order: formOrder.value,
})
message.success("练习题已创建")
}
showForm.value = false
@@ -99,7 +144,15 @@ function copyPlaceholder(id: number) {
}
function typeName(type: string) {
return type === "mcq" ? "选择题" : "代码排序"
if (type === "mcq") return "选择题"
if (type === "sort") return "代码排序"
return "代码填空"
}
function typeTagType(type: string): "success" | "info" | "warning" {
if (type === "mcq") return "success"
if (type === "sort") return "info"
return "warning"
}
</script>
@@ -107,7 +160,9 @@ function typeName(type: string) {
<div>
<n-flex justify="space-between" align="center" style="margin-bottom: 16px">
<n-text> {{ exercises.length }} 道练习题</n-text>
<n-button type="primary" size="small" @click="openCreate">+ 添加练习题</n-button>
<n-button type="primary" size="small" @click="openCreate"
>+ 添加练习题</n-button
>
</n-flex>
<n-empty v-if="exercises.length === 0" description="暂无练习题" />
@@ -116,11 +171,7 @@ function typeName(type: string) {
<n-list-item v-for="ex in exercises" :key="ex.id">
<n-flex justify="space-between" align="center">
<div>
<n-tag
size="small"
:type="ex.type === 'mcq' ? 'success' : 'info'"
:bordered="false"
>
<n-tag size="small" :type="typeTagType(ex.type)" :bordered="false">
{{ typeName(ex.type) }}
</n-tag>
<n-text style="margin-left: 10px">
@@ -130,12 +181,16 @@ function typeName(type: string) {
<n-space :size="8">
<n-tooltip trigger="hover">
<template #trigger>
<n-button size="small" @click="copyPlaceholder(ex.id)">复制占位符</n-button>
<n-button size="small" @click="copyPlaceholder(ex.id)">
复制占位符
</n-button>
</template>
[[exercise:{{ ex.id }}]] 粘贴到 Markdown 内容中
</n-tooltip>
<n-button size="small" @click="openEdit(ex)">编辑</n-button>
<n-button size="small" type="error" @click="confirmDelete(ex.id)">删除</n-button>
<n-button size="small" type="error" @click="confirmDelete(ex.id)">
删除
</n-button>
</n-space>
</n-flex>
</n-list-item>
@@ -152,24 +207,38 @@ function typeName(type: string) {
<n-radio-group v-model:value="formType" :disabled="!!editingId">
<n-radio value="mcq">选择题</n-radio>
<n-radio value="sort">代码排序</n-radio>
<n-radio value="fill">代码填空</n-radio>
</n-radio-group>
</n-form-item>
<n-form-item label="顺序">
<n-input-number v-model:value="formOrder" :min="0" style="width: 100px" />
<n-input-number
v-model:value="formOrder"
:min="0"
style="width: 100px"
/>
</n-form-item>
<template v-if="formType === 'mcq'">
<n-form-item label="题目">
<n-input v-model:value="mcqQuestion" type="textarea" :rows="2" />
<n-input
v-model:value="mcqQuestion"
type="textarea"
:rows="2"
placeholder="下面选项中正确是哪个?"
/>
</n-form-item>
<n-form-item label="选项(正确答案前选择单选按钮">
<n-form-item label="选项(勾选所有正确答案)">
<n-space vertical style="width: 100%">
<n-flex v-for="(opt, i) in mcqOptions" :key="i" align="center" :size="8">
<n-radio
:value="i"
:checked="mcqAnswer === i"
@update:checked="$event && (mcqAnswer = i)"
<n-flex
v-for="(opt, i) in mcqOptions"
:key="i"
align="center"
:size="8"
>
<n-checkbox
:checked="mcqAnswer.includes(i)"
@update:checked="toggleAnswer(i)"
/>
<n-input
v-model:value="mcqOptions[i]"
@@ -179,17 +248,34 @@ function typeName(type: string) {
<n-button
size="small"
:disabled="mcqOptions.length <= 2"
@click="mcqOptions.splice(i, 1)"
@click="
() => {
mcqOptions.splice(i, 1)
mcqAnswer.value = mcqAnswer.value
.filter((a) => a !== i)
.map((a) => (a > i ? a - 1 : a))
}
"
>
</n-button>
</n-flex>
<n-button size="small" @click="mcqOptions.push('')">+ 添加选项</n-button>
<n-button size="small" @click="mcqOptions.push('')">
+ 添加选项
</n-button>
</n-space>
</n-form-item>
</template>
<template v-else>
<template v-else-if="formType === 'sort'">
<n-form-item label="题目">
<n-input
v-model:value="sortQuestion"
type="textarea"
:rows="2"
placeholder="将下列代码行排列为正确顺序"
/>
</n-form-item>
<n-form-item label="正确代码(每行将自动成为一道排序项)">
<n-input
v-model:value="sortCode"
@@ -200,6 +286,26 @@ function typeName(type: string) {
/>
</n-form-item>
</template>
<template v-else>
<n-form-item label="题目说明">
<n-input
v-model:value="fillQuestion"
type="textarea"
:rows="2"
placeholder="例:补全下面的循环语句"
/>
</n-form-item>
<n-form-item label="含空位的代码">
<n-input
v-model:value="fillCode"
type="textarea"
:rows="10"
placeholder="用 {{答案}} 标记空位,多个合法答案用 | 分隔例如for {{i|idx}} in range(10):"
style="font-family: monospace"
/>
</n-form-item>
</template>
</n-form>
<template #footer>

View File

@@ -64,7 +64,6 @@ async function submit() {
await updateTutorial(tutorial)
message.success("修改已保存")
}
router.push({ name: "admin tutorial list" })
} catch (err: any) {
message.error(err.data)
}

View File

@@ -10,6 +10,18 @@ body {
--md-theme-color: var(--n-text-color) !important;
}
.oj-mermaid-surface {
box-sizing: border-box;
padding: 18px;
overflow: auto;
border: 1px solid rgba(148, 163, 184, 0.24);
border-radius: 8px;
}
.oj-mermaid-surface > svg {
max-width: 100%;
}
::view-transition-old(root),
::view-transition-new(root) {
animation: none;

View File

@@ -5,11 +5,22 @@
<n-flex vertical size="large">
<n-flex align="center" justify="space-between">
<n-h3 style="margin: 0">请选择时间范围智能分析学习情况</n-h3>
<n-select
style="width: 140px"
:options="options"
v-model:value="aiStore.duration"
/>
<n-flex align="center">
<n-input
v-if="userStore.isSuperAdmin"
v-model:value="aiStore.targetUsername"
placeholder="查看指定用户"
clearable
style="width: 140px"
@change="onUsernameChange"
@clear="onUsernameChange"
/>
<n-select
style="width: 140px"
:options="options"
v-model:value="aiStore.duration"
/>
</n-flex>
</n-flex>
<Overview />
<n-grid :cols="2" :x-gap="20" :y-gap="20">
@@ -64,9 +75,11 @@ import EfficiencyChart from "./components/EfficiencyChart.vue"
import AI from "./components/AI.vue"
import SolvedTable from "./components/SolvedTable.vue"
import { useAIStore } from "../store/ai"
import { useUserStore } from "shared/store/user"
import { DURATION_OPTIONS } from "utils/constants"
const aiStore = useAIStore()
const userStore = useUserStore()
const { isDesktop } = useBreakpoints()
@@ -89,6 +102,11 @@ const end = computed(() => {
return formatISO(new Date())
})
function onUsernameChange() {
aiStore.fetchHeatmapData()
aiStore.fetchAnalysisData(start.value, end.value, aiStore.duration)
}
// 获取热力图数据(仅一次)
onMounted(() => {
aiStore.fetchHeatmapData()

View File

@@ -88,8 +88,9 @@ const data = computed<ChartData<"bar" | "line">>(() => {
type: "line",
label: "等级",
data: aiStore.durationData.map((duration) =>
gradeOrder.indexOf(duration.grade || "C"),
duration.grade ? gradeOrder.indexOf(duration.grade) : null,
),
spanGaps: false,
tension: 0.4,
yAxisID: "y1",
barThickness: 10,

View File

@@ -66,9 +66,9 @@ const efficiencyData = computed(() => {
// 值越接近1说明一次AC率越高
const efficiency = problemCount > 0 ? submissionCount / problemCount : 0
// 计算一次AC率百分比
// AC率AC题目数 / 总提交次数(越高说明提交质量越好
const onePassRate =
problemCount > 0 ? (problemCount / submissionCount) * 100 : 0
submissionCount > 0 ? (problemCount / submissionCount) * 100 : 0
return {
label: [
@@ -106,7 +106,7 @@ const data = computed<ChartData<"line">>(() => {
yAxisID: "y",
},
{
label: "一次AC率",
label: "提交AC率",
data: efficiency.map((e) => e.onePassRate),
borderColor: "rgb(34, 197, 94)",
backgroundColor: "rgba(34, 197, 94, 0.1)",
@@ -165,7 +165,7 @@ const options = computed(() => {
max: 100,
title: {
display: true,
text: "一次AC率%",
text: "提交AC率%",
font: {
size: 13,
},
@@ -201,10 +201,10 @@ const options = computed(() => {
`总提交: ${item.submissionCount}`,
]
} else {
// 一次AC率
// 提交AC率
return [
`${dsLabel}: ${item.onePassRate.toFixed(1)}%`,
`提示: 越高表示刷题质量越好`,
`提示: AC题目数 / 总提交次数,越高表示提交质量越好`,
]
}
},

View File

@@ -1,7 +1,7 @@
<template>
<n-card title="解题排名分布" size="small" v-if="show">
<n-card title="同期解题排名分布" size="small" v-if="show">
<template #header-extra>
<n-text depth="3" style="font-size: 12px">了解解题速度和竞争力</n-text>
<n-text depth="3" style="font-size: 12px">了解同期解题速度和竞争力</n-text>
</template>
<div style="height: 300px">
<Pie :data="data" :options="options" />
@@ -36,12 +36,10 @@ const rankDistribution = computed(() => {
}))
aiStore.detailsData.solved.forEach((item) => {
const rank = item.rank
const acCount = item.ac_count
const rank = item.period_rank
const acCount = item.period_ac_count
if (rank && acCount && acCount > 0) {
// 计算百分位:(rank / acCount) * 100
// 例如第5名/共100人 = 5%
const percentile = (rank / acCount) * 100
// 找到对应的区间

View File

@@ -2,7 +2,6 @@
<n-tabs animated v-if="submissions.length && flowcharts.length">
<n-tab-pane name="代码提交">
<n-data-table
v-if="submissions.length"
striped
:data="submissions"
:columns="columns"
@@ -11,7 +10,6 @@
</n-tab-pane>
<n-tab-pane name="流程图提交">
<n-data-table
v-if="flowcharts.length"
striped
:data="flowcharts"
:columns="flowchartsColumns"
@@ -20,16 +18,23 @@
</n-tab-pane>
</n-tabs>
<n-data-table
v-if="submissions.length && !flowcharts.length"
v-else-if="submissions.length"
striped
:data="submissions"
:columns="columns"
:max-height="isDesktop ? 1500 : 500"
/>
<n-data-table
v-else-if="flowcharts.length"
striped
:data="flowcharts"
:columns="flowchartsColumns"
:max-height="isDesktop ? 1500 : 500"
/>
</template>
<script lang="ts" setup>
import { NButton } from "naive-ui"
import { NButton, NTooltip } from "naive-ui"
import TagTitle from "./TagTitle.vue"
import { FlowchartSummary, SolvedProblem } from "utils/types"
import { useAIStore } from "oj/store/ai"
@@ -82,7 +87,25 @@ const columns: DataTableColumn<SolvedProblem>[] = [
render: (row) => row.rank + " / " + row.ac_count,
},
{
title: "等级",
title: "同期排名",
key: "period_rank",
width: 100,
align: "center",
render: (row) => row.period_rank + " / " + row.period_ac_count,
},
{
title: () =>
h(NTooltip, null, {
trigger: () => h("span", { style: "cursor:help; border-bottom: 1px dashed" }, "等级"),
default: () =>
h("div", null, [
h("div", null, "基于同时段排名的百分位:"),
h("div", null, "S — 前 10%"),
h("div", null, "A — 前 35%"),
h("div", null, "B — 前 75%"),
h("div", null, "C — 其余"),
]),
}),
key: "grade",
width: 100,
align: "center",

View File

@@ -1,7 +1,7 @@
<template>
<n-card title="时间活跃度分析" size="small" v-if="show">
<template #header-extra>
<n-text depth="3" style="font-size: 12px">发现最佳学习时段</n-text>
<n-text depth="3" style="font-size: 12px">基于 AC 时间发现解题高峰时段</n-text>
</template>
<div style="height: 300px">
<Bar :data="data" :options="options" />

View File

@@ -287,16 +287,16 @@ export function getTutorials() {
return http.get("tutorials")
}
export function getAIDetailData(start: string, end: string) {
return http.get("ai/detail", { params: { start, end } })
export function getAIDetailData(start: string, end: string, username?: string) {
return http.get("ai/detail", { params: { start, end, username } })
}
export function getAIDurationData(end: string, duration: string) {
return http.get("ai/duration", { params: { end, duration } })
export function getAIDurationData(end: string, duration: string, username?: string) {
return http.get("ai/duration", { params: { end, duration, username } })
}
export function getAIHeatmapData() {
return http.get("ai/heatmap")
export function getAIHeatmapData(username?: string) {
return http.get("ai/heatmap", { params: username ? { username } : {} })
}
export function getAILoginSummary() {
@@ -423,6 +423,8 @@ export function getProblemSetUserProgress(
}
export async function getExercises(tutorialId: number): Promise<Exercise[]> {
const res = await http.get("exercises", { params: { tutorial_id: tutorialId } })
const res = await http.get("exercises", {
params: { tutorial_id: tutorialId },
})
return res.data
}

View File

@@ -0,0 +1,160 @@
<script setup lang="ts">
import hljs from "highlight.js/lib/core"
import python from "highlight.js/lib/languages/python"
import c from "highlight.js/lib/languages/c"
import { Exercise, ExerciseFillData } from "utils/types"
hljs.registerLanguage("python", python)
hljs.registerLanguage("c", c)
const props = defineProps<{ exercise: Exercise; lang?: string }>()
const data = computed(() => props.exercise.data as ExerciseFillData)
type CodeSeg = { type: "code"; html: string }
type BlankSeg = { type: "blank"; answers: string[]; index: number }
type Segment = CodeSeg | BlankSeg
function escapeHtml(s: string): string {
return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;")
}
const segments = computed<Segment[]>(() => {
const blanks: string[][] = []
const markedCode = data.value.code.replace(/\{\{([^}]+)\}\}/g, (_, inner) => {
blanks.push(inner.split("|"))
return `____${blanks.length - 1}____`
})
const lang =
props.lang === "python" ? "python" : props.lang === "c" ? "c" : null
let highlighted: string
if (lang) {
try {
highlighted = hljs.highlight(markedCode, { language: lang }).value
} catch {
highlighted = escapeHtml(markedCode)
}
} else {
highlighted = escapeHtml(markedCode)
}
const parts = highlighted.split(/____(\d+)____/)
const result: Segment[] = []
for (let i = 0; i < parts.length; i++) {
if (i % 2 === 0) {
if (parts[i]) result.push({ type: "code", html: parts[i] })
} else {
const idx = parseInt(parts[i])
result.push({ type: "blank", answers: blanks[idx], index: idx })
}
}
return result
})
const blankCount = computed(
() => segments.value.filter((s) => s.type === "blank").length,
)
const userInputs = ref<string[]>([])
const wrongBlanks = ref<Set<number>>(new Set())
const allCorrect = ref(false)
watch(() => props.exercise.id, reset, { immediate: true })
function reset() {
userInputs.value = Array(blankCount.value).fill("")
wrongBlanks.value = new Set()
allCorrect.value = false
}
function submit() {
if (allCorrect.value) return
const wrong = new Set<number>()
for (const seg of segments.value) {
if (seg.type !== "blank") continue
if (!seg.answers.includes(userInputs.value[seg.index]?.trim() ?? "")) {
wrong.add(seg.index)
}
}
wrongBlanks.value = wrong
allCorrect.value = wrong.size === 0
}
function inputWidth(idx: number): string {
return Math.max(4, (userInputs.value[idx]?.length ?? 0) + 2) + "ch"
}
</script>
<template>
<n-card
size="small"
style="margin: 16px 0; border: 1.5px solid var(--n-border-color)"
>
<template #header>
<n-tag type="warning" size="small" :bordered="false"
>练一练 · 代码填空</n-tag
>
</template>
<p style="font-weight: 500; margin-bottom: 12px">{{ data.question }}</p>
<pre
:style="{
fontFamily: 'monospace',
lineHeight: '1.6',
background: 'var(--n-color)',
border: '1px solid var(--n-border-color)',
borderRadius: '6px',
padding: '12px',
overflowX: 'auto',
whiteSpace: 'pre-wrap',
margin: 0,
}"
><template v-for="(seg, i) in segments" :key="i"
><span v-if="seg.type === 'code'" v-html="seg.html" /><input
v-else
:value="userInputs[seg.index]"
:disabled="allCorrect"
:style="{
width: inputWidth(seg.index),
fontFamily: 'monospace',
padding: '1px 4px',
borderRadius: '3px',
border: `1.5px solid ${
allCorrect
? '#18a058'
: wrongBlanks.has(seg.index)
? '#d03050'
: 'var(--n-border-color)'
}`,
background: allCorrect
? 'rgba(24,160,88,0.08)'
: wrongBlanks.has(seg.index)
? 'rgba(208,48,80,0.07)'
: 'transparent',
outline: 'none',
color: 'inherit',
minWidth: '4ch',
}"
@input="userInputs[seg.index] = ($event.target as HTMLInputElement).value"
/></template></pre>
<n-alert
v-if="wrongBlanks.size > 0 || allCorrect"
:type="allCorrect ? 'success' : 'error'"
:title="allCorrect ? '全部正确!' : '有填写错误,请检查红色标注的空位'"
style="margin-top: 12px"
/>
<n-space style="margin-top: 12px" :size="8">
<n-button
type="warning"
size="small"
:disabled="allCorrect"
@click="submit"
>
提交
</n-button>
<n-button size="small" @click="reset">重置</n-button>
</n-space>
</n-card>
</template>

View File

@@ -3,46 +3,75 @@ import { Exercise, ExerciseMcqData } from "utils/types"
const props = defineProps<{ exercise: Exercise }>()
const data = computed(() => props.exercise.data as ExerciseMcqData)
const isSingle = computed(() => data.value.answer.length === 1)
const selected = ref<number | null>(null)
const selected = ref<Set<number>>(new Set())
const correct = ref(false)
const wrong = ref(false)
const partial = ref(false)
function select(idx: number) {
if (correct.value) return
selected.value = idx
const s = new Set(selected.value)
if (isSingle.value) {
s.clear()
if (!selected.value.has(idx)) s.add(idx)
} else {
if (s.has(idx)) s.delete(idx)
else s.add(idx)
}
selected.value = s
wrong.value = false
partial.value = false
}
function submit() {
if (selected.value === null || correct.value) return
if (selected.value === data.value.answer) {
if (selected.value.size === 0 || correct.value) return
const answer = new Set(data.value.answer)
const sel = selected.value
const isEqual =
sel.size === answer.size && [...sel].every((v) => answer.has(v))
if (isEqual) {
correct.value = true
wrong.value = false
partial.value = false
} else {
wrong.value = true
selected.value = null
selected.value = new Set()
const hasIntersection = [...sel].some((v) => answer.has(v))
if (hasIntersection) {
partial.value = true
wrong.value = false
} else {
wrong.value = true
partial.value = false
}
}
}
function reset() {
selected.value = null
selected.value = new Set()
correct.value = false
wrong.value = false
partial.value = false
}
function optionType(idx: number): "default" | "primary" | "success" {
if (correct.value && idx === data.value.answer) return "success"
if (idx === selected.value) return "primary"
if (correct.value && data.value.answer.includes(idx)) return "success"
if (selected.value.has(idx)) return "primary"
return "default"
}
</script>
<template>
<n-card size="small" style="margin: 16px 0; border: 1.5px solid var(--n-border-color)">
<n-card
size="small"
style="margin: 16px 0; border: 1.5px solid var(--n-border-color)"
>
<template #header>
<n-space align="center" :size="8">
<n-tag type="success" size="small" :bordered="false">练一练 · 选择题</n-tag>
<n-tag type="success" size="small" :bordered="false">
练一练 · {{ isSingle ? "单选题" : "多选题" }}
</n-tag>
</n-space>
</template>
@@ -55,21 +84,29 @@ function optionType(idx: number): "default" | "primary" | "success" {
:type="optionType(idx)"
:secondary="optionType(idx) !== 'default'"
:tertiary="optionType(idx) === 'default'"
:strong="idx === selected"
:style="{ justifyContent: 'flex-start', width: '100%', textAlign: 'left' }"
:strong="selected.has(idx)"
:style="{
justifyContent: 'flex-start',
width: '100%',
textAlign: 'left',
}"
@click="select(idx)"
>
<template #icon>
<span style="font-weight: 700">{{ String.fromCharCode(65 + idx) }}</span>
<span style="font-weight: 700">{{
String.fromCharCode(65 + idx)
}}</span>
</template>
{{ opt }}
</n-button>
</n-space>
<n-alert
v-if="correct || wrong"
:type="correct ? 'success' : 'error'"
:title="correct ? '正确!' : '选择有误,请重试'"
v-if="correct || wrong || partial"
:type="correct ? 'success' : partial ? 'warning' : 'error'"
:title="
correct ? '正确!' : partial ? '部分正确,请重试' : '选择有误,请重试'
"
style="margin-top: 12px"
/>
@@ -77,7 +114,7 @@ function optionType(idx: number): "default" | "primary" | "success" {
<n-button
type="primary"
size="small"
:disabled="selected === null || correct"
:disabled="selected.size === 0 || correct"
@click="submit"
>
提交

View File

@@ -22,11 +22,14 @@ function shuffle(arr: LineItem[]): LineItem[] {
;[a[i], a[j]] = [a[j], a[i]]
}
const isCorrect = a.every((item, i) => item.originalIdx === i)
return isCorrect && a.length > 1 ? shuffle(arr) : a
if (isCorrect && a.length > 1) [a[0], a[1]] = [a[1], a[0]]
return a
}
function init() {
lines.value = shuffle(data.value.lines.map((text, idx) => ({ originalIdx: idx, text })))
lines.value = shuffle(
data.value.lines.map((text, idx) => ({ originalIdx: idx, text })),
)
submitted.value = false
}
@@ -54,7 +57,9 @@ function lineStatus(idx: number): "correct" | "wrong" | "default" {
return lines.value[idx].originalIdx === idx ? "correct" : "wrong"
}
const allCorrect = computed(() => lines.value.every((item, i) => item.originalIdx === i))
const allCorrect = computed(() =>
lines.value.every((item, i) => item.originalIdx === i),
)
function submit() {
submitted.value = true
@@ -71,11 +76,14 @@ function escapeHtml(text: string): string {
const lineHtmlMap = computed<Record<number, string>>(() => {
const rawLines = data.value.lines
const map: Record<number, string> = {}
const lang = props.lang === "python" ? "python" : props.lang === "c" ? "c" : null
const lang =
props.lang === "python" ? "python" : props.lang === "c" ? "c" : null
if (lang) {
try {
const result = hljs.highlight(rawLines.join("\n"), { language: lang }).value
const result = hljs.highlight(rawLines.join("\n"), {
language: lang,
}).value
result.split("\n").forEach((html, i) => {
map[i] = html
})
@@ -93,9 +101,14 @@ const lineHtmlMap = computed<Record<number, string>>(() => {
</script>
<template>
<n-card size="small" style="margin: 16px 0; border: 1.5px solid var(--n-border-color)">
<n-card
size="small"
style="margin: 16px 0; border: 1.5px solid var(--n-border-color)"
>
<template #header>
<n-tag type="info" size="small" :bordered="false">练一练 · 代码排序</n-tag>
<n-tag type="info" size="small" :bordered="false"
>练一练 · 代码排序</n-tag
>
</template>
<p style="font-weight: 500; margin-bottom: 12px">{{ data.question }}</p>
@@ -126,7 +139,6 @@ const lineHtmlMap = computed<Record<number, string>>(() => {
: 'transparent',
cursor: 'grab',
fontFamily: 'monospace',
fontSize: '13px',
userSelect: 'none',
}"
@dragstart="onDragStart(idx)"
@@ -146,7 +158,12 @@ const lineHtmlMap = computed<Record<number, string>>(() => {
/>
<n-space style="margin-top: 12px" :size="8">
<n-button type="info" size="small" :disabled="submitted && allCorrect" @click="submit">
<n-button
type="info"
size="small"
:disabled="submitted && allCorrect"
@click="submit"
>
提交
</n-button>
<n-button size="small" @click="reset">重置</n-button>
@@ -157,29 +174,51 @@ const lineHtmlMap = computed<Record<number, string>>(() => {
<style>
.hljs-keyword,
.hljs-operator,
.hljs-selector-tag { color: #d73a49; }
.hljs-selector-tag {
color: #d73a49;
}
.hljs-string,
.hljs-regexp,
.hljs-template-literal { color: #032f62; }
.hljs-template-literal {
color: #032f62;
}
.hljs-comment,
.hljs-quote { color: #6a737d; font-style: italic; }
.hljs-quote {
color: #6a737d;
font-style: italic;
}
.hljs-number,
.hljs-literal { color: #005cc5; }
.hljs-literal {
color: #005cc5;
}
.hljs-built_in,
.hljs-title.function_,
.hljs-class .hljs-title { color: #6f42c1; }
.hljs-class .hljs-title {
color: #6f42c1;
}
.dark .hljs-keyword,
.dark .hljs-operator,
.dark .hljs-selector-tag { color: #c678dd; }
.dark .hljs-selector-tag {
color: #c678dd;
}
.dark .hljs-string,
.dark .hljs-regexp,
.dark .hljs-template-literal { color: #98c379; }
.dark .hljs-template-literal {
color: #98c379;
}
.dark .hljs-comment,
.dark .hljs-quote { color: #7f848e; font-style: italic; }
.dark .hljs-quote {
color: #7f848e;
font-style: italic;
}
.dark .hljs-number,
.dark .hljs-literal { color: #e5c07b; }
.dark .hljs-literal {
color: #e5c07b;
}
.dark .hljs-built_in,
.dark .hljs-title.function_,
.dark .hljs-class .hljs-title { color: #61afef; }
.dark .hljs-class .hljs-title {
color: #61afef;
}
</style>

View File

@@ -3,11 +3,21 @@ import { Exercise } from "utils/types"
const ExerciseMcq = defineAsyncComponent(() => import("./ExerciseMcq.vue"))
const ExerciseSort = defineAsyncComponent(() => import("./ExerciseSort.vue"))
const ExerciseFill = defineAsyncComponent(() => import("./ExerciseFill.vue"))
defineProps<{ exercise: Exercise; lang?: string }>()
</script>
<template>
<ExerciseMcq v-if="exercise.type === 'mcq'" :exercise="exercise" />
<ExerciseSort v-else-if="exercise.type === 'sort'" :exercise="exercise" :lang="lang" />
<ExerciseSort
v-else-if="exercise.type === 'sort'"
:exercise="exercise"
:lang="lang"
/>
<ExerciseFill
v-else-if="exercise.type === 'fill'"
:exercise="exercise"
:lang="lang"
/>
</template>

View File

@@ -4,7 +4,10 @@ type Segment =
| { type: "md"; content: string }
| { type: "exercise"; exercise: Exercise }
export function parseExercises(content: string, exercises: Exercise[]): Segment[] {
export function parseExercises(
content: string,
exercises: Exercise[],
): Segment[] {
const exerciseMap = new Map(exercises.map((e) => [e.id, e]))
const segments: Segment[] = []
const regex = /\[\[exercise:(\d+)\]\]/g
@@ -13,7 +16,10 @@ export function parseExercises(content: string, exercises: Exercise[]): Segment[
while ((match = regex.exec(content)) !== null) {
if (match.index > lastIndex) {
segments.push({ type: "md", content: content.slice(lastIndex, match.index) })
segments.push({
type: "md",
content: content.slice(lastIndex, match.index),
})
}
const id = parseInt(match[1])
const exercise = exerciseMap.get(id)

View File

@@ -34,7 +34,11 @@
:theme="isDark ? 'dark' : 'light'"
:model-value="seg.content"
/>
<ExerciseWidget v-else :exercise="seg.exercise" :lang="tutorial.type" />
<ExerciseWidget
v-else
:exercise="seg.exercise"
:lang="tutorial.type"
/>
</template>
</n-card>
</n-gi>
@@ -74,7 +78,11 @@
:theme="isDark ? 'dark' : 'light'"
:model-value="seg.content"
/>
<ExerciseWidget v-else :exercise="seg.exercise" :lang="tutorial.type" />
<ExerciseWidget
v-else
:exercise="seg.exercise"
:lang="tutorial.type"
/>
</template>
</n-tab-pane>
@@ -86,11 +94,21 @@
<n-divider style="margin: 12px 0" />
<n-flex align="center" justify="space-between">
<n-button secondary type="primary" :disabled="isFirstLesson" @click="goToPrevLesson">
<n-button
secondary
type="primary"
:disabled="isFirstLesson"
@click="goToPrevLesson"
>
上一课
</n-button>
<n-text>{{ step }} / {{ titles.length }}</n-text>
<n-button secondary type="primary" :disabled="isLastLesson" @click="goToNextLesson">
<n-button
secondary
type="primary"
:disabled="isLastLesson"
@click="goToNextLesson"
>
下一课
</n-button>
</n-flex>
@@ -106,8 +124,12 @@ import { getTutorial, getTutorials, getExercises } from "../api"
import { parseExercises } from "./composables/useExerciseParse"
import { useBreakpoints } from "shared/composables/breakpoints"
const ExerciseWidget = defineAsyncComponent(() => import("./components/ExerciseWidget.vue"))
const CodeEditor = defineAsyncComponent(() => import("shared/components/CodeEditor.vue"))
const ExerciseWidget = defineAsyncComponent(
() => import("./components/ExerciseWidget.vue"),
)
const CodeEditor = defineAsyncComponent(
() => import("shared/components/CodeEditor.vue"),
)
const isDark = useDark()
const route = useRoute()
@@ -119,7 +141,12 @@ const step = computed(() => {
return parseInt(route.params.step[0])
})
const tutorial = ref<Partial<Tutorial>>({ id: 0, title: "", content: "", code: "" })
const tutorial = ref<Partial<Tutorial>>({
id: 0,
title: "",
content: "",
code: "",
})
const titles = ref<{ id: number; title: string }[]>([])
const exercises = ref<Exercise[]>([])
const activeTab = ref("content")
@@ -147,9 +174,12 @@ async function init() {
titles.value = res1.data
if (titles.value.length === 0) return
const id = titles.value[step.value - 1].id
const [res2, exs] = await Promise.all([getTutorial(id), getExercises(id)])
tutorial.value = res2.data
exercises.value = exs
const [res2, exs] = await Promise.allSettled([
getTutorial(id),
getExercises(id),
])
if (res2.status === "fulfilled") tutorial.value = res2.value.data
exercises.value = exs.status === "fulfilled" ? exs.value : []
}
watch(

View File

@@ -6,20 +6,18 @@ const problemStore = useProblemStore()
const { problem } = storeToRefs(problemStore)
const mermaidContainer = useTemplateRef<HTMLElement>("mermaidContainer")
// 使用 mermaid composable
const { renderError, renderFlowchart } = useMermaid()
// 渲染流程图的函数
const renderProblemFlowchart = async () => {
if (problem.value?.mermaid_code) {
await renderFlowchart(mermaidContainer.value, problem.value.mermaid_code)
}
await renderFlowchart(
mermaidContainer.value,
problem.value?.mermaid_code ?? "",
)
}
// 初始化Mermaid并渲染
onMounted(() => {
renderProblemFlowchart()
})
onMounted(renderProblemFlowchart)
watch(() => problem.value?.mermaid_code, renderProblemFlowchart)
</script>
<template>

View File

@@ -50,7 +50,7 @@ const columns: DataTableColumn<Submission>[] = [
text: true,
type: "info",
onClick: () => {
showCodePanel(row.id, <string>route.params.problemID ?? "")
showCodePanel(row.id, (route.params.problemID as string) ?? "")
},
},
() => row.id.slice(0, 12),
@@ -116,8 +116,8 @@ async function listSubmissions() {
...query,
myself: "1",
offset,
problem_id: <string>route.params.problemID ?? "",
contest_id: <string>route.params.contestID ?? "",
problem_id: (route.params.problemID as string) ?? "",
contest_id: (route.params.contestID as string) ?? "",
})
submissions.value = res.data.results
total.value = res.data.total
@@ -125,7 +125,7 @@ async function listSubmissions() {
async function getRankOfThisProblem() {
loading.value = true
const res = await getRankOfProblem(<string>route.params.problemID ?? "")
const res = await getRankOfProblem((route.params.problemID as string) ?? "")
loading.value = false
class_name.value = res.data.class_name

View File

@@ -24,8 +24,8 @@ const codeStore = useCodeStore()
const problemStore = useProblemStore()
const { problem } = storeToRefs(problemStore)
const route = useRoute()
const contestID = <string>route.params.contestID ?? ""
const problemSetId = <string>route.params.problemSetId ?? ""
const contestID = (route.params.contestID as string) ?? ""
const problemSetId = (route.params.problemSetId as string) ?? ""
const router = useRouter()
const [commentPanel] = useToggle()

View File

@@ -69,8 +69,6 @@ const page = ref(1)
// ==================== WebSocket 相关函数 ====================
// 处理 WebSocket 消息
const handleWebSocketMessage = (data: FlowchartEvaluationUpdate) => {
console.log("收到流程图评分更新:", data)
if (data.type === "flowchart_evaluation_completed") {
loading.value = false
latestRating.value = {
@@ -79,11 +77,8 @@ const handleWebSocketMessage = (data: FlowchartEvaluationUpdate) => {
}
message.success(`流程图评分完成!得分: ${data.score}分 (${data.grade}级)`)
} else if (data.type === "flowchart_evaluation_failed") {
console.log("处理评分失败消息")
loading.value = false
message.error(`流程图评分失败: ${data.error}`)
} else {
console.log("未知的消息类型:", data.type)
}
}
@@ -94,7 +89,6 @@ const { connect, disconnect, subscribe } = useFlowchartWebSocket(
// 订阅提交更新
function subscribeToSubmission(submissionId: string) {
console.log("开始订阅WebSocket更新")
subscribe(submissionId)
}
@@ -287,16 +281,14 @@ onUnmounted(() => {
<n-grid :cols="5" :x-gap="16">
<!-- 左侧流程图预览区域 -->
<n-gi :span="3">
<n-card title="流程图预览">
<div class="flowchart">
<n-spin :show="rendering">
<n-alert v-if="renderError" type="error" title="流程图渲染失败">
{{ renderError }}
</n-alert>
<div class="flowchart" v-else ref="mermaidContainer"></div>
</n-spin>
</div>
</n-card>
<div class="flowchart">
<n-spin :show="rendering">
<n-alert v-if="renderError" type="error" title="流程图渲染失败">
{{ renderError }}
</n-alert>
<div class="flowchart" v-else ref="mermaidContainer"></div>
</n-spin>
</div>
<!-- 加载到编辑器按钮 -->
<n-flex style="margin-top: 16px" justify="center">
<n-button @click="loadToEditor" type="primary">

View File

@@ -72,15 +72,19 @@ export function useMermaidConverter() {
// 添加样式定义来区分不同类型的节点
mermaid += "\n"
mermaid +=
" classDef startEnd fill:#e1f5fe,stroke:#01579b,stroke-width:2px\n"
" classDef startNode fill:#dcfce7,stroke:#16a34a,stroke-width:2px,color:#0f172a\n"
mermaid +=
" classDef input fill:#e3f2fd,stroke:#1976d2,stroke-width:2px\n"
" classDef endNode fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#0f172a\n"
mermaid +=
" classDef output fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px\n"
" classDef input fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#0f172a\n"
mermaid +=
" classDef process fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px\n"
" classDef output fill:#ede9fe,stroke:#7c3aed,stroke-width:2px,color:#0f172a\n"
mermaid +=
" classDef decision fill:#fff3e0,stroke:#e65100,stroke-width:2px\n"
" classDef process fill:#f0f9ff,stroke:#0284c7,stroke-width:2px,color:#0f172a\n"
mermaid +=
" classDef decision fill:#fef3c7,stroke:#d97706,stroke-width:2px,color:#0f172a\n"
mermaid +=
" classDef loop fill:#fae8ff,stroke:#c026d3,stroke-width:2px,color:#0f172a\n"
mermaid += "\n"
// 为节点应用样式
@@ -90,8 +94,10 @@ export function useMermaidConverter() {
switch (originalType) {
case "start":
mermaid += ` class ${nodeId} startNode\n`
break
case "end":
mermaid += ` class ${nodeId} startEnd\n`
mermaid += ` class ${nodeId} endNode\n`
break
case "input":
mermaid += ` class ${nodeId} input\n`
@@ -100,9 +106,11 @@ export function useMermaidConverter() {
mermaid += ` class ${nodeId} output\n`
break
case "decision":
case "loop":
mermaid += ` class ${nodeId} decision\n`
break
case "loop":
mermaid += ` class ${nodeId} loop\n`
break
default:
mermaid += ` class ${nodeId} process\n`
}

View File

@@ -15,7 +15,6 @@ import { renderTableTitle } from "utils/renders"
import ProblemStatus from "./components/ProblemStatus.vue"
import AuthorSelect from "shared/components/AuthorSelect.vue"
import ProblemListTitle from "./components/ProblemListTitle.vue"
import { labelRect } from "mermaid/dist/rendering-util/rendering-elements/shapes/labelRect"
interface Tag {
id: number
@@ -221,12 +220,12 @@ function rowProps(row: ProblemFiltered) {
<template>
<n-flex vertical size="large">
<n-flex justify="space-between">
<div class="problem-list-toolbar">
<n-space>
<n-form :show-feedback="false" inline label-placement="left">
<n-form-item label="难度">
<n-select
style="width: 120px"
style="width: 100px"
v-model:value="query.difficulty"
:options="difficultyOptions"
/>
@@ -238,7 +237,7 @@ function rowProps(row: ProblemFiltered) {
<n-form :show-feedback="false" inline label-placement="left">
<n-form-item label="排序">
<n-select
style="width: 120px"
style="width: 100px"
v-model:value="query.sort"
:options="sortOptions"
/>
@@ -274,8 +273,8 @@ function rowProps(row: ProblemFiltered) {
</n-form-item>
</n-form>
</n-space>
<Hitokoto v-if="isDesktop" />
</n-flex>
<Hitokoto v-if="isDesktop" class="problem-list-hitokoto" />
</div>
<n-collapse-transition :show="showTag">
<n-flex>
<n-tag
@@ -304,4 +303,32 @@ function rowProps(row: ProblemFiltered) {
/>
</template>
<style scoped></style>
<style scoped>
.problem-list-toolbar {
display: grid;
grid-template-columns: minmax(0, auto) minmax(250px, 1fr);
align-items: start;
gap: 12px 16px;
}
.problem-list-toolbar :deep(.n-space) {
min-width: 0;
}
.problem-list-hitokoto {
justify-self: end;
width: 100%;
max-width: 720px;
min-width: 0;
}
@media (max-width: 768px) {
.problem-list-toolbar {
grid-template-columns: minmax(0, 1fr);
}
.problem-list-toolbar :deep(.n-space) {
width: 100%;
}
}
</style>

View File

@@ -5,6 +5,7 @@ import { getCSRFToken } from "utils/functions"
export const useAIStore = defineStore("ai", () => {
const duration = ref("months:6")
const targetUsername = ref("")
const durationData = ref<DurationData[]>([])
const detailsData = reactive<DetailsData>({
start: "",
@@ -28,7 +29,7 @@ export const useAIStore = defineStore("ai", () => {
const mdContent = ref("")
async function fetchDetailsData(start: string, end: string) {
const res = await getAIDetailData(start, end)
const res = await getAIDetailData(start, end, targetUsername.value || undefined)
detailsData.start = res.data.start
detailsData.end = res.data.end
detailsData.solved = res.data.solved
@@ -41,13 +42,13 @@ export const useAIStore = defineStore("ai", () => {
}
async function fetchDurationData(end: string, duration: string) {
const res = await getAIDurationData(end, duration)
const res = await getAIDurationData(end, duration, targetUsername.value || undefined)
durationData.value = res.data
}
async function fetchHeatmapData() {
loading.heatmap = true
const res = await getAIHeatmapData()
const res = await getAIHeatmapData(targetUsername.value || undefined)
heatmapData.value = res.data
loading.heatmap = false
}
@@ -155,6 +156,7 @@ export const useAIStore = defineStore("ai", () => {
detailsData,
heatmapData,
duration,
targetUsername,
loading,
mdContent,
}

View File

@@ -1,5 +1,5 @@
<template>
<n-button v-if="showLink" type="info" text @click="goto">
<n-button v-if="showLink" type="info" text @click="handleClick">
{{ flowchart.id.slice(0, 12) }}
</n-button>
<n-text v-else class="flowchart-id" @click="handleClick">
@@ -7,8 +7,8 @@
</n-text>
</template>
<script setup lang="ts">
import type { FlowchartSubmissionListItem } from "utils/types"
import { useUserStore } from "shared/store/user"
import { FlowchartSubmissionListItem } from "utils/types"
const userStore = useUserStore()
@@ -27,10 +27,6 @@ const showLink = computed(() => {
return props.flowchart.username === userStore.user?.username
})
function goto() {
emit("showDetail", props.flowchart.id)
}
function handleClick() {
emit("showDetail", props.flowchart.id)
}

View File

@@ -81,7 +81,7 @@ async function copyToProblem() {
}
const contestID = submission.value!.contest
const problemSetId = <string>route.params.problemSetId ?? ""
const problemSetId = (route.params.problemSetId as string) ?? ""
if (contestID) {
// 竞赛题目
router.push({

View File

@@ -103,7 +103,7 @@ async function listSubmissions() {
...query,
offset,
problem_id: query.problem,
contest_id: <string>route.params.contestID ?? "",
contest_id: (route.params.contestID as string) ?? "",
language: query.language,
today: query.today,
})

View File

@@ -93,7 +93,7 @@ function groupBadgesByIcon(badges: UserBadgeType[]): GroupedBadge[] {
async function init() {
toggle(true)
try {
const res = await getProfile(<string>route.query.name)
const res = await getProfile(route.query.name as string)
profile.value = res.data
const acm = res.data.acm_problems_status.problems || {}
const oi = res.data.oi_problems_status.problems || {}
@@ -114,7 +114,7 @@ async function init() {
}
if (route.query.name) {
promises.push(getUserBadges(<string>route.query.name))
promises.push(getUserBadges(route.query.name as string))
} else {
promises.push(getUserBadges())
}

View File

@@ -26,7 +26,7 @@ import { useBreakpoints } from "shared/composables/breakpoints"
const route = useRoute()
const { isMobile } = useBreakpoints()
const hiddenICP = computed(() =>
["problem", "contest problem"].includes(<string>route.name),
["problem", "contest problem"].includes(route.name as string),
)
function goICP() {

View File

@@ -4,7 +4,7 @@
:class="{ 'is-hovered': isHovered, 'is-editing': isEditing }"
:data-node-type="nodeType"
:draggable="!isEditing"
@mouseenter="isHovered = true"
@mouseenter="handleMouseEnter"
@mouseleave="handleMouseLeave"
@dblclick="handleDoubleClick"
@dragstart="handleDragStart"
@@ -53,11 +53,17 @@ import { getNodeTypeConfig } from "./useNodeStyles"
import NodeHandles from "./NodeHandles.vue"
import NodeActions from "./NodeActions.vue"
// 类型定义
interface NodeData {
label: string
color: string
originalType: string
customLabel?: string
}
interface Props {
id: string
type: string
data: any
data: NodeData
}
interface Emits {
@@ -147,6 +153,7 @@ const handleCancelEdit = () => {
}
const handleMouseEnter = () => {
isHovered.value = true
if (hideTimeout) {
clearTimeout(hideTimeout)
hideTimeout = null

View File

@@ -1,6 +1,7 @@
<script setup lang="ts">
import { computed } from "vue"
import { getNodeTypeConfig } from "./useNodeStyles"
import { currentDragNodeType } from "./useDnD"
// 拖拽开始处理
const onDragStart = (event: DragEvent, type: string) => {
@@ -8,6 +9,17 @@ const onDragStart = (event: DragEvent, type: string) => {
event.dataTransfer.setData("application/vueflow", type)
event.dataTransfer.effectAllowed = "move"
currentDragNodeType.value = type
// 隐藏浏览器默认拖影,改用 canvas 跟随预览
const emptyImg = new Image(1, 1)
emptyImg.src =
"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
event.dataTransfer.setDragImage(emptyImg, 0, 0)
}
const onDragEnd = () => {
currentDragNodeType.value = null
}
// Props
@@ -42,8 +54,7 @@ const nodeTypes = computed(() =>
),
)
// 获取保存状态标题
const getSaveStatusTitle = () => {
const saveStatusTitle = computed(() => {
if (props.isSaving) {
return "正在保存..."
} else if (props.hasUnsavedChanges) {
@@ -53,7 +64,7 @@ const getSaveStatusTitle = () => {
} else {
return "已保存"
}
}
})
</script>
<template>
<div class="toolbar">
@@ -68,7 +79,7 @@ const getSaveStatusTitle = () => {
unsaved: props.hasUnsavedChanges && !props.isSaving,
saved: !props.hasUnsavedChanges && !props.isSaving,
}"
:title="getSaveStatusTitle()"
:title="saveStatusTitle"
>
<span v-if="props.isSaving" class="spinner"></span>
<span v-else-if="props.hasUnsavedChanges"></span>
@@ -86,6 +97,7 @@ const getSaveStatusTitle = () => {
class="node-item"
:draggable="true"
@dragstart="onDragStart($event, nodeType.type)"
@dragend="onDragEnd"
:style="{ borderColor: nodeType.color }"
:title="`${nodeType.label} - ${nodeType.description}`"
>

View File

@@ -14,7 +14,8 @@ import {
import { Controls } from "@vue-flow/controls"
import { Background } from "@vue-flow/background"
import { useDnD } from "./useDnD"
import { useDnD, currentDragNodeType } from "./useDnD"
import { getNodeTypeConfig } from "./useNodeStyles"
import { useHistory } from "./useHistory"
import { useFlowOperations } from "./useFlowOperations"
import { useCache } from "./useCache"
@@ -42,17 +43,35 @@ const { canUndo, canRedo, saveState, undo, redo } = useHistory()
const problemStore = useProblemStore()
const { problem } = storeToRefs(problemStore)
// 缓存管理
const { isSaving, lastSaved, hasUnsavedChanges, loadFromCache, clearCache } =
useCache(
nodes,
edges,
problem.value?._id
? `flowchart-editor-data-problem-${problem.value!._id}`
: "flowchart-editor-data",
)
const {
isSaving,
lastSaved,
hasUnsavedChanges,
saveToCache,
loadFromCache,
clearCache,
} = useCache(
nodes,
edges,
problem.value?._id
? `flowchart-editor-data-problem-${problem.value!._id}`
: "flowchart-editor-data",
)
// 拖拽处理
const { onDragOver, onDragLeave, onDrop } = useDnD()
const { onDragOver, onDragLeave, onDrop, isDragOver, screenDragPos } = useDnD()
const dragPreviewStyle = computed(() => {
if (!screenDragPos.value || !currentDragNodeType.value) return null
const config = getNodeTypeConfig(currentDragNodeType.value)
const type = currentDragNodeType.value
return {
left: `${screenDragPos.value.x}px`,
top: `${screenDragPos.value.y}px`,
background: config.color,
borderRadius: type === "start" || type === "end" ? "20px" : "8px",
}
})
// 流程操作
const {
@@ -93,16 +112,18 @@ const handleDrop = (event: DragEvent) => {
const handleUndo = () => {
const state = undo()
if (state) {
nodes.value = [...state.nodes]
edges.value = [...state.edges]
nodes.value = state.nodes
edges.value = state.edges
saveToCache()
}
}
const handleRedo = () => {
const state = redo()
if (state) {
nodes.value = [...state.nodes]
edges.value = [...state.edges]
nodes.value = state.nodes
edges.value = state.edges
saveToCache()
}
}
@@ -182,6 +203,19 @@ defineExpose({
<template>
<div class="container" :style="{ height }">
<!-- 拖拽时跟随鼠标的节点预览 -->
<Transition name="drag-preview">
<div
v-if="isDragOver && dragPreviewStyle && currentDragNodeType"
class="drag-node-preview"
:style="dragPreviewStyle"
>
<span class="preview-icon">{{
getNodeTypeConfig(currentDragNodeType).icon
}}</span>
<span>{{ getNodeTypeConfig(currentDragNodeType).label }}</span>
</div>
</Transition>
<VueFlow
v-model:nodes="nodes"
v-model:edges="edges"
@@ -191,7 +225,7 @@ defineExpose({
@connect="handleConnect"
@edge-click="handleEdgeClick"
:default-edge-options="{
type: 'step',
type: 'default',
style: {
stroke: '#6366f1',
strokeWidth: 2.5,
@@ -269,4 +303,36 @@ defineExpose({
height: 100%;
position: relative;
}
.drag-node-preview {
position: fixed;
transform: translate(-50%, -50%);
pointer-events: none;
z-index: 9999;
padding: 8px 18px;
color: white;
font-size: 14px;
font-weight: 500;
display: flex;
align-items: center;
gap: 8px;
opacity: 0.55;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
white-space: nowrap;
border: 2px dashed rgba(255, 255, 255, 0.6);
user-select: none;
}
.preview-icon {
font-size: 16px;
}
.drag-preview-enter-active,
.drag-preview-leave-active {
transition: opacity 0.1s ease;
}
.drag-preview-enter-from,
.drag-preview-leave-to {
opacity: 0;
}
</style>

View File

@@ -7,28 +7,36 @@ import {
} from "./useNodeStyles"
import { getRandomId } from "utils/functions"
// 模块级共享当前拖拽的节点类型Toolbar 写入canvas 读取)
export const currentDragNodeType = ref<string | null>(null)
/**
* 简化的拖拽处理
*/
export function useDnD() {
const { addNodes, screenToFlowCoordinate } = useVueFlow()
const isDragOver = ref(false)
const screenDragPos = ref<{ x: number; y: number } | null>(null)
// 拖拽悬停处理
const onDragOver = (event: DragEvent) => {
event.preventDefault()
isDragOver.value = true
screenDragPos.value = { x: event.clientX, y: event.clientY }
}
// 拖拽离开处理
const onDragLeave = () => {
isDragOver.value = false
screenDragPos.value = null
}
// 拖拽放置处理
const onDrop = (event: DragEvent) => {
event.preventDefault()
isDragOver.value = false
screenDragPos.value = null
currentDragNodeType.value = null
const type = event.dataTransfer?.getData("application/vueflow")
if (!type) return
@@ -68,6 +76,7 @@ export function useDnD() {
return {
isDragOver,
screenDragPos,
onDragOver,
onDragLeave,
onDrop,

View File

@@ -1,5 +1,5 @@
import type { Ref } from "vue"
import type { Node, Edge } from "@vue-flow/core"
import type { Node, Edge, Connection } from "@vue-flow/core"
import { getRandomId } from "utils/functions"
export function useFlowOperations(
@@ -11,12 +11,11 @@ export function useFlowOperations(
removeEdges: (edgeIds: string[]) => void,
saveState: (nodes: Node[], edges: Edge[]) => void,
) {
// 根据节点类型和handle自动推断标签
const getAutoLabel = (
sourceNode: any,
targetNode: any,
sourceHandle: string,
targetHandle: string,
sourceNode: Node | undefined,
targetNode: Node | undefined,
sourceHandle: string | null | undefined,
targetHandle: string | null | undefined,
) => {
const sourceType = sourceNode?.data?.originalType || sourceNode?.type
const targetType = targetNode?.data?.originalType || targetNode?.type
@@ -51,9 +50,7 @@ export function useFlowOperations(
return ""
}
// 连接处理
const handleConnect = (params: any) => {
// 获取源节点和目标节点
const handleConnect = (params: Connection) => {
const sourceNode = nodes.value.find((node) => node.id === params.source)
const targetNode = nodes.value.find((node) => node.id === params.target)
@@ -79,9 +76,8 @@ export function useFlowOperations(
saveState(nodes.value, edges.value)
}
// 边点击处理 - 单击删除
const handleEdgeClick = (event: any) => {
removeEdges([event.edge.id])
const handleEdgeClick = ({ edge }: { edge: Edge }) => {
removeEdges([edge.id])
saveState(nodes.value, edges.value)
}
@@ -115,12 +111,7 @@ export function useFlowOperations(
},
}
// 使用 Vue Flow 的更新方法
nodes.value[nodeIndex] = updatedNode
// 强制触发响应式更新
nodes.value = [...nodes.value]
saveState(nodes.value, edges.value)
}
}

View File

@@ -1,11 +1,11 @@
import { ref, computed } from "vue"
import { shallowRef, computed } from "vue"
import type { Node, Edge } from "@vue-flow/core"
/**
* 简化的历史记录管理
*/
export function useHistory() {
const history = ref<{ nodes: Node[]; edges: Edge[] }[]>([])
const history = shallowRef<{ nodes: Node[]; edges: Edge[] }[]>([])
const historyIndex = ref(-1)
// 是否可以撤销
@@ -14,21 +14,30 @@ export function useHistory() {
// 是否可以重做
const canRedo = computed(() => historyIndex.value < history.value.length - 1)
const deepCopyState = (
nodes: Node[],
edges: Edge[],
): { nodes: Node[]; edges: Edge[] } =>
JSON.parse(JSON.stringify({ nodes, edges })) as {
nodes: Node[]
edges: Edge[]
}
// 保存状态到历史记录
const saveState = (nodes: Node[], edges: Edge[]) => {
const currentState = { nodes: [...nodes], edges: [...edges] }
const currentState = deepCopyState(nodes, edges)
// 如果当前不在历史记录的末尾,删除后面的记录
if (historyIndex.value < history.value.length - 1) {
history.value = history.value.slice(0, historyIndex.value + 1)
}
history.value.push(currentState)
history.value = [...history.value, currentState]
historyIndex.value = history.value.length - 1
// 限制历史记录数量
if (history.value.length > 20) {
history.value.shift()
history.value = history.value.slice(1)
historyIndex.value--
}
}
@@ -38,7 +47,7 @@ export function useHistory() {
if (canUndo.value) {
historyIndex.value--
const state = history.value[historyIndex.value]
return state
return deepCopyState(state.nodes, state.edges)
}
return null
}
@@ -48,7 +57,7 @@ export function useHistory() {
if (canRedo.value) {
historyIndex.value++
const state = history.value[historyIndex.value]
return state
return deepCopyState(state.nodes, state.edges)
}
return null
}

View File

@@ -30,23 +30,26 @@ function toggleDark(event: MouseEvent) {
isDark.value = !isDark.value
return
}
document.startViewTransition(() => {
isDark.value = !isDark.value
}).ready.then(() => {
document.documentElement.animate(
{
clipPath: [
`circle(0px at ${x}px ${y}px)`,
`circle(${radius}px at ${x}px ${y}px)`,
],
},
{
duration: 400,
easing: "ease-in-out",
pseudoElement: "::view-transition-new(root)",
},
)
}).catch(() => {})
document
.startViewTransition(() => {
isDark.value = !isDark.value
})
.ready.then(() => {
document.documentElement.animate(
{
clipPath: [
`circle(0px at ${x}px ${y}px)`,
`circle(${radius}px at ${x}px ${y}px)`,
],
},
{
duration: 400,
easing: "ease-in-out",
pseudoElement: "::view-transition-new(root)",
},
)
})
.catch(() => {})
}
// 从 store 中获取屏幕模式状态

View File

@@ -26,27 +26,44 @@ onMounted(receive)
@click="receive"
v-if="hitokoto.sentence"
>
<div class="sentence">{{ hitokoto.sentence }}</div>
<div class="from">{{ "来自 " + hitokoto.from }}</div>
<span class="from">{{ "来自 " + hitokoto.from }}</span>
<span class="sentence">{{ hitokoto.sentence }}</span>
</div>
</template>
<style scoped>
.hitokoto {
cursor: pointer;
height: 34px;
height: 36px;
min-width: 0;
display: flow-root;
overflow: hidden;
text-align: right;
line-height: 18px;
word-break: break-all;
}
.hitokoto::before {
content: "";
float: right;
width: 0;
height: 18px;
}
.hitokoto .sentence {
max-width: 400px;
text-overflow: ellipsis;
overflow: hidden;
word-break: break-all;
white-space: nowrap;
text-align: right;
}
.hitokoto .from {
float: right;
clear: right;
max-width: min(45%, 260px);
margin-left: 8px;
text-align: right;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
font-size: 12px;
line-height: 18px;
color: grey;
}
</style>

View File

@@ -1,102 +1,35 @@
<script setup lang="ts">
import { copyToClipboard, getRandomId } from "utils/functions"
// 动态导入 mermaid
let mermaid: any = null
import { copyToClipboard } from "utils/functions"
import { useMermaid } from "shared/composables/useMermaid"
const modelValue = defineModel<string>({ default: "" })
const mermaidContainer = useTemplateRef<HTMLElement>("mermaidContainer")
// 渲染状态
const renderSuccess = ref(false)
const { renderFlowchart, renderError, renderSuccess } = useMermaid()
// 定义事件
const emit = defineEmits<{
renderSuccess: []
}>()
// 动态加载 Mermaid
const loadMermaid = async () => {
if (!mermaid) {
const mermaidModule = await import("mermaid")
mermaid = mermaidModule.default
mermaid.initialize({
startOnLoad: false,
securityLevel: "strict",
theme: "default",
})
}
return mermaid
}
// 初始化
onMounted(async () => {
await loadMermaid()
nextTick(() => {
renderMermaid()
})
})
// 监听代码变化
watch(modelValue, () => {
renderMermaid()
})
// 渲染Mermaid图表
const renderMermaid = async () => {
if (!mermaidContainer.value) {
renderSuccess.value = false
return
}
// 总是先清空容器
mermaidContainer.value.innerHTML = ""
// 如果没有内容,直接返回
if (!modelValue.value.trim()) {
renderSuccess.value = false
return
}
try {
// 确保 mermaid 已加载
const mermaidInstance = await loadMermaid()
const id = `mermaid-${getRandomId()}`
const { svg } = await mermaidInstance.render(id, modelValue.value)
mermaidContainer.value.innerHTML = svg
// 渲染成功
renderSuccess.value = true
emit("renderSuccess")
} catch (error: any) {
const errorMessage = error?.message || "请检查代码语法"
renderSuccess.value = false
const errorDiv = document.createElement("div")
errorDiv.style.cssText = "color: #ff4d4f; padding: 20px; text-align: center; border: 1px dashed #ff4d4f; border-radius: 4px;"
const titleP = document.createElement("p")
titleP.textContent = "Mermaid语法错误"
const detailP = document.createElement("p")
detailP.style.cssText = "font-size: 12px; color: #666;"
detailP.textContent = errorMessage
errorDiv.appendChild(titleP)
errorDiv.appendChild(detailP)
mermaidContainer.value.innerHTML = ""
mermaidContainer.value.appendChild(errorDiv)
}
await renderFlowchart(mermaidContainer.value, modelValue.value)
if (renderSuccess.value) emit("renderSuccess")
}
// 清空代码
onMounted(() => {
nextTick(renderMermaid)
})
watch(modelValue, renderMermaid)
const clearCode = () => {
modelValue.value = ""
}
// 复制代码
const copyCode = async () => {
const copyCode = () => {
copyToClipboard(modelValue.value)
}
// 组件卸载时清空容器
onBeforeUnmount(() => {
if (mermaidContainer.value) {
mermaidContainer.value.innerHTML = ""
@@ -120,7 +53,6 @@ onBeforeUnmount(() => {
</n-flex>
<n-input
class="code-editor"
ref="codeEditor"
v-model:value="modelValue"
type="textarea"
:autosize="{ minRows: 10, maxRows: 20 }"
@@ -133,6 +65,14 @@ onBeforeUnmount(() => {
渲染成功
</n-tag>
</n-flex>
<n-alert
v-if="renderError"
type="error"
title="Mermaid 语法错误"
style="margin-bottom: 8px"
>
<n-text style="font-size: 12px">{{ renderError }}</n-text>
</n-alert>
<div ref="mermaidContainer" class="mermaid-container"></div>
</n-flex>
</n-flex>

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import {
import type {
IDomEditor,
IEditorConfig,
IToolbarConfig,
@@ -25,6 +25,7 @@ const props = withDefaults(defineProps<Props>(), {
const message = useMessage()
const editorRef = shallowRef<IDomEditor>()
const toolbarEditorRef = shallowRef<IDomEditor>()
const toolbarConfig: Partial<IToolbarConfig> = {
toolbarKeys: [
@@ -91,8 +92,10 @@ function onClick() {
editorRef.value.focus()
}
function handleCreated(editor: IDomEditor) {
async function handleCreated(editor: IDomEditor) {
editorRef.value = editor
await nextTick()
toolbarEditorRef.value = editor
}
async function customUpload(file: File, insertFn: InsertFnType) {
@@ -113,7 +116,7 @@ async function customUpload(file: File, insertFn: InsertFnType) {
<div class="editorWrapper">
<Toolbar
class="toolbar"
:editor="editorRef"
:editor="toolbarEditorRef"
:defaultConfig="props.simple ? toolbarConfigSimple : toolbarConfig"
mode="simple"
/>

View File

@@ -1,43 +1,293 @@
import { getRandomId } from "utils/functions"
export function useMermaid() {
// 渲染状态
const renderError = ref<string | null>(null)
const mermaidThemeVariables = {
primaryColor: "#e0f2fe",
primaryTextColor: "#0f172a",
primaryBorderColor: "#0284c7",
lineColor: "#64748b",
secondaryColor: "#f5f3ff",
tertiaryColor: "#ecfdf5",
background: "#ffffff",
mainBkg: "#f8fafc",
secondBkg: "#eef2ff",
tertiaryBkg: "#f0fdfa",
nodeBorder: "#2563eb",
clusterBkg: "#f8fafc",
clusterBorder: "#cbd5e1",
edgeLabelBackground: "#ffffff",
fontFamily:
'Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
}
// 动态导入 mermaid
let mermaid: any = null
const semanticNodeClasses = [
"startNode",
"endNode",
"startEnd",
"input",
"output",
"process",
"decision",
"loop",
]
// 动态加载 Mermaid
const loadMermaid = async () => {
if (!mermaid) {
const mermaidModule = await import("mermaid")
mermaid = mermaidModule.default
mermaid.initialize({
startOnLoad: false,
securityLevel: "strict",
theme: "default",
})
const displayStyleId = "oj-mermaid-display-style"
const mermaidDisplayStyle = `
.oj-mermaid-flowchart {
max-width: 100%;
height: auto;
}
.oj-mermaid-flowchart g.node rect,
.oj-mermaid-flowchart g.node polygon,
.oj-mermaid-flowchart g.node ellipse,
.oj-mermaid-flowchart g.node circle,
.oj-mermaid-flowchart g.node path {
stroke-width: 2px !important;
filter: drop-shadow(0 6px 12px rgba(15, 23, 42, 0.12));
}
.oj-mermaid-flowchart g.node.startNode rect,
.oj-mermaid-flowchart g.node.startNode polygon,
.oj-mermaid-flowchart g.node.startNode ellipse,
.oj-mermaid-flowchart g.node.startNode circle,
.oj-mermaid-flowchart g.node.startNode path,
.oj-mermaid-flowchart g.node.startEnd rect,
.oj-mermaid-flowchart g.node.startEnd polygon,
.oj-mermaid-flowchart g.node.startEnd ellipse,
.oj-mermaid-flowchart g.node.startEnd circle,
.oj-mermaid-flowchart g.node.startEnd path {
fill: #dcfce7 !important;
stroke: #16a34a !important;
}
.oj-mermaid-flowchart g.node.endNode rect,
.oj-mermaid-flowchart g.node.endNode polygon,
.oj-mermaid-flowchart g.node.endNode ellipse,
.oj-mermaid-flowchart g.node.endNode circle,
.oj-mermaid-flowchart g.node.endNode path {
fill: #fee2e2 !important;
stroke: #dc2626 !important;
}
.oj-mermaid-flowchart g.node.input rect,
.oj-mermaid-flowchart g.node.input polygon,
.oj-mermaid-flowchart g.node.input ellipse,
.oj-mermaid-flowchart g.node.input circle,
.oj-mermaid-flowchart g.node.input path {
fill: #dbeafe !important;
stroke: #2563eb !important;
}
.oj-mermaid-flowchart g.node.output rect,
.oj-mermaid-flowchart g.node.output polygon,
.oj-mermaid-flowchart g.node.output ellipse,
.oj-mermaid-flowchart g.node.output circle,
.oj-mermaid-flowchart g.node.output path {
fill: #ede9fe !important;
stroke: #7c3aed !important;
}
.oj-mermaid-flowchart g.node.process rect,
.oj-mermaid-flowchart g.node.process polygon,
.oj-mermaid-flowchart g.node.process ellipse,
.oj-mermaid-flowchart g.node.process circle,
.oj-mermaid-flowchart g.node.process path {
fill: #f0f9ff !important;
stroke: #0284c7 !important;
}
.oj-mermaid-flowchart g.node.decision rect,
.oj-mermaid-flowchart g.node.decision polygon,
.oj-mermaid-flowchart g.node.decision ellipse,
.oj-mermaid-flowchart g.node.decision circle,
.oj-mermaid-flowchart g.node.decision path {
fill: #fef3c7 !important;
stroke: #d97706 !important;
}
.oj-mermaid-flowchart g.node.loop rect,
.oj-mermaid-flowchart g.node.loop polygon,
.oj-mermaid-flowchart g.node.loop ellipse,
.oj-mermaid-flowchart g.node.loop circle,
.oj-mermaid-flowchart g.node.loop path {
fill: #fae8ff !important;
stroke: #c026d3 !important;
}
.oj-mermaid-flowchart g.node.oj-node-palette-0 rect,
.oj-mermaid-flowchart g.node.oj-node-palette-0 polygon,
.oj-mermaid-flowchart g.node.oj-node-palette-0 ellipse,
.oj-mermaid-flowchart g.node.oj-node-palette-0 circle,
.oj-mermaid-flowchart g.node.oj-node-palette-0 path {
fill: #dbeafe !important;
stroke: #2563eb !important;
}
.oj-mermaid-flowchart g.node.oj-node-palette-1 rect,
.oj-mermaid-flowchart g.node.oj-node-palette-1 polygon,
.oj-mermaid-flowchart g.node.oj-node-palette-1 ellipse,
.oj-mermaid-flowchart g.node.oj-node-palette-1 circle,
.oj-mermaid-flowchart g.node.oj-node-palette-1 path {
fill: #ccfbf1 !important;
stroke: #0d9488 !important;
}
.oj-mermaid-flowchart g.node.oj-node-palette-2 rect,
.oj-mermaid-flowchart g.node.oj-node-palette-2 polygon,
.oj-mermaid-flowchart g.node.oj-node-palette-2 ellipse,
.oj-mermaid-flowchart g.node.oj-node-palette-2 circle,
.oj-mermaid-flowchart g.node.oj-node-palette-2 path {
fill: #ede9fe !important;
stroke: #7c3aed !important;
}
.oj-mermaid-flowchart g.node.oj-node-palette-3 rect,
.oj-mermaid-flowchart g.node.oj-node-palette-3 polygon,
.oj-mermaid-flowchart g.node.oj-node-palette-3 ellipse,
.oj-mermaid-flowchart g.node.oj-node-palette-3 circle,
.oj-mermaid-flowchart g.node.oj-node-palette-3 path {
fill: #ffe4e6 !important;
stroke: #e11d48 !important;
}
.oj-mermaid-flowchart g.node.oj-node-palette-4 rect,
.oj-mermaid-flowchart g.node.oj-node-palette-4 polygon,
.oj-mermaid-flowchart g.node.oj-node-palette-4 ellipse,
.oj-mermaid-flowchart g.node.oj-node-palette-4 circle,
.oj-mermaid-flowchart g.node.oj-node-palette-4 path {
fill: #fef3c7 !important;
stroke: #d97706 !important;
}
.oj-mermaid-flowchart g.node.oj-node-palette-5 rect,
.oj-mermaid-flowchart g.node.oj-node-palette-5 polygon,
.oj-mermaid-flowchart g.node.oj-node-palette-5 ellipse,
.oj-mermaid-flowchart g.node.oj-node-palette-5 circle,
.oj-mermaid-flowchart g.node.oj-node-palette-5 path {
fill: #dcfce7 !important;
stroke: #16a34a !important;
}
.oj-mermaid-flowchart g.node .label,
.oj-mermaid-flowchart g.node .nodeLabel,
.oj-mermaid-flowchart g.node .nodeLabel p,
.oj-mermaid-flowchart g.node .label span {
color: #0f172a !important;
fill: #0f172a !important;
font-weight: 650 !important;
}
.oj-mermaid-flowchart .edgePaths path.path,
.oj-mermaid-flowchart .flowchart-link {
stroke: #64748b !important;
stroke-width: 2.4px !important;
}
.oj-mermaid-flowchart marker path,
.oj-mermaid-flowchart .marker {
fill: #64748b !important;
stroke: #64748b !important;
}
.oj-mermaid-flowchart .edgeLabel rect,
.oj-mermaid-flowchart .edgeLabel .labelBkg {
fill: rgba(255, 255, 255, 0.94) !important;
stroke: #cbd5e1 !important;
}
.oj-mermaid-flowchart .edgeLabel,
.oj-mermaid-flowchart .edgeLabel span,
.oj-mermaid-flowchart .edgeLabel p {
color: #334155 !important;
font-weight: 600 !important;
}
`
const svgNamespace = "http://www.w3.org/2000/svg"
function getNodeLabel(node: SVGGElement): string {
const el =
node.querySelector(".nodeLabel p") ||
node.querySelector(".nodeLabel") ||
node.querySelector(".label span") ||
node.querySelector(".label")
return el?.textContent?.trim() ?? ""
}
function applyFlowchartDisplayStyle(container: HTMLElement) {
container.classList.add("oj-mermaid-surface")
const svg = container.querySelector("svg")
if (!svg) return
svg.classList.add("oj-mermaid-flowchart")
const nodes = Array.from(svg.querySelectorAll<SVGGElement>("g.node"))
// Assign palette indices by label so same label → same color, different labels → different colors
const labelPaletteMap = new Map<string, number>()
let paletteCounter = 0
nodes.forEach((node) => {
const hasSemanticClass = semanticNodeClasses.some((className) =>
node.classList.contains(className),
)
if (!hasSemanticClass) {
const label = getNodeLabel(node)
if (!labelPaletteMap.has(label)) {
labelPaletteMap.set(label, paletteCounter % 6)
paletteCounter++
}
node.classList.add(`oj-node-palette-${labelPaletteMap.get(label)}`)
}
return mermaid
}
})
svg.querySelector(`#${displayStyleId}`)?.remove()
const style = document.createElementNS(svgNamespace, "style")
style.setAttribute("id", displayStyleId)
style.textContent = mermaidDisplayStyle
svg.insertBefore(style, svg.firstChild)
}
let mermaidInstance: any = null
async function loadMermaid() {
if (!mermaidInstance) {
const mermaidModule = await import("mermaid")
mermaidInstance = mermaidModule.default
mermaidInstance.initialize({
startOnLoad: false,
securityLevel: "strict",
theme: "base",
themeVariables: mermaidThemeVariables,
})
}
return mermaidInstance
}
export function useMermaid() {
const renderError = ref<string | null>(null)
const renderSuccess = ref(false)
// 渲染流程图的函数
const renderFlowchart = async (
container: HTMLElement | null,
mermaidCode: string,
) => {
renderError.value = null
renderSuccess.value = false
if (container) container.innerHTML = ""
if (!container || !mermaidCode?.trim()) return
try {
renderError.value = null
// 确保 mermaid 已加载
await loadMermaid()
// 渲染流程图
if (container && mermaidCode) {
const id = `mermaid-${getRandomId()}`
const { svg } = await mermaid.render(id, mermaidCode)
container.innerHTML = svg
}
const m = await loadMermaid()
const id = `mermaid-${getRandomId()}`
const { svg } = await m.render(id, mermaidCode)
container.innerHTML = svg
applyFlowchartDisplayStyle(container)
renderSuccess.value = true
} catch (error) {
renderError.value =
error instanceof Error
@@ -46,13 +296,13 @@ export function useMermaid() {
}
}
// 清除渲染错误
const clearError = () => {
renderError.value = null
}
return {
renderError: readonly(renderError),
renderSuccess: readonly(renderSuccess),
renderFlowchart,
clearError,
}

View File

@@ -582,7 +582,7 @@ export interface Tutorial {
export interface ExerciseMcqData {
question: string
options: string[]
answer: number
answer: number[]
}
export interface ExerciseSortData {
@@ -590,10 +590,15 @@ export interface ExerciseSortData {
lines: string[]
}
export interface ExerciseFillData {
question: string
code: string
}
export interface Exercise {
id: number
type: 'mcq' | 'sort'
data: ExerciseMcqData | ExerciseSortData
type: "mcq" | "sort" | "fill"
data: ExerciseMcqData | ExerciseSortData | ExerciseFillData
order: number
}
@@ -618,6 +623,8 @@ export interface SolvedProblem {
rank: number
ac_count: number
grade: Grade
period_rank: number
period_ac_count: number
difficulty: string
}

20
tsconfig.app.json Normal file
View File

@@ -0,0 +1,20 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"paths": {
"utils/*": ["./src/utils/*"],
"oj/*": ["./src/oj/*"],
"admin/*": ["./src/admin/*"],
"shared/*": ["./src/shared/*"]
},
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["src/**/*.ts", "src/**/*.vue"]
}

View File

@@ -1,24 +1,7 @@
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"module": "ESNext",
"strict": true,
"jsx": "preserve",
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"lib": ["ESNext", "DOM"],
"skipLibCheck": true,
"noEmit": true,
"paths": {
"shared/*": ["./src/shared/*"],
"utils/*": ["./src/utils/*"],
"oj/*": ["./src/oj/*"],
"admin/*": ["./src/admin/*"],
},
"types": ["naive-ui/volar"]
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
}

View File

@@ -1,9 +1,24 @@
{
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2022",
"lib": ["ES2023"],
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["rsbuild.config.ts"]
}