Commit b9477951 authored by 崔佳豪's avatar 崔佳豪

perf: 仅有一个站点时,不展示站点选择器

parent 69f3c61e
Pipeline #48433 passed with stages
in 2 minutes 27 seconds
...@@ -172,7 +172,7 @@ const renderSite = ({ data, config, loading, setLoading, action }) => { ...@@ -172,7 +172,7 @@ const renderSite = ({ data, config, loading, setLoading, action }) => {
onVisibleChange={visible => setVisible(visible)} onVisibleChange={visible => setVisible(visible)}
> >
{ {
Array.isArray(data.stations) ? ( Array.isArray(data.allStation) && Array.isArray(data.allStation).length > 1 ? (
<div className={layoutStyles.toggleSite}> <div className={layoutStyles.toggleSite}>
<img src={require('../assets/basic/site.png')} className={layoutStyles.site} /> <img src={require('../assets/basic/site.png')} className={layoutStyles.site} />
<span className={layoutStyles.name}>{data.currentStationName}</span> <span className={layoutStyles.name}>{data.currentStationName}</span>
......
...@@ -204,6 +204,7 @@ class Site { ...@@ -204,6 +204,7 @@ class Site {
); );
resolve({ resolve({
stations, stations,
allStation,
weathers: { weathers: {
icon: `https://panda-water.cn/web4/assets/images/weather2/${imgPath}`, icon: `https://panda-water.cn/web4/assets/images/weather2/${imgPath}`,
text: `${text} ${firtValue.temperatureFirst}`, text: `${text} ${firtValue.temperatureFirst}`,
...@@ -216,6 +217,7 @@ class Site { ...@@ -216,6 +217,7 @@ class Site {
} else { } else {
resolve({ resolve({
stations, stations,
allStation,
siteCityList: self.siteCityList, siteCityList: self.siteCityList,
citySelector: self.citySelector, citySelector: self.citySelector,
currentStationName: self.currentStationName, currentStationName: self.currentStationName,
...@@ -226,6 +228,7 @@ class Site { ...@@ -226,6 +228,7 @@ class Site {
.catch(error => { .catch(error => {
resolve({ resolve({
stations, stations,
allStation,
currentStationName: self.currentStationName, currentStationName: self.currentStationName,
weathers: {}, weathers: {},
siteCityList: self.siteCityList, siteCityList: self.siteCityList,
...@@ -235,6 +238,7 @@ class Site { ...@@ -235,6 +238,7 @@ class Site {
} else { } else {
resolve({ resolve({
stations, stations,
allStation,
currentStationName: self.currentStationName, currentStationName: self.currentStationName,
weathers: {}, weathers: {},
siteCityList: self.siteCityList, siteCityList: self.siteCityList,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment