From fce5fff2e29d07abee0061308d830acce940c726 Mon Sep 17 00:00:00 2001 From: nineven Date: Mon, 16 Mar 2020 19:35:15 +0800 Subject: [PATCH] fix some bugs --- fir_client/src/components/FirAppInfosBase.vue | 4 +- fir_client/src/components/FirApps.vue | 49 +++++++++++-------- fir_client/src/utils/index.js | 3 +- 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/fir_client/src/components/FirAppInfosBase.vue b/fir_client/src/components/FirAppInfosBase.vue index 5a7b428..d339a76 100644 --- a/fir_client/src/components/FirAppInfosBase.vue +++ b/fir_client/src/components/FirAppInfosBase.vue @@ -164,7 +164,9 @@ }, { "app_id": this.$route.params.id }); - this.icon_url = this.$store.state.currentapp.master_release.icon_url + if(this.$store.state.currentapp.master_release){ + this.icon_url = this.$store.state.currentapp.master_release.icon_url + } // this.$store.dispatch('dosetAh',this.getBH); },watch:{ '$store.state.currentapp.master_release.icon_url':function () { diff --git a/fir_client/src/components/FirApps.vue b/fir_client/src/components/FirApps.vue index 9e0bde2..8b986ab 100644 --- a/fir_client/src/components/FirApps.vue +++ b/fir_client/src/components/FirApps.vue @@ -242,10 +242,11 @@ hdata: {}, willDeleteApp: false, delapp: {}, - has_next:false, + has_next:true, query:{'page':1,size:20}, searchflag:false, - uploadflag:false + uploadflag:false, + autoloadflag:true } }, methods: { searchFun(){ @@ -253,6 +254,7 @@ if(keysearch === ''){ this.searchflag=false; this.applists=[]; + this.orgapplists=[]; this.query.page=1; if(this.searchfromtype){ this.getappsFun({"type": this.searchfromtype}); @@ -263,6 +265,8 @@ this.searchflag=true } if(this.searchflag){ + this.applists=[]; + this.orgapplists=[]; if(this.searchfromtype){ this.getappsFun({"type": this.searchfromtype,'page':1,size:999}); }else { @@ -274,25 +278,26 @@ // eslint-disable-next-line no-console // console.log(getScrollTop() , getWindowHeight(),getScrollTop() + getWindowHeight(), getScrollHeight()); if(getScrollTop() + getWindowHeight() >= getScrollHeight()){ - if(this.has_next){ //先判断下一页是否有数据 - if(this.applists.length === 0){ - this.query.page=1; - }else { - this.query.page+=1; - } - if(this.searchfromtype!=='') { - this.query.type = this.searchfromtype; + + if(this.has_next){ //先判断下一页是否有数据 + if(this.autoloadflag) { + this.autoloadflag = false; + if (this.applists.length === 0) { + this.query.page = 1; + } else { + this.query.page += 1; + } + if (this.searchfromtype !== '') { + this.query.type = this.searchfromtype; + } + this.getappsFun(this.query); + } + + }else{ + if(! this.has_next){ + this.$message.success("已经到底啦") + } } - // this.getappsFun(dict(this.query,{"types": this.searchfromtype})); - // this.getappsFun({"type": this.searchfromtype}); - // }else { - this.getappsFun(this.query); - // } - - }else{ - // eslint-disable-next-line no-console - console.log("end") - } } }, searchapps() { @@ -314,6 +319,8 @@ getapps(data => { if (data.code === 1000) { + this.autoloadflag = true; + if(this.uploadflag){ this.applists = data.data ; this.uploadflag = false; @@ -453,6 +460,8 @@ }, mounted() { // this.$store.dispatch('dosetAh',this.getBH); window.addEventListener('scroll',this.auto_load); + this.$store.dispatch('doucurrentapp', {}); + this.getappsFun({}); }, diff --git a/fir_client/src/utils/index.js b/fir_client/src/utils/index.js index 776ec09..7a5866a 100644 --- a/fir_client/src/utils/index.js +++ b/fir_client/src/utils/index.js @@ -8,7 +8,8 @@ export function getScrollTop(){ documentScrollTop = document.documentElement.scrollTop; } scrollTop = (bodyScrollTop - documentScrollTop > 0) ? bodyScrollTop : documentScrollTop; - return Math.ceil(scrollTop); + // return Math.ceil(scrollTop); + return scrollTop; }