import Api from "../../model/api"; import {logicStatus} from "../../model/enum"; import User from "../../model/user"; Page({ data: { show: false, id: '', info: {}, arr: [], logicStatusEnum: logicStatus, isComplete: null }, async onLoad(options) { const {id, isComplete} = options; let res = await Api.getRecommendInfo(id, true); this.setData({ isComplete, id, arr: res.data.rows[0], }) }, toNewsDetail(e) { console.log('e', e); // this.setData({ // show: true // }) wx.showModal({ title: '是否确认报名?', success: (res) => { if (res.confirm) { this.submitSignup(); } } }); }, async submitSignup() { const user = User.getUserInfoByLocal(); await Api.signUp({ teamId: this.data.id, name: user.name, phone: user.phone, }, true); this.setData({ isComplete: logicStatus.YES }) const eventChannel = this.getOpenerEventChannel() eventChannel.emit('sign'); await wx.showToast({ title: '报名成功', icon: 'success' }); setTimeout(() => { wx.navigateBack() }, 500); } });