1 line
10 KiB
JSON
1 line
10 KiB
JSON
|
|
{"remainingRequest":"E:\\hz-zhhq-web\\node_modules\\thread-loader\\dist\\cjs.js!E:\\hz-zhhq-web\\node_modules\\babel-loader\\lib\\index.js!E:\\hz-zhhq-web\\src\\utils\\index.js","dependencies":[{"path":"E:\\hz-zhhq-web\\src\\utils\\index.js","mtime":1737610069399},{"path":"E:\\hz-zhhq-web\\babel.config.js","mtime":1737610069371},{"path":"E:\\hz-zhhq-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"E:\\hz-zhhq-web\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"E:\\hz-zhhq-web\\node_modules\\babel-loader\\lib\\index.js","mtime":456789000000}],"contextDependencies":[],"result":["import \"core-js/modules/es6.regexp.constructor\";\nimport \"core-js/modules/es6.regexp.match\";\nimport \"core-js/modules/es6.set\";\nimport \"core-js/modules/es6.string.iterator\";\nimport \"core-js/modules/es6.array.from\";\nimport \"core-js/modules/es6.regexp.split\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.object.keys\";\nimport \"core-js/modules/es6.regexp.replace\";\nimport \"core-js/modules/es6.regexp.to-string\";\nimport _typeof from \"E:/hz-zhhq-web/node_modules/@babel/runtime/helpers/esm/typeof.js\";\n/**\r\n * Created by PanJiaChen on 16/11/18.\r\n */\n\n/**\r\n * Parse the time to string\r\n * @param {(Object|string|number)} time\r\n * @param {string} cFormat\r\n * @returns {string}\r\n */\nexport function parseTime(time, cFormat) {\n if (arguments.length === 0) {\n return '';\n }\n var format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}';\n var date;\n if (_typeof(time) === 'object') {\n date = time;\n } else {\n if (typeof time === 'string' && /^[0-9]+$/.test(time)) {\n time = parseInt(time);\n }\n if (typeof time === 'number' && time.toString().length === 10) {\n time = time * 1000;\n }\n date = new Date(time);\n }\n var formatObj = {\n y: date.getFullYear(),\n m: date.getMonth() + 1,\n d: date.getDate(),\n h: date.getHours(),\n i: date.getMinutes(),\n s: date.getSeconds(),\n a: date.getDay()\n };\n var time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, function (result, key) {\n var value = formatObj[key];\n // Note: getDay() returns 0 on Sunday\n if (key === 'a') {\n return ['日', '一', '二', '三', '四', '五', '六'][value];\n }\n if (result.length > 0 && value < 10) {\n value = '0' + value;\n }\n return value || 0;\n });\n return time_str;\n}\n\n/**\r\n * @param {number} time\r\n * @param {string} option\r\n * @returns {string}\r\n */\nexport function formatTime(time, option) {\n if (('' + time).length === 10) {\n time = parseInt(time) * 1000;\n } else {\n time = +time;\n }\n var d = new Date(time);\n var now = Date.now();\n var diff = (now - d) / 1000;\n if (diff < 30) {\n return '刚刚';\n } else if (diff < 3600) {\n // less 1 hour\n return Math.ceil(diff / 60) + '分钟前';\n } else if (diff < 3600 * 24) {\n return Math.ceil(diff / 3600) + '小时前';\n } else if (diff < 3600 * 24 * 2) {\n return '1天前';\n }\n if (option) {\n return parseTime(time, option);\n } else {\n return d.getMonth() + 1 + '月' + d.getDate() + '日' + d.getHours() + '时' + d.getMinutes() + '分';\n }\n}\n\n/**\r\n * @param {string} url\r\n * @returns {Object}\r\n */\nexport function getQueryObject(url) {\n url = url == \"\" ? window.location.href : url;\n var search = url.substring(url.lastIndexOf('?') + 1);\n var obj = {};\n var reg = /([^?&=]+)=([^?&=]*)/g;\n search.replace(reg, function (rs, $1, $2) {\n var name = decodeURIComponent($1);\n var val = decodeURIComponent($2);\n val = String(val);\n obj[name] = val;\n return rs;\n });\n return obj;\n}\n\n/**\r\n * @param {string} input value\r\n * @returns {number} output value\r\n */\nexport function byteLength(str) {\n // returns the byte length of an utf8 string\n var s = str.length;\n for (var i = str.length - 1; i >= 0; i--) {\n var code = str.charCodeAt(i);\n if (code > 0x7f && code <= 0x7ff) s++;else if (code > 0x7ff && code <= 0xffff) s
|