myworksheet.js 2.0 KB

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