Add preview environment banner in App.vue
Shows orange warning banner on pr-{id}.oil.oci.euphon.net with PR number.
Production site (oil.oci.euphon.net) is unaffected.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
<template>
|
||||
<div v-if="isPreview" style="background:#e65100;color:white;text-align:center;padding:6px 16px;font-size:13px;font-weight:600;letter-spacing:0.5px;position:sticky;top:0;z-index:100">
|
||||
⚠️ 预览环境 · PR #{{ prId }} · 数据为生产副本,修改不影响正式环境
|
||||
</div>
|
||||
<div class="app-header" style="position:relative">
|
||||
<div class="header-inner" style="padding-right:80px">
|
||||
<div class="header-icon">🌿</div>
|
||||
@@ -82,6 +85,12 @@ const ui = useUiStore()
|
||||
const router = useRouter()
|
||||
const showUserMenu = ref(false)
|
||||
|
||||
// Preview environment detection: pr-{id}.oil.oci.euphon.net
|
||||
const hostname = window.location.hostname
|
||||
const prMatch = hostname.match(/^pr-(\d+)\./)
|
||||
const isPreview = !!prMatch
|
||||
const prId = prMatch ? prMatch[1] : ''
|
||||
|
||||
function goSection(name) {
|
||||
ui.showSection(name)
|
||||
router.push('/' + (name === 'search' ? '' : name))
|
||||
|
||||
Reference in New Issue
Block a user