const app = getApp(); Page({ /** * 页面的初始数据 */ data: { keyword:'', companyList:[] }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, getCompany(){ var that = this; app.requestP({ url:'/company/pageCompany', method:'post', contentType:' application/json', data:{ keyword: that.data.keyword || '', pageNum:1, pageSize:100, } }).then(res=>{ console.log(res.data.data.rows); that.setData({ companyList:res.data.data.rows }) }).catch(err=>{ app.showToptip(that,'error',err.data.msg) }) }, searchList(){ this.getCompany(); }, setKeyword(e) { this.setData({ keyword: e.detail.value }) }, applyJoin(e){ var that = this; var companyid = e.currentTarget.dataset.companyid; app.requestP({ url:'/companyUser/applyjoin', method:'post', contentType:'application/json', data:{ companyid, } }).then(res=>{ app.showToptip(that,'success',res.data.msg); wx.navigateTo({ url: '/pages/my/my', }) }).catch(err=>{ app.showToptip(that,'error',err.data.msg); }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })