hldy_app/unpackage/dist/dev/mp-weixin/pages/index/index.js

174 lines
6.2 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
if (!Math) {
(rightItemsfirst + rightItemssecond)();
}
const rightItemsfirst = () => "../../component/rightItemsindex/index.js";
const rightItemssecond = () => "../../component/rightItemssecond/index.js";
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "index",
setup(__props) {
const iconList = common_vendor.ref([
{ url: "/static/index/lefticon/index.png", targetUrl: "/static/index/lefticontarget/blueindex.png" },
{ url: "/static/index/lefticon/nurse.png", targetUrl: "/static/index/lefticontarget/bluenurse.png" },
{ url: "/static/index/lefticon/doctor.png", targetUrl: "/static/index/lefticontarget/bluedoctor.png" },
{ url: "/static/index/lefticon/give.png", targetUrl: "/static/index/lefticontarget/givedark.png" },
{ url: "/static/index/lefticon/wifi.png", targetUrl: "/static/index/lefticontarget/bluewifi.png" },
{ url: "/static/index/lefticon/back.png", targetUrl: "/static/index/lefticontarget/blueback.png" }
]);
const menuIndex = common_vendor.ref(1);
const menuIndexshow = common_vendor.ref(false);
const menuIndexshowsecond = common_vendor.ref(false);
const darkFans = common_vendor.ref(false);
common_vendor.ref([]);
common_vendor.ref(0);
common_vendor.ref(0);
common_vendor.ref(0);
common_vendor.ref(0);
common_vendor.ref(0);
const darkchange = (res) => {
darkFans.value = res;
};
const changeMenu = (index) => {
if (index === 3) {
menuIndexshow.value = false;
menuIndexshowsecond.value = false;
common_vendor.index.navigateTo({
url: `/pages/somethingmove/index?darkFans=${darkFans.value}`,
animationType: "slide-in-right",
animationDuration: 400
// 设置动画时长为300毫秒, // 动画持续时间,单位为毫秒
});
return;
}
menuIndex.value = index;
menuIndexshow.value = false;
menuIndexshowsecond.value = false;
setTimeout(() => {
switch (index) {
case 0:
menuIndexshow.value = true;
break;
case 1:
menuIndexshowsecond.value = true;
break;
}
}, 50);
};
const clientX = common_vendor.ref(0);
const clientY = common_vendor.ref(0);
const savename = common_vendor.ref("");
const canmove = common_vendor.ref(true);
const indexNumber = common_vendor.ref({
index0: 999,
index1: 999
});
const getxyrel = (event) => {
const touch = event.touches[0];
clientX.value = 2 * (Math.floor(touch.clientX) - 100);
clientY.value = 2 * (Math.floor(touch.clientY) - 55);
const translateX = Math.floor(touch.clientX) - 50;
const translateY = Math.floor(touch.clientY) - 25;
const clickedItem = fangkuaiValue.value.find((item) => {
return translateX >= item.left && translateX <= item.right && translateY >= item.top && translateY <= item.bottom;
});
if (clickedItem) {
const { index0, index1 } = clickedItem.dataset;
indexNumber.value.index0 = index0;
indexNumber.value.index1 = index1;
} else {
indexNumber.value.index0 = 999;
indexNumber.value.index1 = 999;
}
};
const getxy = throttle(getxyrel, 10);
const fangkuaiValue = common_vendor.ref([]);
const openname = (res, fangkuai) => {
savename.value = res;
canmove.value = false;
fangkuaiValue.value = fangkuai;
};
const closename = () => {
savename.value = "";
canmove.value = true;
fangkuaiValue.value = [];
};
const ruler = common_vendor.ref(null);
const cleanall = () => {
var _a;
clientX.value = 9999;
clientY.value = 9999;
canmove.value = true;
indexNumber.value = {
index0: 999,
index1: 999
};
(_a = ruler.value) == null ? void 0 : _a.rulerEnd(savename.value);
savename.value = "";
};
function throttle(fn, delay) {
let lastExecutionTime = 0;
return function(...args) {
const now = Date.now();
if (now - lastExecutionTime >= delay) {
lastExecutionTime = now;
fn.apply(this, args);
}
};
}
common_vendor.onShow(() => {
setTimeout(() => {
changeMenu(menuIndex.value);
}, 50);
});
return (_ctx, _cache) => {
return {
a: common_vendor.t(savename.value),
b: savename.value && clientX.value,
c: `${clientY.value}rpx`,
d: `${clientX.value}rpx`,
e: common_assets._imports_0,
f: common_vendor.n(darkFans.value ? `left-head-font-dark` : `left-head-font`),
g: common_vendor.f(iconList.value, (item, index, i0) => {
return {
a: index === menuIndex.value,
b: index === menuIndex.value ? item.targetUrl : item.url,
c: common_vendor.o(($event) => changeMenu(index), index),
d: index
};
}),
h: `/static/index/ray.png`,
i: !menuIndex.value,
j: common_vendor.o(darkchange),
k: common_vendor.p({
isshow: menuIndexshow.value,
darkFans: darkFans.value
}),
l: common_vendor.sr(ruler, "1cf27b2a-1", {
"k": "ruler"
}),
m: menuIndex.value == 1,
n: common_vendor.o(darkchange),
o: common_vendor.o(openname),
p: common_vendor.o(closename),
q: common_vendor.p({
liang: indexNumber.value,
isshow: menuIndexshowsecond.value,
canmove: canmove.value,
darkFans: darkFans.value
}),
r: common_vendor.n(darkFans.value ? `darkbackgroundContainer` : `backgroundContainer`),
s: common_vendor.o(
//@ts-ignore
(...args) => common_vendor.unref(getxy) && common_vendor.unref(getxy)(...args)
),
t: common_vendor.o(cleanall)
};
};
}
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1cf27b2a"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/index.js.map