使用editor组件向后台提交html内容时,后台无法解析?
希望各位大佬帮帮忙
//发布动态
if (res.confirm) {
var outfile = '';
console.log(files);
if(files!=undefined)
{
if (files.length > 0) {
for (var file in files) {
if (outfile == '') {
outfile = files[file];
}
else {
outfile += ',' + files[file];
}
}
}
}
console.log(outfile);
// const pub = PubContent.replace(/\"/g,"'");
const pub = PubContent.replace(/wx:nodeid="\d+"/g,'');
const content = pub.replace(/\"/g,"'");
// const con = content.replace(/=/g,":");
let data = {
'UserName': 'ycl',
'ApprovalFlag': 1,
'Title': title,
'PubContent': content,
'UploadFile': outfile,
'ShortDes': ShortDes
};
//var abc = JSON.stringify(data).toString().replace(new RegExp("\\\\\"","gm"),"\"");
// var a = abc.PubContent
console.log(JSON.stringify(data));
api.community.publish(JSON.stringify(data), (state, result) => {
console.log(state, result);
if (state == 'success' && result.data.StatusCode == 1000) {
wx.showToast({
title: '发布成功',
duration:1500,
})
} else {
wx.showModal({
title: '提示',
content: '发布失败',
showCancel: false
})
}
})