1.26 个股详情业务结构,发展历程模块完善

This commit is contained in:
尚政杰
2026-01-26 17:53:08 +08:00
parent f296e005b3
commit 67a673cd4d
508 changed files with 44334 additions and 305 deletions

View File

@@ -0,0 +1,364 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const uni_modules_limeEchart_components_lEchart_utils = require("./utils.js");
const cacheChart = {};
class EventEmit {
constructor() {
this.__events = {};
}
on(type, listener) {
if (!type || !listener) {
return;
}
const events = this.__events[type] || [];
events.push(listener);
this.__events[type] = events;
}
emit(type, e) {
if (type.constructor === Object) {
e = type;
type = e && e.type;
}
if (!type) {
return;
}
const events = this.__events[type];
if (!events || !events.length) {
return;
}
events.forEach((listener) => {
listener.call(this, e);
});
}
off(type, listener) {
const __events = this.__events;
const events = __events[type];
if (!events || !events.length) {
return;
}
if (!listener) {
delete __events[type];
return;
}
for (let i = 0, len = events.length; i < len; i++) {
if (events[i] === listener) {
events.splice(i, 1);
i--;
}
}
}
}
class Image {
constructor() {
this.currentSrc = null;
this.naturalHeight = 0;
this.naturalWidth = 0;
this.width = 0;
this.height = 0;
this.tagName = "IMG";
}
set src(src) {
this.currentSrc = src;
common_vendor.index.getImageInfo({
src,
success: (res) => {
this.naturalWidth = this.width = res.width;
this.naturalHeight = this.height = res.height;
this.onload();
},
fail: () => {
this.onerror();
}
});
}
get src() {
return this.currentSrc;
}
}
class OffscreenCanvas {
constructor(ctx, com, canvasId) {
this.tagName = "canvas";
this.com = com;
this.canvasId = canvasId;
this.ctx = ctx;
}
set width(w) {
this.com.offscreenWidth = w;
}
set height(h) {
this.com.offscreenHeight = h;
}
get width() {
return this.com.offscreenWidth || 0;
}
get height() {
return this.com.offscreenHeight || 0;
}
getContext(type) {
return this.ctx;
}
getImageData() {
return new Promise((resolve, reject) => {
this.com.$nextTick(() => {
common_vendor.index.canvasGetImageData({
x: 0,
y: 0,
width: this.com.offscreenWidth,
height: this.com.offscreenHeight,
canvasId: this.canvasId,
success: (res) => {
resolve(res);
},
fail: (err) => {
reject(err);
}
}, this.com);
});
});
}
}
class Canvas {
constructor(ctx, com, isNew, canvasNode = {}) {
cacheChart[com.canvasId] = { ctx };
this.canvasId = com.canvasId;
this.chart = null;
this.isNew = isNew;
this.tagName = "canvas";
this.canvasNode = canvasNode;
this.com = com;
if (!isNew) {
this._initStyle(ctx);
}
this._initEvent();
this._ee = new EventEmit();
}
getContext(type) {
if (type === "2d") {
return this.ctx;
}
}
setAttribute(key, value) {
if (key === "aria-label") {
this.com["ariaLabel"] = value;
}
}
setChart(chart) {
this.chart = chart;
}
createOffscreenCanvas(param) {
if (!this.children) {
this.com.isOffscreenCanvas = true;
this.com.offscreenWidth = param.width || 300;
this.com.offscreenHeight = param.height || 300;
const com = this.com;
const canvasId = this.com.offscreenCanvasId;
const context = common_vendor.index.createCanvasContext(canvasId, this.com);
this._initStyle(context);
this.children = new OffscreenCanvas(context, com, canvasId);
}
return this.children;
}
appendChild(child) {
common_vendor.index.__f__("log", "at uni_modules/lime-echart/components/l-echart/canvas.js:162", "child", child);
}
dispatchEvent(type, e) {
if (typeof type == "object") {
this._ee.emit(type.type, type);
} else {
this._ee.emit(type, e);
}
return true;
}
attachEvent() {
}
detachEvent() {
}
addEventListener(type, listener) {
this._ee.on(type, listener);
}
removeEventListener(type, listener) {
this._ee.off(type, listener);
}
_initCanvas(zrender, ctx) {
}
_initStyle(ctx, child) {
const styles = [
"fillStyle",
"strokeStyle",
"fontSize",
"globalAlpha",
"opacity",
"textAlign",
"textBaseline",
"shadow",
"lineWidth",
"lineCap",
"lineJoin",
"lineDash",
"miterLimit"
];
styles.forEach((style) => {
Object.defineProperty(ctx, style, {
set: (value) => {
if (style === "opacity") {
ctx.setGlobalAlpha(value);
return;
}
if (style !== "fillStyle" && style !== "strokeStyle" || value !== "none" && value !== null) {
ctx["set" + style.charAt(0).toUpperCase() + style.slice(1)](value);
}
}
});
});
if (!this.isNew && !child) {
ctx.uniDrawImage = ctx.drawImage;
ctx.drawImage = (...a) => {
a[0] = a[0].src;
ctx.uniDrawImage(...a);
};
}
if (!ctx.createRadialGradient) {
ctx.createRadialGradient = function() {
return ctx.createCircularGradient(...[...arguments].slice(-3));
};
}
if (!ctx.strokeText) {
ctx.strokeText = (...a) => {
ctx.fillText(...a);
};
}
if (!ctx.measureText || uni_modules_limeEchart_components_lEchart_utils.getDeviceInfo().osName == "harmonyos") {
ctx._measureText = ctx.measureText;
const strLen = (str) => {
let len = 0;
for (let i = 0; i < str.length; i++) {
if (str.charCodeAt(i) > 0 && str.charCodeAt(i) < 128) {
len++;
} else {
len += 2;
}
}
return len;
};
ctx.measureText = (text, font) => {
var _a;
let fontSize = ((_a = ctx == null ? void 0 : ctx.state) == null ? void 0 : _a.fontSize) || 12;
if (font) {
fontSize = parseInt(font.match(/([\d\.]+)px/)[1]);
}
fontSize /= 2;
let isBold = fontSize >= 16;
const widthFactor = isBold ? 1.3 : 1;
return {
width: strLen(text) * fontSize * widthFactor
};
};
}
}
_initEvent(e) {
this.event = {};
const eventNames = [{
wxName: "touchStart",
ecName: "mousedown"
}, {
wxName: "touchMove",
ecName: "mousemove"
}, {
wxName: "touchEnd",
ecName: "mouseup"
}, {
wxName: "touchEnd",
ecName: "click"
}];
eventNames.forEach((name) => {
this.event[name.wxName] = (e2) => {
const touch = e2.touches[0];
this.chart.getZr().handler.dispatch(name.ecName, {
zrX: name.wxName === "tap" ? touch.clientX : touch.x,
zrY: name.wxName === "tap" ? touch.clientY : touch.y
});
};
});
}
set width(w) {
this.canvasNode.width = w;
}
set height(h) {
this.canvasNode.height = h;
}
get width() {
return this.canvasNode.width || 0;
}
get height() {
return this.canvasNode.height || 0;
}
get ctx() {
return cacheChart[this.canvasId]["ctx"] || null;
}
set chart(chart) {
cacheChart[this.canvasId]["chart"] = chart;
}
get chart() {
return cacheChart[this.canvasId]["chart"] || null;
}
}
function dispatch(name, { x, y, wheelDelta }) {
this.dispatch(name, {
zrX: x,
zrY: y,
zrDelta: wheelDelta,
preventDefault: () => {
},
stopPropagation: () => {
}
});
}
function setCanvasCreator(echarts, { canvas, node }) {
if (echarts && !echarts.registerPreprocessor) {
return common_vendor.index.__f__("warn", "at uni_modules/lime-echart/components/l-echart/canvas.js:356", "echarts 版本不对或未传入echartsvue3请使用esm格式");
}
echarts.registerPreprocessor((option) => {
if (option && option.series) {
if (option.series.length > 0) {
option.series.forEach((series) => {
series.progressive = 0;
});
} else if (typeof option.series === "object") {
option.series.progressive = 0;
}
}
});
function loadImage(src, onload, onerror) {
let img = null;
if (node && node.createImage) {
img = node.createImage();
img.onload = onload.bind(img);
img.onerror = onerror.bind(img);
img.src = src;
return img;
} else {
img = new Image();
img.onload = onload.bind(img);
img.onerror = onerror.bind(img);
img.src = src;
return img;
}
}
if (echarts.setPlatformAPI) {
echarts.setPlatformAPI({
loadImage: canvas.setChart ? loadImage : null,
createCanvas() {
const key = "createOffscreenCanvas";
return common_vendor.index.canIUse(key) && common_vendor.index[key] ? common_vendor.index[key]({ type: "2d" }) : canvas;
}
});
} else if (echarts.setCanvasCreator) {
echarts.setCanvasCreator(() => {
return canvas;
});
}
}
exports.Canvas = Canvas;
exports.dispatch = dispatch;
exports.setCanvasCreator = setCanvasCreator;
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/lime-echart/components/l-echart/canvas.js.map

View File

@@ -0,0 +1,328 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const uni_modules_limeEchart_components_lEchart_canvas = require("./canvas.js");
const uni_modules_limeEchart_components_lEchart_utils = require("./utils.js");
const _sfc_main = {
name: "lime-echart",
props: {
type: {
type: String,
default: "2d"
},
customStyle: String,
isDisableScroll: Boolean,
isClickable: {
type: Boolean,
default: true
},
enableHover: Boolean,
beforeDelay: {
type: Number,
default: 30
},
landscape: Boolean
},
data() {
return {
use2dCanvas: true,
ariaLabel: "图表",
width: null,
height: null,
nodeWidth: null,
nodeHeight: null,
// canvasNode: null,
config: {},
inited: false,
finished: false,
file: "",
platform: "",
isPC: false,
isDown: false,
isOffscreenCanvas: false,
offscreenWidth: 0,
offscreenHeight: 0
};
},
computed: {
rootStyle() {
if (this.landscape) {
return `transform: translate(-50%,-50%) rotate(90deg); top:50%; left:50%;`;
}
},
canvasId() {
return `lime-echart${this._ && this._.uid || this._uid}`;
},
offscreenCanvasId() {
return `${this.canvasId}_offscreen`;
},
offscreenStyle() {
return `width:${this.offscreenWidth}px;height: ${this.offscreenHeight}px; position: fixed; left: 99999px; background: red`;
},
canvasStyle() {
return this.rootStyle + (this.width && this.height ? "width:" + this.width + "px;height:" + this.height + "px" : "");
}
},
beforeUnmount() {
this.clear();
this.dispose();
},
created() {
const { platform } = uni_modules_limeEchart_components_lEchart_utils.getDeviceInfo();
this.isPC = /windows/i.test(platform);
this.use2dCanvas = this.type === "2d" && uni_modules_limeEchart_components_lEchart_utils.canIUseCanvas2d();
},
mounted() {
this.$nextTick(() => {
this.$emit("finished");
});
},
methods: {
setChart(callback) {
if (!this.chart) {
common_vendor.index.__f__("warn", "at uni_modules/lime-echart/components/l-echart/l-echart.vue:214", `组件还未初始化,请先使用 init`);
return;
}
if (typeof callback === "function" && this.chart) {
callback(this.chart);
}
},
setOption() {
if (!this.chart || !this.chart.setOption) {
common_vendor.index.__f__("warn", "at uni_modules/lime-echart/components/l-echart/l-echart.vue:228", `组件还未初始化,请先使用 init`);
return;
}
this.chart.setOption(...arguments);
},
showLoading() {
if (this.chart) {
this.chart.showLoading(...arguments);
}
},
hideLoading() {
if (this.chart) {
this.chart.hideLoading();
}
},
clear() {
if (this.chart && !this.chart.isDisposed()) {
this.chart.clear();
}
},
dispose() {
if (this.chart && !this.chart.isDisposed()) {
this.chart.dispose();
}
},
resize(size) {
if (size && size.width && size.height) {
this.height = size.height;
this.width = size.width;
if (this.chart) {
this.chart.resize(size);
}
} else {
this.$nextTick(() => {
uni_modules_limeEchart_components_lEchart_utils.getRect(".lime-echart", this).then((res) => {
if (res) {
let { width, height } = res;
this.width = width = width || 300;
this.height = height = height || 300;
this.chart.resize({ width, height });
}
});
});
}
},
canvasToTempFilePath(args = {}) {
const { use2dCanvas, canvasId } = this;
return new Promise((resolve, reject) => {
const copyArgs = Object.assign({
canvasId,
success: resolve,
fail: reject
}, args);
if (use2dCanvas) {
delete copyArgs.canvasId;
copyArgs.canvas = this.canvasNode;
}
common_vendor.index.canvasToTempFilePath(copyArgs, this);
});
},
async init(echarts, ...args) {
if (args && args.length == 0 && !echarts) {
common_vendor.index.__f__("error", "at uni_modules/lime-echart/components/l-echart/l-echart.vue:306", "缺少参数init(echarts, theme?:string, opts?: object, callback?: function)");
return;
}
let theme = null, opts = {}, callback;
args.forEach((item) => {
if (typeof item === "function") {
callback = item;
}
if (["string"].includes(typeof item)) {
theme = item;
}
if (typeof item === "object") {
opts = item;
}
});
if (this.beforeDelay) {
await uni_modules_limeEchart_components_lEchart_utils.sleep(this.beforeDelay);
}
let config = await this.getContext();
uni_modules_limeEchart_components_lEchart_canvas.setCanvasCreator(echarts, config);
try {
this.chart = echarts.init(config.canvas, theme, Object.assign({}, config, opts || {}));
callback == null ? void 0 : callback(this.chart);
return this.chart;
} catch (e) {
common_vendor.index.__f__("error", "at uni_modules/lime-echart/components/l-echart/l-echart.vue:335", "【lime-echarts】:", e);
return null;
}
},
getContext() {
return uni_modules_limeEchart_components_lEchart_utils.getRect(`#${this.canvasId}`, this, this.use2dCanvas).then((res) => {
if (res) {
let dpr = uni_modules_limeEchart_components_lEchart_utils.devicePixelRatio;
let { width, height, node } = res;
let canvas;
this.width = width = width || 300;
this.height = height = height || 300;
if (node) {
const ctx = node.getContext("2d");
canvas = new uni_modules_limeEchart_components_lEchart_canvas.Canvas(ctx, this, true, node);
this.canvasNode = node;
} else {
dpr = this.isPC ? uni_modules_limeEchart_components_lEchart_utils.devicePixelRatio : 1;
this.rect = res;
this.nodeWidth = width * dpr;
this.nodeHeight = height * dpr;
const ctx = common_vendor.index.createCanvasContext(this.canvasId, this);
canvas = new uni_modules_limeEchart_components_lEchart_canvas.Canvas(ctx, this, false);
}
return { canvas, width, height, devicePixelRatio: dpr, node };
} else {
return {};
}
});
},
getRelative(e, touches) {
let { clientX, clientY } = e;
if (!(clientX && clientY) && touches && touches[0]) {
clientX = touches[0].clientX;
clientY = touches[0].clientY;
}
return { x: clientX - this.rect.left, y: clientY - this.rect.top, wheelDelta: e.wheelDelta || 0 };
},
getTouch(e, touches) {
const { x } = touches && touches[0] || {};
const touch = x ? touches[0] : this.getRelative(e, touches);
if (this.landscape) {
[touch.x, touch.y] = [touch.y, this.height - touch.x];
}
return touch;
},
touchStart(e) {
this.isDown = true;
const next = () => {
const touches = uni_modules_limeEchart_components_lEchart_utils.convertTouchesToArray(e.touches);
if (this.chart) {
const touch = this.getTouch(e, touches);
this.startX = touch.x;
this.startY = touch.y;
this.startT = /* @__PURE__ */ new Date();
const handler = this.chart.getZr().handler;
uni_modules_limeEchart_components_lEchart_canvas.dispatch.call(handler, "mousedown", touch);
uni_modules_limeEchart_components_lEchart_canvas.dispatch.call(handler, "mousemove", touch);
handler.processGesture(uni_modules_limeEchart_components_lEchart_utils.wrapTouch(e), "start");
clearTimeout(this.endTimer);
}
};
if (this.isPC) {
uni_modules_limeEchart_components_lEchart_utils.getRect(`#${this.canvasId}`, { context: this }).then((res) => {
this.rect = res;
next();
});
return;
}
next();
},
touchMove(e) {
if (this.isPC && this.enableHover && !this.isDown) {
this.isDown = true;
}
const touches = uni_modules_limeEchart_components_lEchart_utils.convertTouchesToArray(e.touches);
if (this.chart && this.isDown) {
const handler = this.chart.getZr().handler;
uni_modules_limeEchart_components_lEchart_canvas.dispatch.call(handler, "mousemove", this.getTouch(e, touches));
handler.processGesture(uni_modules_limeEchart_components_lEchart_utils.wrapTouch(e), "change");
}
},
touchEnd(e) {
this.isDown = false;
if (this.chart) {
const touches = uni_modules_limeEchart_components_lEchart_utils.convertTouchesToArray(e.changedTouches);
const { x } = touches && touches[0] || {};
const touch = (x ? touches[0] : this.getRelative(e, touches)) || {};
if (this.landscape) {
[touch.x, touch.y] = [touch.y, this.height - touch.x];
}
const handler = this.chart.getZr().handler;
const isClick = Math.abs(touch.x - this.startX) < 10 && /* @__PURE__ */ new Date() - this.startT < 200;
uni_modules_limeEchart_components_lEchart_canvas.dispatch.call(handler, "mouseup", touch);
handler.processGesture(uni_modules_limeEchart_components_lEchart_utils.wrapTouch(e), "end");
if (isClick) {
uni_modules_limeEchart_components_lEchart_canvas.dispatch.call(handler, "click", touch);
} else {
this.endTimer = setTimeout(() => {
uni_modules_limeEchart_components_lEchart_canvas.dispatch.call(handler, "mousemove", { x: 999999999, y: 999999999 });
uni_modules_limeEchart_components_lEchart_canvas.dispatch.call(handler, "mouseup", { x: 999999999, y: 999999999 });
}, 50);
}
}
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $options.canvasId
}, $options.canvasId ? common_vendor.e({
b: $data.use2dCanvas
}, $data.use2dCanvas ? {
c: $options.canvasId,
d: common_vendor.s($options.canvasStyle),
e: $props.isDisableScroll,
f: common_vendor.o((...args) => $options.touchStart && $options.touchStart(...args)),
g: common_vendor.o((...args) => $options.touchMove && $options.touchMove(...args)),
h: common_vendor.o((...args) => $options.touchEnd && $options.touchEnd(...args))
} : {
i: $data.nodeWidth,
j: $data.nodeHeight,
k: common_vendor.s($options.canvasStyle),
l: $options.canvasId,
m: $options.canvasId,
n: $props.isDisableScroll,
o: common_vendor.o((...args) => $options.touchStart && $options.touchStart(...args)),
p: common_vendor.o((...args) => $options.touchMove && $options.touchMove(...args)),
q: common_vendor.o((...args) => $options.touchEnd && $options.touchEnd(...args))
}, {
r: $data.isPC
}, $data.isPC ? {
s: common_vendor.o((...args) => $options.touchStart && $options.touchStart(...args)),
t: common_vendor.o((...args) => $options.touchMove && $options.touchMove(...args)),
v: common_vendor.o((...args) => $options.touchEnd && $options.touchEnd(...args)),
w: common_vendor.o((...args) => $options.touchStart && $options.touchStart(...args)),
x: common_vendor.o((...args) => $options.touchMove && $options.touchMove(...args)),
y: common_vendor.o((...args) => $options.touchEnd && $options.touchEnd(...args))
} : {}, {
z: $data.isOffscreenCanvas
}, $data.isOffscreenCanvas ? {
A: common_vendor.s($options.offscreenStyle),
B: $options.offscreenCanvasId
} : {}, {
C: common_vendor.s($props.customStyle),
D: $data.ariaLabel
}) : {});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/lime-echart/components/l-echart/l-echart.js.map

View File

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@@ -0,0 +1 @@
<view wx:if="{{a}}" class="lime-echart" style="{{C}}" ref="limeEchart" aria-label="{{D}}"><canvas wx:if="{{b}}" class="lime-echart__canvas" type="2d" id="{{c}}" style="{{d}}" disable-scroll="{{e}}" bindtouchstart="{{f}}" bindtouchmove="{{g}}" bindtouchend="{{h}}"/><block wx:else><canvas wx:if="{{r0}}" class="lime-echart__canvas" width="{{i}}" height="{{j}}" style="{{k}}" canvas-id="{{l}}" id="{{m}}" disable-scroll="{{n}}" bindtouchstart="{{o}}" bindtouchmove="{{p}}" bindtouchend="{{q}}"/></block><view wx:if="{{r}}" class="lime-echart__mask" bindmousedown="{{s}}" bindmousemove="{{t}}" bindmouseup="{{v}}" bindtouchstart="{{w}}" bindtouchmove="{{x}}" bindtouchend="{{y}}"></view><canvas wx:if="{{z}}" style="{{A}}" canvas-id="{{B}}"></canvas></view>

View File

@@ -0,0 +1,21 @@
.lime-echart {
position: relative;
width: 100%;
height: 100%;
}
.lime-echart__canvas {
width: 100%;
height: 100%;
}
.lime-echart__mask {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
z-index: 1;
}

View File

@@ -0,0 +1,107 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
function getDeviceInfo() {
if (common_vendor.index.getDeviceInfo || common_vendor.index.canIUse("getDeviceInfo")) {
return common_vendor.index.getDeviceInfo();
} else {
return common_vendor.index.getSystemInfoSync();
}
}
function getWindowInfo() {
if (common_vendor.index.getWindowInfo || common_vendor.index.canIUse("getWindowInfo")) {
return common_vendor.index.getWindowInfo();
} else {
return common_vendor.index.getSystemInfoSync();
}
}
function getAppBaseInfo() {
if (common_vendor.index.getAppBaseInfo || common_vendor.index.canIUse("getAppBaseInfo")) {
return common_vendor.index.getAppBaseInfo();
} else {
return common_vendor.index.getSystemInfoSync();
}
}
function compareVersion(v1, v2) {
v1 = v1.split(".");
v2 = v2.split(".");
const len = Math.max(v1.length, v2.length);
while (v1.length < len) {
v1.push("0");
}
while (v2.length < len) {
v2.push("0");
}
for (let i = 0; i < len; i++) {
const num1 = parseInt(v1[i], 10);
const num2 = parseInt(v2[i], 10);
if (num1 > num2) {
return 1;
} else if (num1 < num2) {
return -1;
}
}
return 0;
}
function gte(version) {
const { platform } = getDeviceInfo();
let { SDKVersion } = getAppBaseInfo();
return platform !== "mac" && compareVersion(SDKVersion, version) >= 0;
}
function canIUseCanvas2d() {
return gte("2.9.0");
}
function convertTouchesToArray(touches) {
if (Array.isArray(touches)) {
return touches;
}
if (typeof touches === "object" && touches !== null) {
return Object.values(touches);
}
return touches;
}
function wrapTouch(event) {
event.touches = convertTouchesToArray(event.touches);
for (let i = 0; i < event.touches.length; ++i) {
const touch = event.touches[i];
touch.offsetX = touch.x;
touch.offsetY = touch.y;
}
return event;
}
const devicePixelRatio = getWindowInfo().pixelRatio;
function sleep(time) {
return new Promise((resolve) => {
setTimeout(() => {
resolve(true);
}, time);
});
}
function getRect(selector, context, node) {
return new Promise((resolve, reject) => {
const dom = common_vendor.index.createSelectorQuery().in(context).select(selector);
const result = (rect) => {
if (rect) {
resolve(rect);
} else {
reject();
}
};
if (!node) {
dom.boundingClientRect(result).exec();
} else {
dom.fields({
node: true,
size: true,
rect: true
}, result).exec();
}
});
}
exports.canIUseCanvas2d = canIUseCanvas2d;
exports.convertTouchesToArray = convertTouchesToArray;
exports.devicePixelRatio = devicePixelRatio;
exports.getDeviceInfo = getDeviceInfo;
exports.getRect = getRect;
exports.sleep = sleep;
exports.wrapTouch = wrapTouch;
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/lime-echart/components/l-echart/utils.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,129 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title></title>
<style type="text/css">
html,
body,
.canvas {
padding: 0;
margin: 0;
overflow-y: hidden;
background-color: transparent;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div class="canvas" id="limeChart"></div>
<script type="text/javascript" src="./uni.webview.1.5.3.js"></script>
<script type="text/javascript" src="./echarts.min.js"></script>
<script type="text/javascript" src="./ecStat.min.js"></script>
<!-- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-liquidfill@latest/dist/echarts-liquidfill.min.js"></script> -->
<script>
let chart = null;
let cache = [];
console.log = function(...agrs) {
postMessage(agrs)
}
function emit(event, data) {
let dataStr = JSON.stringify(data, stringify)
postMessage({
event,
data: dataStr
})
cache = []
}
function postMessage(data) {
uni.postMessage({
data
});
}
function stringify(key, value) {
if (typeof value === 'object' && value !== null) {
if (cache.indexOf(value) !== -1) {
return;
}
cache.push(value);
}
return value;
}
function parse(name, callback, options) {
const optionNameReg = /[\w]+\.setOption\(([\w]+\.)?([\w]+)\)/
if (optionNameReg.test(callback)) {
const optionNames = callback.match(optionNameReg)
if(optionNames[1]) {
const _this = optionNames[1].split('.')[0]
window[_this] = {}
window[_this][optionNames[2]] = options
return optionNames[2]
} else {
return null
}
}
return null
}
function init(callback, options, opts = {}, theme = null) {
if(!chart) {
chart = echarts.init(document.getElementById('limeChart'), theme, opts)
if(options) {
chart.setOption(options)
}
// const name = parse('a', callback, options)
// console.log('options::', callback)
// if(name) this[name] = options
// eval(`a = ${callback};`)
// if(a) {a(chart)}
}
}
function setChart(callback, options) {
if(!callback) return
if(chart && callback && options) {
var r = null
const name = parse('r', callback, options)
if(name) this[name] = options
eval(`r = ${callback};`)
if(r) {r(chart)}
}
}
function setOption(data) {
if (chart) chart.setOption(data[0], data[1])
}
function showLoading(data) {
if (chart) chart.showLoading(data[0], data[1])
}
function hideLoading() {
if (chart) chart.hideLoading()
}
function clear() {
if (chart) chart.clear()
}
function dispose() {
if (chart) chart.dispose()
}
function resize(size) {
if (chart) chart.resize(size)
}
function canvasToTempFilePath(opt = {}) {
if (chart) {
const src = chart.getDataURL(opt)
postMessage({
file: true,
data: src
})
}
}
</script>
</body>
</html>

View File

@@ -0,0 +1,177 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title></title>
<style type="text/css">
html,
body,
.canvas {
padding: 0;
margin: 0;
overflow-y: hidden;
background-color: transparent;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div class="canvas" id="limeChart"></div>
<script type="text/javascript" src="./uni.webview.1.5.3.js"></script>
<script type="text/javascript" src="./echarts.min.js"></script>
<script type="text/javascript" src="./ecStat.min.js"></script>
<!-- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-liquidfill@latest/dist/echarts-liquidfill.min.js"></script> -->
<script>
let chart = null;
let cache = [];
console.log = function(...agrs) {
postMessage(agrs)
}
function emit(event, data) {
let dataStr = JSON.stringify(data, stringify)
postMessage({
event,
data: dataStr
})
cache = []
}
function postMessage(data) {
uni.postMessage({
data
});
}
function stringify(key, value) {
if (typeof value === 'object' && value !== null) {
if (cache.indexOf(value) !== -1) {
return;
}
cache.push(value);
}
return value;
}
function parse(name, callback, options) {
const optionNameReg = /[\w]+\.setOption\(([\w]+\.)?([\w]+)\)/
if (optionNameReg.test(callback)) {
const optionNames = callback.match(optionNameReg)
if (optionNames[1]) {
const _this = optionNames[1].split('.')[0]
window[_this] = {}
window[_this][optionNames[2]] = options
return optionNames[2]
} else {
return null
}
}
return null
}
function init(callback, options, opts = {}, theme = null) {
if (!chart) {
chart = echarts.init(document.getElementById('limeChart'), theme, opts)
if (options) {
chart.setOption(options)
}
// const name = parse('a', callback, options)
// console.log('options::', callback)
// if(name) this[name] = options
// eval(`a = ${callback};`)
// if(a) {a(chart)}
}
}
function setChart(callback, options) {
if (!callback) return
if (chart && callback && options) {
var r = null
const name = parse('r', callback, options)
if (name) this[name] = options
eval(`r = ${callback};`)
if (r) {
r(chart)
}
}
}
function setOption(data) {
if (chart) chart.setOption(data[0], data[1])
}
function showLoading(data) {
if (chart) chart.showLoading(data[0], data[1])
}
function hideLoading() {
if (chart) chart.hideLoading()
}
function clear() {
if (chart) chart.clear()
}
function dispose() {
if (chart) chart.dispose()
}
function resize(size) {
if (chart) chart.resize(size)
}
function canvasToTempFilePath(opt = {}) {
if (chart) {
const src = chart.getDataURL(opt)
postMessage({
file: true,
data: src
})
}
}
function on(data) {
if (chart && data.length > 0) {
const [type, query] = data
const useQuery = query && typeof query != 'function'
const key = `${type}${useQuery ? JSON.stringify(query): '' }`
if (query) {
chart.on(type, query, (options) => {
const obj = {}
Object.keys(options).forEach(key => {
if (key != 'event') {
obj[key] = options[key]
}
})
emit(`@${key}`, {
event: key,
options: obj
})
})
} else {
chart.on(type, (options) => {
const obj = {}
Object.keys(options).forEach(key => {
if (key != 'event') {
obj[key] = options[key]
}
})
emit(`@${key}`, {
event: key,
options: obj
})
})
}
}
}
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,184 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title></title>
<style type="text/css">
html,
body {
overflow: hidden;
/* 隐藏滚动条 */
overscroll-behavior: none;
/* 禁止橡皮筋效果 */
}
html,
body,
.canvas {
padding: 0;
margin: 0;
overflow-y: hidden;
background-color: transparent;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div class="canvas" id="limeChart"></div>
<script type="text/javascript" src="./uni.webview.1.5.5.js"></script>
<script type="text/javascript" src="./echarts.min.js"></script>
<script type="text/javascript" src="./ecStat.min.js"></script>
<!-- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-liquidfill@latest/dist/echarts-liquidfill.min.js"></script> -->
<script>
let chart = null;
let cache = [];
console.log = function() {
emit('log', {
log: arguments,
})
}
function emit(event, data) {
postMessage({
event,
data
})
cache = []
}
function postMessage(data) {
uni.webView.postMessage({
data
})
// window.__uniapp_x_.postMessage(JSON.stringify(data))
};
function stringify(key, value) {
if (typeof value === 'object' && value !== null) {
if (cache.indexOf(value) !== -1) {
return;
}
cache.push(value);
}
return value;
}
function parse(name, callback, options) {
const optionNameReg = /[\w]+\.setOption\(([\w]+\.)?([\w]+)\)/
if (optionNameReg.test(callback)) {
const optionNames = callback.match(optionNameReg)
if (optionNames[1]) {
const _this = optionNames[1].split('.')[0]
window[_this] = {}
window[_this][optionNames[2]] = options
return optionNames[2]
} else {
return null
}
}
return null
}
function init(callback, options, opts, theme) {
if (!chart) {
chart = echarts.init(document.getElementById('limeChart'), theme, opts)
if (options) {
chart.setOption(options)
}
}
}
function on(data) {
if (chart && data.length > 0) {
const [type, query] = data
const key = `${type}${JSON.stringify(query||'')}`
if (query) {
chart.on(type, query, function(options) {
var obj = {};
Object.keys(options).forEach(function(key) {
if (key != 'event') {
obj[key] = options[key];
}
});
emit(key, {
event: key,
options: obj,
});
});
} else {
chart.on(type, function(options) {
var obj = {};
Object.keys(options).forEach(function(key) {
if (key != 'event') {
obj[key] = options[key];
}
});
emit(key, {
event: key,
options: obj,
});
});
}
}
}
function setChart(callback, options) {
if (!callback) return
if (chart && callback && options) {
var r = null
const name = parse('r', callback, options)
if (name) this[name] = options
eval(`r = ${callback};`)
if (r) {
r(chart)
}
}
}
function setOption(data) {
if (chart) chart.setOption(data[0], data[1])
}
function showLoading(data) {
if (chart) chart.showLoading(data[0], data[1])
}
function hideLoading() {
if (chart) chart.hideLoading()
}
function clear() {
if (chart) chart.clear()
}
function dispose() {
if (chart) chart.dispose()
}
function resize(size) {
if (chart) chart.resize(size)
}
function canvasToTempFilePath(opt) {
if (chart) {
delete opt.success
const src = chart.getDataURL(opt)
postMessage({
// event: 'file',
file: src
})
}
}
document.addEventListener('touchmove', () => {
})
</script>
</body>
</html>