分包医生
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
import { API } from '../../../../utils/network/api'
|
||||
const api = new API()
|
||||
const app = getApp()
|
||||
Page({
|
||||
data: {
|
||||
navbarData: {
|
||||
showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
|
||||
title: '系统通知', //导航栏 中间的标题
|
||||
},
|
||||
height: app.globalData.height,
|
||||
visible: false,
|
||||
list: [],
|
||||
current_page: 0,
|
||||
total: 0,
|
||||
per_page: 0,
|
||||
last_page: 0,
|
||||
static_host: api.getStaticHost()
|
||||
},
|
||||
go(e){
|
||||
this.putMessageReadNotice(e);
|
||||
app.go(e.currentTarget.dataset.url);
|
||||
},
|
||||
onShow(){
|
||||
this.setData({
|
||||
list: [],
|
||||
current_page: 0,
|
||||
total: 0,
|
||||
per_page: 0,
|
||||
last_page: 0,
|
||||
})
|
||||
let ap = this.getList();
|
||||
ap.then(res => {
|
||||
this.check()
|
||||
})
|
||||
},
|
||||
check(){
|
||||
// 不满一页自动加载下一页
|
||||
wx.createSelectorQuery().select('#list').boundingClientRect(res2 => {
|
||||
console.log(res2.height)
|
||||
console.log(wx.getSystemInfoSync().windowHeight)
|
||||
if (res2.height < wx.getSystemInfoSync().windowHeight) {
|
||||
this.getList().then(res => {
|
||||
if(this.data.current_page < this.data.last_page){
|
||||
this.check()
|
||||
}
|
||||
});
|
||||
}
|
||||
}).exec()
|
||||
},
|
||||
getList(){
|
||||
let current_page = this.data.current_page;
|
||||
current_page = current_page + 1;
|
||||
this.setData({
|
||||
current_page: current_page
|
||||
})
|
||||
let list = this.data.list;
|
||||
return api.getDoctorMessageSystem({page: current_page}).then(response => {
|
||||
console.log(response);
|
||||
this.setData({
|
||||
list: list.concat(response.data.data),
|
||||
current_page: response.data.current_page,
|
||||
total: response.data.total,
|
||||
per_page: response.data.per_page,
|
||||
last_page: response.data.last_page,
|
||||
})
|
||||
}).catch(errors => {console.error(errors);})
|
||||
},
|
||||
onReachBottom() {
|
||||
console.log('===触底了!!===');
|
||||
if(this.data.current_page < this.data.last_page){//最后一页时停止分页
|
||||
this.getList()
|
||||
}
|
||||
},
|
||||
putMessageReadNotice(e){
|
||||
let notice_id = e.currentTarget.dataset.notice_id;
|
||||
api.putMessageReadNotice({notice_id: notice_id}).then(response => {
|
||||
console.log(response);
|
||||
|
||||
}).catch(errors => {console.error(errors);})
|
||||
},
|
||||
putMessageReadNoticeAll(){
|
||||
api.putMessageReadNoticeAll({notice_type: 2}).then(response => {
|
||||
console.log(response);
|
||||
let new_list = [];
|
||||
this.data.list.forEach(item => {
|
||||
item.read_status = 1;
|
||||
new_list.push(item)
|
||||
})
|
||||
this.setData({
|
||||
list: new_list
|
||||
})
|
||||
let usertype = wx.getStorageSync('usertype');
|
||||
let userID = wx.getStorageSync('user_id_'+usertype);
|
||||
wx.setStorageSync( userID+"_system_notice_unreadnnum", "");
|
||||
wx.showToast({
|
||||
title: '操作成功',
|
||||
icon: "success"
|
||||
})
|
||||
}).catch(errors => {console.error(errors);})
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"te-nav-bar": "../../../../commpents/te_navbar/index",
|
||||
"van-image": "@vant/weapp/image/index",
|
||||
"van-divider": "@vant/weapp/divider/index",
|
||||
"van-empty": "@vant/weapp/empty/index"
|
||||
},
|
||||
"enablePullDownRefresh": false,
|
||||
"onReachBottomDistance": 50
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<te-nav-bar navbar-data='{{navbarData}}' ></te-nav-bar>
|
||||
<view class="container">
|
||||
<view class="list" id="list">
|
||||
<view class="item" bindtap="go" data-notice_id="{{item.notice_id}}" data-url="/user/pages/yishi/notice_deatil/index?notice_id={{item.notice_id}}" wx:for="{{list}}">
|
||||
<view class="item_top">
|
||||
<view class="item_img">
|
||||
<van-image class="van_img" src="{{static_host}}/applet/doctor/static/images/yishi/service_notice/kuaisu.png" fit="heightFix" height="54rpx" aria-label="qrcode" />
|
||||
</view>
|
||||
<view class="item_content">{{item.notice_brief_title}}</view>
|
||||
</view>
|
||||
<view class="hongdian" wx:if="{{item.read_status == 0}}">
|
||||
<van-image src="{{static_host}}/applet/doctor/static/images/yishi/honhdian.png" fit="heightFix" height="20rpx" aria-label="qrcode" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<van-empty description="暂无数据" wx:if="{{list.length == 0}}" />
|
||||
<van-divider contentPosition="center" wx:if="{{list.length > 0 && current_page == last_page}}">到底了~</van-divider>
|
||||
<van-image bind:click="putMessageReadNoticeAll" style="position: fixed; right: 0;bottom: 262rpx;" src="{{static_host}}/applet/doctor/static/images/yishi/service_notice/readall.png" fit="heightFix" height="84rpx" aria-label="role" />
|
||||
<view style="height: 50rpx;">
|
||||
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,39 @@
|
||||
page{
|
||||
background-color: #F4F4F4;
|
||||
}
|
||||
.container{
|
||||
width: 100vw;
|
||||
padding-top: 20rpx;
|
||||
}
|
||||
.list{
|
||||
width: 92vw;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.item{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
background-color: #fff;
|
||||
padding: 20rpx;
|
||||
border-radius: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.item_top{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.van_img{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.item_content{
|
||||
font-size: 34rpx;
|
||||
color: #333333;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.hongdian{
|
||||
height: 50rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
Reference in New Issue
Block a user