16 changed files with 485 additions and 63 deletions
After Width: | Height: | Size: 134 KiB |
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,173 @@ |
|||||
|
const app = getApp() |
||||
|
import api, {getIntelligentMessage,getToken,getStaffbasicinfo,clearMessage} from "../../../../utils/api" |
||||
|
Page({ |
||||
|
data: { |
||||
|
selectList:['全部消息','居民信息采集','房屋信息采集','社区满意度自查'], |
||||
|
selectValue:0, |
||||
|
pageSize:10, |
||||
|
pageNo:1, |
||||
|
tableData:[], |
||||
|
lowerThreshold:'5', |
||||
|
loadMoreVisible:false, |
||||
|
loadMoreType: "none", |
||||
|
nodata:false |
||||
|
}, |
||||
|
// 事件处理函数
|
||||
|
onLoad: async function () { |
||||
|
this.setData({ |
||||
|
statusHeight: app.globalData.deviceInfo.statusHeight, |
||||
|
navigationHeight: app.globalData.deviceInfo.navigationHeight, |
||||
|
share:app.globalData.share |
||||
|
}) |
||||
|
await this.getToken() |
||||
|
// await this.getIntelligentMessage()
|
||||
|
await this.getStaffbasicinfo() |
||||
|
}, |
||||
|
onShow(){ |
||||
|
|
||||
|
this.getIntelligentMessage() |
||||
|
}, |
||||
|
onPullDownRefresh() { |
||||
|
this.setData({ |
||||
|
pageNo:1, |
||||
|
tableData:[] |
||||
|
}) |
||||
|
this.getIntelligentMessage() |
||||
|
this.getStaffbasicinfo() |
||||
|
}, |
||||
|
|
||||
|
onScrollToLower(e){ |
||||
|
if (this.data.loadMoreType === 'more') { |
||||
|
this.setData({ |
||||
|
loadMoreVisible: true, |
||||
|
}) |
||||
|
this.data.pageNo += 1 |
||||
|
this.getIntelligentMessage() |
||||
|
} |
||||
|
}, |
||||
|
getIntelligentMessage(){ |
||||
|
this.setData({ |
||||
|
loadMoreVisible: true, |
||||
|
nodata: false, |
||||
|
loadMoreType: "more", |
||||
|
}) |
||||
|
const parm = { |
||||
|
type:this.data.selectValue == 0? null :this.data.selectValue - 1, |
||||
|
limit:this.data.pageSize, |
||||
|
page:this.data.pageNo |
||||
|
} |
||||
|
if(!parm.type) delete parm.type |
||||
|
getIntelligentMessage(parm).then(res=>{ |
||||
|
console.log(res) |
||||
|
res.data.list = res.data.list.map(item => { |
||||
|
if (item.createdByName && item.createdByName.length >= 3) { |
||||
|
item.createdByName = item.createdByName.slice(1,3); |
||||
|
} |
||||
|
return item; |
||||
|
}); |
||||
|
|
||||
|
this.setData({ |
||||
|
loadMoreType: res.data.list.length === this.data.pageSize ? 'more' : 'none', |
||||
|
tableData: this.data.tableData.concat(res.data.list), |
||||
|
}) |
||||
|
if (this.data.tableData.length == 0) { |
||||
|
this.setData({ |
||||
|
loadMoreVisible: false, |
||||
|
nodata: true |
||||
|
}) |
||||
|
} |
||||
|
}).catch(err=>{ |
||||
|
console.log(err); |
||||
|
this.setData({ |
||||
|
loadMoreVisible: false, |
||||
|
nodata: true, |
||||
|
}) |
||||
|
}) |
||||
|
}, |
||||
|
getToken(){ |
||||
|
const parm = { |
||||
|
wxCode:'', |
||||
|
app:'gov', |
||||
|
client:'wxmp', |
||||
|
appId:'wxaf87b420b87e2d79' |
||||
|
} |
||||
|
wx.showLoading({ |
||||
|
title: '加载中...', |
||||
|
}) |
||||
|
wx.login({ |
||||
|
success: (res) => { |
||||
|
parm.wxCode = res.code |
||||
|
getToken(parm).then(res=>{ |
||||
|
console.log(res); |
||||
|
wx.hideLoading() |
||||
|
if(res.code === 0){ |
||||
|
wx.setStorageSync('token', res.data.token) |
||||
|
}else{ |
||||
|
wx.reLaunch({ |
||||
|
url: '/pages/login/login', |
||||
|
}) |
||||
|
} |
||||
|
}).catch(err=>{ |
||||
|
console.log(err); |
||||
|
}) |
||||
|
}, |
||||
|
}) |
||||
|
}, |
||||
|
getStaffbasicinfo(){ |
||||
|
getStaffbasicinfo().then(res=>{ |
||||
|
app.globalData.user = res.data |
||||
|
}).catch(err=>{ |
||||
|
console.log(err); |
||||
|
wx.redirectTo({ |
||||
|
url: '/pages/login/login', |
||||
|
}) |
||||
|
}) |
||||
|
}, |
||||
|
handleChangeFilter(e){ |
||||
|
this.setData({ |
||||
|
selectValue:e.detail.value, |
||||
|
tableData:[], |
||||
|
}) |
||||
|
console.log(this.data.selectValue) |
||||
|
this.getIntelligentMessage() |
||||
|
}, |
||||
|
handelClickClear(){ |
||||
|
clearMessage().then(res=>{ |
||||
|
this.setData({ |
||||
|
tableData:[], |
||||
|
pageNo:1 |
||||
|
}) |
||||
|
this.getIntelligentMessage() |
||||
|
}).catch(err=>{ |
||||
|
console.log(err); |
||||
|
}) |
||||
|
}, |
||||
|
toDetail(e){ |
||||
|
console.log(e); |
||||
|
this.clearOneMessage(e.currentTarget.dataset.item.id) |
||||
|
if(e.currentTarget.dataset.item.msgType == 'resident_base_info'){ |
||||
|
wx.navigateTo({ |
||||
|
url: `/subpages/addResi/pages/editResi/editResi?type=edit&resiId=${e.currentTarget.dataset.item.targetId}`, |
||||
|
}) |
||||
|
}else{ |
||||
|
wx.navigateTo({ |
||||
|
url: `/subpages/addhouse/pages/addhouse/addhouse?type=edit&houseId=${e.currentTarget.dataset.item.targetId}`, |
||||
|
}) |
||||
|
} |
||||
|
this.setData({ |
||||
|
[`tableData[${e.currentTarget.dataset.index}].readFlag`]:'1' |
||||
|
}) |
||||
|
}, |
||||
|
clearOneMessage(id){ |
||||
|
let parm= { |
||||
|
msgId:id |
||||
|
} |
||||
|
api.clearOneMessage(parm).then(res=>{ |
||||
|
console.log(res); |
||||
|
}).catch(err=>{ |
||||
|
console.log(err); |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
|
@ -0,0 +1,11 @@ |
|||||
|
{ |
||||
|
"usingComponents": { |
||||
|
"load-more": "../../components/loadMore/loadMore", |
||||
|
"no-data": "../../components/noData/nodata", |
||||
|
"custom-tab-bar":"../../components/custom-tab-bar" |
||||
|
}, |
||||
|
"navigationBarTitleText": "消息", |
||||
|
"enablePullDownRefresh": true, |
||||
|
"backgroundColor": "#f8f8f8", |
||||
|
"backgroundTextStyle": "dark" |
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
<official-account></official-account> |
||||
|
|
||||
|
<view class="select"> |
||||
|
<view class="bgBule"> |
||||
|
<picker mode="selector" style="display: inline-block;" range="{{selectList}}" value="{{selectValue}}" bindchange="handleChangeFilter" > |
||||
|
<view>{{selectValue == 1?'居民信息采集':selectValue == 2?'房屋信息采集':selectValue == 3?'社区满意度自查':'全部消息'}}</view> |
||||
|
</picker> |
||||
|
|
||||
|
<image src="../../images/select.png" mode=""/></view> |
||||
|
<view class="delete" bind:tap="handelClickClear"> <image src="../../images/delete.png" mode="" /> 全部已读</view> |
||||
|
</view> |
||||
|
<view class="content"> |
||||
|
<scroll-view class="scroll" scroll-y="{{true}}" lower-threshold="{{ lowerThreshold }}" bindscrolltolower="onScrollToLower"> |
||||
|
<view class="box"> |
||||
|
<view class="card" wx:for="{{tableData}}" wx:key="index" data-item="{{item}}" data-index="{{index}}" bind:tap="toDetail"> |
||||
|
<view class="left">{{item.createdByName}}</view> |
||||
|
<view class="right"> |
||||
|
<view class="top"><text class="title" >{{item.content}}</text> <text class="{{item.readFlag != '1'?'':'gray'}}" style="font-size: 26rpx;">{{item.readFlag != '1'?'未读':'已读'}}</text></view> |
||||
|
<view class="bottom"> |
||||
|
<view class="flex_box"> |
||||
|
<view wx:if="{{item.msgType == '2'}}">测评打分:</view><view class="{{item.msgType == '2'?'blue':''}}" class="textOver">{{item.deptName || '--'}}</view><view wx:if="{{item.msgType == '2'}}">分</view> |
||||
|
</view> |
||||
|
<text>{{item.createdTime}}</text> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<load-more loadVisible="{{loadMoreVisible}}" loadType="{{loadMoreType}}" ></load-more> |
||||
|
<no-data isShow="{{nodata}}" wx:if="{{nodata}}"></no-data> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
<custom-tab-bar></custom-tab-bar> |
||||
|
|
@ -0,0 +1,161 @@ |
|||||
|
page { |
||||
|
width: 100%; |
||||
|
min-height: 100vh; |
||||
|
overflow: hidden; |
||||
|
background-color: #f7f7f7; |
||||
|
} |
||||
|
|
||||
|
.select{ |
||||
|
width: 100%; |
||||
|
height: 90rpx; |
||||
|
background-color: #fff; |
||||
|
display: flex; |
||||
|
justify-content: space-between; |
||||
|
box-sizing: border-box; |
||||
|
padding: 0 40rpx; |
||||
|
align-items: center; |
||||
|
} |
||||
|
.select view { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
font-size: 30rpx; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 500; |
||||
|
color: #3A80E7; |
||||
|
} |
||||
|
.select view image{ |
||||
|
width: 16rpx; |
||||
|
height: 16rpx; |
||||
|
margin: 0 9rpx; |
||||
|
} |
||||
|
.select .delete { |
||||
|
font-size: 28rpx; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 500; |
||||
|
color: #999999; |
||||
|
} |
||||
|
.select .delete image{ |
||||
|
width: 30rpx; |
||||
|
height: 30rpx; |
||||
|
} |
||||
|
.content{ |
||||
|
width: 100%; |
||||
|
padding:0 20rpx ; |
||||
|
margin-top: 20rpx; |
||||
|
box-sizing: border-box; |
||||
|
} |
||||
|
.content .scroll { |
||||
|
height: calc(100vh - 130rpx); |
||||
|
} |
||||
|
|
||||
|
.content .scroll .box{ |
||||
|
border-radius: 20rpx; |
||||
|
overflow-y: auto; |
||||
|
} |
||||
|
.content .card{ |
||||
|
width: 100%; |
||||
|
background-color: #fff; |
||||
|
display: flex; |
||||
|
height: 168rpx; |
||||
|
padding: 34rpx 30rpx; |
||||
|
box-sizing: border-box; |
||||
|
overflow: hidden; |
||||
|
position: relative; |
||||
|
} |
||||
|
|
||||
|
.content .card::before{ |
||||
|
content: ""; |
||||
|
position: absolute; |
||||
|
left: 30rpx; /* 调整间距 */ |
||||
|
right: 30rpx; /* 调整间距 */ |
||||
|
bottom: 0; |
||||
|
border-bottom: 2rpx solid #EAEAEA; |
||||
|
} |
||||
|
|
||||
|
.blue{ |
||||
|
color:#5693EE; |
||||
|
} |
||||
|
.yellow{ |
||||
|
color:#E2944D; |
||||
|
} |
||||
|
.cyan{ |
||||
|
color: #2EB4F2 ; |
||||
|
} |
||||
|
.cyanBg{ |
||||
|
background: rgba(56,189,253,0.1); |
||||
|
} |
||||
|
.yellowBg{ |
||||
|
background: rgba(248,188,122,0.1); |
||||
|
} |
||||
|
.blueBg{ |
||||
|
background: rgba(86,147,238,0.1); |
||||
|
} |
||||
|
.gray{ |
||||
|
color: #999999 !important; |
||||
|
} |
||||
|
.content .card .left{ |
||||
|
width: 100rpx; |
||||
|
height: 100rpx; |
||||
|
background: linear-gradient(0deg, #3E8DF8 0%, #68A8FD 100%); |
||||
|
border-radius: 20rpx; |
||||
|
color:#fff ; |
||||
|
font-size: 28rpx; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 500; |
||||
|
text-align: center; |
||||
|
line-height: 100rpx; |
||||
|
} |
||||
|
.content .card .right{ |
||||
|
flex: 1; |
||||
|
overflow: hidden; |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
justify-content: space-between; |
||||
|
overflow: hidden; |
||||
|
margin-left: 24rpx; |
||||
|
} |
||||
|
.content .card .right .top{ |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: space-between; |
||||
|
} |
||||
|
.content .card .right .title{ |
||||
|
font-size: 32rpx; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 500; |
||||
|
color: #333333; |
||||
|
overflow: hidden; |
||||
|
text-overflow: ellipsis; |
||||
|
white-space: nowrap; |
||||
|
width: calc(100% - 80rpx); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
.content .card .right .bottom{ |
||||
|
display: flex; |
||||
|
justify-content: space-between; |
||||
|
align-items: center; |
||||
|
font-size: 28rpx; |
||||
|
font-family: PingFang SC; |
||||
|
color: #999999; |
||||
|
} |
||||
|
.textOver{ |
||||
|
overflow: hidden; |
||||
|
text-overflow: ellipsis; |
||||
|
white-space: nowrap; |
||||
|
max-width: 250rpx; |
||||
|
} |
||||
|
.content .card .right .bottom .flex_box{ |
||||
|
display: flex; |
||||
|
justify-content: left; |
||||
|
} |
||||
|
.bgBule{ |
||||
|
background-color: #dfebfb; |
||||
|
border: 1px solid #3A80E7; |
||||
|
border-radius: 32rpx; |
||||
|
padding:10rpx 20rpx; |
||||
|
box-sizing: border-box; |
||||
|
} |
||||
|
.bgBule image{ |
||||
|
margin-left: 50rpx !important; |
||||
|
} |
Loading…
Reference in new issue