Browse Source

修改话题发帖

YY 2 years ago
parent
commit
5318fa2fe3
3 changed files with 8 additions and 8 deletions
  1. 6 8
      pages/topic/info.js
  2. 1 0
      pages/topic/info.less
  3. 1 0
      pages/topic/info.wxss

+ 6 - 8
pages/topic/info.js

@@ -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 });
                     }

+ 1 - 0
pages/topic/info.less

@@ -100,6 +100,7 @@
                             width: 93vw;
                             font-size: 14px;
                             text-align: right;
+                            color: #666;
                         }
                     }
                 }

+ 1 - 0
pages/topic/info.wxss

@@ -85,6 +85,7 @@
   width: 93vw;
   font-size: 14px;
   text-align: right;
+  color: #666;
 }
 .main .foot {
   position: fixed;