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+
384389async 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
420438async function fetchTrend () {
0 commit comments