|
@@ -41,23 +41,22 @@ Page({
|
|
|
onSubmit: async function (e) {
|
|
|
const that = this;
|
|
|
const params = e.detail.value;
|
|
|
- const data = that.data.info;
|
|
|
const user = that.data.user;
|
|
|
params.create_time = moment().format('YYYY-MM-DD');
|
|
|
params.openid = user.openid;
|
|
|
params.name = user.name;
|
|
|
- that.setData({ form: '' })
|
|
|
- data.stick.push(params)
|
|
|
+ let stick = [...that.data.info.stick, params];
|
|
|
if (!this.WxValidate.checkForm(params)) {
|
|
|
const error = this.WxValidate.errorList[0];
|
|
|
wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
|
|
|
return false
|
|
|
} else {
|
|
|
- let arr;
|
|
|
- if (data._id) {
|
|
|
- arr = await app.$post(`/newCourt/api/topic/${data._id}`, data);
|
|
|
+ const arr = await app.$post(`/newCourt/api/topic/${that.data.id}`, { stick: stick });
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ wx.showToast({ title: `发帖完成`, icon: 'success', duration: 2000 });
|
|
|
+ that.toClose(); that.watchLogin();
|
|
|
+ that.setData({ form: {} })
|
|
|
}
|
|
|
- if (arr.errcode == '0') { wx.showToast({ title: `维护信息完成`, icon: 'success', duration: 2000 }); that.toClose(); that.watchLogin(); }
|
|
|
else wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
|
|
|
}
|
|
|
},
|
|
@@ -82,7 +81,6 @@ Page({
|
|
|
const arr = await app.$get(`/newCourt/api/topic/${that.data.id}`);
|
|
|
if (arr.errcode == '0') {
|
|
|
that.setData({ info: arr.data });
|
|
|
- console.log(arr.data);
|
|
|
let content = arr.data.content.replace(/\<img/gi, '<img style="width:100%;height:auto;margin: 5px 0"');
|
|
|
this.setData({ 'info.content': content });
|
|
|
}
|