UNPKG

febs-browser

Version:

febs is a useful utilities set in browser

1,835 lines (1,568 loc) 54.7 kB
module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // identity function for calling harmony imports with the correct context /******/ __webpack_require__.i = function(value) { return value; }; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 14); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Copyright (c) 2017 Copyright brainpoint All Rights Reserved. * Author: lipengxiang * Desc: */ /** * @desc: 判断是否是手机号码. * @return: boolean. */ exports.isPhoneMobile = function (str) { if (!str) return false; if (/^(1[2-9][0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89]|98[0-9]|99[0-9])\d{8}$/.test(str)) { return true; } return false; }; /** * @desc: 判断是否是email. * @return: boolean. */ exports.isEmail = function (str) { if (!str) return false; if (/^(([A-Za-z0-9\u4e00-\u9fa5_-]|\.)+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+)$/.test(str)) { return true; } return false; }; /** * @desc: 判断是否是英文数字组合. * @return: boolean. */ exports.isAlphaOrDigit = function (str) { if (!str) return false; if (/^[A-Za-z0-9]+$/.test(str)) { return true; } return false; }; /** * @desc: 判断是否是中文. * @return: boolean. */ exports.isChinese = function (str) { if (!str) return false; if (/^[\u4e00-\u9fa5]{0,}$/.test(str)) { return true; } return false; }; /** * @desc: 是否为空串. * @return: boolean. */ exports.isEmpty = function (s) { if (!s) { return true; } if (typeof s !== 'string') { return true; } if (s.length == 0) return true; return false; }; /** * @desc: 获得字符串utf8编码后的字节长度. * @return: u32. */ exports.getByteSize = function (s) { if (!s) return 0; var totalLength = 0; var i; var charCode; for (i = 0; i < s.length; i++) { charCode = s.charCodeAt(i); if (charCode < 0x007f) { totalLength = totalLength + 1; } else if (0x0080 <= charCode && charCode <= 0x07ff) { totalLength += 2; } else if (0x0800 <= charCode && charCode <= 0xffff) { totalLength += 3; } else if (0x10000 <= charCode) { totalLength += 4; } } //alert(totalLength); return totalLength; }; /** * @desc: 替换字符串中所有的strSrc->strDest. * @return: string. */ exports.replace = function (str, strSrc, strDest) { if (!str || !strSrc) return str; if (str.length == 0) return str; var s = ''; var endPos = str.length; var i = 0; var j = 0; do { i = str.indexOf(strSrc, j); if (-1 != i && i < endPos) { if (i != j) s += str.slice(j, i); s += strDest; j = i + strSrc.length; } else { s += str.slice(j); break; } } while (i < endPos); // while return s; }; exports.utf8ToBytes = function (str) { if (!str) { return new Array(); } var bytes = new Array(); var len, c; len = str.length; for (var i = 0; i < len; i++) { c = str.charCodeAt(i); if (c >= 0x010000 && c <= 0x10FFFF) { bytes.push(c >> 18 & 0x07 | 0xF0); bytes.push(c >> 12 & 0x3F | 0x80); bytes.push(c >> 6 & 0x3F | 0x80); bytes.push(c & 0x3F | 0x80); } else if (c >= 0x000800 && c <= 0x00FFFF) { bytes.push(c >> 12 & 0x0F | 0xE0); bytes.push(c >> 6 & 0x3F | 0x80); bytes.push(c & 0x3F | 0x80); } else if (c >= 0x000080 && c <= 0x0007FF) { bytes.push(c >> 6 & 0x1F | 0xC0); bytes.push(c & 0x3F | 0x80); } else { bytes.push(c & 0xFF); } } return bytes; }; exports.bytesToUtf8 = function (utf8Bytes) { var unicodeStr = ""; for (var pos = 0; pos < utf8Bytes.length;) { var flag = utf8Bytes[pos]; var unicode = 0; if (flag >>> 7 === 0) { unicodeStr += String.fromCharCode(utf8Bytes[pos]); pos += 1; } else if ((flag & 0xFC) === 0xFC) { unicode = (utf8Bytes[pos] & 0x3) << 30; unicode |= (utf8Bytes[pos + 1] & 0x3F) << 24; unicode |= (utf8Bytes[pos + 2] & 0x3F) << 18; unicode |= (utf8Bytes[pos + 3] & 0x3F) << 12; unicode |= (utf8Bytes[pos + 4] & 0x3F) << 6; unicode |= utf8Bytes[pos + 5] & 0x3F; unicodeStr += String.fromCharCode(unicode); pos += 6; } else if ((flag & 0xF8) === 0xF8) { unicode = (utf8Bytes[pos] & 0x7) << 24; unicode |= (utf8Bytes[pos + 1] & 0x3F) << 18; unicode |= (utf8Bytes[pos + 2] & 0x3F) << 12; unicode |= (utf8Bytes[pos + 3] & 0x3F) << 6; unicode |= utf8Bytes[pos + 4] & 0x3F; unicodeStr += String.fromCharCode(unicode); pos += 5; } else if ((flag & 0xF0) === 0xF0) { unicode = (utf8Bytes[pos] & 0xF) << 18; unicode |= (utf8Bytes[pos + 1] & 0x3F) << 12; unicode |= (utf8Bytes[pos + 2] & 0x3F) << 6; unicode |= utf8Bytes[pos + 3] & 0x3F; unicodeStr += String.fromCharCode(unicode); pos += 4; } else if ((flag & 0xE0) === 0xE0) { unicode = (utf8Bytes[pos] & 0x1F) << 12;; unicode |= (utf8Bytes[pos + 1] & 0x3F) << 6; unicode |= utf8Bytes[pos + 2] & 0x3F; unicodeStr += String.fromCharCode(unicode); pos += 3; } else if ((flag & 0xC0) === 0xC0) { //110 unicode = (utf8Bytes[pos] & 0x3F) << 6; unicode |= utf8Bytes[pos + 1] & 0x3F; unicodeStr += String.fromCharCode(unicode); pos += 2; } else { unicodeStr += String.fromCharCode(utf8Bytes[pos]); pos += 1; } } return unicodeStr; }; exports.utf8Encode = function utf8Encode(str) { var x, y, output = '', i = -1, l; if (str && str.length) { l = str.length; while ((i += 1) < l) { /* Decode utf-16 surrogate pairs */ x = str.charCodeAt(i); y = i + 1 < l ? str.charCodeAt(i + 1) : 0; if (0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF) { x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF); i += 1; } /* Encode output as utf-8 */ if (x <= 0x7F) { output += String.fromCharCode(x); } else if (x <= 0x7FF) { output += String.fromCharCode(0xC0 | x >>> 6 & 0x1F, 0x80 | x & 0x3F); } else if (x <= 0xFFFF) { output += String.fromCharCode(0xE0 | x >>> 12 & 0x0F, 0x80 | x >>> 6 & 0x3F, 0x80 | x & 0x3F); } else if (x <= 0x1FFFFF) { output += String.fromCharCode(0xF0 | x >>> 18 & 0x07, 0x80 | x >>> 12 & 0x3F, 0x80 | x >>> 6 & 0x3F, 0x80 | x & 0x3F); } } } return output; }; exports.utf8Decode = function utf8Decode(str) { var i, ac, c1, c2, c3, arr = [], l; i = ac = c1 = c2 = c3 = 0; if (str && str.length) { l = str.length; str += ''; while (i < l) { c1 = str.charCodeAt(i); ac += 1; if (c1 < 128) { arr[ac] = String.fromCharCode(c1); i += 1; } else if (c1 > 191 && c1 < 224) { c2 = str.charCodeAt(i + 1); arr[ac] = String.fromCharCode((c1 & 31) << 6 | c2 & 63); i += 2; } else { c2 = str.charCodeAt(i + 1); c3 = str.charCodeAt(i + 2); arr[ac] = String.fromCharCode((c1 & 15) << 12 | (c2 & 63) << 6 | c3 & 63); i += 3; } } } return arr.join(''); }; exports.trim = function (str) { if (!str) return str; return str.replace(/(^\s*)|(\s*$)/g, ""); }; /** * @desc: 对字符串中的 <>空格"& 标签进行转义为 &lt;, &gt; * @return: string. */ exports.escapeHtml = function (str) { // 转义. if (str) { str = exports.replace(str, '&', '&amp;'); str = exports.replace(str, '<', '&lt;'); str = exports.replace(str, '>', '&gt;'); str = exports.replace(str, ' ', '&nbsp;'); str = exports.replace(str, '"', '&quot;'); } return str || ''; }; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Copyright (c) 2017 Copyright brainpoint All Rights Reserved. * Author: lipengxiang * Desc: */ var PromiseLib = Promise; /** * @desc: 判断是否是有效时间. */ exports.isValidate = function (date /*:Date*/) /*:boolean*/{ if (isNaN(date) || !date || date.toString() == 'Invalid Date') return false; return date instanceof Date; }; /** * @desc: 获取时间的string. * @param time: ms. * @param fmt: 格式化, 默认为 'HH:mm:ss' * 年(y)、月(M)、日(d)、12小时(h)、24小时(H)、分(m)、秒(s)、周(E)、季度(q) * 'yyyy-MM-dd hh:mm:ss.S' ==> 2006-07-02 08:09:04.423 * 'yyyy-MM-dd E HH:mm:ss' ==> 2009-03-10 星期二 20:09:04 * 'yyyy-M-d h:m:s.S' ==> 2006-7-2 8:9:4.18 * @param weekFmt: 星期的文字格式, 默认为 {'0':'星期天', '1': '星期一', ..., '6':'星期六'} * @return: string. */ function getTimeString(time, fmt, weekFmt) { if (typeof time !== "number") return ""; fmt = fmt || 'HH:mm:ss'; var t = new Date(time); var o = { "M+": t.getMonth() + 1, //月份 "d+": t.getDate(), //日 "h+": t.getHours() % 12 == 0 ? 12 : t.getHours() % 12, //小时 "H+": t.getHours(), //小时 "m+": t.getMinutes(), //分 "s+": t.getSeconds(), //秒 "q+": Math.floor((t.getMonth() + 3) / 3), //季度 "S": t.getMilliseconds() //毫秒 }; var week = weekFmt || { "0": "星期天", "1": "星期一", "2": "星期二", "3": "星期三", "4": "星期四", "5": "星期五", "6": "星期六" }; if (/(y+)/.test(fmt)) { fmt = fmt.replace(RegExp.$1, (t.getFullYear() + "").substr(4 - RegExp.$1.length)); } if (/(E+)/.test(fmt)) { fmt = fmt.replace(RegExp.$1, week[t.getDay() + ""]); } for (var k in o) { if (new RegExp("(" + k + ")").test(fmt)) { fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)); } } return fmt; }; exports.getTimeString = getTimeString; /** * @desc: 获取指定时间距离现在的时间描述. * 例如, 昨天, 1小时前等. * @param time: ms. 小于当前时间, 大于当前时间将显示为 '刚刚'; * @param strFmt: 需要显示的文字. * 默认为 { * now: '刚刚', // 3秒钟以内将显示此信息. * second: '秒前', * minute: '分钟前', * hour: '小时前', * day_yesterday: '昨天', * day: '天前', * month: '个月前', // 6个月内将显示此信息. * time: 'yyyy-M-d h:m:s' // 超过6个月将使用此格式格式化时间 * } * @return: string. */ exports.getTimeStringFromNow = function (time, strFmt) { strFmt = strFmt || {}; strFmt.now = strFmt.now || '刚刚'; strFmt.second = strFmt.second || '秒前'; strFmt.minute = strFmt.minute || '分钟前'; strFmt.hour = strFmt.hour || '小时前'; strFmt.day_yesterday = strFmt.day_yesterday || '昨天'; strFmt.day = strFmt.day || '天前'; strFmt.month = strFmt.month || '个月前'; strFmt.time = strFmt.time || 'yyyy-M-d h:m:s'; var now = Math.ceil(Date.now() / 1000); time = Math.ceil(time / 1000); if (now > time) { var s = now - time; if (s < 3) { return strFmt.now; } if (s < 60) { return s.toString() + strFmt.second; } if (s < 60 * 60) { return Math.ceil(s / 60).toString() + strFmt.minute; } if (s < 60 * 60 * 24) { return Math.ceil(s / 60 / 60).toString() + strFmt.hour; } if (s < 60 * 60 * 24 * 30) { var dNow = new Date(now * 1000); dNow.setHours(0, 0, 1); if (dNow.getTime() - time <= 60 * 60 * 24) { return strFmt.day_yesterday; } return Math.ceil(s / 60 / 60 / 24).toString() + strFmt.day; } if (s < 60 * 60 * 24 * 30 * 6) { return Math.ceil(s / 60 / 60 / 24 / 30).toString() + strFmt.month; } return getTimeString(time, strFmt.time); } return strFmt.now; }; /** * @desc: 通过字符串获取date. getTime('2012-05-09 11:10:12') * @param strTime: 时间字符串. '2012-05-09 11:10:12' * @return: Date. */ exports.getTime = function (strTime) { var date = new Date(); date.setFullYear(parseInt(strTime.substr(0, 4)), parseInt(strTime.substr(5, 2), 10) - 1, parseInt(strTime.substr(8, 2))); date.setHours(parseInt(strTime.substr(11, 2)) || 0, parseInt(strTime.substr(14, 2)) || 0, parseInt(strTime.substr(17, 2)) || 0, 0); return date; }; /** * @desc: 通过时间获取date. getTime2('20120509111012') * @param strTime: 时间字符串. '20120509111012' * @return: Date. */ exports.getTime2 = function (strTime) { var date = new Date(); date.setFullYear(parseInt(strTime.substr(0, 4)), parseInt(strTime.substr(4, 2), 10) - 1, parseInt(strTime.substr(6, 2))); date.setHours(parseInt(strTime.substr(8, 2)) || 0, parseInt(strTime.substr(10, 2)) || 0, parseInt(strTime.substr(12, 2)) || 0, 0); return date; }; /** * @desc: getDate('2012-05-09') * @return: Date. */ exports.getDate = function (strDate) { var date = new Date(parseInt(strDate.substr(0, 4)), parseInt(strDate.substr(5, 2), 10) - 1, parseInt(strDate.substr(8, 2))); return date; }; /** * @desc: getDate2('20120509') * @return: Date. */ exports.getDate2 = function (strDate) { var date = new Date(parseInt(strDate.substr(0, 4)), parseInt(strDate.substr(4, 2), 10) - 1, parseInt(strDate.substr(6, 2))); return date; }; /** * @desc: 获取时间的协调世界时间 string. * @param time: ms. (本地时间) * @param fmt: 格式化, 默认为 'HH:mm:ss' * 年(y)、月(M)、日(d)、12小时(h)、24小时(H)、分(m)、秒(s)、周(E)、季度(q) * 'yyyy-MM-dd hh:mm:ss.S' ==> 2006-07-02 08:09:04.423 * 'yyyy-MM-dd E HH:mm:ss' ==> 2009-03-10 星期二 20:09:04 * 'yyyy-M-d h:m:s.S' ==> 2006-7-2 8:9:4.18 * @param weekFmt: 星期的文字格式, 默认为 {'0':'星期天', '1': '星期一', ..., '6':'星期六'} * @return: string. */ exports.getUTCTimeString = function (time, fmt, weekFmt) { if (typeof time !== "number") return ""; fmt = fmt || 'HH:mm:ss'; var t = new Date(time); var o = { "M+": t.getUTCMonth() + 1, //月份 "d+": t.getUTCDate(), //日 "h+": t.getUTCHours() % 12 == 0 ? 12 : t.getUTCHours() % 12, //小时 "H+": t.getUTCHours(), //小时 "m+": t.getUTCMinutes(), //分 "s+": t.getUTCSeconds(), //秒 "q+": Math.floor((t.getUTCMonth() + 3) / 3), //季度 "S": t.getUTCMilliseconds() //毫秒 }; var week = weekFmt || { "0": "星期天", "1": "星期一", "2": "星期二", "3": "星期三", "4": "星期四", "5": "星期五", "6": "星期六" }; if (/(y+)/.test(fmt)) { fmt = fmt.replace(RegExp.$1, (t.getUTCFullYear() + "").substr(4 - RegExp.$1.length)); } if (/(E+)/.test(fmt)) { fmt = fmt.replace(RegExp.$1, week[t.getUTCDay() + ""]); } for (var k in o) { if (new RegExp("(" + k + ")").test(fmt)) { fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)); } } return fmt; }; /** * @desc: 通过世界时间获取date. getDateFromUTC('2012-05-09') * @param strDateUTC: 世界日期字符串. '2012-05-09' * @return: Date. */ exports.getDateFromUTC = function (strDateUTC) { var date = new Date(); date.setUTCFullYear(parseInt(strDateUTC.substr(0, 4)), parseInt(strDateUTC.substr(5, 2), 10) - 1, parseInt(strDateUTC.substr(8, 2))); date.setUTCHours(0, 0, 0, 0); return date; }; /** * @desc: 通过世界时间获取date. getDate2FromUTC('20120509') * @param strDateUTC: 世界日期字符串. '20120509' * @return: Date. */ exports.getDate2FromUTC = function (strDateUTC) { var date = new Date(); date.setUTCFullYear(parseInt(strDateUTC.substr(0, 4)), parseInt(strDateUTC.substr(4, 2), 10) - 1, parseInt(strDateUTC.substr(6, 2))); date.setUTCHours(0, 0, 0, 0); return date; }; /** * @desc: 通过世界时间获取date. getTimeFromUTC('2012-05-09 11:10:12') * @param strTimeUTC: 世界时间字符串. '2012-05-09 11:10:12' * @return: Date. */ exports.getTimeFromUTC = function (strTimeUTC) { var date = new Date(); date.setUTCFullYear(parseInt(strTimeUTC.substr(0, 4)), parseInt(strTimeUTC.substr(5, 2), 10) - 1, parseInt(strTimeUTC.substr(8, 2))); date.setUTCHours(parseInt(strTimeUTC.substr(11, 2)) || 0, parseInt(strTimeUTC.substr(14, 2)) || 0, parseInt(strTimeUTC.substr(17, 2)) || 0, 0); return date; }; /** * @desc: 通过世界时间获取date. getTime2FromUTC('20120509111012') * @param strTimeUTC: 世界日期字符串. '20120509111012' * @return: Date. */ exports.getTime2FromUTC = function (strTimeUTC) { var date = new Date(); date.setUTCFullYear(parseInt(strTimeUTC.substr(0, 4)), parseInt(strTimeUTC.substr(4, 2), 10) - 1, parseInt(strTimeUTC.substr(6, 2))); date.setUTCHours(parseInt(strTimeUTC.substr(8, 2)) || 0, parseInt(strTimeUTC.substr(10, 2)) || 0, parseInt(strTimeUTC.substr(12, 2)) || 0, 0); return date; }; /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Copyright (c) 2017 Copyright brainpoint All Rights Reserved. * Author: lipengxiang * Desc: */ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor); } }return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); }return call && ((typeof call === "undefined" ? "undefined" : _typeof(call)) === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : _typeof(superClass))); }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } module.exports = function (_Error) { _inherits(_class, _Error); /** * @desc: 构造异常对象. * @param msg: 异常消息 * @param code: 异常代码 * @param filename: 异常文件名 * @param line: 异常文件所在行 * @param column: 异常文件所在列 * @return: */ function _class(msg, code, filename, line, column) { _classCallCheck(this, _class); var _this = _possibleConstructorReturn(this, _Error.call(this, code + " " + msg)); _this.__tag = 'febs.exception'; _this.code = code; _this.msg = msg; _this.filename = filename; _this.line = line; _this.column = column || 0; return _this; } /** * 判断是否是febs.exception异常实例. */ _class.isInstance = function isInstance(e) { return e && e.__tag === 'febs.exception'; }; /** * @desc: 一般错误. */ _createClass(_class, null, [{ key: 'ERROR', get: function get() { return "error"; } /** * @desc: 参数错误. */ }, { key: 'PARAM', get: function get() { return "param error"; } /** * @desc: 越界 * @return: */ }, { key: 'OUT_OF_RANGE', get: function get() { return "out of range"; } }]); return _class; }(Error); /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; (function () { if (typeof Promise.prototype['finally'] === 'function') { return; } Promise.prototype['finally'] = function (fn) { return this.then(function (value) { return this.constructor.resolve(fn()).then(function () { return value; }); })['catch'](function (reason) { return this.constructor.resolve(fn()).then(function () { throw reason; }); }); }; })(); /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Copyright (c) 2017 Copyright brainpoint All Rights Reserved. * Author: lipengxiang * Desc: * crc32(str, crc=null); * crc32_file(file, function(crc32Value) {}) */ var crypt = __webpack_require__(12); /** * @desc: 计算字符串的crc32值 * @param crc: 可以在这个值得基础上继续计算 * @return: number. */ function crc32( /* String */str, /* Number */crc) { if (!crc) crc = 0; crc = crc ^ -1; for (var i = 0, iTop = str.length; i < iTop; i++) { crc = crc >>> 8 ^ crypt.crc32_table[(crc ^ str.charCodeAt(i)) & 0xFF]; } return crc ^ -1; } exports.crc32 = crc32; /** * @desc: * @param cb: cb(crc32) * @return: */ function crc32_fileSegment(file, offset, length, cb) { if (!file || !cb) { if (cb) cb(0); return; } if (offset >= file.size || offset < 0 || length == 0) { if (cb) cb(0); return; } if (length < 0) { length = file.size; } var blobSlice = File.prototype.mozSlice || File.prototype.webkitSlice || File.prototype.slice; var fileReader = new FileReader(); if (file.size - offset < length) { length = file.size - offset; } var chunkSize = 1024 * 1024 * 2; var chunks = Math.ceil(length / chunkSize); var currentChunk = 0; var loadNext = function loadNext() { var start = currentChunk * chunkSize + offset, end = start + chunkSize >= length + offset ? length + offset : start + chunkSize; fileReader.readAsBinaryString(blobSlice.call(file, start, end)); }; var crc = 0; //每块文件读取完毕之后的处理. fileReader.onload = function (e) { crc = crc32(e.target.result, crc); // append binary string currentChunk++; if (currentChunk < chunks) { loadNext(); } else { cb(crc); } }; loadNext(); } exports.crc32_fileSegment = crc32_fileSegment; /** * @desc: * @param cb: cb(crc32) * @return: */ exports.crc32_file = function (file, cb) { crc32_fileSegment(file, 0, file.size, cb); }; /** * @desc: base64编码. * @param arrByte: 字节数组. * @return: string. */ exports.base64_encode = crypt.base64_encode; /** * @desc: base64解码. * @return: 字节数组. */ exports.base64_decode = function (strBase64) { var c1, c2, c3, c4; var base64DecodeChars = new Array(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1); var i = 0, len = strBase64.length, out = []; while (i < len) { do { c1 = base64DecodeChars[strBase64.charCodeAt(i++) & 0xff]; } while (i < len && c1 == -1); if (c1 == -1) break; do { c2 = base64DecodeChars[strBase64.charCodeAt(i++) & 0xff]; } while (i < len && c2 == -1); if (c2 == -1) break; out.push(c1 << 2 | (c2 & 0x30) >> 4); do { c3 = strBase64.charCodeAt(i++) & 0xff; if (c3 == 61) return out; c3 = base64DecodeChars[c3]; } while (i < len && c3 == -1); if (c3 == -1) break; out.push((c2 & 0XF) << 4 | (c3 & 0x3C) >> 2); do { c4 = strBase64.charCodeAt(i++) & 0xff; if (c4 == 61) return out; c4 = base64DecodeChars[c4]; } while (i < len && c4 == -1); if (c4 == -1) break; out.push((c3 & 0x03) << 6 | c4); } return out; }; /** * @desc: 生成一个uuid (v4 random). * @return: */ exports.uuid = function () { var s = []; var hexDigits = "0123456789abcdef"; for (var i = 0; i < 36; i++) { s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1); } s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010 s[19] = hexDigits.substr(s[19] & 0x3 | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01 s[8] = s[13] = s[18] = s[23] = "-"; var uuid = s.join(""); return uuid; }; /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Copyright (c) 2017 Copyright brainpoint All Rights Reserved. * Author: lipengxiang * Desc: */ var stringUtils = __webpack_require__(0); function binl2rstr(input) { var i, l = input.length * 32, output = ''; for (i = 0; i < l; i += 8) { output += String.fromCharCode(input[i >> 5] >>> i % 32 & 0xFF); } return output; } function bit_rol(num, cnt) { return num << cnt | num >>> 32 - cnt; } function rstr2binl(input) { var i, l = input.length * 8, output = Array(input.length >> 2), lo = output.length; for (i = 0; i < lo; i += 1) { output[i] = 0; } for (i = 0; i < l; i += 8) { output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << i % 32; } return output; } function safe_add(x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF), msw = (x >> 16) + (y >> 16) + (lsw >> 16); return msw << 16 | lsw & 0xFFFF; } function hex(s) { var input = binl2rstr(binl(rstr2binl(s), s.length * 8)); var hex_tab = '0123456789abcdef', output = '', x, i = 0, l = input.length; for (; i < l; i += 1) { x = input.charCodeAt(i); output += hex_tab.charAt(x >>> 4 & 0x0f) + hex_tab.charAt(x & 0x0f); } return output; } /** * Calculate the MD5 of an array of little-endian words, and a bit length. */ function binl(x, len) { var i, olda, oldb, oldc, oldd, a = 1732584193, b = -271733879, c = -1732584194, d = 271733878; /* append padding */ x[len >> 5] |= 0x80 << len % 32; x[(len + 64 >>> 9 << 4) + 14] = len; for (i = 0; i < x.length; i += 16) { olda = a; oldb = b; oldc = c; oldd = d; a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936); d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586); c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819); b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330); a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897); d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426); c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341); b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983); a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416); d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417); c = md5_ff(c, d, a, b, x[i + 10], 17, -42063); b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162); a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682); d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101); c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290); b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329); a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510); d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632); c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713); b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302); a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691); d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083); c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335); b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848); a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438); d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690); c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961); b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501); a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467); d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784); c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473); b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734); a = md5_hh(a, b, c, d, x[i + 5], 4, -378558); d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463); c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562); b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556); a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060); d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353); c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632); b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640); a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174); d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222); c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979); b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189); a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487); d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835); c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520); b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651); a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844); d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415); c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905); b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055); a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571); d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606); c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523); b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799); a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359); d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744); c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380); b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649); a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070); d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379); c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259); b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551); a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd); } return Array(a, b, c, d); } /** * These functions implement the four basic operations the algorithm uses. */ function md5_cmn(q, a, b, x, s, t) { return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b); } function md5_ff(a, b, c, d, x, s, t) { return md5_cmn(b & c | ~b & d, a, b, x, s, t); } function md5_gg(a, b, c, d, x, s, t) { return md5_cmn(b & d | c & ~d, a, b, x, s, t); } function md5_hh(a, b, c, d, x, s, t) { return md5_cmn(b ^ c ^ d, a, b, x, s, t); } function md5_ii(a, b, c, d, x, s, t) { return md5_cmn(c ^ (b | ~d), a, b, x, s, t); } exports.md5 = function (str) { return hex(stringUtils.utf8Encode(str)); }; /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Copyright (c) 2017 Copyright brainpoint All Rights Reserved. * Author: lipengxiang * Desc: */ var stringUtils = __webpack_require__(0); function binb2rstr(input) { var i, l = input.length * 32, output = ''; for (i = 0; i < l; i += 8) { output += String.fromCharCode(input[i >> 5] >>> 24 - i % 32 & 0xff); } return output; } function bit_rol(num, cnt) { return num << cnt | num >>> 32 - cnt; } function safe_add(x, y) { var lsw = (x & 0xffff) + (y & 0xffff), msw = (x >> 16) + (y >> 16) + (lsw >> 16); return msw << 16 | lsw & 0xffff; } function sha1_ft(t, b, c, d) { if (t < 20) { return b & c | ~b & d; } if (t < 40) { return b ^ c ^ d; } if (t < 60) { return b & c | b & d | c & d; } return b ^ c ^ d; } function sha1_kt(t) { return t < 20 ? 1518500249 : t < 40 ? 1859775393 : t < 60 ? -1894007588 : -899497514; } function rstr2binb(input) { var i, l = input.length * 8, output = Array(input.length >> 2), lo = output.length; for (i = 0; i < lo; i += 1) { output[i] = 0; } for (i = 0; i < l; i += 8) { output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << 24 - i % 32; } return output; } function hex(s) { var input = binb2rstr(binb(rstr2binb(s), s.length * 8)); var hex_tab = '0123456789abcdef', output = '', x, i = 0, l = input.length; for (; i < l; i += 1) { x = input.charCodeAt(i); output += hex_tab.charAt(x >>> 4 & 0x0f) + hex_tab.charAt(x & 0x0f); } return output; } function binb(x, len) { var i, j, t, olda, oldb, oldc, oldd, olde, w = Array(80), a = 1732584193, b = -271733879, c = -1732584194, d = 271733878, e = -1009589776; /* append padding */ x[len >> 5] |= 0x80 << 24 - len % 32; x[(len + 64 >> 9 << 4) + 15] = len; for (i = 0; i < x.length; i += 16) { olda = a; oldb = b; oldc = c; oldd = d; olde = e; for (j = 0; j < 80; j += 1) { if (j < 16) { w[j] = x[i + j]; } else { w[j] = bit_rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1); } t = safe_add(safe_add(bit_rol(a, 5), sha1_ft(j, b, c, d)), safe_add(safe_add(e, w[j]), sha1_kt(j))); e = d; d = c; c = bit_rol(b, 30); b = a; a = t; } a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd); e = safe_add(e, olde); } return Array(a, b, c, d, e); } exports.sha1 = function (str) { return hex(stringUtils.utf8Encode(str)); }; /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Copyright (c) 2017 Copyright tj All Rights Reserved. * Author: lipengxiang * Date: 2018-06-02 17:39 * Desc: */ var date = __webpack_require__(1); exports.isValidate = date.isValidate; exports.getDate = date.getDate; exports.getDate2 = date.getDate2; exports.getDate2FromUTC = date.getDate2FromUTC; exports.getDateFromUTC = date.getDateFromUTC; exports.getTime2FromUTC = date.getTime2FromUTC; exports.getTimeString = date.getTimeString; exports.getUTCTimeString = date.getUTCTimeString; exports.getTimeStringFromNow = date.getTimeStringFromNow; exports.getTimeFromUTC = date.getTimeFromUTC; exports.getTime = date.getTime; exports.getTime2 = date.getTime2; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Copyright (c) 2017 Copyright brainpoint All Rights Reserved. * Author: lipengxiang * Desc: */ var string = __webpack_require__(0); /** * @desc: 判断是否是手机号码. * @return: boolean. */ exports.isPhoneMobile = string.isPhoneMobile; /** * @desc: 是否为空串. * @return: boolean. */ exports.isEmpty = string.isEmpty; /** * @desc: 判断是否是email. * @return: boolean. */ exports.isEmail = string.isEmail; /** * @desc: 判断是否是英文数字组合. * @return: boolean. */ exports.isAlphaOrDigit = string.isAlphaOrDigit; /** * @desc: 判断是否是中文. * @return: boolean. */ exports.isChinese = string.isChinese; /** * @desc: 获得字符串utf8编码后的字节长度. * @return: u32. */ exports.getByteSize = string.getByteSize; /** * @desc: 替换字符串中所有的strSrc->strDest. * @return: string. */ exports.replace = string.replace; exports.utf8ToBytes = string.utf8ToBytes; exports.bytesToUtf8 = string.bytesToUtf8; exports.utf8Encode = string.utf8Encode; exports.utf8Decode = string.utf8Decode; exports.trim = string.trim; /** * @desc: 对字符串中的 <> 标签进行转义为 &lt;, &gt; * @return: string. */ exports.escapeHtml = string.escapeHtml; /***/ }), /* 9 */ /***/ (function(module, exports) { var g; // This works in non-strict mode g = (function() { return this; })(); try { // This works if eval is allowed (see CSP) g = g || Function("return this")() || (1,eval)("this"); } catch(e) { // This works if the window reference is available if(typeof window === "object") g = window; } // g can still be undefined, but nothing to do about it... // We return undefined, instead of nothing here, so it's // easier to handle this case. if(!global) { ...} module.exports = g; /***/ }), /* 10 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (immutable) */ __webpack_exports__["fetch"] = fetch; /** * Copyright (c) 2017 Copyright brainpoint All Rights Reserved. * Author: lipengxiang * Desc: */ class FetchResponse { constructor(data, headers, status) { this.data = data; this.headers = headers; this.status = status; } get statusText() { return this.status.toString(); } blob() { return new Promise((resolve, reject)=>{ reject(new Error('unsupport fetch.blob')); }); } json() { return new Promise((resolve, reject) => { let data; try { data = JSON.parse(this.data); } catch (e) { reject(e); return; } resolve(data); }); } text() { return new Promise((resolve, reject)=>{ resolve(this.data); }); } } function fetch(url, option/*: { method?: string, // 请求方法 get, post, delete 等. mode?: string | 'no-cors' | 'cors' | 'same-origin', // 'no-cors', 'same-origin'等; (可忽略) headers?: any, // 请求header, 例如: // { // "Content-Type": "application/json", // "Accept": 'application/json', // } body?: string, // 请求内容. timeout?: number, // 超时 (ms), 默认为5000, credentials?: 'include' | null | undefined, // 携带了credentials='include'则服务器需设置Access-Control-Allow-Credentials }*/) /*: Promise<any>*/ { option = option||{}; return new Promise((resolve, reject)=>{ wx.request({ url, header: option.headers, timeout: option.timeout, data: option.body, method: option.method?option.method.toUpperCase():undefined, success: (res)=>{ resolve( new FetchResponse(res.data, res.header, res.status) ); }, fail: (err) => { reject(err); } }) }); } /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Copyright (c) 2017 Copyright brainpoint All Rights Reserved. * Author: lipengxiang * Desc: */ var utils = __webpack_require__(13); /** * @desc: 模拟sleep. * @return: Promise. * 在ms时间后执行. * @e.g. * febs.utils.sleep(1000).then(()=>{ //1000ms之后resolve. }); */ exports.sleep = utils.sleep; /** * @desc: 获取时间的string. * @param time: ms. * @param fmt: 格式化, 默认为 'HH:mm:ss' * 年(y)、月(M)、日(d)、12小时(h)、24小时(H)、分(m)、秒(s)、周(E)、季度(q) * 'yyyy-MM-dd hh:mm:ss.S' ==> 2006-07-02 08:09:04.423 * 'yyyy-MM-dd E HH:mm:ss' ==> 2009-03-10 星期二 20:09:04 * 'yyyy-M-d h:m:s.S' ==> 2006-7-2 8:9:4.18 * @param weekFmt: 星期的文字格式, 默认为 {'0':'星期天', '1': '星期一', ..., '6':'星期六'} * @return: string. */ exports.getTimeString = utils.getTimeString; /** * @desc: 获取指定时间距离现在的时间描述. * 例如, 昨天, 1小时前等. * @param time: ms. 小于当前时间, 大于当前时间将显示为 '刚刚'; * @param strFmt: 需要显示的文字. * 默认为 { * now: '刚刚', // 3秒钟以内将显示此信息. * second: '秒前', * minute: '分钟前', * hour: '小时前', * day_yesterday: '昨天', * day: '天前', * month: '个月前', // 6个月内将显示此信息. * time: 'yyyy-M-d h:m:s' // 超过6个月将使用此格式格式化时间 * } * @return: string. */ exports.getTimeStringFromNow = utils.getTimeStringFromNow; /** * @desc: getDate('2012-05-09') * @return: Date. */ exports.getDate = utils.getDate; /** * @desc: getDate2('20120509') * @return: Date. */ exports.getDate2 = utils.getDate2; /** * @desc: 合并多个map. * @return: {} */ exports.mergeMap = utils.mergeMap; /** * @desc: 判断参数是否是null,undefined,NaN * @return: boolean */ exports.isNull = utils.isNull; /** * @desc: 创建promise,但函数中的this可以为指定值. * 例如: yield denodeify(fs.exists)(path); * @param self: 指定的对象.s * @return: promise. */ exports.denodeify = utils.denodeify; exports.promisify = utils.promisify; /** * @desc: 判断是否是ie. */ exports.browserIsIE = function () { return false; } /** * @desc: 判断ie版本号. * @return number. 非ie返回Number.MAX_SAFE_INTEGER. * 如果是 edge 返回 'edge' */ exports.browserIEVer = function () { return Number.MAX_SAFE_INTEGER; } /** * @desc: the browser is support html5. */ exports.browserIsSupportHtml5 = function () { if (typeof (Worker) !== "undefined") { return true; } else { return false; } } /** * @desc: the browser is mobile. * @param userAgent: the browser user agent string. */ exports.browserIsMobile = function(userAgent) { return true; } /** * @desc: the browser is ios. */ exports.browserIsIOS = function() { let systemInfo = wx.getSystemInfoSync(); if (systemInfo && systemInfo.platform == 'ios') { return true; } return false; } /** * @desc: the browser is phone. * @param userAgent: the browser user agent string. */ exports.browserIsPhone = function(userAgent) { let systemInfo = wx.getSystemInfoSync(); if (systemInfo && systemInfo.windowWidth <= 767) { return true; } return false; } /** * @desc: the browser is weixin. */ exports.browserIsWeixin = function(userAgent) { return true; } /** * @desc: the platform is Windows. */ exports.platformIsWindows = function(userAgent) { return false; } /** * @desc: the platform is Mac. */ exports.platformIsMac = function(userAgent) { return false; } /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Copyright (c) 2017 Copyright brainpoint All Rights Reserved. * Author: lipengxiang * Desc: */ var utilsString = __webpack_require__(0); var crc32_table = [0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D]; exports.crc32_table = crc32_table; /** * @desc: base64编码. * @param arrByte: 字节数组. * @return: string. */ exports.base64_encode = function (arrByte) { if (!arrByte) { return ''; } if (typeof arrByte === 'string') { arrByte = utilsString.utf8ToBytes(arrByte); } var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var out, i, len; var c1, c2, c3; len = arrByte.length; i = 0; out = ""; while (i < len) { c1 = arrByte[i++] & 0xff; if (i == len) { out += base64EncodeChars.charAt(c1 >> 2); out += base64EncodeChars.charAt((c1 & 0x3) << 4); out += "=="; break; } c2 = arrByte[i++]; if (i == len) { out += base64EncodeChars.charAt(c1 >> 2); out += base64EncodeChars.charAt((c1 & 0x3) << 4 | (c2 & 0xF0) >> 4); out += base64EncodeChars.charAt((c2 & 0xF) << 2); out += "="; break; } c3 = arrByte[i++]; out += base64EncodeChars.charAt(c1 >> 2); out += base64EncodeChars.charAt((c1 & 0x3) << 4 | (c2 & 0xF0) >> 4); out += base64EncodeChars.charAt((c2 & 0xF) << 2 | (c3 & 0xC0) >> 6); out += base64EncodeChars.charAt(c3 & 0x3F); } return out; }; /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Copyright (c) 2017 Copyright brainpoint All Rights Reserved. * Author: lipengxiang * Desc: */ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) { return typeof obj === "undefined" ? "undefined" : _typeof2(obj); } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof2(obj); }; var PromiseLib = Promise; var utilsDate = __webpack_require__(1); /** * @desc: 模拟sleep. * @return: Promise. * 在ms时间后执行. * @e.g. * febs.utils.sleep(1000).then(()=>{ //1000ms之后resolve. }); */ exports.sleep = function (ms) { return new PromiseLib(function (resolve, reject) { try { setTimeout(function () { resolve(); }, ms); } catch (err) { reject(err); } }); }; /** * @desc: 合并多个map (浅拷贝). * @return: {} */ exports.mergeMap = function () { var map0 = {}; var map2; for (var i = 0; i < arguments.length; i++) { map2 = arguments[i]; if (map2) { for (var k in map2) { map0[k] = map2[k]; } } } return map0; }; /** * @desc: 判断参数是否是null,undefined,NaN * @return: boolean */ exports.isNull = function (e) { return e === null || e === undefined || Number.isNaN(e); }; /** * date. */ exports.getTimeString = utilsDate.getTimeString; exports.getTimeStringFromNow = utilsDate.getTimeStringFromNow; exports.getDate = utilsDate.getDate; exports.getDate2 = utilsDate.getDate2; /** * @de