(global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/vendor"],{
/***/ 1:
/*!*********************************************************!*\
!*** ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js ***!
\*********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var objectKeys = ['qy', 'env', 'error', 'version', 'lanDebug', 'cloud', 'serviceMarket', 'router', 'worklet', '__webpack_require_UNI_MP_PLUGIN__'];
var singlePageDisableKey = ['lanDebug', 'router', 'worklet'];
var target = typeof globalThis !== 'undefined' ? globalThis : function () {
return this;
}();
var key = ['w', 'x'].join('');
var oldWx = target[key];
var launchOption = oldWx.getLaunchOptionsSync ? oldWx.getLaunchOptionsSync() : null;
function isWxKey(key) {
if (launchOption && launchOption.scene === 1154 && singlePageDisableKey.includes(key)) {
return false;
}
return objectKeys.indexOf(key) > -1 || typeof oldWx[key] === 'function';
}
function initWx() {
var newWx = {};
for (var _key in oldWx) {
if (isWxKey(_key)) {
// TODO wrapper function
newWx[_key] = oldWx[_key];
}
}
return newWx;
}
target[key] = initWx();
if (!target[key].canIUse('getAppBaseInfo')) {
target[key].getAppBaseInfo = target[key].getSystemInfoSync;
}
if (!target[key].canIUse('getWindowInfo')) {
target[key].getWindowInfo = target[key].getSystemInfoSync;
}
if (!target[key].canIUse('getDeviceInfo')) {
target[key].getDeviceInfo = target[key].getSystemInfoSync;
}
var _default = target[key];
exports.default = _default;
/***/ }),
/***/ 10:
/*!****************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
\****************************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 1060:
/*!***********************************************************!*\
!*** D:/Users/15570887941/Desktop/wdsxh/common/poster.js ***!
\***********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(uni) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.canvasToTempFilePath = canvasToTempFilePath;
exports.createPoster = createPoster;
exports.loadImage = loadImage;
exports.saveImageToPhotosAlbum = saveImageToPhotosAlbum;
// 获取图片信息,这里主要要获取图片缓存地址
function loadImage(url) {
return new Promise(function (resolve) {
uni.getImageInfo({
src: url,
success: function success(res) {
resolve(res.path);
},
fail: function fail() {
resolve("");
}
});
});
}
// 解析海报对象,绘制canvas海报
function createPoster(ctx, posterItemList) {
return new Promise(function (resolve, reject) {
try {
// 单行文本超出隐藏
var textEllipsis = function textEllipsis(text, maxWidth) {
var strWidth = ctx.measureText(text).width;
var ellipsis = '…';
var ellipsisWidth = ctx.measureText(ellipsis).width;
if (strWidth > maxWidth && maxWidth > ellipsisWidth) {
var len = text.length;
while (strWidth >= maxWidth - ellipsisWidth && len-- > 0) {
text = text.slice(0, len);
strWidth = ctx.measureText(text).width;
}
text += ellipsis;
}
return text;
};
// 文本换行
var breakTextLines = function breakTextLines(text, maxWidth) {
var words = text.split('');
var line = '';
var lines = [];
for (var i = 0; i < words.length; i++) {
var word = words[i];
var testLine = line + word;
var metrics = ctx.measureText(testLine);
if (metrics.width > maxWidth && i > 0) {
lines.push(line);
line = word;
} else {
line = testLine;
}
}
lines.push(line);
return lines;
};
for (var i = 0; i < posterItemList.length; i++) {
var temp = posterItemList[i];
if (temp.type === 'image') {
ctx.setStrokeStyle("rgba(255, 255, 255, 0)");
ctx.save();
var x = temp.config.x;
var y = temp.config.y;
var width = temp.config.w;
var height = temp.config.h;
var radius = temp.config.r || 0;
ctx.beginPath();
ctx.moveTo(x + radius, y);
ctx.lineTo(x + width - radius, y);
ctx.arc(x + width - radius, y + radius, radius, -Math.PI / 2, 0); // 从右边绘制圆角
ctx.lineTo(x + width, y + height - radius);
ctx.arc(x + width - radius, y + height - radius, radius, 0, Math.PI / 2); // 从底部绘制圆角
ctx.lineTo(x + radius, y + height);
ctx.arc(x + radius, y + height - radius, radius, Math.PI / 2, Math.PI); // 从左边绘制圆角
ctx.lineTo(x, y + radius);
ctx.arc(x + radius, y + radius, radius, -Math.PI, -Math.PI / 2);
ctx.closePath();
ctx.clip();
ctx.drawImage(temp.url, temp.config.x, temp.config.y, temp.config.w, temp.config.h);
ctx.restore();
} else if (temp.type === 'imageGroup') {
var itemX = parseFloat(temp.config.x);
for (var _j in temp.group) {
if (_j >= 3) break;
ctx.drawImage(temp.group[_j], itemX, temp.config.y, temp.config.w, temp.config.h);
itemX += parseFloat(temp.config.w) + parseFloat(temp.config.space);
}
} else if (temp.type === 'avatar') {
ctx.save();
ctx.beginPath();
ctx.arc(temp.config.w / 2 + temp.config.x, temp.config.h / 2 + temp.config.y, temp.config.w / 2, 0, Math.PI * 2);
ctx.clip();
ctx.drawImage(temp.url, temp.config.x, temp.config.y, temp.config.w, temp.config.h);
ctx.restore();
ctx.setStrokeStyle('#fff');
} else if (temp.type === 'text') {
if (temp.config.font) ctx.font = temp.config.font;else ctx.font = "10px sans-serif";
temp.config.fontSize && ctx.setFontSize(temp.config.fontSize);
temp.config.color && ctx.setFillStyle(temp.config.color);
temp.config.textAlign && ctx.setTextAlign(temp.config.textAlign);
ctx.setTextBaseline("middle");
if (temp.config.wrap) {
var maxWidth = temp.config.maxWidth;
var lineHeight = temp.config.lineHeight;
var lines = breakTextLines(temp.text, maxWidth);
var lineNumber = temp.config.lineNumber || 2;
if (temp.config.isVerticalCenter) {
temp.config.y += lineHeight * lineNumber / 2 - lines.length * lineHeight / 2;
}
for (var index = 0; index < lineNumber; index++) {
if (index >= lines.length) break;
var line = lines[index];
if (index == lineNumber - 1 && index + 1 < lines.length) {
line = textEllipsis(line + "...", maxWidth);
ctx.fillText(line, temp.config.x, temp.config.y + index * lineHeight);
} else {
ctx.fillText(line, temp.config.x, temp.config.y + index * lineHeight);
}
}
} else {
var _lineHeight = temp.config.lineHeight;
if (temp.config.isVerticalCenter) {
temp.config.y += _lineHeight / 2;
}
temp.text = textEllipsis(temp.text, temp.config.maxWidth);
ctx.fillText(temp.text, temp.config.x, temp.config.y);
}
ctx.stroke();
} else if (temp.type === 'textGroup') {
var _itemX = temp.config.x;
for (var j in temp.group) {
var item = temp.group[j];
if (temp.font) ctx.font = temp.font;else ctx.font = "10px sans-serif";
item.fontSize && ctx.setFontSize(item.fontSize);
item.color && ctx.setFillStyle(item.color);
temp.config.textAlign && ctx.setTextAlign(temp.config.textAlign);
ctx.setTextBaseline("middle");
if (item.wrap) {
var _maxWidth = temp.config.maxWidth - _itemX + parseFloat(temp.config.x); // 最大宽度
var _lineHeight2 = item.lineHeight; // 行高
var _lines = breakTextLines(item.text, _maxWidth);
var _lineNumber = item.lineNumber || 2;
for (var _index = 0; _index < _lineNumber; _index++) {
if (_index >= _lines.length) break;
var _line = _lines[_index];
if (_index == _lineNumber - 1 && _index + 1 < _lines.length) {
_line = textEllipsis(_line + "...", _maxWidth);
ctx.fillText(_line, _itemX, temp.config.y + _index * _lineHeight2);
} else {
ctx.fillText(_line, _itemX, temp.config.y + _index * _lineHeight2);
}
}
} else {
ctx.fillText(item.text, _itemX, temp.config.y);
}
ctx.stroke();
_itemX += parseFloat(ctx.measureText(item.text).width);
}
} else if (temp.type === 'line') {
ctx.beginPath();
ctx.setLineWidth(temp.config.w);
ctx.moveTo(temp.config.xo, temp.config.y);
ctx.lineTo(temp.config.xt, temp.config.y);
ctx.setStrokeStyle(temp.config.color);
ctx.stroke();
} else if (temp.type === 'function') {
temp.function();
}
}
ctx.draw();
resolve();
} catch (e) {
reject(e);
}
});
}
// canvas转image图片
function canvasToTempFilePath(canvasId, vm) {
var delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;
return new Promise(function (resolve, reject) {
// 这里canvas绘制完成之后想要存缓存需要一定时间,这里设置了50毫秒
setTimeout(function () {
uni.canvasToTempFilePath({
canvasId: canvasId,
success: function success(res) {
if (res.errMsg && res.errMsg.indexOf('ok') != -1) resolve(res.tempFilePath);else reject(res);
},
fail: function fail(err) {
reject(err);
}
}, vm);
}, delay);
});
}
// 保存图片到相册
function saveImageToPhotosAlbum(imagePath) {
return new Promise(function (resolve, reject) {
uni.saveImageToPhotosAlbum({
filePath: imagePath,
success: function success(res) {
resolve(res);
},
fail: function fail(err) {
reject(err);
}
});
});
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
/***/ }),
/***/ 1068:
/*!*******************************************************************************************!*\
!*** D:/Users/15570887941/Desktop/wdsxh/uni_modules/mp-html/components/mp-html/parser.js ***!
\*******************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(uni, wx) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
/**
* @fileoverview html 解析器
*/
// 配置
var config = {
// 信任的标签(保持标签名不变)
trustTags: makeMap('a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,ruby,rt,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video'),
// 块级标签(转为 div,其他的非信任标签转为 span)
blockTags: makeMap('address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section'),
// 要移除的标签
ignoreTags: makeMap('area,base,canvas,embed,frame,head,iframe,input,link,map,meta,param,rp,script,source,style,textarea,title,track,wbr'),
// 自闭合的标签
voidTags: makeMap('area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'),
// html 实体
entities: {
lt: '<',
gt: '>',
quot: '"',
apos: "'",
ensp: "\u2002",
emsp: "\u2003",
nbsp: '\xA0',
semi: ';',
ndash: '–',
mdash: '—',
middot: '·',
lsquo: '‘',
rsquo: '’',
ldquo: '“',
rdquo: '”',
bull: '•',
hellip: '…',
larr: '←',
uarr: '↑',
rarr: '→',
darr: '↓'
},
// 默认的标签样式
tagStyle: {
address: 'font-style:italic',
big: 'display:inline;font-size:1.2em',
caption: 'display:table-caption;text-align:center',
center: 'text-align:center',
cite: 'font-style:italic',
dd: 'margin-left:40px',
mark: 'background-color:yellow',
pre: 'font-family:monospace;white-space:pre',
s: 'text-decoration:line-through',
small: 'display:inline;font-size:0.8em',
strike: 'text-decoration:line-through',
u: 'text-decoration:underline'
},
// svg 大小写对照表
svgDict: {
animatetransform: 'animateTransform',
lineargradient: 'linearGradient',
viewbox: 'viewBox',
attributename: 'attributeName',
repeatcount: 'repeatCount',
repeatdur: 'repeatDur',
foreignobject: 'foreignObject'
}
};
var tagSelector = {};
var _uni$getSystemInfoSyn = uni.getSystemInfoSync(),
windowWidth = _uni$getSystemInfoSyn.windowWidth,
system = _uni$getSystemInfoSyn.system;
var blankChar = makeMap(' ,\r,\n,\t,\f');
var idIndex = 0;
/**
* @description 创建 map
* @param {String} str 逗号分隔
*/
function makeMap(str) {
var map = Object.create(null);
var list = str.split(',');
for (var i = list.length; i--;) {
map[list[i]] = true;
}
return map;
}
/**
* @description 解码 html 实体
* @param {String} str 要解码的字符串
* @param {Boolean} amp 要不要解码 &
* @returns {String} 解码后的字符串
*/
function decodeEntity(str, amp) {
var i = str.indexOf('&');
while (i !== -1) {
var j = str.indexOf(';', i + 3);
var code = void 0;
if (j === -1) break;
if (str[i + 1] === '#') {
// { 形式的实体
code = parseInt((str[i + 2] === 'x' ? '0' : '') + str.substring(i + 2, j));
if (!isNaN(code)) {
str = str.substr(0, i) + String.fromCharCode(code) + str.substr(j + 1);
}
} else {
// 形式的实体
code = str.substring(i + 1, j);
if (config.entities[code] || code === 'amp' && amp) {
str = str.substr(0, i) + (config.entities[code] || '&') + str.substr(j + 1);
}
}
i = str.indexOf('&', i + 1);
}
return str;
}
/**
* @description 合并多个块级标签,加快长内容渲染
* @param {Array} nodes 要合并的标签数组
*/
function mergeNodes(nodes) {
var i = nodes.length - 1;
for (var j = i; j >= -1; j--) {
if (j === -1 || nodes[j].c || !nodes[j].name || nodes[j].name !== 'div' && nodes[j].name !== 'p' && nodes[j].name[0] !== 'h' || (nodes[j].attrs.style || '').includes('inline')) {
if (i - j >= 5) {
nodes.splice(j + 1, i - j, {
name: 'div',
attrs: {},
children: nodes.slice(j + 1, i + 1)
});
}
i = j - 1;
}
}
}
/**
* @description html 解析器
* @param {Object} vm 组件实例
*/
function Parser(vm) {
this.options = vm || {};
this.tagStyle = Object.assign({}, config.tagStyle, this.options.tagStyle);
this.imgList = vm.imgList || [];
this.imgList._unloadimgs = 0;
this.plugins = vm.plugins || [];
this.attrs = Object.create(null);
this.stack = [];
this.nodes = [];
this.pre = (this.options.containerStyle || '').includes('white-space') && this.options.containerStyle.includes('pre') ? 2 : 0;
}
/**
* @description 执行解析
* @param {String} content 要解析的文本
*/
Parser.prototype.parse = function (content) {
// 插件处理
for (var i = this.plugins.length; i--;) {
if (this.plugins[i].onUpdate) {
content = this.plugins[i].onUpdate(content, config) || content;
}
}
new Lexer(this).parse(content);
// 出栈未闭合的标签
while (this.stack.length) {
this.popNode();
}
if (this.nodes.length > 50) {
mergeNodes(this.nodes);
}
return this.nodes;
};
/**
* @description 将标签暴露出来(不被 rich-text 包含)
*/
Parser.prototype.expose = function () {
for (var i = this.stack.length; i--;) {
var item = this.stack[i];
if (item.c || item.name === 'a' || item.name === 'video' || item.name === 'audio') return;
item.c = 1;
}
};
/**
* @description 处理插件
* @param {Object} node 要处理的标签
* @returns {Boolean} 是否要移除此标签
*/
Parser.prototype.hook = function (node) {
for (var i = this.plugins.length; i--;) {
if (this.plugins[i].onParse && this.plugins[i].onParse(node, this) === false) {
return false;
}
}
return true;
};
/**
* @description 将链接拼接上主域名
* @param {String} url 需要拼接的链接
* @returns {String} 拼接后的链接
*/
Parser.prototype.getUrl = function (url) {
var domain = this.options.domain;
if (url[0] === '/') {
if (url[1] === '/') {
// // 开头的补充协议名
url = (domain ? domain.split('://')[0] : 'http') + ':' + url;
} else if (domain) {
// 否则补充整个域名
url = domain + url;
}
} else if (!url.includes('data:') && !url.includes('://')) {
if (domain) {
url = domain + '/' + url;
}
}
return url;
};
/**
* @description 解析样式表
* @param {Object} node 标签
* @returns {Object}
*/
Parser.prototype.parseStyle = function (node) {
var attrs = node.attrs;
var list = (this.tagStyle[node.name] || '').split(';').concat((attrs.style || '').split(';'));
var styleObj = {};
var tmp = '';
if (attrs.id && !this.xml) {
// 暴露锚点
if (this.options.useAnchor) {
this.expose();
} else if (node.name !== 'img' && node.name !== 'a' && node.name !== 'video' && node.name !== 'audio') {
attrs.id = undefined;
}
}
// 转换 width 和 height 属性
if (attrs.width) {
styleObj.width = parseFloat(attrs.width) + (attrs.width.includes('%') ? '%' : 'px');
attrs.width = undefined;
}
if (attrs.height) {
styleObj.height = parseFloat(attrs.height) + (attrs.height.includes('%') ? '%' : 'px');
attrs.height = undefined;
}
for (var i = 0, len = list.length; i < len; i++) {
var info = list[i].split(':');
if (info.length < 2) continue;
var key = info.shift().trim().toLowerCase();
var value = info.join(':').trim();
if (value[0] === '-' && value.lastIndexOf('-') > 0 || value.includes('safe')) {
// 兼容性的 css 不压缩
tmp += ";".concat(key, ":").concat(value);
} else if (!styleObj[key] || value.includes('import') || !styleObj[key].includes('import')) {
// 重复的样式进行覆盖
if (value.includes('url')) {
// 填充链接
var j = value.indexOf('(') + 1;
if (j) {
while (value[j] === '"' || value[j] === "'" || blankChar[value[j]]) {
j++;
}
value = value.substr(0, j) + this.getUrl(value.substr(j));
}
} else if (value.includes('rpx')) {
// 转换 rpx(rich-text 内部不支持 rpx)
value = value.replace(/[0-9.]+\s*rpx/g, function ($) {
return parseFloat($) * windowWidth / 750 + 'px';
});
}
styleObj[key] = value;
}
}
node.attrs.style = tmp;
return styleObj;
};
/**
* @description 解析到标签名
* @param {String} name 标签名
* @private
*/
Parser.prototype.onTagName = function (name) {
this.tagName = this.xml ? name : name.toLowerCase();
if (this.tagName === 'svg') {
this.xml = (this.xml || 0) + 1; // svg 标签内大小写敏感
config.ignoreTags.style = undefined; // svg 标签内 style 可用
}
};
/**
* @description 解析到属性名
* @param {String} name 属性名
* @private
*/
Parser.prototype.onAttrName = function (name) {
name = this.xml ? name : name.toLowerCase();
if (name.substr(0, 5) === 'data-') {
if (name === 'data-src' && !this.attrs.src) {
// data-src 自动转为 src
this.attrName = 'src';
} else if (this.tagName === 'img' || this.tagName === 'a') {
// a 和 img 标签保留 data- 的属性,可以在 imgtap 和 linktap 事件中使用
this.attrName = name;
} else {
// 剩余的移除以减小大小
this.attrName = undefined;
}
} else {
this.attrName = name;
this.attrs[name] = 'T'; // boolean 型属性缺省设置
}
};
/**
* @description 解析到属性值
* @param {String} val 属性值
* @private
*/
Parser.prototype.onAttrVal = function (val) {
var name = this.attrName || '';
if (name === 'style' || name === 'href') {
// 部分属性进行实体解码
this.attrs[name] = decodeEntity(val, true);
} else if (name.includes('src')) {
// 拼接主域名
this.attrs[name] = this.getUrl(decodeEntity(val, true));
} else if (name) {
this.attrs[name] = val;
}
};
/**
* @description 解析到标签开始
* @param {Boolean} selfClose 是否有自闭合标识 />
* @private
*/
Parser.prototype.onOpenTag = function (selfClose) {
// 拼装 node
var node = Object.create(null);
node.name = this.tagName;
node.attrs = this.attrs;
// 避免因为自动 diff 使得 type 被设置为 null 导致部分内容不显示
if (this.options.nodes.length) {
node.type = 'node';
}
this.attrs = Object.create(null);
var attrs = node.attrs;
var parent = this.stack[this.stack.length - 1];
var siblings = parent ? parent.children : this.nodes;
var close = this.xml ? selfClose : config.voidTags[node.name];
// 替换标签名选择器
if (tagSelector[node.name]) {
attrs.class = tagSelector[node.name] + (attrs.class ? ' ' + attrs.class : '');
}
// 转换 embed 标签
if (node.name === 'embed') {
var src = attrs.src || '';
// 按照后缀名和 type 将 embed 转为 video 或 audio
if (src.includes('.mp4') || src.includes('.3gp') || src.includes('.m3u8') || (attrs.type || '').includes('video')) {
node.name = 'video';
} else if (src.includes('.mp3') || src.includes('.wav') || src.includes('.aac') || src.includes('.m4a') || (attrs.type || '').includes('audio')) {
node.name = 'audio';
}
if (attrs.autostart) {
attrs.autoplay = 'T';
}
attrs.controls = 'T';
}
// 处理音视频
if (node.name === 'video' || node.name === 'audio') {
// 设置 id 以便获取 context
if (node.name === 'video' && !attrs.id) {
attrs.id = 'v' + idIndex++;
}
// 没有设置 controls 也没有设置 autoplay 的自动设置 controls
if (!attrs.controls && !attrs.autoplay) {
attrs.controls = 'T';
}
// 用数组存储所有可用的 source
node.src = [];
if (attrs.src) {
node.src.push(attrs.src);
attrs.src = undefined;
}
this.expose();
}
// 处理自闭合标签
if (close) {
if (!this.hook(node) || config.ignoreTags[node.name]) {
// 通过 base 标签设置主域名
if (node.name === 'base' && !this.options.domain) {
this.options.domain = attrs.href;
} else if (node.name === 'source' && parent && (parent.name === 'video' || parent.name === 'audio') && attrs.src) {
// 设置 source 标签(仅父节点为 video 或 audio 时有效)
parent.src.push(attrs.src);
}
return;
}
// 解析 style
var styleObj = this.parseStyle(node);
// 处理图片
if (node.name === 'img') {
if (attrs.src) {
// 标记 webp
if (attrs.src.includes('webp')) {
node.webp = 'T';
}
// data url 图片如果没有设置 original-src 默认为不可预览的小图片
if (attrs.src.includes('data:') && !attrs['original-src']) {
attrs.ignore = 'T';
}
if (!attrs.ignore || node.webp || attrs.src.includes('cloud://')) {
for (var i = this.stack.length; i--;) {
var item = this.stack[i];
if (item.name === 'a') {
node.a = item.attrs;
}
if (item.name === 'table' && !node.webp && !attrs.src.includes('cloud://')) {
if (!styleObj.display || styleObj.display.includes('inline')) {
node.t = 'inline-block';
} else {
node.t = styleObj.display;
}
styleObj.display = undefined;
}
var style = item.attrs.style || '';
if (style.includes('flex:') && !style.includes('flex:0') && !style.includes('flex: 0') && (!styleObj.width || parseInt(styleObj.width) > 100)) {
styleObj.width = '100% !important';
styleObj.height = '';
for (var j = i + 1; j < this.stack.length; j++) {
this.stack[j].attrs.style = (this.stack[j].attrs.style || '').replace('inline-', '');
}
} else if (style.includes('flex') && styleObj.width === '100%') {
for (var _j = i + 1; _j < this.stack.length; _j++) {
var _style = this.stack[_j].attrs.style || '';
if (!_style.includes(';width') && !_style.includes(' width') && _style.indexOf('width') !== 0) {
styleObj.width = '';
break;
}
}
} else if (style.includes('inline-block')) {
if (styleObj.width && styleObj.width[styleObj.width.length - 1] === '%') {
item.attrs.style += ';max-width:' + styleObj.width;
styleObj.width = '';
} else {
item.attrs.style += ';max-width:100%';
}
}
item.c = 1;
}
attrs.i = this.imgList.length.toString();
var _src = attrs['original-src'] || attrs.src;
if (this.imgList.includes(_src)) {
// 如果有重复的链接则对域名进行随机大小写变换避免预览时错位
var _i = _src.indexOf('://');
if (_i !== -1) {
_i += 3;
var newSrc = _src.substr(0, _i);
for (; _i < _src.length; _i++) {
if (_src[_i] === '/') break;
newSrc += Math.random() > 0.5 ? _src[_i].toUpperCase() : _src[_i];
}
newSrc += _src.substr(_i);
_src = newSrc;
}
}
this.imgList.push(_src);
if (!node.t) {
this.imgList._unloadimgs += 1;
}
}
}
if (styleObj.display === 'inline') {
styleObj.display = '';
}
if (attrs.ignore) {
styleObj['max-width'] = styleObj['max-width'] || '100%';
attrs.style += ';-webkit-touch-callout:none';
}
// 设置的宽度超出屏幕,为避免变形,高度转为自动
if (parseInt(styleObj.width) > windowWidth) {
styleObj.height = undefined;
}
// 记录是否设置了宽高
if (!isNaN(parseInt(styleObj.width))) {
node.w = 'T';
}
if (!isNaN(parseInt(styleObj.height)) && (!styleObj.height.includes('%') || parent && (parent.attrs.style || '').includes('height'))) {
node.h = 'T';
}
if (node.w && node.h && styleObj['object-fit']) {
if (styleObj['object-fit'] === 'contain') {
node.m = 'aspectFit';
} else if (styleObj['object-fit'] === 'cover') {
node.m = 'aspectFill';
}
}
} else if (node.name === 'svg') {
siblings.push(node);
this.stack.push(node);
this.popNode();
return;
}
for (var key in styleObj) {
if (styleObj[key]) {
attrs.style += ";".concat(key, ":").concat(styleObj[key].replace(' !important', ''));
}
}
attrs.style = attrs.style.substr(1) || undefined;
} else {
if ((node.name === 'pre' || (attrs.style || '').includes('white-space') && attrs.style.includes('pre')) && this.pre !== 2) {
this.pre = node.pre = 1;
}
node.children = [];
this.stack.push(node);
}
// 加入节点树
siblings.push(node);
};
/**
* @description 解析到标签结束
* @param {String} name 标签名
* @private
*/
Parser.prototype.onCloseTag = function (name) {
// 依次出栈到匹配为止
name = this.xml ? name : name.toLowerCase();
var i;
for (i = this.stack.length; i--;) {
if (this.stack[i].name === name) break;
}
if (i !== -1) {
while (this.stack.length > i) {
this.popNode();
}
} else if (name === 'p' || name === 'br') {
var siblings = this.stack.length ? this.stack[this.stack.length - 1].children : this.nodes;
siblings.push({
name: name,
attrs: {
class: tagSelector[name] || '',
style: this.tagStyle[name] || ''
}
});
}
};
/**
* @description 处理标签出栈
* @private
*/
Parser.prototype.popNode = function () {
var node = this.stack.pop();
var attrs = node.attrs;
var children = node.children;
var parent = this.stack[this.stack.length - 1];
var siblings = parent ? parent.children : this.nodes;
if (!this.hook(node) || config.ignoreTags[node.name]) {
// 获取标题
if (node.name === 'title' && children.length && children[0].type === 'text' && this.options.setTitle) {
uni.setNavigationBarTitle({
title: children[0].text
});
}
siblings.pop();
return;
}
if (node.pre && this.pre !== 2) {
// 是否合并空白符标识
this.pre = node.pre = undefined;
for (var i = this.stack.length; i--;) {
if (this.stack[i].pre) {
this.pre = 1;
}
}
}
var styleObj = {};
// 转换 svg
if (node.name === 'svg') {
if (this.xml > 1) {
// 多层 svg 嵌套
this.xml--;
return;
}
var src = '';
var style = attrs.style;
attrs.style = '';
attrs.xmlns = 'http://www.w3.org/2000/svg';
(function traversal(node) {
if (node.type === 'text') {
src += node.text;
return;
}
var name = config.svgDict[node.name] || node.name;
if (name === 'foreignObject') {
var _iterator = _createForOfIteratorHelper(node.children || []),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var child = _step.value;
if (child.attrs && !child.attrs.xmlns) {
child.attrs.xmlns = 'http://www.w3.org/1999/xhtml';
break;
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
}
src += '<' + name;
for (var item in node.attrs) {
var val = node.attrs[item];
if (val) {
src += " ".concat(config.svgDict[item] || item, "=\"").concat(val, "\"");
}
}
if (!node.children) {
src += '/>';
} else {
src += '>';
for (var _i2 = 0; _i2 < node.children.length; _i2++) {
traversal(node.children[_i2]);
}
src += '' + name + '>';
}
})(node);
node.name = 'img';
node.attrs = {
src: 'data:image/svg+xml;utf8,' + src.replace(/#/g, '%23'),
style: style,
ignore: 'T'
};
node.children = undefined;
this.xml = false;
config.ignoreTags.style = true;
return;
}
// 转换 align 属性
if (attrs.align) {
if (node.name === 'table') {
if (attrs.align === 'center') {
styleObj['margin-inline-start'] = styleObj['margin-inline-end'] = 'auto';
} else {
styleObj.float = attrs.align;
}
} else {
styleObj['text-align'] = attrs.align;
}
attrs.align = undefined;
}
// 转换 dir 属性
if (attrs.dir) {
styleObj.direction = attrs.dir;
attrs.dir = undefined;
}
// 转换 font 标签的属性
if (node.name === 'font') {
if (attrs.color) {
styleObj.color = attrs.color;
attrs.color = undefined;
}
if (attrs.face) {
styleObj['font-family'] = attrs.face;
attrs.face = undefined;
}
if (attrs.size) {
var size = parseInt(attrs.size);
if (!isNaN(size)) {
if (size < 1) {
size = 1;
} else if (size > 7) {
size = 7;
}
styleObj['font-size'] = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', 'xxx-large'][size - 1];
}
attrs.size = undefined;
}
}
// 一些编辑器的自带 class
if ((attrs.class || '').includes('align-center')) {
styleObj['text-align'] = 'center';
}
Object.assign(styleObj, this.parseStyle(node));
if (node.name !== 'table' && parseInt(styleObj.width) > windowWidth) {
styleObj['max-width'] = '100%';
styleObj['box-sizing'] = 'border-box';
}
if (config.blockTags[node.name]) {
node.name = 'div';
} else if (!config.trustTags[node.name] && !this.xml) {
// 未知标签转为 span,避免无法显示
node.name = 'span';
}
if (node.name === 'a' || node.name === 'ad') {
this.expose();
} else if (node.name === 'video') {
if ((styleObj.height || '').includes('auto')) {
styleObj.height = undefined;
}
} else if ((node.name === 'ul' || node.name === 'ol') && node.c) {
// 列表处理
var types = {
a: 'lower-alpha',
A: 'upper-alpha',
i: 'lower-roman',
I: 'upper-roman'
};
if (types[attrs.type]) {
attrs.style += ';list-style-type:' + types[attrs.type];
attrs.type = undefined;
}
for (var _i3 = children.length; _i3--;) {
if (children[_i3].name === 'li') {
children[_i3].c = 1;
}
}
} else if (node.name === 'table') {
// 表格处理
// cellpadding、cellspacing、border 这几个常用表格属性需要通过转换实现
var padding = parseFloat(attrs.cellpadding);
var spacing = parseFloat(attrs.cellspacing);
var border = parseFloat(attrs.border);
var bordercolor = styleObj['border-color'];
var borderstyle = styleObj['border-style'];
if (node.c) {
// padding 和 spacing 默认 2
if (isNaN(padding)) {
padding = 2;
}
if (isNaN(spacing)) {
spacing = 2;
}
}
if (border) {
attrs.style += ";border:".concat(border, "px ").concat(borderstyle || 'solid', " ").concat(bordercolor || 'gray');
}
if (node.flag && node.c) {
// 有 colspan 或 rowspan 且含有链接的表格通过 grid 布局实现
styleObj.display = 'grid';
if (styleObj['border-collapse'] === 'collapse') {
styleObj['border-collapse'] = undefined;
spacing = 0;
}
if (spacing) {
styleObj['grid-gap'] = spacing + 'px';
styleObj.padding = spacing + 'px';
} else if (border) {
// 无间隔的情况下避免边框重叠
attrs.style += ';border-left:0;border-top:0';
}
var width = []; // 表格的列宽
var trList = []; // tr 列表
var cells = []; // 保存新的单元格
var map = {}; // 被合并单元格占用的格子
(function traversal(nodes) {
for (var _i4 = 0; _i4 < nodes.length; _i4++) {
if (nodes[_i4].name === 'tr') {
trList.push(nodes[_i4]);
} else if (nodes[_i4].name === 'colgroup') {
var colI = 1;
var _iterator2 = _createForOfIteratorHelper(nodes[_i4].children || []),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var col = _step2.value;
if (col.name === 'col') {
var _style2 = col.attrs.style || '';
var start = _style2.indexOf('width') ? _style2.indexOf(';width') : 0;
// 提取出宽度
if (start !== -1) {
var end = _style2.indexOf(';', start + 6);
if (end === -1) {
end = _style2.length;
}
width[colI] = _style2.substring(start ? start + 7 : 6, end);
}
colI += 1;
}
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
} else {
traversal(nodes[_i4].children || []);
}
}
})(children);
for (var row = 1; row <= trList.length; row++) {
var col = 1;
for (var j = 0; j < trList[row - 1].children.length; j++) {
var td = trList[row - 1].children[j];
if (td.name === 'td' || td.name === 'th') {
// 这个格子被上面的单元格占用,则列号++
while (map[row + '.' + col]) {
col++;
}
var _style3 = td.attrs.style || '';
var start = _style3.indexOf('width') ? _style3.indexOf(';width') : 0;
// 提取出 td 的宽度
if (start !== -1) {
var end = _style3.indexOf(';', start + 6);
if (end === -1) {
end = _style3.length;
}
if (!td.attrs.colspan) {
width[col] = _style3.substring(start ? start + 7 : 6, end);
}
_style3 = _style3.substr(0, start) + _style3.substr(end);
}
// 设置竖直对齐
_style3 += ';display:flex';
start = _style3.indexOf('vertical-align');
if (start !== -1) {
var val = _style3.substr(start + 15, 10);
if (val.includes('middle')) {
_style3 += ';align-items:center';
} else if (val.includes('bottom')) {
_style3 += ';align-items:flex-end';
}
} else {
_style3 += ';align-items:center';
}
// 设置水平对齐
start = _style3.indexOf('text-align');
if (start !== -1) {
var _val = _style3.substr(start + 11, 10);
if (_val.includes('center')) {
_style3 += ';justify-content: center';
} else if (_val.includes('right')) {
_style3 += ';justify-content: right';
}
}
_style3 = (border ? ";border:".concat(border, "px ").concat(borderstyle || 'solid', " ").concat(bordercolor || 'gray') + (spacing ? '' : ';border-right:0;border-bottom:0') : '') + (padding ? ";padding:".concat(padding, "px") : '') + ';' + _style3;
// 处理列合并
if (td.attrs.colspan) {
_style3 += ";grid-column-start:".concat(col, ";grid-column-end:").concat(col + parseInt(td.attrs.colspan));
if (!td.attrs.rowspan) {
_style3 += ";grid-row-start:".concat(row, ";grid-row-end:").concat(row + 1);
}
col += parseInt(td.attrs.colspan) - 1;
}
// 处理行合并
if (td.attrs.rowspan) {
_style3 += ";grid-row-start:".concat(row, ";grid-row-end:").concat(row + parseInt(td.attrs.rowspan));
if (!td.attrs.colspan) {
_style3 += ";grid-column-start:".concat(col, ";grid-column-end:").concat(col + 1);
}
// 记录下方单元格被占用
for (var rowspan = 1; rowspan < td.attrs.rowspan; rowspan++) {
for (var colspan = 0; colspan < (td.attrs.colspan || 1); colspan++) {
map[row + rowspan + '.' + (col - colspan)] = 1;
}
}
}
if (_style3) {
td.attrs.style = _style3;
}
cells.push(td);
col++;
}
}
if (row === 1) {
var temp = '';
for (var _i5 = 1; _i5 < col; _i5++) {
temp += (width[_i5] ? width[_i5] : 'auto') + ' ';
}
styleObj['grid-template-columns'] = temp;
}
}
node.children = cells;
} else {
// 没有使用合并单元格的表格通过 table 布局实现
if (node.c) {
styleObj.display = 'table';
}
if (!isNaN(spacing)) {
styleObj['border-spacing'] = spacing + 'px';
}
if (border || padding) {
// 遍历
(function traversal(nodes) {
for (var _i6 = 0; _i6 < nodes.length; _i6++) {
var _td = nodes[_i6];
if (_td.name === 'th' || _td.name === 'td') {
if (border) {
_td.attrs.style = "border:".concat(border, "px ").concat(borderstyle || 'solid', " ").concat(bordercolor || 'gray', ";").concat(_td.attrs.style || '');
}
if (padding) {
_td.attrs.style = "padding:".concat(padding, "px;").concat(_td.attrs.style || '');
}
} else if (_td.children) {
traversal(_td.children);
}
}
})(children);
}
}
// 给表格添加一个单独的横向滚动层
if (this.options.scrollTable && !(attrs.style || '').includes('inline')) {
var table = Object.assign({}, node);
node.name = 'div';
node.attrs = {
style: 'overflow:auto'
};
node.children = [table];
attrs = table.attrs;
}
} else if ((node.name === 'td' || node.name === 'th') && (attrs.colspan || attrs.rowspan)) {
for (var _i7 = this.stack.length; _i7--;) {
if (this.stack[_i7].name === 'table') {
this.stack[_i7].flag = 1; // 指示含有合并单元格
break;
}
}
} else if (node.name === 'ruby') {
// 转换 ruby
node.name = 'span';
for (var _i8 = 0; _i8 < children.length - 1; _i8++) {
if (children[_i8].type === 'text' && children[_i8 + 1].name === 'rt') {
children[_i8] = {
name: 'div',
attrs: {
style: 'display:inline-block;text-align:center'
},
children: [{
name: 'div',
attrs: {
style: 'font-size:50%;' + (children[_i8 + 1].attrs.style || '')
},
children: children[_i8 + 1].children
}, children[_i8]]
};
children.splice(_i8 + 1, 1);
}
}
} else if (node.c) {
(function traversal(node) {
node.c = 2;
for (var _i9 = node.children.length; _i9--;) {
var child = node.children[_i9];
if (!child.c || child.name === 'table') {
node.c = 1;
}
}
})(node);
}
if ((styleObj.display || '').includes('flex') && !node.c) {
for (var _i10 = children.length; _i10--;) {
var item = children[_i10];
if (item.f) {
item.attrs.style = (item.attrs.style || '') + item.f;
item.f = undefined;
}
}
}
// flex 布局时部分样式需要提取到 rich-text 外层
var flex = parent && ((parent.attrs.style || '').includes('flex') || (parent.attrs.style || '').includes('grid'))
// 检查基础库版本 virtualHost 是否可用
&& !(node.c && wx.getNFCAdapter); // eslint-disable-line
if (flex) {
node.f = ';max-width:100%';
}
if (children.length >= 50 && node.c && !(styleObj.display || '').includes('flex')) {
mergeNodes(children);
}
for (var key in styleObj) {
if (styleObj[key]) {
var _val2 = ";".concat(key, ":").concat(styleObj[key].replace(' !important', ''));
if (flex && (key.includes('flex') && key !== 'flex-direction' || key === 'align-self' || key.includes('grid') || styleObj[key][0] === '-' || key.includes('width') && _val2.includes('%'))) {
node.f += _val2;
if (key === 'width') {
attrs.style += ';width:100%';
}
} else {
attrs.style += _val2;
}
}
}
attrs.style = attrs.style.substr(1) || undefined;
};
/**
* @description 解析到文本
* @param {String} text 文本内容
*/
Parser.prototype.onText = function (text) {
if (!this.pre) {
// 合并空白符
var trim = '';
var flag;
for (var i = 0, len = text.length; i < len; i++) {
if (!blankChar[text[i]]) {
trim += text[i];
} else {
if (trim[trim.length - 1] !== ' ') {
trim += ' ';
}
if (text[i] === '\n' && !flag) {
flag = true;
}
}
}
// 去除含有换行符的空串
if (trim === ' ') {
if (flag) return;
}
text = trim;
}
var node = Object.create(null);
node.type = 'text';
node.text = decodeEntity(text);
if (this.hook(node)) {
if (this.options.selectable === 'force' && system.includes('iOS') && !uni.canIUse('rich-text.user-select')) {
this.expose();
}
var siblings = this.stack.length ? this.stack[this.stack.length - 1].children : this.nodes;
siblings.push(node);
}
};
/**
* @description html 词法分析器
* @param {Object} handler 高层处理器
*/
function Lexer(handler) {
this.handler = handler;
}
/**
* @description 执行解析
* @param {String} content 要解析的文本
*/
Lexer.prototype.parse = function (content) {
this.content = content || '';
this.i = 0; // 标记解析位置
this.start = 0; // 标记一个单词的开始位置
this.state = this.text; // 当前状态
for (var len = this.content.length; this.i !== -1 && this.i < len;) {
this.state();
}
};
/**
* @description 检查标签是否闭合
* @param {String} method 如果闭合要进行的操作
* @returns {Boolean} 是否闭合
* @private
*/
Lexer.prototype.checkClose = function (method) {
var selfClose = this.content[this.i] === '/';
if (this.content[this.i] === '>' || selfClose && this.content[this.i + 1] === '>') {
if (method) {
this.handler[method](this.content.substring(this.start, this.i));
}
this.i += selfClose ? 2 : 1;
this.start = this.i;
this.handler.onOpenTag(selfClose);
if (this.handler.tagName === 'script') {
this.i = this.content.indexOf('', this.i);
if (this.i !== -1) {
this.i += 2;
this.start = this.i;
}
this.state = this.endTag;
} else {
this.state = this.text;
}
return true;
}
return false;
};
/**
* @description 文本状态
* @private
*/
Lexer.prototype.text = function () {
this.i = this.content.indexOf('<', this.i); // 查找最近的标签
if (this.i === -1) {
// 没有标签了
if (this.start < this.content.length) {
this.handler.onText(this.content.substring(this.start, this.content.length));
}
return;
}
var c = this.content[this.i + 1];
if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z') {
// 标签开头
if (this.start !== this.i) {
this.handler.onText(this.content.substring(this.start, this.i));
}
this.start = ++this.i;
this.state = this.tagName;
} else if (c === '/' || c === '!' || c === '?') {
if (this.start !== this.i) {
this.handler.onText(this.content.substring(this.start, this.i));
}
var next = this.content[this.i + 2];
if (c === '/' && (next >= 'a' && next <= 'z' || next >= 'A' && next <= 'Z')) {
// 标签结尾
this.i += 2;
this.start = this.i;
this.state = this.endTag;
return;
}
// 处理注释
var end = '-->';
if (c !== '!' || this.content[this.i + 2] !== '-' || this.content[this.i + 3] !== '-') {
end = '>';
}
this.i = this.content.indexOf(end, this.i);
if (this.i !== -1) {
this.i += end.length;
this.start = this.i;
}
} else {
this.i++;
}
};
/**
* @description 标签名状态
* @private
*/
Lexer.prototype.tagName = function () {
if (blankChar[this.content[this.i]]) {
// 解析到标签名
this.handler.onTagName(this.content.substring(this.start, this.i));
while (blankChar[this.content[++this.i]]) {
;
}
if (this.i < this.content.length && !this.checkClose()) {
this.start = this.i;
this.state = this.attrName;
}
} else if (!this.checkClose('onTagName')) {
this.i++;
}
};
/**
* @description 属性名状态
* @private
*/
Lexer.prototype.attrName = function () {
var c = this.content[this.i];
if (blankChar[c] || c === '=') {
// 解析到属性名
this.handler.onAttrName(this.content.substring(this.start, this.i));
var needVal = c === '=';
var len = this.content.length;
while (++this.i < len) {
c = this.content[this.i];
if (!blankChar[c]) {
if (this.checkClose()) return;
if (needVal) {
// 等号后遇到第一个非空字符
this.start = this.i;
this.state = this.attrVal;
return;
}
if (this.content[this.i] === '=') {
needVal = true;
} else {
this.start = this.i;
this.state = this.attrName;
return;
}
}
}
} else if (!this.checkClose('onAttrName')) {
this.i++;
}
};
/**
* @description 属性值状态
* @private
*/
Lexer.prototype.attrVal = function () {
var c = this.content[this.i];
var len = this.content.length;
if (c === '"' || c === "'") {
// 有冒号的属性
this.start = ++this.i;
this.i = this.content.indexOf(c, this.i);
if (this.i === -1) return;
this.handler.onAttrVal(this.content.substring(this.start, this.i));
} else {
// 没有冒号的属性
for (; this.i < len; this.i++) {
if (blankChar[this.content[this.i]]) {
this.handler.onAttrVal(this.content.substring(this.start, this.i));
break;
} else if (this.checkClose('onAttrVal')) return;
}
}
while (blankChar[this.content[++this.i]]) {
;
}
if (this.i < len && !this.checkClose()) {
this.start = this.i;
this.state = this.attrName;
}
};
/**
* @description 结束标签状态
* @returns {String} 结束的标签名
* @private
*/
Lexer.prototype.endTag = function () {
var c = this.content[this.i];
if (blankChar[c] || c === '>' || c === '/') {
this.handler.onCloseTag(this.content.substring(this.start, this.i));
if (c !== '>') {
this.i = this.content.indexOf('>', this.i);
if (this.i === -1) return;
}
this.start = ++this.i;
this.state = this.text;
} else {
this.i++;
}
};
var _default = Parser;
exports.default = _default;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
/***/ }),
/***/ 11:
/*!***************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/defineProperty.js ***!
\***************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 12);
function _defineProperty(obj, key, value) {
key = toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 1111:
/*!*******************************************************************************!*\
!*** D:/Users/15570887941/Desktop/wdsxh/uni_modules/sp-editor/utils/index.js ***!
\*******************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.addLink = addLink;
exports.convertImgStylesToAttributes = convertImgStylesToAttributes;
exports.handleHtmlWithVideo = handleHtmlWithVideo;
exports.linkFlag = void 0;
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
// 标识必须独一无二 - 标识是为了使用insertText插入标识文本后,查找到标识所在delta位置的索引
var linkFlag = '#-*=*-*=*-*=*@-link超链接标识link-@*=*-*=*-*=*-#';
exports.linkFlag = linkFlag;
function addLink(editorCtx, attr, callback) {
// 先插入一段文本内容
editorCtx.insertText({
text: linkFlag
});
// 获取全文delta内容
editorCtx.getContents({
success: function success(res) {
var options = res.delta.ops;
var findex = options.findIndex(function (item) {
var _item$insert;
return item.insert && (0, _typeof2.default)(item.insert) !== 'object' && ((_item$insert = item.insert) === null || _item$insert === void 0 ? void 0 : _item$insert.indexOf(linkFlag)) !== -1;
});
// 根据标识查找到插入的位置
if (findex > -1) {
var findOption = options[findex];
var findAttributes = findOption.attributes;
// 将该findOption分成三部分:前内容 要插入的link 后内容
var _findOption$insert$sp = findOption.insert.split(linkFlag),
_findOption$insert$sp2 = (0, _slicedToArray2.default)(_findOption$insert$sp, 2),
prefix = _findOption$insert$sp2[0],
suffix = _findOption$insert$sp2[1];
var handleOps = [];
// 前内容
if (prefix) {
var prefixOps = findAttributes ? {
insert: prefix,
attributes: findAttributes
} : {
insert: prefix
};
handleOps.push(prefixOps);
}
// 插入的link
var linkOps = {
insert: attr.text,
attributes: {
link: attr.href,
textDecoration: attr.textDecoration || 'none',
// 下划线
color: attr.color || '#007aff'
}
};
handleOps.push(linkOps);
// 后内容
if (suffix) {
var suffixOps = findAttributes ? {
insert: suffix,
attributes: findAttributes
} : {
insert: suffix
};
handleOps.push(suffixOps);
}
// 删除原options[findex]并在findex位置插入上述三个ops
options.splice(findex, 1);
options.splice.apply(options, [findex, 0].concat(handleOps));
// 最后重新初始化内容,注意该方法会导致光标重置到最开始位置
editorCtx.setContents({
delta: {
ops: options
}
});
// 所以最后建议使富文本光标失焦,让用户手动聚焦光标
editorCtx.blur();
// 后续回调操作
if (callback) callback();
}
}
});
}
/**
* 将含有特殊图片形式视频的富文本转换成正常视频的富文本
* @param {String} html 要进行处理的富文本字符串
* @returns {String} 返回处理结果
*/
function handleHtmlWithVideo(html) {
// 正则表达式用于匹配img标签中带有alt属性且alt属性值为视频链接的模式
var regex = /
]*>/g;
// 使用replace方法和一个函数回调来替换匹配到的内容
return html.replace(regex, function (match, videoUrl) {
// 替换为video标签,并添加controls属性以便用户可以控制播放
return "");
});
}
/**
* 将img标签中内联style属性中的宽高样式提取出标签width与height属性
* @param {Object} html 要处理的富文本字符串
* @returns {Object} 返回处理结果
*/
function convertImgStylesToAttributes(html) {
return html.replace(/
]+)\s*>/g, function (match, attributes) {
// 分割属性
var attrs = attributes.split(/\s+/);
// 找到style属性的位置
var styleIndex = attrs.findIndex(function (attr) {
return attr.startsWith('style=');
});
if (styleIndex === -1) return match; // 如果没有找到style属性,则返回原样
// 提取style属性值
var styleAttr = attrs.splice(styleIndex, 1)[0];
var style = styleAttr.match(/"([^"]*)"/)[1];
// 解析 style 属性
var styleObj = {};
style.split(';').forEach(function (part) {
if (part) {
var _part$split = part.split(':'),
_part$split2 = (0, _slicedToArray2.default)(_part$split, 2),
name = _part$split2[0],
value = _part$split2[1];
styleObj[name.trim()] = value.trim();
}
});
// 创建新的 img 标签
var newTag = '
';
return newTag;
});
}
/***/ }),
/***/ 12:
/*!**************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/toPropertyKey.js ***!
\**************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ 14);
function toPropertyKey(t) {
var i = toPrimitive(t, "string");
return "symbol" == _typeof(i) ? i : i + "";
}
module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 1294:
/*!**********************************************************************************************************!*\
!*** D:/Users/15570887941/Desktop/wdsxh/uni_modules/uni-icons/components/uni-icons/uniicons_file_vue.js ***!
\**********************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.fontData = void 0;
var fontData = [{
"font_class": "arrow-down",
"unicode": "\uE6BE"
}, {
"font_class": "arrow-left",
"unicode": "\uE6BC"
}, {
"font_class": "arrow-right",
"unicode": "\uE6BB"
}, {
"font_class": "arrow-up",
"unicode": "\uE6BD"
}, {
"font_class": "auth",
"unicode": "\uE6AB"
}, {
"font_class": "auth-filled",
"unicode": "\uE6CC"
}, {
"font_class": "back",
"unicode": "\uE6B9"
}, {
"font_class": "bars",
"unicode": "\uE627"
}, {
"font_class": "calendar",
"unicode": "\uE6A0"
}, {
"font_class": "calendar-filled",
"unicode": "\uE6C0"
}, {
"font_class": "camera",
"unicode": "\uE65A"
}, {
"font_class": "camera-filled",
"unicode": "\uE658"
}, {
"font_class": "cart",
"unicode": "\uE631"
}, {
"font_class": "cart-filled",
"unicode": "\uE6D0"
}, {
"font_class": "chat",
"unicode": "\uE65D"
}, {
"font_class": "chat-filled",
"unicode": "\uE659"
}, {
"font_class": "chatboxes",
"unicode": "\uE696"
}, {
"font_class": "chatboxes-filled",
"unicode": "\uE692"
}, {
"font_class": "chatbubble",
"unicode": "\uE697"
}, {
"font_class": "chatbubble-filled",
"unicode": "\uE694"
}, {
"font_class": "checkbox",
"unicode": "\uE62B"
}, {
"font_class": "checkbox-filled",
"unicode": "\uE62C"
}, {
"font_class": "checkmarkempty",
"unicode": "\uE65C"
}, {
"font_class": "circle",
"unicode": "\uE65B"
}, {
"font_class": "circle-filled",
"unicode": "\uE65E"
}, {
"font_class": "clear",
"unicode": "\uE66D"
}, {
"font_class": "close",
"unicode": "\uE673"
}, {
"font_class": "closeempty",
"unicode": "\uE66C"
}, {
"font_class": "cloud-download",
"unicode": "\uE647"
}, {
"font_class": "cloud-download-filled",
"unicode": "\uE646"
}, {
"font_class": "cloud-upload",
"unicode": "\uE645"
}, {
"font_class": "cloud-upload-filled",
"unicode": "\uE648"
}, {
"font_class": "color",
"unicode": "\uE6CF"
}, {
"font_class": "color-filled",
"unicode": "\uE6C9"
}, {
"font_class": "compose",
"unicode": "\uE67F"
}, {
"font_class": "contact",
"unicode": "\uE693"
}, {
"font_class": "contact-filled",
"unicode": "\uE695"
}, {
"font_class": "down",
"unicode": "\uE6B8"
}, {
"font_class": "bottom",
"unicode": "\uE6B8"
}, {
"font_class": "download",
"unicode": "\uE68D"
}, {
"font_class": "download-filled",
"unicode": "\uE681"
}, {
"font_class": "email",
"unicode": "\uE69E"
}, {
"font_class": "email-filled",
"unicode": "\uE69A"
}, {
"font_class": "eye",
"unicode": "\uE651"
}, {
"font_class": "eye-filled",
"unicode": "\uE66A"
}, {
"font_class": "eye-slash",
"unicode": "\uE6B3"
}, {
"font_class": "eye-slash-filled",
"unicode": "\uE6B4"
}, {
"font_class": "fire",
"unicode": "\uE6A1"
}, {
"font_class": "fire-filled",
"unicode": "\uE6C5"
}, {
"font_class": "flag",
"unicode": "\uE65F"
}, {
"font_class": "flag-filled",
"unicode": "\uE660"
}, {
"font_class": "folder-add",
"unicode": "\uE6A9"
}, {
"font_class": "folder-add-filled",
"unicode": "\uE6C8"
}, {
"font_class": "font",
"unicode": "\uE6A3"
}, {
"font_class": "forward",
"unicode": "\uE6BA"
}, {
"font_class": "gear",
"unicode": "\uE664"
}, {
"font_class": "gear-filled",
"unicode": "\uE661"
}, {
"font_class": "gift",
"unicode": "\uE6A4"
}, {
"font_class": "gift-filled",
"unicode": "\uE6C4"
}, {
"font_class": "hand-down",
"unicode": "\uE63D"
}, {
"font_class": "hand-down-filled",
"unicode": "\uE63C"
}, {
"font_class": "hand-up",
"unicode": "\uE63F"
}, {
"font_class": "hand-up-filled",
"unicode": "\uE63E"
}, {
"font_class": "headphones",
"unicode": "\uE630"
}, {
"font_class": "heart",
"unicode": "\uE639"
}, {
"font_class": "heart-filled",
"unicode": "\uE641"
}, {
"font_class": "help",
"unicode": "\uE679"
}, {
"font_class": "help-filled",
"unicode": "\uE674"
}, {
"font_class": "home",
"unicode": "\uE662"
}, {
"font_class": "home-filled",
"unicode": "\uE663"
}, {
"font_class": "image",
"unicode": "\uE670"
}, {
"font_class": "image-filled",
"unicode": "\uE678"
}, {
"font_class": "images",
"unicode": "\uE650"
}, {
"font_class": "images-filled",
"unicode": "\uE64B"
}, {
"font_class": "info",
"unicode": "\uE669"
}, {
"font_class": "info-filled",
"unicode": "\uE649"
}, {
"font_class": "left",
"unicode": "\uE6B7"
}, {
"font_class": "link",
"unicode": "\uE6A5"
}, {
"font_class": "list",
"unicode": "\uE644"
}, {
"font_class": "location",
"unicode": "\uE6AE"
}, {
"font_class": "location-filled",
"unicode": "\uE6AF"
}, {
"font_class": "locked",
"unicode": "\uE66B"
}, {
"font_class": "locked-filled",
"unicode": "\uE668"
}, {
"font_class": "loop",
"unicode": "\uE633"
}, {
"font_class": "mail-open",
"unicode": "\uE643"
}, {
"font_class": "mail-open-filled",
"unicode": "\uE63A"
}, {
"font_class": "map",
"unicode": "\uE667"
}, {
"font_class": "map-filled",
"unicode": "\uE666"
}, {
"font_class": "map-pin",
"unicode": "\uE6AD"
}, {
"font_class": "map-pin-ellipse",
"unicode": "\uE6AC"
}, {
"font_class": "medal",
"unicode": "\uE6A2"
}, {
"font_class": "medal-filled",
"unicode": "\uE6C3"
}, {
"font_class": "mic",
"unicode": "\uE671"
}, {
"font_class": "mic-filled",
"unicode": "\uE677"
}, {
"font_class": "micoff",
"unicode": "\uE67E"
}, {
"font_class": "micoff-filled",
"unicode": "\uE6B0"
}, {
"font_class": "minus",
"unicode": "\uE66F"
}, {
"font_class": "minus-filled",
"unicode": "\uE67D"
}, {
"font_class": "more",
"unicode": "\uE64D"
}, {
"font_class": "more-filled",
"unicode": "\uE64E"
}, {
"font_class": "navigate",
"unicode": "\uE66E"
}, {
"font_class": "navigate-filled",
"unicode": "\uE67A"
}, {
"font_class": "notification",
"unicode": "\uE6A6"
}, {
"font_class": "notification-filled",
"unicode": "\uE6C1"
}, {
"font_class": "paperclip",
"unicode": "\uE652"
}, {
"font_class": "paperplane",
"unicode": "\uE672"
}, {
"font_class": "paperplane-filled",
"unicode": "\uE675"
}, {
"font_class": "person",
"unicode": "\uE699"
}, {
"font_class": "person-filled",
"unicode": "\uE69D"
}, {
"font_class": "personadd",
"unicode": "\uE69F"
}, {
"font_class": "personadd-filled",
"unicode": "\uE698"
}, {
"font_class": "personadd-filled-copy",
"unicode": "\uE6D1"
}, {
"font_class": "phone",
"unicode": "\uE69C"
}, {
"font_class": "phone-filled",
"unicode": "\uE69B"
}, {
"font_class": "plus",
"unicode": "\uE676"
}, {
"font_class": "plus-filled",
"unicode": "\uE6C7"
}, {
"font_class": "plusempty",
"unicode": "\uE67B"
}, {
"font_class": "pulldown",
"unicode": "\uE632"
}, {
"font_class": "pyq",
"unicode": "\uE682"
}, {
"font_class": "qq",
"unicode": "\uE680"
}, {
"font_class": "redo",
"unicode": "\uE64A"
}, {
"font_class": "redo-filled",
"unicode": "\uE655"
}, {
"font_class": "refresh",
"unicode": "\uE657"
}, {
"font_class": "refresh-filled",
"unicode": "\uE656"
}, {
"font_class": "refreshempty",
"unicode": "\uE6BF"
}, {
"font_class": "reload",
"unicode": "\uE6B2"
}, {
"font_class": "right",
"unicode": "\uE6B5"
}, {
"font_class": "scan",
"unicode": "\uE62A"
}, {
"font_class": "search",
"unicode": "\uE654"
}, {
"font_class": "settings",
"unicode": "\uE653"
}, {
"font_class": "settings-filled",
"unicode": "\uE6CE"
}, {
"font_class": "shop",
"unicode": "\uE62F"
}, {
"font_class": "shop-filled",
"unicode": "\uE6CD"
}, {
"font_class": "smallcircle",
"unicode": "\uE67C"
}, {
"font_class": "smallcircle-filled",
"unicode": "\uE665"
}, {
"font_class": "sound",
"unicode": "\uE684"
}, {
"font_class": "sound-filled",
"unicode": "\uE686"
}, {
"font_class": "spinner-cycle",
"unicode": "\uE68A"
}, {
"font_class": "staff",
"unicode": "\uE6A7"
}, {
"font_class": "staff-filled",
"unicode": "\uE6CB"
}, {
"font_class": "star",
"unicode": "\uE688"
}, {
"font_class": "star-filled",
"unicode": "\uE68F"
}, {
"font_class": "starhalf",
"unicode": "\uE683"
}, {
"font_class": "trash",
"unicode": "\uE687"
}, {
"font_class": "trash-filled",
"unicode": "\uE685"
}, {
"font_class": "tune",
"unicode": "\uE6AA"
}, {
"font_class": "tune-filled",
"unicode": "\uE6CA"
}, {
"font_class": "undo",
"unicode": "\uE64F"
}, {
"font_class": "undo-filled",
"unicode": "\uE64C"
}, {
"font_class": "up",
"unicode": "\uE6B6"
}, {
"font_class": "top",
"unicode": "\uE6B6"
}, {
"font_class": "upload",
"unicode": "\uE690"
}, {
"font_class": "upload-filled",
"unicode": "\uE68E"
}, {
"font_class": "videocam",
"unicode": "\uE68C"
}, {
"font_class": "videocam-filled",
"unicode": "\uE689"
}, {
"font_class": "vip",
"unicode": "\uE6A8"
}, {
"font_class": "vip-filled",
"unicode": "\uE6C6"
}, {
"font_class": "wallet",
"unicode": "\uE6B1"
}, {
"font_class": "wallet-filled",
"unicode": "\uE6C2"
}, {
"font_class": "weibo",
"unicode": "\uE68B"
}, {
"font_class": "weixin",
"unicode": "\uE691"
}];
// export const fontData = JSON.parse(fontDataJson)
exports.fontData = fontData;
/***/ }),
/***/ 13:
/*!*******************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
\*******************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
function _typeof(o) {
"@babel/helpers - typeof";
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
}
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 14:
/*!************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/toPrimitive.js ***!
\************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
function toPrimitive(t, r) {
if ("object" != _typeof(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 15:
/*!**********************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/construct.js ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ 16);
var isNativeReflectConstruct = __webpack_require__(/*! ./isNativeReflectConstruct.js */ 17);
function _construct(t, e, r) {
if (isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
var o = [null];
o.push.apply(o, e);
var p = new (t.bind.apply(t, o))();
return r && setPrototypeOf(p, r.prototype), p;
}
module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 1548:
/*!***********************************************************************************************************************!*\
!*** D:/Users/15570887941/Desktop/wdsxh/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js ***!
\***********************************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _en = _interopRequireDefault(__webpack_require__(/*! ./en.json */ 1549));
var _zhHans = _interopRequireDefault(__webpack_require__(/*! ./zh-Hans.json */ 1550));
var _zhHant = _interopRequireDefault(__webpack_require__(/*! ./zh-Hant.json */ 1551));
var _default = {
en: _en.default,
'zh-Hans': _zhHans.default,
'zh-Hant': _zhHant.default
};
exports.default = _default;
/***/ }),
/***/ 1549:
/*!**********************************************************************************************************************!*\
!*** D:/Users/15570887941/Desktop/wdsxh/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json ***!
\**********************************************************************************************************************/
/*! exports provided: uni-datetime-picker.selectDate, uni-datetime-picker.selectTime, uni-datetime-picker.selectDateTime, uni-datetime-picker.startDate, uni-datetime-picker.endDate, uni-datetime-picker.startTime, uni-datetime-picker.endTime, uni-datetime-picker.ok, uni-datetime-picker.clear, uni-datetime-picker.cancel, uni-datetime-picker.year, uni-datetime-picker.month, uni-calender.MON, uni-calender.TUE, uni-calender.WED, uni-calender.THU, uni-calender.FRI, uni-calender.SAT, uni-calender.SUN, uni-calender.confirm, default */
/***/ (function(module) {
module.exports = JSON.parse("{\"uni-datetime-picker.selectDate\":\"select date\",\"uni-datetime-picker.selectTime\":\"select time\",\"uni-datetime-picker.selectDateTime\":\"select date and time\",\"uni-datetime-picker.startDate\":\"start date\",\"uni-datetime-picker.endDate\":\"end date\",\"uni-datetime-picker.startTime\":\"start time\",\"uni-datetime-picker.endTime\":\"end time\",\"uni-datetime-picker.ok\":\"ok\",\"uni-datetime-picker.clear\":\"clear\",\"uni-datetime-picker.cancel\":\"cancel\",\"uni-datetime-picker.year\":\"-\",\"uni-datetime-picker.month\":\"\",\"uni-calender.MON\":\"MON\",\"uni-calender.TUE\":\"TUE\",\"uni-calender.WED\":\"WED\",\"uni-calender.THU\":\"THU\",\"uni-calender.FRI\":\"FRI\",\"uni-calender.SAT\":\"SAT\",\"uni-calender.SUN\":\"SUN\",\"uni-calender.confirm\":\"confirm\"}");
/***/ }),
/***/ 1550:
/*!***************************************************************************************************************************!*\
!*** D:/Users/15570887941/Desktop/wdsxh/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json ***!
\***************************************************************************************************************************/
/*! exports provided: uni-datetime-picker.selectDate, uni-datetime-picker.selectTime, uni-datetime-picker.selectDateTime, uni-datetime-picker.startDate, uni-datetime-picker.endDate, uni-datetime-picker.startTime, uni-datetime-picker.endTime, uni-datetime-picker.ok, uni-datetime-picker.clear, uni-datetime-picker.cancel, uni-datetime-picker.year, uni-datetime-picker.month, uni-calender.SUN, uni-calender.MON, uni-calender.TUE, uni-calender.WED, uni-calender.THU, uni-calender.FRI, uni-calender.SAT, uni-calender.confirm, default */
/***/ (function(module) {
module.exports = JSON.parse("{\"uni-datetime-picker.selectDate\":\"选择日期\",\"uni-datetime-picker.selectTime\":\"选择时间\",\"uni-datetime-picker.selectDateTime\":\"选择日期时间\",\"uni-datetime-picker.startDate\":\"开始日期\",\"uni-datetime-picker.endDate\":\"结束日期\",\"uni-datetime-picker.startTime\":\"开始时间\",\"uni-datetime-picker.endTime\":\"结束时间\",\"uni-datetime-picker.ok\":\"确定\",\"uni-datetime-picker.clear\":\"清除\",\"uni-datetime-picker.cancel\":\"取消\",\"uni-datetime-picker.year\":\"年\",\"uni-datetime-picker.month\":\"月\",\"uni-calender.SUN\":\"日\",\"uni-calender.MON\":\"一\",\"uni-calender.TUE\":\"二\",\"uni-calender.WED\":\"三\",\"uni-calender.THU\":\"四\",\"uni-calender.FRI\":\"五\",\"uni-calender.SAT\":\"六\",\"uni-calender.confirm\":\"确认\"}");
/***/ }),
/***/ 1551:
/*!***************************************************************************************************************************!*\
!*** D:/Users/15570887941/Desktop/wdsxh/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json ***!
\***************************************************************************************************************************/
/*! exports provided: uni-datetime-picker.selectDate, uni-datetime-picker.selectTime, uni-datetime-picker.selectDateTime, uni-datetime-picker.startDate, uni-datetime-picker.endDate, uni-datetime-picker.startTime, uni-datetime-picker.endTime, uni-datetime-picker.ok, uni-datetime-picker.clear, uni-datetime-picker.cancel, uni-datetime-picker.year, uni-datetime-picker.month, uni-calender.SUN, uni-calender.MON, uni-calender.TUE, uni-calender.WED, uni-calender.THU, uni-calender.FRI, uni-calender.SAT, uni-calender.confirm, default */
/***/ (function(module) {
module.exports = JSON.parse("{\"uni-datetime-picker.selectDate\":\"選擇日期\",\"uni-datetime-picker.selectTime\":\"選擇時間\",\"uni-datetime-picker.selectDateTime\":\"選擇日期時間\",\"uni-datetime-picker.startDate\":\"開始日期\",\"uni-datetime-picker.endDate\":\"結束日期\",\"uni-datetime-picker.startTime\":\"開始时间\",\"uni-datetime-picker.endTime\":\"結束时间\",\"uni-datetime-picker.ok\":\"確定\",\"uni-datetime-picker.clear\":\"清除\",\"uni-datetime-picker.cancel\":\"取消\",\"uni-datetime-picker.year\":\"年\",\"uni-datetime-picker.month\":\"月\",\"uni-calender.SUN\":\"日\",\"uni-calender.MON\":\"一\",\"uni-calender.TUE\":\"二\",\"uni-calender.WED\":\"三\",\"uni-calender.THU\":\"四\",\"uni-calender.FRI\":\"五\",\"uni-calender.SAT\":\"六\",\"uni-calender.confirm\":\"確認\"}");
/***/ }),
/***/ 1552:
/*!*****************************************************************************************************************!*\
!*** D:/Users/15570887941/Desktop/wdsxh/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js ***!
\*****************************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Calendar = void 0;
exports.addZero = addZero;
exports.checkDate = checkDate;
exports.dateCompare = dateCompare;
exports.fixIosDateFormat = fixIosDateFormat;
exports.getDate = getDate;
exports.getDateTime = getDateTime;
exports.getDefaultSecond = getDefaultSecond;
exports.getTime = getTime;
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
var Calendar = /*#__PURE__*/function () {
function Calendar() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
selected = _ref.selected,
startDate = _ref.startDate,
endDate = _ref.endDate,
range = _ref.range;
(0, _classCallCheck2.default)(this, Calendar);
// 当前日期
this.date = this.getDateObj(new Date()); // 当前初入日期
// 打点信息
this.selected = selected || [];
// 起始时间
this.startDate = startDate;
// 终止时间
this.endDate = endDate;
// 是否范围选择
this.range = range;
// 多选状态
this.cleanMultipleStatus();
// 每周日期
this.weeks = {};
this.lastHover = false;
}
/**
* 设置日期
* @param {Object} date
*/
(0, _createClass2.default)(Calendar, [{
key: "setDate",
value: function setDate(date) {
var selectDate = this.getDateObj(date);
this.getWeeks(selectDate.fullDate);
}
/**
* 清理多选状态
*/
}, {
key: "cleanMultipleStatus",
value: function cleanMultipleStatus() {
this.multipleStatus = {
before: '',
after: '',
data: []
};
}
}, {
key: "setStartDate",
value: function setStartDate(startDate) {
this.startDate = startDate;
}
}, {
key: "setEndDate",
value: function setEndDate(endDate) {
this.endDate = endDate;
}
}, {
key: "getPreMonthObj",
value: function getPreMonthObj(date) {
date = fixIosDateFormat(date);
date = new Date(date);
var oldMonth = date.getMonth();
date.setMonth(oldMonth - 1);
var newMonth = date.getMonth();
if (oldMonth !== 0 && newMonth - oldMonth === 0) {
date.setMonth(newMonth - 1);
}
return this.getDateObj(date);
}
}, {
key: "getNextMonthObj",
value: function getNextMonthObj(date) {
date = fixIosDateFormat(date);
date = new Date(date);
var oldMonth = date.getMonth();
date.setMonth(oldMonth + 1);
var newMonth = date.getMonth();
if (newMonth - oldMonth > 1) {
date.setMonth(newMonth - 1);
}
return this.getDateObj(date);
}
/**
* 获取指定格式Date对象
*/
}, {
key: "getDateObj",
value: function getDateObj(date) {
date = fixIosDateFormat(date);
date = new Date(date);
return {
fullDate: getDate(date),
year: date.getFullYear(),
month: addZero(date.getMonth() + 1),
date: addZero(date.getDate()),
day: date.getDay()
};
}
/**
* 获取上一个月日期集合
*/
}, {
key: "getPreMonthDays",
value: function getPreMonthDays(amount, dateObj) {
var result = [];
for (var i = amount - 1; i >= 0; i--) {
var month = dateObj.month - 1;
result.push({
date: new Date(dateObj.year, month, -i).getDate(),
month: month,
disable: true
});
}
return result;
}
/**
* 获取本月日期集合
*/
}, {
key: "getCurrentMonthDays",
value: function getCurrentMonthDays(amount, dateObj) {
var _this = this;
var result = [];
var fullDate = this.date.fullDate;
var _loop = function _loop(i) {
var currentDate = "".concat(dateObj.year, "-").concat(dateObj.month, "-").concat(addZero(i));
var isToday = fullDate === currentDate;
// 获取打点信息
var info = _this.selected && _this.selected.find(function (item) {
if (_this.dateEqual(currentDate, item.date)) {
return item;
}
});
// 日期禁用
var disableBefore = true;
var disableAfter = true;
if (_this.startDate) {
disableBefore = dateCompare(_this.startDate, currentDate);
}
if (_this.endDate) {
disableAfter = dateCompare(currentDate, _this.endDate);
}
var multiples = _this.multipleStatus.data;
var multiplesStatus = -1;
if (_this.range && multiples) {
multiplesStatus = multiples.findIndex(function (item) {
return _this.dateEqual(item, currentDate);
});
}
var checked = multiplesStatus !== -1;
result.push({
fullDate: currentDate,
year: dateObj.year,
date: i,
multiple: _this.range ? checked : false,
beforeMultiple: _this.isLogicBefore(currentDate, _this.multipleStatus.before, _this.multipleStatus.after),
afterMultiple: _this.isLogicAfter(currentDate, _this.multipleStatus.before, _this.multipleStatus.after),
month: dateObj.month,
disable: _this.startDate && !dateCompare(_this.startDate, currentDate) || _this.endDate && !dateCompare(currentDate, _this.endDate),
isToday: isToday,
userChecked: false,
extraInfo: info
});
};
for (var i = 1; i <= amount; i++) {
_loop(i);
}
return result;
}
/**
* 获取下一个月日期集合
*/
}, {
key: "_getNextMonthDays",
value: function _getNextMonthDays(amount, dateObj) {
var result = [];
var month = dateObj.month + 1;
for (var i = 1; i <= amount; i++) {
result.push({
date: i,
month: month,
disable: true
});
}
return result;
}
/**
* 获取当前日期详情
* @param {Object} date
*/
}, {
key: "getInfo",
value: function getInfo(date) {
var _this2 = this;
if (!date) {
date = new Date();
}
return this.calendar.find(function (item) {
return item.fullDate === _this2.getDateObj(date).fullDate;
});
}
/**
* 比较时间是否相等
*/
}, {
key: "dateEqual",
value: function dateEqual(before, after) {
before = new Date(fixIosDateFormat(before));
after = new Date(fixIosDateFormat(after));
return before.valueOf() === after.valueOf();
}
/**
* 比较真实起始日期
*/
}, {
key: "isLogicBefore",
value: function isLogicBefore(currentDate, before, after) {
var logicBefore = before;
if (before && after) {
logicBefore = dateCompare(before, after) ? before : after;
}
return this.dateEqual(logicBefore, currentDate);
}
}, {
key: "isLogicAfter",
value: function isLogicAfter(currentDate, before, after) {
var logicAfter = after;
if (before && after) {
logicAfter = dateCompare(before, after) ? after : before;
}
return this.dateEqual(logicAfter, currentDate);
}
/**
* 获取日期范围内所有日期
* @param {Object} begin
* @param {Object} end
*/
}, {
key: "geDateAll",
value: function geDateAll(begin, end) {
var arr = [];
var ab = begin.split('-');
var ae = end.split('-');
var db = new Date();
db.setFullYear(ab[0], ab[1] - 1, ab[2]);
var de = new Date();
de.setFullYear(ae[0], ae[1] - 1, ae[2]);
var unixDb = db.getTime() - 24 * 60 * 60 * 1000;
var unixDe = de.getTime() - 24 * 60 * 60 * 1000;
for (var k = unixDb; k <= unixDe;) {
k = k + 24 * 60 * 60 * 1000;
arr.push(this.getDateObj(new Date(parseInt(k))).fullDate);
}
return arr;
}
/**
* 获取多选状态
*/
}, {
key: "setMultiple",
value: function setMultiple(fullDate) {
if (!this.range) return;
var _this$multipleStatus = this.multipleStatus,
before = _this$multipleStatus.before,
after = _this$multipleStatus.after;
if (before && after) {
if (!this.lastHover) {
this.lastHover = true;
return;
}
this.multipleStatus.before = fullDate;
this.multipleStatus.after = '';
this.multipleStatus.data = [];
this.multipleStatus.fulldate = '';
this.lastHover = false;
} else {
if (!before) {
this.multipleStatus.before = fullDate;
this.multipleStatus.after = undefined;
this.lastHover = false;
} else {
this.multipleStatus.after = fullDate;
if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
} else {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
}
this.lastHover = true;
}
}
this.getWeeks(fullDate);
}
/**
* 鼠标 hover 更新多选状态
*/
}, {
key: "setHoverMultiple",
value: function setHoverMultiple(fullDate) {
//抖音小程序点击会触发hover事件,需要避免一下
if (!this.range || this.lastHover) return;
var before = this.multipleStatus.before;
if (!before) {
this.multipleStatus.before = fullDate;
} else {
this.multipleStatus.after = fullDate;
if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
} else {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
}
}
this.getWeeks(fullDate);
}
/**
* 更新默认值多选状态
*/
}, {
key: "setDefaultMultiple",
value: function setDefaultMultiple(before, after) {
this.multipleStatus.before = before;
this.multipleStatus.after = after;
if (before && after) {
if (dateCompare(before, after)) {
this.multipleStatus.data = this.geDateAll(before, after);
this.getWeeks(after);
} else {
this.multipleStatus.data = this.geDateAll(after, before);
this.getWeeks(before);
}
}
}
/**
* 获取每周数据
* @param {Object} dateData
*/
}, {
key: "getWeeks",
value: function getWeeks(dateData) {
var _this$getDateObj = this.getDateObj(dateData),
year = _this$getDateObj.year,
month = _this$getDateObj.month;
var preMonthDayAmount = new Date(year, month - 1, 1).getDay();
var preMonthDays = this.getPreMonthDays(preMonthDayAmount, this.getDateObj(dateData));
var currentMonthDayAmount = new Date(year, month, 0).getDate();
var currentMonthDays = this.getCurrentMonthDays(currentMonthDayAmount, this.getDateObj(dateData));
var nextMonthDayAmount = 42 - preMonthDayAmount - currentMonthDayAmount;
var nextMonthDays = this._getNextMonthDays(nextMonthDayAmount, this.getDateObj(dateData));
var calendarDays = [].concat((0, _toConsumableArray2.default)(preMonthDays), (0, _toConsumableArray2.default)(currentMonthDays), (0, _toConsumableArray2.default)(nextMonthDays));
var weeks = new Array(6);
for (var i = 0; i < calendarDays.length; i++) {
var index = Math.floor(i / 7);
if (!weeks[index]) {
weeks[index] = new Array(7);
}
weeks[index][i % 7] = calendarDays[i];
}
this.calendar = calendarDays;
this.weeks = weeks;
}
}]);
return Calendar;
}();
exports.Calendar = Calendar;
function getDateTime(date, hideSecond) {
return "".concat(getDate(date), " ").concat(getTime(date, hideSecond));
}
function getDate(date) {
date = fixIosDateFormat(date);
date = new Date(date);
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
return "".concat(year, "-").concat(addZero(month), "-").concat(addZero(day));
}
function getTime(date, hideSecond) {
date = fixIosDateFormat(date);
date = new Date(date);
var hour = date.getHours();
var minute = date.getMinutes();
var second = date.getSeconds();
return hideSecond ? "".concat(addZero(hour), ":").concat(addZero(minute)) : "".concat(addZero(hour), ":").concat(addZero(minute), ":").concat(addZero(second));
}
function addZero(num) {
if (num < 10) {
num = "0".concat(num);
}
return num;
}
function getDefaultSecond(hideSecond) {
return hideSecond ? '00:00' : '00:00:00';
}
function dateCompare(startDate, endDate) {
startDate = new Date(fixIosDateFormat(startDate));
endDate = new Date(fixIosDateFormat(endDate));
return startDate <= endDate;
}
function checkDate(date) {
var dateReg = /((19|20)\d{2})(-|\/)\d{1,2}(-|\/)\d{1,2}/g;
return date.match(dateReg);
}
//ios低版本15及以下,无法匹配 没有 ’秒‘ 时的情况,所以需要在末尾 秒 加上 问号
var dateTimeReg = /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])( [0-5]?[0-9]:[0-5]?[0-9](:[0-5]?[0-9])?)?$/;
function fixIosDateFormat(value) {
if (typeof value === 'string' && dateTimeReg.test(value)) {
value = value.replace(/-/g, '/');
}
return value;
}
/***/ }),
/***/ 16:
/*!***************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/setPrototypeOf.js ***!
\***************************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
function _setPrototypeOf(o, p) {
module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
return _setPrototypeOf(o, p);
}
module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 1602:
/*!****************************************************************************************!*\
!*** D:/Users/15570887941/Desktop/wdsxh/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js ***!
\****************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _default = {
// 将自定义节点设置成虚拟的(去掉自定义组件包裹层),更加接近Vue组件的表现,能更好的使用flex属性
options: {
virtualHost: true
}
};
exports.default = _default;
/***/ }),
/***/ 1603:
/*!**************************************************************************************!*\
!*** D:/Users/15570887941/Desktop/wdsxh/uni_modules/uv-ui-tools/libs/mixin/mixin.js ***!
\**************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(uni) {
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
var index = _interopRequireWildcard(__webpack_require__(/*! ../function/index.js */ 1604));
var test = _interopRequireWildcard(__webpack_require__(/*! ../function/test.js */ 1605));
var _route = _interopRequireDefault(__webpack_require__(/*! ../util/route.js */ 1608));
var _debounce = _interopRequireDefault(__webpack_require__(/*! ../function/debounce.js */ 1609));
var _throttle = _interopRequireDefault(__webpack_require__(/*! ../function/throttle.js */ 1610));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var _default2 = {
// 定义每个组件都可能需要用到的外部样式以及类名
props: {
// 每个组件都有的父组件传递的样式,可以为字符串或者对象形式
customStyle: {
type: [Object, String],
default: function _default() {
return {};
}
},
customClass: {
type: String,
default: ''
},
// 跳转的页面路径
url: {
type: String,
default: ''
},
// 页面跳转的类型
linkType: {
type: String,
default: 'navigateTo'
}
},
data: function data() {
return {};
},
onLoad: function onLoad() {
// getRect挂载到$uv上,因为这方法需要使用in(this),所以无法把它独立成一个单独的文件导出
this.$uv.getRect = this.$uvGetRect;
},
created: function created() {
// 组件当中,只有created声明周期,为了能在组件使用,故也在created中将方法挂载到$uv
this.$uv.getRect = this.$uvGetRect;
},
computed: {
$uv: function $uv() {
var _uni, _uni$$uv, _uni$$uv$config;
return _objectSpread(_objectSpread({}, index), {}, {
test: test,
route: _route.default,
debounce: _debounce.default,
throttle: _throttle.default,
unit: (_uni = uni) === null || _uni === void 0 ? void 0 : (_uni$$uv = _uni.$uv) === null || _uni$$uv === void 0 ? void 0 : (_uni$$uv$config = _uni$$uv.config) === null || _uni$$uv$config === void 0 ? void 0 : _uni$$uv$config.unit
});
},
/**
* 生成bem规则类名
* 由于微信小程序,H5,nvue之间绑定class的差异,无法通过:class="[bem()]"的形式进行同用
* 故采用如下折中做法,最后返回的是数组(一般平台)或字符串(支付宝和字节跳动平台),类似['a', 'b', 'c']或'a b c'的形式
* @param {String} name 组件名称
* @param {Array} fixed 一直会存在的类名
* @param {Array} change 会根据变量值为true或者false而出现或者隐藏的类名
* @returns {Array|string}
*/
bem: function bem() {
return function (name, fixed, change) {
var _this = this;
// 类名前缀
var prefix = "uv-".concat(name, "--");
var classes = {};
if (fixed) {
fixed.map(function (item) {
// 这里的类名,会一直存在
classes[prefix + _this[item]] = true;
});
}
if (change) {
change.map(function (item) {
// 这里的类名,会根据this[item]的值为true或者false,而进行添加或者移除某一个类
_this[item] ? classes[prefix + item] = _this[item] : delete classes[prefix + item];
});
}
return Object.keys(classes);
// 支付宝,头条小程序无法动态绑定一个数组类名,否则解析出来的结果会带有",",而导致失效
};
}
},
methods: {
// 跳转某一个页面
openPage: function openPage() {
var urlKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'url';
var url = this[urlKey];
if (url) {
// 执行类似uni.navigateTo的方法
uni[this.linkType]({
url: url
});
}
},
// 查询节点信息
// 目前此方法在支付宝小程序中无法获取组件跟接点的尺寸,为支付宝的bug(2020-07-21)
// 解决办法为在组件根部再套一个没有任何作用的view元素
$uvGetRect: function $uvGetRect(selector, all) {
var _this2 = this;
return new Promise(function (resolve) {
uni.createSelectorQuery().in(_this2)[all ? 'selectAll' : 'select'](selector).boundingClientRect(function (rect) {
if (all && Array.isArray(rect) && rect.length) {
resolve(rect);
}
if (!all && rect) {
resolve(rect);
}
}).exec();
});
},
getParentData: function getParentData() {
var _this3 = this;
var parentName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
// 避免在created中去定义parent变量
if (!this.parent) this.parent = {};
// 这里的本质原理是,通过获取父组件实例(也即类似uv-radio的父组件uv-radio-group的this)
// 将父组件this中对应的参数,赋值给本组件(uv-radio的this)的parentData对象中对应的属性
// 之所以需要这么做,是因为所有端中,头条小程序不支持通过this.parent.xxx去监听父组件参数的变化
// 此处并不会自动更新子组件的数据,而是依赖父组件uv-radio-group去监听data的变化,手动调用更新子组件的方法去重新获取
this.parent = this.$uv.$parent.call(this, parentName);
if (this.parent.children) {
// 如果父组件的children不存在本组件的实例,才将本实例添加到父组件的children中
this.parent.children.indexOf(this) === -1 && this.parent.children.push(this);
}
if (this.parent && this.parentData) {
// 历遍parentData中的属性,将parent中的同名属性赋值给parentData
Object.keys(this.parentData).map(function (key) {
_this3.parentData[key] = _this3.parent[key];
});
}
},
// 阻止事件冒泡
preventEvent: function preventEvent(e) {
e && typeof e.stopPropagation === 'function' && e.stopPropagation();
},
// 空操作
noop: function noop(e) {
this.preventEvent(e);
}
},
onReachBottom: function onReachBottom() {
uni.$emit('uvOnReachBottom');
},
beforeDestroy: function beforeDestroy() {
var _this4 = this;
// 判断当前页面是否存在parent和chldren,一般在checkbox和checkbox-group父子联动的场景会有此情况
// 组件销毁时,移除子组件在父组件children数组中的实例,释放资源,避免数据混乱
if (this.parent && test.array(this.parent.children)) {
// 组件销毁时,移除父组件中的children数组中对应的实例
var childrenList = this.parent.children;
childrenList.map(function (child, index) {
// 如果相等,则移除
if (child === _this4) {
childrenList.splice(index, 1);
}
});
}
},
// 兼容vue3
unmounted: function unmounted() {
var _this5 = this;
if (this.parent && test.array(this.parent.children)) {
// 组件销毁时,移除父组件中的children数组中对应的实例
var childrenList = this.parent.children;
childrenList.map(function (child, index) {
// 如果相等,则移除
if (child === _this5) {
childrenList.splice(index, 1);
}
});
}
}
};
exports.default = _default2;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
/***/ }),
/***/ 1604:
/*!*****************************************************************************************!*\
!*** D:/Users/15570887941/Desktop/wdsxh/uni_modules/uv-ui-tools/libs/function/index.js ***!
\*****************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(uni) {
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.$parent = $parent;
exports.addStyle = addStyle;
exports.addUnit = addUnit;
exports.deepClone = deepClone;
exports.deepMerge = deepMerge;
exports.error = error;
exports.formValidate = formValidate;
exports.getDuration = getDuration;
exports.getHistoryPage = getHistoryPage;
exports.getProperty = getProperty;
exports.getPx = getPx;
exports.guid = guid;
exports.os = os;
exports.padZero = padZero;
exports.page = page;
exports.pages = pages;
exports.priceFormat = priceFormat;
exports.queryParams = queryParams;
exports.random = random;
exports.randomArray = randomArray;
exports.range = range;
exports.setConfig = setConfig;
exports.setProperty = setProperty;
exports.sleep = sleep;
exports.sys = sys;
exports.timeFormat = timeFormat;
exports.timeFrom = timeFrom;
exports.toast = toast;
exports.trim = trim;
exports.type2icon = type2icon;
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
var _test = __webpack_require__(/*! ./test.js */ 1605);
var _digit = __webpack_require__(/*! ./digit.js */ 1606);
/**
* @description 如果value小于min,取min;如果value大于max,取max
* @param {number} min
* @param {number} max
* @param {number} value
*/
function range() {
var min = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
return Math.max(min, Math.min(max, Number(value)));
}
/**
* @description 用于获取用户传递值的px值 如果用户传递了"xxpx"或者"xxrpx",取出其数值部分,如果是"xxxrpx"还需要用过uni.upx2px进行转换
* @param {number|string} value 用户传递值的px值
* @param {boolean} unit
* @returns {number|string}
*/
function getPx(value) {
var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if ((0, _test.number)(value)) {
return unit ? "".concat(value, "px") : Number(value);
}
// 如果带有rpx,先取出其数值部分,再转为px值
if (/(rpx|upx)$/.test(value)) {
return unit ? "".concat(uni.upx2px(parseInt(value)), "px") : Number(uni.upx2px(parseInt(value)));
}
return unit ? "".concat(parseInt(value), "px") : parseInt(value);
}
/**
* @description 进行延时,以达到可以简写代码的目的 比如: await uni.$uv.sleep(20)将会阻塞20ms
* @param {number} value 堵塞时间 单位ms 毫秒
* @returns {Promise} 返回promise
*/
function sleep() {
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 30;
return new Promise(function (resolve) {
setTimeout(function () {
resolve();
}, value);
});
}
/**
* @description 运行期判断平台
* @returns {string} 返回所在平台(小写)
* @link 运行期判断平台 https://uniapp.dcloud.io/frame?id=判断平台
*/
function os() {
return uni.getSystemInfoSync().platform.toLowerCase();
}
/**
* @description 获取系统信息同步接口
* @link 获取系统信息同步接口 https://uniapp.dcloud.io/api/system/info?id=getsysteminfosync
*/
function sys() {
return uni.getSystemInfoSync();
}
/**
* @description 取一个区间数
* @param {Number} min 最小值
* @param {Number} max 最大值
*/
function random(min, max) {
if (min >= 0 && max > 0 && max >= min) {
var gab = max - min + 1;
return Math.floor(Math.random() * gab + min);
}
return 0;
}
/**
* @param {Number} len uuid的长度
* @param {Boolean} firstU 将返回的首字母置为"u"
* @param {Nubmer} radix 生成uuid的基数(意味着返回的字符串都是这个基数),2-二进制,8-八进制,10-十进制,16-十六进制
*/
function guid() {
var len = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 32;
var firstU = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var radix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
var uuid = [];
radix = radix || chars.length;
if (len) {
// 如果指定uuid长度,只是取随机的字符,0|x为位运算,能去掉x的小数位,返回整数位
for (var i = 0; i < len; i++) {
uuid[i] = chars[0 | Math.random() * radix];
}
} else {
var r;
// rfc4122标准要求返回的uuid中,某些位为固定的字符
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
uuid[14] = '4';
for (var _i = 0; _i < 36; _i++) {
if (!uuid[_i]) {
r = 0 | Math.random() * 16;
uuid[_i] = chars[_i == 19 ? r & 0x3 | 0x8 : r];
}
}
}
// 移除第一个字符,并用u替代,因为第一个字符为数值时,该guuid不能用作id或者class
if (firstU) {
uuid.shift();
return "u".concat(uuid.join(''));
}
return uuid.join('');
}
/**
* @description 获取父组件的参数,因为支付宝小程序不支持provide/inject的写法
this.$parent在非H5中,可以准确获取到父组件,但是在H5中,需要多次this.$parent.$parent.xxx
这里默认值等于undefined有它的含义,因为最顶层元素(组件)的$parent就是undefined,意味着不传name
值(默认为undefined),就是查找最顶层的$parent
* @param {string|undefined} name 父组件的参数名
*/
function $parent() {
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
var parent = this.$parent;
// 通过while历遍,这里主要是为了H5需要多层解析的问题
while (parent) {
// 父组件
if (parent.$options && parent.$options.name !== name) {
// 如果组件的name不相等,继续上一级寻找
parent = parent.$parent;
} else {
return parent;
}
}
return false;
}
/**
* @description 样式转换
* 对象转字符串,或者字符串转对象
* @param {object | string} customStyle 需要转换的目标
* @param {String} target 转换的目的,object-转为对象,string-转为字符串
* @returns {object|string}
*/
function addStyle(customStyle) {
var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'object';
// 字符串转字符串,对象转对象情形,直接返回
if ((0, _test.empty)(customStyle) || (0, _typeof2.default)(customStyle) === 'object' && target === 'object' || target === 'string' && typeof customStyle === 'string') {
return customStyle;
}
// 字符串转对象
if (target === 'object') {
// 去除字符串样式中的两端空格(中间的空格不能去掉,比如padding: 20px 0如果去掉了就错了),空格是无用的
customStyle = trim(customStyle);
// 根据";"将字符串转为数组形式
var styleArray = customStyle.split(';');
var style = {};
// 历遍数组,拼接成对象
for (var i = 0; i < styleArray.length; i++) {
// 'font-size:20px;color:red;',如此最后字符串有";"的话,会导致styleArray最后一个元素为空字符串,这里需要过滤
if (styleArray[i]) {
var item = styleArray[i].split(':');
style[trim(item[0])] = trim(item[1]);
}
}
return style;
}
// 这里为对象转字符串形式
var string = '';
for (var _i2 in customStyle) {
// 驼峰转为中划线的形式,否则css内联样式,无法识别驼峰样式属性名
var key = _i2.replace(/([A-Z])/g, '-$1').toLowerCase();
string += "".concat(key, ":").concat(customStyle[_i2], ";");
}
// 去除两端空格
return trim(string);
}
/**
* @description 添加单位,如果有rpx,upx,%,px等单位结尾或者值为auto,直接返回,否则加上px单位结尾
* @param {string|number} value 需要添加单位的值
* @param {string} unit 添加的单位名 比如px
*/
function addUnit() {
var _uni, _uni$$uv, _uni$$uv$config, _uni2, _uni2$$uv, _uni2$$uv$config;
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'auto';
var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (_uni = uni) !== null && _uni !== void 0 && (_uni$$uv = _uni.$uv) !== null && _uni$$uv !== void 0 && (_uni$$uv$config = _uni$$uv.config) !== null && _uni$$uv$config !== void 0 && _uni$$uv$config.unit ? (_uni2 = uni) === null || _uni2 === void 0 ? void 0 : (_uni2$$uv = _uni2.$uv) === null || _uni2$$uv === void 0 ? void 0 : (_uni2$$uv$config = _uni2$$uv.config) === null || _uni2$$uv$config === void 0 ? void 0 : _uni2$$uv$config.unit : 'px';
value = String(value);
// 用uvui内置验证规则中的number判断是否为数值
return (0, _test.number)(value) ? "".concat(value).concat(unit) : value;
}
/**
* @description 深度克隆
* @param {object} obj 需要深度克隆的对象
* @param cache 缓存
* @returns {*} 克隆后的对象或者原值(不是对象)
*/
function deepClone(obj) {
var cache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new WeakMap();
if (obj === null || (0, _typeof2.default)(obj) !== 'object') return obj;
if (cache.has(obj)) return cache.get(obj);
var clone;
if (obj instanceof Date) {
clone = new Date(obj.getTime());
} else if (obj instanceof RegExp) {
clone = new RegExp(obj);
} else if (obj instanceof Map) {
clone = new Map(Array.from(obj, function (_ref) {
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
key = _ref2[0],
value = _ref2[1];
return [key, deepClone(value, cache)];
}));
} else if (obj instanceof Set) {
clone = new Set(Array.from(obj, function (value) {
return deepClone(value, cache);
}));
} else if (Array.isArray(obj)) {
clone = obj.map(function (value) {
return deepClone(value, cache);
});
} else if (Object.prototype.toString.call(obj) === '[object Object]') {
clone = Object.create(Object.getPrototypeOf(obj));
cache.set(obj, clone);
for (var _i3 = 0, _Object$entries = Object.entries(obj); _i3 < _Object$entries.length; _i3++) {
var _Object$entries$_i = (0, _slicedToArray2.default)(_Object$entries[_i3], 2),
key = _Object$entries$_i[0],
value = _Object$entries$_i[1];
clone[key] = deepClone(value, cache);
}
} else {
clone = Object.assign({}, obj);
}
cache.set(obj, clone);
return clone;
}
/**
* @description JS对象深度合并
* @param {object} target 需要拷贝的对象
* @param {object} source 拷贝的来源对象
* @returns {object|boolean} 深度合并后的对象或者false(入参有不是对象)
*/
function deepMerge() {
var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
target = deepClone(target);
if ((0, _typeof2.default)(target) !== 'object' || target === null || (0, _typeof2.default)(source) !== 'object' || source === null) return target;
var merged = Array.isArray(target) ? target.slice() : Object.assign({}, target);
for (var prop in source) {
if (!source.hasOwnProperty(prop)) continue;
var sourceValue = source[prop];
var targetValue = merged[prop];
if (sourceValue instanceof Date) {
merged[prop] = new Date(sourceValue);
} else if (sourceValue instanceof RegExp) {
merged[prop] = new RegExp(sourceValue);
} else if (sourceValue instanceof Map) {
merged[prop] = new Map(sourceValue);
} else if (sourceValue instanceof Set) {
merged[prop] = new Set(sourceValue);
} else if ((0, _typeof2.default)(sourceValue) === 'object' && sourceValue !== null) {
merged[prop] = deepMerge(targetValue, sourceValue);
} else {
merged[prop] = sourceValue;
}
}
return merged;
}
/**
* @description error提示
* @param {*} err 错误内容
*/
function error(err) {
// 开发环境才提示,生产环境不会提示
if (true) {
console.error("uvui\u63D0\u793A\uFF1A".concat(err));
}
}
/**
* @description 打乱数组
* @param {array} array 需要打乱的数组
* @returns {array} 打乱后的数组
*/
function randomArray() {
var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
// 原理是sort排序,Math.random()产生0<= x < 1之间的数,会导致x-0.05大于或者小于0
return array.sort(function () {
return Math.random() - 0.5;
});
}
// padStart 的 polyfill,因为某些机型或情况,还无法支持es7的padStart,比如电脑版的微信小程序
// 所以这里做一个兼容polyfill的兼容处理
if (!String.prototype.padStart) {
// 为了方便表示这里 fillString 用了ES6 的默认参数,不影响理解
String.prototype.padStart = function (maxLength) {
var fillString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' ';
if (Object.prototype.toString.call(fillString) !== '[object String]') {
throw new TypeError('fillString must be String');
}
var str = this;
// 返回 String(str) 这里是为了使返回的值是字符串字面量,在控制台中更符合直觉
if (str.length >= maxLength) return String(str);
var fillLength = maxLength - str.length;
var times = Math.ceil(fillLength / fillString.length);
while (times >>= 1) {
fillString += fillString;
if (times === 1) {
fillString += fillString;
}
}
return fillString.slice(0, fillLength) + str;
};
}
/**
* @description 格式化时间
* @param {String|Number} dateTime 需要格式化的时间戳
* @param {String} fmt 格式化规则 yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合 默认yyyy-mm-dd
* @returns {string} 返回格式化后的字符串
*/
function timeFormat() {
var dateTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var formatStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-mm-dd';
var date;
// 若传入时间为假值,则取当前时间
if (!dateTime) {
date = new Date();
}
// 若为unix秒时间戳,则转为毫秒时间戳(逻辑有点奇怪,但不敢改,以保证历史兼容)
else if (/^\d{10}$/.test(dateTime === null || dateTime === void 0 ? void 0 : dateTime.toString().trim())) {
date = new Date(dateTime * 1000);
}
// 若用户传入字符串格式时间戳,new Date无法解析,需做兼容
else if (typeof dateTime === 'string' && /^\d+$/.test(dateTime.trim())) {
date = new Date(Number(dateTime));
}
// 处理平台性差异,在Safari/Webkit中,new Date仅支持/作为分割符的字符串时间
// 处理 '2022-07-10 01:02:03',跳过 '2022-07-10T01:02:03'
else if (typeof dateTime === 'string' && dateTime.includes('-') && !dateTime.includes('T')) {
date = new Date(dateTime.replace(/-/g, '/'));
}
// 其他都认为符合 RFC 2822 规范
else {
date = new Date(dateTime);
}
var timeSource = {
'y': date.getFullYear().toString(),
// 年
'm': (date.getMonth() + 1).toString().padStart(2, '0'),
// 月
'd': date.getDate().toString().padStart(2, '0'),
// 日
'h': date.getHours().toString().padStart(2, '0'),
// 时
'M': date.getMinutes().toString().padStart(2, '0'),
// 分
's': date.getSeconds().toString().padStart(2, '0') // 秒
// 有其他格式化字符需求可以继续添加,必须转化成字符串
};
for (var key in timeSource) {
var _ref3 = new RegExp("".concat(key, "+")).exec(formatStr) || [],
_ref4 = (0, _slicedToArray2.default)(_ref3, 1),
ret = _ref4[0];
if (ret) {
// 年可能只需展示两位
var beginIndex = key === 'y' && ret.length === 2 ? 2 : 0;
formatStr = formatStr.replace(ret, timeSource[key].slice(beginIndex));
}
}
return formatStr;
}
/**
* @description 时间戳转为多久之前
* @param {String|Number} timestamp 时间戳
* @param {String|Boolean} format
* 格式化规则如果为时间格式字符串,超出一定时间范围,返回固定的时间格式;
* 如果为布尔值false,无论什么时间,都返回多久以前的格式
* @returns {string} 转化后的内容
*/
function timeFrom() {
var timestamp = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-mm-dd';
if (timestamp == null) timestamp = Number(new Date());
timestamp = parseInt(timestamp);
// 判断用户输入的时间戳是秒还是毫秒,一般前端js获取的时间戳是毫秒(13位),后端传过来的为秒(10位)
if (timestamp.toString().length == 10) timestamp *= 1000;
var timer = new Date().getTime() - timestamp;
timer = parseInt(timer / 1000);
// 如果小于5分钟,则返回"刚刚",其他以此类推
var tips = '';
switch (true) {
case timer < 300:
tips = '刚刚';
break;
case timer >= 300 && timer < 3600:
tips = "".concat(parseInt(timer / 60), "\u5206\u949F\u524D");
break;
case timer >= 3600 && timer < 86400:
tips = "".concat(parseInt(timer / 3600), "\u5C0F\u65F6\u524D");
break;
case timer >= 86400 && timer < 2592000:
tips = "".concat(parseInt(timer / 86400), "\u5929\u524D");
break;
default:
// 如果format为false,则无论什么时间戳,都显示xx之前
if (format === false) {
if (timer >= 2592000 && timer < 365 * 86400) {
tips = "".concat(parseInt(timer / (86400 * 30)), "\u4E2A\u6708\u524D");
} else {
tips = "".concat(parseInt(timer / (86400 * 365)), "\u5E74\u524D");
}
} else {
tips = timeFormat(timestamp, format);
}
}
return tips;
}
/**
* @description 去除空格
* @param String str 需要去除空格的字符串
* @param String pos both(左右)|left|right|all 默认both
*/
function trim(str) {
var pos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'both';
str = String(str);
if (pos == 'both') {
return str.replace(/^\s+|\s+$/g, '');
}
if (pos == 'left') {
return str.replace(/^\s*/, '');
}
if (pos == 'right') {
return str.replace(/(\s*$)/g, '');
}
if (pos == 'all') {
return str.replace(/\s+/g, '');
}
return str;
}
/**
* @description 对象转url参数
* @param {object} data,对象
* @param {Boolean} isPrefix,是否自动加上"?"
* @param {string} arrayFormat 规则 indices|brackets|repeat|comma
*/
function queryParams() {
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var isPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var arrayFormat = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'brackets';
var prefix = isPrefix ? '?' : '';
var _result = [];
if (['indices', 'brackets', 'repeat', 'comma'].indexOf(arrayFormat) == -1) arrayFormat = 'brackets';
var _loop = function _loop(key) {
var value = data[key];
// 去掉为空的参数
if (['', undefined, null].indexOf(value) >= 0) {
return "continue";
}
// 如果值为数组,另行处理
if (value.constructor === Array) {
// e.g. {ids: [1, 2, 3]}
switch (arrayFormat) {
case 'indices':
// 结果: ids[0]=1&ids[1]=2&ids[2]=3
for (var i = 0; i < value.length; i++) {
_result.push("".concat(key, "[").concat(i, "]=").concat(value[i]));
}
break;
case 'brackets':
// 结果: ids[]=1&ids[]=2&ids[]=3
value.forEach(function (_value) {
_result.push("".concat(key, "[]=").concat(_value));
});
break;
case 'repeat':
// 结果: ids=1&ids=2&ids=3
value.forEach(function (_value) {
_result.push("".concat(key, "=").concat(_value));
});
break;
case 'comma':
// 结果: ids=1,2,3
var commaStr = '';
value.forEach(function (_value) {
commaStr += (commaStr ? ',' : '') + _value;
});
_result.push("".concat(key, "=").concat(commaStr));
break;
default:
value.forEach(function (_value) {
_result.push("".concat(key, "[]=").concat(_value));
});
}
} else {
_result.push("".concat(key, "=").concat(value));
}
};
for (var key in data) {
var _ret = _loop(key);
if (_ret === "continue") continue;
}
return _result.length ? prefix + _result.join('&') : '';
}
/**
* 显示消息提示框
* @param {String} title 提示的内容,长度与 icon 取值有关。
* @param {Number} duration 提示的延迟时间,单位毫秒,默认:2000
*/
function toast(title) {
var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2000;
uni.showToast({
title: String(title),
icon: 'none',
duration: duration
});
}
/**
* @description 根据主题type值,获取对应的图标
* @param {String} type 主题名称,primary|info|error|warning|success
* @param {boolean} fill 是否使用fill填充实体的图标
*/
function type2icon() {
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'success';
var fill = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
// 如果非预置值,默认为success
if (['primary', 'info', 'error', 'warning', 'success'].indexOf(type) == -1) type = 'success';
var iconName = '';
// 目前(2019-12-12),info和primary使用同一个图标
switch (type) {
case 'primary':
iconName = 'info-circle';
break;
case 'info':
iconName = 'info-circle';
break;
case 'error':
iconName = 'close-circle';
break;
case 'warning':
iconName = 'error-circle';
break;
case 'success':
iconName = 'checkmark-circle';
break;
default:
iconName = 'checkmark-circle';
}
// 是否是实体类型,加上-fill,在icon组件库中,实体的类名是后面加-fill的
if (fill) iconName += '-fill';
return iconName;
}
/**
* @description 数字格式化
* @param {number|string} number 要格式化的数字
* @param {number} decimals 保留几位小数
* @param {string} decimalPoint 小数点符号
* @param {string} thousandsSeparator 千分位符号
* @returns {string} 格式化后的数字
*/
function priceFormat(number) {
var decimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var decimalPoint = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.';
var thousandsSeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ',';
number = "".concat(number).replace(/[^0-9+-Ee.]/g, '');
var n = !isFinite(+number) ? 0 : +number;
var prec = !isFinite(+decimals) ? 0 : Math.abs(decimals);
var sep = typeof thousandsSeparator === 'undefined' ? ',' : thousandsSeparator;
var dec = typeof decimalPoint === 'undefined' ? '.' : decimalPoint;
var s = '';
s = (prec ? (0, _digit.round)(n, prec) + '' : "".concat(Math.round(n))).split('.');
var re = /(-?\d+)(\d{3})/;
while (re.test(s[0])) {
s[0] = s[0].replace(re, "$1".concat(sep, "$2"));
}
if ((s[1] || '').length < prec) {
s[1] = s[1] || '';
s[1] += new Array(prec - s[1].length + 1).join('0');
}
return s.join(dec);
}
/**
* @description 获取duration值
* 如果带有ms或者s直接返回,如果大于一定值,认为是ms单位,小于一定值,认为是s单位
* 比如以30位阈值,那么300大于30,可以理解为用户想要的是300ms,而不是想花300s去执行一个动画
* @param {String|number} value 比如: "1s"|"100ms"|1|100
* @param {boolean} unit 提示: 如果是false 默认返回number
* @return {string|number}
*/
function getDuration(value) {
var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var valueNum = parseInt(value);
if (unit) {
if (/s$/.test(value)) return value;
return value > 30 ? "".concat(value, "ms") : "".concat(value, "s");
}
if (/ms$/.test(value)) return valueNum;
if (/s$/.test(value)) return valueNum > 30 ? valueNum : valueNum * 1000;
return valueNum;
}
/**
* @description 日期的月或日补零操作
* @param {String} value 需要补零的值
*/
function padZero(value) {
return "00".concat(value).slice(-2);
}
/**
* @description 在uv-form的子组件内容发生变化,或者失去焦点时,尝试通知uv-form执行校验方法
* @param {*} instance
* @param {*} event
*/
function formValidate(instance, event) {
var formItem = $parent.call(instance, 'uv-form-item');
var form = $parent.call(instance, 'uv-form');
// 如果发生变化的input或者textarea等,其父组件中有uv-form-item或者uv-form等,就执行form的validate方法
// 同时将form-item的pros传递给form,让其进行精确对象验证
if (formItem && form) {
form.validateField(formItem.prop, function () {}, event);
}
}
/**
* @description 获取某个对象下的属性,用于通过类似'a.b.c'的形式去获取一个对象的的属性的形式
* @param {object} obj 对象
* @param {string} key 需要获取的属性字段
* @returns {*}
*/
function getProperty(obj, key) {
if (!obj) {
return;
}
if (typeof key !== 'string' || key === '') {
return '';
}
if (key.indexOf('.') !== -1) {
var keys = key.split('.');
var firstObj = obj[keys[0]] || {};
for (var i = 1; i < keys.length; i++) {
if (firstObj) {
firstObj = firstObj[keys[i]];
}
}
return firstObj;
}
return obj[key];
}
/**
* @description 设置对象的属性值,如果'a.b.c'的形式进行设置
* @param {object} obj 对象
* @param {string} key 需要设置的属性
* @param {string} value 设置的值
*/
function setProperty(obj, key, value) {
if (!obj) {
return;
}
// 递归赋值
var inFn = function inFn(_obj, keys, v) {
// 最后一个属性key
if (keys.length === 1) {
_obj[keys[0]] = v;
return;
}
// 0~length-1个key
while (keys.length > 1) {
var k = keys[0];
if (!_obj[k] || (0, _typeof2.default)(_obj[k]) !== 'object') {
_obj[k] = {};
}
var _key = keys.shift();
// 自调用判断是否存在属性,不存在则自动创建对象
inFn(_obj[k], keys, v);
}
};
if (typeof key !== 'string' || key === '') {} else if (key.indexOf('.') !== -1) {
// 支持多层级赋值操作
var keys = key.split('.');
inFn(obj, keys, value);
} else {
obj[key] = value;
}
}
/**
* @description 获取当前页面路径
*/
function page() {
var _pages;
var pages = getCurrentPages();
var route = (_pages = pages[pages.length - 1]) === null || _pages === void 0 ? void 0 : _pages.route;
// 某些特殊情况下(比如页面进行redirectTo时的一些时机),pages可能为空数组
return "/".concat(route ? route : '');
}
/**
* @description 获取当前路由栈实例数组
*/
function pages() {
var pages = getCurrentPages();
return pages;
}
/**
* 获取页面历史栈指定层实例
* @param back {number} [0] - 0或者负数,表示获取历史栈的哪一层,0表示获取当前页面实例,-1 表示获取上一个页面实例。默认0。
*/
function getHistoryPage() {
var back = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var pages = getCurrentPages();
var len = pages.length;
return pages[len - 1 + back];
}
/**
* @description 修改uvui内置属性值
* @param {object} props 修改内置props属性
* @param {object} config 修改内置config属性
* @param {object} color 修改内置color属性
* @param {object} zIndex 修改内置zIndex属性
*/
function setConfig(_ref5) {
var _ref5$props = _ref5.props,
props = _ref5$props === void 0 ? {} : _ref5$props,
_ref5$config = _ref5.config,
config = _ref5$config === void 0 ? {} : _ref5$config,
_ref5$color = _ref5.color,
color = _ref5$color === void 0 ? {} : _ref5$color,
_ref5$zIndex = _ref5.zIndex,
zIndex = _ref5$zIndex === void 0 ? {} : _ref5$zIndex;
var deepMerge = uni.$uv.deepMerge;
uni.$uv.config = deepMerge(uni.$uv.config, config);
uni.$uv.props = deepMerge(uni.$uv.props, props);
uni.$uv.color = deepMerge(uni.$uv.color, color);
uni.$uv.zIndex = deepMerge(uni.$uv.zIndex, zIndex);
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
/***/ }),
/***/ 1605:
/*!****************************************************************************************!*\
!*** D:/Users/15570887941/Desktop/wdsxh/uni_modules/uv-ui-tools/libs/function/test.js ***!
\****************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.amount = amount;
exports.array = array;
exports.carNo = carNo;
exports.chinese = chinese;
exports.code = code;
exports.contains = contains;
exports.date = date;
exports.dateISO = dateISO;
exports.digits = digits;
exports.email = email;
exports.empty = empty;
exports.enOrNum = enOrNum;
exports.func = func;
exports.idCard = idCard;
exports.image = image;
exports.jsonString = jsonString;
exports.landline = landline;
exports.letter = letter;
exports.mobile = mobile;
exports.number = number;
exports.object = object;
exports.promise = promise;
exports.range = range;
exports.rangeLength = rangeLength;
exports.regExp = regExp;
exports.string = string;
exports.url = url;
exports.video = video;
var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
/**
* 验证电子邮箱格式
*/
function email(value) {
return /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(value);
}
/**
* 验证手机格式
*/
function mobile(value) {
return /^1([3589]\d|4[5-9]|6[1-2,4-7]|7[0-8])\d{8}$/.test(value);
}
/**
* 验证URL格式
*/
function url(value) {
return /^((https|http|ftp|rtsp|mms):\/\/)(([0-9a-zA-Z_!~*'().&=+$%-]+: )?[0-9a-zA-Z_!~*'().&=+$%-]+@)?(([0-9]{1,3}.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z].[a-zA-Z]{2,6})(:[0-9]{1,4})?((\/?)|(\/[0-9a-zA-Z_!~*'().;?:@&=+$,%#-]+)+\/?)$/.test(value);
}
/**
* 验证日期格式
*/
function date(value) {
if (!value) return false;
// 判断是否数值或者字符串数值(意味着为时间戳),转为数值,否则new Date无法识别字符串时间戳
if (number(value)) value = +value;
return !/Invalid|NaN/.test(new Date(value).toString());
}
/**
* 验证ISO类型的日期格式
*/
function dateISO(value) {
return /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(value);
}
/**
* 验证十进制数字
*/
function number(value) {
return /^[\+-]?(\d+\.?\d*|\.\d+|\d\.\d+e\+\d+)$/.test(value);
}
/**
* 验证字符串
*/
function string(value) {
return typeof value === 'string';
}
/**
* 验证整数
*/
function digits(value) {
return /^\d+$/.test(value);
}
/**
* 验证身份证号码
*/
function idCard(value) {
return /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(value);
}
/**
* 是否车牌号
*/
function carNo(value) {
// 新能源车牌
var xreg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;
// 旧车牌
var creg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
if (value.length === 7) {
return creg.test(value);
}
if (value.length === 8) {
return xreg.test(value);
}
return false;
}
/**
* 金额,只允许2位小数
*/
function amount(value) {
// 金额,只允许保留两位小数
return /^[1-9]\d*(,\d{3})*(\.\d{1,2})?$|^0\.\d{1,2}$/.test(value);
}
/**
* 中文
*/
function chinese(value) {
var reg = /^[\u4e00-\u9fa5]+$/gi;
return reg.test(value);
}
/**
* 只能输入字母
*/
function letter(value) {
return /^[a-zA-Z]*$/.test(value);
}
/**
* 只能是字母或者数字
*/
function enOrNum(value) {
// 英文或者数字
var reg = /^[0-9a-zA-Z]*$/g;
return reg.test(value);
}
/**
* 验证是否包含某个值
*/
function contains(value, param) {
return value.indexOf(param) >= 0;
}
/**
* 验证一个值范围[min, max]
*/
function range(value, param) {
return value >= param[0] && value <= param[1];
}
/**
* 验证一个长度范围[min, max]
*/
function rangeLength(value, param) {
return value.length >= param[0] && value.length <= param[1];
}
/**
* 是否固定电话
*/
function landline(value) {
var reg = /^\d{3,4}-\d{7,8}(-\d{3,4})?$/;
return reg.test(value);
}
/**
* 判断是否为空
*/
function empty(value) {
switch ((0, _typeof2.default)(value)) {
case 'undefined':
return true;
case 'string':
if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
break;
case 'boolean':
if (!value) return true;
break;
case 'number':
if (value === 0 || isNaN(value)) return true;
break;
case 'object':
if (value === null || value.length === 0) return true;
for (var i in value) {
return false;
}
return true;
}
return false;
}
/**
* 是否json字符串
*/
function jsonString(value) {
if (typeof value === 'string') {
try {
var obj = JSON.parse(value);
if ((0, _typeof2.default)(obj) === 'object' && obj) {
return true;
}
return false;
} catch (e) {
return false;
}
}
return false;
}
/**
* 是否数组
*/
function array(value) {
if (typeof Array.isArray === 'function') {
return Array.isArray(value);
}
return Object.prototype.toString.call(value) === '[object Array]';
}
/**
* 是否对象
*/
function object(value) {
return Object.prototype.toString.call(value) === '[object Object]';
}
/**
* 是否短信验证码
*/
function code(value) {
var len = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6;
return new RegExp("^\\d{".concat(len, "}$")).test(value);
}
/**
* 是否函数方法
* @param {Object} value
*/
function func(value) {
return typeof value === 'function';
}
/**
* 是否promise对象
* @param {Object} value
*/
function promise(value) {
return object(value) && func(value.then) && func(value.catch);
}
/** 是否图片格式
* @param {Object} value
*/
function image(value) {
var newValue = value.split('?')[0];
var IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
return IMAGE_REGEXP.test(newValue);
}
/**
* 是否视频格式
* @param {Object} value
*/
function video(value) {
var VIDEO_REGEXP = /\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv|m3u8)/i;
return VIDEO_REGEXP.test(value);
}
/**
* 是否为正则对象
* @param {Object}
* @return {Boolean}
*/
function regExp(o) {
return o && Object.prototype.toString.call(o) === '[object RegExp]';
}
/***/ }),
/***/ 1606:
/*!*****************************************************************************************!*\
!*** D:/Users/15570887941/Desktop/wdsxh/uni_modules/uv-ui-tools/libs/function/digit.js ***!
\*****************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
exports.divide = divide;
exports.enableBoundaryChecking = enableBoundaryChecking;
exports.minus = minus;
exports.plus = plus;
exports.round = round;
exports.times = times;
var _toArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toArray */ 1607));
var _boundaryCheckingState = true; // 是否进行越界检查的全局开关
/**
* 把错误的数据转正
* @private
* @example strip(0.09999999999999998)=0.1
*/
function strip(num) {
var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 15;
return +parseFloat(Number(num).toPrecision(precision));
}
/**
* Return digits length of a number
* @private
* @param {*number} num Input number
*/
function digitLength(num) {
// Get digit length of e
var eSplit = num.toString().split(/[eE]/);
var len = (eSplit[0].split('.')[1] || '').length - +(eSplit[1] || 0);
return len > 0 ? len : 0;
}
/**
* 把小数转成整数,如果是小数则放大成整数
* @private
* @param {*number} num 输入数
*/
function float2Fixed(num) {
if (num.toString().indexOf('e') === -1) {
return Number(num.toString().replace('.', ''));
}
var dLen = digitLength(num);
return dLen > 0 ? strip(Number(num) * Math.pow(10, dLen)) : Number(num);
}
/**
* 检测数字是否越界,如果越界给出提示
* @private
* @param {*number} num 输入数
*/
function checkBoundary(num) {
if (_boundaryCheckingState) {
if (num > Number.MAX_SAFE_INTEGER || num < Number.MIN_SAFE_INTEGER) {
console.warn("".concat(num, " \u8D85\u51FA\u4E86\u7CBE\u5EA6\u9650\u5236\uFF0C\u7ED3\u679C\u53EF\u80FD\u4E0D\u6B63\u786E"));
}
}
}
/**
* 把递归操作扁平迭代化
* @param {number[]} arr 要操作的数字数组
* @param {function} operation 迭代操作
* @private
*/
function iteratorOperation(arr, operation) {
var _arr = (0, _toArray2.default)(arr),
num1 = _arr[0],
num2 = _arr[1],
others = _arr.slice(2);
var res = operation(num1, num2);
others.forEach(function (num) {
res = operation(res, num);
});
return res;
}
/**
* 高精度乘法
* @export
*/
function times() {
for (var _len = arguments.length, nums = new Array(_len), _key = 0; _key < _len; _key++) {
nums[_key] = arguments[_key];
}
if (nums.length > 2) {
return iteratorOperation(nums, times);
}
var num1 = nums[0],
num2 = nums[1];
var num1Changed = float2Fixed(num1);
var num2Changed = float2Fixed(num2);
var baseNum = digitLength(num1) + digitLength(num2);
var leftValue = num1Changed * num2Changed;
checkBoundary(leftValue);
return leftValue / Math.pow(10, baseNum);
}
/**
* 高精度加法
* @export
*/
function plus() {
for (var _len2 = arguments.length, nums = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
nums[_key2] = arguments[_key2];
}
if (nums.length > 2) {
return iteratorOperation(nums, plus);
}
var num1 = nums[0],
num2 = nums[1];
// 取最大的小数位
var baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2)));
// 把小数都转为整数然后再计算
return (times(num1, baseNum) + times(num2, baseNum)) / baseNum;
}
/**
* 高精度减法
* @export
*/
function minus() {
for (var _len3 = arguments.length, nums = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
nums[_key3] = arguments[_key3];
}
if (nums.length > 2) {
return iteratorOperation(nums, minus);
}
var num1 = nums[0],
num2 = nums[1];
var baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2)));
return (times(num1, baseNum) - times(num2, baseNum)) / baseNum;
}
/**
* 高精度除法
* @export
*/
function divide() {
for (var _len4 = arguments.length, nums = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
nums[_key4] = arguments[_key4];
}
if (nums.length > 2) {
return iteratorOperation(nums, divide);
}
var num1 = nums[0],
num2 = nums[1];
var num1Changed = float2Fixed(num1);
var num2Changed = float2Fixed(num2);
checkBoundary(num1Changed);
checkBoundary(num2Changed);
// 重要,这里必须用strip进行修正
return times(num1Changed / num2Changed, strip(Math.pow(10, digitLength(num2) - digitLength(num1))));
}
/**
* 四舍五入
* @export
*/
function round(num, ratio) {
var base = Math.pow(10, ratio);
var result = divide(Math.round(Math.abs(times(num, base))), base);
if (num < 0 && result !== 0) {
result = times(result, -1);
}
// 位数不足则补0
return result;
}
/**
* 是否进行边界检查,默认开启
* @param flag 标记开关,true 为开启,false 为关闭,默认为 true
* @export
*/
function enableBoundaryChecking() {
var flag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
_boundaryCheckingState = flag;
}
var _default = {
times: times,
plus: plus,
minus: minus,
divide: divide,
round: round,
enableBoundaryChecking: enableBoundaryChecking
};
exports.default = _default;
/***/ }),
/***/ 1607:
/*!********************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/toArray.js ***!
\********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles.js */ 6);
var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ 20);
var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 8);
var nonIterableRest = __webpack_require__(/*! ./nonIterableRest.js */ 10);
function _toArray(arr) {
return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest();
}
module.exports = _toArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 1608:
/*!*************************************************************************************!*\
!*** D:/Users/15570887941/Desktop/wdsxh/uni_modules/uv-ui-tools/libs/util/route.js ***!
\*************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(uni) {
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 39));
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 41));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
var _index = __webpack_require__(/*! @/uni_modules/uv-ui-tools/libs/function/index.js */ 1604);
/**
* 路由跳转方法,该方法相对于直接使用uni.xxx的好处是使用更加简单快捷
* 并且带有路由拦截功能
*/
var Router = /*#__PURE__*/function () {
function Router() {
(0, _classCallCheck2.default)(this, Router);
// 原始属性定义
this.config = {
type: 'navigateTo',
url: '',
delta: 1,
// navigateBack页面后退时,回退的层数
params: {},
// 传递的参数
animationType: 'pop-in',
// 窗口动画,只在APP有效
animationDuration: 300,
// 窗口动画持续时间,单位毫秒,只在APP有效
intercept: false,
// 是否需要拦截
events: {} // 页面间通信接口,用于监听被打开页面发送到当前页面的数据。hbuilderx 2.8.9+ 开始支持。
};
// 因为route方法是需要对外赋值给另外的对象使用,同时route内部有使用this,会导致route失去上下文
// 这里在构造函数中进行this绑定
this.route = this.route.bind(this);
}
// 判断url前面是否有"/",如果没有则加上,否则无法跳转
(0, _createClass2.default)(Router, [{
key: "addRootPath",
value: function addRootPath(url) {
return url[0] === '/' ? url : "/".concat(url);
}
// 整合路由参数
}, {
key: "mixinParam",
value: function mixinParam(url, params) {
url = url && this.addRootPath(url);
// 使用正则匹配,主要依据是判断是否有"/","?","="等,如“/page/index/index?name=mary"
// 如果有url中有get参数,转换后无需带上"?"
var query = '';
if (/.*\/.*\?.*=.*/.test(url)) {
// object对象转为get类型的参数
query = (0, _index.queryParams)(params, false);
// 因为已有get参数,所以后面拼接的参数需要带上"&"隔开
return url += "&".concat(query);
}
// 直接拼接参数,因为此处url中没有后面的query参数,也就没有"?/&"之类的符号
query = (0, _index.queryParams)(params);
return url += query;
}
// 对外的方法名称
}, {
key: "route",
value: function () {
var _route = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
var options,
params,
mergeConfig,
isNext,
_args = arguments;
return _regenerator.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
params = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
// 合并用户的配置和内部的默认配置
mergeConfig = {};
if (typeof options === 'string') {
// 如果options为字符串,则为route(url, params)的形式
mergeConfig.url = this.mixinParam(options, params);
mergeConfig.type = 'navigateTo';
} else {
mergeConfig = (0, _index.deepMerge)(this.config, options);
// 否则正常使用mergeConfig中的url和params进行拼接
mergeConfig.url = this.mixinParam(options.url, options.params);
}
// 如果本次跳转的路径和本页面路径一致,不执行跳转,防止用户快速点击跳转按钮,造成多次跳转同一个页面的问题
if (!(mergeConfig.url === (0, _index.page)())) {
_context.next = 6;
break;
}
return _context.abrupt("return");
case 6:
if (params.intercept) {
mergeConfig.intercept = params.intercept;
}
// params参数也带给拦截器
mergeConfig.params = params;
// 合并内外部参数
mergeConfig = (0, _index.deepMerge)(this.config, mergeConfig);
// 判断用户是否定义了拦截器
if (!(typeof mergeConfig.intercept === 'function')) {
_context.next = 16;
break;
}
_context.next = 12;
return new Promise(function (resolve, reject) {
mergeConfig.intercept(mergeConfig, resolve);
});
case 12:
isNext = _context.sent;
// 如果isNext为true,则执行路由跳转
isNext && this.openPage(mergeConfig);
_context.next = 17;
break;
case 16:
this.openPage(mergeConfig);
case 17:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
function route() {
return _route.apply(this, arguments);
}
return route;
}() // 执行路由跳转
}, {
key: "openPage",
value: function openPage(config) {
// 解构参数
var url = config.url,
type = config.type,
delta = config.delta,
animationType = config.animationType,
animationDuration = config.animationDuration,
events = config.events;
if (config.type == 'navigateTo' || config.type == 'to') {
uni.navigateTo({
url: url,
animationType: animationType,
animationDuration: animationDuration,
events: events
});
}
if (config.type == 'redirectTo' || config.type == 'redirect') {
uni.redirectTo({
url: url
});
}
if (config.type == 'switchTab' || config.type == 'tab') {
uni.switchTab({
url: url
});
}
if (config.type == 'reLaunch' || config.type == 'launch') {
uni.reLaunch({
url: url
});
}
if (config.type == 'navigateBack' || config.type == 'back') {
uni.navigateBack({
delta: delta
});
}
}
}]);
return Router;
}();
var _default = new Router().route;
exports.default = _default;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
/***/ }),
/***/ 1609:
/*!********************************************************************************************!*\
!*** D:/Users/15570887941/Desktop/wdsxh/uni_modules/uv-ui-tools/libs/function/debounce.js ***!
\********************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var timeout = null;
/**
* 防抖原理:一定时间内,只有最后一次操作,再过wait毫秒后才执行函数
*
* @param {Function} func 要执行的回调函数
* @param {Number} wait 延时的时间
* @param {Boolean} immediate 是否立即执行
* @return null
*/
function debounce(func) {
var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
// 清除定时器
if (timeout !== null) clearTimeout(timeout);
// 立即执行,此类情况一般用不到
if (immediate) {
var callNow = !timeout;
timeout = setTimeout(function () {
timeout = null;
}, wait);
if (callNow) typeof func === 'function' && func();
} else {
// 设置定时器,当最后一次操作后,timeout不会再被清除,所以在延时wait毫秒后执行func回调方法
timeout = setTimeout(function () {
typeof func === 'function' && func();
}, wait);
}
}
var _default = debounce;
exports.default = _default;
/***/ }),
/***/ 1610:
/*!********************************************************************************************!*\
!*** D:/Users/15570887941/Desktop/wdsxh/uni_modules/uv-ui-tools/libs/function/throttle.js ***!
\********************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var timer;
var flag;
/**
* 节流原理:在一定时间内,只能触发一次
*
* @param {Function} func 要执行的回调函数
* @param {Number} wait 延时的时间
* @param {Boolean} immediate 是否立即执行
* @return null
*/
function throttle(func) {
var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
if (immediate) {
if (!flag) {
flag = true;
// 如果是立即执行,则在wait毫秒内开始时执行
typeof func === 'function' && func();
timer = setTimeout(function () {
flag = false;
}, wait);
}
} else if (!flag) {
flag = true;
// 如果是非立即执行,则在wait毫秒内的结束处执行
timer = setTimeout(function () {
flag = false;
typeof func === 'function' && func();
}, wait);
}
}
var _default = throttle;
exports.default = _default;
/***/ }),
/***/ 1611:
/*!****************************************************************************************************!*\
!*** D:/Users/15570887941/Desktop/wdsxh/uni_modules/uv-waterfall/components/uv-waterfall/props.js ***!
\****************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(uni) {
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
var _uni$$uv, _uni$$uv$props;
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var _default2 = {
props: _objectSpread({
// 瀑布流数据
value: {
type: Array,
default: function _default() {
return [];
}
},
// 数据的id值,根据id值对数据执行删除操作
// 如数据为:{id: 1, name: 'uv-ui'},那么该值设置为id
idKey: {
type: String,
default: 'id'
},
// 每次插入数据的事件间隔,间隔越长能保证两列高度相近,但是用户体验不好,单位ms
addTime: {
type: Number,
default: 200
},
// 瀑布流的列数,默认2,最高为5
columnCount: {
type: [Number, String],
default: 2
},
// 列与列的间隙,默认20
columnGap: {
type: [Number, String],
default: 20
},
// 左边和列表的间隙
leftGap: {
type: [Number, String],
default: 0
},
// 右边和列表的间隙
rightGap: {
type: [Number, String],
default: 0
},
// 是否显示滚动条,仅nvue生效
showScrollbar: {
type: [Boolean],
default: false
},
// 列宽,nvue生效
columnWidth: {
type: [Number, String],
default: 'auto'
},
// 瀑布流的宽度,nvue生效
width: {
type: [Number, String],
default: ''
},
// 瀑布流的高度,nvue生效
height: {
type: [Number, String],
default: ''
}
}, (_uni$$uv = uni.$uv) === null || _uni$$uv === void 0 ? void 0 : (_uni$$uv$props = _uni$$uv.props) === null || _uni$$uv$props === void 0 ? void 0 : _uni$$uv$props.waterfall)
};
exports.default = _default2;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
/***/ }),
/***/ 1619:
/*!******************************************************************************************************************!*\
!*** D:/Users/15570887941/Desktop/wdsxh/uni_modules/uni-transition/components/uni-transition/createAnimation.js ***!
\******************************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(uni) {
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAnimation = createAnimation;
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
// const defaultOption = {
// duration: 300,
// timingFunction: 'linear',
// delay: 0,
// transformOrigin: '50% 50% 0'
// }
var MPAnimation = /*#__PURE__*/function () {
function MPAnimation(options, _this) {
(0, _classCallCheck2.default)(this, MPAnimation);
this.options = options;
// 在iOS10+QQ小程序平台下,传给原生的对象一定是个普通对象而不是Proxy对象,否则会报parameter should be Object instead of ProxyObject的错误
this.animation = uni.createAnimation(_objectSpread({}, options));
this.currentStepAnimates = {};
this.next = 0;
this.$ = _this;
}
(0, _createClass2.default)(MPAnimation, [{
key: "_nvuePushAnimates",
value: function _nvuePushAnimates(type, args) {
var aniObj = this.currentStepAnimates[this.next];
var styles = {};
if (!aniObj) {
styles = {
styles: {},
config: {}
};
} else {
styles = aniObj;
}
if (animateTypes1.includes(type)) {
if (!styles.styles.transform) {
styles.styles.transform = '';
}
var unit = '';
if (type === 'rotate') {
unit = 'deg';
}
styles.styles.transform += "".concat(type, "(").concat(args + unit, ") ");
} else {
styles.styles[type] = "".concat(args);
}
this.currentStepAnimates[this.next] = styles;
}
}, {
key: "_animateRun",
value: function _animateRun() {
var styles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var ref = this.$.$refs['ani'].ref;
if (!ref) return;
return new Promise(function (resolve, reject) {
nvueAnimation.transition(ref, _objectSpread({
styles: styles
}, config), function (res) {
resolve();
});
});
}
}, {
key: "_nvueNextAnimate",
value: function _nvueNextAnimate(animates) {
var _this2 = this;
var step = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var fn = arguments.length > 2 ? arguments[2] : undefined;
var obj = animates[step];
if (obj) {
var styles = obj.styles,
config = obj.config;
this._animateRun(styles, config).then(function () {
step += 1;
_this2._nvueNextAnimate(animates, step, fn);
});
} else {
this.currentStepAnimates = {};
typeof fn === 'function' && fn();
this.isEnd = true;
}
}
}, {
key: "step",
value: function step() {
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
this.animation.step(config);
return this;
}
}, {
key: "run",
value: function run(fn) {
this.$.animationData = this.animation.export();
this.$.timer = setTimeout(function () {
typeof fn === 'function' && fn();
}, this.$.durationTime);
}
}]);
return MPAnimation;
}();
var animateTypes1 = ['matrix', 'matrix3d', 'rotate', 'rotate3d', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scale3d', 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'translate', 'translate3d', 'translateX', 'translateY', 'translateZ'];
var animateTypes2 = ['opacity', 'backgroundColor'];
var animateTypes3 = ['width', 'height', 'left', 'right', 'top', 'bottom'];
animateTypes1.concat(animateTypes2, animateTypes3).forEach(function (type) {
MPAnimation.prototype[type] = function () {
var _this$animation;
(_this$animation = this.animation)[type].apply(_this$animation, arguments);
return this;
};
});
function createAnimation(option, _this) {
if (!_this) return;
clearTimeout(_this.timer);
return new MPAnimation(option, _this);
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
/***/ }),
/***/ 1625:
/*!***********************************************************************************************!*\
!*** D:/Users/15570887941/Desktop/wdsxh/uni_modules/Sansnn-uQRCode/js_sdk/uqrcode/uqrcode.js ***!
\***********************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = b;
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 39));
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 41));
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
//---------------------------------------------------------------------
// uQRCode二维码生成插件 v4.0.6
//
// uQRCode是一款基于Javascript环境开发的二维码生成插件,适用所有Javascript运行环境的前端应用和Node.js。
//
// Copyright (c) Sansnn uQRCode All rights reserved.
//
// Licensed under the Apache License, Version 2.0.
// http://www.apache.org/licenses/LICENSE-2.0
//
// github地址:
// https://github.com/Sansnn/uQRCode
//
// npm地址:
// https://www.npmjs.com/package/uqrcodejs
//
// uni-app插件市场地址:
// https://ext.dcloud.net.cn/plugin?id=1287
//
// 复制使用请保留本段注释,感谢支持开源!
//
//---------------------------------------------------------------------
//---------------------------------------------------------------------
// 当前文件格式为 es,将 bundle 保留为 ES 模块文件,适用于其他打包工具以及支持