新增: 24h天气预报降水概率+组件间距统一

- 24h预报卡片显示降水概率(非0%时显示)
- MULTI布局组件间距统一为20px,边距统一40px
- 时间卡片和星座卡片垂直间距调整
This commit is contained in:
2026-05-26 04:49:07 +08:00
parent 8e7ec8424d
commit 79851781aa
2 changed files with 22 additions and 19 deletions

View File

@@ -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
}

View File

@@ -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 '<div class="forecast-item"><div class="forecast-time">'+item.time+'</div><div class="forecast-icon">'+item.icon+'</div><div class="forecast-temp">'+item.temp+'</div></div>';
return '<div class="forecast-item"><div class="forecast-time">'+item.time+'</div><div class="forecast-icon">'+item.icon+'</div><div class="forecast-temp">'+item.temp+'</div>'+(item.pop&&item.pop!=='0'?'<div class="forecast-pop">'+item.pop+'%</div>':'')+'</div>';
}).join('');
} else { fel.innerHTML='<div style="font-size:11px;opacity:0.4">暂无数据</div>'; }
}