publisherPage.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. // miniprogram/pages/publisherPage/publisherPage.js
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. pubInfo: null,
  9. hasPubInfo: false,
  10. pubName: [],
  11. pubIndex: 0
  12. },
  13. publisherHome: function () {
  14. wx.navigateTo({
  15. url: '/pages/publisher/publisher',
  16. }).then(res => {
  17. res.eventChannel.emit('loadCommonData', {
  18. data: this.data.pubInfo[this.data.pubIndex]
  19. })
  20. })
  21. },
  22. activityPublish: function () {
  23. wx.navigateTo({
  24. url: "/pages/activityPublish/activityPublish?id=" + this.data.pubInfo[this.data.pubIndex].pub_id,
  25. })
  26. },
  27. publisherQuestion: function () {
  28. wx.navigateTo({
  29. url: "/pages/publisherQuestion/publisherQuestion?id=" + this.data.pubInfo[this.data.pubIndex].pub_id
  30. })
  31. },
  32. administratorSetting: function () {
  33. wx.navigateTo({
  34. url: "/pages/administratorSetting/administratorSetting?id=" + this.data.pubInfo[this.data.pubIndex].pub_id
  35. })
  36. },
  37. publisherInfoChange: function () {
  38. wx.navigateTo({
  39. url: "/pages/publisherInfoChange/publisherInfoChange?id=" + this.data.pubInfo[this.data.pubIndex].pub_id
  40. })
  41. },
  42. publisherLogin: function () {
  43. wx.navigateTo({
  44. url: "/pages/publisherLogin/publisherLogin",
  45. })
  46. },
  47. /**
  48. * 生命周期函数--监听页面加载
  49. */
  50. onLoad: function (options) {
  51. if (app.globalData.hasUserInfo) {
  52. const pubName = []
  53. for (let i = 0; i < app.globalData.pubInfo.length; i++) {
  54. pubName.push(app.globalData.pubInfo[i].publisher.name)
  55. }
  56. this.setData({
  57. pubInfo: app.globalData.pubInfo,
  58. hasPubInfo: true,
  59. pubName: pubName,
  60. pubIndex: 0
  61. })
  62. } else {
  63. wx.showToast({
  64. title: '请先登录',
  65. icon: 'none'
  66. })
  67. }
  68. },
  69. /**
  70. * 生命周期函数--监听页面初次渲染完成
  71. */
  72. onReady: function () {
  73. },
  74. /**
  75. * 生命周期函数--监听页面显示
  76. */
  77. onShow: function () {
  78. },
  79. /**
  80. * 生命周期函数--监听页面隐藏
  81. */
  82. onHide: function () {
  83. },
  84. /**
  85. * 生命周期函数--监听页面卸载
  86. */
  87. onUnload: function () {
  88. },
  89. /**
  90. * 页面相关事件处理函数--监听用户下拉动作
  91. */
  92. onPullDownRefresh: function () {
  93. },
  94. /**
  95. * 页面上拉触底事件的处理函数
  96. */
  97. onReachBottom: function () {
  98. },
  99. /**
  100. * 用户点击右上角分享
  101. */
  102. onShareAppMessage: function () {
  103. }
  104. })