WeChat Mini Programs's secondary development adds a comment function to report an error.

problem description

Click on the message to submit a comment and report an error.

related codes

var app = getApp (), WxParse = require (".. /.. / public/wxParse/wxParse.js"), article = null;
var input_value;
var actid;
var user_id;
Page ({

)
data: {
    syscfg: {},
    user: {},
    actid: null,
    actdata: null,
    setcont: "0",
    barTitle: "",
    input_value: "",
    msg_data: "",
    to_open: "none",
    to_cover: "none",
    user_id:""
},
open_all: function () {
  var that = this;
  that.setData({
    to_open: "block",
    to_cover: "block"
  })
},
to_cover_over: function () {
  var that = this;
  that.setData({
    to_open: "none",
    to_cover: "none"
  })
},
btn_send: function () {
  var that = this
  var fetch1
  var fetch
  //
  console.log(actid);
  wx.request({
    url: "https://m.yishushe.net/addons/slwl_fitment/remark.php?action=add_com",
    method: "POST",
    header: {
      "content-Type": "application/x-www-form-urlencoded",
      "Accept": "application/json"
    },
    data: {
      act_id: actid,
      user_id: user_id,
      input_value: input_value
    },
    success: function (result) {
      that.setData({
        input_value: "",
        to_open: "none",
        to_cover: "none"
      })
      // fetch
      wx.request({
        url: "https://m.yishushe.net/addons/slwl_fitment/remark.php?action=fetch_com",
        method: "POST",
        header: {
          "content-Type": "application/x-www-form-urlencoded",
          "Accept": "application/json"
        },
        data: {
          id: actid
        },
        success: result => {
          if (result.data.result == "success") {
            fetch = result.data.msg
            console.log(fetch)
            that.setData({
              msg_data: fetch
            })
          } else if (result.data.msg == "session") {
            //
            wx.showToast({
              title: "",
              image: "/image/wrong.png",
              duration: 3000
            })
          } else if (result.data.msg == "") {
            //do nothing
          } else {
            wx.showToast({
              title: result.data.msg,
              image: "/image/wrong.png",
              duration: 3000
            })
          }
        },
        fail: res => {
          wx.showToast({
            title: "",
            image: "/image/wrong.png",
            duration: 3000
          })
        }
      })
    },
    fail: res => {
      wx.showToast({
        title: "",
        image: "/image/wrong.png",
        duration: 3000
      })
    }
  })
},
bindLinkClick: function(a) {
    app.sitefun.clickObjectLink(a, app);
},
bindCopyrightClick: function(a) {
    app.sitefun.clickCopyright(a, app);
},
suspendCloseClick: function() {
    "0" == app.sys.suspend.suspend_show ? this.setData({
        "syscfg.suspend.suspend_show": "1"
    }) : this.setData({
        "syscfg.suspend.suspend_show": "0"
    });
},
onLoad: function(a) {
  var that = this
  var fetch
  wx.getStorage({
    key: "appUserInfo",
    success: function (res) {
      user_id = res.data.id
      that.setData({
        user_id: user_id
      })
    }
  })
  // fetch
  wx.request({
    url: "https://m.yishushe.net/addons/slwl_fitment/remark.php?action=fetch_com",
    method: "POST",
    header: {
      "content-Type": "application/x-www-form-urlencoded",
      "Accept": "application/json"
    },
    data: {
      id: actid
    },
    success: result => {
      if (result.data.result == "success") {
        fetch = result.data.msg
        console.log(fetch)
        that.setData({
          msg_data: fetch
        })
      } else if (result.data.msg == "session") {
        //
        wx.showToast({
          title: "",
          image: "/image/wrong.png",
          duration: 3000
        })
      } else if (result.data.msg == "") {
        //do nothing
      } else {
        wx.showToast({
          title: result.data.msg,
          image: "/image/wrong.png",
          duration: 3000
        })
      }
    },
    fail: res => {
      wx.showToast({
        title: "",
        image: "/image/wrong.png",
        duration: 3000
      })
    }
  })


    if (this.setData({
        actid: a.id
    }), null == app.globalData.userInfo || "undefined" == app.globalData.userInfo) {
        var t = app.sitefun.getCurrentPageUrlWithArgs();
        wx.redirectTo({
            url: "/pages/auth/auth?rb=" + encodeURIComponent(t)
        });
    } else wx.showNavigationBarLoading(), app.info.isLoadInterval = setInterval(this.checkInfo, 500);
},
checkInfo: function() {
    null != app.sys && (clearInterval(app.info.isLoadInterval), wx.hideNavigationBarLoading(), 
    this.setConfig(), this.setActContent(), this.checkPop());
},
setConfig: function() {
    this.setData({
        syscfg: app.sys,
        user: app.globalData.userInfo
    }), app.sitefun.appConfig(app);
},
setActContent: function() {
    var t = this, a = t.data.actid;
    wx.request({
        url: app.siteInfo.siteroot + "?i=" + app.siteInfo.uniacid + "&c=entry&a=wxapp&do=smk_actnews_one&m=" + app.moduleName,
        data: {
            aid: a
        },
        success: function(a) {
            t.setData({
                actdata: a.data.data.one,
                barTitle: a.data.data.one.newsname
            }), wx.setNavigationBarTitle({
                title: a.data.data.one.newsname
            }), article = a.data.data.one.detail, WxParse.wxParse("article", "html", article, t);
        },
        error: function(a) {
            wx.showToast({
              title: a,
                image: "/public/images/icon_error.png"
            });
        }
    });
},
checkPop: function() {
    var t = this;
    wx.request({
        url: app.siteInfo.siteroot + "?i=" + app.siteInfo.uniacid + "&c=entry&a=wxapp&do=smk_get_adpop&m=" + app.moduleName,
        data: {
            uid: app.globalData.userInfo.uid
        },
        header: {
            "content-type": "application/json"
        },
        success: function(a) {
            t.setData({
                myadpop: a.data.data
            });
        },
        error: function(a) {
            wx.showToast({
                title: a,
                image: "/public/images/icon_error.png"
            });
        }
    });
},
adpopClose: function() {
    0 == this.data.myadpop.adpop_show ? this.setData({
        "myadpop.adpop_show": "1"
    }) : this.setData({
        "myadpop.adpop_show": "0"
    });
},
onReady: function() {},
onShow: function() {},
onHide: function() {},
onUnload: function() {},
onPullDownRefresh: function() {},
onReachBottom: function() {},
onShareAppMessage: function() {
    return {
        title: app.sys.appname,
        success: function(a) {},
        fail: function(a) {}
    };
}

});

what is the error message of the developer tooltip in Wechat?

showToast:fail parameter error: parameter.title should be String instead of Undefined;

console.error @ VM6812:1
Y @ WAService.js:6
z @ WAService.js:6
vs @ WAService.js:10
(anonymous) @ WAService.js:6
(anonymous) @ WAService.js:7
(anonymous) @ WAService.js:14
(anonymous) @ WAService.js:6
success @ actnews.js? [sm]: 85
function.a. (anonymous function) @ WAService.js:7
(anonymous) @ WAService.js:6
(anonymous) @ WAService.js:4
(anonymous) @ WAService.js:7
L.emit @ WAService.js:8
(anonymous) @ WAService.js:12
(anonymous) @ WAService.js:6
a @ appservice?t=1536166881574:10965
(anonymous) @ appservice?t=1536166881574:10965
b.emit @ appservice?t=1536166881574:10965
callback @ appservice?t=1536166881574:10965
setTimeout @ appservice?t=1536166881574:10965 br @ br Js:4
(anonymous) @ WAService.js:4
setTimeout (async)
setTimeout @ WAService.js:4
n @ appservice?t=1536166881574:10965
c @ appservice?t=1536166881574:10965
v.onreadystatechange @ appservice?t=1536166881574:10965
XMLHttpRequest.send (async)
Q @ appservice?t=1536166881574:10965
createRequestTask @ appservice?t=1536166881574:10965
invoke @ appservice?t=1536166881574:10965
invoke @ WAService.js:4
U @ WAService.js:6
H @ WAService.js:6
Rt @ WAService.js:7 @ WAService.js:7
(anonymous) @ WAService.js:14
(anonymous) @ WAService.js:6
success @ actnews.js? [sm]: 58
function.a. (anonymous function) @ WAService.js:7
(anonymous) @ WAService.js:6
(anonymous) @ WAService.js:4
(anonymous) @ WAService.js:7
L.emit @ WAService.js:8
(anonymous) @ WAService.js:12
(anonymous) @ WAService.js:6
a @ appservice?t=1536166881574:10965
(anonymous) @ appservice?t=1536166881574:10965
b.emit @ appservice?t=1536166881574:10965
callback @ appservice?t=1536166881574:10965
setTimeout @ appservice?t=1536166881574:10965 br @ br Js:4
(anonymous) @ WAService.js:4
setTimeout (async)
setTimeout @ WAService.js:4
n @ appservice?t=1536166881574:10965
c @ appservice?t=1536166881574:10965
v.onreadystatechange @ appservice?t=1536166881574:10965
XMLHttpRequest.send (async)
Q @ appservice?t=1536166881574:10965
createRequestTask @ appservice?t=1536166881574:10965
invoke @ appservice?t=1536166881574:10965
invoke @ WAService.js:4
U @ WAService.js:6
H @ WAService.js:6
Rt @ WAService.js:7 @ WAService.js:7
(anonymous) @ WAService.js:14
(anonymous) @ WAService.js:6
btn_send @ actnews.js? [sm]: 39
(anonymous) @ WAService.js:19
l @ WAService.js:18
Dt @ WAService.js:19
ln @ WAService.js:20
(anonymous) @ WAService.js:20
(anonymous) @ WAService.js:19
(anonymous) @ WAService.js:10
n @ appservice?t=1536166881574:10965
a @ appservice?t=1536166881574:10965
e.registerCallback @ appservice?t=1536166881574:10965
n.forEach @ appservice?t=1536166881574:10965
d @ appservice?t=1536166881574:10965
k.onmessage @ appservice?t=1536166881574:10965

the environment in which the problem occurs

second development, add comment function to the original program

May.28,2021

look at the picture
clipboard.png

Menu