Skip to content

Commit acdec02

Browse files
committed
fix
1 parent e5b4f3e commit acdec02

File tree

2 files changed

+30
-11
lines changed

2 files changed

+30
-11
lines changed

web/src/components/Favicon.vue

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<!-- Fallback: 首字母徽标 -->
33
<div v-if="!hasValidSource || !hasIcon" class="w-5 h-5 rounded-full flex items-center justify-center text-[10px] font-semibold"
4-
style="flex:none;transition: all 0.2s ease; background: linear-gradient(135deg, #1D9BF0 0%, #2B6BFF 50%, #37B4FF 100%); color: #FFFFFF">
4+
style="flex:none;transition: all 0.2s ease; background: #3b82f6; color: #FFFFFF">
55
{{ initial }}
66
</div>
77
<!-- Favicon with multi-source fallback -->
@@ -28,17 +28,14 @@ const parsed = computed(() => {
2828
const domain = computed(() => (parsed.value?.hostname || '').replace(/^www\./, ''))
2929
const origin = computed(() => parsed.value?.origin || '')
3030
31-
//国内友好的回退顺序:站点本身 → DuckDuckGo → iowen → Clearbit
31+
//"国内友好"的回退顺序:站点本身 → DuckDuckGo → 直接显示首字母
3232
const sources = computed(() => {
3333
const d = domain.value
3434
if (!d) return []
3535
const arr = []
36+
// 只尝试两个来源:站点本身和 DuckDuckGo
3637
if (origin.value) arr.push(() => `${origin.value}/favicon.ico`)
37-
arr.push(
38-
() => `https://icons.duckduckgo.com/ip3/${d}.ico`,
39-
() => `https://api.iowen.cn/favicon/${d}.png`,
40-
() => `https://logo.clearbit.com/${d}`,
41-
)
38+
arr.push(() => `https://icons.duckduckgo.com/ip3/${d}.ico`)
4239
return arr
4340
})
4441
@@ -51,8 +48,12 @@ const src = computed(() => {
5148
const initial = computed(() => (domain.value[0] || '?').toUpperCase())
5249
5350
function showFallback(){
54-
if (current.value < sources.value.length - 1) current.value++
55-
else hasIcon.value = false
51+
if (current.value < sources.value.length - 1) {
52+
current.value++
53+
} else {
54+
// 所有源都失败,显示首字母徽标
55+
hasIcon.value = false
56+
}
5657
}
5758
</script>
5859

web/src/pages/StatsPage.vue

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
<button @click="goDashboard" class="btn btn-secondary">数据看板</button>
99
</div>
1010
<div class="flex items-center gap-3">
11-
<button @click="copy(shortUrl)" class="btn btn-secondary">复制短链</button>
11+
<button @click="copy(shortUrl)" class="btn btn-secondary">
12+
{{ copying ? '已复制' : '复制短链' }}
13+
</button>
1214
<button @click="openFilter" class="btn btn-primary">筛选</button>
1315
<button @click="exportCsv" class="btn btn-secondary">导出CSV</button>
1416
</div>
@@ -381,11 +383,21 @@ function getPercent(value, total) {
381383
return total > 0 ? Math.round(value / total * 100) : 0
382384
}
383385
386+
// 复制状态
387+
const copying = ref(false)
388+
384389
async function copy(text) {
385390
try {
391+
copying.value = true
386392
await copyToClipboard(text)
393+
// 显示复制成功提示
394+
setTimeout(() => {
395+
copying.value = false
396+
}, 2000)
387397
} catch (e) {
388398
console.error('复制失败:', e)
399+
alert('复制失败,请手动复制')
400+
copying.value = false
389401
}
390402
}
391403
@@ -406,6 +418,7 @@ async function fetchDetailedStats() {
406418
detailedStats.value = res.data
407419
408420
// 解析分布数据
421+
console.log('Detailed stats response:', res.data) // 调试信息
409422
hourDistribution.value = (res.data.hourDistribution || []).map(i => ({ key: i.key || i.label, count: Number(i.count || i.value || 0) }))
410423
weekdayDistribution.value = (res.data.weekdayDistribution || []).map(i => ({ key: i.key || i.label, count: Number(i.count || i.value || 0) }))
411424
deviceDistribution.value = (res.data.deviceDistribution || []).map(i => ({ key: i.key || i.label, count: Number(i.count || i.value || 0) }))
@@ -414,7 +427,12 @@ async function fetchDetailedStats() {
414427
countryDistribution.value = (res.data.countryDistribution || []).map(i => ({ key: i.key || i.label, count: Number(i.count || i.value || 0) }))
415428
sourceDistribution.value = (res.data.sourceDistribution || []).map(i => ({ key: i.key || i.label, count: Number(i.count || i.value || 0) }))
416429
refererDistribution.value = (res.data.refererDistribution || []).map(i => ({ key: i.key || i.label, count: Number(i.count || i.value || 0) }))
417-
} catch (e) { console.error('fetchDetailedStats error:', e) }
430+
431+
console.log('Hour distribution:', hourDistribution.value)
432+
console.log('Device distribution:', deviceDistribution.value)
433+
} catch (e) {
434+
console.error('fetchDetailedStats error:', e)
435+
}
418436
}
419437
420438
async function fetchTrend() {

0 commit comments

Comments
 (0)