// pages/ucenter/myworksheet/myworksheet.js Page({ /** * 页面的初始数据 */ data: { userInfo: {}, isLogin: false, worksheets: [] }, goInfo(e) { let { keywords } = e.currentTarget.dataset; //console.log(keywords); let worksheet = JSON.stringify(keywords); //console.log(worksheet); let url = '/pages/worksheetinfo/worksheetinfo?worksheet=' + worksheet; wx.navigateTo({ url }); }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { let userInfo = wx.getStorageSync('userInfo'); let isLogin = wx.getStorageSync('isLogin'); let that = this; // 页面显示 if (userInfo && isLogin) { //userInfo.flag = true; this.setData({ userInfo: userInfo, isLogin: isLogin }); wx.request({ url: getApp().globalData.postHeadAgreement +'/restapi/wechat/workSheets', data: { accendant: userInfo.userName //accendant: '康国栋' }, method: 'POST', success(res) { console.log(res); if (res.data) { let { data: worksheets } = res; that.setData({ worksheets }); } } }); } }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })