feat(web-admin): add UnifiedProtocolPage shell with cell-storage and research-donation tabs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-10-07 12:14:36 +08:00
1 parent db75ca6deb
commit 70c92fb33f
1 file changed
+61
@@ -0,0 +1,61 @@
<template>
<div class="unified-protocol-page">
<div class="panel-pill-tabs panel-pill-tabs--lg">
<div class="panel-pill-tabs__track" role="tablist" aria-label="协议来源">
<button
v-for="item in tabs"
:key="item.key"
type="button"
role="tab"
class="panel-pill-tabs__btn"
:class="{ 'is-active': activeSource === item.key }"
:aria-selected="activeSource === item.key"
@click="switchSource(item.key)"
>
{{ item.title }}
</button>
</div>
</div>
<!-- v-if:仅挂载当前 Tab,避免双列表同时请求 -->
<ProtocolAuditTab v-if="activeSource === 'cell_storage'" />
<DonationProtocolTab v-else />
</div>
</template>
<script setup lang="ts">
import ProtocolAuditTab from './ProtocolAuditTab.vue'
import DonationProtocolTab from './DonationProtocolTab.vue'
defineOptions({ name: 'UnifiedProtocolPage' })
const props = defineProps<{
defaultSource: 'cell_storage' | 'research_donation'
}>()
type SourceKey = 'cell_storage' | 'research_donation'
const tabs: Array<{ key: SourceKey; title: string }> = [
{ key: 'cell_storage', title: '细胞存储' },
{ key: 'research_donation', title: '科研捐赠' }
]
const route = useRoute()
const router = useRouter()
const activeSource = ref<SourceKey>(props.defaultSource)
function switchSource(key: SourceKey) {
if (activeSource.value === key) return
activeSource.value = key
router.replace({ query: { ...route.query, tab: key } })
}
onMounted(() => {
const tab = String(route.query.tab || '')
if (tab === 'cell_storage' || tab === 'research_donation') {
activeSource.value = tab
return
}
activeSource.value = props.defaultSource
})
</script>