From 547328ad44458a6b52ccb649760ee9c5aea42bb4 Mon Sep 17 00:00:00 2001 From: zly <644706215@qq.com> Date: Tue, 13 Jan 2026 16:57:03 +0800 Subject: [PATCH] feat(frontend): add i18n support and navigation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Install vue-i18n and configure locales (zh/en) - Add complete navigation bar with 5 items: Home, About, Submit, Status, Tool Guide - Add language switcher (中文/EN) with localStorage persistence - Create HomeView with hero section, features, and quick links - Create AboutView with features and usage guide - Create ToolInfoView explaining BtToxin_Shoter principles (no formulas, no Digger) - Update TaskSubmitForm: single file upload, genome/protein toggle, tooltips - Update TaskMonitorView: i18n, queue status display - Add queue_position field to TaskStatusResponse type Co-Authored-By: Claude --- activate_backend.sh | 8 +- frontend/package.json | 1 + frontend/src/App.vue | 164 +++++++++++- .../src/components/task/TaskSubmitForm.vue | 237 ++++++++++-------- frontend/src/locales/en.json | 177 +++++++++++++ frontend/src/locales/zh.json | 177 +++++++++++++ frontend/src/main.ts | 23 ++ frontend/src/router/index.ts | 27 +- frontend/src/types/task.ts | 5 +- frontend/src/views/AboutView.vue | 173 +++++++++++++ frontend/src/views/HomeView.vue | 211 ++++++++++++++++ frontend/src/views/TaskMonitorView.vue | 216 ++++++++++------ frontend/src/views/TaskSubmitView.vue | 15 +- frontend/src/views/ToolInfoView.vue | 206 +++++++++++++++ 14 files changed, 1436 insertions(+), 204 deletions(-) create mode 100644 frontend/src/locales/en.json create mode 100644 frontend/src/locales/zh.json create mode 100644 frontend/src/views/AboutView.vue create mode 100644 frontend/src/views/HomeView.vue create mode 100644 frontend/src/views/ToolInfoView.vue diff --git a/activate_backend.sh b/activate_backend.sh index 1a86a44..2d26968 100644 --- a/activate_backend.sh +++ b/activate_backend.sh @@ -1,12 +1,12 @@ export PATH="/app/.pixi/envs/webbackend/bin:/root/.pixi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" export CONDA_SHLVL=1 export CONDA_PREFIX=/app/.pixi/envs/webbackend -export PIXI_PROJECT_NAME=bttoxin-pipeline -export PIXI_PROJECT_ROOT=/app export PIXI_PROJECT_VERSION=0.1.0 -export PIXI_PROJECT_MANIFEST=/app/pixi.toml -export PIXI_EXE=/usr/local/bin/pixi export PIXI_IN_SHELL=1 +export PIXI_PROJECT_MANIFEST=/app/pixi.toml +export PIXI_PROJECT_ROOT=/app +export PIXI_EXE=/usr/local/bin/pixi +export PIXI_PROJECT_NAME=bttoxin-pipeline export CONDA_DEFAULT_ENV=bttoxin-pipeline:webbackend export PIXI_ENVIRONMENT_NAME=webbackend export PIXI_ENVIRONMENT_PLATFORMS=linux-64 diff --git a/frontend/package.json b/frontend/package.json index cb0a5b6..703a21a 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -24,6 +24,7 @@ "element-plus": "^2.13.0", "pinia": "^3.0.4", "vue": "^3.5.25", + "vue-i18n": "^9.14.2", "vue-router": "^4.6.3" }, "devDependencies": { diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 3aea9ef..b36e480 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,31 +1,101 @@ @@ -39,6 +109,7 @@ import { Monitor } from '@element-plus/icons-vue' background-color: var(--el-bg-color); border-bottom: 1px solid var(--el-border-color-light); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08); + padding: 0; } .header-content { @@ -56,6 +127,12 @@ import { Monitor } from '@element-plus/icons-vue' align-items: center; gap: 8px; color: var(--el-color-primary); + cursor: pointer; + transition: opacity 0.2s; +} + +.logo:hover { + opacity: 0.8; } .title { @@ -63,11 +140,46 @@ import { Monitor } from '@element-plus/icons-vue' font-weight: 600; } -.header-tag { +.nav-menu { + flex: 1; + justify-content: center; + border-bottom: none; + background: transparent; +} + +.nav-menu :deep(.el-menu-item) { + font-size: 14px; + height: 56px; + line-height: 56px; +} + +.nav-menu :deep(.el-menu-item:hover), +.nav-menu :deep(.el-menu-item.is-active) { + background-color: transparent; + color: var(--el-color-primary); + border-bottom-color: var(--el-color-primary); +} + +.lang-switcher { display: flex; align-items: center; } +.lang-button { + display: flex; + align-items: center; + gap: 6px; + padding: 8px 12px; + border-radius: 4px; + cursor: pointer; + transition: background-color 0.2s; + font-size: 14px; +} + +.lang-button:hover { + background-color: var(--el-fill-color-light); +} + .app-main { padding: 20px; max-width: 1200px; @@ -75,4 +187,32 @@ import { Monitor } from '@element-plus/icons-vue' width: 100%; box-sizing: border-box; } + +.app-footer { + text-align: center; + padding: 20px; + color: var(--el-text-color-secondary); + font-size: 13px; + border-top: 1px solid var(--el-border-color-lighter); + margin-top: auto; +} + +@media (max-width: 768px) { + .header-content { + flex-wrap: wrap; + padding: 10px 20px; + } + + .nav-menu { + order: 3; + width: 100%; + justify-content: flex-start; + margin-top: 10px; + } + + .nav-menu :deep(.el-menu-item) { + padding: 0 12px; + font-size: 13px; + } +} diff --git a/frontend/src/components/task/TaskSubmitForm.vue b/frontend/src/components/task/TaskSubmitForm.vue index 6cdd0e7..1b0de2e 100644 --- a/frontend/src/components/task/TaskSubmitForm.vue +++ b/frontend/src/components/task/TaskSubmitForm.vue @@ -6,60 +6,57 @@ label-position="top" class="task-submit-form" > + + + + {{ $t('submit.fileUpload.genomeLabel') }} + {{ $t('submit.fileUpload.proteinLabel') }} + + + - + -
- 拖拽文件到此处,或 点击上传 -
+
- +
- Shoter 评分参数 - - + {{ $t('submit.params.title') }} +
-

- 以下参数用于 Shoter 评分工具,对 Digger 检测结果进行过滤和活性评估。 -

@@ -76,13 +73,8 @@ @@ -102,13 +94,8 @@ @@ -118,13 +105,8 @@ @@ -133,7 +115,8 @@ - + + 中文 English @@ -148,44 +131,42 @@ :disabled="fileList.length === 0" @click="handleSubmit" > - {{ submitting ? '提交中...' : '提交任务' }} + {{ submitting ? $t('submit.submitting') : $t('submit.submitBtn') }} + + + + diff --git a/frontend/src/views/HomeView.vue b/frontend/src/views/HomeView.vue new file mode 100644 index 0000000..7317a3a --- /dev/null +++ b/frontend/src/views/HomeView.vue @@ -0,0 +1,211 @@ + + + + + diff --git a/frontend/src/views/TaskMonitorView.vue b/frontend/src/views/TaskMonitorView.vue index 0de9270..e67d09c 100644 --- a/frontend/src/views/TaskMonitorView.vue +++ b/frontend/src/views/TaskMonitorView.vue @@ -3,19 +3,19 @@
-

加载任务状态中...

+

{{ $t('status.loading') }}

@@ -24,11 +24,11 @@
@@ -37,58 +37,58 @@ @@ -171,13 +171,13 @@ diff --git a/frontend/src/views/ToolInfoView.vue b/frontend/src/views/ToolInfoView.vue new file mode 100644 index 0000000..579d488 --- /dev/null +++ b/frontend/src/views/ToolInfoView.vue @@ -0,0 +1,206 @@ + + + + +