首页细节调整

This commit is contained in:
2026-02-06 16:18:04 +08:00
parent d00f0b7412
commit 57846534bc
86 changed files with 2751 additions and 3074 deletions

View File

@@ -1,7 +1,7 @@
<template>
<template>
<view class="page" @click="closeMoreMenu">
<AnalyticsTopBar
:title="'鏁版嵁娲炲療璇︽儏'"
:title="'数据洞察详情'"
:lastUpdateTime="lastUpdateTime"
:sidebarVisible="showSidebarMenu"
@menu-click="handleMenu"
@@ -25,7 +25,7 @@
<view class="container">
<view class="card card-full">
<view class="card-head">
<text class="card-title">{{ insight.title || '娲炲療璇︽儏' }}</text>
<text class="card-title">{{ insight.title || '洞察详情' }}</text>
<view class="meta-row">
<text class="badge" :class="'badge-' + (insight.type || 'info')">{{ getInsightTypeText(insight.type) }}</text>
<text class="badge badge-impact" :class="'impact-' + (insight.impact || 'medium')">{{ getImpactText(insight.impact) }}</text>
@@ -34,7 +34,7 @@
</view>
<view v-if="loading" class="state">
<text class="state-text">鍔犺浇涓?..</text>
<text class="state-text">加载中...</text>
</view>
<view v-else-if="errorMsg" class="state">
<text class="state-text">{{ errorMsg }}</text>
@@ -46,11 +46,11 @@
<view class="card" v-if="relatedReport.id">
<view class="card-head">
<text class="card-title">鍏宠仈鎶ヨ〃</text>
<text class="card-desc">{{ relatedReport.type }} {{ relatedReport.period }}</text>
<text class="card-title">关联报表</text>
<text class="card-desc">{{ relatedReport.type }} · {{ relatedReport.period }}</text>
</view>
<view class="report-row" @click="goToReportDetail">
<view class="report-icon">馃搫</view>
<view class="report-icon">📄</view>
<view class="report-info">
<text class="report-title">{{ relatedReport.title }}</text>
<text class="report-time">{{ relatedReport.generated_at ? formatTime(relatedReport.generated_at) : '' }}</text>
@@ -110,7 +110,7 @@ onLoad((options: any) => {
const iid = (options.insightId || options.id) as string
if (!iid) {
uni.showToast({ title: '缂哄皯娲炲療ID', icon: 'none' })
uni.showToast({ title: '缺少洞察ID', icon: 'none' })
setTimeout(() => uni.navigateBack(), 1500)
return
}
@@ -131,7 +131,7 @@ async function loadInsightDetail() {
const data = await fetchInsightDetail(insightId.value)
if (data == null) {
errorMsg.value = '娲炲療涓嶅瓨鍦ㄦ垨鏃犳潈闄愯闂?
errorMsg.value = '洞察不存在或无权限访问'
return
}
@@ -165,7 +165,7 @@ async function loadInsightDetail() {
}
} catch (e) {
console.error('loadInsightDetail failed', e)
errorMsg.value = mapAnalyticsError(e, { fallbackMessage: '鍔犺浇澶辫触锛岃绋嶅悗閲嶈瘯' })
errorMsg.value = mapAnalyticsError(e, { fallbackMessage: '加载失败,请稍后重试' })
} finally {
loading.value = false
}
@@ -173,13 +173,13 @@ async function loadInsightDetail() {
function refreshData() {
void loadInsightDetail()
uni.showToast({ title: '宸插埛鏂?, icon: 'success' })
uni.showToast({ title: '已刷新', icon: 'success' })
}
function exportReport() {
uni.showActionSheet({
itemList: ['瀵煎嚭Excel', '瀵煎嚭PDF', '瀵煎嚭鍥剧墖'],
success: () => uni.showToast({ title: '瀵煎嚭鎴愬姛', icon: 'success' })
itemList: ['导出Excel', '导出PDF', '导出图片'],
success: () => uni.showToast({ title: '导出成功', icon: 'success' })
})
}
@@ -198,21 +198,21 @@ function formatTime(timeStr: string): string {
function getInsightTypeText(type: string): string {
const t = `${type || 'info'}`
const map: Record<string, string> = {
positive: '姝e悜',
warning: '棰勮',
negative: '椋庨櫓',
info: '淇℃伅'
positive: '正向',
warning: '预警',
negative: '风险',
info: '信息'
}
return map[t] || '淇℃伅'
return map[t] || '信息'
}
function getImpactText(impact: string): string {
const impacts: Record<string, string> = {
high: '楂樺奖鍝?,
medium: '涓奖鍝?,
low: '浣庡奖鍝?
high: '高影响',
medium: '中影响',
low: '低影响'
}
return impacts[impact || 'medium'] || '涓奖鍝?
return impacts[impact || 'medium'] || '中影响'
}
function goToReportDetail() {
@@ -239,27 +239,27 @@ function closeMoreMenu() {
}
function handleSearch() {
uni.showToast({ title: '鎼滅储', icon: 'none' })
uni.showToast({ title: '搜索', icon: 'none' })
}
function handleNotification() {
uni.showToast({ title: '閫氱煡', icon: 'none' })
uni.showToast({ title: '通知', icon: 'none' })
}
function handleFullscreen() {
uni.showToast({ title: '鍏ㄥ睆', icon: 'none' })
uni.showToast({ title: '全屏', icon: 'none' })
}
function handleMobile() {
uni.showToast({ title: '绉诲姩绔?, icon: 'none' })
uni.showToast({ title: '移动端', icon: 'none' })
}
function handleDropdown() {
uni.showToast({ title: '涓嬫媺鑿滃崟', icon: 'none' })
uni.showToast({ title: '下拉菜单', icon: 'none' })
}
function handleSettings() {
uni.showToast({ title: '璁剧疆', icon: 'none' })
uni.showToast({ title: '设置', icon: 'none' })
}
</script>
@@ -287,8 +287,7 @@ function handleSettings() {
width: 100%;
max-width: 1280px;
margin: 0 auto;
/* padding removed */ 16px 28px;
padding: 16px 16px 28px;
box-sizing: border-box;
}
</style>