|
|
|
<template>
|
|
|
|
<u-navbar
|
|
|
|
:title="title"
|
|
|
|
:auto-back="false"
|
|
|
|
left-icon=""
|
|
|
|
left-icon-size="40rpx"
|
|
|
|
:safe-area-inset-top="true"
|
|
|
|
:placeholder="true"
|
|
|
|
:bgColor="(footCheck === 'shop')?'#ffffff':'transparent'"
|
|
|
|
></u-navbar>
|
|
|
|
<view :class="{show:(footCheck === 'home')}">
|
|
|
|
<HomePage v-show="(footCheck === 'home')"></HomePage>
|
|
|
|
</view>
|
|
|
|
<view :class="{show:(footCheck === 'order')}">
|
|
|
|
<!-- <HomePage v-show="(footCheck === 'order')"></HomePage>-->
|
|
|
|
</view>
|
|
|
|
<view :class="{show:(footCheck === 'shop')}">
|
|
|
|
<ShopPage ref="shop" v-show="(footCheck === 'shop')"></ShopPage>
|
|
|
|
</view>
|
|
|
|
<view :class="{show:(footCheck === 'user')}">
|
|
|
|
<UserPage v-show="(footCheck === 'user')"></UserPage>
|
|
|
|
</view>
|
|
|
|
<u-tabbar
|
|
|
|
:value="value1"
|
|
|
|
@change="change1"
|
|
|
|
|
|
|
|
>
|
|
|
|
<FooterNav style="width:100%;"></FooterNav>
|
|
|
|
</u-tabbar>
|
|
|
|
<u-modal :show="show" title="登录" content="当前未登录是否前往登录" @confirm="userLogin" @cancel="this.show = false;"
|
|
|
|
:closeOnClickOverlay="true" showCancelButton></u-modal>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import RightNav from '@/components/RightNav/index.vue';
|
|
|
|
import FooterNav from '@/components/FooterNav/index.vue';
|
|
|
|
import HeaderNav from '@/components/HeaderNav/index.vue';
|
|
|
|
import HomePage from '@/pages/Index/components/HomePage/index.vue';
|
|
|
|
import UserPage from '@/pages/Index/components/UserPage/index.vue';
|
|
|
|
import ShopPage from '@/pages/Index/components/ShopPage/index.vue';
|
|
|
|
import {
|
|
|
|
testLogin,
|
|
|
|
userDetail,
|
|
|
|
userExtends
|
|
|
|
} from "@/api/user";
|
|
|
|
import {imghost} from "@/config/host";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
RightNav,
|
|
|
|
HeaderNav,
|
|
|
|
HomePage,
|
|
|
|
UserPage,
|
|
|
|
FooterNav,
|
|
|
|
ShopPage,
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
value1: 0,
|
|
|
|
footCheck: 'home',
|
|
|
|
show: false,
|
|
|
|
title: '标题',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onLoad() {
|
|
|
|
|
|
|
|
},
|
|
|
|
onReachBottom() {
|
|
|
|
if(this.footCheck === 'shop'){
|
|
|
|
this.$refs.shop.getRoomList();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
change1(e) {
|
|
|
|
this.value1=e
|
|
|
|
},
|
|
|
|
userLogin() {
|
|
|
|
testLogin({
|
|
|
|
user_id: 1
|
|
|
|
}).then((res) => {
|
|
|
|
uni.setStorageSync('token', res.data);
|
|
|
|
this.show = false;
|
|
|
|
this.getUserDetail();
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
getUserDetail() {
|
|
|
|
userDetail().then((res) => {
|
|
|
|
uni.setStorageSync('user', res.data);
|
|
|
|
this.$store.commit('userInfo', res.data);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
getUserExtend() {
|
|
|
|
userExtends().then((res) => {
|
|
|
|
uni.setStorageSync('user-extends', res.data);
|
|
|
|
this.$store.commit('userExtends', res.data);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
// store.
|
|
|
|
},
|
|
|
|
onPageScroll(res) {
|
|
|
|
if (res.scrollTop <= 20) {
|
|
|
|
uni.$emit('isTop', true);
|
|
|
|
} else {
|
|
|
|
uni.$emit('isTop', false);
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
onShow() {
|
|
|
|
console.log('show123123')
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
|
|
})
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
// this.pagePadding = (api.navHeight().navPaddingTop+
|
|
|
|
// api.navHeight().navHeight + (api.navHeight().headerPadding *2))
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.title = this.$store.state.title;
|
|
|
|
// let token = uni.getStorageSync('token');
|
|
|
|
// let user = uni.getStorageSync('user');
|
|
|
|
// let userExtends = uni.getStorageSync('user-extends');
|
|
|
|
// if (!token) {
|
|
|
|
// this.show = true;
|
|
|
|
// } else if (!user) {
|
|
|
|
// this.getUserDetail();
|
|
|
|
// } else if (!userExtends) {
|
|
|
|
// this.getUserExtend();
|
|
|
|
// } else {
|
|
|
|
// this.$store.commit('userInfo', user);
|
|
|
|
// this.$store.commit('userExtends', userExtends);
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
"$store.state.footCheck": {
|
|
|
|
handler(newVal, oldVal) {
|
|
|
|
this.footCheck = newVal;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"$store.state.title": {
|
|
|
|
handler(newVal, oldVal) {
|
|
|
|
this.title = newVal;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
::v-deep .u-tabs__wrapper__nav__line{
|
|
|
|
left:24rpx;
|
|
|
|
}
|
|
|
|
@keyframes show {
|
|
|
|
0% {
|
|
|
|
display: block;
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
100% {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.show {
|
|
|
|
animation: show .5s;
|
|
|
|
}
|
|
|
|
</style>
|