158 lines
7.6 KiB
TypeScript
158 lines
7.6 KiB
TypeScript
import { createRouter, createWebHistory } from 'vue-router'
|
|
import Layout from '@/components/Layout.vue'
|
|
import DashboardLayout from '@/components/DashboardLayout.vue'
|
|
import ProtectedRoute from '@/components/ProtectedRoute.vue'
|
|
import { useAuthStore } from '@/stores/auth'
|
|
|
|
// 页面组件
|
|
import Home from '@/views/Home.vue'
|
|
import AboutOverview from '@/views/AboutOverview.vue'
|
|
import AboutInsurers from '@/views/AboutInsurers.vue'
|
|
import AboutBrokers from '@/views/AboutBrokers.vue'
|
|
import AboutThirdParty from '@/views/AboutThirdParty.vue'
|
|
import RiskDutiesOverview from '@/views/RiskDutiesOverview.vue'
|
|
import Sponsor from '@/views/Sponsor.vue'
|
|
import Holder from '@/views/Holder.vue'
|
|
import Institution from '@/views/Institution.vue'
|
|
import ServiceProvider from '@/views/ServiceProvider.vue'
|
|
import Participant from '@/views/Participant.vue'
|
|
import SolutionsPharmacovigilance from '@/views/SolutionsPharmacovigilance.vue'
|
|
import SolutionsClinicalInsurance from '@/views/SolutionsClinicalInsurance.vue'
|
|
import SolutionsProductInsurance from '@/views/SolutionsProductInsurance.vue'
|
|
import SolutionsFundPayment from '@/views/SolutionsFundPayment.vue'
|
|
import SmartAcquisition from '@/views/SmartAcquisition.vue'
|
|
import PVReport from '@/views/PVReport.vue'
|
|
import DrugSafetyDict from '@/views/DrugSafetyDict.vue'
|
|
import RmoMode from '@/views/RmoMode.vue'
|
|
import PostMarket from '@/views/PostMarket.vue'
|
|
import KnowledgePVknowledge from '@/views/KnowledgePVknowledge.vue'
|
|
import KnowledgeInsurance from '@/views/KnowledgeInsurance.vue'
|
|
import KnowledgePvInsurance from '@/views/KnowledgePvInsurance.vue'
|
|
import ResourceCenter from '@/views/ResourceCenter.vue'
|
|
import Overseas from '@/views/Overseas.vue'
|
|
import FAQ from '@/views/FAQ.vue'
|
|
import LearningCenter from '@/views/LearningCenter.vue'
|
|
import Contact from '@/views/Contact.vue'
|
|
import PrivacyPolicy from '@/views/PrivacyPolicy.vue'
|
|
import Login from '@/views/Login.vue'
|
|
|
|
// Dashboard
|
|
import Dashboard from '@/views/dashboard/Dashboard.vue'
|
|
import ProjectList from '@/views/dashboard/ProjectList.vue'
|
|
import ProjectDetail from '@/views/dashboard/ProjectDetail.vue'
|
|
import InquiryList from '@/views/dashboard/InquiryList.vue'
|
|
import InquiryDetail from '@/views/dashboard/InquiryDetail.vue'
|
|
import ClaimProgress from '@/views/dashboard/ClaimProgress.vue'
|
|
import ClaimDetail from '@/views/dashboard/ClaimDetail.vue'
|
|
import Tools from '@/views/dashboard/Tools.vue'
|
|
import PremiumCalculator from '@/views/dashboard/PremiumCalculator.vue'
|
|
import ProjectQuotes from '@/views/dashboard/ProjectQuotes.vue'
|
|
import ICFEditor from '@/views/dashboard/ICFEditor.vue'
|
|
import RiskScoring from '@/views/dashboard/RiskScoring.vue'
|
|
import ProtocolRiskAssessment from '@/views/dashboard/ProtocolRiskAssessment.vue'
|
|
import DrugSafetyQuery from '@/views/dashboard/DrugSafetyQuery.vue'
|
|
|
|
const router = createRouter({
|
|
history: createWebHistory(),
|
|
routes: [
|
|
{
|
|
path: '/',
|
|
component: Layout,
|
|
children: [
|
|
{ path: '', component: Home },
|
|
{ path: 'about/overview', component: AboutOverview },
|
|
{ path: 'about/insurers', component: AboutInsurers },
|
|
{ path: 'about/brokers', component: AboutBrokers },
|
|
{ path: 'about/third-party', component: AboutThirdParty },
|
|
{ path: 'concern', component: RiskDutiesOverview },
|
|
{ path: 'sponsor', component: Sponsor },
|
|
{ path: 'holder', component: Holder },
|
|
{ path: 'institution', component: Institution },
|
|
{ path: 'service-provider', component: ServiceProvider },
|
|
{ path: 'participant', component: Participant },
|
|
{ path: 'solutions/pharmacovigilance', component: SolutionsPharmacovigilance },
|
|
{ path: 'solutions/clinical-insurance', component: SolutionsClinicalInsurance },
|
|
{ path: 'solutions/product-insurance', component: SolutionsProductInsurance },
|
|
{ path: 'solutions/fund-payment', component: SolutionsFundPayment },
|
|
{ path: 'risk-data/smart-acquisition', component: SmartAcquisition },
|
|
{ path: 'risk-data/pv-report', component: PVReport },
|
|
{ path: 'risk-data/drug-safety-dict', component: DrugSafetyDict },
|
|
{ path: 'risk-data/pv-service', component: PVReport },
|
|
{ path: 'risk-data/ai-tools', component: SmartAcquisition },
|
|
{ path: 'rmo-mode', component: RmoMode },
|
|
{ path: 'rmo-mode/insurance', component: RmoMode },
|
|
{ path: 'rmo-mode/guarantee', component: RmoMode },
|
|
{ path: 'rmo-mode/insurance-guarantee', component: RmoMode },
|
|
{ path: 'post-market', component: PostMarket },
|
|
{ path: 'post-market/insurance', component: PostMarket },
|
|
{ path: 'post-market/guarantee', component: PostMarket },
|
|
{ path: 'knowledge/PVknowledge', component: KnowledgePVknowledge },
|
|
{ path: 'knowledge/ai-app', component: SmartAcquisition },
|
|
{ path: 'knowledge/insurance', component: KnowledgeInsurance },
|
|
{ path: 'knowledge/insurance/PVknowledge', component: KnowledgePVknowledge },
|
|
{ path: 'knowledge/insurance/overseas', component: Overseas },
|
|
{ path: 'knowledge/insurance/group-standard', component: KnowledgeInsurance },
|
|
{ path: 'knowledge/pv-insurance', component: KnowledgePvInsurance },
|
|
{ path: 'knowledge/learning-center', component: LearningCenter },
|
|
{ path: 'knowledge/learning-center/cases', component: LearningCenter },
|
|
{ path: 'knowledge/learning-center/videos', component: LearningCenter },
|
|
{ path: 'knowledge/learning-center/exam', component: LearningCenter },
|
|
{ path: 'system-management', component: ResourceCenter },
|
|
{ path: 'system-management/laws', component: ResourceCenter },
|
|
{ path: 'system-management/practice-guide', component: ResourceCenter },
|
|
{ path: 'system-management/training', component: ResourceCenter },
|
|
{ path: 'system-management/faq', component: FAQ },
|
|
{ path: 'faq', component: FAQ },
|
|
{ path: 'faq/duty-logic', component: FAQ },
|
|
{ path: 'faq/coverage', component: FAQ },
|
|
{ path: 'faq/pv-insurance', component: FAQ },
|
|
{ path: 'contact', component: Contact },
|
|
{ path: 'privacy-policy', component: PrivacyPolicy },
|
|
{ path: 'overseas', component: Overseas },
|
|
{ path: 'login', component: Login },
|
|
]
|
|
},
|
|
{
|
|
path: '/dashboard',
|
|
component: ProtectedRoute,
|
|
children: [
|
|
{
|
|
path: '',
|
|
component: DashboardLayout,
|
|
children: [
|
|
{ path: '', component: Dashboard },
|
|
{ path: 'project-quotes', component: ProjectQuotes },
|
|
{ path: 'projects', component: ProjectList },
|
|
{ path: 'projects/:id', component: ProjectDetail },
|
|
{ path: 'inquiries', component: InquiryList },
|
|
{ path: 'inquiries/:id', component: InquiryDetail },
|
|
{ path: 'claims', component: ClaimProgress },
|
|
{ path: 'claims/:id', component: ClaimDetail },
|
|
{ path: 'tools', component: Tools },
|
|
{ path: 'tools/premium-calculator', component: PremiumCalculator },
|
|
{ path: 'tools/icf-editor', component: ICFEditor },
|
|
{ path: 'tools/risk-scoring', component: RiskScoring },
|
|
{ path: 'tools/protocol-risk', component: ProtocolRiskAssessment },
|
|
{ path: 'tools/drug-safety', component: DrugSafetyQuery },
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
})
|
|
|
|
router.beforeEach((to, from, next) => {
|
|
const auth = useAuthStore()
|
|
if (!auth.loading && auth.token === null && auth.user === null) {
|
|
auth.restoreAuth()
|
|
}
|
|
// 保护 /dashboard 路由
|
|
if (to.path.startsWith('/dashboard') && !auth.isAuthenticated && !auth.loading) {
|
|
next({ path: '/login', query: { from: to.fullPath } })
|
|
} else {
|
|
next()
|
|
}
|
|
})
|
|
|
|
export default router
|