gambit.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // pages/gambit/gambit.js
  2. const App = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. detail: {}
  9. },
  10. /**
  11. * 生命周期函数--监听页面加载
  12. */
  13. onLoad(options) {
  14. console.log(options)
  15. this.getDetail(options.id)
  16. },
  17. /**
  18. * 生命周期函数--监听页面初次渲染完成
  19. */
  20. onReady() {
  21. },
  22. /**
  23. * 生命周期函数--监听页面显示
  24. */
  25. onShow() {
  26. },
  27. getDetail(id) {
  28. wx.showLoading({
  29. title: '努力加载中...'
  30. })
  31. App._get(`experttopic/info/${id}`, {}, res => {
  32. if (res.code === 0) {
  33. this.setData({
  34. detail: res.expertTopic
  35. })
  36. wx.hideLoading()
  37. }
  38. })
  39. },
  40. /**
  41. * 生命周期函数--监听页面隐藏
  42. */
  43. onHide() {
  44. },
  45. /**
  46. * 生命周期函数--监听页面卸载
  47. */
  48. onUnload() {
  49. },
  50. /**
  51. * 页面相关事件处理函数--监听用户下拉动作
  52. */
  53. onPullDownRefresh() {
  54. },
  55. /**
  56. * 页面上拉触底事件的处理函数
  57. */
  58. onReachBottom() {
  59. },
  60. /**
  61. * 用户点击右上角分享
  62. */
  63. onShareAppMessage() {
  64. }
  65. })