|
@@ -38,9 +38,7 @@ export default class HomePage extends Component {
|
|
|
stopList: [],
|
|
stopList: [],
|
|
|
hasPermission: false,
|
|
hasPermission: false,
|
|
|
permissionDenied: false,
|
|
permissionDenied: false,
|
|
|
- pinMessage: {
|
|
|
|
|
- visible: false
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ pinMessages: []
|
|
|
};
|
|
};
|
|
|
this.isHide = true;
|
|
this.isHide = true;
|
|
|
this.denied = true;
|
|
this.denied = true;
|
|
@@ -154,13 +152,7 @@ export default class HomePage extends Component {
|
|
|
console.log("获取GPS缓存-err", err);
|
|
console.log("获取GPS缓存-err", err);
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
- if (isLogin()) {
|
|
|
|
|
- this.getPinMessage()
|
|
|
|
|
- } else {
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- this.getPinMessage()
|
|
|
|
|
- }, 5000);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.getPinMessage()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
toExit = () => {
|
|
toExit = () => {
|
|
@@ -531,29 +523,21 @@ export default class HomePage extends Component {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
getPinMessage() {
|
|
getPinMessage() {
|
|
|
- if (!isLogin()) return;
|
|
|
|
|
apiBase.getPinMessage().then(res => {
|
|
apiBase.getPinMessage().then(res => {
|
|
|
- if (res.data && res.data.pinTitle) {
|
|
|
|
|
- const pin = {
|
|
|
|
|
- visible: true,
|
|
|
|
|
- title: res.data.pinTitle,
|
|
|
|
|
- message: res.data.pinContent
|
|
|
|
|
|
|
+ let list = []
|
|
|
|
|
+ if (res.data) {
|
|
|
|
|
+ if (res.data.pinTitle) {
|
|
|
|
|
+ list = [res.data];
|
|
|
|
|
+ } else if (Array.isArray(res.data)) {
|
|
|
|
|
+ list = res.data;
|
|
|
}
|
|
}
|
|
|
- this.setState({
|
|
|
|
|
- pinMessage: pin
|
|
|
|
|
- })
|
|
|
|
|
- } else {
|
|
|
|
|
- this.setState({
|
|
|
|
|
- pinMessage: {
|
|
|
|
|
- visible: false
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ this.setState({
|
|
|
|
|
+ pinMessages: list
|
|
|
|
|
+ })
|
|
|
}).catch(err => {
|
|
}).catch(err => {
|
|
|
this.setState({
|
|
this.setState({
|
|
|
- pinMessage: {
|
|
|
|
|
- visible: false
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ pinMessages: []
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
@@ -599,7 +583,7 @@ export default class HomePage extends Component {
|
|
|
useApplesMap={this.settingInfo.useApplesMap}
|
|
useApplesMap={this.settingInfo.useApplesMap}
|
|
|
showUserLocation={this.state.hasPermission && this.settingInfo.alwaysLocation}
|
|
showUserLocation={this.state.hasPermission && this.settingInfo.alwaysLocation}
|
|
|
viewChargeStation={id => this.viewChargeStation(id)}
|
|
viewChargeStation={id => this.viewChargeStation(id)}
|
|
|
- pinMessage={this.state.pinMessage}
|
|
|
|
|
|
|
+ pinMessages={this.state.pinMessages}
|
|
|
/>
|
|
/>
|
|
|
}
|
|
}
|
|
|
<LocationPermission.VIEW
|
|
<LocationPermission.VIEW
|