hldy_app/unpackage/dist/dev/mp-weixin/component/Initialization/leida.js

139 lines
5.3 KiB
JavaScript
Raw Normal View History

2025-06-19 17:04:05 +08:00
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "leida",
props: { isShow: { type: Boolean, required: true } },
emits: ["nav"],
setup(__props, { emit: __emit }) {
const props = __props;
const savevalue = common_vendor.ref("");
const renamenummber = common_vendor.ref(-1);
const transition = common_vendor.ref(true);
const progress = common_vendor.ref(0);
const scrollTop = common_vendor.ref(0);
common_vendor.ref(null);
const rightbutton = common_vendor.ref([
{ url: "/static/index/leida/00.png", targetUrl: "/static/index/leida/01.png", target: false },
{ url: "/static/index/leida/10.png", targetUrl: "/static/index/leida/11.png", target: false },
{ url: "/static/index/leida/20.png", targetUrl: "/static/index/leida/21.png", target: false },
{ url: "/static/index/leida/30.png", targetUrl: "/static/index/leida/31.png", target: false }
]);
const cardarray = common_vendor.ref([]);
common_vendor.watch(
() => props.isShow,
(newVal, oldVal) => {
if (!oldVal && newVal) {
transition.value = false;
setTimeout(() => transition.value = true, 50);
suiji();
const timer = setInterval(() => {
progress.value += 0.01;
if (progress.value >= 1)
clearInterval(timer);
}, 50);
}
}
);
function suiji() {
const n = 10;
cardarray.value = [];
const randomWeights = Array.from({ length: n }, () => Math.random());
const totalWeight = randomWeights.reduce((a, b) => a + b, 0);
const intervals = randomWeights.map((w) => w / totalWeight * 5e3);
let cumulative = 0;
for (let i = 0; i < n; i++) {
cumulative += intervals[i];
setTimeout(async () => {
const menuCopy = JSON.parse(JSON.stringify(rightbutton.value));
cardarray.value.push({ menu: menuCopy, name: `未命名${i}`, isNew: true });
const len = cardarray.value.length;
if (len >= 5 && len % 2 === 1) {
scrollTop.value = 0;
await common_vendor.nextTick$1();
scrollTop.value = 99999;
}
}, cumulative);
}
}
function again() {
renamenummber.value = -1;
suiji();
progress.value = 0;
const timer = setInterval(() => {
progress.value += 0.01;
if (progress.value >= 1)
clearInterval(timer);
}, 50);
}
function onAnimEnd(item) {
item.isNew = false;
}
const changename = (name, index) => {
if (name) {
cardarray.value[index].name = name;
}
renamenummber.value = -1;
};
common_vendor.onMounted(() => {
});
return (_ctx, _cache) => {
return {
a: common_assets._imports_0$8,
b: common_vendor.n(progress.value < 1 ? "spin-anim" : "no-anim"),
c: common_assets._imports_1$6,
d: common_vendor.n(progress.value < 1 ? "spin-anim-spec" : "no-anim-spec"),
e: `scaleX(${progress.value})`,
f: common_vendor.t(progress.value >= 1 ? "扫描完成。" : "正在使用雷达区域扫描护理机构,"),
g: common_vendor.t(progress.value >= 1 ? "" : "请稍后..."),
h: common_vendor.o(again),
i: common_vendor.f(cardarray.value, (allitem, allindex, i0) => {
return common_vendor.e({
a: common_vendor.o(($event) => renamenummber.value = -1, allindex),
b: common_vendor.f(allitem.menu, (item, index, i1) => {
return {
a: item.target ? item.targetUrl : item.url,
b: index,
c: common_vendor.o(($event) => {
item.target = !item.target;
renamenummber.value = -1;
}, index)
};
}),
c: common_vendor.t(allitem.name),
d: common_vendor.o(($event) => {
renamenummber.value = allindex;
savevalue.value = allitem.name;
}, allindex),
e: renamenummber.value == allindex
}, renamenummber.value == allindex ? {
f: common_assets._imports_4$1,
g: savevalue.value,
h: common_vendor.o(($event) => savevalue.value = $event.detail.value, allindex),
i: savevalue.value,
j: common_assets._imports_5$1,
k: common_vendor.o(($event) => savevalue.value = ``, allindex),
l: common_vendor.o(($event) => changename(savevalue.value, allindex), allindex)
} : {}, {
m: allindex,
n: allitem.isNew ? 1 : "",
o: common_vendor.o(($event) => onAnimEnd(allitem), allindex)
});
}),
j: common_assets._imports_2$2,
k: common_assets._imports_3$2,
l: scrollTop.value,
m: __props.isShow,
n: common_vendor.s(transition.value ? {
opacity: `1`
} : {
opacity: `0`
})
};
};
}
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-14770cca"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/component/Initialization/leida.js.map