13 changed files with 345 additions and 17 deletions
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 451 B |
@ -0,0 +1,90 @@ |
|||
const api = require('../../../../utils/api') |
|||
|
|||
Page({ |
|||
data: { |
|||
loadMoreType: 'none', |
|||
loadMoreVisible: false, |
|||
pageNo: 1, |
|||
pageSize: 10, |
|||
deptName: '', |
|||
deptIntro: '', |
|||
griderList: [] |
|||
}, |
|||
onLoad() { |
|||
this.getDeptInfo() |
|||
this.getMemberList() |
|||
}, |
|||
onReachBottom() { |
|||
this.setData({ |
|||
loadMoreVisible: true |
|||
}) |
|||
if (this.data.loadMoreType === 'loading') { |
|||
this.data.pageNo += 1 |
|||
this.loadMoreMemberList() |
|||
} |
|||
}, |
|||
// 社区介绍
|
|||
getDeptInfo() { |
|||
api.getDeptInfo().then(res => { |
|||
console.log(res) |
|||
const { deptInfo, deptName } = res.data |
|||
this.setData({ |
|||
deptName: deptName, |
|||
deptIntro: deptInfo |
|||
}) |
|||
}).catch(err => { |
|||
console.error(err) |
|||
}) |
|||
}, |
|||
// 初始化加载网格员队伍
|
|||
getMemberList() { |
|||
const params = { |
|||
pageIndex: this.data.pageNo, |
|||
pageSize: this.data.pageSize |
|||
} |
|||
wx.showLoading({ |
|||
title: '加载中...' |
|||
}) |
|||
api.getMemberList(params).then(res => { |
|||
wx.hideLoading() |
|||
const arr = [] |
|||
// res.data.forEach()
|
|||
this.setData({ |
|||
griderList: res.data, |
|||
loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none' |
|||
}) |
|||
}).catch(err => { |
|||
wx.hideLoading() |
|||
this.setData({ |
|||
griderList: [], |
|||
loadMoreType: 'none' |
|||
}) |
|||
}) |
|||
}, |
|||
// 下拉加载 网格员列表
|
|||
loadMoreMemberList() { |
|||
const params = { |
|||
pageIndex: this.data.pageNo, |
|||
pageSize: this.data.pageSize |
|||
} |
|||
wx.showLoading({ |
|||
title: '加载中...' |
|||
}) |
|||
api.getMemberList(params).then(res => { |
|||
wx.hideLoading() |
|||
this.setData({ |
|||
griderList: this.data.griderList.concat(res.data), |
|||
loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none' |
|||
}) |
|||
}).catch(err => { |
|||
wx.hideLoading() |
|||
console.error(err) |
|||
}) |
|||
}, |
|||
callGrider(e) { |
|||
const { phone } = e.currentTarget.dataset |
|||
wx.makePhoneCall({ |
|||
phoneNumber: phone |
|||
}) |
|||
} |
|||
}) |
@ -0,0 +1,9 @@ |
|||
{ |
|||
"navigationBarBackgroundColor": "#d73e32", |
|||
"backgroundColor": "#f7f7f7", |
|||
"navigationBarTextStyle": "white", |
|||
"navigationBarTitleText": "网格队伍", |
|||
"usingComponents": { |
|||
"no-data": "/components/nodata/nodata" |
|||
} |
|||
} |
@ -0,0 +1,32 @@ |
|||
<view class="grid-army"> |
|||
<view class="community-intro"> |
|||
<view class="community-name"> |
|||
<view class="icon"> |
|||
<image src="../../images/community.png" /> |
|||
</view> |
|||
<view class="name">{{deptName}}</view> |
|||
</view> |
|||
<view class="community-detail">{{deptIntro}}</view> |
|||
</view> |
|||
<view class="grider-list" wx:if="{{griderList.length > 0}}"> |
|||
<view class="grid-item" wx:for="{{griderList}}" wx:key="index"> |
|||
<view class="avatar"> |
|||
<image src="{{item.imgUrl}}" /> |
|||
</view> |
|||
<view class="name">{{item.name}}</view> |
|||
<view class="item">格言:{{item.motto}}</view> |
|||
<view class="item">负责区域:{{item.territory}}</view> |
|||
<view class="item">电话:{{item.mobile}}</view> |
|||
<view class="call-phone"> |
|||
<view class="phone"> |
|||
<image src="../../images/phone.png" /> |
|||
</view> |
|||
<view class="tip" bindtap="callGrider" data-phone="{{item.mobile}}">打电话</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view wx:else class="no-data-container"> |
|||
<no-data isShow="{{true}}"></no-data> |
|||
</view> |
|||
</view> |
|||
<load-more loadMoreType="{{loadMoreType}}" loadMoreVisible="{{loadMoreVisible}}"></load-more> |
@ -0,0 +1,129 @@ |
|||
page { |
|||
background: #f7f7f7; |
|||
} |
|||
|
|||
image { |
|||
width: 100%; |
|||
height: 100%; |
|||
float: left; |
|||
} |
|||
|
|||
.grid-army { |
|||
width: 100%; |
|||
height: auto; |
|||
} |
|||
|
|||
.community-intro { |
|||
width: 100%; |
|||
background: linear-gradient(to bottom, #d73e32, #cd1b1e); |
|||
box-sizing: border-box; |
|||
padding: 0 32rpx 80rpx; |
|||
} |
|||
|
|||
.community-intro .community-name { |
|||
display: flex; |
|||
align-items: center; |
|||
height: 100rpx; |
|||
width: 100%; |
|||
} |
|||
|
|||
.community-intro .community-name .icon { |
|||
width: 56rpx; |
|||
height: 56rpx; |
|||
} |
|||
|
|||
.community-intro .community-name .name { |
|||
font-size: 52rpx; |
|||
color: #fff; |
|||
margin-left: 15rpx; |
|||
} |
|||
|
|||
.community-intro .community-detail { |
|||
font-size: 30rpx; |
|||
color: #fff; |
|||
line-height: 50rpx; |
|||
text-indent: 60rpx; |
|||
} |
|||
|
|||
.grider-list { |
|||
width: 100%; |
|||
box-sizing: border-box; |
|||
padding: 0 32rpx; |
|||
margin-top: -40rpx; |
|||
display: grid; |
|||
grid-template-columns: repeat(2, 1fr); |
|||
grid-auto-flow: dense; |
|||
column-gap: 30rpx; |
|||
} |
|||
|
|||
.grider-list .grid-item { |
|||
width: 100%; |
|||
background: #fff; |
|||
margin-bottom: 20rpx; |
|||
border-radius: 14rpx; |
|||
box-sizing: border-box; |
|||
padding: 40rpx 30rpx 30rpx; |
|||
display: flex; |
|||
flex-direction: column; |
|||
align-items: center; |
|||
} |
|||
|
|||
.grider-list .grid-item .avatar { |
|||
width: 110rpx; |
|||
height: 110rpx; |
|||
border-radius: 50%; |
|||
background: yellow; |
|||
overflow: hidden; |
|||
} |
|||
|
|||
.grider-list .grid-item .name { |
|||
font-size: 30rpx; |
|||
line-height: 50rpx; |
|||
color: #333; |
|||
margin-top: 20rpx; |
|||
} |
|||
|
|||
.grider-list .grid-item .item { |
|||
width: 100%; |
|||
line-height: 36rpx; |
|||
font-size: 26rpx; |
|||
color: #c1c1c1; |
|||
} |
|||
|
|||
.grider-list .grid-item .item + .item { |
|||
margin-top: 4rpx; |
|||
} |
|||
|
|||
.grider-list .grid-item .call-phone { |
|||
margin-top: 20rpx; |
|||
width: 156rpx; |
|||
height: 56rpx; |
|||
background-image: linear-gradient(90deg, |
|||
#e3271c 0%, |
|||
#f95c2c 100%), |
|||
linear-gradient( |
|||
#8da5eb, |
|||
#8da5eb); |
|||
background-blend-mode: normal, |
|||
normal; |
|||
border-radius: 28rpx; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
font-size: 26rpx; |
|||
color: #ffffff; |
|||
} |
|||
|
|||
.grider-list .grid-item .call-phone .phone { |
|||
width:23rpx; |
|||
height:27rpx; |
|||
margin-right: 6rpx; |
|||
} |
|||
|
|||
.no-data-container { |
|||
width: 100%; |
|||
height: 50vh; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
} |
Loading…
Reference in new issue