publisherPage.js 2.5 KB

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