myworksheet.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // pages/ucenter/myworksheet/myworksheet.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. userInfo: {},
  8. isLogin: false,
  9. worksheets: []
  10. },
  11. goInfo(e) {
  12. let {
  13. keywords
  14. } = e.currentTarget.dataset;
  15. //console.log(keywords);
  16. let worksheet = JSON.stringify(keywords);
  17. //console.log(worksheet);
  18. let url = '/pages/worksheetinfo/worksheetinfo?worksheet=' + worksheet;
  19. wx.navigateTo({
  20. url
  21. });
  22. },
  23. /**
  24. * 生命周期函数--监听页面加载
  25. */
  26. onLoad: function (options) {
  27. },
  28. /**
  29. * 生命周期函数--监听页面初次渲染完成
  30. */
  31. onReady: function () {
  32. },
  33. /**
  34. * 生命周期函数--监听页面显示
  35. */
  36. onShow: function () {
  37. let userInfo = wx.getStorageSync('userInfo');
  38. let isLogin = wx.getStorageSync('isLogin');
  39. let that = this;
  40. // 页面显示
  41. if (userInfo && isLogin) {
  42. //userInfo.flag = true;
  43. this.setData({
  44. userInfo: userInfo,
  45. isLogin: isLogin
  46. });
  47. wx.request({
  48. url: getApp().globalData.postHeadAgreement +'/restapi/wechat/workSheets',
  49. data: {
  50. accendant: userInfo.userName
  51. //accendant: '康国栋'
  52. },
  53. method: 'POST',
  54. success(res) {
  55. console.log(res);
  56. if (res.data) {
  57. let {
  58. data: worksheets
  59. } = res;
  60. that.setData({
  61. worksheets
  62. });
  63. }
  64. }
  65. });
  66. }
  67. },
  68. /**
  69. * 生命周期函数--监听页面隐藏
  70. */
  71. onHide: function () {
  72. },
  73. /**
  74. * 生命周期函数--监听页面卸载
  75. */
  76. onUnload: function () {
  77. },
  78. /**
  79. * 页面相关事件处理函数--监听用户下拉动作
  80. */
  81. onPullDownRefresh: function () {
  82. },
  83. /**
  84. * 页面上拉触底事件的处理函数
  85. */
  86. onReachBottom: function () {
  87. },
  88. /**
  89. * 用户点击右上角分享
  90. */
  91. onShareAppMessage: function () {
  92. }
  93. })