guests.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. console.log(r)
  39. this.setData({
  40. detail: r || {}
  41. })
  42. })
  43. },
  44. /**
  45. * 生命周期函数--监听页面初次渲染完成
  46. */
  47. onReady() {
  48. },
  49. /**
  50. * 生命周期函数--监听页面显示
  51. */
  52. onShow() {
  53. },
  54. /**
  55. * 生命周期函数--监听页面隐藏
  56. */
  57. onHide() {
  58. },
  59. /**
  60. * 生命周期函数--监听页面卸载
  61. */
  62. onUnload() {
  63. },
  64. /**
  65. * 页面相关事件处理函数--监听用户下拉动作
  66. */
  67. onPullDownRefresh() {
  68. },
  69. /**
  70. * 页面上拉触底事件的处理函数
  71. */
  72. onReachBottom() {
  73. },
  74. /**
  75. * 用户点击右上角分享
  76. */
  77. onShareAppMessage() {
  78. }
  79. })