admin
2020-12-22 28a4cfadc0a78d1bfec093e0694f420aaf3a725c
util/help.js
@@ -1,13 +1,19 @@
var help = {
import parse from 'mini-html-parser2';
var help;
help = {
  getEventParam(event, name) {
    return event.target.dataset[name];
  },
  setPageNavBar(title) {
    my.setNavigationBar({
      title: title,
    var data = {
      backgroundColor: getApp().themeColor,
      borderBottomColor: getApp().themeColor
    });
    }
    if (title != null) {
      data.title = title;
    }
    my.setNavigationBar(data);
  },
  isNullOrEmpty(str) {
    if (str == undefined || str == null || str.length == 0)
@@ -30,6 +36,21 @@
    html += "</div>";
    console.log(html);
    return html;
  },
  /**
   * 通过html文件获取富文本
   * @param {*} html
   * @param {*} callback
   */
  loadRichTextNode(html, callback) {
    parse(html, (err, nodes) => {
      console.log(nodes);
      if (!err) {
        callback(nodes);
      }
    });
  },
  //获取助力进度html
@@ -75,11 +96,20 @@
      hh: h < 10 ? '0' + h : h,
    }
  },
  getUid() {
    let data = my.getStorageSync({
      key: 'uid'
  cacheConfig(params) {
    my.setStorage({
      key: 'config',
      data: params
    });
    return data.data;
  },
  getCachedConfig(callback) {
    let data = my.getStorage({
      key: 'config',
      success: function (res) {
        callback(res.data);
      }
    });
  }