|
@@ -33,10 +33,10 @@
|
|
|
|
|
|
|
|
<!-- 站点清单 start-->
|
|
<!-- 站点清单 start-->
|
|
|
<view class="w100 content_station">
|
|
<view class="w100 content_station">
|
|
|
- <template v-if="isLogin">
|
|
|
|
|
|
|
+<!-- <template v-if="isLogin">-->
|
|
|
<WashStation v-for="item in state.stationList" :key="item.id" :item="item"></WashStation>
|
|
<WashStation v-for="item in state.stationList" :key="item.id" :item="item"></WashStation>
|
|
|
- </template>
|
|
|
|
|
- <uv-empty v-else mode="order" text="请先登录" :marginTop="100" @click="gotoLogin"></uv-empty>
|
|
|
|
|
|
|
+<!-- </template>-->
|
|
|
|
|
+<!-- <uv-empty v-if="!isLogin" mode="order" text="请先登录" :marginTop="100" @click="gotoLogin"></uv-empty>-->
|
|
|
</view>
|
|
</view>
|
|
|
<!--
|
|
<!--
|
|
|
<movable-area class="mov-area">
|
|
<movable-area class="mov-area">
|
|
@@ -142,23 +142,6 @@ onLoad((e: any) => {
|
|
|
width: '100%',
|
|
width: '100%',
|
|
|
height: `${(height - rpxToPx(60)) / 4}px`
|
|
height: `${(height - rpxToPx(60)) / 4}px`
|
|
|
};
|
|
};
|
|
|
- /* if (query) {
|
|
|
|
|
- uni.showToast({
|
|
|
|
|
- title: query,
|
|
|
|
|
- duration: 5000
|
|
|
|
|
- })
|
|
|
|
|
- }*/
|
|
|
|
|
-
|
|
|
|
|
-})
|
|
|
|
|
-
|
|
|
|
|
-onShow(() => {
|
|
|
|
|
- let height = uni.getWindowInfo().windowHeight;
|
|
|
|
|
- // const bound = uni.getMenuButtonBoundingClientRect();
|
|
|
|
|
- // width: 100%;height:170px;
|
|
|
|
|
- state.customStyle = {
|
|
|
|
|
- width: '100%',
|
|
|
|
|
- height: `${(height - rpxToPx(60)) / 4}px`
|
|
|
|
|
- };
|
|
|
|
|
|
|
|
|
|
let token = fetchToken();
|
|
let token = fetchToken();
|
|
|
if (token) {
|
|
if (token) {
|
|
@@ -186,45 +169,45 @@ onShow(() => {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- /* const userData = getApp<any>().globalData.user;
|
|
|
|
|
- if (userData && userData.id) {
|
|
|
|
|
- isLogin.value = true;
|
|
|
|
|
- }*/
|
|
|
|
|
-
|
|
|
|
|
- console.log("show index>>>>", isLogin.value, state.stationList, state.location)
|
|
|
|
|
- let locationData = getApp<any>().globalData.location;
|
|
|
|
|
- // if(isLogin.value) {
|
|
|
|
|
- if (!locationData || !locationData.longitude) {
|
|
|
|
|
- loadCurrentLocation();
|
|
|
|
|
- } else {
|
|
|
|
|
- state.location = locationData;
|
|
|
|
|
- loadWashStationList();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // }
|
|
|
|
|
-
|
|
|
|
|
- loadBannerList();
|
|
|
|
|
|
|
|
|
|
if (!isLogin.value) {
|
|
if (!isLogin.value) {
|
|
|
addListener();
|
|
addListener();
|
|
|
}
|
|
}
|
|
|
|
|
+})
|
|
|
|
|
|
|
|
|
|
+onShow(() => {
|
|
|
|
|
+ let height = uni.getWindowInfo().windowHeight;
|
|
|
|
|
+ // const bound = uni.getMenuButtonBoundingClientRect();
|
|
|
|
|
+ // width: 100%;height:170px;
|
|
|
|
|
+ state.customStyle = {
|
|
|
|
|
+ width: '100%',
|
|
|
|
|
+ height: `${(height - rpxToPx(60)) / 4}px`
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
|
|
+ loadInitData()
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
onHide(() => {
|
|
onHide(() => {
|
|
|
- // Object.assign(state, initState());
|
|
|
|
|
removeListener();
|
|
removeListener();
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+const loadInitData = () => {
|
|
|
|
|
+ console.log("show index>>>>", isLogin.value, state.stationList, state.location)
|
|
|
|
|
+ let locationData = getApp<any>().globalData.location;
|
|
|
|
|
+ if (!locationData || !locationData.longitude) {
|
|
|
|
|
+ loadCurrentLocation();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ state.location = locationData;
|
|
|
|
|
+ loadWashStationList();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ loadBannerList();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const addListener = () => {
|
|
const addListener = () => {
|
|
|
uni.$on('login', function (data) {
|
|
uni.$on('login', function (data) {
|
|
|
isLogin.value = data.isLogin;
|
|
isLogin.value = data.isLogin;
|
|
|
- // if (!state.bannerList || state.bannerList.length === 0) {
|
|
|
|
|
- // loadBannerList();
|
|
|
|
|
- // }
|
|
|
|
|
- // loadWashStationList();
|
|
|
|
|
-
|
|
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
uni.$on('logout', function (data) {
|
|
uni.$on('logout', function (data) {
|
|
@@ -327,9 +310,6 @@ const loadCurrentLocation = () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const loadWashStationList = () => {
|
|
const loadWashStationList = () => {
|
|
|
- if (state.stationList && state.stationList.length > 0) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
post(`/wash-station/listStation`, {pageSize: 5}).then((res: any) => {
|
|
post(`/wash-station/listStation`, {pageSize: 5}).then((res: any) => {
|
|
|
let {list, total} = res;
|
|
let {list, total} = res;
|
|
|
list.forEach((station: any) => {
|
|
list.forEach((station: any) => {
|