12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import {getDataSet, getEventParam, throttle, toast} from "../../../../utils/utils";
- import Api from "../../../../model/api";
- import Config from "../../../../model/config";
- Component({
- properties: {},
- data: {
- msg: '',
- attachmentType: '',
- attachmentUrl: '',
- uploadPath: Config.UPLOAD_PATH.COMMUNITY_FOCUSISSUES
- },
- 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
- }
- await Api.ReleaseHot(params, true);
- this.triggerEvent("postFinish");
- })
- }
- })
|