// pages/mineAgency/index.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { list: [], deleteAgencyShow: false, storeJobListSearchForm: { pageNum: 1, pageSize: 20, keys:'' }, }, /** * 生命周期函数--监听页面加载 */ onLoad (options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady () { }, /** * 生命周期函数--监听页面显示 */ onShow () { this.getList(); }, getList(){ let that = this; wx.request({ url: app.globalData.ip + "/assistant/mine/getAgency", header: app.globalData.headers, method: "POST", data: this.data.storeJobListSearchForm, success: function (res) { console.log(res); if (res.data.status == 200) { that.setData({ list: res.data.data.list, }); } }, }); }, inputTyping: function (e) { this.setData({ inputVal: e.detail.value, }); if (this.data.inputVal == "") { this.setData({ list: [], }); this.data.storeJobListSearchForm.pageNum = 1; this.data.storeJobListSearchForm.keys = ""; this.getList(); } }, clearInput: function () { this.setData({ inputVal: "", chaShowed: false, inputShowed: false, list: [], }); this.data.storeJobListSearchForm.pageNum = 1; this.data.storeJobListSearchForm.keys = ""; this.getList(); }, searchKey: function (e) { console.log(e); if (this.data.inputVal == "" && this.data.placeholderText == "请输入关键词") { wx.showToast({ title: "请输入内容", icon: "none", }); } else { this.setData({ list: [], }); this.data.storeJobListSearchForm.pageNum = 1; this.data.storeJobListSearchForm.keys = this.data.inputVal || this.data.placeholderText; this.setData({ inputVal: this.data.inputVal, }); this.getList(); } }, sureDelete () { let that = this wx.showModal({ title: '删除代理', content: '删除后,将无法查看此代理名下的职位。', confirmColor: "#00B666", success: function (res) { if (res.confirm) { console.log("用户点击确定"); wx.showToast({ title: '删除成功', icon: 'success' }) that.setData({ deleteAgencyShow: false }) } else if (res.cancel) { console.log("用户点击取消"); } }, }); }, cancelDelete () { this.setData({ deleteAgencyShow: false }) }, deleteAgency () { this.setData({ deleteAgencyShow: true }) }, /** * 抽屉组件隐藏 * * */ hidedrawershow (e) { console.log(e); this.setData({ [e.detail.type]: false }) }, /** * 生命周期函数--监听页面隐藏 */ onHide () { }, /** * 生命周期函数--监听页面卸载 */ onUnload () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom () { }, /** * 用户点击右上角分享 */ onShareAppMessage () { } })