service.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // pages/service/service.js
  2. const {fetchGraphql} = require('../../utils/util.js');
  3. const {servicebyprops} = require('../../config/gql.js');
  4. Page({
  5. data: {
  6. serverID: '',
  7. loading: true,
  8. service: ''
  9. },
  10. chooseThis(e) {
  11. wx.navigateTo({
  12. url: `../message/message?id=${e.target.id}&count=${e.target.dataset.count}&repertoryID=${e.target.dataset.repertoryid}`,
  13. })
  14. },
  15. /**
  16. * 生命周期函数--监听页面加载
  17. */
  18. onLoad: function (options) {
  19. this.setData({
  20. serverID: options.id
  21. });
  22. fetchGraphql(servicebyprops, {server_id: this.data.serverID}, 'service', 'servicebyprops', this).then(service => {
  23. this.setData({
  24. loading: false,
  25. service
  26. });
  27. });
  28. },
  29. /**
  30. * 生命周期函数--监听页面初次渲染完成
  31. */
  32. onReady: function () {
  33. wx.setNavigationBarTitle({
  34. title: '选择TA的服务'
  35. })
  36. },
  37. /**
  38. * 生命周期函数--监听页面显示
  39. */
  40. onShow: function () {
  41. },
  42. /**
  43. * 生命周期函数--监听页面隐藏
  44. */
  45. onHide: function () {
  46. },
  47. /**
  48. * 生命周期函数--监听页面卸载
  49. */
  50. onUnload: function () {
  51. },
  52. /**
  53. * 页面相关事件处理函数--监听用户下拉动作
  54. */
  55. onPullDownRefresh: function () {
  56. },
  57. /**
  58. * 页面上拉触底事件的处理函数
  59. */
  60. onReachBottom: function () {
  61. },
  62. /**
  63. * 用户点击右上角分享
  64. */
  65. onShareAppMessage: function () {
  66. }
  67. });