一. 在 wxParse->html2Json.js 文件进行处理

1.设备信息获取
var isAndroid;
var isIos;

wx.getSystemInfo({
  success: function (res) {
    isAndroid = res.system.toLowerCase().indexOf('android') != -1;
    isIos = res.system.toLowerCase().indexOf('ios') != -1;
  }
})
2.处理function html2json方法
//对img添加额外数据
if (node.tag === 'img') {
  node.full_path = node.attr.src; 
  node.imgIndex = results.images.length;
  var imgUrl = node.attr.src;
  // jpg正则
  var reg = /[http|https]:\/\/.*?(jpg)/gi;
  imgUrl = wxDiscode.urlToHttpUrl(imgUrl, __placeImgeUrlHttps);
  // 正则匹配图片地址
  if (reg.test(imgUrl)) {
    //不包含其他url参数
    if (imgUrl.indexOf('?') == -1 ){
      imgUrl += '?x-oss-process=image/resize,m_lfit,w_500';
    }else{
      imgUrl += '&x-oss-process=image/resize,m_lfit,w_500';
    }
  }
  if ( isAndroid ){
    if (imgUrl.indexOf('x-oss-process=image/resize') != -1) {
      imgUrl += '/format,webp';
    } else {
      imgUrl += '?x-oss-process=image/format,webp';
    }
  }
  node.attr.src = imgUrl;
  node.from = bindName;
  results.images.push(node);
  results.imageUrls.push(imgUrl);
}
            

二. 在 wxParse->wxParse.wxml 文件进行处理

1.处理模板
<template name="wxParseImg">
    <image class=" wxParse-" data-from="" data-src=""  data-idx=""  src="" mode="aspectFit" bindload="wxParseImgLoad" bindtap="wxParseImgTap" mode="widthFix" style="width:px;"   />
</template>