|
@@ -0,0 +1,52 @@
|
|
|
|
+const app = getApp()
|
|
|
|
+
|
|
|
|
+Page({
|
|
|
|
+ data: {
|
|
|
|
+ tableData: [],
|
|
|
|
+ keyword:'',
|
|
|
|
+ from: 0,
|
|
|
|
+ size: 10
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ onLoad: function(options) {
|
|
|
|
+ this.setData({
|
|
|
|
+ spinShow: true
|
|
|
|
+ });
|
|
|
|
+ this.search(true)
|
|
|
|
+ },
|
|
|
|
+ onPullDownRefresh() {
|
|
|
|
+ this.setData({ spinShow: true });
|
|
|
|
+ if (!this.loading) {
|
|
|
|
+ this.setData({ from:0,tableData:[]});
|
|
|
|
+ this.search(true)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ onReachBottom() {
|
|
|
|
+ if (!this.loading && this.data.from > -1) {
|
|
|
|
+ this.search(false)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ onInputEvent(e){
|
|
|
|
+ let {value} = e.detail;
|
|
|
|
+ if( this.data.keyword == value) return;
|
|
|
|
+ this.setData({keyword: value, from:0})
|
|
|
|
+ this.search( )
|
|
|
|
+ },
|
|
|
|
+ search: function() {
|
|
|
|
+ let {from, size, keyword, tableData} = this.data;
|
|
|
|
+ let _this = this
|
|
|
|
+ let param = {from, size, keyword}
|
|
|
|
+ app.formPost('User.search', param ).then(res => {
|
|
|
|
+ _this.setData({spinShow: false});
|
|
|
|
+ wx.stopPullDownRefresh()
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ const re = res.data
|
|
|
|
+ if( from== 0) tableData = [];
|
|
|
|
+ _this.setData({
|
|
|
|
+ from: re.from,
|
|
|
|
+ tableData: tableData.concat(re.list)
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+})
|