diff --git a/weather.go b/weather.go index e47c154..662d84a 100644 --- a/weather.go +++ b/weather.go @@ -167,6 +167,7 @@ type hourlyItem struct { Time string `json:"time"` Temp string `json:"temp"` Icon string `json:"icon"` + Pop string `json:"pop,omitempty"` } type dailyItem struct { @@ -267,6 +268,7 @@ func fetchHourlyForecast(cityID string) []hourlyItem { Hourly []struct { FxTime string `json:"fxTime"` Temp string `json:"temp"` + Pop string `json:"pop"` Text string `json:"text"` } `json:"hourly"` } @@ -285,7 +287,7 @@ func fetchHourlyForecast(cityID string) []hourlyItem { t = t[:5] } } - result = append(result, hourlyItem{t, h.Temp + "°", getWeatherIcon(h.Text)}) + result = append(result, hourlyItem{t, h.Temp + "°", getWeatherIcon(h.Text), h.Pop}) } return result } diff --git a/web/overlay.html b/web/overlay.html index 29e3f97..2ceadbe 100644 --- a/web/overlay.html +++ b/web/overlay.html @@ -89,6 +89,7 @@ html, body { .forecast-icon { font-size: 20px; margin: 4px 0; } .forecast-time { opacity: 0.6; font-size: 10px; } .forecast-temp { font-weight: 600; margin-top: 2px; font-size: 13px; } +.forecast-pop { font-size: 10px; opacity: 0.6; margin-top: 1px; } .daily-forecast { display: flex; gap: 6px; @@ -309,20 +310,34 @@ body.layout-multi #card-time { min-width: 280px; z-index: 10; } +body.layout-multi #card-zodiac { + position: fixed; + top: 160px; + right: 40px; + width: 280px; + z-index: 10; +} +body.layout-multi #card-ainews { + position: fixed; + bottom: 40px; + left: 40px; + width: calc(50vw - 80px); + z-index: 10; +} body.layout-multi #card-bottom { position: fixed; - bottom: 80px; + bottom: 40px; right: 40px; width: calc(50vw - 60px); display: flex; - gap: 16px; + gap: 20px; align-items: flex-end; z-index: 10; } body.layout-multi #card-right-col { display: flex; flex-direction: column; - gap: 16px; + gap: 20px; flex: 1; min-width: 0; } @@ -335,20 +350,6 @@ body.layout-multi #card-right-col #card-ainews { body.layout-multi #card-bottom #card-weather { text-align: right; } -body.layout-multi #card-ainews { - position: fixed; - bottom: 80px; - left: 40px; - width: calc(50vw - 80px); - z-index: 10; -} -body.layout-multi #card-zodiac { - position: fixed; - top: 200px; - right: 40px; - width: 280px; - z-index: 10; -} /* ===== 卡片隐藏 ===== */ body.hide-time #card-time, @@ -701,7 +702,7 @@ window.updateWeatherFromGo=function(data){ if(fel){ if(data.hourly&&data.hourly.length>0){ fel.innerHTML=data.hourly.map(function(item){ - return '
'+item.time+'
'+item.icon+'
'+item.temp+'
'; + return '
'+item.time+'
'+item.icon+'
'+item.temp+'
'+(item.pop&&item.pop!=='0'?'
'+item.pop+'%
':'')+'
'; }).join(''); } else { fel.innerHTML='
暂无数据
'; } }