myworksheet.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. addNew(e) {
  24. let url = '/pages/worksheetinfo/addworksheetinfo';
  25. wx.navigateTo({
  26. url
  27. });
  28. },
  29. /**
  30. * 生命周期函数--监听页面加载
  31. */
  32. onLoad: function (options) {
  33. },
  34. /**
  35. * 生命周期函数--监听页面初次渲染完成
  36. */
  37. onReady: function () {
  38. },
  39. /**
  40. * 生命周期函数--监听页面显示
  41. */
  42. onShow: function () {
  43. let userInfo = wx.getStorageSync('userInfo');
  44. let isLogin = wx.getStorageSync('isLogin');
  45. let that = this;
  46. // 页面显示
  47. if (userInfo && isLogin) {
  48. //userInfo.flag = true;
  49. this.setData({
  50. userInfo: userInfo,
  51. isLogin: isLogin
  52. });
  53. wx.request({
  54. url: getApp().globalData.postHeadAgreement +'/restapi/wechat/workSheets',
  55. data: {
  56. accendant: userInfo.userName
  57. //accendant: '康国栋'
  58. },
  59. method: 'POST',
  60. success(res) {
  61. // console.log(res);
  62. if (res.data) {
  63. let {
  64. data: worksheets
  65. } = res;
  66. that.setData({
  67. worksheets
  68. });
  69. }
  70. }
  71. });
  72. }
  73. },
  74. /**
  75. * 生命周期函数--监听页面隐藏
  76. */
  77. onHide: function () {
  78. },
  79. /**
  80. * 生命周期函数--监听页面卸载
  81. */
  82. onUnload: function () {
  83. },
  84. /**
  85. * 页面相关事件处理函数--监听用户下拉动作
  86. */
  87. onPullDownRefresh: function () {
  88. },
  89. /**
  90. * 页面上拉触底事件的处理函数
  91. */
  92. onReachBottom: function () {
  93. },
  94. /**
  95. * 用户点击右上角分享
  96. */
  97. onShareAppMessage: function () {
  98. }
  99. })