|
@@ -1,28 +1,80 @@
|
|
|
-// custom-tab-bar/message/index.js
|
|
|
+const getHeight = require("../../../utils/getRheRemainingHeight"),
|
|
|
+ _Http = getApp().globalData.http;
|
|
|
Page({
|
|
|
-
|
|
|
/**
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
-
|
|
|
+ height: 0,
|
|
|
+ list: [],
|
|
|
+ content: {
|
|
|
+ nocache: true,
|
|
|
+ pageNumber: 1,
|
|
|
+ pageSize: 20,
|
|
|
+ pageTotal: 1,
|
|
|
+ type: "系统"
|
|
|
+ },
|
|
|
+ total: 0,
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad(options) {
|
|
|
-
|
|
|
+ this.getlist();
|
|
|
},
|
|
|
//切换tab选项
|
|
|
- tabChange({detail}){
|
|
|
- console.log("回调",detail)
|
|
|
+ tabChange({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.setData({
|
|
|
+ "content.type": detail.label.slice(0, 2)
|
|
|
+ })
|
|
|
+ this.getlist(true);
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
|
|
onReady() {
|
|
|
+ getHeight.getHeight("#tabs", this).then(res => {
|
|
|
+ this.setData({
|
|
|
+ height: res
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ toDetails(e) {
|
|
|
+ const {
|
|
|
+ item
|
|
|
+ } = e.currentTarget.dataset;
|
|
|
+ wx.navigateTo({
|
|
|
+ url: './details?id=' + item.objectid,
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
+ getlist(init = false) {
|
|
|
+ if (init.detail != undefined) init = init.detail;
|
|
|
+ if (init) this.setData({
|
|
|
+ ['content.pageNumber']: 1
|
|
|
+ })
|
|
|
+ if (this.data.content.pageNumber > this.data.content.pageTotal) return;
|
|
|
+ _Http.basic({
|
|
|
+ "classname": "system.message.Message",
|
|
|
+ "method": "queryMessage",
|
|
|
+ content: this.data.content
|
|
|
+ }).then(res => {
|
|
|
+ this.selectComponent('#ListBox').RefreshToComplete();
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ total: res.total,
|
|
|
+ list: (res.pageNumber == 1) ? res.data : this.data.list.concat(res.data),
|
|
|
+ ['content.pageNumber']: res.pageNumber + 1,
|
|
|
+ ['content.pageTotal']: res.pageTotal
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
/**
|