From cc7478d03ac60e819552e156580cb1c75b5400c6 Mon Sep 17 00:00:00 2001 From: SunWuyuan Date: Sat, 26 Apr 2025 09:26:53 +0800 Subject: [PATCH] Add js-yaml and jscses dependencies; enhance cses2wakeup.vue with improved UI elements, error handling, and YAML support for data processing. --- package.json | 2 + pnpm-lock.yaml | 14 + src/pages/cses2wakeup.vue | 1881 +++++++++++++++++++------------------ 3 files changed, 992 insertions(+), 905 deletions(-) diff --git a/package.json b/package.json index 1daddd3..fed03e3 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,8 @@ "@mdi/font": "7.4.47", "axios": "^1.8.4", "idb": "^8.0.2", + "js-yaml": "^4.1.0", + "jscses": "^1.0.6", "pinyin-pro": "^3.26.0", "roboto-fontface": "*", "typewriter-effect": "^2.21.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 30c497b..9151373 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,6 +17,12 @@ importers: idb: specifier: ^8.0.2 version: 8.0.2 + js-yaml: + specifier: ^4.1.0 + version: 4.1.0 + jscses: + specifier: ^1.0.6 + version: 1.0.6 pinyin-pro: specifier: ^3.26.0 version: 3.26.0 @@ -2300,6 +2306,10 @@ packages: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true + jscses@1.0.6: + resolution: {integrity: sha512-AKQZuopfyWv+BOEZtiEvfhn2FGr2cfAfY0oAuoGqKjBXkgx3lpq6VfW7nQREnJ9Whhr1t6LV2BNLFry/Kwajdg==} + hasBin: true + jsesc@3.0.2: resolution: {integrity: sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==} engines: {node: '>=6'} @@ -5871,6 +5881,10 @@ snapshots: dependencies: argparse: 2.0.1 + jscses@1.0.6: + dependencies: + js-yaml: 4.1.0 + jsesc@3.0.2: {} jsesc@3.1.0: {} diff --git a/src/pages/cses2wakeup.vue b/src/pages/cses2wakeup.vue index df9cb32..4ea3c63 100644 --- a/src/pages/cses2wakeup.vue +++ b/src/pages/cses2wakeup.vue @@ -3,155 +3,236 @@ - + + mdi-swap-horizontal 课程表转换工具 - 请在CSES中将数据格式改为“通用CSES(JSON)” + + 将CSES格式的JSON或YAML文本转换为WakeUp软件使用的课程表 + - {{ error }} +
+ mdi-alert-circle + {{ error }} +
+ - {{ success }} +
+ mdi-check-circle + {{ success }} +
- - 文本粘贴 - - 文件上传 + + + mdi-text-box 文本粘贴 + mdi-file-upload 文件上传 + + + 自动检测 + JSON + + YAML + + {{ yamlLibLoaded ? 'YAML解析库已加载' : '正在加载YAML解析库...' }} + + + + + +
+ 检测到的格式: {{ isYaml(jsonText) ? 'YAML' : 'JSON' }} +
+ - +
+ +
+ + + 将根据文件扩展名自动检测格式 +
- - 课程设置 - -
-
导出设置
- - - - - - - - - - - - - -
+ + +
+ mdi-calendar-multiselect +

选择导出天数

+ -
课表选择
- - - -
- - {{ schedule.name }} - - ({{ schedule.weeks === "odd" ? "单" : "双" }}周) - - -
-
-
-
+ mdi-checkbox-multiple-marked + 全选 + + + mdi-checkbox-multiple-blank-outline + 清除 +
+ + + {{ dayNames[day] }} + + + + + + + + + +
+ mdi-cog +

显示配置

+
+ + + + + + + + + + + +
+
+ + + + + - - - 处理结果预览 + + + + {{ processedData.tableData.length }} 节课程 + + + + + 请选择要导出的节次 + + + + + + mdi-table + 课程表 + + mdi-book-open-variant + {{ processedData.tableData.length }} 节课程 + - -
每周课程表
+ -