recommandDetail.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import Api from "../../model/api";
  2. import {logicStatus} from "../../model/enum";
  3. import User from "../../model/user";
  4. Page({
  5. data: {
  6. show: false,
  7. id: '',
  8. info: {},
  9. arr: [],
  10. logicStatusEnum: logicStatus,
  11. isComplete: null
  12. },
  13. async onLoad(options) {
  14. const {id, isComplete} = options;
  15. let res = await Api.getRecommendInfo(id, true);
  16. this.setData({
  17. isComplete, id,
  18. arr: res.data.rows[0],
  19. })
  20. },
  21. toNewsDetail(e) {
  22. console.log('e', e);
  23. // this.setData({
  24. // show: true
  25. // })
  26. wx.showModal({
  27. title: '是否确认报名?',
  28. success: (res) => {
  29. if (res.confirm) {
  30. this.submitSignup();
  31. }
  32. }
  33. });
  34. },
  35. async submitSignup() {
  36. const user = User.getUserInfoByLocal();
  37. await Api.signUp({
  38. teamId: this.data.id,
  39. name: user.name,
  40. phone: user.phone,
  41. }, true);
  42. this.setData({
  43. isComplete: logicStatus.YES
  44. })
  45. const eventChannel = this.getOpenerEventChannel()
  46. eventChannel.emit('sign');
  47. await wx.showToast({
  48. title: '报名成功',
  49. icon: 'success'
  50. });
  51. setTimeout(() => {
  52. wx.navigateBack()
  53. }, 500);
  54. }
  55. });