first commit

This commit is contained in:
PC-202306242200\Administrator
2026-03-28 23:09:02 +08:00
commit dac42e3b0c
3512 changed files with 181637 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
/* 根节点样式 */
._root {
padding: 1px 0;
overflow-x: auto;
overflow-y: hidden;
-webkit-overflow-scrolling: touch;
}
/* 长按复制 */
._select {
-webkit-user-select: text;
user-select: text;
}

View File

@@ -0,0 +1 @@
<view id="_root" class="{{c}}" style="{{d}}"><slot a:if="{{a}}"/><node a:else u-i="44f124fd-0" onVI="__l" u-p="{{b||''}}"/></view>

View File

@@ -0,0 +1,267 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const uni_modules_mpHtml_components_mpHtml_parser = require("./parser.js");
const node = () => "./node/node.js";
const plugins = [];
const _sfc_main = {
name: "mp-html",
data() {
return {
nodes: []
};
},
props: {
containerStyle: {
type: String,
default: ""
},
content: {
type: String,
default: ""
},
copyLink: {
type: [Boolean, String],
default: true
},
domain: String,
errorImg: {
type: String,
default: ""
},
lazyLoad: {
type: [Boolean, String],
default: false
},
loadingImg: {
type: String,
default: ""
},
pauseVideo: {
type: [Boolean, String],
default: true
},
previewImg: {
type: [Boolean, String],
default: true
},
scrollTable: [Boolean, String],
selectable: [Boolean, String],
setTitle: {
type: [Boolean, String],
default: true
},
showImgMenu: {
type: [Boolean, String],
default: true
},
tagStyle: Object,
useAnchor: [Boolean, Number]
},
emits: ["load", "ready", "imgtap", "linktap", "play", "error"],
components: {
node
},
watch: {
content(content) {
this.setContent(content);
}
},
created() {
this.plugins = [];
for (let i = plugins.length; i--; ) {
this.plugins.push(new plugins[i](this));
}
},
mounted() {
if (this.content && !this.nodes.length) {
this.setContent(this.content);
}
},
beforeDestroy() {
this._hook("onDetached");
},
methods: {
/**
* @description 将锚点跳转的范围限定在一个 scroll-view 内
* @param {Object} page scroll-view 所在页面的示例
* @param {String} selector scroll-view 的选择器
* @param {String} scrollTop scroll-view scroll-top 属性绑定的变量名
*/
in(page, selector, scrollTop) {
if (page && selector && scrollTop) {
this._in = {
page,
selector,
scrollTop
};
}
},
/**
* @description 锚点跳转
* @param {String} id 要跳转的锚点 id
* @param {Number} offset 跳转位置的偏移量
* @returns {Promise}
*/
navigateTo(id, offset) {
return new Promise((resolve, reject) => {
if (!this.useAnchor) {
reject(Error("Anchor is disabled"));
return;
}
offset = offset || parseInt(this.useAnchor) || 0;
let deep = " ";
const selector = common_vendor.index.createSelectorQuery().select((this._in ? this._in.selector : "._root") + (id ? `${deep}#${id}` : "")).boundingClientRect();
if (this._in) {
selector.select(this._in.selector).scrollOffset().select(this._in.selector).boundingClientRect();
} else {
selector.selectViewport().scrollOffset();
}
selector.exec((res) => {
if (!res[0]) {
reject(Error("Label not found"));
return;
}
const scrollTop = res[1].scrollTop + res[0].top - (res[2] ? res[2].top : 0) + offset;
if (this._in) {
this._in.page[this._in.scrollTop] = scrollTop;
} else {
common_vendor.index.pageScrollTo({
scrollTop,
duration: 300
});
}
resolve();
});
});
},
/**
* @description 获取文本内容
* @return {String}
*/
getText(nodes) {
let text = "";
(function traversal(nodes2) {
for (let i = 0; i < nodes2.length; i++) {
const node2 = nodes2[i];
if (node2.type === "text") {
text += node2.text.replace(/&amp;/g, "&");
} else if (node2.name === "br") {
text += "\n";
} else {
const isBlock = node2.name === "p" || node2.name === "div" || node2.name === "tr" || node2.name === "li" || node2.name[0] === "h" && node2.name[1] > "0" && node2.name[1] < "7";
if (isBlock && text && text[text.length - 1] !== "\n") {
text += "\n";
}
if (node2.children) {
traversal(node2.children);
}
if (isBlock && text[text.length - 1] !== "\n") {
text += "\n";
} else if (node2.name === "td" || node2.name === "th") {
text += " ";
}
}
}
})(nodes || this.nodes);
return text;
},
/**
* @description 获取内容大小和位置
* @return {Promise}
*/
getRect() {
return new Promise((resolve, reject) => {
common_vendor.index.createSelectorQuery().select("#_root").boundingClientRect().exec((res) => res[0] ? resolve(res[0]) : reject(Error("Root label not found")));
});
},
/**
* @description 暂停播放媒体
*/
pauseMedia() {
for (let i = (this._videos || []).length; i--; ) {
this._videos[i].pause();
}
},
/**
* @description 设置媒体播放速率
* @param {Number} rate 播放速率
*/
setPlaybackRate(rate) {
this.playbackRate = rate;
for (let i = (this._videos || []).length; i--; ) {
this._videos[i].playbackRate(rate);
}
},
/**
* @description 设置内容
* @param {String} content html 内容
* @param {Boolean} append 是否在尾部追加
*/
setContent(content, append) {
if (!append || !this.imgList) {
this.imgList = [];
}
const nodes = new uni_modules_mpHtml_components_mpHtml_parser.Parser(this).parse(content);
this.$set(this, "nodes", append ? (this.nodes || []).concat(nodes) : nodes);
this._videos = [];
this.$nextTick(() => {
this._hook("onLoad");
this.$emit("load");
});
if (this.lazyLoad || this.imgList._unloadimgs < this.imgList.length / 2) {
let height = 0;
const callback = (rect) => {
if (!rect || !rect.height)
rect = {};
if (rect.height === height) {
this.$emit("ready", rect);
} else {
height = rect.height;
setTimeout(() => {
this.getRect().then(callback).catch(callback);
}, 350);
}
};
this.getRect().then(callback).catch(callback);
} else {
if (!this.imgList._unloadimgs) {
this.getRect().then((rect) => {
this.$emit("ready", rect);
}).catch(() => {
this.$emit("ready", {});
});
}
}
},
/**
* @description 调用插件钩子函数
*/
_hook(name) {
for (let i = plugins.length; i--; ) {
if (this.plugins[i][name]) {
this.plugins[i][name]();
}
}
}
}
};
if (!Array) {
const _component_node = common_vendor.resolveComponent("node");
_component_node();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: !$data.nodes[0]
}, !$data.nodes[0] ? {} : {
b: common_vendor.p({
childs: $data.nodes,
opts: [$props.lazyLoad, $props.loadingImg, $props.errorImg, $props.showImgMenu, $props.selectable],
name: "span"
})
}, {
c: common_vendor.n(($props.selectable ? "_select " : "") + "_root"),
d: common_vendor.s($props.containerStyle)
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
my.createComponent(Component);

View File

@@ -0,0 +1,7 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {
"node": "./node/node"
}
}

View File

@@ -0,0 +1,143 @@
/* a 标签默认效果 */
._a {
padding: 1.5px 0 1.5px 0;
color: #366092;
word-break: break-all;
}
/* a 标签点击态效果 */
._hover {
text-decoration: underline;
opacity: 0.7;
}
/* 图片默认效果 */
._img {
max-width: 100%;
-webkit-touch-callout: none;
}
/* 内部样式 */
._block {
display: block;
}
._b,
._strong {
font-weight: bold;
}
._code {
font-family: monospace;
}
._del {
text-decoration: line-through;
}
._em,
._i {
font-style: italic;
}
._h1 {
font-size: 2em;
}
._h2 {
font-size: 1.5em;
}
._h3 {
font-size: 1.17em;
}
._h5 {
font-size: 0.83em;
}
._h6 {
font-size: 0.67em;
}
._h1,
._h2,
._h3,
._h4,
._h5,
._h6 {
display: block;
font-weight: bold;
}
._image {
height: 1px;
}
._ins {
text-decoration: underline;
}
._li {
display: list-item;
}
._ol {
list-style-type: decimal;
}
._ol,
._ul {
display: block;
padding-left: 40px;
margin: 1em 0;
}
._q::before {
content: '"';
}
._q::after {
content: '"';
}
._sub {
font-size: smaller;
vertical-align: sub;
}
._sup {
font-size: smaller;
vertical-align: super;
}
._thead,
._tbody,
._tfoot {
display: table-row-group;
}
._tr {
display: table-row;
}
._td,
._th {
display: table-cell;
vertical-align: middle;
}
._th {
font-weight: bold;
text-align: center;
}
._ul {
list-style-type: disc;
}
._ul ._ul {
margin: 0;
list-style-type: circle;
}
._ul ._ul ._ul {
list-style-type: square;
}
._abbr,
._b,
._code,
._del,
._em,
._i,
._ins,
._label,
._q,
._span,
._strong,
._sub,
._sup {
display: inline;
}

View File

@@ -0,0 +1 @@
<view id="{{b}}" class="{{c}}" style="{{d}}"><block a:for="{{a}}" a:for-item="n" a:key="aF"><image a:if="{{n.a}}" class="_img" style="{{n.b}}" src="{{n.c}}" mode="widthFix"/><rich-text a:if="{{n.d}}" style="{{n.e}}" nodes="{{n.f}}" data-i="{{n.g}}" catchTap="{{n.h}}"/><image a:elif="{{n.i}}" id="{{n.j}}" class="{{n.k}}" style="{{n.l}}" src="{{n.m}}" mode="{{n.n}}" lazy-load="{{n.o}}" webp="{{n.p}}" show-menu-by-longpress="{{n.q}}" image-menu-prevent="{{n.r}}" data-i="{{n.s}}" onLoad="{{n.t}}" onError="{{n.v}}" catchTap="{{n.w}}" onLongTap="{{n.x}}"/><text a:elif="{{n.y}}">\n</text><view a:elif="{{n.z}}" id="{{n.C}}" class="{{n.D}}" hover-class="_hover" style="{{n.E}}" data-i="{{n.F}}" catchTap="{{n.G}}"><node style="display:inherit" u-i="{{n.A}}" onVI="__l" u-p="{{n.B}}"/></view><video a:elif="{{n.H}}" id="{{n.I}}" class="{{n.J}}" style="{{n.K}}" autoplay="{{n.L}}" controls="{{n.M}}" loop="{{n.N}}" muted="{{n.O}}" object-fit="{{n.P}}" poster="{{n.Q}}" src="{{n.R}}" data-i="{{n.S}}" onPlay="{{n.T}}" onError="{{n.U}}"/><audio a:elif="{{n.V}}" id="{{n.W}}" class="{{n.X}}" style="{{n.Y}}" author="{{n.Z}}" controls="{{n.aa}}" loop="{{n.ab}}" name="{{n.ac}}" poster="{{n.ad}}" src="{{n.ae}}" data-i="{{n.af}}" onPlay="{{n.ag}}" onError="{{n.ah}}"/><view a:elif="{{n.ai}}" id="{{n.an}}" class="{{n.ao}}" style="{{n.ap}}"><node a:if="{{n.aj}}" u-i="{{n.ak}}" onVI="__l" u-p="{{n.al}}"/><block a:else><view a:for="{{n.am}}" a:for-item="tbody" a:key="e" class="{{tbody.f}}" style="{{tbody.g}}"><node a:if="{{tbody.a}}" u-i="{{tbody.b}}" onVI="__l" u-p="{{tbody.c}}"/><block a:else><block a:for="{{tbody.d}}" a:for-item="tr" a:key="i"><view a:if="{{tr.a}}" class="{{tr.d}}" style="{{tr.e}}"><node u-i="{{tr.b}}" onVI="__l" u-p="{{tr.c}}"/></view><view a:else class="{{tr.g}}" style="{{tr.h}}"><view a:for="{{tr.f}}" a:for-item="td" a:key="c" class="{{td.d}}" style="{{td.e}}"><node u-i="{{td.a}}" onVI="__l" u-p="{{td.b}}"/></view></view></block></block></view></block></view><rich-text a:elif="{{n.aq}}" id="{{n.ar}}" style="{{n.as}}" preview="{{false}}" selectable="{{n.at}}" user-select="{{n.av}}" nodes="{{n.aw}}"/><view a:elif="{{n.ax}}" id="{{n.az}}" class="{{n.aA}}" style="{{n.aB}}"><node a:for="{{n.ay}}" a:for-item="n2" a:key="a" style="{{n2.b}}" u-i="{{n2.c}}" onVI="__l" u-p="{{n2.d}}"/></view><node a:else style="{{n.aC}}" u-i="{{n.aD}}" onVI="__l" u-p="{{n.aE||''}}"/></block></view>

View File

@@ -0,0 +1,394 @@
"use strict";
const common_vendor = require("../../../../../common/vendor.js");
const block0 = {};
const node = () => Promise.resolve().then(() => RDovQmFja3VwL0RvY3VtZW50cy9IQnVpbGRlclByb2plY3RzLAYnWKqOiDvea6kC91bmlfbW9kdWxlcy9tcC1odG1sL2NvbXBvbmVudHMvbXAtaHRtbC9ub2RlL25vZGUudnVl);
const _sfc_main = {
name: "node",
options: {},
data() {
return {
ctrl: {}
};
},
props: {
name: String,
attrs: {
type: Object,
default() {
return {};
}
},
childs: Array,
opts: Array
},
components: {
node
},
mounted() {
this.$nextTick(() => {
for (this.root = this.$parent; this.root.$options.name !== "mp-html"; this.root = this.root.$parent)
;
});
},
beforeDestroy() {
},
methods: {
/**
* @description 播放视频事件
* @param {Event} e
*/
play(e) {
const i = e.currentTarget.dataset.i;
const node2 = this.childs[i];
this.root.$emit("play", {
source: node2.name,
attrs: {
...node2.attrs,
src: node2.src[this.ctrl[i] || 0]
}
});
if (this.root.pauseVideo) {
let flag = false;
const id = e.target.id;
for (let i2 = this.root._videos.length; i2--; ) {
if (this.root._videos[i2].id === id) {
flag = true;
} else {
this.root._videos[i2].pause();
}
}
if (!flag) {
const ctx = common_vendor.index.createVideoContext(
id,
this
);
ctx.id = id;
if (this.root.playbackRate) {
ctx.playbackRate(this.root.playbackRate);
}
this.root._videos.push(ctx);
}
}
},
/**
* @description 图片点击事件
* @param {Event} e
*/
imgTap(e) {
const node2 = this.childs[e.currentTarget.dataset.i];
if (node2.a) {
this.linkTap(node2.a);
return;
}
if (node2.attrs.ignore)
return;
this.root.$emit("imgtap", node2.attrs);
if (this.root.previewImg) {
common_vendor.index.previewImage({
enablesavephoto: this.root.showImgMenu,
enableShowPhotoDownload: this.root.showImgMenu,
current: parseInt(node2.attrs.i),
urls: this.root.imgList
});
}
},
/**
* @description 图片长按
*/
imgLongTap(e) {
},
/**
* @description 图片加载完成事件
* @param {Event} e
*/
imgLoad(e) {
const i = e.currentTarget.dataset.i;
if (!this.childs[i].w) {
this.$set(this.ctrl, i, e.detail.width);
} else if (this.opts[1] && !this.ctrl[i] || this.ctrl[i] === -1) {
this.$set(this.ctrl, i, 1);
}
this.checkReady();
},
/**
* @description 检查是否所有图片加载完毕
*/
checkReady() {
if (this.root && !this.root.lazyLoad) {
this.root._unloadimgs -= 1;
if (!this.root._unloadimgs) {
setTimeout(() => {
this.root.getRect().then((rect) => {
this.root.$emit("ready", rect);
}).catch(() => {
this.root.$emit("ready", {});
});
}, 350);
}
}
},
/**
* @description 链接点击事件
* @param {Event} e
*/
linkTap(e) {
const node2 = e.currentTarget ? this.childs[e.currentTarget.dataset.i] : {};
const attrs = node2.attrs || e;
const href = attrs.href;
this.root.$emit("linktap", Object.assign({
innerText: this.root.getText(node2.children || [])
// 链接内的文本内容
}, attrs));
if (href) {
if (href[0] === "#") {
this.root.navigateTo(href.substring(1)).catch(() => {
});
} else if (href.split("?")[0].includes("://")) {
if (this.root.copyLink) {
common_vendor.index.setClipboardData({
data: href,
success: () => common_vendor.index.showToast({
title: "链接已复制"
})
});
}
} else {
common_vendor.index.navigateTo({
url: href,
fail() {
common_vendor.index.switchTab({
url: href,
fail() {
}
});
}
});
}
}
},
/**
* @description 错误事件
* @param {Event} e
*/
mediaError(e) {
const i = e.currentTarget.dataset.i;
const node2 = this.childs[i];
if (node2.name === "video" || node2.name === "audio") {
let index = (this.ctrl[i] || 0) + 1;
if (index > node2.src.length) {
index = 0;
}
if (index < node2.src.length) {
this.$set(this.ctrl, i, index);
return;
}
} else if (node2.name === "img") {
if (this.opts[2]) {
this.$set(this.ctrl, i, -1);
}
this.checkReady();
}
if (this.root) {
this.root.$emit("error", {
source: node2.name,
attrs: node2.attrs,
errMsg: e.detail.errMsg
});
}
}
}
};
if (!Array) {
const _component_node = common_vendor.resolveComponent("node");
_component_node();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.f($props.childs, (n, i, i0) => {
return common_vendor.e({
a: n.name === "img" && !n.t && ($props.opts[1] && !$data.ctrl[i] || $data.ctrl[i] < 0)
}, n.name === "img" && !n.t && ($props.opts[1] && !$data.ctrl[i] || $data.ctrl[i] < 0) ? {
b: common_vendor.s(n.attrs.style),
c: $data.ctrl[i] < 0 ? $props.opts[2] : $props.opts[1]
} : {}, {
d: n.name === "img" && n.t
}, n.name === "img" && n.t ? {
e: common_vendor.s("display:" + n.t),
f: [{
attrs: {
style: n.attrs.style || "",
src: n.attrs.src
},
name: "img"
}],
g: i,
h: common_vendor.o((...args) => $options.imgTap && $options.imgTap(...args))
} : n.name === "img" ? {
j: n.attrs.id,
k: common_vendor.n("_img " + n.attrs.class),
l: common_vendor.s(($data.ctrl[i] === -1 ? "display:none;" : "") + "width:" + ($data.ctrl[i] || 1) + "px;height:1px;" + n.attrs.style),
m: n.attrs.src,
n: !n.h ? "widthFix" : !n.w ? "heightFix" : n.m || "scaleToFill",
o: $props.opts[0],
p: n.webp,
q: $props.opts[3] && !n.attrs.ignore,
r: !$props.opts[3] || n.attrs.ignore,
s: i,
t: common_vendor.o((...args) => $options.imgLoad && $options.imgLoad(...args)),
v: common_vendor.o((...args) => $options.mediaError && $options.mediaError(...args)),
w: common_vendor.o((...args) => $options.imgTap && $options.imgTap(...args)),
x: common_vendor.o((...args) => $options.imgLongTap && $options.imgLongTap(...args))
} : n.name === "br" ? {} : n.name === "a" ? {
A: "3f8b6c57-0-" + i0,
B: common_vendor.p({
name: "span",
childs: n.children,
opts: $props.opts
}),
C: n.attrs.id,
D: common_vendor.n((n.attrs.href ? "_a " : "") + n.attrs.class),
E: common_vendor.s("display:inline;" + n.attrs.style),
F: i,
G: common_vendor.o((...args) => $options.linkTap && $options.linkTap(...args))
} : n.name === "video" ? {
I: n.attrs.id,
J: common_vendor.n(n.attrs.class),
K: common_vendor.s(n.attrs.style),
L: n.attrs.autoplay,
M: n.attrs.controls,
N: n.attrs.loop,
O: n.attrs.muted,
P: n.attrs["object-fit"],
Q: n.attrs.poster,
R: n.src[$data.ctrl[i] || 0],
S: i,
T: common_vendor.o((...args) => $options.play && $options.play(...args)),
U: common_vendor.o((...args) => $options.mediaError && $options.mediaError(...args))
} : n.name === "audio" ? {
W: n.attrs.id,
X: common_vendor.n(n.attrs.class),
Y: common_vendor.s(n.attrs.style),
Z: n.attrs.author,
aa: n.attrs.controls,
ab: n.attrs.loop,
ac: n.attrs.name,
ad: n.attrs.poster,
ae: n.src[$data.ctrl[i] || 0],
af: i,
ag: common_vendor.o((...args) => $options.play && $options.play(...args)),
ah: common_vendor.o((...args) => $options.mediaError && $options.mediaError(...args))
} : n.name === "table" && n.c || n.name === "li" ? common_vendor.e({
aj: n.name === "li"
}, n.name === "li" ? {
ak: "3f8b6c57-1-" + i0,
al: common_vendor.p({
childs: n.children,
opts: $props.opts
})
} : {
am: common_vendor.f(n.children, (tbody, x, i1) => {
return common_vendor.e({
a: tbody.name === "td" || tbody.name === "th"
}, tbody.name === "td" || tbody.name === "th" ? {
b: "3f8b6c57-2-" + i0 + "-" + i1,
c: common_vendor.p({
childs: tbody.children,
opts: $props.opts
})
} : {
d: common_vendor.f(tbody.children, (tr, y, i2) => {
return common_vendor.e({
a: tr.name === "td" || tr.name === "th"
}, tr.name === "td" || tr.name === "th" ? {
b: "3f8b6c57-3-" + i0 + "-" + i1 + "-" + i2,
c: common_vendor.p({
childs: tr.children,
opts: $props.opts
}),
d: common_vendor.n("_" + tr.name + " " + tr.attrs.class),
e: common_vendor.s(tr.attrs.style)
} : {
f: common_vendor.f(tr.children, (td, z, i3) => {
return {
a: "3f8b6c57-4-" + i0 + "-" + i1 + "-" + i2 + "-" + i3,
b: common_vendor.p({
childs: td.children,
opts: $props.opts
}),
c: z,
d: common_vendor.n("_" + td.name + " " + td.attrs.class),
e: common_vendor.s(td.attrs.style)
};
}),
g: common_vendor.n("_" + tr.name + " " + tr.attrs.class),
h: common_vendor.s(tr.attrs.style)
}, {
i: y
});
})
}, {
e: x,
f: common_vendor.n("_" + tbody.name + " " + tbody.attrs.class),
g: common_vendor.s(tbody.attrs.style)
});
})
}, {
an: n.attrs.id,
ao: common_vendor.n("_" + n.name + " " + n.attrs.class),
ap: common_vendor.s(n.attrs.style)
}) : !n.c ? {
ar: n.attrs.id,
as: common_vendor.s("display:inline;" + n.f),
at: $props.opts[4],
av: $props.opts[4],
aw: [n]
} : n.c === 2 ? {
ay: common_vendor.f(n.children, (n2, j, i1) => {
return {
a: j,
b: common_vendor.s(n2.f),
c: "3f8b6c57-5-" + i0 + "-" + i1,
d: common_vendor.p({
name: n2.name,
attrs: n2.attrs,
childs: n2.children,
opts: $props.opts
})
};
}),
az: n.attrs.id,
aA: common_vendor.n("_block _" + n.name + " " + n.attrs.class),
aB: common_vendor.s(n.f + ";" + n.attrs.style)
} : {
aC: common_vendor.s(n.f),
aD: "3f8b6c57-6-" + i0,
aE: common_vendor.p({
name: n.name,
attrs: n.attrs,
childs: n.children,
opts: $props.opts
})
}, {
i: n.name === "img",
y: n.name === "br",
z: n.name === "a",
H: n.name === "video",
V: n.name === "audio",
ai: n.name === "table" && n.c || n.name === "li",
aq: !n.c,
ax: n.c === 2,
aF: i
});
}),
b: $props.attrs.id,
c: common_vendor.n("_block _" + $props.name + " " + $props.attrs.class),
d: common_vendor.s($props.attrs.style)
};
}
if (typeof block0 === "function")
block0(_sfc_main);
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
my.createComponent(Component);
const RDovQmFja3VwL0RvY3VtZW50cy9IQnVpbGRlclByb2plY3RzLAYnWKqOiDvea6kC91bmlfbW9kdWxlcy9tcC1odG1sL2NvbXBvbmVudHMvbXAtaHRtbC9ub2RlL25vZGUudnVl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null
}, Symbol.toStringTag, { value: "Module" }));

View File

@@ -0,0 +1,7 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {
"node": "./node"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
.chartsview.data-v-0ca34aee {
width: 100%;
height: 100%;
display: flex;
flex: 1;
justify-content: center;
align-items: center;
}

View File

@@ -0,0 +1 @@
<view class="chartsview data-v-0ca34aee" id="{{H}}"><view a:if="{{a}}" class="data-v-0ca34aee"><qiun-loading class="data-v-0ca34aee" u-i="0ca34aee-0" onVI="__l" u-p="{{b}}"/></view><view a:if="{{c}}" class="data-v-0ca34aee" onTap="{{e}}"><qiun-error class="data-v-0ca34aee" u-i="0ca34aee-1" onVI="__l" u-p="{{d}}"/></view><block a:if="{{f}}"><canvas class="data-v-0ca34aee" id="{{g}}" canvasId="{{h}}" width="{{i}}" height="{{j}}" style="{{'width:' + k + ';' + ('height:' + l) + ';' + ('background:' + m)}}" disable-scroll="{{n}}" onTap="{{o}}" onTouchStart="{{p}}" onTouchMove="{{q}}" onTouchEnd="{{r}}" onError="{{s}}" hidden="{{!t}}"/></block><block a:if="{{v}}"><canvas class="data-v-0ca34aee" id="{{w}}" canvasId="{{x}}" width="{{y}}" height="{{z}}" style="{{'width:' + A + ';' + ('height:' + B) + ';' + ('background:' + C)}}" disable-scroll="{{D}}" onTap="{{E}}" onError="{{F}}" hidden="{{!G}}"/></block></view>

View File

@@ -0,0 +1,954 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const uni_modules_qiunDataCharts_js_sdk_uCharts_uCharts = require("../../js_sdk/u-charts/u-charts.js");
const uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts = require("../../js_sdk/u-charts/config-ucharts.js");
function deepCloneAssign(origin = {}, ...args) {
for (let i in args) {
for (let key in args[i]) {
if (args[i].hasOwnProperty(key)) {
origin[key] = args[i][key] && typeof args[i][key] === "object" ? deepCloneAssign(Array.isArray(args[i][key]) ? [] : {}, origin[key], args[i][key]) : args[i][key];
}
}
}
return origin;
}
function formatterAssign(args, formatter) {
for (let key in args) {
if (args.hasOwnProperty(key) && args[key] !== null && typeof args[key] === "object") {
formatterAssign(args[key], formatter);
} else if (key === "format" && typeof args[key] === "string") {
args["formatter"] = formatter[args[key]] ? formatter[args[key]] : void 0;
}
}
return args;
}
function getFormatDate(date) {
var seperator = "-";
var year = date.getFullYear();
var month = date.getMonth() + 1;
var strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
var currentdate = year + seperator + month + seperator + strDate;
return currentdate;
}
var lastMoveTime = null;
const _sfc_main = {
name: "qiun-data-charts",
mixins: [common_vendor.Ys.mixinDatacom],
props: {
type: {
type: String,
default: null
},
canvasId: {
type: String,
default: "uchartsid"
},
canvas2d: {
type: Boolean,
default: false
},
background: {
type: String,
default: "rgba(0,0,0,0)"
},
animation: {
type: Boolean,
default: true
},
chartData: {
type: Object,
default() {
return {
categories: [],
series: []
};
}
},
opts: {
type: Object,
default() {
return {};
}
},
eopts: {
type: Object,
default() {
return {};
}
},
loadingType: {
type: Number,
default: 2
},
errorShow: {
type: Boolean,
default: true
},
errorReload: {
type: Boolean,
default: true
},
errorMessage: {
type: String,
default: null
},
inScrollView: {
type: Boolean,
default: false
},
reshow: {
type: Boolean,
default: false
},
reload: {
type: Boolean,
default: false
},
disableScroll: {
type: Boolean,
default: false
},
optsWatch: {
type: Boolean,
default: true
},
onzoom: {
type: Boolean,
default: false
},
ontap: {
type: Boolean,
default: true
},
ontouch: {
type: Boolean,
default: false
},
onmouse: {
type: Boolean,
default: true
},
onmovetip: {
type: Boolean,
default: false
},
echartsH5: {
type: Boolean,
default: false
},
echartsApp: {
type: Boolean,
default: false
},
tooltipShow: {
type: Boolean,
default: true
},
tooltipFormat: {
type: String,
default: void 0
},
tooltipCustom: {
type: Object,
default: void 0
},
startDate: {
type: String,
default: void 0
},
endDate: {
type: String,
default: void 0
},
textEnum: {
type: Array,
default() {
return [];
}
},
groupEnum: {
type: Array,
default() {
return [];
}
},
pageScrollTop: {
type: Number,
default: 0
},
directory: {
type: String,
default: "/"
},
tapLegend: {
type: Boolean,
default: true
},
menus: {
type: Array,
default() {
return [];
}
}
},
data() {
return {
cid: "uchartsid",
inWx: false,
inAli: false,
inTt: false,
inBd: false,
inH5: false,
inApp: false,
inWin: false,
type2d: true,
disScroll: false,
openmouse: false,
pixel: 1,
cWidth: 375,
cHeight: 250,
showchart: false,
echarts: false,
echartsResize: {
state: false
},
uchartsOpts: {},
echartsOpts: {},
drawData: {},
lastDrawTime: null
};
},
created() {
this.cid = this.canvasId;
if (this.canvasId == "uchartsid" || this.canvasId == "") {
let t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
let len = t.length;
let id = "";
for (let i = 0; i < 32; i++) {
id += t.charAt(Math.floor(Math.random() * len));
}
this.cid = id;
}
const systemInfo = common_vendor.index.getSystemInfoSync();
if (systemInfo.platform === "windows" || systemInfo.platform === "mac") {
this.inWin = true;
}
this.type2d = false;
this.type2d = this.canvas2d;
this.inAli = true;
this.pixel = systemInfo.pixelRatio;
this.disScroll = this.disableScroll;
},
mounted() {
this.$nextTick(() => {
this.beforeInit();
});
},
destroyed() {
if (this.echarts === true) {
delete cfe.option[this.cid];
delete cfe.instance[this.cid];
} else {
delete uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[this.cid];
delete uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[this.cid];
}
},
watch: {
chartDataProps: {
handler(val, oldval) {
if (typeof val === "object") {
if (JSON.stringify(val) !== JSON.stringify(oldval)) {
this._clearChart();
if (val.series && val.series.length > 0) {
this.beforeInit();
} else {
this.mixinDatacomLoading = true;
this.showchart = false;
this.mixinDatacomErrorMessage = null;
}
}
} else {
this.mixinDatacomLoading = false;
this._clearChart();
this.showchart = false;
this.mixinDatacomErrorMessage = "参数错误chartData数据类型错误";
}
},
immediate: false,
deep: true
},
localdata: {
handler(val, oldval) {
if (JSON.stringify(val) !== JSON.stringify(oldval)) {
if (val.length > 0) {
this.beforeInit();
} else {
this.mixinDatacomLoading = true;
this._clearChart();
this.showchart = false;
this.mixinDatacomErrorMessage = null;
}
}
},
immediate: false,
deep: true
},
optsProps: {
handler(val, oldval) {
if (typeof val === "object") {
if (JSON.stringify(val) !== JSON.stringify(oldval) && this.echarts === false && this.optsWatch == true) {
this.checkData(this.drawData);
}
} else {
this.mixinDatacomLoading = false;
this._clearChart();
this.showchart = false;
this.mixinDatacomErrorMessage = "参数错误opts数据类型错误";
}
},
immediate: false,
deep: true
},
eoptsProps: {
handler(val, oldval) {
if (typeof val === "object") {
if (JSON.stringify(val) !== JSON.stringify(oldval) && this.echarts === true) {
this.checkData(this.drawData);
}
} else {
this.mixinDatacomLoading = false;
this.showchart = false;
this.mixinDatacomErrorMessage = "参数错误eopts数据类型错误";
}
},
immediate: false,
deep: true
},
reshow(val, oldval) {
if (val === true && this.mixinDatacomLoading === false) {
setTimeout(() => {
this.mixinDatacomErrorMessage = null;
this.echartsResize.state = !this.echartsResize.state;
this.checkData(this.drawData);
}, 200);
}
},
reload(val, oldval) {
if (val === true) {
this.showchart = false;
this.mixinDatacomErrorMessage = null;
this.reloading();
}
},
mixinDatacomErrorMessage(val, oldval) {
if (val) {
this.emitMsg({ name: "error", params: { type: "error", errorShow: this.errorShow, msg: val, id: this.cid } });
if (this.errorShow) {
console.log("[秋云图表组件]" + val);
}
}
},
errorMessage(val, oldval) {
if (val && this.errorShow && val !== null && val !== "null" && val !== "") {
this.showchart = false;
this.mixinDatacomLoading = false;
this.mixinDatacomErrorMessage = val;
} else {
this.showchart = false;
this.mixinDatacomErrorMessage = null;
this.reloading();
}
}
},
computed: {
optsProps() {
return JSON.parse(JSON.stringify(this.opts));
},
eoptsProps() {
return JSON.parse(JSON.stringify(this.eopts));
},
chartDataProps() {
return JSON.parse(JSON.stringify(this.chartData));
}
},
methods: {
beforeInit() {
this.mixinDatacomErrorMessage = null;
if (typeof this.chartData === "object" && this.chartData != null && this.chartData.series !== void 0 && this.chartData.series.length > 0) {
this.drawData = deepCloneAssign({}, this.chartData);
this.mixinDatacomLoading = false;
this.showchart = true;
this.checkData(this.chartData);
} else if (this.localdata.length > 0) {
this.mixinDatacomLoading = false;
this.showchart = true;
this.localdataInit(this.localdata);
} else if (this.collection !== "") {
this.mixinDatacomLoading = false;
this.getCloudData();
} else {
this.mixinDatacomLoading = true;
}
},
localdataInit(resdata) {
if (this.groupEnum.length > 0) {
for (let i = 0; i < resdata.length; i++) {
for (let j = 0; j < this.groupEnum.length; j++) {
if (resdata[i].group === this.groupEnum[j].value) {
resdata[i].group = this.groupEnum[j].text;
}
}
}
}
if (this.textEnum.length > 0) {
for (let i = 0; i < resdata.length; i++) {
for (let j = 0; j < this.textEnum.length; j++) {
if (resdata[i].text === this.textEnum[j].value) {
resdata[i].text = this.textEnum[j].text;
}
}
}
}
let needCategories = false;
let tmpData = { categories: [], series: [] };
let tmpcategories = [];
let tmpseries = [];
if (this.echarts === true) {
needCategories = cfe.categories.includes(this.type);
} else {
needCategories = uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.categories.includes(this.type);
}
if (needCategories === true) {
if (this.chartData && this.chartData.categories && this.chartData.categories.length > 0) {
tmpcategories = this.chartData.categories;
} else {
if (this.startDate && this.endDate) {
let idate = new Date(this.startDate);
let edate = new Date(this.endDate);
while (idate <= edate) {
tmpcategories.push(getFormatDate(idate));
idate = idate.setDate(idate.getDate() + 1);
idate = new Date(idate);
}
} else {
let tempckey = {};
resdata.map(function(item, index) {
if (item.text != void 0 && !tempckey[item.text]) {
tmpcategories.push(item.text);
tempckey[item.text] = true;
}
});
}
}
tmpData.categories = tmpcategories;
}
let tempskey = {};
resdata.map(function(item, index) {
if (item.group != void 0 && !tempskey[item.group]) {
tmpseries.push({ name: item.group, data: [] });
tempskey[item.group] = true;
}
});
if (tmpseries.length == 0) {
tmpseries = [{ name: "默认分组", data: [] }];
if (needCategories === true) {
for (let j = 0; j < tmpcategories.length; j++) {
let seriesdata = 0;
for (let i = 0; i < resdata.length; i++) {
if (resdata[i].text == tmpcategories[j]) {
seriesdata = resdata[i].value;
}
}
tmpseries[0].data.push(seriesdata);
}
} else {
for (let i = 0; i < resdata.length; i++) {
tmpseries[0].data.push({ "name": resdata[i].text, "value": resdata[i].value });
}
}
} else {
for (let k = 0; k < tmpseries.length; k++) {
if (tmpcategories.length > 0) {
for (let j = 0; j < tmpcategories.length; j++) {
let seriesdata = 0;
for (let i = 0; i < resdata.length; i++) {
if (tmpseries[k].name == resdata[i].group && resdata[i].text == tmpcategories[j]) {
seriesdata = resdata[i].value;
}
}
tmpseries[k].data.push(seriesdata);
}
} else {
for (let i = 0; i < resdata.length; i++) {
if (tmpseries[k].name == resdata[i].group) {
tmpseries[k].data.push(resdata[i].value);
}
}
}
}
}
tmpData.series = tmpseries;
this.drawData = deepCloneAssign({}, tmpData);
this.checkData(tmpData);
},
reloading() {
if (this.errorReload === false) {
return;
}
this.showchart = false;
this.mixinDatacomErrorMessage = null;
if (this.collection !== "") {
this.mixinDatacomLoading = false;
this.onMixinDatacomPropsChange(true);
} else {
this.beforeInit();
}
},
checkData(anyData) {
let cid = this.cid;
if (this.echarts === true) {
cfe.option[cid] = deepCloneAssign({}, this.eopts);
cfe.option[cid].id = cid;
cfe.option[cid].type = this.type;
} else {
if (this.type && uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.type.includes(this.type)) {
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid] = deepCloneAssign({}, uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu[this.type], this.opts);
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].canvasId = cid;
} else {
this.mixinDatacomLoading = false;
this.showchart = false;
this.mixinDatacomErrorMessage = "参数错误props参数中type类型不正确";
}
}
let newData = deepCloneAssign({}, anyData);
if (newData.series !== void 0 && newData.series.length > 0) {
this.mixinDatacomErrorMessage = null;
if (this.echarts === true) {
cfe.option[cid].chartData = newData;
this.$nextTick(() => {
this.init();
});
} else {
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].categories = newData.categories;
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].series = newData.series;
this.$nextTick(() => {
this.init();
});
}
}
},
resizeHandler() {
let currTime = Date.now();
let lastDrawTime = this.lastDrawTime ? this.lastDrawTime : currTime - 3e3;
let duration = currTime - lastDrawTime;
if (duration < 1e3)
return;
common_vendor.index.createSelectorQuery().select("#ChartBoxId" + this.cid).boundingClientRect((data) => {
this.showchart = true;
if (data.width > 0 && data.height > 0) {
if (data.width !== this.cWidth || data.height !== this.cHeight) {
this.checkData(this.drawData);
}
}
}).exec();
},
getCloudData() {
if (this.mixinDatacomLoading == true) {
return;
}
this.mixinDatacomLoading = true;
this.mixinDatacomGet().then((res) => {
this.mixinDatacomResData = res.result.data;
this.localdataInit(this.mixinDatacomResData);
}).catch((err) => {
this.mixinDatacomLoading = false;
this.showchart = false;
this.mixinDatacomErrorMessage = "请求错误:" + err;
});
},
onMixinDatacomPropsChange(needReset, changed) {
if (needReset == true && this.collection !== "") {
this.showchart = false;
this.mixinDatacomErrorMessage = null;
this._clearChart();
this.getCloudData();
}
},
_clearChart() {
let cid = this.cid;
if (this.echarts !== true && uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid] && uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].context) {
const ctx = uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].context;
if (typeof ctx === "object" && !!!uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].update) {
ctx.clearRect(0, 0, this.cWidth * this.pixel, this.cHeight * this.pixel);
ctx.draw();
}
}
},
init() {
let cid = this.cid;
common_vendor.index.createSelectorQuery().select("#ChartBoxId" + cid).boundingClientRect((data) => {
if (data.width > 0 && data.height > 0) {
this.mixinDatacomLoading = false;
this.showchart = true;
this.lastDrawTime = Date.now();
this.cWidth = data.width;
this.cHeight = data.height;
if (this.echarts !== true) {
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].background = this.background == "rgba(0,0,0,0)" ? "#FFFFFF" : this.background;
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].canvas2d = this.type2d;
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].pixelRatio = this.pixel;
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].animation = this.animation;
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].width = data.width * this.pixel;
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].height = data.height * this.pixel;
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].onzoom = this.onzoom;
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].ontap = this.ontap;
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].ontouch = this.ontouch;
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].onmouse = this.openmouse;
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].onmovetip = this.onmovetip;
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].tooltipShow = this.tooltipShow;
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].tooltipFormat = this.tooltipFormat;
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].tooltipCustom = this.tooltipCustom;
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].inScrollView = this.inScrollView;
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].lastDrawTime = this.lastDrawTime;
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].tapLegend = this.tapLegend;
}
if (this.inH5 || this.inApp) {
if (this.echarts == true) {
cfe.option[cid].ontap = this.ontap;
cfe.option[cid].onmouse = this.openmouse;
cfe.option[cid].tooltipShow = this.tooltipShow;
cfe.option[cid].tooltipFormat = this.tooltipFormat;
cfe.option[cid].tooltipCustom = this.tooltipCustom;
cfe.option[cid].lastDrawTime = this.lastDrawTime;
this.echartsOpts = deepCloneAssign({}, cfe.option[cid]);
} else {
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].rotateLock = uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].rotate;
this.uchartsOpts = deepCloneAssign({}, uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid]);
}
} else {
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid] = formatterAssign(uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid], uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.formatter);
this.mixinDatacomErrorMessage = null;
this.mixinDatacomLoading = false;
this.showchart = true;
this.$nextTick(() => {
if (this.type2d === true) {
const query = common_vendor.index.createSelectorQuery().in(this);
query.select("#" + cid).fields({ node: true, size: true }).exec((res) => {
if (res[0]) {
const canvas = res[0].node;
const ctx = canvas.getContext("2d");
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].context = ctx;
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].rotateLock = uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].rotate;
if (uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid] && uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid] && uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].update === true) {
this._updataUChart(cid);
} else {
canvas.width = data.width * this.pixel;
canvas.height = data.height * this.pixel;
canvas._width = data.width * this.pixel;
canvas._height = data.height * this.pixel;
setTimeout(() => {
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].context.restore();
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].context.save();
this._newChart(cid);
}, 100);
}
} else {
this.showchart = false;
this.mixinDatacomErrorMessage = "参数错误开启2d模式后未获取到dom节点canvas-id:" + cid;
}
});
} else {
if (this.inAli) {
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].rotateLock = uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].rotate;
}
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].context = common_vendor.index.createCanvasContext(cid, this);
if (uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid] && uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid] && uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].update === true) {
this._updataUChart(cid);
} else {
setTimeout(() => {
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].context.restore();
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].context.save();
this._newChart(cid);
}, 100);
}
}
});
}
} else {
this.mixinDatacomLoading = false;
this.showchart = false;
if (this.reshow == true) {
this.mixinDatacomErrorMessage = "布局错误未获取到父元素宽高尺寸canvas-id:" + cid;
}
}
}).exec();
},
saveImage() {
common_vendor.index.canvasToTempFilePath({
canvasId: this.cid,
success: (res) => {
common_vendor.index.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: function() {
common_vendor.index.showToast({
title: "保存成功",
duration: 2e3
});
}
});
}
}, this);
},
getImage() {
if (this.type2d == false) {
common_vendor.index.canvasToTempFilePath({
canvasId: this.cid,
success: (res) => {
this.emitMsg({ name: "getImage", params: { type: "getImage", base64: res.tempFilePath } });
}
}, this);
} else {
const query = common_vendor.index.createSelectorQuery().in(this);
query.select("#" + this.cid).fields({ node: true, size: true }).exec((res) => {
if (res[0]) {
const canvas = res[0].node;
this.emitMsg({ name: "getImage", params: { type: "getImage", base64: canvas.toDataURL("image/png") } });
}
});
}
},
_newChart(cid) {
if (this.mixinDatacomLoading == true) {
return;
}
this.showchart = true;
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid] = new uni_modules_qiunDataCharts_js_sdk_uCharts_uCharts.uCharts(uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid]);
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].addEventListener("renderComplete", () => {
this.emitMsg({ name: "complete", params: { type: "complete", complete: true, id: cid, opts: uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].opts } });
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].delEventListener("renderComplete");
});
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].addEventListener("scrollLeft", () => {
this.emitMsg({ name: "scrollLeft", params: { type: "scrollLeft", scrollLeft: true, id: cid, opts: uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].opts } });
});
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].addEventListener("scrollRight", () => {
this.emitMsg({ name: "scrollRight", params: { type: "scrollRight", scrollRight: true, id: cid, opts: uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].opts } });
});
},
_updataUChart(cid) {
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].updateData(uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid]);
},
_tooltipDefault(item, category, index, opts) {
if (category) {
let data = item.data;
if (typeof item.data === "object") {
data = item.data.value;
}
return category + " " + item.name + ":" + data;
} else {
if (item.properties && item.properties.name) {
return item.properties.name;
} else {
return item.name + ":" + item.data;
}
}
},
_showTooltip(e) {
let cid = this.cid;
let tc = uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].tooltipCustom;
if (tc && tc !== void 0 && tc !== null) {
let offset = void 0;
if (tc.x >= 0 && tc.y >= 0) {
offset = { x: tc.x, y: tc.y + 10 };
}
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].showToolTip(e, {
index: tc.index,
offset,
textList: tc.textList,
formatter: (item, category, index, opts) => {
if (typeof uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].tooltipFormat === "string" && uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.formatter[uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].tooltipFormat]) {
return uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.formatter[uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].tooltipFormat](item, category, index, opts);
} else {
return this._tooltipDefault(item, category, index, opts);
}
}
});
} else {
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].showToolTip(e, {
formatter: (item, category, index, opts) => {
if (typeof uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].tooltipFormat === "string" && uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.formatter[uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].tooltipFormat]) {
return uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.formatter[uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].tooltipFormat](item, category, index, opts);
} else {
return this._tooltipDefault(item, category, index, opts);
}
}
});
}
},
_tap(e, move) {
let cid = this.cid;
let currentIndex = null;
let legendIndex = null;
if (this.inScrollView === true || this.inAli) {
common_vendor.index.createSelectorQuery().select("#" + this.cid).boundingClientRect((data) => {
e.changedTouches = [];
if (this.inAli) {
e.changedTouches.unshift({ x: e.detail.clientX - data.left, y: e.detail.clientY - data.top });
} else {
e.changedTouches.unshift({ x: e.detail.x - data.left, y: e.detail.y - data.top - this.pageScrollTop });
}
if (move) {
if (this.tooltipShow === true) {
this._showTooltip(e);
}
} else {
currentIndex = uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].getCurrentDataIndex(e);
legendIndex = uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].getLegendDataIndex(e);
if (this.tapLegend === true) {
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].touchLegend(e);
}
if (this.tooltipShow === true) {
this._showTooltip(e);
}
this.emitMsg({ name: "getIndex", params: { type: "getIndex", event: { x: e.detail.x - data.left, y: e.detail.y - data.top }, currentIndex, legendIndex, id: cid, opts: uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].opts } });
}
}).exec();
} else {
if (move) {
if (this.tooltipShow === true) {
this._showTooltip(e);
}
} else {
e.changedTouches = [];
e.changedTouches.unshift({ x: e.detail.x - e.currentTarget.offsetLeft, y: e.detail.y - e.currentTarget.offsetTop });
currentIndex = uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].getCurrentDataIndex(e);
legendIndex = uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].getLegendDataIndex(e);
if (this.tapLegend === true) {
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].touchLegend(e);
}
if (this.tooltipShow === true) {
this._showTooltip(e);
}
this.emitMsg({ name: "getIndex", params: { type: "getIndex", event: { x: e.detail.x, y: e.detail.y - e.currentTarget.offsetTop }, currentIndex, legendIndex, id: cid, opts: uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].opts } });
}
}
},
_touchStart(e) {
let cid = this.cid;
lastMoveTime = Date.now();
if (uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].enableScroll === true && e.touches.length == 1) {
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].scrollStart(e);
}
this.emitMsg({ name: "getTouchStart", params: { type: "touchStart", event: e.changedTouches[0], id: cid, opts: uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].opts } });
},
_touchMove(e) {
let cid = this.cid;
let currMoveTime = Date.now();
let duration = currMoveTime - lastMoveTime;
let touchMoveLimit = uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].touchMoveLimit || 24;
if (duration < Math.floor(1e3 / touchMoveLimit))
return;
lastMoveTime = currMoveTime;
if (uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].enableScroll === true && e.changedTouches.length == 1) {
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].scroll(e);
}
if (this.ontap === true && uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].enableScroll === false && this.onmovetip === true) {
this._tap(e, true);
}
if (this.ontouch === true && uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].enableScroll === true && this.onzoom === true && e.changedTouches.length == 2) {
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].dobuleZoom(e);
}
this.emitMsg({ name: "getTouchMove", params: { type: "touchMove", event: e.changedTouches[0], id: cid, opts: uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].opts } });
},
_touchEnd(e) {
let cid = this.cid;
if (uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].enableScroll === true && e.touches.length == 0) {
uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].scrollEnd(e);
}
this.emitMsg({ name: "getTouchEnd", params: { type: "touchEnd", event: e.changedTouches[0], id: cid, opts: uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.instance[cid].opts } });
if (this.ontap === true && uni_modules_qiunDataCharts_js_sdk_uCharts_configUcharts.cfu.option[cid].enableScroll === false && this.onmovetip === true) {
this._tap(e, true);
}
},
_error(e) {
this.mixinDatacomErrorMessage = e.detail.errMsg;
},
emitMsg(msg) {
this.$emit(msg.name, msg.params);
},
getRenderType() {
if (this.echarts === true && this.mixinDatacomLoading === false) {
this.beforeInit();
}
},
toJSON() {
return this;
}
}
};
if (!Array) {
const _easycom_qiun_loading2 = common_vendor.resolveComponent("qiun-loading");
const _easycom_qiun_error2 = common_vendor.resolveComponent("qiun-error");
(_easycom_qiun_loading2 + _easycom_qiun_error2)();
}
const _easycom_qiun_loading = () => "../qiun-loading/qiun-loading.js";
const _easycom_qiun_error = () => "../qiun-error/qiun-error.js";
if (!Math) {
(_easycom_qiun_loading + _easycom_qiun_error)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: _ctx.mixinDatacomLoading
}, _ctx.mixinDatacomLoading ? {
b: common_vendor.p({
loadingType: $props.loadingType
})
} : {}, {
c: _ctx.mixinDatacomErrorMessage && $props.errorShow
}, _ctx.mixinDatacomErrorMessage && $props.errorShow ? {
d: common_vendor.p({
errorMessage: $props.errorMessage
}),
e: common_vendor.o((...args) => $options.reloading && $options.reloading(...args))
} : {}, {
f: $props.ontouch
}, $props.ontouch ? {
g: $data.cid,
h: $data.cid,
i: $data.cWidth * $data.pixel,
j: $data.cHeight * $data.pixel,
k: $data.cWidth + "px",
l: $data.cHeight + "px",
m: $props.background,
n: $data.disScroll,
o: common_vendor.o((...args) => $options._tap && $options._tap(...args)),
p: common_vendor.o((...args) => $options._touchStart && $options._touchStart(...args)),
q: common_vendor.o((...args) => $options._touchMove && $options._touchMove(...args)),
r: common_vendor.o((...args) => $options._touchEnd && $options._touchEnd(...args)),
s: common_vendor.o((...args) => $options._error && $options._error(...args)),
t: $data.showchart
} : {}, {
v: !$props.ontouch
}, !$props.ontouch ? {
w: $data.cid,
x: $data.cid,
y: $data.cWidth * $data.pixel,
z: $data.cHeight * $data.pixel,
A: $data.cWidth + "px",
B: $data.cHeight + "px",
C: $props.background,
D: $data.disScroll,
E: common_vendor.o((...args) => $options._tap && $options._tap(...args)),
F: common_vendor.o((...args) => $options._error && $options._error(...args)),
G: $data.showchart
} : {}, {
H: "ChartBoxId" + $data.cid
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-0ca34aee"]]);
my.createComponent(Component);

View File

@@ -0,0 +1,8 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {
"qiun-loading": "../qiun-loading/qiun-loading",
"qiun-error": "../qiun-error/qiun-error"
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
<view class="chartsview"><view class="charts-error"></view><view class="charts-font">{{a}}</view></view>

View File

@@ -0,0 +1,21 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const _sfc_main = {
name: "qiun-error",
props: {
errorMessage: {
type: String,
default: null
}
},
data() {
return {};
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.t($props.errorMessage == null ? "请点击重试" : $props.errorMessage)
};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
my.createComponent(Component);

View File

@@ -0,0 +1,5 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {}
}

View File

@@ -0,0 +1,78 @@
.container.data-v-0e645258 {
width: 30px;
height: 30px;
position: relative;
}
.container.loading1.data-v-0e645258 {
transform: rotate(45deg);
}
.container .shape.data-v-0e645258 {
position: absolute;
width: 10px;
height: 10px;
border-radius: 1px;
}
.container .shape.shape1.data-v-0e645258 {
left: 0;
background-color: #1890FF;
}
.container .shape.shape2.data-v-0e645258 {
right: 0;
background-color: #91CB74;
}
.container .shape.shape3.data-v-0e645258 {
bottom: 0;
background-color: #FAC858;
}
.container .shape.shape4.data-v-0e645258 {
bottom: 0;
right: 0;
background-color: #EE6666;
}
.loading1 .shape1.data-v-0e645258 {
animation: animation1shape1-0e645258 0.5s ease 0s infinite alternate;
}
@keyframes animation1shape1-0e645258 {
from {
transform: translate(0, 0);
}
to {
transform: translate(16px, 16px);
}
}
.loading1 .shape2.data-v-0e645258 {
animation: animation1shape2-0e645258 0.5s ease 0s infinite alternate;
}
@keyframes animation1shape2-0e645258 {
from {
transform: translate(0, 0);
}
to {
transform: translate(-16px, 16px);
}
}
.loading1 .shape3.data-v-0e645258 {
animation: animation1shape3-0e645258 0.5s ease 0s infinite alternate;
}
@keyframes animation1shape3-0e645258 {
from {
transform: translate(0, 0);
}
to {
transform: translate(16px, -16px);
}
}
.loading1 .shape4.data-v-0e645258 {
animation: animation1shape4-0e645258 0.5s ease 0s infinite alternate;
}
@keyframes animation1shape4-0e645258 {
from {
transform: translate(0, 0);
}
to {
transform: translate(-16px, -16px);
}
}

View File

@@ -0,0 +1 @@
<view class="container loading1 data-v-0e645258"><view class="shape shape1 data-v-0e645258"></view><view class="shape shape2 data-v-0e645258"></view><view class="shape shape3 data-v-0e645258"></view><view class="shape shape4 data-v-0e645258"></view></view>

View File

@@ -0,0 +1,13 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const _sfc_main = {
name: "loading1",
data() {
return {};
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-0e645258"]]);
my.createComponent(Component);

View File

@@ -0,0 +1,5 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {}
}

View File

@@ -0,0 +1,83 @@
.container.data-v-3df48dc2 {
width: 30px;
height: 30px;
position: relative;
}
.container.loading2.data-v-3df48dc2 {
transform: rotate(10deg);
}
.container.loading2 .shape.data-v-3df48dc2 {
border-radius: 5px;
}
.container.loading2.data-v-3df48dc2{
animation: rotation 1s infinite;
}
.container .shape.data-v-3df48dc2 {
position: absolute;
width: 10px;
height: 10px;
border-radius: 1px;
}
.container .shape.shape1.data-v-3df48dc2 {
left: 0;
background-color: #1890FF;
}
.container .shape.shape2.data-v-3df48dc2 {
right: 0;
background-color: #91CB74;
}
.container .shape.shape3.data-v-3df48dc2 {
bottom: 0;
background-color: #FAC858;
}
.container .shape.shape4.data-v-3df48dc2 {
bottom: 0;
right: 0;
background-color: #EE6666;
}
.loading2 .shape1.data-v-3df48dc2 {
animation: animation2shape1-3df48dc2 0.5s ease 0s infinite alternate;
}
@keyframes animation2shape1-3df48dc2 {
from {
transform: translate(0, 0);
}
to {
transform: translate(20px, 20px);
}
}
.loading2 .shape2.data-v-3df48dc2 {
animation: animation2shape2-3df48dc2 0.5s ease 0s infinite alternate;
}
@keyframes animation2shape2-3df48dc2 {
from {
transform: translate(0, 0);
}
to {
transform: translate(-20px, 20px);
}
}
.loading2 .shape3.data-v-3df48dc2 {
animation: animation2shape3-3df48dc2 0.5s ease 0s infinite alternate;
}
@keyframes animation2shape3-3df48dc2 {
from {
transform: translate(0, 0);
}
to {
transform: translate(20px, -20px);
}
}
.loading2 .shape4.data-v-3df48dc2 {
animation: animation2shape4-3df48dc2 0.5s ease 0s infinite alternate;
}
@keyframes animation2shape4-3df48dc2 {
from {
transform: translate(0, 0);
}
to {
transform: translate(-20px, -20px);
}
}

View File

@@ -0,0 +1 @@
<view class="container loading2 data-v-3df48dc2"><view class="shape shape1 data-v-3df48dc2"></view><view class="shape shape2 data-v-3df48dc2"></view><view class="shape shape3 data-v-3df48dc2"></view><view class="shape shape4 data-v-3df48dc2"></view></view>

View File

@@ -0,0 +1,13 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const _sfc_main = {
name: "loading2",
data() {
return {};
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-3df48dc2"]]);
my.createComponent(Component);

View File

@@ -0,0 +1,5 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {}
}

View File

@@ -0,0 +1,88 @@
.container.data-v-27a8293c {
width: 30px;
height: 30px;
position: relative;
}
.container.loading3.data-v-27a8293c {
animation: rotation 1s infinite;
}
.container.loading3 .shape1.data-v-27a8293c {
border-top-left-radius: 10px;
}
.container.loading3 .shape2.data-v-27a8293c {
border-top-right-radius: 10px;
}
.container.loading3 .shape3.data-v-27a8293c {
border-bottom-left-radius: 10px;
}
.container.loading3 .shape4.data-v-27a8293c {
border-bottom-right-radius: 10px;
}
.container .shape.data-v-27a8293c {
position: absolute;
width: 10px;
height: 10px;
border-radius: 1px;
}
.container .shape.shape1.data-v-27a8293c {
left: 0;
background-color: #1890FF;
}
.container .shape.shape2.data-v-27a8293c {
right: 0;
background-color: #91CB74;
}
.container .shape.shape3.data-v-27a8293c {
bottom: 0;
background-color: #FAC858;
}
.container .shape.shape4.data-v-27a8293c {
bottom: 0;
right: 0;
background-color: #EE6666;
}
.loading3 .shape1.data-v-27a8293c {
animation: animation3shape1-27a8293c 0.5s ease 0s infinite alternate;
}
@keyframes animation3shape1-27a8293c {
from {
transform: translate(0, 0);
}
to {
transform: translate(5px, 5px);
}
}
.loading3 .shape2.data-v-27a8293c {
animation: animation3shape2-27a8293c 0.5s ease 0s infinite alternate;
}
@keyframes animation3shape2-27a8293c {
from {
transform: translate(0, 0);
}
to {
transform: translate(-5px, 5px);
}
}
.loading3 .shape3.data-v-27a8293c {
animation: animation3shape3-27a8293c 0.5s ease 0s infinite alternate;
}
@keyframes animation3shape3-27a8293c {
from {
transform: translate(0, 0);
}
to {
transform: translate(5px, -5px);
}
}
.loading3 .shape4.data-v-27a8293c {
animation: animation3shape4-27a8293c 0.5s ease 0s infinite alternate;
}
@keyframes animation3shape4-27a8293c {
from {
transform: translate(0, 0);
}
to {
transform: translate(-5px, -5px);
}
}

View File

@@ -0,0 +1 @@
<view class="container loading3 data-v-27a8293c"><view class="shape shape1 data-v-27a8293c"></view><view class="shape shape2 data-v-27a8293c"></view><view class="shape shape3 data-v-27a8293c"></view><view class="shape shape4 data-v-27a8293c"></view></view>

View File

@@ -0,0 +1,13 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const _sfc_main = {
name: "loading3",
data() {
return {};
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-27a8293c"]]);
my.createComponent(Component);

View File

@@ -0,0 +1,5 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {}
}

View File

@@ -0,0 +1,102 @@
.container.data-v-2e7deb83 {
width: 30px;
height: 30px;
position: relative;
}
.container.loading5 .shape.data-v-2e7deb83 {
width: 15px;
height: 15px;
}
.container .shape.data-v-2e7deb83 {
position: absolute;
width: 10px;
height: 10px;
border-radius: 1px;
}
.container .shape.shape1.data-v-2e7deb83 {
left: 0;
background-color: #1890FF;
}
.container .shape.shape2.data-v-2e7deb83 {
right: 0;
background-color: #91CB74;
}
.container .shape.shape3.data-v-2e7deb83 {
bottom: 0;
background-color: #FAC858;
}
.container .shape.shape4.data-v-2e7deb83 {
bottom: 0;
right: 0;
background-color: #EE6666;
}
.loading5 .shape1.data-v-2e7deb83 {
animation: animation5shape1-2e7deb83 2s ease 0s infinite reverse;
}
@keyframes animation5shape1-2e7deb83 {
0% {
transform: translate(0, 0);
}
25% {
transform: translate(0, 15px);
}
50% {
transform: translate(15px, 15px);
}
75% {
transform: translate(15px, 0);
}
}
.loading5 .shape2.data-v-2e7deb83 {
animation: animation5shape2-2e7deb83 2s ease 0s infinite reverse;
}
@keyframes animation5shape2-2e7deb83 {
0% {
transform: translate(0, 0);
}
25% {
transform: translate(-15px, 0);
}
50% {
transform: translate(-15px, 15px);
}
75% {
transform: translate(0, 15px);
}
}
.loading5 .shape3.data-v-2e7deb83 {
animation: animation5shape3-2e7deb83 2s ease 0s infinite reverse;
}
@keyframes animation5shape3-2e7deb83 {
0% {
transform: translate(0, 0);
}
25% {
transform: translate(15px, 0);
}
50% {
transform: translate(15px, -15px);
}
75% {
transform: translate(0, -15px);
}
}
.loading5 .shape4.data-v-2e7deb83 {
animation: animation5shape4-2e7deb83 2s ease 0s infinite reverse;
}
@keyframes animation5shape4-2e7deb83 {
0% {
transform: translate(0, 0);
}
25% {
transform: translate(0, -15px);
}
50% {
transform: translate(-15px, -15px);
}
75% {
transform: translate(-15px, 0);
}
}

View File

@@ -0,0 +1 @@
<view class="container loading5 data-v-2e7deb83"><view class="shape shape1 data-v-2e7deb83"></view><view class="shape shape2 data-v-2e7deb83"></view><view class="shape shape3 data-v-2e7deb83"></view><view class="shape shape4 data-v-2e7deb83"></view></view>

View File

@@ -0,0 +1,13 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const _sfc_main = {
name: "loading5",
data() {
return {};
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-2e7deb83"]]);
my.createComponent(Component);

View File

@@ -0,0 +1,5 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {}
}

View File

@@ -0,0 +1,105 @@
.container.data-v-ef674bbb {
width: 30px;
height: 30px;
position: relative;
}
.container.loading6.data-v-ef674bbb {
animation: rotation 1s infinite;
}
.container.loading6 .shape.data-v-ef674bbb {
width: 12px;
height: 12px;
border-radius: 2px;
}
.container .shape.data-v-ef674bbb {
position: absolute;
width: 10px;
height: 10px;
border-radius: 1px;
}
.container .shape.shape1.data-v-ef674bbb {
left: 0;
background-color: #1890FF;
}
.container .shape.shape2.data-v-ef674bbb {
right: 0;
background-color: #91CB74;
}
.container .shape.shape3.data-v-ef674bbb {
bottom: 0;
background-color: #FAC858;
}
.container .shape.shape4.data-v-ef674bbb {
bottom: 0;
right: 0;
background-color: #EE6666;
}
.loading6 .shape1.data-v-ef674bbb {
animation: animation6shape1-ef674bbb 2s linear 0s infinite normal;
}
@keyframes animation6shape1-ef674bbb {
0% {
transform: translate(0, 0);
}
25% {
transform: translate(0, 18px);
}
50% {
transform: translate(18px, 18px);
}
75% {
transform: translate(18px, 0);
}
}
.loading6 .shape2.data-v-ef674bbb {
animation: animation6shape2-ef674bbb 2s linear 0s infinite normal;
}
@keyframes animation6shape2-ef674bbb {
0% {
transform: translate(0, 0);
}
25% {
transform: translate(-18px, 0);
}
50% {
transform: translate(-18px, 18px);
}
75% {
transform: translate(0, 18px);
}
}
.loading6 .shape3.data-v-ef674bbb {
animation: animation6shape3-ef674bbb 2s linear 0s infinite normal;
}
@keyframes animation6shape3-ef674bbb {
0% {
transform: translate(0, 0);
}
25% {
transform: translate(18px, 0);
}
50% {
transform: translate(18px, -18px);
}
75% {
transform: translate(0, -18px);
}
}
.loading6 .shape4.data-v-ef674bbb {
animation: animation6shape4-ef674bbb 2s linear 0s infinite normal;
}
@keyframes animation6shape4-ef674bbb {
0% {
transform: translate(0, 0);
}
25% {
transform: translate(0, -18px);
}
50% {
transform: translate(-18px, -18px);
}
75% {
transform: translate(-18px, 0);
}
}

View File

@@ -0,0 +1 @@
<view class="container loading6 data-v-ef674bbb"><view class="shape shape1 data-v-ef674bbb"></view><view class="shape shape2 data-v-ef674bbb"></view><view class="shape shape3 data-v-ef674bbb"></view><view class="shape shape4 data-v-ef674bbb"></view></view>

View File

@@ -0,0 +1,13 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const _sfc_main = {
name: "loading6",
data() {
return {};
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-ef674bbb"]]);
my.createComponent(Component);

View File

@@ -0,0 +1,5 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {}
}

View File

@@ -0,0 +1 @@
<view><loading1 a:if="{{a}}" u-i="67426558-0" onVI="__l"/><loading2 a:if="{{b}}" u-i="67426558-1" onVI="__l"/><loading3 a:if="{{c}}" u-i="67426558-2" onVI="__l"/><loading4 a:if="{{d}}" u-i="67426558-3" onVI="__l"/><loading5 a:if="{{e}}" u-i="67426558-4" onVI="__l"/></view>

View File

@@ -0,0 +1,43 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const Loading1 = () => "./loading1.js";
const Loading2 = () => "./loading2.js";
const Loading3 = () => "./loading3.js";
const Loading4 = () => "./loading4.js";
const Loading5 = () => "./loading5.js";
const _sfc_main = {
components: { Loading1, Loading2, Loading3, Loading4, Loading5 },
name: "qiun-loading",
props: {
loadingType: {
type: Number,
default: 2
}
},
data() {
return {};
}
};
if (!Array) {
const _component_Loading1 = common_vendor.resolveComponent("Loading1");
const _component_Loading2 = common_vendor.resolveComponent("Loading2");
const _component_Loading3 = common_vendor.resolveComponent("Loading3");
const _component_Loading4 = common_vendor.resolveComponent("Loading4");
const _component_Loading5 = common_vendor.resolveComponent("Loading5");
(_component_Loading1 + _component_Loading2 + _component_Loading3 + _component_Loading4 + _component_Loading5)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $props.loadingType == 1
}, $props.loadingType == 1 ? {} : {}, {
b: $props.loadingType == 2
}, $props.loadingType == 2 ? {} : {}, {
c: $props.loadingType == 3
}, $props.loadingType == 3 ? {} : {}, {
d: $props.loadingType == 4
}, $props.loadingType == 4 ? {} : {}, {
e: $props.loadingType == 5
}, $props.loadingType == 5 ? {} : {});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
my.createComponent(Component);

View File

@@ -0,0 +1,11 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {
"loading1": "./loading1",
"loading2": "./loading2",
"loading3": "./loading3",
"loading4": "./loading4",
"loading5": "./loading5"
}
}

View File

@@ -0,0 +1,587 @@
"use strict";
const color = ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", "#ea7ccc"];
const formatDateTime = (timeStamp, returnType) => {
var date = /* @__PURE__ */ new Date();
date.setTime(timeStamp * 1e3);
var y = date.getFullYear();
var m = date.getMonth() + 1;
m = m < 10 ? "0" + m : m;
var d = date.getDate();
d = d < 10 ? "0" + d : d;
var h = date.getHours();
h = h < 10 ? "0" + h : h;
var minute = date.getMinutes();
var second = date.getSeconds();
minute = minute < 10 ? "0" + minute : minute;
second = second < 10 ? "0" + second : second;
if (returnType == "full") {
return y + "-" + m + "-" + d + " " + h + ":" + minute + ":" + second;
}
if (returnType == "y-m-d") {
return y + "-" + m + "-" + d;
}
if (returnType == "h:m") {
return h + ":" + minute;
}
if (returnType == "h:m:s") {
return h + ":" + minute + ":" + second;
}
return [y, m, d, h, minute, second];
};
const cfu = {
//demotype为自定义图表类型一般不需要自定义图表类型只需要改根节点上对应的类型即可
"type": ["pie", "ring", "rose", "word", "funnel", "map", "arcbar", "line", "column", "mount", "bar", "area", "radar", "gauge", "candle", "mix", "tline", "tarea", "scatter", "bubble", "demotype"],
"range": ["饼状图", "圆环图", "玫瑰图", "词云图", "漏斗图", "地图", "圆弧进度条", "折线图", "柱状图", "山峰图", "条状图", "区域图", "雷达图", "仪表盘", "K线图", "混合图", "时间轴折线", "时间轴区域", "散点图", "气泡图", "自定义类型"],
//增加自定义图表类型如果需要categories请在这里加入您的图表类型例如最后的"demotype"
//自定义类型时需要注意"tline","tarea","scatter","bubble"等时间轴矢量x轴类图表没有categories不需要加入categories
"categories": ["line", "column", "mount", "bar", "area", "radar", "gauge", "candle", "mix", "demotype"],
//instance为实例变量承载属性不要删除
"instance": {},
//option为opts及eopts承载属性不要删除
"option": {},
//下面是自定义format配置因除H5端外的其他端无法通过props传递函数只能通过此属性对应下标的方式来替换
"formatter": {
"yAxisDemo1": function(val, index, opts) {
return val + "元";
},
"yAxisDemo2": function(val, index, opts) {
return val.toFixed(2);
},
"xAxisDemo1": function(val, index, opts) {
return val + "年";
},
"xAxisDemo2": function(val, index, opts) {
return formatDateTime(val, "h:m");
},
"seriesDemo1": function(val, index, series, opts) {
return val + "元";
},
"tooltipDemo1": function(item, category, index, opts) {
if (index == 0) {
return "随便用" + item.data + "年";
} else {
return "其他我没改" + item.data + "天";
}
},
"pieDemo": function(val, index, series, opts) {
if (index !== void 0) {
return series[index].name + "" + series[index].data + "元";
}
}
},
//这里演示了自定义您的图表类型的option可以随意命名之后在组件上 type="demotype" 后组件会调用这个花括号里的option如果组件上还存在opts参数会将demotype与opts中option合并后渲染图表。
"demotype": {
//我这里把曲线图当做了自定义图表类型,您可以根据需要随意指定类型或配置
"type": "line",
"color": color,
"padding": [15, 10, 0, 15],
"xAxis": {
"disableGrid": true
},
"yAxis": {
"gridType": "dash",
"dashLength": 2
},
"legend": {},
"extra": {
"line": {
"type": "curve",
"width": 2
}
}
},
//下面是自定义配置,请添加项目所需的通用配置
"pie": {
"type": "pie",
"color": color,
"padding": [5, 5, 5, 5],
"extra": {
"pie": {
"activeOpacity": 0.5,
"activeRadius": 10,
"offsetAngle": 0,
"labelWidth": 15,
"border": true,
"borderWidth": 3,
"borderColor": "#FFFFFF"
}
}
},
"ring": {
"type": "ring",
"color": color,
"padding": [5, 5, 5, 5],
"rotate": false,
"dataLabel": true,
"legend": {
"show": true,
"position": "right",
"lineHeight": 25
},
"title": {
"name": "收益率",
"fontSize": 15,
"color": "#666666"
},
"subtitle": {
"name": "70%",
"fontSize": 25,
"color": "#7cb5ec"
},
"extra": {
"ring": {
"ringWidth": 30,
"activeOpacity": 0.5,
"activeRadius": 10,
"offsetAngle": 0,
"labelWidth": 15,
"border": true,
"borderWidth": 3,
"borderColor": "#FFFFFF"
}
}
},
"rose": {
"type": "rose",
"color": color,
"padding": [5, 5, 5, 5],
"legend": {
"show": true,
"position": "left",
"lineHeight": 25
},
"extra": {
"rose": {
"type": "area",
"minRadius": 50,
"activeOpacity": 0.5,
"activeRadius": 10,
"offsetAngle": 0,
"labelWidth": 15,
"border": false,
"borderWidth": 2,
"borderColor": "#FFFFFF"
}
}
},
"word": {
"type": "word",
"color": color,
"extra": {
"word": {
"type": "normal",
"autoColors": false
}
}
},
"funnel": {
"type": "funnel",
"color": color,
"padding": [15, 15, 0, 15],
"extra": {
"funnel": {
"activeOpacity": 0.3,
"activeWidth": 10,
"border": true,
"borderWidth": 2,
"borderColor": "#FFFFFF",
"fillOpacity": 1,
"labelAlign": "right"
}
}
},
"map": {
"type": "map",
"color": color,
"padding": [0, 0, 0, 0],
"dataLabel": true,
"extra": {
"map": {
"border": true,
"borderWidth": 1,
"borderColor": "#666666",
"fillOpacity": 0.6,
"activeBorderColor": "#F04864",
"activeFillColor": "#FACC14",
"activeFillOpacity": 1
}
}
},
"arcbar": {
"type": "arcbar",
"color": color,
"title": {
"name": "百分比",
"fontSize": 25,
"color": "#00FF00"
},
"subtitle": {
"name": "默认标题",
"fontSize": 15,
"color": "#666666"
},
"extra": {
"arcbar": {
"type": "default",
"width": 12,
"backgroundColor": "#E9E9E9",
"startAngle": 0.75,
"endAngle": 0.25,
"gap": 2
}
}
},
"line": {
"type": "line",
"color": color,
"padding": [15, 10, 0, 15],
"xAxis": {
"disableGrid": true
},
"yAxis": {
"gridType": "dash",
"dashLength": 2
},
"legend": {},
"extra": {
"line": {
"type": "straight",
"width": 2,
"activeType": "hollow"
}
}
},
"tline": {
"type": "line",
"color": color,
"padding": [15, 10, 0, 15],
"xAxis": {
"disableGrid": false,
"boundaryGap": "justify"
},
"yAxis": {
"gridType": "dash",
"dashLength": 2,
"data": [
{
"min": 0,
"max": 80
}
]
},
"legend": {},
"extra": {
"line": {
"type": "curve",
"width": 2,
"activeType": "hollow"
}
}
},
"tarea": {
"type": "area",
"color": color,
"padding": [15, 10, 0, 15],
"xAxis": {
"disableGrid": true,
"boundaryGap": "justify"
},
"yAxis": {
"gridType": "dash",
"dashLength": 2,
"data": [
{
"min": 0,
"max": 80
}
]
},
"legend": {},
"extra": {
"area": {
"type": "curve",
"opacity": 0.2,
"addLine": true,
"width": 2,
"gradient": true,
"activeType": "hollow"
}
}
},
"column": {
"type": "column",
"color": color,
"padding": [15, 15, 0, 5],
"xAxis": {
"disableGrid": true
},
"yAxis": {
"data": [{ "min": 0 }]
},
"legend": {},
"extra": {
"column": {
"type": "group",
"width": 30,
"activeBgColor": "#000000",
"activeBgOpacity": 0.08
}
}
},
"mount": {
"type": "mount",
"color": color,
"padding": [15, 15, 0, 5],
"xAxis": {
"disableGrid": true
},
"yAxis": {
"data": [{ "min": 0 }]
},
"legend": {},
"extra": {
"mount": {
"type": "mount",
"widthRatio": 1.5
}
}
},
"bar": {
"type": "bar",
"color": color,
"padding": [15, 30, 0, 5],
"xAxis": {
"boundaryGap": "justify",
"disableGrid": false,
"min": 0,
"axisLine": false
},
"yAxis": {},
"legend": {},
"extra": {
"bar": {
"type": "group",
"width": 30,
"meterBorde": 1,
"meterFillColor": "#FFFFFF",
"activeBgColor": "#000000",
"activeBgOpacity": 0.08
}
}
},
"area": {
"type": "area",
"color": color,
"padding": [15, 15, 0, 15],
"xAxis": {
"disableGrid": true
},
"yAxis": {
"gridType": "dash",
"dashLength": 2
},
"legend": {},
"extra": {
"area": {
"type": "straight",
"opacity": 0.2,
"addLine": true,
"width": 2,
"gradient": false,
"activeType": "hollow"
}
}
},
"radar": {
"type": "radar",
"color": color,
"padding": [5, 5, 5, 5],
"dataLabel": false,
"legend": {
"show": true,
"position": "right",
"lineHeight": 25
},
"extra": {
"radar": {
"gridType": "radar",
"gridColor": "#CCCCCC",
"gridCount": 3,
"opacity": 0.2,
"max": 200,
"labelShow": true
}
}
},
"gauge": {
"type": "gauge",
"color": color,
"title": {
"name": "66Km/H",
"fontSize": 25,
"color": "#2fc25b",
"offsetY": 50
},
"subtitle": {
"name": "实时速度",
"fontSize": 15,
"color": "#1890ff",
"offsetY": -50
},
"extra": {
"gauge": {
"type": "default",
"width": 30,
"labelColor": "#666666",
"startAngle": 0.75,
"endAngle": 0.25,
"startNumber": 0,
"endNumber": 100,
"labelFormat": "",
"splitLine": {
"fixRadius": 0,
"splitNumber": 10,
"width": 30,
"color": "#FFFFFF",
"childNumber": 5,
"childWidth": 12
},
"pointer": {
"width": 24,
"color": "auto"
}
}
}
},
"candle": {
"type": "candle",
"color": color,
"padding": [15, 15, 0, 15],
"enableScroll": true,
"enableMarkLine": true,
"dataLabel": false,
"xAxis": {
"labelCount": 4,
"itemCount": 40,
"disableGrid": true,
"gridColor": "#CCCCCC",
"gridType": "solid",
"dashLength": 4,
"scrollShow": true,
"scrollAlign": "left",
"scrollColor": "#A6A6A6",
"scrollBackgroundColor": "#EFEBEF"
},
"yAxis": {},
"legend": {},
"extra": {
"candle": {
"color": {
"upLine": "#f04864",
"upFill": "#f04864",
"downLine": "#2fc25b",
"downFill": "#2fc25b"
},
"average": {
"show": true,
"name": ["MA5", "MA10", "MA30"],
"day": [5, 10, 20],
"color": ["#1890ff", "#2fc25b", "#facc14"]
}
},
"markLine": {
"type": "dash",
"dashLength": 5,
"data": [
{
"value": 2150,
"lineColor": "#f04864",
"showLabel": true
},
{
"value": 2350,
"lineColor": "#f04864",
"showLabel": true
}
]
}
}
},
"mix": {
"type": "mix",
"color": color,
"padding": [15, 15, 0, 15],
"xAxis": {
"disableGrid": true
},
"yAxis": {
"disabled": false,
"disableGrid": false,
"splitNumber": 5,
"gridType": "dash",
"dashLength": 4,
"gridColor": "#CCCCCC",
"padding": 10,
"showTitle": true,
"data": []
},
"legend": {},
"extra": {
"mix": {
"column": {
"width": 20
}
}
}
},
"scatter": {
"type": "scatter",
"color": color,
"padding": [15, 15, 0, 15],
"dataLabel": false,
"xAxis": {
"disableGrid": false,
"gridType": "dash",
"splitNumber": 5,
"boundaryGap": "justify",
"min": 0
},
"yAxis": {
"disableGrid": false,
"gridType": "dash"
},
"legend": {},
"extra": {
"scatter": {}
}
},
"bubble": {
"type": "bubble",
"color": color,
"padding": [15, 15, 0, 15],
"xAxis": {
"disableGrid": false,
"gridType": "dash",
"splitNumber": 5,
"boundaryGap": "justify",
"min": 0,
"max": 250
},
"yAxis": {
"disableGrid": false,
"gridType": "dash",
"data": [{
"min": 0,
"max": 150
}]
},
"legend": {},
"extra": {
"bubble": {
"border": 2,
"opacity": 0.5
}
}
}
};
exports.cfu = cfu;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,25 @@
@charset "UTF-8";
@font-face {
font-family: "tuniaoFont"; /* Project id 3784643 */
src:
url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAN8AAsAAAAAB4gAAAMvAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACDBgqCQIIdATYCJAMMCwgABCAFhH8HPRuYBiMRpmvPIfurAzsYPj7DCVbrRAmElfXCs4V6xacO8aHO69VXu54tTy8h0hcJ7ufgieY+3+xscrn9B8wKQQFBywplLZCw9SwcOyZ5pKsoAQAbcICJTr7AjPPqr06NRkeIAemFpXv8cje1+/LkuLvD789WJZUANjOe9F76qptDOSMUui/Ua0WQKpZGXaqf5hHZdAD6x8tRJtRKtQd7j5UKkk6lWywYkGADCZBnGLugJd6CAI4GOjH956Ep4k7imdNkYTGFAkm2nJyPrBNwA7YhWwgQ/K4bLXITD8wl8xxuBN+XwyYJwOAp5jFjOwNbPNwd3l3WiyFAv3sCBLjcAB6gQM3GjLLSbJpDo1ANiqsiFiX7WAQzqTcMA06j/pb/eAbEx8yMAaAChg3sDjs6COwub8IAoAD4PEZkA7iAZClPKdicmJLc2OiZcQC3cV613sc3Ab9W7YItQtio9YgdKGjgr+ANlbg5gPvXFacv8IyvKTH4pcjV7VIcfnuIAUd3VCbxcCIKj++rvr/hpx/iwxd4/5mxDXeILbBp2+ByMIlGMuQEU3gjiVaMcXk8Dn2gWo5wuRwuIldLRqRwWogvmCRXE9/kSvrVQP4iFDVWRSbRakMk/AtcBYVpO6rpah1V9J/m/Wt+q8WfsOV+S5KFTGD5dwW9KFstZUs5smuYK3V495zwUG+r/Izf0PWtbWj/HUQsAL9u+cGK8NCiAgRnaRJ49fqljrxWc4PaKs4pQwBlMLUeAzgcEGLakvg5nCZ3zgTBkZzAEEUuFEeJyMrq4BGhGT6OPjiqGd4eIZkLKGKjgTKuAAgpPIAhjmdQUngnsrJdeKTxBz4pkgjHjJQeFqFMXv8PQqg0QP+F2cbAdoHqFmaM52jYlcbNoeTq4CtPkjzHAE1Zl0QvFEjGmp9fY6vKwBI9kOvIuQhJ4kJWy0k1dVXFVXcpbfTmIIRKA/RfmG0M7G1T3cKM8VwMXGlEnR1KY0uU+CTJnM1ODk1ZdxJdSOjYdGOp+TW2k6szsNg8qIvIuQipetFCVstpQCB1lcXHXUl5ZOpfdBvgMI9QMaJi8TZdzLS36K8/ueDZOWMAAA==') format('woff2'),
url('//at.alicdn.com/t/c/font_3784643_5jru9pe5fad.woff?t=1669045092678') format('woff'),
url('//at.alicdn.com/t/c/font_3784643_5jru9pe5fad.ttf?t=1669045092678') format('truetype');
}
[class*='tn-icon-'] {
font-family: 'tuniaoFont' !important;
font-style: normal;
-webkit-font-smoothing: antialiased;
text-align: center;
text-decoration: none;
}
.tn-icon-close:before {
content: "\e74d";
}
.tn-icon-camera-fill:before {
content: "\e75d";
}

View File

@@ -0,0 +1,88 @@
.uni-calendar-item__weeks-box {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin: 1px 0;
position: relative;
}
.uni-calendar-item__weeks-box-text {
font-size: 14px;
font-weight: bold;
color: #001833;
}
.uni-calendar-item__weeks-box-item {
position: relative;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 40px;
height: 40px;
}
.uni-calendar-item__weeks-box-circle {
position: absolute;
top: 5px;
right: 5px;
width: 8px;
height: 8px;
border-radius: 8px;
background-color: #dd524d;
}
.uni-calendar-item__weeks-box .uni-calendar-item--disable {
cursor: default;
}
.uni-calendar-item--disable .uni-calendar-item__weeks-box-text-disable {
color: #D1D1D1;
}
.uni-calendar-item--today {
position: absolute;
top: 10px;
right: 17%;
background-color: #dd524d;
width: 6px;
height: 6px;
border-radius: 50%;
}
.uni-calendar-item--extra {
color: #dd524d;
opacity: 0.8;
}
.uni-calendar-item__weeks-box .uni-calendar-item--checked {
background-color: #007aff;
border-radius: 50%;
box-sizing: border-box;
border: 3px solid #fff;
}
.uni-calendar-item--checked .uni-calendar-item--checked-text {
color: #fff;
}
.uni-calendar-item--multiple .uni-calendar-item--checked-range-text {
color: #333;
}
.uni-calendar-item--multiple {
background-color: #F6F7FC;
}
.uni-calendar-item--multiple .uni-calendar-item--before-checked,
.uni-calendar-item--multiple .uni-calendar-item--after-checked {
background-color: #007aff;
border-radius: 50%;
box-sizing: border-box;
border: 3px solid #F6F7FC;
}
.uni-calendar-item--before-checked .uni-calendar-item--checked-text,
.uni-calendar-item--after-checked .uni-calendar-item--checked-text {
color: #fff;
}
.uni-calendar-item--before-checked-x {
border-top-left-radius: 50px;
border-bottom-left-radius: 50px;
box-sizing: border-box;
background-color: #F6F7FC;
}
.uni-calendar-item--after-checked-x {
border-top-right-radius: 50px;
border-bottom-right-radius: 50px;
background-color: #F6F7FC;
}

View File

@@ -0,0 +1 @@
<view class="{{('uni-calendar-item__weeks-box') + ' ' + (j && 'uni-calendar-item--disable') + ' ' + (k && 'uni-calendar-item--before-checked-x') + ' ' + (l && 'uni-calendar-item--multiple') + ' ' + (m && 'uni-calendar-item--after-checked-x')}}" onTap="{{n}}" onMouseenter="{{o}}"><view class="{{('uni-calendar-item__weeks-box-item') + ' ' + (c && 'uni-calendar-item--checked') + ' ' + (d && 'uni-calendar-item--checked-range-text') + ' ' + (e && 'uni-calendar-item--before-checked') + ' ' + (f && 'uni-calendar-item--multiple') + ' ' + (g && 'uni-calendar-item--after-checked') + ' ' + (h && 'uni-calendar-item--disable')}}"><text a:if="{{a}}" class="uni-calendar-item__weeks-box-circle"></text><text class="uni-calendar-item__weeks-box-text uni-calendar-item__weeks-box-text-disable uni-calendar-item--checked-text">{{b}}</text></view><view class="{{(i && 'uni-calendar-item--today')}}"></view></view>

View File

@@ -0,0 +1,58 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const _sfc_main = {
props: {
weeks: {
type: Object,
default() {
return {};
}
},
calendar: {
type: Object,
default: () => {
return {};
}
},
selected: {
type: Array,
default: () => {
return [];
}
},
checkHover: {
type: Boolean,
default: false
}
},
methods: {
choiceDate(weeks) {
this.$emit("change", weeks);
},
handleMousemove(weeks) {
this.$emit("handleMouse", weeks);
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $props.selected && $props.weeks.extraInfo
}, $props.selected && $props.weeks.extraInfo ? {} : {}, {
b: common_vendor.t($props.weeks.date),
c: $props.calendar.fullDate === $props.weeks.fullDate && ($props.calendar.userChecked || !$props.checkHover) ? 1 : "",
d: $props.checkHover ? 1 : "",
e: $props.weeks.beforeMultiple ? 1 : "",
f: $props.weeks.multiple ? 1 : "",
g: $props.weeks.afterMultiple ? 1 : "",
h: $props.weeks.disable ? 1 : "",
i: $props.weeks.isToday ? 1 : "",
j: $props.weeks.disable ? 1 : "",
k: $props.weeks.beforeMultiple ? 1 : "",
l: $props.weeks.multiple ? 1 : "",
m: $props.weeks.afterMultiple ? 1 : "",
n: common_vendor.o(($event) => $options.choiceDate($props.weeks)),
o: common_vendor.o(($event) => $options.handleMousemove($props.weeks))
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
my.createComponent(Component);

View File

@@ -0,0 +1,5 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {}
}

View File

@@ -0,0 +1,226 @@
.uni-calendar {
display: flex;
flex-direction: column;
}
.uni-calendar__mask {
position: fixed;
bottom: 0;
top: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.4);
transition-property: opacity;
transition-duration: 0.3s;
opacity: 0;
z-index: 99;
}
.uni-calendar--mask-show {
opacity: 1;
}
.uni-calendar--fixed {
position: fixed;
bottom: calc(var(--window-bottom));
left: 0;
right: 0;
transition-property: transform;
transition-duration: 0.3s;
transform: translateY(460px);
z-index: 99;
}
.uni-calendar--ani-show {
transform: translateY(0);
}
.uni-calendar__content {
background-color: #fff;
}
.uni-calendar__content-mobile {
border-top-left-radius: 10px;
border-top-right-radius: 10px;
box-shadow: 0px 0px 5px 3px rgba(0, 0, 0, 0.1);
}
.uni-calendar__header {
position: relative;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
height: 50px;
}
.uni-calendar__header-mobile {
padding: 10px;
padding-bottom: 0;
}
.uni-calendar--fixed-top {
display: flex;
flex-direction: row;
justify-content: space-between;
border-top-color: rgba(0, 0, 0, 0.4);
border-top-style: solid;
border-top-width: 1px;
}
.uni-calendar--fixed-width {
width: 50px;
}
.uni-calendar__backtoday {
position: absolute;
right: 0;
top: 25rpx;
padding: 0 5px;
padding-left: 10px;
height: 25px;
line-height: 25px;
font-size: 12px;
border-top-left-radius: 25px;
border-bottom-left-radius: 25px;
color: #fff;
background-color: #f1f1f1;
}
.uni-calendar__header-text {
text-align: center;
width: 100px;
font-size: 15px;
color: #666;
}
.uni-calendar__button-text {
text-align: center;
width: 100px;
font-size: 14px;
color: #007aff;
letter-spacing: 3px;
}
.uni-calendar__header-btn-box {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
width: 50px;
height: 50px;
}
.uni-calendar__header-btn {
width: 9px;
height: 9px;
border-left-color: #808080;
border-left-style: solid;
border-left-width: 1px;
border-top-color: #555555;
border-top-style: solid;
border-top-width: 1px;
}
.uni-calendar--left {
transform: rotate(-45deg);
}
.uni-calendar--right {
transform: rotate(135deg);
}
.uni-calendar__weeks {
position: relative;
display: flex;
flex-direction: row;
}
.uni-calendar__weeks-item {
flex: 1;
}
.uni-calendar__weeks-day {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 40px;
border-bottom-color: #F5F5F5;
border-bottom-style: solid;
border-bottom-width: 1px;
}
.uni-calendar__weeks-day-text {
font-size: 12px;
color: #B2B2B2;
}
.uni-calendar__box {
position: relative;
padding-bottom: 7px;
}
.uni-calendar__box-bg {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.uni-calendar__box-bg-text {
font-size: 200px;
font-weight: bold;
color: #999;
opacity: 0.1;
text-align: center;
line-height: 1;
}
.uni-date-changed {
padding: 0 10px;
text-align: center;
color: #333;
border-top-color: #DCDCDC;
border-top-style: solid;
border-top-width: 1px;
flex: 1;
}
.uni-date-btn--ok {
padding: 20px 15px;
}
.uni-date-changed--time-start {
display: flex;
align-items: center;
}
.uni-date-changed--time-end {
display: flex;
align-items: center;
}
.uni-date-changed--time-date {
color: #999;
line-height: 50px;
margin-right: 5px;
}
.time-picker-style {
display: flex;
justify-content: center;
align-items: center;
}
.mr-10 {
margin-right: 10px;
}
.dialog-close {
position: absolute;
top: 0;
right: 0;
bottom: 0;
display: flex;
flex-direction: row;
align-items: center;
padding: 0 25px;
margin-top: 10px;
}
.dialog-close-plus {
width: 16px;
height: 2px;
background-color: #737987;
border-radius: 2px;
transform: rotate(45deg);
}
.dialog-close-rotate {
position: absolute;
transform: rotate(-45deg);
}
.uni-datetime-picker--btn {
border-radius: 100px;
height: 40px;
line-height: 40px;
background-color: #007aff;
color: #fff;
font-size: 16px;
letter-spacing: 2px;
}
.uni-datetime-picker--btn:active {
opacity: 0.7;
}

View File

@@ -0,0 +1 @@
<view class="uni-calendar" onMouseleave="{{R}}"><view a:if="{{a}}" class="{{('uni-calendar__mask') + ' ' + (b && 'uni-calendar--mask-show')}}" onTap="{{c}}"></view><view a:if="{{d}}" class="{{('uni-calendar__content') + ' ' + (O && 'uni-calendar--fixed') + ' ' + (P && 'uni-calendar--ani-show') + ' ' + (Q && 'uni-calendar__content-mobile')}}"><view class="{{('uni-calendar__header') + ' ' + (l && 'uni-calendar__header-mobile')}}"><view class="uni-calendar__header-btn-box" catchTap="{{e}}"><view class="uni-calendar__header-btn uni-calendar--left"></view></view><picker mode="date" value="{{g}}" fields="month" onChange="{{h}}"><text class="uni-calendar__header-text">{{f}}</text></picker><view class="uni-calendar__header-btn-box" catchTap="{{i}}"><view class="uni-calendar__header-btn uni-calendar--right"></view></view><view a:if="{{j}}" class="dialog-close" onTap="{{k}}"><view class="dialog-close-plus" data-id="close"></view><view class="dialog-close-plus dialog-close-rotate" data-id="close"></view></view></view><view class="uni-calendar__box"><view a:if="{{m}}" class="uni-calendar__box-bg"><text class="uni-calendar__box-bg-text">{{n}}</text></view><view class="uni-calendar__weeks" style="padding-bottom:7px"><view class="uni-calendar__weeks-day"><text class="uni-calendar__weeks-day-text">{{o}}</text></view><view class="uni-calendar__weeks-day"><text class="uni-calendar__weeks-day-text">{{p}}</text></view><view class="uni-calendar__weeks-day"><text class="uni-calendar__weeks-day-text">{{q}}</text></view><view class="uni-calendar__weeks-day"><text class="uni-calendar__weeks-day-text">{{r}}</text></view><view class="uni-calendar__weeks-day"><text class="uni-calendar__weeks-day-text">{{s}}</text></view><view class="uni-calendar__weeks-day"><text class="uni-calendar__weeks-day-text">{{t}}</text></view><view class="uni-calendar__weeks-day"><text class="uni-calendar__weeks-day-text">{{v}}</text></view></view><view a:for="{{w}}" a:for-item="item" a:key="b" class="uni-calendar__weeks"><view a:for="{{item.a}}" a:for-item="weeks" a:key="c" class="uni-calendar__weeks-item"><calendar-item class="uni-calendar-item--hook" onChange="{{x}}" onHandleMouse="{{y}}" u-i="{{weeks.a}}" onVI="__l" u-p="{{weeks.b}}"></calendar-item></view></view></view><view a:if="{{z}}" class="uni-date-changed uni-calendar--fixed-top" style="padding:0 80px"><view class="uni-date-changed--time-date">{{A}}</view><time-picker class="time-picker-style" u-i="22e5bfc6-1" onVI="__l" onUpdateModelValue="{{B}}" u-p="{{C}}"></time-picker></view><view a:if="{{D}}" class="uni-date-changed uni-calendar--fixed-top"><view class="uni-date-changed--time-start"><view class="uni-date-changed--time-date">{{E}}</view><time-picker class="time-picker-style" u-i="22e5bfc6-2" onVI="__l" onUpdateModelValue="{{F}}" u-p="{{G}}"></time-picker></view><view style="line-height:50px"><uni-icons u-i="22e5bfc6-3" onVI="__l" u-p="{{H}}"></uni-icons></view><view class="uni-date-changed--time-end"><view class="uni-date-changed--time-date">{{I}}</view><time-picker class="time-picker-style" u-i="22e5bfc6-4" onVI="__l" onUpdateModelValue="{{J}}" u-p="{{K}}"></time-picker></view></view><view a:if="{{L}}" class="uni-date-changed uni-date-btn--ok"><view class="uni-datetime-picker--btn" onTap="{{N}}">{{M}}</view></view></view></view>

View File

@@ -0,0 +1,604 @@
"use strict";
const uni_modules_uniDatetimePicker_components_uniDatetimePicker_util = require("./util.js");
const common_vendor = require("../../../../common/vendor.js");
const uni_modules_uniDatetimePicker_components_uniDatetimePicker_i18n_index = require("./i18n/index.js");
const calendarItem = () => "./calendar-item.js";
const timePicker = () => "./time-picker.js";
const {
t
} = common_vendor.initVueI18n(uni_modules_uniDatetimePicker_components_uniDatetimePicker_i18n_index.i18nMessages);
const _sfc_main = {
components: {
calendarItem,
timePicker
},
options: {
virtualHost: true
},
props: {
date: {
type: String,
default: ""
},
defTime: {
type: [String, Object],
default: ""
},
selectableTimes: {
type: [Object],
default() {
return {};
}
},
selected: {
type: Array,
default() {
return [];
}
},
startDate: {
type: String,
default: ""
},
endDate: {
type: String,
default: ""
},
startPlaceholder: {
type: String,
default: ""
},
endPlaceholder: {
type: String,
default: ""
},
range: {
type: Boolean,
default: false
},
hasTime: {
type: Boolean,
default: false
},
insert: {
type: Boolean,
default: true
},
showMonth: {
type: Boolean,
default: true
},
clearDate: {
type: Boolean,
default: true
},
checkHover: {
type: Boolean,
default: true
},
hideSecond: {
type: [Boolean],
default: false
},
pleStatus: {
type: Object,
default() {
return {
before: "",
after: "",
data: [],
fulldate: ""
};
}
},
defaultValue: {
type: [String, Object, Array],
default: ""
}
},
data() {
return {
show: false,
weeks: [],
calendar: {},
nowDate: {},
aniMaskShow: false,
firstEnter: true,
time: "",
timeRange: {
startTime: "",
endTime: ""
},
tempSingleDate: "",
tempRange: {
before: "",
after: ""
}
};
},
watch: {
date: {
immediate: true,
handler(newVal) {
if (!this.range) {
this.tempSingleDate = newVal;
setTimeout(() => {
this.init(newVal);
}, 100);
}
}
},
defTime: {
immediate: true,
handler(newVal) {
if (!this.range) {
this.time = newVal;
} else {
this.timeRange.startTime = newVal.start;
this.timeRange.endTime = newVal.end;
}
}
},
startDate(val) {
if (!this.cale) {
return;
}
this.cale.setStartDate(val);
this.cale.setDate(this.nowDate.fullDate);
this.weeks = this.cale.weeks;
},
endDate(val) {
if (!this.cale) {
return;
}
this.cale.setEndDate(val);
this.cale.setDate(this.nowDate.fullDate);
this.weeks = this.cale.weeks;
},
selected(newVal) {
if (!this.cale) {
return;
}
this.cale.setSelectInfo(this.nowDate.fullDate, newVal);
this.weeks = this.cale.weeks;
},
pleStatus: {
immediate: true,
handler(newVal) {
const {
before,
after,
fulldate,
which
} = newVal;
this.tempRange.before = before;
this.tempRange.after = after;
setTimeout(() => {
if (fulldate) {
this.cale.setHoverMultiple(fulldate);
if (before && after) {
this.cale.lastHover = true;
if (this.rangeWithinMonth(after, before))
return;
this.setDate(before);
} else {
this.cale.setMultiple(fulldate);
this.setDate(this.nowDate.fullDate);
this.calendar.fullDate = "";
this.cale.lastHover = false;
}
} else {
if (!this.cale) {
return;
}
this.cale.setDefaultMultiple(before, after);
if (which === "left" && before) {
this.setDate(before);
this.weeks = this.cale.weeks;
} else if (after) {
this.setDate(after);
this.weeks = this.cale.weeks;
}
this.cale.lastHover = true;
}
}, 16);
}
}
},
computed: {
timepickerStartTime() {
const activeDate = this.range ? this.tempRange.before : this.calendar.fullDate;
return activeDate === this.startDate ? this.selectableTimes.start : "";
},
timepickerEndTime() {
const activeDate = this.range ? this.tempRange.after : this.calendar.fullDate;
return activeDate === this.endDate ? this.selectableTimes.end : "";
},
/**
* for i18n
*/
selectDateText() {
return t("uni-datetime-picker.selectDate");
},
startDateText() {
return this.startPlaceholder || t("uni-datetime-picker.startDate");
},
endDateText() {
return this.endPlaceholder || t("uni-datetime-picker.endDate");
},
okText() {
return t("uni-datetime-picker.ok");
},
yearText() {
return t("uni-datetime-picker.year");
},
monthText() {
return t("uni-datetime-picker.month");
},
MONText() {
return t("uni-calender.MON");
},
TUEText() {
return t("uni-calender.TUE");
},
WEDText() {
return t("uni-calender.WED");
},
THUText() {
return t("uni-calender.THU");
},
FRIText() {
return t("uni-calender.FRI");
},
SATText() {
return t("uni-calender.SAT");
},
SUNText() {
return t("uni-calender.SUN");
},
confirmText() {
return t("uni-calender.confirm");
}
},
created() {
this.cale = new uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.Calendar({
selected: this.selected,
startDate: this.startDate,
endDate: this.endDate,
range: this.range
});
this.init(this.date);
},
methods: {
leaveCale() {
this.firstEnter = true;
},
handleMouse(weeks) {
if (weeks.disable)
return;
if (this.cale.lastHover)
return;
let {
before,
after
} = this.cale.multipleStatus;
if (!before)
return;
this.calendar = weeks;
this.cale.setHoverMultiple(this.calendar.fullDate);
this.weeks = this.cale.weeks;
if (this.firstEnter) {
this.$emit("firstEnterCale", this.cale.multipleStatus);
this.firstEnter = false;
}
},
rangeWithinMonth(A, B) {
const [yearA, monthA] = A.split("-");
const [yearB, monthB] = B.split("-");
return yearA === yearB && monthA === monthB;
},
// 蒙版点击事件
maskClick() {
this.close();
this.$emit("maskClose");
},
clearCalender() {
if (this.range) {
this.timeRange.startTime = "";
this.timeRange.endTime = "";
this.tempRange.before = "";
this.tempRange.after = "";
this.cale.multipleStatus.before = "";
this.cale.multipleStatus.after = "";
this.cale.multipleStatus.data = [];
this.cale.lastHover = false;
} else {
this.time = "";
this.tempSingleDate = "";
}
this.calendar.fullDate = "";
this.setDate(/* @__PURE__ */ new Date());
},
bindDateChange(e) {
const value = e.detail.value + "-1";
this.setDate(value);
},
/**
* 初始化日期显示
* @param {Object} date
*/
init(date) {
if (!this.cale) {
return;
}
this.cale.setDate(date || /* @__PURE__ */ new Date());
this.weeks = this.cale.weeks;
this.nowDate = this.cale.getInfo(date);
this.calendar = {
...this.nowDate
};
if (!date) {
this.calendar.fullDate = "";
if (this.defaultValue && !this.range) {
const defaultDate = new Date(this.defaultValue);
const fullDate = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getDate(defaultDate);
const year = defaultDate.getFullYear();
const month = defaultDate.getMonth() + 1;
const date2 = defaultDate.getDate();
const day = defaultDate.getDay();
this.calendar = {
fullDate,
year,
month,
date: date2,
day
}, this.tempSingleDate = fullDate;
this.time = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getTime(defaultDate, this.hideSecond);
}
}
},
/**
* 打开日历弹窗
*/
open() {
if (this.clearDate && !this.insert) {
this.cale.cleanMultipleStatus();
this.init(this.date);
}
this.show = true;
this.$nextTick(() => {
setTimeout(() => {
this.aniMaskShow = true;
}, 50);
});
},
/**
* 关闭日历弹窗
*/
close() {
this.aniMaskShow = false;
this.$nextTick(() => {
setTimeout(() => {
this.show = false;
this.$emit("close");
}, 300);
});
},
/**
* 确认按钮
*/
confirm() {
this.setEmit("confirm");
this.close();
},
/**
* 变化触发
*/
change(isSingleChange) {
if (!this.insert && !isSingleChange)
return;
this.setEmit("change");
},
/**
* 选择月份触发
*/
monthSwitch() {
let {
year,
month
} = this.nowDate;
this.$emit("monthSwitch", {
year,
month: Number(month)
});
},
/**
* 派发事件
* @param {Object} name
*/
setEmit(name) {
if (!this.range) {
if (!this.calendar.fullDate) {
this.calendar = this.cale.getInfo(/* @__PURE__ */ new Date());
this.tempSingleDate = this.calendar.fullDate;
}
if (this.hasTime && !this.time) {
this.time = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getTime(/* @__PURE__ */ new Date(), this.hideSecond);
}
}
let {
year,
month,
date,
fullDate,
extraInfo
} = this.calendar;
this.$emit(name, {
range: this.cale.multipleStatus,
year,
month,
date,
time: this.time,
timeRange: this.timeRange,
fulldate: fullDate,
extraInfo: extraInfo || {}
});
},
/**
* 选择天触发
* @param {Object} weeks
*/
choiceDate(weeks) {
if (weeks.disable)
return;
this.calendar = weeks;
this.calendar.userChecked = true;
this.cale.setMultiple(this.calendar.fullDate, true);
this.weeks = this.cale.weeks;
this.tempSingleDate = this.calendar.fullDate;
const beforeDate = new Date(this.cale.multipleStatus.before).getTime();
const afterDate = new Date(this.cale.multipleStatus.after).getTime();
if (beforeDate > afterDate && afterDate) {
this.tempRange.before = this.cale.multipleStatus.after;
this.tempRange.after = this.cale.multipleStatus.before;
} else {
this.tempRange.before = this.cale.multipleStatus.before;
this.tempRange.after = this.cale.multipleStatus.after;
}
this.change(true);
},
changeMonth(type) {
let newDate;
if (type === "pre") {
newDate = this.cale.getPreMonthObj(this.nowDate.fullDate).fullDate;
} else if (type === "next") {
newDate = this.cale.getNextMonthObj(this.nowDate.fullDate).fullDate;
}
this.setDate(newDate);
this.monthSwitch();
},
/**
* 设置日期
* @param {Object} date
*/
setDate(date) {
this.cale.setDate(date);
this.weeks = this.cale.weeks;
this.nowDate = this.cale.getInfo(date);
}
}
};
if (!Array) {
const _component_calendar_item = common_vendor.resolveComponent("calendar-item");
const _component_time_picker = common_vendor.resolveComponent("time-picker");
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
(_component_calendar_item + _component_time_picker + _easycom_uni_icons2)();
}
const _easycom_uni_icons = () => "../../../uni-icons/components/uni-icons/uni-icons.js";
if (!Math) {
_easycom_uni_icons();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: !$props.insert && $data.show
}, !$props.insert && $data.show ? {
b: $data.aniMaskShow ? 1 : "",
c: common_vendor.o((...args) => $options.maskClick && $options.maskClick(...args))
} : {}, {
d: $props.insert || $data.show
}, $props.insert || $data.show ? common_vendor.e({
e: common_vendor.o(($event) => $options.changeMonth("pre")),
f: common_vendor.t(($data.nowDate.year || "") + $options.yearText + ($data.nowDate.month || "") + $options.monthText),
g: $props.date,
h: common_vendor.o((...args) => $options.bindDateChange && $options.bindDateChange(...args)),
i: common_vendor.o(($event) => $options.changeMonth("next")),
j: !$props.insert
}, !$props.insert ? {
k: common_vendor.o((...args) => $options.maskClick && $options.maskClick(...args))
} : {}, {
l: !$props.insert ? 1 : "",
m: $props.showMonth
}, $props.showMonth ? {
n: common_vendor.t($data.nowDate.month)
} : {}, {
o: common_vendor.t($options.SUNText),
p: common_vendor.t($options.MONText),
q: common_vendor.t($options.TUEText),
r: common_vendor.t($options.WEDText),
s: common_vendor.t($options.THUText),
t: common_vendor.t($options.FRIText),
v: common_vendor.t($options.SATText),
w: common_vendor.f($data.weeks, (item, weekIndex, i0) => {
return {
a: common_vendor.f(item, (weeks, weeksIndex, i1) => {
return {
a: "22e5bfc6-0-" + i0 + "-" + i1,
b: common_vendor.p({
weeks,
calendar: $data.calendar,
selected: $props.selected,
checkHover: $props.range
}),
c: weeksIndex
};
}),
b: weekIndex
};
}),
x: common_vendor.o($options.choiceDate),
y: common_vendor.o($options.handleMouse),
z: !$props.insert && !$props.range && $props.hasTime
}, !$props.insert && !$props.range && $props.hasTime ? {
A: common_vendor.t($data.tempSingleDate ? $data.tempSingleDate : $options.selectDateText),
B: common_vendor.o(($event) => $data.time = $event),
C: common_vendor.p({
type: "time",
start: $options.timepickerStartTime,
end: $options.timepickerEndTime,
disabled: !$data.tempSingleDate,
border: false,
["hide-second"]: $props.hideSecond,
modelValue: $data.time
})
} : {}, {
D: !$props.insert && $props.range && $props.hasTime
}, !$props.insert && $props.range && $props.hasTime ? {
E: common_vendor.t($data.tempRange.before ? $data.tempRange.before : $options.startDateText),
F: common_vendor.o(($event) => $data.timeRange.startTime = $event),
G: common_vendor.p({
type: "time",
start: $options.timepickerStartTime,
border: false,
["hide-second"]: $props.hideSecond,
disabled: !$data.tempRange.before,
modelValue: $data.timeRange.startTime
}),
H: common_vendor.p({
type: "arrowthinright",
color: "#999"
}),
I: common_vendor.t($data.tempRange.after ? $data.tempRange.after : $options.endDateText),
J: common_vendor.o(($event) => $data.timeRange.endTime = $event),
K: common_vendor.p({
type: "time",
end: $options.timepickerEndTime,
border: false,
["hide-second"]: $props.hideSecond,
disabled: !$data.tempRange.after,
modelValue: $data.timeRange.endTime
})
} : {}, {
L: !$props.insert
}, !$props.insert ? {
M: common_vendor.t($options.confirmText),
N: common_vendor.o((...args) => $options.confirm && $options.confirm(...args))
} : {}, {
O: !$props.insert ? 1 : "",
P: $data.aniMaskShow ? 1 : "",
Q: $data.aniMaskShow ? 1 : ""
}) : {}, {
R: common_vendor.o((...args) => $options.leaveCale && $options.leaveCale(...args))
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
my.createComponent(Component);

View File

@@ -0,0 +1,9 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {
"calendar-item": "./calendar-item",
"time-picker": "./time-picker",
"uni-icons": "../../../uni-icons/components/uni-icons/uni-icons"
}
}

View File

@@ -0,0 +1,73 @@
"use strict";
const en = {
"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"
};
const zhHans = {
"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": "确认"
};
const zhHant = {
"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": "確認"
};
const i18nMessages = {
en,
"zh-Hans": zhHans,
"zh-Hant": zhHant
};
exports.i18nMessages = i18nMessages;

View File

@@ -0,0 +1,102 @@
.uni-datetime-picker {
/* width: 100%; */
}
.uni-datetime-picker-view {
height: 130px;
width: 270px;
cursor: pointer;
}
.uni-datetime-picker-item {
height: 50px;
line-height: 50px;
text-align: center;
font-size: 14px;
}
.uni-datetime-picker-btn {
margin-top: 60px;
display: flex;
cursor: pointer;
flex-direction: row;
justify-content: space-between;
}
.uni-datetime-picker-btn-text {
font-size: 14px;
color: #007aff;
}
.uni-datetime-picker-btn-group {
display: flex;
flex-direction: row;
}
.uni-datetime-picker-cancel {
margin-right: 30px;
}
.uni-datetime-picker-mask {
position: fixed;
bottom: 0px;
top: 0px;
left: 0px;
right: 0px;
background-color: rgba(0, 0, 0, 0.4);
transition-duration: 0.3s;
z-index: 998;
}
.uni-datetime-picker-popup {
border-radius: 8px;
padding: 30px;
width: 270px;
background-color: #fff;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
transition-duration: 0.3s;
z-index: 999;
}
.uni-datetime-picker-time {
color: grey;
}
.uni-datetime-picker-column {
height: 50px;
}
.uni-datetime-picker-timebox {
border: 1px solid #E5E5E5;
border-radius: 5px;
padding: 7px 10px;
box-sizing: border-box;
cursor: pointer;
}
.uni-datetime-picker-timebox-pointer {
cursor: pointer;
}
.uni-datetime-picker-disabled {
opacity: 0.4;
}
.uni-datetime-picker-text {
font-size: 14px;
line-height: 50px;
}
.uni-datetime-picker-sign {
position: absolute;
top: 53px;
/* 减掉 10px 的元素高度兼容nvue */
color: #999;
}
.sign-left {
left: 86px;
}
.sign-right {
right: 86px;
}
.sign-center {
left: 135px;
}
.uni-datetime-picker__container-box {
position: relative;
display: flex;
align-items: center;
justify-content: center;
margin-top: 40px;
}
.time-hide-second {
width: 180px;
}

View File

@@ -0,0 +1 @@
<view class="uni-datetime-picker"><view onTap="{{f}}"><slot><view class="{{('uni-datetime-picker-timebox-pointer') + ' ' + (d && 'uni-datetime-picker-disabled') + ' ' + (e && 'uni-datetime-picker-timebox')}}"><text class="uni-datetime-picker-text">{{a}}</text><view a:if="{{b}}" class="uni-datetime-picker-time"><text class="uni-datetime-picker-text">{{c}}</text></view></view></slot></view><view a:if="{{g}}" id="mask" class="uni-datetime-picker-mask" onTap="{{h}}"></view><view a:if="{{i}}" class="{{('uni-datetime-picker-popup') + ' ' + J}}" style="{{K}}"><view class="uni-title"><text class="uni-datetime-picker-text">{{j}}</text></view><view a:if="{{k}}" class="uni-datetime-picker__container-box"><picker-view class="uni-datetime-picker-view" indicator-style="{{o}}" value="{{p}}" onChange="{{q}}"><picker-view-column><view a:for="{{l}}" a:for-item="item" a:key="b" class="uni-datetime-picker-item"><text class="uni-datetime-picker-item">{{item.a}}</text></view></picker-view-column><picker-view-column><view a:for="{{m}}" a:for-item="item" a:key="b" class="uni-datetime-picker-item"><text class="uni-datetime-picker-item">{{item.a}}</text></view></picker-view-column><picker-view-column><view a:for="{{n}}" a:for-item="item" a:key="b" class="uni-datetime-picker-item"><text class="uni-datetime-picker-item">{{item.a}}</text></view></picker-view-column></picker-view><text class="uni-datetime-picker-sign sign-left">-</text><text class="uni-datetime-picker-sign sign-right">-</text></view><view a:if="{{r}}" class="uni-datetime-picker__container-box"><picker-view class="{{('uni-datetime-picker-view') + ' ' + x}}" indicator-style="{{y}}" value="{{z}}" onChange="{{A}}"><picker-view-column><view a:for="{{s}}" a:for-item="item" a:key="b" class="uni-datetime-picker-item"><text class="uni-datetime-picker-item">{{item.a}}</text></view></picker-view-column><picker-view-column><view a:for="{{t}}" a:for-item="item" a:key="b" class="uni-datetime-picker-item"><text class="uni-datetime-picker-item">{{item.a}}</text></view></picker-view-column><picker-view-column a:if="{{v}}"><view a:for="{{w}}" a:for-item="item" a:key="b" class="uni-datetime-picker-item"><text class="uni-datetime-picker-item">{{item.a}}</text></view></picker-view-column></picker-view><text class="{{('uni-datetime-picker-sign') + ' ' + B}}">:</text><text a:if="{{C}}" class="uni-datetime-picker-sign sign-right">:</text></view><view class="uni-datetime-picker-btn"><view onTap="{{E}}"><text class="uni-datetime-picker-btn-text">{{D}}</text></view><view class="uni-datetime-picker-btn-group"><view class="uni-datetime-picker-cancel" onTap="{{G}}"><text class="uni-datetime-picker-btn-text">{{F}}</text></view><view onTap="{{I}}"><text class="uni-datetime-picker-btn-text">{{H}}</text></view></view></view></view></view>

View File

@@ -0,0 +1,694 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const uni_modules_uniDatetimePicker_components_uniDatetimePicker_i18n_index = require("./i18n/index.js");
const uni_modules_uniDatetimePicker_components_uniDatetimePicker_util = require("./util.js");
const {
t
} = common_vendor.initVueI18n(uni_modules_uniDatetimePicker_components_uniDatetimePicker_i18n_index.i18nMessages);
const _sfc_main = {
name: "UniDatetimePicker",
data() {
return {
indicatorStyle: `height: 50px;`,
visible: false,
fixNvueBug: {},
dateShow: true,
timeShow: true,
title: "日期和时间",
// 输入框当前时间
time: "",
// 当前的年月日时分秒
year: 1920,
month: 0,
day: 0,
hour: 0,
minute: 0,
second: 0,
// 起始时间
startYear: 1920,
startMonth: 1,
startDay: 1,
startHour: 0,
startMinute: 0,
startSecond: 0,
// 结束时间
endYear: 2120,
endMonth: 12,
endDay: 31,
endHour: 23,
endMinute: 59,
endSecond: 59
};
},
options: {
virtualHost: true
},
props: {
type: {
type: String,
default: "datetime"
},
value: {
type: [String, Number],
default: ""
},
modelValue: {
type: [String, Number],
default: ""
},
start: {
type: [Number, String],
default: ""
},
end: {
type: [Number, String],
default: ""
},
returnType: {
type: String,
default: "string"
},
disabled: {
type: [Boolean, String],
default: false
},
border: {
type: [Boolean, String],
default: true
},
hideSecond: {
type: [Boolean, String],
default: false
}
},
watch: {
modelValue: {
handler(newVal) {
if (newVal) {
this.parseValue(uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.fixIosDateFormat(newVal));
this.initTime(false);
} else {
this.time = "";
this.parseValue(Date.now());
}
},
immediate: true
},
type: {
handler(newValue) {
if (newValue === "date") {
this.dateShow = true;
this.timeShow = false;
this.title = "日期";
} else if (newValue === "time") {
this.dateShow = false;
this.timeShow = true;
this.title = "时间";
} else {
this.dateShow = true;
this.timeShow = true;
this.title = "日期和时间";
}
},
immediate: true
},
start: {
handler(newVal) {
this.parseDatetimeRange(uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.fixIosDateFormat(newVal), "start");
},
immediate: true
},
end: {
handler(newVal) {
this.parseDatetimeRange(uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.fixIosDateFormat(newVal), "end");
},
immediate: true
},
// 月、日、时、分、秒可选范围变化后,检查当前值是否在范围内,不在则当前值重置为可选范围第一项
months(newVal) {
this.checkValue("month", this.month, newVal);
},
days(newVal) {
this.checkValue("day", this.day, newVal);
},
hours(newVal) {
this.checkValue("hour", this.hour, newVal);
},
minutes(newVal) {
this.checkValue("minute", this.minute, newVal);
},
seconds(newVal) {
this.checkValue("second", this.second, newVal);
}
},
computed: {
// 当前年、月、日、时、分、秒选择范围
years() {
return this.getCurrentRange("year");
},
months() {
return this.getCurrentRange("month");
},
days() {
return this.getCurrentRange("day");
},
hours() {
return this.getCurrentRange("hour");
},
minutes() {
return this.getCurrentRange("minute");
},
seconds() {
return this.getCurrentRange("second");
},
// picker 当前值数组
ymd() {
return [this.year - this.minYear, this.month - this.minMonth, this.day - this.minDay];
},
hms() {
return [this.hour - this.minHour, this.minute - this.minMinute, this.second - this.minSecond];
},
// 当前 date 是 start
currentDateIsStart() {
return this.year === this.startYear && this.month === this.startMonth && this.day === this.startDay;
},
// 当前 date 是 end
currentDateIsEnd() {
return this.year === this.endYear && this.month === this.endMonth && this.day === this.endDay;
},
// 当前年、月、日、时、分、秒的最小值和最大值
minYear() {
return this.startYear;
},
maxYear() {
return this.endYear;
},
minMonth() {
if (this.year === this.startYear) {
return this.startMonth;
} else {
return 1;
}
},
maxMonth() {
if (this.year === this.endYear) {
return this.endMonth;
} else {
return 12;
}
},
minDay() {
if (this.year === this.startYear && this.month === this.startMonth) {
return this.startDay;
} else {
return 1;
}
},
maxDay() {
if (this.year === this.endYear && this.month === this.endMonth) {
return this.endDay;
} else {
return this.daysInMonth(this.year, this.month);
}
},
minHour() {
if (this.type === "datetime") {
if (this.currentDateIsStart) {
return this.startHour;
} else {
return 0;
}
}
if (this.type === "time") {
return this.startHour;
}
},
maxHour() {
if (this.type === "datetime") {
if (this.currentDateIsEnd) {
return this.endHour;
} else {
return 23;
}
}
if (this.type === "time") {
return this.endHour;
}
},
minMinute() {
if (this.type === "datetime") {
if (this.currentDateIsStart && this.hour === this.startHour) {
return this.startMinute;
} else {
return 0;
}
}
if (this.type === "time") {
if (this.hour === this.startHour) {
return this.startMinute;
} else {
return 0;
}
}
},
maxMinute() {
if (this.type === "datetime") {
if (this.currentDateIsEnd && this.hour === this.endHour) {
return this.endMinute;
} else {
return 59;
}
}
if (this.type === "time") {
if (this.hour === this.endHour) {
return this.endMinute;
} else {
return 59;
}
}
},
minSecond() {
if (this.type === "datetime") {
if (this.currentDateIsStart && this.hour === this.startHour && this.minute === this.startMinute) {
return this.startSecond;
} else {
return 0;
}
}
if (this.type === "time") {
if (this.hour === this.startHour && this.minute === this.startMinute) {
return this.startSecond;
} else {
return 0;
}
}
},
maxSecond() {
if (this.type === "datetime") {
if (this.currentDateIsEnd && this.hour === this.endHour && this.minute === this.endMinute) {
return this.endSecond;
} else {
return 59;
}
}
if (this.type === "time") {
if (this.hour === this.endHour && this.minute === this.endMinute) {
return this.endSecond;
} else {
return 59;
}
}
},
/**
* for i18n
*/
selectTimeText() {
return t("uni-datetime-picker.selectTime");
},
okText() {
return t("uni-datetime-picker.ok");
},
clearText() {
return t("uni-datetime-picker.clear");
},
cancelText() {
return t("uni-datetime-picker.cancel");
}
},
mounted() {
},
methods: {
/**
* @param {Object} item
* 小于 10 在前面加个 0
*/
lessThanTen(item) {
return item < 10 ? "0" + item : item;
},
/**
* 解析时分秒字符串例如00:00:00
* @param {String} timeString
*/
parseTimeType(timeString) {
if (timeString) {
let timeArr = timeString.split(":");
this.hour = Number(timeArr[0]);
this.minute = Number(timeArr[1]);
this.second = Number(timeArr[2]);
}
},
/**
* 解析选择器初始值类型可以是字符串、时间戳例如2000-10-02、'08:30:00'、 1610695109000
* @param {String | Number} datetime
*/
initPickerValue(datetime) {
let defaultValue = null;
if (datetime) {
defaultValue = this.compareValueWithStartAndEnd(datetime, this.start, this.end);
} else {
defaultValue = Date.now();
defaultValue = this.compareValueWithStartAndEnd(defaultValue, this.start, this.end);
}
this.parseValue(defaultValue);
},
/**
* 初始值规则:
* - 用户设置初始值 value
* - 设置了起始时间 start、终止时间 end并 start < value < end初始值为 value 否则初始值为 start
* - 只设置了起始时间 start并 start < value初始值为 value否则初始值为 start
* - 只设置了终止时间 end并 value < end初始值为 value否则初始值为 end
* - 无起始终止时间,则初始值为 value
* - 无初始值 value则初始值为当前本地时间 Date.now()
* @param {Object} value
* @param {Object} dateBase
*/
compareValueWithStartAndEnd(value, start, end) {
let winner = null;
value = this.superTimeStamp(value);
start = this.superTimeStamp(start);
end = this.superTimeStamp(end);
if (start && end) {
if (value < start) {
winner = new Date(start);
} else if (value > end) {
winner = new Date(end);
} else {
winner = new Date(value);
}
} else if (start && !end) {
winner = start <= value ? new Date(value) : new Date(start);
} else if (!start && end) {
winner = value <= end ? new Date(value) : new Date(end);
} else {
winner = new Date(value);
}
return winner;
},
/**
* 转换为可比较的时间戳,接受日期、时分秒、时间戳
* @param {Object} value
*/
superTimeStamp(value) {
let dateBase = "";
if (this.type === "time" && value && typeof value === "string") {
const now = /* @__PURE__ */ new Date();
const year = now.getFullYear();
const month = now.getMonth() + 1;
const day = now.getDate();
dateBase = year + "/" + month + "/" + day + " ";
}
if (Number(value)) {
value = parseInt(value);
dateBase = 0;
}
return this.createTimeStamp(dateBase + value);
},
/**
* 解析默认值 value字符串、时间戳
* @param {Object} defaultTime
*/
parseValue(value) {
if (!value) {
return;
}
if (this.type === "time" && typeof value === "string") {
this.parseTimeType(value);
} else {
let defaultDate = null;
defaultDate = new Date(value);
if (this.type !== "time") {
this.year = defaultDate.getFullYear();
this.month = defaultDate.getMonth() + 1;
this.day = defaultDate.getDate();
}
if (this.type !== "date") {
this.hour = defaultDate.getHours();
this.minute = defaultDate.getMinutes();
this.second = defaultDate.getSeconds();
}
}
if (this.hideSecond) {
this.second = 0;
}
},
/**
* 解析可选择时间范围 start、end年月日字符串、时间戳
* @param {Object} defaultTime
*/
parseDatetimeRange(point, pointType) {
if (!point) {
if (pointType === "start") {
this.startYear = 1920;
this.startMonth = 1;
this.startDay = 1;
this.startHour = 0;
this.startMinute = 0;
this.startSecond = 0;
}
if (pointType === "end") {
this.endYear = 2120;
this.endMonth = 12;
this.endDay = 31;
this.endHour = 23;
this.endMinute = 59;
this.endSecond = 59;
}
return;
}
if (this.type === "time") {
const pointArr = point.split(":");
this[pointType + "Hour"] = Number(pointArr[0]);
this[pointType + "Minute"] = Number(pointArr[1]);
this[pointType + "Second"] = Number(pointArr[2]);
} else {
if (!point) {
pointType === "start" ? this.startYear = this.year - 60 : this.endYear = this.year + 60;
return;
}
if (Number(point)) {
point = parseInt(point);
}
const hasTime = /[0-9]:[0-9]/;
if (this.type === "datetime" && pointType === "end" && typeof point === "string" && !hasTime.test(
point
)) {
point = point + " 23:59:59";
}
const pointDate = new Date(point);
this[pointType + "Year"] = pointDate.getFullYear();
this[pointType + "Month"] = pointDate.getMonth() + 1;
this[pointType + "Day"] = pointDate.getDate();
if (this.type === "datetime") {
this[pointType + "Hour"] = pointDate.getHours();
this[pointType + "Minute"] = pointDate.getMinutes();
this[pointType + "Second"] = pointDate.getSeconds();
}
}
},
// 获取 年、月、日、时、分、秒 当前可选范围
getCurrentRange(value) {
const range = [];
for (let i = this["min" + this.capitalize(value)]; i <= this["max" + this.capitalize(value)]; i++) {
range.push(i);
}
return range;
},
// 字符串首字母大写
capitalize(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
},
// 检查当前值是否在范围内,不在则当前值重置为可选范围第一项
checkValue(name, value, values) {
if (values.indexOf(value) === -1) {
this[name] = values[0];
}
},
// 每个月的实际天数
daysInMonth(year, month) {
return new Date(year, month, 0).getDate();
},
/**
* 生成时间戳
* @param {Object} time
*/
createTimeStamp(time) {
if (!time)
return;
if (typeof time === "number") {
return time;
} else {
time = time.replace(/-/g, "/");
if (this.type === "date") {
time = time + " 00:00:00";
}
return Date.parse(time);
}
},
/**
* 生成日期或时间的字符串
*/
createDomSting() {
const yymmdd = this.year + "-" + this.lessThanTen(this.month) + "-" + this.lessThanTen(this.day);
let hhmmss = this.lessThanTen(this.hour) + ":" + this.lessThanTen(this.minute);
if (!this.hideSecond) {
hhmmss = hhmmss + ":" + this.lessThanTen(this.second);
}
if (this.type === "date") {
return yymmdd;
} else if (this.type === "time") {
return hhmmss;
} else {
return yymmdd + " " + hhmmss;
}
},
/**
* 初始化返回值,并抛出 change 事件
*/
initTime(emit = true) {
this.time = this.createDomSting();
if (!emit)
return;
if (this.returnType === "timestamp" && this.type !== "time") {
this.$emit("change", this.createTimeStamp(this.time));
this.$emit("input", this.createTimeStamp(this.time));
this.$emit("update:modelValue", this.createTimeStamp(this.time));
} else {
this.$emit("change", this.time);
this.$emit("input", this.time);
this.$emit("update:modelValue", this.time);
}
},
/**
* 用户选择日期或时间更新 data
* @param {Object} e
*/
bindDateChange(e) {
const val = e.detail.value;
this.year = this.years[val[0]];
this.month = this.months[val[1]];
this.day = this.days[val[2]];
},
bindTimeChange(e) {
const val = e.detail.value;
this.hour = this.hours[val[0]];
this.minute = this.minutes[val[1]];
this.second = this.seconds[val[2]];
},
/**
* 初始化弹出层
*/
initTimePicker() {
if (this.disabled)
return;
const value = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.fixIosDateFormat(this.time);
this.initPickerValue(value);
this.visible = !this.visible;
},
/**
* 触发或关闭弹框
*/
tiggerTimePicker(e) {
this.visible = !this.visible;
},
/**
* 用户点击“清空”按钮,清空当前值
*/
clearTime() {
this.time = "";
this.$emit("change", this.time);
this.$emit("input", this.time);
this.$emit("update:modelValue", this.time);
this.tiggerTimePicker();
},
/**
* 用户点击“确定”按钮
*/
setTime() {
this.initTime();
this.tiggerTimePicker();
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: common_vendor.t($data.time),
b: !$data.time
}, !$data.time ? {
c: common_vendor.t($options.selectTimeText)
} : {}, {
d: $props.disabled ? 1 : "",
e: $props.border ? 1 : "",
f: common_vendor.o((...args) => $options.initTimePicker && $options.initTimePicker(...args)),
g: $data.visible
}, $data.visible ? {
h: common_vendor.o((...args) => $options.tiggerTimePicker && $options.tiggerTimePicker(...args))
} : {}, {
i: $data.visible
}, $data.visible ? common_vendor.e({
j: common_vendor.t($options.selectTimeText),
k: $data.dateShow
}, $data.dateShow ? {
l: common_vendor.f($options.years, (item, index, i0) => {
return {
a: common_vendor.t($options.lessThanTen(item)),
b: index
};
}),
m: common_vendor.f($options.months, (item, index, i0) => {
return {
a: common_vendor.t($options.lessThanTen(item)),
b: index
};
}),
n: common_vendor.f($options.days, (item, index, i0) => {
return {
a: common_vendor.t($options.lessThanTen(item)),
b: index
};
}),
o: $data.indicatorStyle,
p: $options.ymd,
q: common_vendor.o((...args) => $options.bindDateChange && $options.bindDateChange(...args))
} : {}, {
r: $data.timeShow
}, $data.timeShow ? common_vendor.e({
s: common_vendor.f($options.hours, (item, index, i0) => {
return {
a: common_vendor.t($options.lessThanTen(item)),
b: index
};
}),
t: common_vendor.f($options.minutes, (item, index, i0) => {
return {
a: common_vendor.t($options.lessThanTen(item)),
b: index
};
}),
v: !$props.hideSecond
}, !$props.hideSecond ? {
w: common_vendor.f($options.seconds, (item, index, i0) => {
return {
a: common_vendor.t($options.lessThanTen(item)),
b: index
};
})
} : {}, {
x: common_vendor.n($props.hideSecond ? "time-hide-second" : ""),
y: $data.indicatorStyle,
z: $options.hms,
A: common_vendor.o((...args) => $options.bindTimeChange && $options.bindTimeChange(...args)),
B: common_vendor.n($props.hideSecond ? "sign-center" : "sign-left"),
C: !$props.hideSecond
}, !$props.hideSecond ? {} : {}) : {}, {
D: common_vendor.t($options.clearText),
E: common_vendor.o((...args) => $options.clearTime && $options.clearTime(...args)),
F: common_vendor.t($options.cancelText),
G: common_vendor.o((...args) => $options.tiggerTimePicker && $options.tiggerTimePicker(...args)),
H: common_vendor.t($options.okText),
I: common_vendor.o((...args) => $options.setTime && $options.setTime(...args)),
J: common_vendor.n($data.dateShow && $data.timeShow ? "" : "fix-nvue-height"),
K: common_vendor.s($data.fixNvueBug)
}) : {});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
my.createComponent(Component);

View File

@@ -0,0 +1,5 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {}
}

View File

@@ -0,0 +1,176 @@
.uni-date {
width: 100%;
flex: 1;
}
.uni-date-x {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
border-radius: 4px;
background-color: #fff;
color: #666;
font-size: 14px;
flex: 1;
}
.uni-date-x .icon-calendar {
padding-left: 3px;
}
.uni-date-x .range-separator {
height: 35px;
line-height: 35px;
}
.uni-date-x--border {
box-sizing: border-box;
border-radius: 4px;
border: 1px solid #e5e5e5;
}
.uni-date-editor--x {
display: flex;
align-items: center;
position: relative;
}
.uni-date-editor--x .uni-date__icon-clear {
padding-right: 3px;
display: flex;
align-items: center;
}
.uni-date__x-input {
width: auto;
height: 35px;
position: relative;
flex: 1;
line-height: 35px;
font-size: 14px;
overflow: hidden;
}
.text-center {
text-align: center;
}
.uni-date__input {
height: 40px;
width: 100%;
line-height: 40px;
font-size: 14px;
}
.uni-date-range__input {
text-align: center;
max-width: 142px;
}
.uni-date-picker__container {
position: relative;
}
.uni-date-mask--pc {
position: fixed;
bottom: 0px;
top: 0px;
left: 0px;
right: 0px;
background-color: rgba(0, 0, 0, 0);
transition-duration: 0.3s;
z-index: 996;
}
.uni-date-single--x {
background-color: #fff;
position: absolute;
top: 0;
z-index: 999;
border: 1px solid #EBEEF5;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
border-radius: 4px;
}
.uni-date-range--x {
background-color: #fff;
position: absolute;
top: 0;
z-index: 999;
border: 1px solid #EBEEF5;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
border-radius: 4px;
}
.uni-date-editor--x__disabled {
opacity: 0.4;
cursor: default;
}
.uni-date-editor--logo {
width: 16px;
height: 16px;
vertical-align: middle;
}
/* 添加时间 */
.popup-x-header {
display: flex;
flex-direction: row;
}
.popup-x-header--datetime {
display: flex;
flex-direction: row;
flex: 1;
}
.popup-x-body {
display: flex;
}
.popup-x-footer {
padding: 0 15px;
border-top-color: #F1F1F1;
border-top-style: solid;
border-top-width: 1px;
line-height: 40px;
text-align: right;
color: #666;
}
.popup-x-footer text:hover {
color: #007aff;
cursor: pointer;
opacity: 0.8;
}
.popup-x-footer .confirm-text {
margin-left: 20px;
color: #007aff;
}
.uni-date-changed {
text-align: center;
color: #333;
border-bottom-color: #F1F1F1;
border-bottom-style: solid;
border-bottom-width: 1px;
}
.uni-date-changed--time text {
height: 50px;
line-height: 50px;
}
.uni-date-changed .uni-date-changed--time {
flex: 1;
}
.uni-date-changed--time-date {
color: #333;
opacity: 0.6;
}
.mr-50 {
margin-right: 50px;
}
/* picker 弹出层通用的指示小三角, todo扩展至上下左右方向定位 */
.uni-popper__arrow,
.uni-popper__arrow::after {
position: absolute;
display: block;
width: 0;
height: 0;
border: 6px solid transparent;
border-top-width: 0;
}
.uni-popper__arrow {
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
top: -6px;
left: 10%;
margin-right: 3px;
border-bottom-color: #EBEEF5;
}
.uni-popper__arrow::after {
content: " ";
top: 1px;
margin-left: -6px;
border-bottom-color: #fff;
}

View File

@@ -0,0 +1 @@
<view class="uni-date"><view class="uni-date-editor" onTap="{{m}}"><slot><view class="{{('uni-date-editor--x') + ' ' + (k && 'uni-date-editor--x__disabled') + ' ' + (l && 'uni-date-x--border')}}"><view a:if="{{a}}" class="uni-date-x uni-date-single"><uni-icons class="icon-calendar" u-i="1884632a-0" onVI="__l" u-p="{{b}}"></uni-icons><view class="uni-date__x-input">{{c}}</view></view><view a:else class="uni-date-x uni-date-range"><uni-icons class="icon-calendar" u-i="1884632a-1" onVI="__l" u-p="{{d}}"></uni-icons><view class="uni-date__x-input text-center">{{e}}</view><view class="range-separator">{{f}}</view><view class="uni-date__x-input text-center">{{g}}</view></view><view a:if="{{h}}" class="uni-date__icon-clear" catchTap="{{j}}"><uni-icons u-i="1884632a-2" onVI="__l" u-p="{{i}}"></uni-icons></view></view></slot></view><view hidden="{{!n}}" class="uni-date-mask--pc" onTap="{{o}}"></view><view a:if="{{p}}" hidden="{{!ao}}" ref="datePicker" class="uni-date-picker__container"><view a:if="{{q}}" class="uni-date-single--x" style="{{H}}"><view class="uni-popper__arrow"></view><view a:if="{{r}}" class="uni-date-changed popup-x-header"><input class="uni-date__input text-center" type="text" placeholder="{{s}}" value="{{t}}" onInput="{{v}}"/><time-picker u-s="{{['d']}}" style="width:100%" u-i="1884632a-3" onVI="__l" onUpdateModelValue="{{A}}" u-p="{{B}}"><input class="uni-date__input text-center" type="text" placeholder="{{w}}" disabled="{{x}}" value="{{y}}" onInput="{{z}}"/></time-picker></view><calendar ref="__r" u-r="pcSingle" onChange="{{C}}" style="padding:0 8px" u-i="1884632a-4" onVI="__l" u-p="{{D}}"/><view a:if="{{E}}" class="popup-x-footer"><text class="confirm-text" onTap="{{G}}">{{F}}</text></view></view><view a:else class="uni-date-range--x" style="{{an}}"><view class="uni-popper__arrow"></view><view a:if="{{I}}" class="popup-x-header uni-date-changed"><view class="popup-x-header--datetime"><input class="uni-date__input uni-date-range__input" type="text" placeholder="{{J}}" value="{{K}}" onInput="{{L}}"/><time-picker u-s="{{['d']}}" u-i="1884632a-5" onVI="__l" onUpdateModelValue="{{Q}}" u-p="{{R}}"><input class="uni-date__input uni-date-range__input" type="text" placeholder="{{M}}" disabled="{{N}}" value="{{O}}" onInput="{{P}}"/></time-picker></view><uni-icons style="line-height:40px" u-i="1884632a-6" onVI="__l" u-p="{{S}}"></uni-icons><view class="popup-x-header--datetime"><input class="uni-date__input uni-date-range__input" type="text" placeholder="{{T}}" value="{{U}}" onInput="{{V}}"/><time-picker u-s="{{['d']}}" u-i="1884632a-7" onVI="__l" onUpdateModelValue="{{aa}}" u-p="{{ab}}"><input class="uni-date__input uni-date-range__input" type="text" placeholder="{{W}}" disabled="{{X}}" value="{{Y}}" onInput="{{Z}}"/></time-picker></view></view><view class="popup-x-body"><calendar ref="__r" u-r="left" onChange="{{ac}}" onFirstEnterCale="{{ad}}" style="padding:0 8px" u-i="1884632a-8" onVI="__l" u-p="{{ae}}"/><calendar ref="__r" u-r="right" onChange="{{af}}" onFirstEnterCale="{{ag}}" style="padding:0 8px;border-left:1px solid #F1F1F1" u-i="1884632a-9" onVI="__l" u-p="{{ah}}"/></view><view a:if="{{ai}}" class="popup-x-footer"><text onTap="{{ak}}">{{aj}}</text><text class="confirm-text" onTap="{{am}}">{{al}}</text></view></view></view><calendar a:if="{{ap}}" ref="__r" u-r="mobile" onConfirm="{{aq}}" onMaskClose="{{ar}}" onChange="{{as}}" u-i="1884632a-10" onVI="__l" u-p="{{at}}"/></view>

View File

@@ -0,0 +1,839 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const uni_modules_uniDatetimePicker_components_uniDatetimePicker_i18n_index = require("./i18n/index.js");
const uni_modules_uniDatetimePicker_components_uniDatetimePicker_util = require("./util.js");
const Calendar = () => "./calendar.js";
const TimePicker = () => "./time-picker.js";
const _sfc_main = {
name: "UniDatetimePicker",
options: {
virtualHost: true
},
components: {
Calendar,
TimePicker
},
data() {
return {
isRange: false,
hasTime: false,
displayValue: "",
inputDate: "",
calendarDate: "",
pickerTime: "",
calendarRange: {
startDate: "",
startTime: "",
endDate: "",
endTime: ""
},
displayRangeValue: {
startDate: "",
endDate: ""
},
tempRange: {
startDate: "",
startTime: "",
endDate: "",
endTime: ""
},
// 左右日历同步数据
startMultipleStatus: {
before: "",
after: "",
data: [],
fulldate: ""
},
endMultipleStatus: {
before: "",
after: "",
data: [],
fulldate: ""
},
pickerVisible: false,
pickerPositionStyle: null,
isEmitValue: false,
isPhone: false,
isFirstShow: true,
i18nT: () => {
}
};
},
props: {
type: {
type: String,
default: "datetime"
},
value: {
type: [String, Number, Array, Date],
default: ""
},
modelValue: {
type: [String, Number, Array, Date],
default: ""
},
start: {
type: [Number, String],
default: ""
},
end: {
type: [Number, String],
default: ""
},
returnType: {
type: String,
default: "string"
},
placeholder: {
type: String,
default: ""
},
startPlaceholder: {
type: String,
default: ""
},
endPlaceholder: {
type: String,
default: ""
},
rangeSeparator: {
type: String,
default: "-"
},
border: {
type: [Boolean],
default: true
},
disabled: {
type: [Boolean],
default: false
},
clearIcon: {
type: [Boolean],
default: true
},
hideSecond: {
type: [Boolean],
default: false
},
defaultValue: {
type: [String, Object, Array],
default: ""
}
},
watch: {
type: {
immediate: true,
handler(newVal) {
this.hasTime = newVal.indexOf("time") !== -1;
this.isRange = newVal.indexOf("range") !== -1;
}
},
modelValue: {
immediate: true,
handler(newVal) {
if (this.isEmitValue) {
this.isEmitValue = false;
return;
}
this.initPicker(newVal);
}
},
start: {
immediate: true,
handler(newVal) {
if (!newVal)
return;
this.calendarRange.startDate = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getDate(newVal);
if (this.hasTime) {
this.calendarRange.startTime = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getTime(newVal);
}
}
},
end: {
immediate: true,
handler(newVal) {
if (!newVal)
return;
this.calendarRange.endDate = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getDate(newVal);
if (this.hasTime) {
this.calendarRange.endTime = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getTime(newVal, this.hideSecond);
}
}
}
},
computed: {
timepickerStartTime() {
const activeDate = this.isRange ? this.tempRange.startDate : this.inputDate;
return activeDate === this.calendarRange.startDate ? this.calendarRange.startTime : "";
},
timepickerEndTime() {
const activeDate = this.isRange ? this.tempRange.endDate : this.inputDate;
return activeDate === this.calendarRange.endDate ? this.calendarRange.endTime : "";
},
mobileCalendarTime() {
const timeRange = {
start: this.tempRange.startTime,
end: this.tempRange.endTime
};
return this.isRange ? timeRange : this.pickerTime;
},
mobSelectableTime() {
return {
start: this.calendarRange.startTime,
end: this.calendarRange.endTime
};
},
datePopupWidth() {
return this.isRange ? 653 : 301;
},
/**
* for i18n
*/
singlePlaceholderText() {
return this.placeholder || (this.type === "date" ? this.selectDateText : this.selectDateTimeText);
},
startPlaceholderText() {
return this.startPlaceholder || this.startDateText;
},
endPlaceholderText() {
return this.endPlaceholder || this.endDateText;
},
selectDateText() {
return this.i18nT("uni-datetime-picker.selectDate");
},
selectDateTimeText() {
return this.i18nT("uni-datetime-picker.selectDateTime");
},
selectTimeText() {
return this.i18nT("uni-datetime-picker.selectTime");
},
startDateText() {
return this.startPlaceholder || this.i18nT("uni-datetime-picker.startDate");
},
startTimeText() {
return this.i18nT("uni-datetime-picker.startTime");
},
endDateText() {
return this.endPlaceholder || this.i18nT("uni-datetime-picker.endDate");
},
endTimeText() {
return this.i18nT("uni-datetime-picker.endTime");
},
okText() {
return this.i18nT("uni-datetime-picker.ok");
},
clearText() {
return this.i18nT("uni-datetime-picker.clear");
},
showClearIcon() {
return this.clearIcon && !this.disabled && (this.displayValue || this.displayRangeValue.startDate && this.displayRangeValue.endDate);
}
},
created() {
this.initI18nT();
this.platform();
},
methods: {
initI18nT() {
const vueI18n = common_vendor.initVueI18n(uni_modules_uniDatetimePicker_components_uniDatetimePicker_i18n_index.i18nMessages);
this.i18nT = vueI18n.t;
},
initPicker(newVal) {
if (!newVal && !this.defaultValue || Array.isArray(newVal) && !newVal.length) {
this.$nextTick(() => {
this.clear(false);
});
return;
}
if (!Array.isArray(newVal) && !this.isRange) {
if (newVal) {
this.displayValue = this.inputDate = this.calendarDate = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getDate(newVal);
if (this.hasTime) {
this.pickerTime = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getTime(newVal, this.hideSecond);
this.displayValue = `${this.displayValue} ${this.pickerTime}`;
}
} else if (this.defaultValue) {
this.inputDate = this.calendarDate = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getDate(this.defaultValue);
if (this.hasTime) {
this.pickerTime = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getTime(this.defaultValue, this.hideSecond);
}
}
} else {
const [before, after] = newVal;
if (!before && !after)
return;
const beforeDate = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getDate(before);
const beforeTime = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getTime(before, this.hideSecond);
const afterDate = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getDate(after);
const afterTime = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getTime(after, this.hideSecond);
const startDate = beforeDate;
const endDate = afterDate;
this.displayRangeValue.startDate = this.tempRange.startDate = startDate;
this.displayRangeValue.endDate = this.tempRange.endDate = endDate;
if (this.hasTime) {
this.displayRangeValue.startDate = `${beforeDate} ${beforeTime}`;
this.displayRangeValue.endDate = `${afterDate} ${afterTime}`;
this.tempRange.startTime = beforeTime;
this.tempRange.endTime = afterTime;
}
const defaultRange = {
before: beforeDate,
after: afterDate
};
this.startMultipleStatus = Object.assign({}, this.startMultipleStatus, defaultRange, {
which: "right"
});
this.endMultipleStatus = Object.assign({}, this.endMultipleStatus, defaultRange, {
which: "left"
});
}
},
updateLeftCale(e) {
const left = this.$refs.left;
left.cale.setHoverMultiple(e.after);
left.setDate(this.$refs.left.nowDate.fullDate);
},
updateRightCale(e) {
const right = this.$refs.right;
right.cale.setHoverMultiple(e.after);
right.setDate(this.$refs.right.nowDate.fullDate);
},
platform() {
if (typeof navigator !== "undefined") {
this.isPhone = navigator.userAgent.toLowerCase().indexOf("mobile") !== -1;
return;
}
const {
windowWidth
} = common_vendor.index.getSystemInfoSync();
this.isPhone = windowWidth <= 500;
this.windowWidth = windowWidth;
},
show() {
this.$emit("show");
if (this.disabled) {
return;
}
this.platform();
if (this.isPhone) {
setTimeout(() => {
this.$refs.mobile.open();
}, 0);
return;
}
this.pickerPositionStyle = {
top: "10px"
};
const dateEditor = common_vendor.index.createSelectorQuery().in(this).select(".uni-date-editor");
dateEditor.boundingClientRect((rect) => {
if (this.windowWidth - rect.left < this.datePopupWidth) {
this.pickerPositionStyle.right = 0;
}
}).exec();
setTimeout(() => {
this.pickerVisible = !this.pickerVisible;
if (!this.isPhone && this.isRange && this.isFirstShow) {
this.isFirstShow = false;
const {
startDate,
endDate
} = this.calendarRange;
if (startDate && endDate) {
if (this.diffDate(startDate, endDate) < 30) {
this.$refs.right.changeMonth("pre");
}
} else {
if (this.isPhone) {
this.$refs.right.cale.lastHover = false;
}
}
}
}, 50);
},
close() {
setTimeout(() => {
this.pickerVisible = false;
this.$emit("maskClick", this.value);
this.$refs.mobile && this.$refs.mobile.close();
}, 20);
},
setEmit(value) {
if (this.returnType === "timestamp" || this.returnType === "date") {
if (!Array.isArray(value)) {
if (!this.hasTime) {
value = value + " 00:00:00";
}
value = this.createTimestamp(value);
if (this.returnType === "date") {
value = new Date(value);
}
} else {
if (!this.hasTime) {
value[0] = value[0] + " 00:00:00";
value[1] = value[1] + " 00:00:00";
}
value[0] = this.createTimestamp(value[0]);
value[1] = this.createTimestamp(value[1]);
if (this.returnType === "date") {
value[0] = new Date(value[0]);
value[1] = new Date(value[1]);
}
}
}
this.$emit("update:modelValue", value);
this.$emit("input", value);
this.$emit("change", value);
this.isEmitValue = true;
},
createTimestamp(date) {
date = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.fixIosDateFormat(date);
return Date.parse(new Date(date));
},
singleChange(e) {
this.calendarDate = this.inputDate = e.fulldate;
if (this.hasTime)
return;
this.confirmSingleChange();
},
confirmSingleChange() {
if (!uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.checkDate(this.inputDate)) {
const now = /* @__PURE__ */ new Date();
this.calendarDate = this.inputDate = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getDate(now);
this.pickerTime = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getTime(now, this.hideSecond);
}
let startLaterInputDate = false;
let startDate, startTime;
if (this.start) {
let startString = this.start;
if (typeof this.start === "number") {
startString = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getDateTime(this.start, this.hideSecond);
}
[startDate, startTime] = startString.split(" ");
if (this.start && !uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.dateCompare(startDate, this.inputDate)) {
startLaterInputDate = true;
this.inputDate = startDate;
}
}
let endEarlierInputDate = false;
let endDate, endTime;
if (this.end) {
let endString = this.end;
if (typeof this.end === "number") {
endString = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getDateTime(this.end, this.hideSecond);
}
[endDate, endTime] = endString.split(" ");
if (this.end && !uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.dateCompare(this.inputDate, endDate)) {
endEarlierInputDate = true;
this.inputDate = endDate;
}
}
if (this.hasTime) {
if (startLaterInputDate) {
this.pickerTime = startTime || uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getDefaultSecond(this.hideSecond);
}
if (endEarlierInputDate) {
this.pickerTime = endTime || uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getDefaultSecond(this.hideSecond);
}
if (!this.pickerTime) {
this.pickerTime = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getTime(Date.now(), this.hideSecond);
}
this.displayValue = `${this.inputDate} ${this.pickerTime}`;
} else {
this.displayValue = this.inputDate;
}
this.setEmit(this.displayValue);
this.pickerVisible = false;
},
leftChange(e) {
const {
before,
after
} = e.range;
this.rangeChange(before, after);
const obj = {
before: e.range.before,
after: e.range.after,
data: e.range.data,
fulldate: e.fulldate
};
this.startMultipleStatus = Object.assign({}, this.startMultipleStatus, obj);
this.$emit("calendarClick", e);
},
rightChange(e) {
const {
before,
after
} = e.range;
this.rangeChange(before, after);
const obj = {
before: e.range.before,
after: e.range.after,
data: e.range.data,
fulldate: e.fulldate
};
this.endMultipleStatus = Object.assign({}, this.endMultipleStatus, obj);
this.$emit("calendarClick", e);
},
mobileChange(e) {
if (this.isRange) {
const {
before,
after
} = e.range;
if (!before) {
return;
}
this.handleStartAndEnd(before, after, true);
if (this.hasTime) {
const {
startTime,
endTime
} = e.timeRange;
this.tempRange.startTime = startTime;
this.tempRange.endTime = endTime;
}
this.confirmRangeChange();
} else {
if (this.hasTime) {
this.displayValue = e.fulldate + " " + e.time;
} else {
this.displayValue = e.fulldate;
}
this.setEmit(this.displayValue);
}
this.$refs.mobile.close();
},
rangeChange(before, after) {
if (!(before && after))
return;
this.handleStartAndEnd(before, after, true);
if (this.hasTime)
return;
this.confirmRangeChange();
},
confirmRangeChange() {
if (!this.tempRange.startDate || !this.tempRange.endDate) {
this.pickerVisible = false;
return;
}
if (!uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.checkDate(this.tempRange.startDate)) {
this.tempRange.startDate = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getDate(Date.now());
}
if (!uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.checkDate(this.tempRange.endDate)) {
this.tempRange.endDate = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getDate(Date.now());
}
let start, end;
let startDateLaterRangeStartDate = false;
let startDateLaterRangeEndDate = false;
let startDate, startTime;
if (this.start) {
let startString = this.start;
if (typeof this.start === "number") {
startString = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getDateTime(this.start, this.hideSecond);
}
[startDate, startTime] = startString.split(" ");
if (this.start && !uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.dateCompare(this.start, `${this.tempRange.startDate} ${this.tempRange.startTime}`)) {
startDateLaterRangeStartDate = true;
this.tempRange.startDate = startDate;
}
if (this.start && !uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.dateCompare(this.start, `${this.tempRange.endDate} ${this.tempRange.endTime}`)) {
startDateLaterRangeEndDate = true;
this.tempRange.endDate = startDate;
}
}
let endDateEarlierRangeStartDate = false;
let endDateEarlierRangeEndDate = false;
let endDate, endTime;
if (this.end) {
let endString = this.end;
if (typeof this.end === "number") {
endString = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getDateTime(this.end, this.hideSecond);
}
[endDate, endTime] = endString.split(" ");
if (this.end && !uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.dateCompare(`${this.tempRange.startDate} ${this.tempRange.startTime}`, this.end)) {
endDateEarlierRangeStartDate = true;
this.tempRange.startDate = endDate;
}
if (this.end && !uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.dateCompare(`${this.tempRange.endDate} ${this.tempRange.endTime}`, this.end)) {
endDateEarlierRangeEndDate = true;
this.tempRange.endDate = endDate;
}
}
if (!this.hasTime) {
start = this.displayRangeValue.startDate = this.tempRange.startDate;
end = this.displayRangeValue.endDate = this.tempRange.endDate;
} else {
if (startDateLaterRangeStartDate) {
this.tempRange.startTime = startTime || uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getDefaultSecond(this.hideSecond);
} else if (endDateEarlierRangeStartDate) {
this.tempRange.startTime = endTime || uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getDefaultSecond(this.hideSecond);
}
if (!this.tempRange.startTime) {
this.tempRange.startTime = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getTime(Date.now(), this.hideSecond);
}
if (startDateLaterRangeEndDate) {
this.tempRange.endTime = startTime || uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getDefaultSecond(this.hideSecond);
} else if (endDateEarlierRangeEndDate) {
this.tempRange.endTime = endTime || uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getDefaultSecond(this.hideSecond);
}
if (!this.tempRange.endTime) {
this.tempRange.endTime = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.getTime(Date.now(), this.hideSecond);
}
start = this.displayRangeValue.startDate = `${this.tempRange.startDate} ${this.tempRange.startTime}`;
end = this.displayRangeValue.endDate = `${this.tempRange.endDate} ${this.tempRange.endTime}`;
}
if (!uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.dateCompare(start, end)) {
[start, end] = [end, start];
}
this.displayRangeValue.startDate = start;
this.displayRangeValue.endDate = end;
const displayRange = [start, end];
this.setEmit(displayRange);
this.pickerVisible = false;
},
handleStartAndEnd(before, after, temp = false) {
if (!before)
return;
if (!after)
after = before;
const type = temp ? "tempRange" : "range";
const isStartEarlierEnd = uni_modules_uniDatetimePicker_components_uniDatetimePicker_util.dateCompare(before, after);
this[type].startDate = isStartEarlierEnd ? before : after;
this[type].endDate = isStartEarlierEnd ? after : before;
},
/**
* 比较时间大小
*/
dateCompare(startDate, endDate) {
startDate = new Date(startDate.replace("-", "/").replace("-", "/"));
endDate = new Date(endDate.replace("-", "/").replace("-", "/"));
return startDate <= endDate;
},
/**
* 比较时间差
*/
diffDate(startDate, endDate) {
startDate = new Date(startDate.replace("-", "/").replace("-", "/"));
endDate = new Date(endDate.replace("-", "/").replace("-", "/"));
const diff = (endDate - startDate) / (24 * 60 * 60 * 1e3);
return Math.abs(diff);
},
clear(needEmit = true) {
if (!this.isRange) {
this.displayValue = "";
this.inputDate = "";
this.pickerTime = "";
if (this.isPhone) {
this.$refs.mobile && this.$refs.mobile.clearCalender();
} else {
this.$refs.pcSingle && this.$refs.pcSingle.clearCalender();
}
if (needEmit) {
this.$emit("change", "");
this.$emit("input", "");
this.$emit("update:modelValue", "");
}
} else {
this.displayRangeValue.startDate = "";
this.displayRangeValue.endDate = "";
this.tempRange.startDate = "";
this.tempRange.startTime = "";
this.tempRange.endDate = "";
this.tempRange.endTime = "";
if (this.isPhone) {
this.$refs.mobile && this.$refs.mobile.clearCalender();
} else {
this.$refs.left && this.$refs.left.clearCalender();
this.$refs.right && this.$refs.right.clearCalender();
this.$refs.right && this.$refs.right.changeMonth("next");
}
if (needEmit) {
this.$emit("change", []);
this.$emit("input", []);
this.$emit("update:modelValue", []);
}
}
},
calendarClick(e) {
this.$emit("calendarClick", e);
}
}
};
if (!Array) {
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
const _component_time_picker = common_vendor.resolveComponent("time-picker");
const _component_Calendar = common_vendor.resolveComponent("Calendar");
(_easycom_uni_icons2 + _component_time_picker + _component_Calendar)();
}
const _easycom_uni_icons = () => "../../../uni-icons/components/uni-icons/uni-icons.js";
if (!Math) {
_easycom_uni_icons();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: !$data.isRange
}, !$data.isRange ? {
b: common_vendor.p({
type: "calendar",
color: "#c0c4cc",
size: "22"
}),
c: common_vendor.t($data.displayValue || $options.singlePlaceholderText)
} : {
d: common_vendor.p({
type: "calendar",
color: "#c0c4cc",
size: "22"
}),
e: common_vendor.t($data.displayRangeValue.startDate || $options.startPlaceholderText),
f: common_vendor.t($props.rangeSeparator),
g: common_vendor.t($data.displayRangeValue.endDate || $options.endPlaceholderText)
}, {
h: $options.showClearIcon
}, $options.showClearIcon ? {
i: common_vendor.p({
type: "clear",
color: "#c0c4cc",
size: "22"
}),
j: common_vendor.o((...args) => $options.clear && $options.clear(...args))
} : {}, {
k: $props.disabled ? 1 : "",
l: $props.border ? 1 : "",
m: common_vendor.o((...args) => $options.show && $options.show(...args)),
n: $data.pickerVisible,
o: common_vendor.o((...args) => $options.close && $options.close(...args)),
p: !$data.isPhone
}, !$data.isPhone ? common_vendor.e({
q: !$data.isRange
}, !$data.isRange ? common_vendor.e({
r: $data.hasTime
}, $data.hasTime ? {
s: $options.selectDateText,
t: $data.inputDate,
v: common_vendor.o(($event) => $data.inputDate = $event.detail.value),
w: $options.selectTimeText,
x: !$data.inputDate,
y: $data.pickerTime,
z: common_vendor.o(($event) => $data.pickerTime = $event.detail.value),
A: common_vendor.o(($event) => $data.pickerTime = $event),
B: common_vendor.p({
type: "time",
border: false,
disabled: !$data.inputDate,
start: $options.timepickerStartTime,
end: $options.timepickerEndTime,
hideSecond: $props.hideSecond,
modelValue: $data.pickerTime
})
} : {}, {
C: common_vendor.o($options.singleChange),
D: common_vendor.p({
showMonth: false,
["start-date"]: $data.calendarRange.startDate,
["end-date"]: $data.calendarRange.endDate,
date: $data.calendarDate,
["default-value"]: $props.defaultValue
}),
E: $data.hasTime
}, $data.hasTime ? {
F: common_vendor.t($options.okText),
G: common_vendor.o((...args) => $options.confirmSingleChange && $options.confirmSingleChange(...args))
} : {}, {
H: common_vendor.s($data.pickerPositionStyle)
}) : common_vendor.e({
I: $data.hasTime
}, $data.hasTime ? {
J: $options.startDateText,
K: $data.tempRange.startDate,
L: common_vendor.o(($event) => $data.tempRange.startDate = $event.detail.value),
M: $options.startTimeText,
N: !$data.tempRange.startDate,
O: $data.tempRange.startTime,
P: common_vendor.o(($event) => $data.tempRange.startTime = $event.detail.value),
Q: common_vendor.o(($event) => $data.tempRange.startTime = $event),
R: common_vendor.p({
type: "time",
start: $options.timepickerStartTime,
border: false,
disabled: !$data.tempRange.startDate,
hideSecond: $props.hideSecond,
modelValue: $data.tempRange.startTime
}),
S: common_vendor.p({
type: "arrowthinright",
color: "#999"
}),
T: $options.endDateText,
U: $data.tempRange.endDate,
V: common_vendor.o(($event) => $data.tempRange.endDate = $event.detail.value),
W: $options.endTimeText,
X: !$data.tempRange.endDate,
Y: $data.tempRange.endTime,
Z: common_vendor.o(($event) => $data.tempRange.endTime = $event.detail.value),
aa: common_vendor.o(($event) => $data.tempRange.endTime = $event),
ab: common_vendor.p({
type: "time",
end: $options.timepickerEndTime,
border: false,
disabled: !$data.tempRange.endDate,
hideSecond: $props.hideSecond,
modelValue: $data.tempRange.endTime
})
} : {}, {
ac: common_vendor.o($options.leftChange),
ad: common_vendor.o($options.updateRightCale),
ae: common_vendor.p({
showMonth: false,
["start-date"]: $data.calendarRange.startDate,
["end-date"]: $data.calendarRange.endDate,
range: true,
pleStatus: $data.endMultipleStatus
}),
af: common_vendor.o($options.rightChange),
ag: common_vendor.o($options.updateLeftCale),
ah: common_vendor.p({
showMonth: false,
["start-date"]: $data.calendarRange.startDate,
["end-date"]: $data.calendarRange.endDate,
range: true,
pleStatus: $data.startMultipleStatus
}),
ai: $data.hasTime
}, $data.hasTime ? {
aj: common_vendor.t($options.clearText),
ak: common_vendor.o((...args) => $options.clear && $options.clear(...args)),
al: common_vendor.t($options.okText),
am: common_vendor.o((...args) => $options.confirmRangeChange && $options.confirmRangeChange(...args))
} : {}, {
an: common_vendor.s($data.pickerPositionStyle)
}), {
ao: $data.pickerVisible
}) : {}, {
ap: $data.isPhone
}, $data.isPhone ? {
aq: common_vendor.o($options.mobileChange),
ar: common_vendor.o($options.close),
as: common_vendor.o($options.calendarClick),
at: common_vendor.p({
clearDate: false,
date: $data.calendarDate,
defTime: $options.mobileCalendarTime,
["start-date"]: $data.calendarRange.startDate,
["end-date"]: $data.calendarRange.endDate,
selectableTimes: $options.mobSelectableTime,
startPlaceholder: $props.startPlaceholder,
endPlaceholder: $props.endPlaceholder,
["default-value"]: $props.defaultValue,
pleStatus: $data.endMultipleStatus,
showMonth: false,
range: $data.isRange,
hasTime: $data.hasTime,
insert: false,
hideSecond: $props.hideSecond
})
} : {});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
my.createComponent(Component);

View File

@@ -0,0 +1,9 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {
"calendar": "./calendar",
"time-picker": "./time-picker",
"uni-icons": "../../../uni-icons/components/uni-icons/uni-icons"
}
}

View File

@@ -0,0 +1,365 @@
"use strict";
class Calendar {
constructor({
selected,
startDate,
endDate,
range
} = {}) {
this.date = this.getDateObj(/* @__PURE__ */ new Date());
this.selected = selected || [];
this.startDate = startDate;
this.endDate = endDate;
this.range = range;
this.cleanMultipleStatus();
this.weeks = {};
this.lastHover = false;
}
/**
* 设置日期
* @param {Object} date
*/
setDate(date) {
const selectDate = this.getDateObj(date);
this.getWeeks(selectDate.fullDate);
}
/**
* 清理多选状态
*/
cleanMultipleStatus() {
this.multipleStatus = {
before: "",
after: "",
data: []
};
}
setStartDate(startDate) {
this.startDate = startDate;
}
setEndDate(endDate) {
this.endDate = endDate;
}
getPreMonthObj(date) {
date = fixIosDateFormat(date);
date = new Date(date);
const oldMonth = date.getMonth();
date.setMonth(oldMonth - 1);
const newMonth = date.getMonth();
if (oldMonth !== 0 && newMonth - oldMonth === 0) {
date.setMonth(newMonth - 1);
}
return this.getDateObj(date);
}
getNextMonthObj(date) {
date = fixIosDateFormat(date);
date = new Date(date);
const oldMonth = date.getMonth();
date.setMonth(oldMonth + 1);
const newMonth = date.getMonth();
if (newMonth - oldMonth > 1) {
date.setMonth(newMonth - 1);
}
return this.getDateObj(date);
}
/**
* 获取指定格式Date对象
*/
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()
};
}
/**
* 获取上一个月日期集合
*/
getPreMonthDays(amount, dateObj) {
const result = [];
for (let i = amount - 1; i >= 0; i--) {
const month = dateObj.month - 1;
result.push({
date: new Date(dateObj.year, month, -i).getDate(),
month,
disable: true
});
}
return result;
}
/**
* 获取本月日期集合
*/
getCurrentMonthDays(amount, dateObj) {
const result = [];
const fullDate = this.date.fullDate;
for (let i = 1; i <= amount; i++) {
const currentDate = `${dateObj.year}-${dateObj.month}-${addZero(i)}`;
const isToday = fullDate === currentDate;
const info = this.selected && this.selected.find((item) => {
if (this.dateEqual(currentDate, item.date)) {
return item;
}
});
if (this.startDate) {
dateCompare(this.startDate, currentDate);
}
if (this.endDate) {
dateCompare(currentDate, this.endDate);
}
let multiples = this.multipleStatus.data;
let multiplesStatus = -1;
if (this.range && multiples) {
multiplesStatus = multiples.findIndex((item) => {
return this.dateEqual(item, currentDate);
});
}
const 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,
userChecked: false,
extraInfo: info
});
}
return result;
}
/**
* 获取下一个月日期集合
*/
_getNextMonthDays(amount, dateObj) {
const result = [];
const month = dateObj.month + 1;
for (let i = 1; i <= amount; i++) {
result.push({
date: i,
month,
disable: true
});
}
return result;
}
/**
* 获取当前日期详情
* @param {Object} date
*/
getInfo(date) {
if (!date) {
date = /* @__PURE__ */ new Date();
}
const res = this.calendar.find((item) => item.fullDate === this.getDateObj(date).fullDate);
return res ? res : this.getDateObj(date);
}
/**
* 比较时间是否相等
*/
dateEqual(before, after) {
before = new Date(fixIosDateFormat(before));
after = new Date(fixIosDateFormat(after));
return before.valueOf() === after.valueOf();
}
/**
* 比较真实起始日期
*/
isLogicBefore(currentDate, before, after) {
let logicBefore = before;
if (before && after) {
logicBefore = dateCompare(before, after) ? before : after;
}
return this.dateEqual(logicBefore, currentDate);
}
isLogicAfter(currentDate, before, after) {
let logicAfter = after;
if (before && after) {
logicAfter = dateCompare(before, after) ? after : before;
}
return this.dateEqual(logicAfter, currentDate);
}
/**
* 获取日期范围内所有日期
* @param {Object} begin
* @param {Object} end
*/
geDateAll(begin, end) {
var arr = [];
var ab = begin.split("-");
var ae = end.split("-");
var db = /* @__PURE__ */ new Date();
db.setFullYear(ab[0], ab[1] - 1, ab[2]);
var de = /* @__PURE__ */ new Date();
de.setFullYear(ae[0], ae[1] - 1, ae[2]);
var unixDb = db.getTime() - 24 * 60 * 60 * 1e3;
var unixDe = de.getTime() - 24 * 60 * 60 * 1e3;
for (var k = unixDb; k <= unixDe; ) {
k = k + 24 * 60 * 60 * 1e3;
arr.push(this.getDateObj(new Date(parseInt(k))).fullDate);
}
return arr;
}
/**
* 获取多选状态
*/
setMultiple(fullDate) {
if (!this.range)
return;
let {
before,
after
} = this.multipleStatus;
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 = void 0;
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 更新多选状态
*/
setHoverMultiple(fullDate) {
if (!this.range || this.lastHover)
return;
const {
before
} = this.multipleStatus;
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);
}
/**
* 更新默认值多选状态
*/
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
*/
getWeeks(dateData) {
const {
year,
month
} = this.getDateObj(dateData);
const preMonthDayAmount = new Date(year, month - 1, 1).getDay();
const preMonthDays = this.getPreMonthDays(preMonthDayAmount, this.getDateObj(dateData));
const currentMonthDayAmount = new Date(year, month, 0).getDate();
const currentMonthDays = this.getCurrentMonthDays(currentMonthDayAmount, this.getDateObj(dateData));
const nextMonthDayAmount = 42 - preMonthDayAmount - currentMonthDayAmount;
const nextMonthDays = this._getNextMonthDays(nextMonthDayAmount, this.getDateObj(dateData));
const calendarDays = [...preMonthDays, ...currentMonthDays, ...nextMonthDays];
const weeks = new Array(6);
for (let i = 0; i < calendarDays.length; i++) {
const 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;
}
}
function getDateTime(date, hideSecond) {
return `${getDate(date)} ${getTime(date, hideSecond)}`;
}
function getDate(date) {
date = fixIosDateFormat(date);
date = new Date(date);
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
return `${year}-${addZero(month)}-${addZero(day)}`;
}
function getTime(date, hideSecond) {
date = fixIosDateFormat(date);
date = new Date(date);
const hour = date.getHours();
const minute = date.getMinutes();
const second = date.getSeconds();
return hideSecond ? `${addZero(hour)}:${addZero(minute)}` : `${addZero(hour)}:${addZero(minute)}:${addZero(second)}`;
}
function addZero(num) {
if (num < 10) {
num = `0${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) {
const dateReg = /((19|20)\d{2})(-|\/)\d{1,2}(-|\/)\d{1,2}/g;
return date.match(dateReg);
}
const 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;
}
exports.Calendar = Calendar;
exports.checkDate = checkDate;
exports.dateCompare = dateCompare;
exports.fixIosDateFormat = fixIosDateFormat;
exports.getDate = getDate;
exports.getDateTime = getDateTime;
exports.getDefaultSecond = getDefaultSecond;
exports.getTime = getTime;

View File

@@ -0,0 +1,508 @@
.uniui-cart-filled:before {
content: "\e6d0";
}
.uniui-gift-filled:before {
content: "\e6c4";
}
.uniui-color:before {
content: "\e6cf";
}
.uniui-wallet:before {
content: "\e6b1";
}
.uniui-settings-filled:before {
content: "\e6ce";
}
.uniui-auth-filled:before {
content: "\e6cc";
}
.uniui-shop-filled:before {
content: "\e6cd";
}
.uniui-staff-filled:before {
content: "\e6cb";
}
.uniui-vip-filled:before {
content: "\e6c6";
}
.uniui-plus-filled:before {
content: "\e6c7";
}
.uniui-folder-add-filled:before {
content: "\e6c8";
}
.uniui-color-filled:before {
content: "\e6c9";
}
.uniui-tune-filled:before {
content: "\e6ca";
}
.uniui-calendar-filled:before {
content: "\e6c0";
}
.uniui-notification-filled:before {
content: "\e6c1";
}
.uniui-wallet-filled:before {
content: "\e6c2";
}
.uniui-medal-filled:before {
content: "\e6c3";
}
.uniui-fire-filled:before {
content: "\e6c5";
}
.uniui-refreshempty:before {
content: "\e6bf";
}
.uniui-location-filled:before {
content: "\e6af";
}
.uniui-person-filled:before {
content: "\e69d";
}
.uniui-personadd-filled:before {
content: "\e698";
}
.uniui-arrowthinleft:before {
content: "\e6d2";
}
.uniui-arrowthinup:before {
content: "\e6d3";
}
.uniui-arrowthindown:before {
content: "\e6d4";
}
.uniui-back:before {
content: "\e6b9";
}
.uniui-forward:before {
content: "\e6ba";
}
.uniui-arrow-right:before {
content: "\e6bb";
}
.uniui-arrow-left:before {
content: "\e6bc";
}
.uniui-arrow-up:before {
content: "\e6bd";
}
.uniui-arrow-down:before {
content: "\e6be";
}
.uniui-arrowthinright:before {
content: "\e6d1";
}
.uniui-down:before {
content: "\e6b8";
}
.uniui-bottom:before {
content: "\e6b8";
}
.uniui-arrowright:before {
content: "\e6d5";
}
.uniui-right:before {
content: "\e6b5";
}
.uniui-up:before {
content: "\e6b6";
}
.uniui-top:before {
content: "\e6b6";
}
.uniui-left:before {
content: "\e6b7";
}
.uniui-arrowup:before {
content: "\e6d6";
}
.uniui-eye:before {
content: "\e651";
}
.uniui-eye-filled:before {
content: "\e66a";
}
.uniui-eye-slash:before {
content: "\e6b3";
}
.uniui-eye-slash-filled:before {
content: "\e6b4";
}
.uniui-info-filled:before {
content: "\e649";
}
.uniui-reload:before {
content: "\e6b2";
}
.uniui-micoff-filled:before {
content: "\e6b0";
}
.uniui-map-pin-ellipse:before {
content: "\e6ac";
}
.uniui-map-pin:before {
content: "\e6ad";
}
.uniui-location:before {
content: "\e6ae";
}
.uniui-starhalf:before {
content: "\e683";
}
.uniui-star:before {
content: "\e688";
}
.uniui-star-filled:before {
content: "\e68f";
}
.uniui-calendar:before {
content: "\e6a0";
}
.uniui-fire:before {
content: "\e6a1";
}
.uniui-medal:before {
content: "\e6a2";
}
.uniui-font:before {
content: "\e6a3";
}
.uniui-gift:before {
content: "\e6a4";
}
.uniui-link:before {
content: "\e6a5";
}
.uniui-notification:before {
content: "\e6a6";
}
.uniui-staff:before {
content: "\e6a7";
}
.uniui-vip:before {
content: "\e6a8";
}
.uniui-folder-add:before {
content: "\e6a9";
}
.uniui-tune:before {
content: "\e6aa";
}
.uniui-auth:before {
content: "\e6ab";
}
.uniui-person:before {
content: "\e699";
}
.uniui-email-filled:before {
content: "\e69a";
}
.uniui-phone-filled:before {
content: "\e69b";
}
.uniui-phone:before {
content: "\e69c";
}
.uniui-email:before {
content: "\e69e";
}
.uniui-personadd:before {
content: "\e69f";
}
.uniui-chatboxes-filled:before {
content: "\e692";
}
.uniui-contact:before {
content: "\e693";
}
.uniui-chatbubble-filled:before {
content: "\e694";
}
.uniui-contact-filled:before {
content: "\e695";
}
.uniui-chatboxes:before {
content: "\e696";
}
.uniui-chatbubble:before {
content: "\e697";
}
.uniui-upload-filled:before {
content: "\e68e";
}
.uniui-upload:before {
content: "\e690";
}
.uniui-weixin:before {
content: "\e691";
}
.uniui-compose:before {
content: "\e67f";
}
.uniui-qq:before {
content: "\e680";
}
.uniui-download-filled:before {
content: "\e681";
}
.uniui-pyq:before {
content: "\e682";
}
.uniui-sound:before {
content: "\e684";
}
.uniui-trash-filled:before {
content: "\e685";
}
.uniui-sound-filled:before {
content: "\e686";
}
.uniui-trash:before {
content: "\e687";
}
.uniui-videocam-filled:before {
content: "\e689";
}
.uniui-spinner-cycle:before {
content: "\e68a";
}
.uniui-weibo:before {
content: "\e68b";
}
.uniui-videocam:before {
content: "\e68c";
}
.uniui-download:before {
content: "\e68d";
}
.uniui-help:before {
content: "\e679";
}
.uniui-navigate-filled:before {
content: "\e67a";
}
.uniui-plusempty:before {
content: "\e67b";
}
.uniui-smallcircle:before {
content: "\e67c";
}
.uniui-minus-filled:before {
content: "\e67d";
}
.uniui-micoff:before {
content: "\e67e";
}
.uniui-closeempty:before {
content: "\e66c";
}
.uniui-clear:before {
content: "\e66d";
}
.uniui-navigate:before {
content: "\e66e";
}
.uniui-minus:before {
content: "\e66f";
}
.uniui-image:before {
content: "\e670";
}
.uniui-mic:before {
content: "\e671";
}
.uniui-paperplane:before {
content: "\e672";
}
.uniui-close:before {
content: "\e673";
}
.uniui-help-filled:before {
content: "\e674";
}
.uniui-paperplane-filled:before {
content: "\e675";
}
.uniui-plus:before {
content: "\e676";
}
.uniui-mic-filled:before {
content: "\e677";
}
.uniui-image-filled:before {
content: "\e678";
}
.uniui-locked-filled:before {
content: "\e668";
}
.uniui-info:before {
content: "\e669";
}
.uniui-locked:before {
content: "\e66b";
}
.uniui-camera-filled:before {
content: "\e658";
}
.uniui-chat-filled:before {
content: "\e659";
}
.uniui-camera:before {
content: "\e65a";
}
.uniui-circle:before {
content: "\e65b";
}
.uniui-checkmarkempty:before {
content: "\e65c";
}
.uniui-chat:before {
content: "\e65d";
}
.uniui-circle-filled:before {
content: "\e65e";
}
.uniui-flag:before {
content: "\e65f";
}
.uniui-flag-filled:before {
content: "\e660";
}
.uniui-gear-filled:before {
content: "\e661";
}
.uniui-home:before {
content: "\e662";
}
.uniui-home-filled:before {
content: "\e663";
}
.uniui-gear:before {
content: "\e664";
}
.uniui-smallcircle-filled:before {
content: "\e665";
}
.uniui-map-filled:before {
content: "\e666";
}
.uniui-map:before {
content: "\e667";
}
.uniui-refresh-filled:before {
content: "\e656";
}
.uniui-refresh:before {
content: "\e657";
}
.uniui-cloud-upload:before {
content: "\e645";
}
.uniui-cloud-download-filled:before {
content: "\e646";
}
.uniui-cloud-download:before {
content: "\e647";
}
.uniui-cloud-upload-filled:before {
content: "\e648";
}
.uniui-redo:before {
content: "\e64a";
}
.uniui-images-filled:before {
content: "\e64b";
}
.uniui-undo-filled:before {
content: "\e64c";
}
.uniui-more:before {
content: "\e64d";
}
.uniui-more-filled:before {
content: "\e64e";
}
.uniui-undo:before {
content: "\e64f";
}
.uniui-images:before {
content: "\e650";
}
.uniui-paperclip:before {
content: "\e652";
}
.uniui-settings:before {
content: "\e653";
}
.uniui-search:before {
content: "\e654";
}
.uniui-redo-filled:before {
content: "\e655";
}
.uniui-list:before {
content: "\e644";
}
.uniui-mail-open-filled:before {
content: "\e63a";
}
.uniui-hand-down-filled:before {
content: "\e63c";
}
.uniui-hand-down:before {
content: "\e63d";
}
.uniui-hand-up-filled:before {
content: "\e63e";
}
.uniui-hand-up:before {
content: "\e63f";
}
.uniui-heart-filled:before {
content: "\e641";
}
.uniui-mail-open:before {
content: "\e643";
}
.uniui-heart:before {
content: "\e639";
}
.uniui-loop:before {
content: "\e633";
}
.uniui-pulldown:before {
content: "\e632";
}
.uniui-scan:before {
content: "\e62a";
}
.uniui-bars:before {
content: "\e627";
}
.uniui-checkbox:before {
content: "\e62b";
}
.uniui-checkbox-filled:before {
content: "\e62c";
}
.uniui-shop:before {
content: "\e62f";
}
.uniui-headphones:before {
content: "\e630";
}
.uniui-cart:before {
content: "\e631";
}
@font-face {
font-family: uniicons;
src: url("../../../../assets/uniicons.32e978a5.ttf");
}
.uni-icons {
font-family: uniicons;
text-decoration: none;
text-align: center;
}

View File

@@ -0,0 +1 @@
<text style="{{a}}" class="{{('uni-icons') + ' ' + b + ' ' + c + ' ' + d}}" onTap="{{e}}"><slot></slot></text>

View File

@@ -0,0 +1,72 @@
"use strict";
const uni_modules_uniIcons_components_uniIcons_uniicons_file_vue = require("./uniicons_file_vue.js");
const common_vendor = require("../../../../common/vendor.js");
const getVal = (val) => {
const reg = /^[0-9]*$/g;
return typeof val === "number" || reg.test(val) ? val + "px" : val;
};
const _sfc_main = {
name: "UniIcons",
emits: ["click"],
props: {
type: {
type: String,
default: ""
},
color: {
type: String,
default: "#333333"
},
size: {
type: [Number, String],
default: 16
},
customPrefix: {
type: String,
default: ""
},
fontFamily: {
type: String,
default: ""
}
},
data() {
return {
icons: uni_modules_uniIcons_components_uniIcons_uniicons_file_vue.fontData
};
},
computed: {
unicode() {
let code = this.icons.find((v) => v.font_class === this.type);
if (code) {
return code.unicode;
}
return "";
},
iconSize() {
return getVal(this.size);
},
styleObj() {
if (this.fontFamily !== "") {
return `color: ${this.color}; font-size: ${this.iconSize}; font-family: ${this.fontFamily};`;
}
return `color: ${this.color}; font-size: ${this.iconSize};`;
}
},
methods: {
_onClick() {
this.$emit("click");
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.s($options.styleObj),
b: common_vendor.n("uniui-" + $props.type),
c: common_vendor.n($props.customPrefix),
d: common_vendor.n($props.customPrefix ? $props.type : ""),
e: common_vendor.o((...args) => $options._onClick && $options._onClick(...args))
};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
my.createComponent(Component);

View File

@@ -0,0 +1,5 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {}
}

View File

@@ -0,0 +1,648 @@
"use strict";
const fontData = [
{
"font_class": "arrow-down",
"unicode": ""
},
{
"font_class": "arrow-left",
"unicode": ""
},
{
"font_class": "arrow-right",
"unicode": ""
},
{
"font_class": "arrow-up",
"unicode": ""
},
{
"font_class": "auth",
"unicode": ""
},
{
"font_class": "auth-filled",
"unicode": ""
},
{
"font_class": "back",
"unicode": ""
},
{
"font_class": "bars",
"unicode": ""
},
{
"font_class": "calendar",
"unicode": ""
},
{
"font_class": "calendar-filled",
"unicode": ""
},
{
"font_class": "camera",
"unicode": ""
},
{
"font_class": "camera-filled",
"unicode": ""
},
{
"font_class": "cart",
"unicode": ""
},
{
"font_class": "cart-filled",
"unicode": ""
},
{
"font_class": "chat",
"unicode": ""
},
{
"font_class": "chat-filled",
"unicode": ""
},
{
"font_class": "chatboxes",
"unicode": ""
},
{
"font_class": "chatboxes-filled",
"unicode": ""
},
{
"font_class": "chatbubble",
"unicode": ""
},
{
"font_class": "chatbubble-filled",
"unicode": ""
},
{
"font_class": "checkbox",
"unicode": ""
},
{
"font_class": "checkbox-filled",
"unicode": ""
},
{
"font_class": "checkmarkempty",
"unicode": ""
},
{
"font_class": "circle",
"unicode": ""
},
{
"font_class": "circle-filled",
"unicode": ""
},
{
"font_class": "clear",
"unicode": ""
},
{
"font_class": "close",
"unicode": ""
},
{
"font_class": "closeempty",
"unicode": ""
},
{
"font_class": "cloud-download",
"unicode": ""
},
{
"font_class": "cloud-download-filled",
"unicode": ""
},
{
"font_class": "cloud-upload",
"unicode": ""
},
{
"font_class": "cloud-upload-filled",
"unicode": ""
},
{
"font_class": "color",
"unicode": ""
},
{
"font_class": "color-filled",
"unicode": ""
},
{
"font_class": "compose",
"unicode": ""
},
{
"font_class": "contact",
"unicode": ""
},
{
"font_class": "contact-filled",
"unicode": ""
},
{
"font_class": "down",
"unicode": ""
},
{
"font_class": "bottom",
"unicode": ""
},
{
"font_class": "download",
"unicode": ""
},
{
"font_class": "download-filled",
"unicode": ""
},
{
"font_class": "email",
"unicode": ""
},
{
"font_class": "email-filled",
"unicode": ""
},
{
"font_class": "eye",
"unicode": ""
},
{
"font_class": "eye-filled",
"unicode": ""
},
{
"font_class": "eye-slash",
"unicode": ""
},
{
"font_class": "eye-slash-filled",
"unicode": ""
},
{
"font_class": "fire",
"unicode": ""
},
{
"font_class": "fire-filled",
"unicode": ""
},
{
"font_class": "flag",
"unicode": ""
},
{
"font_class": "flag-filled",
"unicode": ""
},
{
"font_class": "folder-add",
"unicode": ""
},
{
"font_class": "folder-add-filled",
"unicode": ""
},
{
"font_class": "font",
"unicode": ""
},
{
"font_class": "forward",
"unicode": ""
},
{
"font_class": "gear",
"unicode": ""
},
{
"font_class": "gear-filled",
"unicode": ""
},
{
"font_class": "gift",
"unicode": ""
},
{
"font_class": "gift-filled",
"unicode": ""
},
{
"font_class": "hand-down",
"unicode": ""
},
{
"font_class": "hand-down-filled",
"unicode": ""
},
{
"font_class": "hand-up",
"unicode": ""
},
{
"font_class": "hand-up-filled",
"unicode": ""
},
{
"font_class": "headphones",
"unicode": ""
},
{
"font_class": "heart",
"unicode": ""
},
{
"font_class": "heart-filled",
"unicode": ""
},
{
"font_class": "help",
"unicode": ""
},
{
"font_class": "help-filled",
"unicode": ""
},
{
"font_class": "home",
"unicode": ""
},
{
"font_class": "home-filled",
"unicode": ""
},
{
"font_class": "image",
"unicode": ""
},
{
"font_class": "image-filled",
"unicode": ""
},
{
"font_class": "images",
"unicode": ""
},
{
"font_class": "images-filled",
"unicode": ""
},
{
"font_class": "info",
"unicode": ""
},
{
"font_class": "info-filled",
"unicode": ""
},
{
"font_class": "left",
"unicode": ""
},
{
"font_class": "link",
"unicode": ""
},
{
"font_class": "list",
"unicode": ""
},
{
"font_class": "location",
"unicode": ""
},
{
"font_class": "location-filled",
"unicode": ""
},
{
"font_class": "locked",
"unicode": ""
},
{
"font_class": "locked-filled",
"unicode": ""
},
{
"font_class": "loop",
"unicode": ""
},
{
"font_class": "mail-open",
"unicode": ""
},
{
"font_class": "mail-open-filled",
"unicode": ""
},
{
"font_class": "map",
"unicode": ""
},
{
"font_class": "map-filled",
"unicode": ""
},
{
"font_class": "map-pin",
"unicode": ""
},
{
"font_class": "map-pin-ellipse",
"unicode": ""
},
{
"font_class": "medal",
"unicode": ""
},
{
"font_class": "medal-filled",
"unicode": ""
},
{
"font_class": "mic",
"unicode": ""
},
{
"font_class": "mic-filled",
"unicode": ""
},
{
"font_class": "micoff",
"unicode": ""
},
{
"font_class": "micoff-filled",
"unicode": ""
},
{
"font_class": "minus",
"unicode": ""
},
{
"font_class": "minus-filled",
"unicode": ""
},
{
"font_class": "more",
"unicode": ""
},
{
"font_class": "more-filled",
"unicode": ""
},
{
"font_class": "navigate",
"unicode": ""
},
{
"font_class": "navigate-filled",
"unicode": ""
},
{
"font_class": "notification",
"unicode": ""
},
{
"font_class": "notification-filled",
"unicode": ""
},
{
"font_class": "paperclip",
"unicode": ""
},
{
"font_class": "paperplane",
"unicode": ""
},
{
"font_class": "paperplane-filled",
"unicode": ""
},
{
"font_class": "person",
"unicode": ""
},
{
"font_class": "person-filled",
"unicode": ""
},
{
"font_class": "personadd",
"unicode": ""
},
{
"font_class": "personadd-filled",
"unicode": ""
},
{
"font_class": "personadd-filled-copy",
"unicode": ""
},
{
"font_class": "phone",
"unicode": ""
},
{
"font_class": "phone-filled",
"unicode": ""
},
{
"font_class": "plus",
"unicode": ""
},
{
"font_class": "plus-filled",
"unicode": ""
},
{
"font_class": "plusempty",
"unicode": ""
},
{
"font_class": "pulldown",
"unicode": ""
},
{
"font_class": "pyq",
"unicode": ""
},
{
"font_class": "qq",
"unicode": ""
},
{
"font_class": "redo",
"unicode": ""
},
{
"font_class": "redo-filled",
"unicode": ""
},
{
"font_class": "refresh",
"unicode": ""
},
{
"font_class": "refresh-filled",
"unicode": ""
},
{
"font_class": "refreshempty",
"unicode": ""
},
{
"font_class": "reload",
"unicode": ""
},
{
"font_class": "right",
"unicode": ""
},
{
"font_class": "scan",
"unicode": ""
},
{
"font_class": "search",
"unicode": ""
},
{
"font_class": "settings",
"unicode": ""
},
{
"font_class": "settings-filled",
"unicode": ""
},
{
"font_class": "shop",
"unicode": ""
},
{
"font_class": "shop-filled",
"unicode": ""
},
{
"font_class": "smallcircle",
"unicode": ""
},
{
"font_class": "smallcircle-filled",
"unicode": ""
},
{
"font_class": "sound",
"unicode": ""
},
{
"font_class": "sound-filled",
"unicode": ""
},
{
"font_class": "spinner-cycle",
"unicode": ""
},
{
"font_class": "staff",
"unicode": ""
},
{
"font_class": "staff-filled",
"unicode": ""
},
{
"font_class": "star",
"unicode": ""
},
{
"font_class": "star-filled",
"unicode": ""
},
{
"font_class": "starhalf",
"unicode": ""
},
{
"font_class": "trash",
"unicode": ""
},
{
"font_class": "trash-filled",
"unicode": ""
},
{
"font_class": "tune",
"unicode": ""
},
{
"font_class": "tune-filled",
"unicode": ""
},
{
"font_class": "undo",
"unicode": ""
},
{
"font_class": "undo-filled",
"unicode": ""
},
{
"font_class": "up",
"unicode": ""
},
{
"font_class": "top",
"unicode": ""
},
{
"font_class": "upload",
"unicode": ""
},
{
"font_class": "upload-filled",
"unicode": ""
},
{
"font_class": "videocam",
"unicode": ""
},
{
"font_class": "videocam-filled",
"unicode": ""
},
{
"font_class": "vip",
"unicode": ""
},
{
"font_class": "vip-filled",
"unicode": ""
},
{
"font_class": "wallet",
"unicode": ""
},
{
"font_class": "wallet-filled",
"unicode": ""
},
{
"font_class": "weibo",
"unicode": ""
},
{
"font_class": "weixin",
"unicode": ""
}
];
exports.fontData = fontData;

View File

@@ -0,0 +1,74 @@
.uni-popup-dialog {
width: 300px;
border-radius: 11px;
background-color: #fff;
}
.uni-dialog-title {
display: flex;
flex-direction: row;
justify-content: center;
padding-top: 25px;
}
.uni-dialog-title-text {
font-size: 16px;
font-weight: 500;
}
.uni-dialog-content {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
padding: 20px;
}
.uni-dialog-content-text {
font-size: 14px;
color: #6C6C6C;
}
.uni-dialog-button-group {
display: flex;
flex-direction: row;
border-top-color: #f5f5f5;
border-top-style: solid;
border-top-width: 1px;
}
.uni-dialog-button {
display: flex;
flex: 1;
flex-direction: row;
justify-content: center;
align-items: center;
height: 45px;
}
.uni-border-left {
border-left-color: #f0f0f0;
border-left-style: solid;
border-left-width: 1px;
}
.uni-dialog-button-text {
font-size: 16px;
color: #333;
}
.uni-button-color {
color: #007aff;
}
.uni-dialog-input {
flex: 1;
font-size: 14px;
border: 1px #eee solid;
height: 40px;
padding: 0 10px;
border-radius: 5px;
color: #555;
}
.uni-popup__success {
color: #4cd964;
}
.uni-popup__warn {
color: #f0ad4e;
}
.uni-popup__error {
color: #dd524d;
}
.uni-popup__info {
color: #909399;
}

View File

@@ -0,0 +1 @@
<view class="uni-popup-dialog"><view class="uni-dialog-title"><text class="{{('uni-dialog-title-text') + ' ' + b}}">{{a}}</text></view><view a:if="{{c}}" class="uni-dialog-content"><slot><text class="uni-dialog-content-text">{{d}}</text></slot></view><view a:else class="uni-dialog-content"><slot><input class="uni-dialog-input" maxlength="{{e}}" type="{{f}}" placeholder="{{g}}" focus="{{h}}" value="{{i}}" onInput="{{j}}"></input></slot></view><view class="uni-dialog-button-group"><view a:if="{{k}}" class="uni-dialog-button" onTap="{{m}}"><text class="uni-dialog-button-text">{{l}}</text></view><view class="{{('uni-dialog-button') + ' ' + o}}" onTap="{{p}}"><text class="uni-dialog-button-text uni-button-color">{{n}}</text></view></view></view>

View File

@@ -0,0 +1,170 @@
"use strict";
const uni_modules_uniPopup_components_uniPopup_popup = require("../uni-popup/popup.js");
const common_vendor = require("../../../../common/vendor.js");
const uni_modules_uniPopup_components_uniPopup_i18n_index = require("../uni-popup/i18n/index.js");
const {
t
} = common_vendor.initVueI18n(uni_modules_uniPopup_components_uniPopup_i18n_index.messages);
const _sfc_main = {
name: "uniPopupDialog",
mixins: [uni_modules_uniPopup_components_uniPopup_popup.popup],
emits: ["confirm", "close", "update:modelValue", "input"],
props: {
inputType: {
type: String,
default: "text"
},
showClose: {
type: Boolean,
default: true
},
modelValue: {
type: [Number, String],
default: ""
},
placeholder: {
type: [String, Number],
default: ""
},
type: {
type: String,
default: "error"
},
mode: {
type: String,
default: "base"
},
title: {
type: String,
default: ""
},
content: {
type: String,
default: ""
},
beforeClose: {
type: Boolean,
default: false
},
cancelText: {
type: String,
default: ""
},
confirmText: {
type: String,
default: ""
},
maxlength: {
type: Number,
default: -1
},
focus: {
type: Boolean,
default: true
}
},
data() {
return {
dialogType: "error",
val: ""
};
},
computed: {
okText() {
return this.confirmText || t("uni-popup.ok");
},
closeText() {
return this.cancelText || t("uni-popup.cancel");
},
placeholderText() {
return this.placeholder || t("uni-popup.placeholder");
},
titleText() {
return this.title || t("uni-popup.title");
}
},
watch: {
type(val) {
this.dialogType = val;
},
mode(val) {
if (val === "input") {
this.dialogType = "info";
}
},
value(val) {
if (this.maxlength != -1 && this.mode === "input") {
this.val = val.slice(0, this.maxlength);
} else {
this.val = val;
}
},
val(val) {
this.$emit("update:modelValue", val);
}
},
created() {
this.popup.disableMask();
if (this.mode === "input") {
this.dialogType = "info";
this.val = this.value;
this.val = this.modelValue;
} else {
this.dialogType = this.type;
}
},
methods: {
/**
* 点击确认按钮
*/
onOk() {
if (this.mode === "input") {
this.$emit("confirm", this.val);
} else {
this.$emit("confirm");
}
if (this.beforeClose)
return;
this.popup.close();
},
/**
* 点击取消按钮
*/
closeDialog() {
this.$emit("close");
if (this.beforeClose)
return;
this.popup.close();
},
close() {
this.popup.close();
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: common_vendor.t($options.titleText),
b: common_vendor.n("uni-popup__" + $data.dialogType),
c: $props.mode === "base"
}, $props.mode === "base" ? {
d: common_vendor.t($props.content)
} : {
e: $props.maxlength,
f: $props.inputType,
g: $options.placeholderText,
h: $props.focus,
i: $data.val,
j: common_vendor.o(($event) => $data.val = $event.detail.value)
}, {
k: $props.showClose
}, $props.showClose ? {
l: common_vendor.t($options.closeText),
m: common_vendor.o((...args) => $options.closeDialog && $options.closeDialog(...args))
} : {}, {
n: common_vendor.t($options.okText),
o: common_vendor.n($props.showClose ? "uni-border-left" : ""),
p: common_vendor.o((...args) => $options.onOk && $options.onOk(...args))
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
my.createComponent(Component);

View File

@@ -0,0 +1,5 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {}
}

View File

@@ -0,0 +1,28 @@
"use strict";
const en = {
"uni-popup.cancel": "cancel",
"uni-popup.ok": "ok",
"uni-popup.placeholder": "pleace enter",
"uni-popup.title": "Hint",
"uni-popup.shareTitle": "Share to"
};
const zhHans = {
"uni-popup.cancel": "取消",
"uni-popup.ok": "确定",
"uni-popup.placeholder": "请输入",
"uni-popup.title": "提示",
"uni-popup.shareTitle": "分享到"
};
const zhHant = {
"uni-popup.cancel": "取消",
"uni-popup.ok": "確定",
"uni-popup.placeholder": "請輸入",
"uni-popup.title": "提示",
"uni-popup.shareTitle": "分享到"
};
const messages = {
en,
"zh-Hans": zhHans,
"zh-Hant": zhHant
};
exports.messages = messages;

View File

@@ -0,0 +1,26 @@
"use strict";
const popup = {
data() {
return {};
},
created() {
this.popup = this.getParent();
},
methods: {
/**
* 获取父元素实例
*/
getParent(name = "uniPopup") {
let parent = this.$parent;
let parentName = parent.$options.name;
while (parentName !== name) {
parent = parent.$parent;
if (!parent)
return false;
parentName = parent.$options.name;
}
return parent;
}
}
};
exports.popup = popup;

View File

@@ -0,0 +1,22 @@
.uni-popup {
position: fixed;
z-index: 99;
}
.uni-popup.top, .uni-popup.left, .uni-popup.right {
top: 0;
}
.uni-popup .uni-popup__wrapper {
display: block;
position: relative;
/* iphonex 等安全区设置,底部安全区适配 */
}
.uni-popup .uni-popup__wrapper.left, .uni-popup .uni-popup__wrapper.right {
padding-top: 0;
flex: 1;
}
.fixforpc-z-index {
z-index: 999;
}
.fixforpc-top {
top: 0;
}

View File

@@ -0,0 +1 @@
<view a:if="{{a}}" class="{{('uni-popup') + ' ' + k + ' ' + l}}"><view onTouchStart="{{j}}"><uni-transition a:if="{{b}}" key="1" onClick="{{c}}" u-i="2f4ad777-0" onVI="__l" u-p="{{d}}"/><uni-transition u-s="{{['d']}}" key="2" onClick="{{h}}" u-i="2f4ad777-1" onVI="__l" u-p="{{i}}"><view style="{{e}}" class="{{('uni-popup__wrapper') + ' ' + f}}" onTap="{{g}}"><slot/></view></uni-transition></view></view>

View File

@@ -0,0 +1,393 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const _sfc_main = {
name: "uniPopup",
components: {},
emits: ["change", "maskClick"],
props: {
// 开启动画
animation: {
type: Boolean,
default: true
},
// 弹出层类型可选值top: 顶部弹出层bottom底部弹出层center全屏弹出层
// message: 消息提示 ; dialog : 对话框
type: {
type: String,
default: "center"
},
// maskClick
isMaskClick: {
type: Boolean,
default: null
},
// TODO 2 个版本后废弃属性 ,使用 isMaskClick
maskClick: {
type: Boolean,
default: null
},
backgroundColor: {
type: String,
default: "none"
},
safeArea: {
type: Boolean,
default: true
},
maskBackgroundColor: {
type: String,
default: "rgba(0, 0, 0, 0.4)"
},
borderRadius: {
type: String
}
},
watch: {
/**
* 监听type类型
*/
type: {
handler: function(type) {
if (!this.config[type])
return;
this[this.config[type]](true);
},
immediate: true
},
isDesktop: {
handler: function(newVal) {
if (!this.config[newVal])
return;
this[this.config[this.type]](true);
},
immediate: true
},
/**
* 监听遮罩是否可点击
* @param {Object} val
*/
maskClick: {
handler: function(val) {
this.mkclick = val;
},
immediate: true
},
isMaskClick: {
handler: function(val) {
this.mkclick = val;
},
immediate: true
},
// H5 下禁止底部滚动
showPopup(show) {
}
},
data() {
return {
duration: 300,
ani: [],
showPopup: false,
showTrans: false,
popupWidth: 0,
popupHeight: 0,
config: {
top: "top",
bottom: "bottom",
center: "center",
left: "left",
right: "right",
message: "top",
dialog: "center",
share: "bottom"
},
maskClass: {
position: "fixed",
bottom: 0,
top: 0,
left: 0,
right: 0,
backgroundColor: "rgba(0, 0, 0, 0.4)"
},
transClass: {
backgroundColor: "transparent",
borderRadius: this.borderRadius || "0",
position: "fixed",
left: 0,
right: 0
},
maskShow: true,
mkclick: true,
popupstyle: "top"
};
},
computed: {
getStyles() {
let res = { backgroundColor: this.bg };
if (this.borderRadius || "0") {
res = Object.assign(res, { borderRadius: this.borderRadius });
}
return res;
},
isDesktop() {
return this.popupWidth >= 500 && this.popupHeight >= 500;
},
bg() {
if (this.backgroundColor === "" || this.backgroundColor === "none") {
return "transparent";
}
return this.backgroundColor;
}
},
mounted() {
const fixSize = () => {
const {
windowWidth,
windowHeight,
windowTop,
safeArea,
screenHeight,
safeAreaInsets
} = common_vendor.index.getSystemInfoSync();
this.popupWidth = windowWidth;
this.popupHeight = windowHeight + (windowTop || 0);
if (safeArea && this.safeArea) {
this.safeAreaInsets = safeAreaInsets.bottom;
} else {
this.safeAreaInsets = 0;
}
};
fixSize();
},
// TODO vue3
unmounted() {
this.setH5Visible();
},
activated() {
this.setH5Visible(!this.showPopup);
},
deactivated() {
this.setH5Visible(true);
},
created() {
if (this.isMaskClick === null && this.maskClick === null) {
this.mkclick = true;
} else {
this.mkclick = this.isMaskClick !== null ? this.isMaskClick : this.maskClick;
}
if (this.animation) {
this.duration = 300;
} else {
this.duration = 0;
}
this.messageChild = null;
this.clearPropagation = false;
this.maskClass.backgroundColor = this.maskBackgroundColor;
},
methods: {
setH5Visible(visible = true) {
},
/**
* 公用方法,不显示遮罩层
*/
closeMask() {
this.maskShow = false;
},
/**
* 公用方法,遮罩层禁止点击
*/
disableMask() {
this.mkclick = false;
},
// TODO nvue 取消冒泡
clear(e) {
e.stopPropagation();
this.clearPropagation = true;
},
open(direction) {
if (this.showPopup) {
return;
}
let innerType = ["top", "center", "bottom", "left", "right", "message", "dialog", "share"];
if (!(direction && innerType.indexOf(direction) !== -1)) {
direction = this.type;
}
if (!this.config[direction]) {
console.error("缺少类型:", direction);
return;
}
this[this.config[direction]]();
this.$emit("change", {
show: true,
type: direction
});
},
close(type) {
this.showTrans = false;
this.$emit("change", {
show: false,
type: this.type
});
clearTimeout(this.timer);
this.timer = setTimeout(() => {
this.showPopup = false;
}, 300);
},
// TODO 处理冒泡事件,头条的冒泡事件有问题 ,先这样兼容
touchstart() {
this.clearPropagation = false;
},
onTap() {
if (this.clearPropagation) {
this.clearPropagation = false;
return;
}
this.$emit("maskClick");
if (!this.mkclick)
return;
this.close();
},
/**
* 顶部弹出样式处理
*/
top(type) {
this.popupstyle = this.isDesktop ? "fixforpc-top" : "top";
this.ani = ["slide-top"];
this.transClass = {
position: "fixed",
left: 0,
right: 0,
backgroundColor: this.bg,
borderRadius: this.borderRadius || "0"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
this.$nextTick(() => {
if (this.messageChild && this.type === "message") {
this.messageChild.timerClose();
}
});
},
/**
* 底部弹出样式处理
*/
bottom(type) {
this.popupstyle = "bottom";
this.ani = ["slide-bottom"];
this.transClass = {
position: "fixed",
left: 0,
right: 0,
bottom: 0,
paddingBottom: this.safeAreaInsets + "px",
backgroundColor: this.bg,
borderRadius: this.borderRadius || "0"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
},
/**
* 中间弹出样式处理
*/
center(type) {
this.popupstyle = "center";
this.ani = ["zoom-out", "fade"];
this.transClass = {
position: "fixed",
display: "flex",
flexDirection: "column",
bottom: 0,
left: 0,
right: 0,
top: 0,
justifyContent: "center",
alignItems: "center",
borderRadius: this.borderRadius || "0"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
},
left(type) {
this.popupstyle = "left";
this.ani = ["slide-left"];
this.transClass = {
position: "fixed",
left: 0,
bottom: 0,
top: 0,
backgroundColor: this.bg,
borderRadius: this.borderRadius || "0",
display: "flex",
flexDirection: "column"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
},
right(type) {
this.popupstyle = "right";
this.ani = ["slide-right"];
this.transClass = {
position: "fixed",
bottom: 0,
right: 0,
top: 0,
backgroundColor: this.bg,
borderRadius: this.borderRadius || "0",
display: "flex",
flexDirection: "column"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
}
}
};
if (!Array) {
const _easycom_uni_transition2 = common_vendor.resolveComponent("uni-transition");
_easycom_uni_transition2();
}
const _easycom_uni_transition = () => "../../../uni-transition/components/uni-transition/uni-transition.js";
if (!Math) {
_easycom_uni_transition();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $data.showPopup
}, $data.showPopup ? common_vendor.e({
b: $data.maskShow
}, $data.maskShow ? {
c: common_vendor.o($options.onTap),
d: common_vendor.p({
name: "mask",
["mode-class"]: "fade",
styles: $data.maskClass,
duration: $data.duration,
show: $data.showTrans
})
} : {}, {
e: common_vendor.s($options.getStyles),
f: common_vendor.n($data.popupstyle),
g: common_vendor.o((...args) => $options.clear && $options.clear(...args)),
h: common_vendor.o($options.onTap),
i: common_vendor.p({
["mode-class"]: $data.ani,
name: "content",
styles: $data.transClass,
duration: $data.duration,
show: $data.showTrans
}),
j: common_vendor.o((...args) => $options.touchstart && $options.touchstart(...args)),
k: common_vendor.n($data.popupstyle),
l: common_vendor.n($options.isDesktop ? "fixforpc-z-index" : "")
}) : {});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
my.createComponent(Component);

View File

@@ -0,0 +1,7 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {
"uni-transition": "../../../uni-transition/components/uni-transition/uni-transition"
}
}

View File

@@ -0,0 +1,48 @@
.uni-section .uni-section-header {
position: relative;
display: flex;
flex-direction: row;
align-items: center;
font-weight: normal;
}
.uni-section .uni-section-header__decoration {
margin-right: 6px;
background-color: #4874E5;
}
.uni-section .uni-section-header__decoration.line {
width: 12rpx;
height: 40rpx;
border-radius: 6rpx;
}
.uni-section .uni-section-header__decoration.circle {
width: 8px;
height: 8px;
border-top-right-radius: 50px;
border-top-left-radius: 50px;
border-bottom-left-radius: 50px;
border-bottom-right-radius: 50px;
}
.uni-section .uni-section-header__decoration.square {
width: 8px;
height: 8px;
}
.uni-section .uni-section-header__content {
display: flex;
flex-direction: column;
flex: 1;
color: #333;
font-weight: bold;
}
.uni-section .uni-section-header__content .distraction {
flex-direction: row;
align-items: center;
}
.uni-section .uni-section-header__content-sub {
margin-top: 2px;
}
.uni-section .uni-section-header__slot-right {
font-size: 14px;
}
.uni-section .uni-section-content {
font-size: 14px;
}

View File

@@ -0,0 +1 @@
<view class="uni-section"><view class="uni-section-header" onTap="{{k}}"><view a:if="{{a}}" class="{{('uni-section-header__decoration') + ' ' + b}}"/><slot a:else name="decoration"></slot><view class="uni-section-header__content"><text style="{{'font-size:' + d + ';' + ('color:' + e)}}" class="{{('uni-section__content-title') + ' ' + (f && 'distraction')}}">{{c}}</text><text a:if="{{g}}" style="{{'font-size:' + i + ';' + ('color:' + j)}}" class="uni-section-header__content-sub">{{h}}</text></view><view class="uni-section-header__slot-right"><slot name="right"></slot></view></view><view class="uni-section-content" style="{{'padding:' + l}}"><slot/></view></view>

View File

@@ -0,0 +1,83 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const _sfc_main = {
name: "UniSection",
emits: ["click"],
props: {
type: {
type: String,
default: ""
},
title: {
type: String,
required: true,
default: ""
},
titleFontSize: {
type: String,
default: "14px"
},
titleColor: {
type: String,
default: "#333"
},
subTitle: {
type: String,
default: ""
},
subTitleFontSize: {
type: String,
default: "12px"
},
subTitleColor: {
type: String,
default: "#999"
},
padding: {
type: [Boolean, String],
default: false
}
},
computed: {
_padding() {
if (typeof this.padding === "string") {
return this.padding;
}
return this.padding ? "10px" : "";
}
},
watch: {
title(newVal) {
if (common_vendor.index.report && newVal !== "") {
common_vendor.index.report("title", newVal);
}
}
},
methods: {
onClick() {
this.$emit("click");
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $props.type
}, $props.type ? {
b: common_vendor.n($props.type)
} : {}, {
c: common_vendor.t($props.title),
d: $props.titleFontSize,
e: $props.titleColor,
f: !$props.subTitle ? 1 : "",
g: $props.subTitle
}, $props.subTitle ? {
h: common_vendor.t($props.subTitle),
i: $props.subTitleFontSize,
j: $props.subTitleColor
} : {}, {
k: common_vendor.o((...args) => $options.onClick && $options.onClick(...args)),
l: $options._padding
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
my.createComponent(Component);

View File

@@ -0,0 +1,5 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {}
}

View File

@@ -0,0 +1,115 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
class MPAnimation {
constructor(options, _this) {
this.options = options;
this.animation = common_vendor.index.createAnimation({
...options
});
this.currentStepAnimates = {};
this.next = 0;
this.$ = _this;
}
_nvuePushAnimates(type, args) {
let aniObj = this.currentStepAnimates[this.next];
let styles = {};
if (!aniObj) {
styles = {
styles: {},
config: {}
};
} else {
styles = aniObj;
}
if (animateTypes1.includes(type)) {
if (!styles.styles.transform) {
styles.styles.transform = "";
}
let unit = "";
if (type === "rotate") {
unit = "deg";
}
styles.styles.transform += `${type}(${args + unit}) `;
} else {
styles.styles[type] = `${args}`;
}
this.currentStepAnimates[this.next] = styles;
}
_animateRun(styles = {}, config = {}) {
let ref = this.$.$refs["ani"].ref;
if (!ref)
return;
return new Promise((resolve, reject) => {
nvueAnimation.transition(ref, {
styles,
...config
}, (res) => {
resolve();
});
});
}
_nvueNextAnimate(animates, step = 0, fn) {
let obj = animates[step];
if (obj) {
let {
styles,
config
} = obj;
this._animateRun(styles, config).then(() => {
step += 1;
this._nvueNextAnimate(animates, step, fn);
});
} else {
this.currentStepAnimates = {};
typeof fn === "function" && fn();
this.isEnd = true;
}
}
step(config = {}) {
this.animation.step(config);
return this;
}
run(fn) {
this.$.animationData = this.animation.export();
this.$.timer = setTimeout(() => {
typeof fn === "function" && fn();
}, this.$.durationTime);
}
}
const animateTypes1 = [
"matrix",
"matrix3d",
"rotate",
"rotate3d",
"rotateX",
"rotateY",
"rotateZ",
"scale",
"scale3d",
"scaleX",
"scaleY",
"scaleZ",
"skew",
"skewX",
"skewY",
"translate",
"translate3d",
"translateX",
"translateY",
"translateZ"
];
const animateTypes2 = ["opacity", "backgroundColor"];
const animateTypes3 = ["width", "height", "left", "right", "top", "bottom"];
animateTypes1.concat(animateTypes2, animateTypes3).forEach((type) => {
MPAnimation.prototype[type] = function(...args) {
this.animation[type](...args);
return this;
};
});
function createAnimation(option, _this) {
if (!_this)
return;
clearTimeout(_this.timer);
return new MPAnimation(option, _this);
}
exports.createAnimation = createAnimation;

View File

@@ -0,0 +1 @@
<view hidden="{{!a}}" ref="ani" animation="{{b}}" class="{{c}}" style="{{d}}" onTap="{{e}}"><slot></slot></view>

View File

@@ -0,0 +1,265 @@
"use strict";
const uni_modules_uniTransition_components_uniTransition_createAnimation = require("./createAnimation.js");
const common_vendor = require("../../../../common/vendor.js");
const _sfc_main = {
name: "uniTransition",
emits: ["click", "change"],
props: {
show: {
type: Boolean,
default: false
},
modeClass: {
type: [Array, String],
default() {
return "fade";
}
},
duration: {
type: Number,
default: 300
},
styles: {
type: Object,
default() {
return {};
}
},
customClass: {
type: String,
default: ""
},
onceRender: {
type: Boolean,
default: false
}
},
data() {
return {
isShow: false,
transform: "",
opacity: 1,
animationData: {},
durationTime: 300,
config: {}
};
},
watch: {
show: {
handler(newVal) {
if (newVal) {
this.open();
} else {
if (this.isShow) {
this.close();
}
}
},
immediate: true
}
},
computed: {
// 生成样式数据
stylesObject() {
let styles = {
...this.styles,
"transition-duration": this.duration / 1e3 + "s"
};
let transform = "";
for (let i in styles) {
let line = this.toLine(i);
transform += line + ":" + styles[i] + ";";
}
return transform;
},
// 初始化动画条件
transformStyles() {
return "transform:" + this.transform + ";opacity:" + this.opacity + ";" + this.stylesObject;
}
},
created() {
this.config = {
duration: this.duration,
timingFunction: "ease",
transformOrigin: "50% 50%",
delay: 0
};
this.durationTime = this.duration;
},
methods: {
/**
* ref 触发 初始化动画
*/
init(obj = {}) {
if (obj.duration) {
this.durationTime = obj.duration;
}
this.animation = uni_modules_uniTransition_components_uniTransition_createAnimation.createAnimation(Object.assign(this.config, obj), this);
},
/**
* 点击组件触发回调
*/
onClick() {
this.$emit("click", {
detail: this.isShow
});
},
/**
* ref 触发 动画分组
* @param {Object} obj
*/
step(obj, config = {}) {
if (!this.animation)
return;
for (let i in obj) {
try {
if (typeof obj[i] === "object") {
this.animation[i](...obj[i]);
} else {
this.animation[i](obj[i]);
}
} catch (e) {
console.error(`方法 ${i} 不存在`);
}
}
this.animation.step(config);
return this;
},
/**
* ref 触发 执行动画
*/
run(fn) {
if (!this.animation)
return;
this.animation.run(fn);
},
// 开始过度动画
open() {
clearTimeout(this.timer);
this.transform = "";
this.isShow = true;
let { opacity, transform } = this.styleInit(false);
if (typeof opacity !== "undefined") {
this.opacity = opacity;
}
this.transform = transform;
this.$nextTick(() => {
this.timer = setTimeout(() => {
this.animation = uni_modules_uniTransition_components_uniTransition_createAnimation.createAnimation(this.config, this);
this.tranfromInit(false).step();
this.animation.run();
this.$emit("change", {
detail: this.isShow
});
}, 20);
});
},
// 关闭过度动画
close(type) {
if (!this.animation)
return;
this.tranfromInit(true).step().run(() => {
this.isShow = false;
this.animationData = null;
this.animation = null;
let { opacity, transform } = this.styleInit(false);
this.opacity = opacity || 1;
this.transform = transform;
this.$emit("change", {
detail: this.isShow
});
});
},
// 处理动画开始前的默认样式
styleInit(type) {
let styles = {
transform: ""
};
let buildStyle = (type2, mode) => {
if (mode === "fade") {
styles.opacity = this.animationType(type2)[mode];
} else {
styles.transform += this.animationType(type2)[mode] + " ";
}
};
if (typeof this.modeClass === "string") {
buildStyle(type, this.modeClass);
} else {
this.modeClass.forEach((mode) => {
buildStyle(type, mode);
});
}
return styles;
},
// 处理内置组合动画
tranfromInit(type) {
let buildTranfrom = (type2, mode) => {
let aniNum = null;
if (mode === "fade") {
aniNum = type2 ? 0 : 1;
} else {
aniNum = type2 ? "-100%" : "0";
if (mode === "zoom-in") {
aniNum = type2 ? 0.8 : 1;
}
if (mode === "zoom-out") {
aniNum = type2 ? 1.2 : 1;
}
if (mode === "slide-right") {
aniNum = type2 ? "100%" : "0";
}
if (mode === "slide-bottom") {
aniNum = type2 ? "100%" : "0";
}
}
this.animation[this.animationMode()[mode]](aniNum);
};
if (typeof this.modeClass === "string") {
buildTranfrom(type, this.modeClass);
} else {
this.modeClass.forEach((mode) => {
buildTranfrom(type, mode);
});
}
return this.animation;
},
animationType(type) {
return {
fade: type ? 0 : 1,
"slide-top": `translateY(${type ? "0" : "-100%"})`,
"slide-right": `translateX(${type ? "0" : "100%"})`,
"slide-bottom": `translateY(${type ? "0" : "100%"})`,
"slide-left": `translateX(${type ? "0" : "-100%"})`,
"zoom-in": `scaleX(${type ? 1 : 0.8}) scaleY(${type ? 1 : 0.8})`,
"zoom-out": `scaleX(${type ? 1 : 1.2}) scaleY(${type ? 1 : 1.2})`
};
},
// 内置动画类型与实际动画对应字典
animationMode() {
return {
fade: "opacity",
"slide-top": "translateY",
"slide-right": "translateX",
"slide-bottom": "translateY",
"slide-left": "translateX",
"zoom-in": "scale",
"zoom-out": "scale"
};
},
// 驼峰转中横线
toLine(name) {
return name.replace(/([A-Z])/g, "-$1").toLowerCase();
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: $data.isShow,
b: $data.animationData,
c: common_vendor.n($props.customClass),
d: common_vendor.s($options.transformStyles),
e: common_vendor.o((...args) => $options.onClick && $options.onClick(...args))
};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
my.createComponent(Component);

View File

@@ -0,0 +1,5 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {}
}

View File

@@ -0,0 +1 @@
<uv-image u-s="{{['loading','error']}}" onClick="{{a}}" onError="{{b}}" onLoad="{{c}}" u-i="3a6b4072-0" onVI="__l" u-p="{{d}}"><view slot="loading"><slot name="loading"></slot></view><view slot="error"><slot name="error"></slot></view></uv-image>

View File

@@ -0,0 +1,46 @@
"use strict";
const uni_modules_uviewPlus_components_uImage_props = require("../u-image/props.js");
const uni_modules_uviewPlus_libs_mixin_mpMixin = require("../../libs/mixin/mpMixin.js");
const uni_modules_uviewPlus_libs_mixin_mixin = require("../../libs/mixin/mixin.js");
const common_vendor = require("../../../../common/vendor.js");
const uvImage = () => "../u-image/u-image.js";
const _sfc_main = {
name: "u--image",
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_components_uImage_props.props, uni_modules_uviewPlus_libs_mixin_mixin.mixin],
components: {
uvImage
},
emits: ["click", "error", "load"]
};
if (!Array) {
const _component_uvImage = common_vendor.resolveComponent("uvImage");
_component_uvImage();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.o(($event) => _ctx.$emit("click")),
b: common_vendor.o(($event) => _ctx.$emit("error")),
c: common_vendor.o(($event) => _ctx.$emit("load")),
d: common_vendor.p({
src: _ctx.src,
mode: _ctx.mode,
width: _ctx.width,
height: _ctx.height,
shape: _ctx.shape,
radius: _ctx.radius,
lazyLoad: _ctx.lazyLoad,
showMenuByLongpress: _ctx.showMenuByLongpress,
loadingIcon: _ctx.loadingIcon,
errorIcon: _ctx.errorIcon,
showLoading: _ctx.showLoading,
showError: _ctx.showError,
fade: _ctx.fade,
webp: _ctx.webp,
duration: _ctx.duration,
bgColor: _ctx.bgColor,
customStyle: _ctx.customStyle
})
};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
my.createComponent(Component);

View File

@@ -0,0 +1,7 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {
"uv-image": "../u-image/u-image"
}
}

View File

@@ -0,0 +1,80 @@
"use strict";
const uni_modules_uviewPlus_libs_config_props = require("../../libs/config/props.js");
const props = {
props: {
// 是否显示圆点
isDot: {
type: Boolean,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.isDot
},
// 显示的内容
value: {
type: [Number, String],
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.value
},
// 显示的内容
modelValue: {
type: [Number, String],
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.modelValue
},
// 是否显示
show: {
type: Boolean,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.show
},
// 最大值,超过最大值会显示 '{max}+'
max: {
type: [Number, String],
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.max
},
// 主题类型error|warning|success|primary
type: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.type
},
// 当数值为 0 时,是否展示 Badge
showZero: {
type: Boolean,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.showZero
},
// 背景颜色优先级比type高如设置type参数会失效
bgColor: {
type: [String, null],
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.bgColor
},
// 字体颜色
color: {
type: [String, null],
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.color
},
// 徽标形状circle-四角均为圆角horn-左下角为直角
shape: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.shape
},
// 设置数字的显示方式overflow|ellipsis|limit
// overflow会根据max字段判断超出显示`${max}+`
// ellipsis会根据max判断超出显示`${max}...`
// limit会依据1000作为判断条件超出1000显示`${value/1000}K`比如2.2k、3.34w最多保留2位小数
numberType: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.numberType
},
// 设置badge的位置偏移格式为 [x, y]也即设置的为top和right的值absolute为true时有效
offset: {
type: Array,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.offset
},
// 是否反转背景和字体颜色
inverted: {
type: Boolean,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.inverted
},
// 是否绝对定位
absolute: {
type: Boolean,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.absolute
}
}
};
exports.props = props;

View File

@@ -0,0 +1,71 @@
.u-empty.data-v-06cca9b7,
.u-empty__wrap.data-v-06cca9b7,
.u-tabs.data-v-06cca9b7,
.u-tabs__wrapper.data-v-06cca9b7,
.u-tabs__wrapper__scroll-view-wrapper.data-v-06cca9b7,
.u-tabs__wrapper__scroll-view.data-v-06cca9b7,
.u-tabs__wrapper__nav.data-v-06cca9b7,
.u-tabs__wrapper__nav__line.data-v-06cca9b7 {
display: flex;
flex-direction: column;
flex-shrink: 0;
flex-grow: 0;
flex-basis: auto;
align-items: stretch;
align-content: flex-start;
}
.u-badge.data-v-06cca9b7 {
border-top-right-radius: 100px;
border-top-left-radius: 100px;
border-bottom-left-radius: 100px;
border-bottom-right-radius: 100px;
display: flex;
flex-direction: row;
line-height: 11px;
text-align: center;
font-size: 11px;
color: #FFFFFF;
}
.u-badge--dot.data-v-06cca9b7 {
height: 8px;
width: 8px;
}
.u-badge--inverted.data-v-06cca9b7 {
font-size: 13px;
}
.u-badge--not-dot.data-v-06cca9b7 {
padding: 2px 5px;
}
.u-badge--horn.data-v-06cca9b7 {
border-bottom-left-radius: 0;
}
.u-badge--primary.data-v-06cca9b7 {
background-color: #3c9cff;
}
.u-badge--primary--inverted.data-v-06cca9b7 {
color: #3c9cff;
}
.u-badge--error.data-v-06cca9b7 {
background-color: #f56c6c;
}
.u-badge--error--inverted.data-v-06cca9b7 {
color: #f56c6c;
}
.u-badge--success.data-v-06cca9b7 {
background-color: #5ac725;
}
.u-badge--success--inverted.data-v-06cca9b7 {
color: #5ac725;
}
.u-badge--info.data-v-06cca9b7 {
background-color: #909399;
}
.u-badge--info--inverted.data-v-06cca9b7 {
color: #909399;
}
.u-badge--warning.data-v-06cca9b7 {
background-color: #f9ae3d;
}
.u-badge--warning--inverted.data-v-06cca9b7 {
color: #f9ae3d;
}

View File

@@ -0,0 +1 @@
<text a:if="{{a}}" class="{{(c) + ' ' + d + ' ' + e + ' ' + f + ' ' + 'u-badge' + ' ' + 'data-v-06cca9b7'}}" style="{{g + ';' + h}}">{{b}}</text>

View File

@@ -0,0 +1,67 @@
"use strict";
const uni_modules_uviewPlus_components_uBadge_props = require("./props.js");
const uni_modules_uviewPlus_libs_mixin_mpMixin = require("../../libs/mixin/mpMixin.js");
const uni_modules_uviewPlus_libs_mixin_mixin = require("../../libs/mixin/mixin.js");
const uni_modules_uviewPlus_libs_function_index = require("../../libs/function/index.js");
const common_vendor = require("../../../../common/vendor.js");
const _sfc_main = {
name: "u-badge",
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_components_uBadge_props.props, uni_modules_uviewPlus_libs_mixin_mixin.mixin],
computed: {
// 是否将badge中心与父组件右上角重合
boxStyle() {
let style = {};
return style;
},
// 整个组件的样式
badgeStyle() {
const style = {};
if (this.color) {
style.color = this.color;
}
if (this.bgColor && !this.inverted) {
style.backgroundColor = this.bgColor;
}
if (this.absolute) {
style.position = "absolute";
if (this.offset.length) {
const top = this.offset[0];
const right = this.offset[1] || top;
style.top = uni_modules_uviewPlus_libs_function_index.addUnit(top);
style.right = uni_modules_uviewPlus_libs_function_index.addUnit(right);
}
}
return style;
},
showValue() {
switch (this.numberType) {
case "overflow":
return Number(this.value) > Number(this.max) ? this.max + "+" : this.value;
case "ellipsis":
return Number(this.value) > Number(this.max) ? "..." : this.value;
case "limit":
return Number(this.value) > 999 ? Number(this.value) >= 9999 ? Math.floor(this.value / 1e4 * 100) / 100 + "w" : Math.floor(this.value / 1e3 * 100) / 100 + "k" : this.value;
default:
return Number(this.value);
}
}
},
methods: {
addStyle: uni_modules_uviewPlus_libs_function_index.addStyle
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: _ctx.show && ((Number(_ctx.value) === 0 ? _ctx.showZero : true) || _ctx.isDot)
}, _ctx.show && ((Number(_ctx.value) === 0 ? _ctx.showZero : true) || _ctx.isDot) ? {
b: common_vendor.t(_ctx.isDot ? "" : $options.showValue),
c: common_vendor.n(_ctx.isDot ? "u-badge--dot" : "u-badge--not-dot"),
d: common_vendor.n(_ctx.inverted && "u-badge--inverted"),
e: common_vendor.n(_ctx.shape === "horn" && "u-badge--horn"),
f: common_vendor.n(`u-badge--${_ctx.type}${_ctx.inverted ? "--inverted" : ""}`),
g: common_vendor.s($options.addStyle(_ctx.customStyle)),
h: common_vendor.s($options.badgeStyle)
} : {});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-06cca9b7"]]);
my.createComponent(Component);

View File

@@ -0,0 +1,5 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {}
}

View File

@@ -0,0 +1,155 @@
"use strict";
const uni_modules_uviewPlus_libs_config_props = require("../../libs/config/props.js");
const props = {
props: {
// 是否细边框
hairline: {
type: Boolean,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.hairline
},
// 按钮的预置样式infoprimaryerrorwarningsuccess
type: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.type
},
// 按钮尺寸largenormalsmallmini
size: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.size
},
// 按钮形状circle两边为半圆square带圆角
shape: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.shape
},
// 按钮是否镂空
plain: {
type: Boolean,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.plain
},
// 是否禁止状态
disabled: {
type: Boolean,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.disabled
},
// 是否加载中
loading: {
type: Boolean,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.loading
},
// 加载中提示文字
loadingText: {
type: [String, Number],
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.loadingText
},
// 加载状态图标类型
loadingMode: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.loadingMode
},
// 加载图标大小
loadingSize: {
type: [String, Number],
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.loadingSize
},
// 开放能力具体请看uniapp稳定关于button组件部分说明
// https://uniapp.dcloud.io/component/button
openType: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.openType
},
// 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件
// 取值为submit提交表单reset重置表单
formType: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.formType
},
// 打开 APP 时,向 APP 传递的参数open-type=launchApp时有效
// 只微信小程序、QQ小程序有效
appParameter: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.appParameter
},
// 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效
hoverStopPropagation: {
type: Boolean,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.hoverStopPropagation
},
// 指定返回用户信息的语言zh_CN 简体中文zh_TW 繁体中文en 英文。只微信小程序有效
lang: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.lang
},
// 会话来源open-type="contact"时有效。只微信小程序有效
sessionFrom: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.sessionFrom
},
// 会话内消息卡片标题open-type="contact"时有效
// 默认当前标题,只微信小程序有效
sendMessageTitle: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.sendMessageTitle
},
// 会话内消息卡片点击跳转小程序路径open-type="contact"时有效
// 默认当前分享路径,只微信小程序有效
sendMessagePath: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.sendMessagePath
},
// 会话内消息卡片图片open-type="contact"时有效
// 默认当前页面截图,只微信小程序有效
sendMessageImg: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.sendMessageImg
},
// 是否显示会话内消息卡片,设置此参数为 true用户进入客服会话会在右下角显示"可能要发送的小程序"提示,
// 用户点击后可以快速发送小程序消息open-type="contact"时有效
showMessageCard: {
type: Boolean,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.showMessageCard
},
// 额外传参参数用于小程序的data-xxx属性通过target.dataset.name获取
dataName: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.dataName
},
// 节流,一定时间内只能触发一次
throttleTime: {
type: [String, Number],
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.throttleTime
},
// 按住后多久出现点击态,单位毫秒
hoverStartTime: {
type: [String, Number],
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.hoverStartTime
},
// 手指松开后点击态保留时间,单位毫秒
hoverStayTime: {
type: [String, Number],
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.hoverStayTime
},
// 按钮文字之所以通过props传入是因为slot传入的话
// nvue中无法控制文字的样式
text: {
type: [String, Number],
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.text
},
// 按钮图标
icon: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.icon
},
// 按钮图标
iconColor: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.icon
},
// 按钮颜色支持传入linear-gradient渐变色
color: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.color
}
}
};
exports.props = props;

View File

@@ -0,0 +1,163 @@
.u-empty.data-v-5ce41ee6,
.u-empty__wrap.data-v-5ce41ee6,
.u-tabs.data-v-5ce41ee6,
.u-tabs__wrapper.data-v-5ce41ee6,
.u-tabs__wrapper__scroll-view-wrapper.data-v-5ce41ee6,
.u-tabs__wrapper__scroll-view.data-v-5ce41ee6,
.u-tabs__wrapper__nav.data-v-5ce41ee6,
.u-tabs__wrapper__nav__line.data-v-5ce41ee6 {
display: flex;
flex-direction: column;
flex-shrink: 0;
flex-grow: 0;
flex-basis: auto;
align-items: stretch;
align-content: flex-start;
}
.u-button.data-v-5ce41ee6 {
width: 100%;
white-space: nowrap;
}
.u-button__text.data-v-5ce41ee6 {
white-space: nowrap;
line-height: 1;
}
.u-button.data-v-5ce41ee6:before {
position: absolute;
top: 50%;
left: 50%;
width: 100%;
height: 100%;
border: inherit;
border-radius: inherit;
transform: translate(-50%, -50%);
opacity: 0;
content: " ";
background-color: #000;
border-color: #000;
}
.u-button--active.data-v-5ce41ee6:before {
opacity: 0.15;
}
.u-button__icon + .u-button__text.data-v-5ce41ee6:not(:empty), .u-button__loading-text.data-v-5ce41ee6 {
margin-left: 4px;
}
.u-button--plain.u-button--primary.data-v-5ce41ee6 {
color: #3c9cff;
}
.u-button--plain.u-button--info.data-v-5ce41ee6 {
color: #909399;
}
.u-button--plain.u-button--success.data-v-5ce41ee6 {
color: #5ac725;
}
.u-button--plain.u-button--error.data-v-5ce41ee6 {
color: #f56c6c;
}
.u-button--plain.u-button--warning.data-v-5ce41ee6 {
color: #f56c6c;
}
.u-button.data-v-5ce41ee6 {
height: 38px;
position: relative;
align-items: center;
justify-content: center;
display: flex;
flex-direction: row;
box-sizing: border-box;
flex-direction: row;
}
.u-button__text.data-v-5ce41ee6 {
font-size: 15px;
}
.u-button__loading-text.data-v-5ce41ee6 {
font-size: 15px;
margin-left: 4px;
}
.u-button--large.data-v-5ce41ee6 {
width: 100%;
height: 50px;
padding: 0 15px;
}
.u-button--normal.data-v-5ce41ee6 {
padding: 0 12px;
font-size: 14px;
}
.u-button--small.data-v-5ce41ee6 {
min-width: 60px;
height: 30px;
padding: 0px 8px;
font-size: 12px;
}
.u-button--mini.data-v-5ce41ee6 {
height: 22px;
font-size: 10px;
min-width: 50px;
padding: 0px 8px;
}
.u-button--disabled.data-v-5ce41ee6 {
opacity: 0.5;
}
.u-button--info.data-v-5ce41ee6 {
color: #323233;
background-color: #fff;
border-color: #ebedf0;
border-width: 1px;
border-style: solid;
}
.u-button--success.data-v-5ce41ee6 {
color: #fff;
background-color: #5ac725;
border-color: #5ac725;
border-width: 1px;
border-style: solid;
}
.u-button--primary.data-v-5ce41ee6 {
color: #fff;
background-color: #3c9cff;
border-color: #3c9cff;
border-width: 1px;
border-style: solid;
}
.u-button--error.data-v-5ce41ee6 {
color: #fff;
background-color: #f56c6c;
border-color: #f56c6c;
border-width: 1px;
border-style: solid;
}
.u-button--warning.data-v-5ce41ee6 {
color: #fff;
background-color: #f9ae3d;
border-color: #f9ae3d;
border-width: 1px;
border-style: solid;
}
.u-button--block.data-v-5ce41ee6 {
display: flex;
flex-direction: row;
width: 100%;
}
.u-button--circle.data-v-5ce41ee6 {
border-top-right-radius: 100px;
border-top-left-radius: 100px;
border-bottom-left-radius: 100px;
border-bottom-right-radius: 100px;
}
.u-button--square.data-v-5ce41ee6 {
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
.u-button__icon.data-v-5ce41ee6 {
min-width: 1em;
line-height: inherit !important;
vertical-align: top;
}
.u-button--plain.data-v-5ce41ee6 {
background-color: #fff;
}
.u-button--hairline.data-v-5ce41ee6 {
border-width: 0.5px !important;
}

View File

@@ -0,0 +1 @@
<button hover-start-time="{{i}}" hover-stay-time="{{j}}" form-type="{{k}}" open-type="{{l}}" app-parameter="{{m}}" hover-stop-propagation="{{n}}" send-message-title="{{o}}" send-message-path="{{p}}" lang="{{q}}" data-name="{{r}}" session-from="{{s}}" send-message-img="{{t}}" show-message-card="{{v}}" onGetphonenumber="{{w}}" onGetuserinfo="{{x}}" onError="{{y}}" onOpensetting="{{z}}" onLaunchapp="{{A}}" onAgreeprivacyauthorization="{{B}}" hover-class="{{C}}" style="{{D + ';' + E}}" onTap="{{F}}" class="{{('u-button') + ' ' + 'u-reset-button' + ' ' + 'data-v-5ce41ee6' + ' ' + G}}"><block a:if="{{a}}"><u-loading-icon class="data-v-5ce41ee6" u-i="5ce41ee6-0" onVI="__l" u-p="{{b}}"></u-loading-icon><text class="u-button__loading-text data-v-5ce41ee6" style="{{d}}">{{c}}</text></block><block a:else><u-icon a:if="{{e}}" class="data-v-5ce41ee6" u-i="5ce41ee6-1" onVI="__l" u-p="{{f}}"></u-icon><slot><text class="u-button__text data-v-5ce41ee6" style="{{h}}">{{g}}</text></slot></block></button>

View File

@@ -0,0 +1,207 @@
"use strict";
const uni_modules_uviewPlus_libs_mixin_button = require("../../libs/mixin/button.js");
const uni_modules_uviewPlus_libs_mixin_openType = require("../../libs/mixin/openType.js");
const uni_modules_uviewPlus_libs_mixin_mpMixin = require("../../libs/mixin/mpMixin.js");
const uni_modules_uviewPlus_libs_mixin_mixin = require("../../libs/mixin/mixin.js");
const uni_modules_uviewPlus_components_uButton_props = require("./props.js");
const uni_modules_uviewPlus_libs_function_index = require("../../libs/function/index.js");
const uni_modules_uviewPlus_libs_function_throttle = require("../../libs/function/throttle.js");
const uni_modules_uviewPlus_libs_config_color = require("../../libs/config/color.js");
const common_vendor = require("../../../../common/vendor.js");
const _sfc_main = {
name: "u-button",
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_libs_mixin_mixin.mixin, uni_modules_uviewPlus_libs_mixin_button.button, uni_modules_uviewPlus_libs_mixin_openType.openType, uni_modules_uviewPlus_components_uButton_props.props],
data() {
return {};
},
computed: {
// 生成bem风格的类名
bemClass() {
if (!this.color) {
return this.bem(
"button",
["type", "shape", "size"],
["disabled", "plain", "hairline"]
);
} else {
return this.bem(
"button",
["shape", "size"],
["disabled", "plain", "hairline"]
);
}
},
loadingColor() {
if (this.plain) {
return this.color ? this.color : uni_modules_uviewPlus_libs_config_color.color[`u-${this.type}`];
}
if (this.type === "info") {
return "#c9c9c9";
}
return "rgb(200, 200, 200)";
},
iconColorCom() {
if (this.iconColor)
return this.iconColor;
if (this.plain) {
return this.color ? this.color : this.type;
} else {
return this.type === "info" ? "#000000" : "#ffffff";
}
},
baseColor() {
let style = {};
if (this.color) {
style.color = this.plain ? this.color : "white";
if (!this.plain) {
style["background-color"] = this.color;
}
if (this.color.indexOf("gradient") !== -1) {
style.borderTopWidth = 0;
style.borderRightWidth = 0;
style.borderBottomWidth = 0;
style.borderLeftWidth = 0;
if (!this.plain) {
style.backgroundImage = this.color;
}
} else {
style.borderColor = this.color;
style.borderWidth = "1px";
style.borderStyle = "solid";
}
}
return style;
},
// nvue版本按钮的字体不会继承父组件的颜色需要对每一个text组件进行单独的设置
nvueTextStyle() {
let style = {};
if (this.type === "info") {
style.color = "#323233";
}
if (this.color) {
style.color = this.plain ? this.color : "white";
}
style.fontSize = this.textSize + "px";
return style;
},
// 字体大小
textSize() {
let fontSize = 14, { size } = this;
if (size === "large")
fontSize = 16;
if (size === "normal")
fontSize = 14;
if (size === "small")
fontSize = 12;
if (size === "mini")
fontSize = 10;
return fontSize;
}
},
emits: [
"click",
"getphonenumber",
"getuserinfo",
"error",
"opensetting",
"launchapp",
"agreeprivacyauthorization"
],
methods: {
addStyle: uni_modules_uviewPlus_libs_function_index.addStyle,
clickHandler() {
if (!this.disabled && !this.loading) {
uni_modules_uviewPlus_libs_function_throttle.throttle(() => {
this.$emit("click");
}, this.throttleTime);
}
},
// 下面为对接uniapp官方按钮开放能力事件回调的对接
getphonenumber(res) {
this.$emit("getphonenumber", res);
},
getuserinfo(res) {
this.$emit("getuserinfo", res);
},
error(res) {
this.$emit("error", res);
},
opensetting(res) {
this.$emit("opensetting", res);
},
launchapp(res) {
this.$emit("launchapp", res);
},
agreeprivacyauthorization(res) {
this.$emit("agreeprivacyauthorization", res);
}
}
};
if (!Array) {
const _easycom_u_loading_icon2 = common_vendor.resolveComponent("u-loading-icon");
const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
(_easycom_u_loading_icon2 + _easycom_u_icon2)();
}
const _easycom_u_loading_icon = () => "../u-loading-icon/u-loading-icon.js";
const _easycom_u_icon = () => "../u-icon/u-icon.js";
if (!Math) {
(_easycom_u_loading_icon + _easycom_u_icon)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: _ctx.loading
}, _ctx.loading ? {
b: common_vendor.p({
mode: _ctx.loadingMode,
size: _ctx.loadingSize * 1.15,
color: $options.loadingColor
}),
c: common_vendor.t(_ctx.loadingText || _ctx.text),
d: common_vendor.s({
fontSize: $options.textSize + "px"
})
} : common_vendor.e({
e: _ctx.icon
}, _ctx.icon ? {
f: common_vendor.p({
name: _ctx.icon,
color: $options.iconColorCom,
size: $options.textSize * 1.35,
customStyle: {
marginRight: "2px"
}
})
} : {}, {
g: common_vendor.t(_ctx.text),
h: common_vendor.s({
fontSize: $options.textSize + "px"
})
}), {
i: Number(_ctx.hoverStartTime),
j: Number(_ctx.hoverStayTime),
k: _ctx.formType,
l: _ctx.openType,
m: _ctx.appParameter,
n: _ctx.hoverStopPropagation,
o: _ctx.sendMessageTitle,
p: _ctx.sendMessagePath,
q: _ctx.lang,
r: _ctx.dataName,
s: _ctx.sessionFrom,
t: _ctx.sendMessageImg,
v: _ctx.showMessageCard,
w: common_vendor.o((...args) => $options.getphonenumber && $options.getphonenumber(...args)),
x: common_vendor.o((...args) => $options.getuserinfo && $options.getuserinfo(...args)),
y: common_vendor.o((...args) => $options.error && $options.error(...args)),
z: common_vendor.o((...args) => $options.opensetting && $options.opensetting(...args)),
A: common_vendor.o((...args) => $options.launchapp && $options.launchapp(...args)),
B: common_vendor.o((...args) => $options.agreeprivacyauthorization && $options.agreeprivacyauthorization(...args)),
C: !_ctx.disabled && !_ctx.loading ? "u-button--active" : "",
D: common_vendor.s($options.baseColor),
E: common_vendor.s($options.addStyle(_ctx.customStyle)),
F: common_vendor.o((...args) => $options.clickHandler && $options.clickHandler(...args)),
G: common_vendor.n($options.bemClass)
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-5ce41ee6"]]);
my.createComponent(Component);

View File

@@ -0,0 +1,8 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {
"u-loading-icon": "../u-loading-icon/u-loading-icon",
"u-icon": "../u-icon/u-icon"
}
}

Some files were not shown because too many files have changed in this diff Show More