|
@@ -1,7 +1,13 @@
|
|
const app = getApp()
|
|
const app = getApp()
|
|
Page({
|
|
Page({
|
|
data: {
|
|
data: {
|
|
- info: {}
|
|
|
|
|
|
+ searchInfo: {},
|
|
|
|
+ list: [],
|
|
|
|
+ total: 0,
|
|
|
|
+ page: 0,
|
|
|
|
+ skip: 0,
|
|
|
|
+ limit: 5,
|
|
|
|
+ statusList: []
|
|
},
|
|
},
|
|
toPath(e) {
|
|
toPath(e) {
|
|
let data = e.detail;
|
|
let data = e.detail;
|
|
@@ -11,21 +17,84 @@ Page({
|
|
else if (data.type == '2') wx.relaunch({ url })
|
|
else if (data.type == '2') wx.relaunch({ url })
|
|
else if (data.type == '3') wx.switchTab({ url })
|
|
else if (data.type == '3') wx.switchTab({ url })
|
|
},
|
|
},
|
|
-
|
|
|
|
|
|
+ // 查询
|
|
|
|
+ async toSearch(e) {
|
|
|
|
+ const that = this;
|
|
|
|
+ that.setData({ 'searchInfo.name': e.detail.value })
|
|
|
|
+ that.clearPage();
|
|
|
|
+ that.search()
|
|
|
|
+ },
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
*/
|
|
- onLoad(options) {
|
|
|
|
|
|
+ async onLoad(options) {
|
|
const that = this;
|
|
const that = this;
|
|
wx.showLoading({ title: '加载中', mask: true })
|
|
wx.showLoading({ title: '加载中', mask: true })
|
|
- that.search()
|
|
|
|
|
|
+ await that.searchOther()
|
|
|
|
+ await that.search()
|
|
wx.hideLoading()
|
|
wx.hideLoading()
|
|
},
|
|
},
|
|
// 查询通知
|
|
// 查询通知
|
|
async search() {
|
|
async search() {
|
|
const that = this;
|
|
const that = this;
|
|
|
|
+ let info = { skip: that.data.skip, limit: that.data.limit, status: '2' };
|
|
|
|
+ let res = await app.$api('match', 'GET', { ...info, ...that.data.searchInfo })
|
|
|
|
+ if (res.errcode == '0') {
|
|
|
|
+ let list = [...that.data.list, ...res.data]
|
|
|
|
+ for (const val of list) {
|
|
|
|
+ val.status_name = that.getDict(val.status, 'status')
|
|
|
|
+ }
|
|
|
|
+ that.setData({ list })
|
|
|
|
+ that.setData({ total: res.total })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 分页-触底
|
|
|
|
+ toLower() {
|
|
|
|
+ const that = this;
|
|
|
|
+ let list = that.data.list;
|
|
|
|
+ let limit = that.data.limit;
|
|
|
|
+ if (that.data.total > list.length) {
|
|
|
|
+ wx.showLoading({ title: '加载中', mask: true })
|
|
|
|
+ let page = that.data.page + 1;
|
|
|
|
+ that.setData({ page })
|
|
|
|
+ let skip = page * limit
|
|
|
|
+ that.setData({ skip })
|
|
|
|
+ that.search()
|
|
|
|
+ wx.hideLoading()
|
|
|
|
+ } else {
|
|
|
|
+ wx.showToast({ title: `到底了没数据了`, icon: 'none' });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 分页-滚动
|
|
|
|
+ toScroll() {
|
|
|
|
+ // console.log('滚动');
|
|
|
|
+ },
|
|
|
|
+ // 字典
|
|
|
|
+ getDict(value, model) {
|
|
|
|
+ const that = this;
|
|
|
|
+ if (model == 'status') {
|
|
|
|
+ if (value) {
|
|
|
|
+ let data = that.data.statusList.find(i => i.value == value)
|
|
|
|
+ if (data) return data.label
|
|
|
|
+ else return '暂无'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 查询其他信息
|
|
|
|
+ async searchOther() {
|
|
|
|
+ const that = this;
|
|
|
|
+ let res;
|
|
|
|
+ res = await app.$api('dictData', 'GET', { type: 'match_status', is_use: '0' })
|
|
|
|
+ if (res.errcode == '0') that.setData({ statusList: res.data })
|
|
|
|
+ },
|
|
|
|
+ // 清空列表
|
|
|
|
+ clearPage() {
|
|
|
|
+ const that = this;
|
|
|
|
+ that.setData({ list: [] })
|
|
|
|
+ that.setData({ skip: 0 })
|
|
|
|
+ that.setData({ limit: 5 })
|
|
|
|
+ that.setData({ total: 0 })
|
|
},
|
|
},
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
*/
|