import {getDataSet, getEventParam, throttle, toast} from "../../../../utils/utils"; import Api from "../../../../model/api"; import Config from "../../../../model/config"; Component({ properties: { teamId: String, eduStuId: String, eduStuName: String, }, data: { msg: '', attachmentType: '', attachmentUrl: '', uploadPath: Config.UPLOAD_PATH.TEAM_INTERACTION }, methods: { onChange(e) { const field = getDataSet(e, "field"); this.setData({ [field]: getEventParam(e) }) }, handleUpload(e) { const fileType = getEventParam(e, "fileType"); const fileList = getEventParam(e, "fileList"); const urls = fileList.map(item => item.url); const attachmentUrl = JSON.stringify(urls); this.setData({ attachmentType: fileType, attachmentUrl }) }, publish: throttle(async function (e) { if (!this.data.msg.trim()) { toast('请输入内容') return; } const params = { issues: this.data.msg, attachmentType: this.data.attachmentType, attachmentUrl: this.data.attachmentUrl, stuId: this.data.eduStuId, teamId: this.data.teamId, stuName: this.data.eduStuName } await Api.publishTeamInteraction(params, true); this.triggerEvent("postFinish"); }) } })