全局中文化
This commit is contained in:
@@ -4,6 +4,7 @@ import { useStudyStore } from "../store/study";
|
||||
import Layout from "../components/Layout.vue";
|
||||
import Login from "../views/Login.vue";
|
||||
import Register from "../views/Register.vue";
|
||||
import ForgotPassword from "../views/ForgotPassword.vue";
|
||||
import StudyHome from "../views/StudyHome.vue";
|
||||
import MyWorkbench from "../views/workbench/MyWorkbench.vue";
|
||||
import FaqDetail from "../views/FaqDetail.vue";
|
||||
@@ -44,19 +45,26 @@ import NoteForm from "../views/knowledge/NoteForm.vue";
|
||||
import NoteDetail from "../views/knowledge/NoteDetail.vue";
|
||||
import SubjectForm from "../views/subjects/SubjectForm.vue";
|
||||
import SubjectDetail from "../views/subjects/SubjectDetail.vue";
|
||||
import { TEXT } from "../locales";
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: "/login",
|
||||
name: "Login",
|
||||
component: Login,
|
||||
meta: { public: true, title: "登录" },
|
||||
meta: { public: true, title: TEXT.common.actions.login },
|
||||
},
|
||||
{
|
||||
path: "/register",
|
||||
name: "Register",
|
||||
component: Register,
|
||||
meta: { public: true, title: "注册" },
|
||||
meta: { public: true, title: TEXT.common.actions.register },
|
||||
},
|
||||
{
|
||||
path: "/forgot-password",
|
||||
name: "ForgotPassword",
|
||||
component: ForgotPassword,
|
||||
meta: { public: true, title: TEXT.modules.auth.forgotTitle },
|
||||
},
|
||||
{
|
||||
path: "/",
|
||||
@@ -67,247 +75,247 @@ const routes: RouteRecordRaw[] = [
|
||||
path: "workbench",
|
||||
name: "MyWorkbench",
|
||||
component: MyWorkbench,
|
||||
meta: { title: "我的工作台" },
|
||||
meta: { title: TEXT.menu.workbench },
|
||||
},
|
||||
{
|
||||
path: "profile",
|
||||
name: "ProfileSettings",
|
||||
component: ProfileSettings,
|
||||
meta: { title: "个人设置" },
|
||||
meta: { title: TEXT.menu.profile },
|
||||
},
|
||||
{
|
||||
path: "project/overview",
|
||||
name: "ProjectOverview",
|
||||
component: ProjectOverview,
|
||||
meta: { title: "项目总览", requiresStudy: true },
|
||||
meta: { title: TEXT.menu.projectOverview, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "finance/contracts",
|
||||
name: "FinanceContracts",
|
||||
component: FinanceContracts,
|
||||
meta: { title: "合同费用", requiresStudy: true },
|
||||
meta: { title: TEXT.menu.financeContracts, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "finance/contracts/new",
|
||||
name: "FinanceContractNew",
|
||||
component: ContractForm,
|
||||
meta: { title: "新增合同费用", requiresStudy: true },
|
||||
meta: { title: TEXT.common.actions.add + TEXT.menu.financeContracts, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "finance/contracts/:contractId",
|
||||
name: "FinanceContractDetail",
|
||||
component: ContractDetail,
|
||||
meta: { title: "合同费用详情", requiresStudy: true },
|
||||
meta: { title: TEXT.modules.financeContracts.detailTitle, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "finance/contracts/:contractId/edit",
|
||||
name: "FinanceContractEdit",
|
||||
component: ContractForm,
|
||||
meta: { title: "编辑合同费用", requiresStudy: true },
|
||||
meta: { title: TEXT.common.actions.edit + TEXT.menu.financeContracts, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "finance/special",
|
||||
name: "FinanceSpecial",
|
||||
component: FinanceSpecial,
|
||||
meta: { title: "特殊费用", requiresStudy: true },
|
||||
meta: { title: TEXT.menu.financeSpecials, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "finance/special/new",
|
||||
name: "FinanceSpecialNew",
|
||||
component: SpecialForm,
|
||||
meta: { title: "新增特殊费用", requiresStudy: true },
|
||||
meta: { title: TEXT.common.actions.add + TEXT.menu.financeSpecials, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "finance/special/:specialId",
|
||||
name: "FinanceSpecialDetail",
|
||||
component: SpecialDetail,
|
||||
meta: { title: "特殊费用详情", requiresStudy: true },
|
||||
meta: { title: TEXT.modules.financeSpecials.detailTitle, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "finance/special/:specialId/edit",
|
||||
name: "FinanceSpecialEdit",
|
||||
component: SpecialForm,
|
||||
meta: { title: "编辑特殊费用", requiresStudy: true },
|
||||
meta: { title: TEXT.common.actions.edit + TEXT.menu.financeSpecials, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "drug/shipments",
|
||||
name: "DrugShipments",
|
||||
component: DrugShipments,
|
||||
meta: { title: "药品流向", requiresStudy: true },
|
||||
meta: { title: TEXT.menu.drugShipments, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "drug/shipments/new",
|
||||
name: "DrugShipmentNew",
|
||||
component: ShipmentForm,
|
||||
meta: { title: "新增运输记录", requiresStudy: true },
|
||||
meta: { title: TEXT.common.actions.add + TEXT.menu.drugShipments, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "drug/shipments/:shipmentId",
|
||||
name: "DrugShipmentDetail",
|
||||
component: ShipmentDetail,
|
||||
meta: { title: "运输记录详情", requiresStudy: true },
|
||||
meta: { title: TEXT.modules.drugShipments.detailTitle, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "drug/shipments/:shipmentId/edit",
|
||||
name: "DrugShipmentEdit",
|
||||
component: ShipmentForm,
|
||||
meta: { title: "编辑运输记录", requiresStudy: true },
|
||||
meta: { title: TEXT.common.actions.edit + TEXT.menu.drugShipments, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "startup/feasibility-ethics",
|
||||
name: "StartupFeasibilityEthics",
|
||||
component: StartupFeasibilityEthics,
|
||||
meta: { title: "立项与伦理", requiresStudy: true },
|
||||
meta: { title: TEXT.menu.startupFeasibilityEthics, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "startup/feasibility/new",
|
||||
name: "StartupFeasibilityNew",
|
||||
component: FeasibilityForm,
|
||||
meta: { title: "新增立项记录", requiresStudy: true },
|
||||
meta: { title: TEXT.common.actions.add + TEXT.modules.startupFeasibilityEthics.feasibilityTab, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "startup/feasibility/:recordId",
|
||||
name: "StartupFeasibilityDetail",
|
||||
component: FeasibilityDetail,
|
||||
meta: { title: "立项记录详情", requiresStudy: true },
|
||||
meta: { title: TEXT.modules.startupFeasibilityEthics.feasibilityDetailTitle, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "startup/feasibility/:recordId/edit",
|
||||
name: "StartupFeasibilityEdit",
|
||||
component: FeasibilityForm,
|
||||
meta: { title: "编辑立项记录", requiresStudy: true },
|
||||
meta: { title: TEXT.common.actions.edit + TEXT.modules.startupFeasibilityEthics.feasibilityTab, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "startup/ethics/new",
|
||||
name: "StartupEthicsNew",
|
||||
component: EthicsForm,
|
||||
meta: { title: "新增伦理记录", requiresStudy: true },
|
||||
meta: { title: TEXT.common.actions.add + TEXT.modules.startupFeasibilityEthics.ethicsTab, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "startup/ethics/:recordId",
|
||||
name: "StartupEthicsDetail",
|
||||
component: EthicsDetail,
|
||||
meta: { title: "伦理记录详情", requiresStudy: true },
|
||||
meta: { title: TEXT.modules.startupFeasibilityEthics.ethicsDetailTitle, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "startup/ethics/:recordId/edit",
|
||||
name: "StartupEthicsEdit",
|
||||
component: EthicsForm,
|
||||
meta: { title: "编辑伦理记录", requiresStudy: true },
|
||||
meta: { title: TEXT.common.actions.edit + TEXT.modules.startupFeasibilityEthics.ethicsTab, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "startup/meeting-auth",
|
||||
name: "StartupMeetingAuth",
|
||||
component: StartupMeetingAuth,
|
||||
meta: { title: "启动与授权", requiresStudy: true },
|
||||
meta: { title: TEXT.menu.startupMeetingAuth, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "startup/kickoff/new",
|
||||
name: "StartupKickoffNew",
|
||||
component: KickoffForm,
|
||||
meta: { title: "新增启动会", requiresStudy: true },
|
||||
meta: { title: TEXT.common.actions.add + TEXT.modules.startupMeetingAuth.kickoffTab, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "startup/kickoff/:meetingId",
|
||||
name: "StartupKickoffDetail",
|
||||
component: KickoffDetail,
|
||||
meta: { title: "启动会详情", requiresStudy: true },
|
||||
meta: { title: TEXT.modules.startupMeetingAuth.kickoffDetailTitle, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "startup/kickoff/:meetingId/edit",
|
||||
name: "StartupKickoffEdit",
|
||||
component: KickoffForm,
|
||||
meta: { title: "编辑启动会", requiresStudy: true },
|
||||
meta: { title: TEXT.common.actions.edit + TEXT.modules.startupMeetingAuth.kickoffTab, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "startup/training/new",
|
||||
name: "StartupTrainingNew",
|
||||
component: TrainingForm,
|
||||
meta: { title: "新增人员", requiresStudy: true },
|
||||
meta: { title: TEXT.common.actions.add + TEXT.common.fields.person, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "startup/training/:recordId",
|
||||
name: "StartupTrainingDetail",
|
||||
component: TrainingDetail,
|
||||
meta: { title: "培训授权详情", requiresStudy: true },
|
||||
meta: { title: TEXT.modules.startupMeetingAuth.trainingDetailTitle, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "startup/training/:recordId/edit",
|
||||
name: "StartupTrainingEdit",
|
||||
component: TrainingForm,
|
||||
meta: { title: "编辑培训授权", requiresStudy: true },
|
||||
meta: { title: TEXT.common.actions.edit + TEXT.modules.startupMeetingAuth.trainingTab, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "subjects",
|
||||
name: "SubjectManagement",
|
||||
component: SubjectManagement,
|
||||
meta: { title: "受试者管理", requiresStudy: true },
|
||||
meta: { title: TEXT.menu.subjects, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "subjects/new",
|
||||
name: "SubjectNew",
|
||||
component: SubjectForm,
|
||||
meta: { title: "新增受试者", requiresStudy: true },
|
||||
meta: { title: TEXT.common.actions.add + TEXT.menu.subjects, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "subjects/:subjectId",
|
||||
name: "SubjectDetail",
|
||||
component: SubjectDetail,
|
||||
meta: { title: "受试者详情", requiresStudy: true },
|
||||
meta: { title: TEXT.modules.subjectDetail.title, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "subjects/:subjectId/edit",
|
||||
name: "SubjectEdit",
|
||||
component: SubjectForm,
|
||||
meta: { title: "编辑受试者", requiresStudy: true },
|
||||
meta: { title: TEXT.common.actions.edit + TEXT.menu.subjects, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "monitoring",
|
||||
name: "MonitoringPlaceholder",
|
||||
component: MonitoringPlaceholder,
|
||||
meta: { title: "监查", requiresStudy: true },
|
||||
meta: { title: TEXT.menu.monitoring, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "audit",
|
||||
name: "AuditPlaceholder",
|
||||
component: AuditPlaceholder,
|
||||
meta: { title: "稽查", requiresStudy: true },
|
||||
meta: { title: TEXT.menu.audit, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "knowledge/medical-consult",
|
||||
name: "KnowledgeMedicalConsult",
|
||||
component: KnowledgeMedicalConsult,
|
||||
meta: { title: "医学咨询", requiresStudy: true },
|
||||
meta: { title: TEXT.menu.knowledgeMedicalConsult, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "knowledge/medical-consult/:itemId",
|
||||
name: "KnowledgeMedicalConsultDetail",
|
||||
component: FaqDetail,
|
||||
meta: { title: "医学咨询详情", requiresStudy: true },
|
||||
meta: { title: TEXT.modules.knowledgeMedicalConsult.detailTitle, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "knowledge/notes",
|
||||
name: "KnowledgeNotes",
|
||||
component: KnowledgeNotes,
|
||||
meta: { title: "注意事项", requiresStudy: true },
|
||||
meta: { title: TEXT.menu.knowledgeNotes, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "knowledge/notes/new",
|
||||
name: "KnowledgeNoteNew",
|
||||
component: NoteForm,
|
||||
meta: { title: "新增注意事项", requiresStudy: true },
|
||||
meta: { title: TEXT.common.actions.add + TEXT.menu.knowledgeNotes, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "knowledge/notes/:noteId",
|
||||
name: "KnowledgeNoteDetail",
|
||||
component: NoteDetail,
|
||||
meta: { title: "注意事项详情", requiresStudy: true },
|
||||
meta: { title: TEXT.modules.knowledgeNotes.detailTitle, requiresStudy: true },
|
||||
},
|
||||
{
|
||||
path: "knowledge/notes/:noteId/edit",
|
||||
name: "KnowledgeNoteEdit",
|
||||
component: NoteForm,
|
||||
meta: { title: "编辑注意事项", requiresStudy: true },
|
||||
meta: { title: TEXT.common.actions.edit + TEXT.menu.knowledgeNotes, requiresStudy: true },
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -320,37 +328,37 @@ const routes: RouteRecordRaw[] = [
|
||||
path: "users",
|
||||
name: "AdminUsers",
|
||||
component: AdminUsers,
|
||||
meta: { title: "账号管理", requiresAdmin: true },
|
||||
meta: { title: TEXT.menu.accountManagement, requiresAdmin: true },
|
||||
},
|
||||
{
|
||||
path: "user-approval",
|
||||
name: "AdminUserApproval",
|
||||
component: AdminUserApproval,
|
||||
meta: { title: "注册审核", requiresAdmin: true },
|
||||
meta: { title: TEXT.modules.adminUserApproval.title, requiresAdmin: true },
|
||||
},
|
||||
{
|
||||
path: "projects",
|
||||
name: "AdminProjects",
|
||||
component: AdminProjects,
|
||||
meta: { title: "项目管理", requiresAdmin: true },
|
||||
meta: { title: TEXT.menu.projectManagement, requiresAdmin: true },
|
||||
},
|
||||
{
|
||||
path: "projects/:projectId/members",
|
||||
name: "AdminProjectMembers",
|
||||
component: ProjectMembers,
|
||||
meta: { title: "项目成员", requiresAdmin: true },
|
||||
meta: { title: TEXT.modules.adminProjectMembers.memberLabel, requiresAdmin: true },
|
||||
},
|
||||
{
|
||||
path: "projects/:projectId/sites",
|
||||
name: "AdminSites",
|
||||
component: AdminSites,
|
||||
meta: { title: "中心管理", requiresAdmin: true },
|
||||
meta: { title: TEXT.modules.adminSites.title, requiresAdmin: true },
|
||||
},
|
||||
{
|
||||
path: "audit-logs",
|
||||
name: "AdminAuditLogs",
|
||||
component: AuditLogs,
|
||||
meta: { title: "审计日志", requiresAdmin: true },
|
||||
meta: { title: TEXT.menu.auditLogs, requiresAdmin: true },
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -358,7 +366,7 @@ const routes: RouteRecordRaw[] = [
|
||||
path: "/projects/:projectId",
|
||||
name: "ProjectDetail",
|
||||
component: ProjectDetail,
|
||||
meta: { title: "项目详情", requiresAdmin: true },
|
||||
meta: { title: TEXT.modules.adminProjects.detailTitle, requiresAdmin: true },
|
||||
},
|
||||
];
|
||||
|
||||
@@ -370,8 +378,8 @@ const router = createRouter({
|
||||
router.beforeEach(async (to, _from, next) => {
|
||||
const auth = useAuthStore();
|
||||
const studyStore = useStudyStore();
|
||||
const token = auth.token;
|
||||
if (!auth.user && token) {
|
||||
const getToken = () => auth.token;
|
||||
if (!auth.user && getToken()) {
|
||||
try {
|
||||
await auth.fetchMe();
|
||||
} catch {
|
||||
@@ -379,6 +387,7 @@ router.beforeEach(async (to, _from, next) => {
|
||||
auth.logout();
|
||||
}
|
||||
}
|
||||
const token = getToken();
|
||||
if (token && !studyStore.currentStudy) {
|
||||
await studyStore.ensureDefaultStudy();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user