|
|
|
const app = getApp();
|
|
|
|
Page({
|
|
|
|
data: {
|
|
|
|
tidings:[],
|
|
|
|
list:[
|
|
|
|
{text:"课堂提醒",type:"course"},{text:"项目提醒",type:"project"},{text:"互动提醒", type:"interaction"},{text:"审核",type:"apply"},{text:"通知", type:"notice"}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
changeType({detail:{current, value}}){
|
|
|
|
this.options.type=value.type;
|
|
|
|
this.refresh({refresh:2});
|
|
|
|
},
|
|
|
|
refresh({refresh=0}={}){
|
|
|
|
if(refresh){
|
|
|
|
if(refresh==1){
|
|
|
|
this.options.page=1;
|
|
|
|
var { options } = this;
|
|
|
|
}else if(refresh==2){
|
|
|
|
var { per_page, page, type} = this.options;
|
|
|
|
var options = {per_page:per_page*page, page:1, type};
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
this.options.page++;
|
|
|
|
var {options} = this;
|
|
|
|
}
|
|
|
|
console.log(options);
|
|
|
|
return app.api("users.tidings")(options).then(res => {
|
|
|
|
let {tidings} = res;
|
|
|
|
if(!refresh)
|
|
|
|
tidings = this.data.tidings.concat(tidings);
|
|
|
|
this.setData({ tidings });
|
|
|
|
})
|
|
|
|
},
|
|
|
|
onLoad: function (options) {
|
|
|
|
this.options = { page: 1, per_page: 10 };
|
|
|
|
console.log(this.options);
|
|
|
|
|
|
|
|
},
|
|
|
|
_onReachBottom(){
|
|
|
|
this.refresh();
|
|
|
|
},
|
|
|
|
onShow: function () {
|
|
|
|
this.refresh({refresh:2});
|
|
|
|
wx.hideTabBarRedDot({index: 1});
|
|
|
|
wx.removeTabBarBadge({index: 1});
|
|
|
|
},
|
|
|
|
|
|
|
|
onPullDownRefresh: function () {
|
|
|
|
this.refresh({refresh:2});
|
|
|
|
},
|
|
|
|
|
|
|
|
onShareAppMessage: function () {
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|