手机端页面

This commit is contained in:
宋伟佳
2022-05-31 09:30:02 +08:00
parent 08953ff36d
commit 5cc225d5a2
3 changed files with 4241 additions and 11 deletions
+1
View File
@@ -221,6 +221,7 @@ export default {
&& this.$route.name !== 'loginStandDetails' && this.$route.name !== 'error' && this.$route.name !== 'loginStandDetails' && this.$route.name !== 'error'
&& this.$route.name !== 'phoneHome'&& this.$route.name !== 'databaseSearch' && this.$route.name !== 'phoneHome'&& this.$route.name !== 'databaseSearch'
&& this.$route.name !== 'standDynamics' && this.$route.name !== 'domesticStand' && this.$route.name !== 'standDynamics' && this.$route.name !== 'domesticStand'
&& this.$route.name !== 'domesticDetails'
&& this.$route.name !== 'OtherStandardExternalDetails' && this.$route.name !== 'OtherStandardExternalDetails') { && this.$route.name !== 'OtherStandardExternalDetails' && this.$route.name !== 'OtherStandardExternalDetails') {
this.isBoolean = true this.isBoolean = true
} else { } else {
+39 -7
View File
@@ -17,11 +17,11 @@
</template> </template>
</van-search> </van-search>
</div> </div>
<div class="card-box"> <div class="card-box" ref="cardBox" @scroll="scrool">
<div v-if="loading"> <div v-if="loading">
<van-loading size="24px" color="#3170A8">加载中...</van-loading> <van-loading size="24px" color="#3170A8">加载中...</van-loading>
</div> </div>
<div v-else-if="!loading && standList.length" class="card-content" v-for="item in standList" :key="item.id"> <div v-else-if="!loading && standList.length" class="card-content" v-for="item in standList" :key="item.id" @click="jumpDetails(item) ">
<div class="standTitle"> <div class="standTitle">
<div class="title">{{item.title}}</div> <div class="title">{{item.title}}</div>
</div> </div>
@@ -46,23 +46,45 @@ export default {
name: "databaseSearch", name: "databaseSearch",
data(){ data(){
return{ return{
scrolled: '',
moreFlag: false,
searchKey: '', searchKey: '',
standList: [], standList: [],
loading: true, loading: true,
page: 1,
} }
}, },
methods: { methods: {
scrool(){
let scrolled = this.$refs.cardBox.scrollTop
//获得可视区的高度
const windowHeight = this.$refs.cardBox.clientHeight
//获取滚动条的总高度
const scrollHeight = this.$refs.cardBox.scrollHeight
let windowScrolled = scrolled + windowHeight
this.scrolled = scrolled
if(scrollHeight - windowScrolled < 600 ){
//把距离顶部的距离加上可视区域的高度 等于或者大于滚动条的总高度就是到达底部
this.moreFlag = true
this.page++
}
},
onSearch(){ onSearch(){
this.moreFlag = false
this.$http.post('search/searchCenter/searchSarBykey',{ this.$http.post('search/searchCenter/searchSarBykey',{
selectIndex: 'fulltextserch', selectIndex: 'fulltextserch',
selectValue: this.searchKey, selectValue: this.searchKey,
selectType: 'titleSearch', selectType: 'titleSearch',
page: 1, page: this.page,
pageSize: 20 pageSize: 20
},{ },{
_this: this, _this: this,
}, res => { }, res => {
this.standList = res.data.list if(this.standList.length){
this.standList = this.standList.concat(res.data.list)
}else{
this.standList = res.data.list
}
console.log(this.standList); console.log(this.standList);
this.loading = false this.loading = false
}, e => { }, e => {
@@ -73,11 +95,21 @@ export default {
back(){ back(){
this.$router.push('/phoneHome') this.$router.push('/phoneHome')
}, },
jumpDetails(item){
this.$router.push({
name: 'domesticDetails',
query: {
id: item.id,
pageType: 'INLAND_STAND'
}
})
},
}, },
mounted(){ mounted(){
this.searchKey = this.$route.query.searchKey this.searchKey = this.$route.query.searchKey
this.onSearch() this.onSearch()
} this.$refs.cardBox.addEventListener('scroll', this.scrool);
},
}; };
</script> </script>
@@ -85,7 +117,6 @@ export default {
#database-search{ #database-search{
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: auto;
margin: 0; margin: 0;
padding: 0; padding: 0;
background: #F6F6F6; background: #F6F6F6;
@@ -130,8 +161,9 @@ export default {
} }
} }
.card-box{ .card-box{
height: 100%; height: 85%;
position: relative; position: relative;
overflow-y: scroll;
top: 100px; top: 100px;
} }
.card-content{ .card-content{
File diff suppressed because it is too large Load Diff