Browse Source

场景页面优化

h5_css
yanyan 3 years ago
parent
commit
18d7f3adc2
  1. 3
      pages.json
  2. 37
      subpkg/list/list.vue

3
pages.json

@ -37,7 +37,8 @@
"style": { "style": {
"navigationBarTitleText": "场景演练", "navigationBarTitleText": "场景演练",
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"enablePullDownRefresh": true, "enablePullDownRefresh": false,
"onReachBottomDistance": 150,
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },

37
subpkg/list/list.vue

@ -35,10 +35,16 @@
export default { export default {
data() { data() {
return { return {
name:"", queryObj:{
name:"",
pageNum:1,
pageSize:1
},
total:0,
isloading:false,
//轮播图数据列表 //轮播图数据列表
swiperList: [], swiperList: [],
//轮播图数据列表 //场景数据列表
sceneList: [] sceneList: []
}; };
}, },
@ -62,26 +68,19 @@
uni.$showMsg('数据请求成功!') uni.$showMsg('数据请求成功!')
}, },
async getSceneList() { async getSceneList() {
this.isloading = true
const { const {
data: res data: res
} = await uni.$http.post('/small/scene/manage/listAll',{name:this.name}) } = await uni.$http.post('/small/scene/manage/listApp',this.queryObj)
if (!res.success) return uni.$showMsg() this.isloading = false
this.sceneList = []
res.data.forEach(item=>{ res.rows.forEach(item=>{
item.uploadPath = uni.$http.baseUrl +item.uploadPath item.uploadPath = uni.$http.baseUrl +item.uploadPath
this.sceneList.push(item)
}) })
this.sceneList =[...this.sceneList,...res.rows]
this.total = res.total
uni.$showMsg('数据请求成功!') uni.$showMsg('数据请求成功!')
}, },
objToParams(obj){
let arr = [];
for (let key in obj) {
arr.push(`${key}=${obj[key]}`);
}
return arr.join('&')
},
navClickHandler(item) { navClickHandler(item) {
if(item !== ""){ if(item !== ""){
uni.navigateTo({ uni.navigateTo({
@ -102,6 +101,12 @@
delta:1,//返回层数,2则上上页 delta:1,//返回层数,2则上上页
}) })
}, },
onReachBottom(){
if(this.queryObj.pageNum * this.queryObj.pageSize >= this.total) return uni.$showMsg('已展示所有场景')
if(this.isloading) return
this.queryObj.pageNum++
this.getSceneList()
}
} }
} }
</script> </script>

Loading…
Cancel
Save