recommend.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. import Dialog from '@vant/weapp/dialog/dialog';
  2. const util = require('../../../../utils/util.js');
  3. const api = require('../../../../config/api.js');
  4. const app = getApp();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. rId: 0,
  11. checked: false,
  12. userName: '',
  13. avatarUrl: ''
  14. },
  15. /**
  16. * 生命周期函数--监听页面加载
  17. */
  18. onLoad: function (options) {
  19. if (options.rId) {
  20. this.setData({
  21. rId: options.rId
  22. });
  23. app.globalData.rId = options.rId;
  24. this.getReferrerRidInfo();
  25. }
  26. },
  27. getReferrerRidInfo() {
  28. util.request(api.ReferrerRidInfo, {
  29. rId: this.data.rId,
  30. }, "GET")
  31. .then((res) => {
  32. if (res.errno == 0) {
  33. this.setData({
  34. userName: res.data.applyName,
  35. avatarUrl: res.data.avatar
  36. })
  37. app.globalData.recommend = {
  38. bCode: res.data.bCode,
  39. userName: res.data.applyName,
  40. avatarUrl: res.data.avatar
  41. };
  42. } else {
  43. util.showErrorToast(res.errmsg);
  44. }
  45. });
  46. },
  47. /**
  48. * 生命周期函数--监听页面初次渲染完成
  49. */
  50. onReady: function () {
  51. },
  52. /**
  53. * 生命周期函数--监听页面显示
  54. */
  55. onShow: function () {
  56. },
  57. onChange(e) {
  58. console.log(e);
  59. this.setData({
  60. checked: e.detail,
  61. });
  62. },
  63. confirmJoin() {
  64. if (!this.data.checked) {
  65. Dialog.alert({
  66. title: '提示',
  67. message: '请阅读《用户条款》并勾选',
  68. }).then(() => {
  69. // on close
  70. });
  71. } else {
  72. wx.navigateTo({
  73. url: '../confirm/confirm'
  74. });
  75. }
  76. },
  77. userProtocol() {
  78. wx.navigateTo({
  79. url: '../protocol/protocol'
  80. });
  81. },
  82. /**
  83. * 生命周期函数--监听页面隐藏
  84. */
  85. onHide: function () {
  86. },
  87. /**
  88. * 生命周期函数--监听页面卸载
  89. */
  90. onUnload: function () {
  91. },
  92. /**
  93. * 页面相关事件处理函数--监听用户下拉动作
  94. */
  95. onPullDownRefresh: function () {
  96. },
  97. /**
  98. * 页面上拉触底事件的处理函数
  99. */
  100. onReachBottom: function () {
  101. },
  102. /**
  103. * 用户点击右上角分享
  104. */
  105. onShareAppMessage: function () {
  106. }
  107. })