feat(ECR-043): StarConfig 写面闭环并 Closed
加法权限 admin.explore.write、POST/PUT+审计、C端 GET /star/configs、 H5 无 active 空态/失败回退;migration 000052。ExploreConfig Loop STOP,禁自动 ECR-044。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -36,6 +36,8 @@ export function useStarProfilePage() {
|
||||
const loading = ref(false)
|
||||
const needBirth = ref(true)
|
||||
const error = ref('')
|
||||
/** Fail-open: true until proven empty; API error keeps generation. */
|
||||
const configAvailable = ref(true)
|
||||
const report = ref<GrowthReport | null>(null)
|
||||
const paying = ref(false)
|
||||
const shareOpen = ref(false)
|
||||
@@ -149,7 +151,21 @@ export function useStarProfilePage() {
|
||||
clearDayTimer()
|
||||
}
|
||||
|
||||
async function refreshConfigGate() {
|
||||
try {
|
||||
const res = await api.getStarConfigs()
|
||||
configAvailable.value = (res.items || []).length > 0
|
||||
} catch {
|
||||
configAvailable.value = true
|
||||
}
|
||||
}
|
||||
|
||||
async function generate(y: number, m: number, d: number) {
|
||||
if (!configAvailable.value) {
|
||||
error.value = '星座配置暂未开放'
|
||||
needBirth.value = true
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
error.value = ''
|
||||
needBirth.value = false
|
||||
@@ -175,6 +191,10 @@ export function useStarProfilePage() {
|
||||
}
|
||||
|
||||
async function start() {
|
||||
if (!configAvailable.value) {
|
||||
error.value = '星座配置暂未开放'
|
||||
return
|
||||
}
|
||||
const y = Number(year.value)
|
||||
const m = Number(month.value)
|
||||
const d = Number(day.value)
|
||||
@@ -188,6 +208,7 @@ export function useStarProfilePage() {
|
||||
|
||||
async function load() {
|
||||
if (!(await ensureAccount(router, route.fullPath))) return
|
||||
await refreshConfigGate()
|
||||
const reportId = String(route.query.report_id || '')
|
||||
if (reportId) {
|
||||
loading.value = true
|
||||
@@ -204,6 +225,11 @@ export function useStarProfilePage() {
|
||||
}
|
||||
return
|
||||
}
|
||||
if (!configAvailable.value) {
|
||||
needBirth.value = true
|
||||
report.value = null
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
try {
|
||||
const cached = await loadSelfLatest('star')
|
||||
@@ -268,6 +294,7 @@ export function useStarProfilePage() {
|
||||
return {
|
||||
loading,
|
||||
needBirth,
|
||||
configAvailable,
|
||||
error,
|
||||
report,
|
||||
paying,
|
||||
|
||||
@@ -17,8 +17,15 @@
|
||||
</template>
|
||||
|
||||
<div class="body">
|
||||
<div v-if="!configAvailable && !report" class="empty-gate">
|
||||
<HomeToolIcon name="star" :size="56" />
|
||||
<p class="empty-title">星座配置暂未开放</p>
|
||||
<p class="empty-sub">运营尚未启用星座配置,请稍后再来</p>
|
||||
<button class="cta-off" type="button" disabled>生成我的星座</button>
|
||||
</div>
|
||||
|
||||
<StarBirthForm
|
||||
v-if="needBirth && !report"
|
||||
v-else-if="needBirth && !report"
|
||||
v-model:year="year"
|
||||
v-model:month="month"
|
||||
v-model:day="day"
|
||||
@@ -110,6 +117,7 @@ const { selfLabel } = useAccountNickname()
|
||||
const {
|
||||
loading,
|
||||
needBirth,
|
||||
configAvailable,
|
||||
error,
|
||||
report,
|
||||
paying,
|
||||
@@ -195,4 +203,35 @@ function onPlanetSelect(key: string) {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.body { padding: 8px 16px 24px; }
|
||||
.empty-gate {
|
||||
text-align: center;
|
||||
padding: 28px 16px 12px;
|
||||
}
|
||||
.empty-title {
|
||||
font-family: var(--font-display);
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
margin-top: 10px;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
.empty-sub {
|
||||
font-size: 13px;
|
||||
color: rgba(0, 0, 0, 0.42);
|
||||
margin-top: 8px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.cta-off {
|
||||
margin-top: 16px;
|
||||
width: 100%;
|
||||
max-width: 320px;
|
||||
padding: 13px;
|
||||
border: none;
|
||||
border-radius: 22px;
|
||||
color: #fff;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
background: linear-gradient(135deg, #ff7a6e, var(--color-primary));
|
||||
opacity: 0.45;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user