<template>
|
<view class="area_index">
|
<scroll-view
|
scroll-y="true"
|
class="area_index_scroll"
|
:scroll-top="scrollTop"
|
refresher-enabled="true"
|
refresher-background="#EAEAEA"
|
:refresher-triggered="triggered"
|
@refresherpulling="refresherrefresh"
|
@scrolltolower="scrolltoLower">
|
<view class="area_card_index" v-for="(item,index) in areaData" :key="index">
|
<view class="area_card_headers">{{item.areaName}}</view>
|
<view class="area_card_main">
|
<view class="area_card_items" v-for="(names,nameIndex) in item.areaAdmins" :key="nameIndex">
|
<view class="area_card_phone">
|
<u-image src="@/static/area_user.png" width="120rpx" height="120rpx"></u-image>
|
</view>
|
<view class="area_card_name">{{names}}</view>
|
</view>
|
</view>
|
</view>
|
<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
|
</scroll-view>
|
</view>
|
</template>
|
|
<script>
|
import { throttle } from '../../plugins/public.js';
|
export default{
|
data(){
|
return{
|
pageNum: 1,
|
pageSize: 10,
|
loadPage: 0,
|
scrollTop: 0,
|
triggered: true,
|
status: 'loading',
|
loadText: {
|
loading: '努力加载中',
|
nomore: '没有更多数据了'
|
},
|
areaData:[{}],//区域负责人列表
|
}
|
},
|
onLoad() {
|
this.searchVideoList()
|
},
|
methods:{
|
//查询列表
|
searchVideoList(){
|
this.triggered = true;
|
this.areaData = [];
|
let params = {
|
pageNum: this.pageNum,
|
pageSize:this.pageSize,
|
}
|
this.$api.reboSystem.getAreaUserLists(params).then(res=>{
|
if(res.statusMsg === 'ok'){
|
res.data.list.map(item=>{
|
this.areaData.push({
|
areaName:item.areaName,
|
areaAdmins:item.areaAdmins.split(',')
|
})
|
})
|
console.log(this.areaData,'yuqu')
|
this.loadPage = res.data.pages;
|
this.triggered = false;
|
this.status = 'nomore';
|
}else{
|
uni.$u.toast(res.statusMsg);
|
}
|
}).catch((err) => {
|
uni.$u.toast('请检查网络服务或联系管理员!')
|
})
|
},
|
//自定义下拉刷新
|
refresherrefresh: throttle(function() {
|
this.status = 'loading';
|
this.pageNum = 1;
|
this.searchVideoList();
|
uni.$u.toast('刷新成功');
|
}, 500),
|
//触底刷新
|
scrolltoLower: throttle(function() {
|
this.status = 'loading';
|
if(this.pageNum >= this.loadPage) {
|
setTimeout(() => {
|
this.status = 'nomore'
|
uni.$u.toast('没有更多数据了');
|
},1000)
|
return
|
} else {
|
this.pageNum+=1
|
let params = {
|
pageNum: this.pageNum,
|
pageSize:this.pageSize,
|
}
|
this.$api.reboSystem.getAreaUserLists(params).then(res=>{
|
if(res.statusMsg === 'ok'){
|
res.data.list.map(item=>{
|
this.areaData.push({
|
areaName:item.areaName,
|
areaAdmins:item.areaAdmins.split(',')
|
})
|
})
|
this.loadPage = res.data.pages;
|
this.triggered = false;
|
this.status = 'nomore';
|
}else{
|
uni.$u.toast(res.statusMsg);
|
}
|
}).catch((err) => {
|
uni.$u.toast('请检查网络服务或联系管理员!')
|
})
|
}
|
}, 1500),
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
.area_index{
|
height: 100vh;
|
background-color: #F6F6F6;
|
padding: 10px 15px;
|
.area_index_scroll{
|
height: 90%;
|
|
.area_card_index{
|
height: 160px;
|
margin-bottom: 15px;
|
background-color: #FFFFFF;
|
border-radius: 6px;
|
|
.area_card_headers{
|
padding-left: 15px;
|
line-height: 45px;
|
color: #333333;
|
font-size: 17px;
|
border-bottom: 1px solid #EAEAEA;
|
position: relative;
|
&::before{
|
content: "";
|
position: absolute;
|
top: 14px;
|
left: 10px;
|
width: 2px;
|
height: 15px;
|
background-color: #1977FF;
|
}
|
}
|
.area_card_main{
|
padding: 15px;
|
display: flex;
|
.area_card_items{
|
display: flex;
|
flex-direction: column;
|
justify-content: center;
|
margin-right: 10px;
|
.area_card_phone{
|
display: flex;
|
justify-content: center;
|
}
|
.area_card_name{
|
flex: none;
|
margin-top: 5px;
|
text-align: center;
|
}
|
}
|
}
|
}
|
}
|
}
|
</style>
|