feat(ops): ECR-007 行为分析与 ECR-008 内容运营后台
ci / h5 (push) Canceled after 0s
ci / api (push) Canceled after 0s
ci / ess-docs (push) Canceled after 0s

落地埋点 ingest/数据看板、首页宫格 CMS 与测评上下架;含账号引导、问答流式与免责声明去重,以及 review P1 审计同事务修复。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-07 02:26:16 +08:00
co-authored by Cursor
parent 7e9023f0a8
commit 7ab9add5dd
132 changed files with 8276 additions and 491 deletions
+36 -13
View File
@@ -1,13 +1,15 @@
import { computed, onMounted, ref } from 'vue'
import { useRoute } from 'vue-router'
import { useRoute, useRouter } from 'vue-router'
import type { GrowthReport } from '@yuxingu/types'
import { validateBirth } from '@yuxingu/utils'
import { api } from '../api/client'
import { AnalyticsEvent, track } from '../lib/analytics'
import { ensureAccount, loadSelfLatest } from '../lib/authSession'
import type { PortraitSharePayload } from '../lib/shareLink'
export function usePortraitPage() {
const route = useRoute()
const router = useRouter()
const loading = ref(false)
const needBirth = ref(true)
const error = ref('')
@@ -44,7 +46,7 @@ export function usePortraitPage() {
try {
const birth = `${y}-${String(m).padStart(2, '0')}-${String(d).padStart(2, '0')}`
const profile = await api.createProfile({ relation: 'self', birth_date: birth, display_name: '我' })
report.value = await api.createPortrait(profile.id)
report.value = await api.getLatestReport(profile.id, 'portrait')
track(AnalyticsEvent.PortraitCompleted, { source: 'form' })
} catch (e) {
error.value = e instanceof Error ? e.message : '加载失败'
@@ -67,6 +69,7 @@ export function usePortraitPage() {
}
async function load() {
if (!(await ensureAccount(router, route.fullPath))) return
const reportId = String(route.query.report_id || '')
if (reportId) {
loading.value = true
@@ -83,18 +86,38 @@ export function usePortraitPage() {
}
return
}
const y = Number(route.query.y)
const m = Number(route.query.m)
const d = Number(route.query.d)
if (y && m && d && !validateBirth(y, m, d)) {
year.value = String(y)
month.value = String(m)
day.value = String(d)
await generate(y, m, d)
return
loading.value = true
error.value = ''
try {
const cached = await loadSelfLatest('portrait')
if (cached.report) {
report.value = cached.report
needBirth.value = false
track(AnalyticsEvent.PortraitCompleted, { source: 'cache' })
return
}
if (cached.profile) {
report.value = await api.createPortrait(cached.profile.id)
needBirth.value = false
return
}
const y = Number(route.query.y)
const m = Number(route.query.m)
const d = Number(route.query.d)
if (y && m && d && !validateBirth(y, m, d)) {
year.value = String(y)
month.value = String(m)
day.value = String(d)
await generate(y, m, d)
return
}
needBirth.value = true
} catch (e) {
error.value = e instanceof Error ? e.message : '加载失败'
needBirth.value = true
} finally {
loading.value = false
}
needBirth.value = true
loading.value = false
}
function retry() {