better-staridc-MNBT
1<template>
2 <div class="td-page td-user-dashboard">
3 <!-- 欢迎区 -->
4 <section class="hero">
5 <div class="hero-left">
6 <h2 class="hero-title">{{ greeting }},{{ user }}</h2>
7 <p class="hero-sub">
8 欢迎回到 {{ siteName }} 控制面板 ·
9 <span class="hero-time">{{ nowTime }}</span>
10 </p>
11 </div>
12 <div class="hero-right">
13 <t-button theme="primary" @click="$router.push('/settings/password')">
14 <i class="mdi mdi-key-variant"></i>
15 修改密码
16 </t-button>
17 </div>
18 </section>
19
20 <!-- 资源使用 gauge 仪表盘 -->
21 <section class="section">
22 <div class="section-title">
23 <i class="mdi mdi-chart-arc"></i>
24 <span>资源使用</span>
25 </div>
26 <div class="gauge-grid">
27 <!-- 网页空间 -->
28 <div class="gauge-card">
29 <div class="gauge-head">
30 <div class="gauge-title">
31 <i class="mdi mdi-web"></i>
32 <span>网页空间</span>
33 </div>
34 <t-tag theme="default" size="small" shape="round" variant="light">
35 {{ formatSpaceText(hxa) }}
36 </t-tag>
37 </div>
38 <div ref="hxaGaugeRef" class="gauge-body"></div>
39 <div class="gauge-foot">
40 已用 {{ hxa.dq || 0 }} MB · {{ hxa.max === 0 ? '不限上限' : `上限 ${hxa.max} MB` }}
41 </div>
42 </div>
43
44 <!-- 数据库空间 -->
45 <div class="gauge-card">
46 <div class="gauge-head">
47 <div class="gauge-title">
48 <i class="mdi mdi-database"></i>
49 <span>数据库空间</span>
50 </div>
51 <t-tag theme="default" size="small" shape="round" variant="light">
52 {{ formatSpaceText(hxb) }}
53 </t-tag>
54 </div>
55 <div ref="hxbGaugeRef" class="gauge-body"></div>
56 <div class="gauge-foot">
57 已用 {{ hxb.dq || 0 }} MB · {{ hxb.max === 0 ? '不限上限' : `上限 ${hxb.max} MB` }}
58 </div>
59 </div>
60
61 <!-- 流量使用 -->
62 <div class="gauge-card">
63 <div class="gauge-head">
64 <div class="gauge-title">
65 <i class="mdi mdi-chart-line-variant"></i>
66 <span>流量使用</span>
67 </div>
68 <t-tag theme="default" size="small" shape="round" variant="light">
69 {{ formatFlowText(llmax) }}
70 </t-tag>
71 </div>
72 <div ref="llmaxGaugeRef" class="gauge-body"></div>
73 <div class="gauge-foot">
74 已用 {{ llmax.dq || 0 }} G · {{ llmax.max === 0 ? '不限上限' : `上限 ${llmax.max} G` }}
75 </div>
76 </div>
77 </div>
78 </section>
79
80 <!-- 站点信息:顶部平铺快捷操作 + 下方信息卡片 -->
81 <section class="section">
82 <div class="section-title">
83 <i class="mdi mdi-information-outline"></i>
84 <span>站点信息</span>
85 </div>
86
87 <!-- 顶部平铺快捷操作区(宽度与下方信息区相同)-->
88 <div class="quick-actions-bar">
89 <div class="quick-actions-head">
90 <i class="mdi mdi-lightning-bolt"></i>
91 <span>快捷操作</span>
92 </div>
93 <div class="quick-actions-grid">
94 <router-link
95 v-for="item in quickNavItems"
96 :key="item.path"
97 :to="item.path"
98 custom
99 v-slot="{ navigate, isActive }"
100 >
101 <a
102 href="javascript:;"
103 class="quick-action-btn"
104 :class="{ active: isActive }"
105 @click="navigate"
106 >
107 <i class="mdi quick-action-icon" :class="item.icon"></i>
108 <span class="quick-action-label">{{ item.label }}</span>
109 </a>
110 </router-link>
111 </div>
112 </div>
113
114 <!-- 信息卡片网格 -->
115 <div class="info-grid">
116 <!-- 基本信息 -->
117 <div class="info-card">
118 <div class="info-card-head">
119 <div class="info-card-icon info-card-icon-blue">
120 <i class="mdi mdi-earth"></i>
121 </div>
122 <div class="info-card-name">
123 <strong>基本信息</strong>
124 <span>Basic Information</span>
125 </div>
126 <t-tag
127 :theme="siteStatusTag.theme"
128 size="small"
129 shape="round"
130 variant="light"
131 >
132 <i class="mdi mdi-circle-medium"></i>{{ siteStatusTag.text }}
133 </t-tag>
134 </div>
135 <table class="info-tbl">
136 <tbody>
137 <tr><td>主域名</td><td>{{ yhc.url || yhc.domain || '-' }}</td></tr>
138 <tr><td>所属宝塔</td><td>{{ yhc.ssbt || yhc.bt || '-' }}</td></tr>
139 <tr><td>开通时间</td><td>{{ yhc.data || '-' }}</td></tr>
140 <tr>
141 <td>到期时间</td>
142 <td :class="{ 'td-text-danger': isExpired(yhc.datae) }">
143 {{ yhc.datae || '永久' }}
144 <t-tag v-if="isExpired(yhc.datae)" theme="danger" size="small" variant="light" shape="round">已到期</t-tag>
145 </td>
146 </tr>
147 <tr><td>主机状态</td><td>{{ siteStatusTag.text }}</td></tr>
148 </tbody>
149 </table>
150 </div>
151
152 <!-- 账号信息 -->
153 <div class="info-card">
154 <div class="info-card-head">
155 <div class="info-card-icon info-card-icon-purple">
156 <i class="mdi mdi-account-key"></i>
157 </div>
158 <div class="info-card-name">
159 <strong>账号信息</strong>
160 <span>Account Credentials</span>
161 </div>
162 </div>
163 <table class="info-tbl">
164 <tbody>
165 <tr><td>FTP 账号</td><td>{{ yhc.user || '-' }}</td></tr>
166 <tr><td>FTP 密码</td><td>••••••••(已隐藏)</td></tr>
167 <tr><td>SQL 账号</td><td>{{ yhc.sqluser || '-' }}</td></tr>
168 <tr><td>SQL 密码</td><td>••••••••(已隐藏)</td></tr>
169 <tr><td>SQL 数据库</td><td>{{ yhc.sqldz || '-' }}</td></tr>
170 <tr><td>SQL ID</td><td>{{ yhc.hxd || '-' }}</td></tr>
171 </tbody>
172 </table>
173 </div>
174
175 <!-- 配额信息 -->
176 <div class="info-card">
177 <div class="info-card-head">
178 <div class="info-card-icon info-card-icon-green">
179 <i class="mdi mdi-scale"></i>
180 </div>
181 <div class="info-card-name">
182 <strong>配额信息</strong>
183 <span>Resource Quota</span>
184 </div>
185 </div>
186 <table class="info-tbl">
187 <tbody>
188 <tr><td>网页空间</td><td>{{ formatSpaceText(hxa) }}</td></tr>
189 <tr><td>数据库空间</td><td>{{ formatSpaceText(hxb) }}</td></tr>
190 <tr><td>流量上限</td><td>{{ formatFlowText(llmax) }}</td></tr>
191 <tr><td>域名绑定数</td><td>{{ yhc.ymbds || '不限' }} 个</td></tr>
192 <tr><td>宝塔站点 ID</td><td>{{ yhc.btid || '-' }}</td></tr>
193 <tr><td>FTP ID</td><td>{{ yhc.ftpid || '-' }}</td></tr>
194 </tbody>
195 </table>
196 </div>
197
198 <!-- 联系信息 -->
199 <div class="info-card">
200 <div class="info-card-head">
201 <div class="info-card-icon info-card-icon-orange">
202 <i class="mdi mdi-email-outline"></i>
203 </div>
204 <div class="info-card-name">
205 <strong>联系信息</strong>
206 <span>Contact Information</span>
207 </div>
208 </div>
209 <table class="info-tbl">
210 <tbody>
211 <tr>
212 <td>绑定邮箱</td>
213 <td>
214 <span v-if="yhc.mailuser">{{ yhc.mailuser }}</span>
215 <span v-else class="td-text-warning">未绑定</span>
216 </td>
217 </tr>
218 <tr><td>主机 ID</td><td>#{{ yhc.id || '-' }}</td></tr>
219 <tr><td>产品类型</td><td>{{ productTypeText }}</td></tr>
220 <tr><td>服务器时间</td><td>{{ nowTime }}</td></tr>
221 </tbody>
222 </table>
223 <div class="info-card-actions">
224 <t-button
225 v-if="!yhc.mailuser"
226 theme="primary"
227 size="small"
228 variant="outline"
229 @click="showMailBind = true"
230 >
231 <i class="mdi mdi-email-plus-outline"></i> 绑定邮箱
232 </t-button>
233 <t-button
234 theme="default"
235 size="small"
236 variant="outline"
237 @click="$router.push('/settings/password')"
238 >
239 <i class="mdi mdi-key-change"></i> 修改密码
240 </t-button>
241 </div>
242 </div>
243 </div>
244 </section>
245
246 <!-- 月度流量趋势 echarts 图表 -->
247 <section class="section">
248 <div class="section-title">
249 <i class="mdi mdi-chart-bar"></i>
250 <span>月度流量趋势</span>
251 <span v-if="trendText" class="trend-indicator" v-html="trendText"></span>
252 </div>
253 <div class="chart-card">
254 <div ref="trafficChartRef" class="traffic-chart"></div>
255 <div v-if="!hasChartData" class="chart-empty">
256 <i class="mdi mdi-chart-bar-stacked"></i>
257 <span>暂无流量数据</span>
258 </div>
259 </div>
260 </section>
261
262 <!-- 邮箱绑定弹窗 -->
263 <MailBindDialog
264 v-model:visible="showMailBind"
265 :required="mailBindRequired"
266 @success="onMailBound"
267 />
268 </div>
269</template>
270
271<script setup>
272import { ref, computed, onMounted, onBeforeUnmount, nextTick, watch } from 'vue'
273import { refreshSpace, getIndexConf } from '@/user/api/common'
274import MailBindDialog from '@/user/components/MailBindDialog.vue'
275import echarts from '@/shared/utils/echarts'
276
277const boot = window.__TD_BOOT__ || {}
278const siteName = boot.siteName || 'MNBT'
279const user = boot.user || 'user'
280const yhc = boot.yhc || {}
281
282const nowTime = ref('')
283let timer = null
284
285// ============== 弹窗控制 ==============
286const showMailBind = ref(false)
287// 邮箱未绑定时,自动弹出且不允许关闭
288const mailBindRequired = ref(!yhc.mailuser)
289
290// ============== 空间数据 ==============
291function parseSpace(v) {
292 if (v == null) return { dq: 0, max: 0 }
293 if (typeof v === 'object') return { dq: Number(v.dq) || 0, max: Number(v.max) || 0 }
294 try {
295 const o = JSON.parse(v)
296 return { dq: Number(o.dq) || 0, max: Number(o.max) || 0 }
297 } catch {
298 return { dq: 0, max: 0 }
299 }
300}
301
302const hxa = ref(parseSpace(yhc.hxa))
303const hxb = ref(parseSpace(yhc.hxb))
304const llmax = ref(parseSpace(yhc.llmax))
305
306// 保存原始 lls 数据,用于绘制趋势图
307const rawLls = ref(null)
308
309function calcPercent(o) {
310 if (!o.max || o.max === 0) return 0
311 return Math.min(100, Math.round((o.dq / o.max) * 100))
312}
313
314const hxaPercent = computed(() => calcPercent(hxa.value))
315const hxbPercent = computed(() => calcPercent(hxb.value))
316const llmaxPercent = computed(() => calcPercent(llmax.value))
317
318function formatSpaceText(o) {
319 if (o.max === 0) return `${o.dq || 0} / ∞ MB`
320 return `${o.dq || 0} / ${o.max} MB`
321}
322function formatFlowText(o) {
323 if (o.max === 0) return `${o.dq || 0} / ∞ G`
324 return `${o.dq || 0} / ${o.max} G`
325}
326
327function isExpired(datae) {
328 if (!datae) return false
329 const d = new Date(datae)
330 if (isNaN(d.getTime())) return false
331 return d.getTime() < Date.now()
332}
333
334const siteStatusTag = computed(() => {
335 const off = yhc.qk === false || yhc.qk === 'false' || yhc.qk === 0 || yhc.qk === '0'
336 if (off) return { theme: 'danger', text: '已关闭' }
337 if (isExpired(yhc.datae)) return { theme: 'warning', text: '已到期' }
338 return { theme: 'success', text: '正常运行' }
339})
340
341const productTypeText = computed(() => {
342 const t = yhc.hxc
343 if (t === '2' || t === 2) return '虚拟主机'
344 if (t === '1' || t === 1) return '云服务器'
345 return t ? `类型 ${t}` : '虚拟主机'
346})
347
348// ============== 快捷跳转栏 ==============
349const quickNavItems = [
350 { path: '/settings/php', label: 'PHP 版本', icon: 'mdi-language-php' },
351 { path: '/settings/ssl', label: 'SSL 配置', icon: 'mdi-shield-lock-outline' },
352 { path: '/settings/rewrite', label: '伪静态', icon: 'mdi-file-replace-outline' },
353 { path: '/settings/run-dir', label: '运行目录', icon: 'mdi-folder-outline' },
354 { path: '/ftp', label: '文件管理', icon: 'mdi-folder-multiple-outline' },
355 { path: '/monitor', label: '监控任务', icon: 'mdi-radar' },
356 { path: '/stats', label: '站点统计', icon: 'mdi-chart-bar' },
357 { path: '/deploy', label: '一键部署', icon: 'mdi-webpack' },
358]
359
360const greeting = computed(() => {
361 const h = new Date().getHours()
362 if (h < 6) return '凌晨好'
363 if (h < 9) return '早上好'
364 if (h < 12) return '上午好'
365 if (h < 14) return '中午好'
366 if (h < 18) return '下午好'
367 return '晚上好'
368})
369
370function tickTime() {
371 nowTime.value = new Date().toLocaleString('zh-CN', { hour12: false })
372}
373
374async function loadSpace() {
375 const r = await refreshSpace()
376 if (r.ok && r.data) {
377 const d = r.data
378 if (d.hxa) hxa.value = parseSpace(d.hxa)
379 if (d.hxb) hxb.value = parseSpace(d.hxb)
380 if (d.llmax) llmax.value = parseSpace(d.llmax)
381 nextTick(renderGauges)
382 }
383}
384
385/** 从 indexconf 合并空间/流量数据 */
386function applyIndexConf(conf) {
387 if (!conf) return
388 if (conf.web) {
389 hxa.value = { dq: Number(conf.web.dq) || 0, max: Number(conf.web.max) || 0 }
390 }
391 if (conf.sql) {
392 hxb.value = { dq: Number(conf.sql.dq) || 0, max: Number(conf.sql.max) || 0 }
393 }
394 if (conf.lls) {
395 rawLls.value = conf.lls
396 const dqBytes = Number(conf.lls.dq) || 0
397 const maxG = Number(conf.lls.max) || 0
398 llmax.value = { dq: +(dqBytes / (1024 * 1024 * 1024)).toFixed(2), max: maxG }
399 nextTick(() => {
400 renderGauges()
401 renderChart()
402 })
403 }
404}
405
406async function loadIndexConf() {
407 const r = await getIndexConf()
408 if (r.ok && r.data) applyIndexConf(r.data)
409}
410
411function onMailBound(mail) {
412 // 同步更新 boot.yhc,避免再次自动弹出
413 window.__TD_BOOT__ = {
414 ...(window.__TD_BOOT__ || {}),
415 yhc: { ...(window.__TD_BOOT__?.yhc || {}), mailuser: mail },
416 }
417 mailBindRequired.value = false
418}
419
420// ============== echarts gauge 仪表盘 ==============
421const hxaGaugeRef = ref(null)
422const hxbGaugeRef = ref(null)
423const llmaxGaugeRef = ref(null)
424let hxaChart = null
425let hxbChart = null
426let llmaxChart = null
427
428function buildGaugeOption(value, opts = {}) {
429 const { color = '#0052d9', unlimited = false } = opts
430 let theme = '#2ba471'
431 if (value > 80) theme = '#d54941'
432 else if (value > 60) theme = '#e37318'
433
434 // 不限时显示"不限"而非 0%
435 const detailFormatter = unlimited ? '不限' : `{value}%`
436
437 return {
438 series: [
439 {
440 type: 'gauge',
441 startAngle: 210,
442 endAngle: -30,
443 min: 0,
444 max: 100,
445 progress: {
446 show: !unlimited,
447 width: 12,
448 roundCap: true,
449 itemStyle: { color: theme },
450 },
451 axisLine: {
452 lineStyle: {
453 width: 12,
454 color: [[1, '#ebedf0']],
455 },
456 },
457 pointer: { show: false },
458 axisTick: { show: false },
459 splitLine: { show: false },
460 axisLabel: { show: false },
461 anchor: { show: false },
462 title: { show: false },
463 detail: {
464 valueAnimation: true,
465 fontSize: 24,
466 fontWeight: 700,
467 color: theme,
468 offsetCenter: [0, '0%'],
469 formatter: detailFormatter,
470 },
471 data: [{ value: unlimited ? 0 : value }],
472 color,
473 },
474 ],
475 }
476}
477
478function renderGauges() {
479 if (hxaGaugeRef.value) {
480 if (!hxaChart) hxaChart = echarts.init(hxaGaugeRef.value)
481 hxaChart.setOption(buildGaugeOption(hxaPercent.value, {
482 color: '#0052d9',
483 unlimited: hxa.value.max === 0,
484 }))
485 }
486 if (hxbGaugeRef.value) {
487 if (!hxbChart) hxbChart = echarts.init(hxbGaugeRef.value)
488 hxbChart.setOption(buildGaugeOption(hxbPercent.value, {
489 color: '#7c3aed',
490 unlimited: hxb.value.max === 0,
491 }))
492 }
493 if (llmaxGaugeRef.value) {
494 if (!llmaxChart) llmaxChart = echarts.init(llmaxGaugeRef.value)
495 llmaxChart.setOption(buildGaugeOption(llmaxPercent.value, {
496 color: '#e37318',
497 unlimited: llmax.value.max === 0,
498 }))
499 }
500}
501
502function resizeGauges() {
503 hxaChart?.resize()
504 hxbChart?.resize()
505 llmaxChart?.resize()
506}
507
508// ============== echarts 月度流量趋势图 ==============
509const trafficChartRef = ref(null)
510let chartInstance = null
511const trendText = ref('')
512const hasChartData = ref(false)
513
514function buildChartData() {
515 const lls = rawLls.value
516 if (!lls) return { labels: [], values: [] }
517 const history = lls.history || {}
518 const months = Object.keys(history).sort()
519 const labels = []
520 const values = []
521 months.forEach(m => {
522 const mm = parseInt(String(m).split('-')[1], 10)
523 labels.push(isNaN(mm) ? m : mm + '月')
524 values.push(+(Number(history[m]) / (1024 * 1024 * 1024)).toFixed(2))
525 })
526 // 追加本月
527 const curDq = Number(lls.dq) || 0
528 if (curDq > 0 || labels.length > 0) {
529 labels.push('本月')
530 values.push(+(curDq / (1024 * 1024 * 1024)).toFixed(2))
531 }
532 return { labels, values }
533}
534
535function calcTrend(values) {
536 if (!values || values.length < 2) {
537 if (values && values.length === 1) {
538 trendText.value = `本月用量 <span style="color:#7367f0;font-weight:bold">${values[0].toFixed(2)} GB</span>`
539 } else {
540 trendText.value = ''
541 }
542 return
543 }
544 const prev = values[values.length - 2]
545 const curr = values[values.length - 1]
546 if (prev > 0) {
547 const pct = ((curr - prev) / prev * 100).toFixed(1)
548 const arrow = curr >= prev ? '↑' : '↓'
549 const color = curr >= prev ? '#ea5455' : '#28c76f'
550 trendText.value =
551 `较上月 <span style="color:${color};font-weight:bold">${arrow} ${Math.abs(curr - prev).toFixed(2)} GB` +
552 ` (${pct >= 0 ? '+' : ''}${pct}%)</span>`
553 } else {
554 trendText.value = `本月用量 <span style="color:#7367f0;font-weight:bold">${curr.toFixed(2)} GB</span>`
555 }
556}
557
558function buildOption(labels, values) {
559 return {
560 grid: { top: 36, right: 18, bottom: 30, left: 42 },
561 tooltip: {
562 trigger: 'axis',
563 axisPointer: { type: 'shadow' },
564 valueFormatter: v => (v == null ? '-' : Number(v).toFixed(2) + ' GB'),
565 },
566 legend: {
567 top: 4,
568 right: 8,
569 data: ['流量用量 (GB)', '趋势'],
570 icon: 'roundRect',
571 itemWidth: 14,
572 itemHeight: 8,
573 textStyle: { fontSize: 12 },
574 },
575 xAxis: {
576 type: 'category',
577 data: labels,
578 axisLine: { lineStyle: { color: '#e3e8ef' } },
579 axisLabel: { color: '#666', fontSize: 12 },
580 axisTick: { show: false },
581 },
582 yAxis: {
583 type: 'value',
584 name: 'GB',
585 nameTextStyle: { color: '#999', fontSize: 11 },
586 axisLine: { show: false },
587 axisLabel: { color: '#666', fontSize: 12 },
588 splitLine: { lineStyle: { color: '#f0f2f5', type: 'dashed' } },
589 },
590 series: [
591 {
592 name: '流量用量 (GB)',
593 type: 'bar',
594 data: values,
595 barWidth: '46%',
596 itemStyle: {
597 color: {
598 type: 'linear',
599 x: 0, y: 0, x2: 0, y2: 1,
600 colorStops: [
601 { offset: 0, color: 'rgba(23, 162, 184, 0.85)' },
602 { offset: 1, color: 'rgba(23, 162, 184, 0.45)' },
603 ],
604 },
605 borderRadius: [4, 4, 0, 0],
606 },
607 },
608 {
609 name: '趋势',
610 type: 'line',
611 data: values,
612 smooth: true,
613 symbol: 'circle',
614 symbolSize: 7,
615 lineStyle: { color: '#7367f0', width: 2 },
616 itemStyle: { color: '#7367f0', borderColor: '#fff', borderWidth: 2 },
617 areaStyle: {
618 color: {
619 type: 'linear',
620 x: 0, y: 0, x2: 0, y2: 1,
621 colorStops: [
622 { offset: 0, color: 'rgba(115, 103, 240, 0.18)' },
623 { offset: 1, color: 'rgba(115, 103, 240, 0)' },
624 ],
625 },
626 },
627 },
628 ],
629 }
630}
631
632function renderChart() {
633 if (!trafficChartRef.value) return
634 const { labels, values } = buildChartData()
635 hasChartData.value = values.length > 0
636 calcTrend(values)
637 if (!hasChartData.value) return
638
639 if (!chartInstance) {
640 chartInstance = echarts.init(trafficChartRef.value)
641 }
642 chartInstance.setOption(buildOption(labels, values), true)
643
644 // 自适应容器尺寸
645 chartInstance.resize()
646}
647
648function handleResize() {
649 resizeGauges()
650 if (chartInstance) chartInstance.resize()
651}
652
653// 数据更新后重绘
654watch([rawLls, hxa, hxb, llmax], () => {
655 nextTick(() => {
656 renderGauges()
657 renderChart()
658 })
659})
660
661onMounted(() => {
662 tickTime()
663 timer = setInterval(tickTime, 1000)
664 loadSpace()
665 loadIndexConf()
666 // 强制邮箱绑定时自动弹出
667 if (mailBindRequired.value) {
668 nextTick(() => { showMailBind.value = true })
669 }
670 window.addEventListener('resize', handleResize)
671 // 首次渲染 gauge(基于 boot 数据)
672 nextTick(renderGauges)
673})
674
675onBeforeUnmount(() => {
676 if (timer) clearInterval(timer)
677 window.removeEventListener('resize', handleResize)
678 if (chartInstance) {
679 chartInstance.dispose()
680 chartInstance = null
681 }
682 hxaChart?.dispose()
683 hxbChart?.dispose()
684 llmaxChart?.dispose()
685})
686</script>
687
688<style scoped>
689.td-user-dashboard {
690 padding: 20px;
691}
692
693/* ============== 欢迎区 ============== */
694.hero {
695 display: flex;
696 align-items: center;
697 justify-content: space-between;
698 gap: 16px;
699 padding: 22px 24px;
700 margin-bottom: 18px;
701 background: linear-gradient(135deg, #ffffff 0%, #f5f8ff 100%);
702 border: 1px solid var(--td-border);
703 border-radius: var(--td-radius-xl);
704 box-shadow: var(--td-shadow-sm);
705 flex-wrap: wrap;
706 animation: td-fade-in var(--td-dur-lg) var(--td-ease-out);
707}
708.hero-left {
709 min-width: 0;
710 flex: 1;
711}
712.hero-title {
713 margin: 0;
714 font-size: 22px;
715 font-weight: 700;
716 color: var(--td-text);
717 letter-spacing: 0.3px;
718 line-height: 1.3;
719}
720.hero-sub {
721 margin: 6px 0 0;
722 font-size: 13px;
723 color: var(--td-text-secondary);
724}
725.hero-time {
726 color: var(--td-text-placeholder);
727 font-variant-numeric: tabular-nums;
728}
729.hero-right {
730 display: flex;
731 align-items: center;
732 gap: 10px;
733 flex-wrap: wrap;
734}
735
736/* ============== Section ============== */
737.section {
738 margin-top: 22px;
739}
740.section-title {
741 display: flex;
742 align-items: center;
743 gap: 8px;
744 font-size: 15px;
745 font-weight: 600;
746 margin: 0 0 14px 0;
747 color: var(--td-text);
748 letter-spacing: 0.2px;
749}
750.section-title i {
751 font-size: 18px;
752 color: var(--td-brand);
753}
754.trend-indicator {
755 margin-left: auto;
756 font-size: 12px;
757 font-weight: 400;
758 color: var(--td-text-secondary);
759}
760
761/* ============== Gauge 仪表盘 ============== */
762.gauge-grid {
763 display: grid;
764 grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
765 gap: 14px;
766}
767.gauge-card {
768 background: var(--td-surface);
769 border: 1px solid var(--td-border);
770 border-radius: var(--td-radius-lg);
771 box-shadow: var(--td-shadow-sm);
772 overflow: hidden;
773 transition: box-shadow var(--td-dur) var(--td-ease);
774}
775.gauge-card:hover {
776 box-shadow: var(--td-shadow-md);
777}
778.gauge-head {
779 display: flex;
780 align-items: center;
781 justify-content: space-between;
782 gap: 8px;
783 padding: 14px 16px 0;
784}
785.gauge-title {
786 display: flex;
787 align-items: center;
788 gap: 6px;
789 font-size: 13px;
790 font-weight: 600;
791 color: var(--td-text);
792}
793.gauge-title i {
794 font-size: 16px;
795 color: var(--td-brand);
796}
797.gauge-body {
798 width: 100%;
799 height: 180px;
800}
801.gauge-foot {
802 padding: 0 16px 14px;
803 font-size: 11px;
804 color: var(--td-text-placeholder);
805 text-align: center;
806}
807
808/* ============== 图表卡片 ============== */
809.chart-card {
810 position: relative;
811 background: var(--td-surface);
812 border: 1px solid var(--td-border);
813 border-radius: var(--td-radius-lg);
814 box-shadow: var(--td-shadow-sm);
815 padding: 14px 16px;
816}
817.traffic-chart {
818 width: 100%;
819 height: 280px;
820}
821.chart-empty {
822 position: absolute;
823 inset: 0;
824 display: flex;
825 flex-direction: column;
826 align-items: center;
827 justify-content: center;
828 gap: 8px;
829 color: var(--td-text-placeholder);
830 font-size: 13px;
831 pointer-events: none;
832}
833.chart-empty i {
834 font-size: 38px;
835 color: #cbd5e1;
836}
837
838/* ============== 快捷操作平铺区 ============== */
839.quick-actions-bar {
840 background: var(--td-surface);
841 border: 1px solid var(--td-border);
842 border-radius: var(--td-radius-lg);
843 box-shadow: var(--td-shadow-sm);
844 overflow: hidden;
845 margin-bottom: 14px;
846}
847.quick-actions-head {
848 display: flex;
849 align-items: center;
850 gap: 6px;
851 padding: 12px 16px;
852 font-size: 13px;
853 font-weight: 600;
854 color: var(--td-text);
855 border-bottom: 1px solid var(--td-border);
856 background: linear-gradient(135deg, #fffbe6 0%, #ffffff 100%);
857}
858.quick-actions-head i {
859 font-size: 16px;
860 color: #e37318;
861}
862.quick-actions-grid {
863 display: grid;
864 grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
865 gap: 6px;
866 padding: 10px;
867}
868.quick-action-btn {
869 display: flex;
870 flex-direction: column;
871 align-items: center;
872 justify-content: center;
873 gap: 6px;
874 padding: 14px 8px;
875 border-radius: 10px;
876 color: var(--td-text-secondary);
877 font-size: 12px;
878 text-decoration: none;
879 cursor: pointer;
880 text-align: center;
881 transition: background var(--td-dur) var(--td-ease),
882 color var(--td-dur) var(--td-ease),
883 transform var(--td-dur) var(--td-ease),
884 box-shadow var(--td-dur) var(--td-ease);
885}
886.quick-action-icon {
887 font-size: 22px;
888 color: var(--td-text-placeholder);
889 transition: color var(--td-dur) var(--td-ease),
890 transform var(--td-dur) var(--td-ease);
891}
892.quick-action-label {
893 white-space: nowrap;
894 overflow: hidden;
895 text-overflow: ellipsis;
896 max-width: 100%;
897}
898.quick-action-btn:hover {
899 background: var(--td-brand-light, #e8f3ff);
900 color: var(--td-brand);
901 transform: translateY(-2px);
902 box-shadow: 0 4px 12px rgba(0, 82, 217, 0.08);
903}
904.quick-action-btn:hover .quick-action-icon {
905 color: var(--td-brand);
906 transform: scale(1.1);
907}
908.quick-action-btn.active {
909 background: var(--td-brand-light, #e8f3ff);
910 color: var(--td-brand);
911 font-weight: 500;
912}
913.quick-action-btn.active .quick-action-icon {
914 color: var(--td-brand);
915}
916
917/* ============== 信息卡片 ============== */
918.info-grid {
919 display: grid;
920 grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
921 gap: 14px;
922}
923.info-card {
924 background: var(--td-surface);
925 border: 1px solid var(--td-border);
926 border-radius: var(--td-radius-lg);
927 box-shadow: var(--td-shadow-sm);
928 overflow: hidden;
929 transition: box-shadow var(--td-dur) var(--td-ease);
930 display: flex;
931 flex-direction: column;
932}
933.info-card:hover {
934 box-shadow: var(--td-shadow-md);
935}
936.info-card-head {
937 padding: 14px 16px;
938 border-bottom: 1px solid var(--td-border);
939 display: flex;
940 align-items: center;
941 gap: 10px;
942}
943.info-card-icon {
944 width: 36px;
945 height: 36px;
946 border-radius: 8px;
947 display: grid;
948 place-items: center;
949 font-size: 18px;
950 flex-shrink: 0;
951}
952.info-card-icon-blue { background: #e8f3ff; color: #0052d9; }
953.info-card-icon-purple { background: #f3e8ff; color: #7c3aed; }
954.info-card-icon-green { background: #e8f8f0; color: #2ba471; }
955.info-card-icon-orange { background: #fff3e0; color: #e37318; }
956.info-card-name {
957 flex: 1;
958 min-width: 0;
959 display: flex;
960 flex-direction: column;
961}
962.info-card-name strong {
963 font-size: 14px;
964 font-weight: 600;
965 color: var(--td-text);
966}
967.info-card-name span {
968 font-size: 11px;
969 color: var(--td-text-placeholder);
970 margin-top: 1px;
971}
972.info-tbl {
973 width: 100%;
974 border-collapse: collapse;
975 flex: 1;
976}
977.info-tbl td {
978 padding: 8px 16px;
979 font-size: 13px;
980 border-bottom: 1px solid #f5f6f8;
981}
982.info-tbl tr:last-child td {
983 border-bottom: none;
984}
985.info-tbl td:first-child {
986 color: var(--td-text-secondary);
987 white-space: nowrap;
988 width: 100px;
989}
990.info-tbl td:last-child {
991 color: var(--td-text);
992 word-break: break-all;
993}
994.info-card-actions {
995 display: flex;
996 gap: 8px;
997 padding: 12px 16px;
998 border-top: 1px solid #f5f6f8;
999 flex-wrap: wrap;
1000}
1001
1002.td-text-danger {
1003 color: var(--td-error, #d54941);
1004}
1005.td-text-warning {
1006 color: #e37318;
1007}
1008
1009@media (max-width: 991px) {
1010 .quick-actions-grid {
1011 grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
1012 }
1013 .quick-action-btn {
1014 padding: 10px 6px;
1015 }
1016}
1017
1018@media (max-width: 600px) {
1019 .td-user-dashboard { padding: 14px; }
1020 .hero { padding: 16px; }
1021 .hero-title { font-size: 18px; }
1022 .traffic-chart { height: 240px; }
1023 .gauge-body { height: 150px; }
1024}
1025</style>