diff --git a/aircraft/server/index/index.vue b/aircraft/server/index/index.vue index 054f853..2de9bc7 100644 --- a/aircraft/server/index/index.vue +++ b/aircraft/server/index/index.vue @@ -1,6 +1,7 @@ @@ -67,18 +71,13 @@ export default { topLevel: 0,// 页面是否滚动到顶 // 滚动顶部 scrollTop: 0, + oldScrollTop: 0, // refs组件列表 refs: ['order','equipment','route','my'], // 登录状态 isLogin: this.$store.state.vuex_token, } }, - onPageScroll(e) { - const level = e.scrollTop/60; - if(level<=1) this.topLevel = level; - else this.topLevel = 1; - this.scrollTop = e.scrollTop; - }, onLoad(){ let index = uni.getStorageSync('current'); this.current = index?index:0; @@ -86,33 +85,21 @@ export default { this.changeCurrent(this.current); }, onShow(){ - // 小程序除我的页,其它不要刷新 - let index = uni.getStorageSync('current'); - this.current = index?index:0; - this.isLogin = this.$store.state.vuex_token; - if(this.current === 3){ - this.changeCurrent(this.current); - } - }, - - // 上拉刷新 - onPullDownRefresh(){ - try{ - this.changeCurrent(this.current); - }catch(e){} - finally{ - uni.stopPullDownRefresh(); - } - }, - // 滑动到底部 - onReachBottom(){ + // // 小程序除我的页,其它不要刷新 + // let index = uni.getStorageSync('current'); + // this.current = index?index:0; + // this.isLogin = this.$store.state.vuex_token; + // if(this.current === 3){ + // this.changeCurrent(this.current); + // } }, methods:{ // 切换页面 changeCurrent(index){ this.current = index; uni.setStorageSync('current',index); - if(this.current === 1 && !this.isLogin){ + // if(this.current === 1 && !this.isLogin){ + if(!this.isLogin){ const url = '/aircraft/server/index/index'; uni.navigateTo({ url: `/aircraft/server/my/child_pages/login?nextUrl=${url}` @@ -123,6 +110,24 @@ export default { this.$refs.pageRef.init(); }) }, + // 滚动回顶部 + goTop() { + this.scrollTop = this.oldScrollTop; + this.$nextTick(()=>{ + this.scrollTop = 0; + }); + }, + // 滚动监听 + scroll(e){ + const level = e.detail.scrollTop/60; + if(level<=1) this.topLevel = level; + else this.topLevel = 1; + this.oldScrollTop = e.detail.scrollTop; + }, + // 上拉刷新 + refresh(){ + this.changeCurrent(this.current); + }, } } @@ -134,9 +139,9 @@ export default { min-height: 100vh; display: flex; flex-direction: column; - background-color: #F5F5F5; height: 100%; .upage{ + background-color: #F5F5F5; width: 100%; height: calc(100vh - 114rpx - constant(safe-area-inset-bottom)); height: calc(100vh - 114rpx - env(safe-area-inset-bottom)); @@ -157,7 +162,7 @@ export default { align-items: center; border-top: 2rpx solid #E6E6E6; .nav-item-selected{ - color: #333333; + color: #333333 !important; } .nav-item{ font-family: Source Han Sans SC; diff --git a/aircraft/server/order/order.vue b/aircraft/server/order/order.vue index ed2d552..422d1b0 100644 --- a/aircraft/server/order/order.vue +++ b/aircraft/server/order/order.vue @@ -1,14 +1,34 @@