|
|
@@ -43,7 +43,10 @@
|
|
|
|
|
|
<!-- 站点清单 start-->
|
|
|
<view class="w100 content_station">
|
|
|
- <WashStation v-for="item in state.stationList" :key="item.id" :item="item"></WashStation>
|
|
|
+ <template v-if="isLogin">
|
|
|
+ <WashStation v-for="item in state.stationList" :key="item.id" :item="item"></WashStation>
|
|
|
+ </template>
|
|
|
+ <uv-empty v-else mode="order" text="请先登录"></uv-empty>
|
|
|
</view>
|
|
|
<!-- 站点清单 end-->
|
|
|
|
|
|
@@ -171,9 +174,11 @@ onHide(() => {
|
|
|
const addListener = () => {
|
|
|
uni.$on('login', function (data) {
|
|
|
isLogin.value = data.isLogin;
|
|
|
- if(!state.bannerList|| state.bannerList.length===0){
|
|
|
+ if (!state.bannerList || state.bannerList.length === 0) {
|
|
|
loadBannerList();
|
|
|
}
|
|
|
+ loadWashStationList();
|
|
|
+
|
|
|
})
|
|
|
|
|
|
uni.$on('logout', function (data) {
|
|
|
@@ -250,17 +255,19 @@ const loadCurrentLocation = () => {
|
|
|
}
|
|
|
|
|
|
const loadWashStationList = () => {
|
|
|
- post(`/wash-station/listStation`, {pageSize: 5}).then((res: any) => {
|
|
|
- console.log(res)
|
|
|
- let {list, total} = res;
|
|
|
- list.forEach((station: any) => {
|
|
|
- if (station.location) {
|
|
|
- let stationLocation = JSON.parse(station.location);
|
|
|
- station.distance = calcMapDistance(state.location.latitude, state.location.longitude, stationLocation.stationLat, stationLocation.stationLng);
|
|
|
- }
|
|
|
+ if (isLogin.value) {
|
|
|
+ post(`/wash-station/listStation`, {pageSize: 5}).then((res: any) => {
|
|
|
+ console.log(res)
|
|
|
+ let {list, total} = res;
|
|
|
+ list.forEach((station: any) => {
|
|
|
+ if (station.location) {
|
|
|
+ let stationLocation = JSON.parse(station.location);
|
|
|
+ station.distance = calcMapDistance(state.location.latitude, state.location.longitude, stationLocation.stationLat, stationLocation.stationLng);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ state.stationList = list;
|
|
|
})
|
|
|
- state.stationList = list;
|
|
|
- })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
const handleNavMap = (station: any) => {
|