You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
119 lines
2.0 KiB
119 lines
2.0 KiB
let common = getApp().globalData.commonFun; |
|
let util = getApp().globalData.utilFun; |
|
Page({ |
|
/** |
|
* 页面的初始数据 |
|
*/ |
|
data: { |
|
box_arr:[], |
|
num:0, |
|
page:1, |
|
title:"", |
|
flag:false |
|
}, |
|
// 跳转详情 |
|
loan(e) { |
|
let id = e.currentTarget.dataset.id |
|
wx.navigateTo({ |
|
url: `../loanDetails/loanDetails?id=${id}`, |
|
}) |
|
}, |
|
/** |
|
* 生命周期函数--监听页面加载 |
|
*/ |
|
onLoad: function (options) { |
|
this.setData({ |
|
num:options.num |
|
}) |
|
this.getData() |
|
}, |
|
getData() { |
|
let url = `api/product-lists?page=${this.data.page}&limit=10&title=${this.data.title}` |
|
util.httpRequest(url).then((res) => { |
|
if (res.code == '200') { |
|
res.data.map(item=>{ |
|
item.tag = item.tag.split(",") |
|
}) |
|
this.setData({ |
|
box_arr: this.data.box_arr.concat(res.data), |
|
flag:true |
|
}) |
|
console.log(this.data.box_arr) |
|
} |
|
}) |
|
}, |
|
// 搜索 |
|
search (e) { |
|
this.setData({ |
|
title:e.detail.value |
|
}) |
|
if (this.data.title == '') { |
|
this.setData({ |
|
flag: false, |
|
box_arr: [], |
|
page:1 |
|
}) |
|
this.getData() |
|
} |
|
}, |
|
// 搜索按钮 |
|
button_search () { |
|
this.setData({ |
|
flag:false, |
|
box_arr:[], |
|
page:1 |
|
}) |
|
this.getData() |
|
}, |
|
/** |
|
* 生命周期函数--监听页面初次渲染完成 |
|
*/ |
|
onReady: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面显示 |
|
*/ |
|
onShow: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面隐藏 |
|
*/ |
|
onHide: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面卸载 |
|
*/ |
|
onUnload: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 页面相关事件处理函数--监听用户下拉动作 |
|
*/ |
|
onPullDownRefresh: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 页面上拉触底事件的处理函数 |
|
*/ |
|
onReachBottom: function () { |
|
this.setData({ |
|
page:this.data.page+1 |
|
}) |
|
this.getData() |
|
}, |
|
|
|
/** |
|
* 用户点击右上角分享 |
|
*/ |
|
onShareAppMessage: function () { |
|
|
|
} |
|
}) |