import {formTypes} from "../../model/enum"; import Api from "../../model/api"; import Config from "../../model/config"; import {showLoading} from "../../utils/utils"; Page({ data: { formTypesEnum: formTypes, type: '', directionData: [], modelData: [], typeData: [], categoryData: [], teamId: '', eduStuId: '', eduStuName: '', }, async onLoad(options) { const {type, teamId, eduStuId, eduStuName} = options; wx.setNavigationBarTitle({title: type}); if (type == formTypes.NEEDS) { showLoading(); const [res1, res2, res3] = await Api.promiseAll([ Api.getPulishDict(Config.DICT.TRAIN_DIRECTION), Api.getPulishDict(Config.DICT.TRAIN_MODEL), Api.getPulishDict(Config.DICT.COURSE_TYPE), ]); this.setData({ directionData: res1.data, modelData: res2.data, typeData: res3.data, type }) wx.hideLoading(); } if (type == formTypes.TYPICAL) { const res = await Api.getPulishDict(Config.DICT.EXAMPLE_CATEGORY, true); this.setData({ categoryData: res.data, type }) } if (type == formTypes.DYNAMIC) { this.setData({ teamId, eduStuId, eduStuName, type }) } if (type == formTypes.HOT) { this.setData({ type }) } }, async postFinish(e) { await wx.showModal({ title: '发布成功', showCancel: false, }) const eventChannel = this.getOpenerEventChannel() eventChannel.emit('publish', {isSuccess: true}); wx.navigateBack() } });