|
@@ -32,8 +32,8 @@
|
|
|
<view class="menu-content w100">
|
|
<view class="menu-content w100">
|
|
|
<uv-grid :border="false" :col="4">
|
|
<uv-grid :border="false" :col="4">
|
|
|
<uv-grid-item v-for="(item,index) in state.menuList" :key="index" @click="handleMenuClick(item)">
|
|
<uv-grid-item v-for="(item,index) in state.menuList" :key="index" @click="handleMenuClick(item)">
|
|
|
- <image :src="item.icon" mode="widthFit" style="width: 48rpx;height: 48rpx"></image>
|
|
|
|
|
-<!-- <uv-icon :customStyle="{paddingTop:20+'rpx'}" :name="item.name" :size="22"></uv-icon>-->
|
|
|
|
|
|
|
+ <image :src="item.icon" mode="widthFit" style="width: 48rpx;height: 48rpx"></image>
|
|
|
|
|
+ <!-- <uv-icon :customStyle="{paddingTop:20+'rpx'}" :name="item.name" :size="22"></uv-icon>-->
|
|
|
<text class="grid-text" style="font-size: 14px;">{{ item.title }}</text>
|
|
<text class="grid-text" style="font-size: 14px;">{{ item.title }}</text>
|
|
|
</uv-grid-item>
|
|
</uv-grid-item>
|
|
|
</uv-grid>
|
|
</uv-grid>
|
|
@@ -77,13 +77,12 @@ const change = () => {
|
|
|
|
|
|
|
|
const initState = () => ({
|
|
const initState = () => ({
|
|
|
bannerList: [],
|
|
bannerList: [],
|
|
|
- swiperList: [
|
|
|
|
|
- ],
|
|
|
|
|
|
|
+ swiperList: [],
|
|
|
menuList: [
|
|
menuList: [
|
|
|
- {name: "photo", title: "洗车",icon:'/static/iconfont/default/fastwash.svg'},
|
|
|
|
|
- {name: "lock", title: "充值",icon:'/static/iconfont/default/chongzhi_1.svg'},
|
|
|
|
|
- {name: "star", title: "卡券",icon:'/static/iconfont/default/coupon.svg'},
|
|
|
|
|
- {name: "red-packet", title: "停车",icon:'/static/iconfont/default/parking.svg'},
|
|
|
|
|
|
|
+ {name: "photo", title: "洗车", icon: '/static/iconfont/default/fastwash.svg'},
|
|
|
|
|
+ {name: "lock", title: "充值", icon: '/static/iconfont/default/chongzhi_1.svg'},
|
|
|
|
|
+ {name: "star", title: "卡券", icon: '/static/iconfont/default/coupon.svg'},
|
|
|
|
|
+ {name: "red-packet", title: "停车", icon: '/static/iconfont/default/parking.svg'},
|
|
|
],
|
|
],
|
|
|
qrcodeOption: {
|
|
qrcodeOption: {
|
|
|
style: 'round',
|
|
style: 'round',
|
|
@@ -123,29 +122,29 @@ onLoad((e: any) => {
|
|
|
|
|
|
|
|
onShow(() => {
|
|
onShow(() => {
|
|
|
let token = fetchToken();
|
|
let token = fetchToken();
|
|
|
- if(token){
|
|
|
|
|
|
|
+ if (token) {
|
|
|
getApp<any>().globalData.token = token;
|
|
getApp<any>().globalData.token = token;
|
|
|
getApp<any>().globalData.isLogin = true;
|
|
getApp<any>().globalData.isLogin = true;
|
|
|
isLogin.value = true;
|
|
isLogin.value = true;
|
|
|
loadUserInfo();
|
|
loadUserInfo();
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
//主动退出的不自动登录
|
|
//主动退出的不自动登录
|
|
|
let manualLogout = getApp<any>().globalData.manualLogout;
|
|
let manualLogout = getApp<any>().globalData.manualLogout;
|
|
|
- if(manualLogout){
|
|
|
|
|
|
|
+ if (manualLogout) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- tryLogin().then(token=>{
|
|
|
|
|
|
|
+ tryLogin().then(token => {
|
|
|
getApp<any>().globalData.token = token;
|
|
getApp<any>().globalData.token = token;
|
|
|
getApp<any>().globalData.isLogin = true;
|
|
getApp<any>().globalData.isLogin = true;
|
|
|
isLogin.value = true;
|
|
isLogin.value = true;
|
|
|
- }).catch(e=>{
|
|
|
|
|
|
|
+ }).catch(e => {
|
|
|
console.error(e)
|
|
console.error(e)
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
- /* const userData = getApp<any>().globalData.user;
|
|
|
|
|
- if (userData && userData.id) {
|
|
|
|
|
- isLogin.value = true;
|
|
|
|
|
- }*/
|
|
|
|
|
|
|
+ /* const userData = getApp<any>().globalData.user;
|
|
|
|
|
+ if (userData && userData.id) {
|
|
|
|
|
+ isLogin.value = true;
|
|
|
|
|
+ }*/
|
|
|
|
|
|
|
|
console.log("show index>>>>", isLogin.value, state.stationList, state.location)
|
|
console.log("show index>>>>", isLogin.value, state.stationList, state.location)
|
|
|
let locationData = getApp<any>().globalData.location;
|
|
let locationData = getApp<any>().globalData.location;
|
|
@@ -155,7 +154,10 @@ onShow(() => {
|
|
|
state.location = locationData;
|
|
state.location = locationData;
|
|
|
loadWashStationList();
|
|
loadWashStationList();
|
|
|
}
|
|
}
|
|
|
- loadBannerList();
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (isLogin.value) {
|
|
|
|
|
+ loadBannerList();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
addListener();
|
|
addListener();
|
|
|
|
|
|
|
@@ -169,6 +171,9 @@ onHide(() => {
|
|
|
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();
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
uni.$on('logout', function (data) {
|
|
uni.$on('logout', function (data) {
|
|
@@ -206,10 +211,10 @@ const handleMenuClick = (menu: any) => {
|
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
|
url: '/pages-user/wallet/recharge'
|
|
url: '/pages-user/wallet/recharge'
|
|
|
})
|
|
})
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
- icon:'none',
|
|
|
|
|
- title:'敬请期待',
|
|
|
|
|
|
|
+ icon: 'none',
|
|
|
|
|
+ title: '敬请期待',
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
@@ -280,9 +285,10 @@ const handleNavStation = (station: any) => {
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
|
-page{
|
|
|
|
|
|
|
+page {
|
|
|
background: #fafafa;
|
|
background: #fafafa;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
.content {
|
|
.content {
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
display: flex;
|
|
display: flex;
|