新增: 24h天气预报降水概率+组件间距统一
- 24h预报卡片显示降水概率(非0%时显示) - MULTI布局组件间距统一为20px,边距统一40px - 时间卡片和星座卡片垂直间距调整
This commit is contained in:
@@ -167,6 +167,7 @@ type hourlyItem struct {
|
|||||||
Time string `json:"time"`
|
Time string `json:"time"`
|
||||||
Temp string `json:"temp"`
|
Temp string `json:"temp"`
|
||||||
Icon string `json:"icon"`
|
Icon string `json:"icon"`
|
||||||
|
Pop string `json:"pop,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type dailyItem struct {
|
type dailyItem struct {
|
||||||
@@ -267,6 +268,7 @@ func fetchHourlyForecast(cityID string) []hourlyItem {
|
|||||||
Hourly []struct {
|
Hourly []struct {
|
||||||
FxTime string `json:"fxTime"`
|
FxTime string `json:"fxTime"`
|
||||||
Temp string `json:"temp"`
|
Temp string `json:"temp"`
|
||||||
|
Pop string `json:"pop"`
|
||||||
Text string `json:"text"`
|
Text string `json:"text"`
|
||||||
} `json:"hourly"`
|
} `json:"hourly"`
|
||||||
}
|
}
|
||||||
@@ -285,7 +287,7 @@ func fetchHourlyForecast(cityID string) []hourlyItem {
|
|||||||
t = t[:5]
|
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
|
return result
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ html, body {
|
|||||||
.forecast-icon { font-size: 20px; margin: 4px 0; }
|
.forecast-icon { font-size: 20px; margin: 4px 0; }
|
||||||
.forecast-time { opacity: 0.6; font-size: 10px; }
|
.forecast-time { opacity: 0.6; font-size: 10px; }
|
||||||
.forecast-temp { font-weight: 600; margin-top: 2px; font-size: 13px; }
|
.forecast-temp { font-weight: 600; margin-top: 2px; font-size: 13px; }
|
||||||
|
.forecast-pop { font-size: 10px; opacity: 0.6; margin-top: 1px; }
|
||||||
.daily-forecast {
|
.daily-forecast {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
@@ -309,20 +310,34 @@ body.layout-multi #card-time {
|
|||||||
min-width: 280px;
|
min-width: 280px;
|
||||||
z-index: 10;
|
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 {
|
body.layout-multi #card-bottom {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 80px;
|
bottom: 40px;
|
||||||
right: 40px;
|
right: 40px;
|
||||||
width: calc(50vw - 60px);
|
width: calc(50vw - 60px);
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 16px;
|
gap: 20px;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
body.layout-multi #card-right-col {
|
body.layout-multi #card-right-col {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 16px;
|
gap: 20px;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
@@ -335,20 +350,6 @@ body.layout-multi #card-right-col #card-ainews {
|
|||||||
body.layout-multi #card-bottom #card-weather {
|
body.layout-multi #card-bottom #card-weather {
|
||||||
text-align: right;
|
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,
|
body.hide-time #card-time,
|
||||||
@@ -701,7 +702,7 @@ window.updateWeatherFromGo=function(data){
|
|||||||
if(fel){
|
if(fel){
|
||||||
if(data.hourly&&data.hourly.length>0){
|
if(data.hourly&&data.hourly.length>0){
|
||||||
fel.innerHTML=data.hourly.map(function(item){
|
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('');
|
}).join('');
|
||||||
} else { fel.innerHTML='<div style="font-size:11px;opacity:0.4">暂无数据</div>'; }
|
} else { fel.innerHTML='<div style="font-size:11px;opacity:0.4">暂无数据</div>'; }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user