guests.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // pages/detail/guests.js
  2. import api from "../../api/index"
  3. const {
  4. globalData: {
  5. systemInfo: {
  6. windowWidth
  7. }
  8. }
  9. } = getApp()
  10. Page({
  11. /**
  12. * 页面的初始数据
  13. */
  14. data: {
  15. detail : {}
  16. },
  17. imageload(e){
  18. const {
  19. detail: {
  20. width,
  21. height
  22. }
  23. } = e;
  24. const rWidth = windowWidth * 0.3
  25. const rheight = height / width * rWidth;
  26. const item = JSON.parse(JSON.stringify(this.data.detail));
  27. item.width = rWidth;
  28. item.height = rheight;
  29. this.setData({
  30. detail: item
  31. })
  32. },
  33. /**
  34. * 生命周期函数--监听页面加载
  35. */
  36. onLoad(options) {
  37. api.getGuestsDetail({id: options.id}).then(r=>{
  38. this.setData({
  39. detail: r || {}
  40. })
  41. })
  42. },
  43. /**
  44. * 生命周期函数--监听页面初次渲染完成
  45. */
  46. onReady() {
  47. },
  48. /**
  49. * 生命周期函数--监听页面显示
  50. */
  51. onShow() {
  52. },
  53. /**
  54. * 生命周期函数--监听页面隐藏
  55. */
  56. onHide() {
  57. },
  58. /**
  59. * 生命周期函数--监听页面卸载
  60. */
  61. onUnload() {
  62. },
  63. /**
  64. * 页面相关事件处理函数--监听用户下拉动作
  65. */
  66. onPullDownRefresh() {
  67. },
  68. /**
  69. * 页面上拉触底事件的处理函数
  70. */
  71. onReachBottom() {
  72. },
  73. /**
  74. * 用户点击右上角分享
  75. */
  76. onShareAppMessage() {
  77. }
  78. })