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

193 lines
6.5 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const _sfc_main = {
__name: "index",
setup(__props) {
const itemArray = ["NU", "动态", "我的"];
const buttonArray = common_vendor.ref(["护理流程", "服务指令", "实时监控", "客户信息", "缴费账单", "充值缴费", "退住管理"]);
const itemTarget = common_vendor.ref(0);
const which = common_vendor.ref(0);
const scaning = common_vendor.ref(false);
function preview() {
common_vendor.index.previewImage({
urls: [common_assets.tu]
// 需要预览的所有图片地址数组
// current: imgList.value[currentIndex], // 当前点击的那张
});
}
const jumpTo = () => {
common_vendor.index.navigateTo({
url: "/pages/index/indexone"
});
};
const month = common_vendor.ref("01");
const day = common_vendor.ref("01");
const weekday = common_vendor.ref("周一");
const weekMap = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
const hours = common_vendor.ref("00");
const minutes = common_vendor.ref("00");
const seconds = common_vendor.ref("00");
let timer = null;
function updateTime() {
const now = /* @__PURE__ */ new Date();
month.value = String(now.getMonth() + 1).padStart(2, "0");
day.value = String(now.getDate()).padStart(2, "0");
weekday.value = weekMap[now.getDay()];
hours.value = String(now.getHours()).padStart(2, "0");
minutes.value = String(now.getMinutes()).padStart(2, "0");
seconds.value = String(now.getSeconds()).padStart(2, "0");
}
const whichMenu = common_vendor.ref(0);
const swiperchange = (res) => {
whichMenu.value = res.detail.current;
};
const addoldman = () => {
common_vendor.index.navigateTo({
url: "/pages/addoldman/IDcard"
});
};
const gotoPay = () => {
common_vendor.index.navigateTo({
url: "/pages/pay/index"
});
};
const qrResult = common_vendor.ref("");
const scanning = common_vendor.ref(false);
let html5QrCode = null;
async function cancelScan() {
if (html5QrCode && scanning.value) {
try {
await html5QrCode.stop();
} catch (e) {
common_vendor.index.__f__("warn", "at pages/index/index.vue:252", "停止扫码出错", e);
}
}
scanning.value = false;
}
function scanQrCode() {
if (html5QrCode && scanning.value) {
html5QrCode.stop().catch(() => {
}).finally(() => {
scanning.value = false;
});
return;
}
scanning.value = true;
qrResult.value = "";
html5QrCode = new Html5Qrcode("reader");
const config = {
fps: 10,
qrbox: {
width: 350,
height: 350
}
};
html5QrCode.start(
{
facingMode: "environment"
},
// 后置摄像头
config,
(decodedText) => {
qrResult.value = decodedText;
html5QrCode.stop().catch(console.warn).finally(() => {
scanning.value = false;
});
},
(errorMessage) => {
}
).catch((err) => {
common_vendor.index.__f__("error", "at pages/index/index.vue:299", "扫码启动失败", err);
scanning.value = false;
});
}
const gotoWindy = () => {
common_vendor.index.navigateTo({
url: "/pages/selectunit/map"
});
};
common_vendor.onMounted(async () => {
updateTime();
timer = setInterval(updateTime, 1e3);
});
common_vendor.onUnmounted(() => {
clearInterval(timer);
html5QrCode && html5QrCode.stop().catch(console.warn);
});
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.o(cancelScan),
b: common_vendor.o(() => {
}),
c: scanning.value,
d: common_assets._imports_0$3,
e: common_vendor.o(gotoPay),
f: common_assets._imports_1$2,
g: common_assets._imports_2$1,
h: common_assets._imports_3,
i: common_assets._imports_4,
j: common_vendor.o(jumpTo),
k: common_assets._imports_5,
l: common_vendor.unref(common_assets.tu),
m: common_vendor.o(($event) => preview()),
n: common_assets._imports_6,
o: common_vendor.o(($event) => {
scaning.value = false;
}),
p: qrResult.value
}, qrResult.value ? {
q: common_vendor.t(qrResult.value)
} : {}, {
r: common_assets._imports_7,
s: common_vendor.o(scanQrCode),
t: scaning.value,
v: common_vendor.t(hours.value),
w: common_vendor.t(minutes.value),
x: common_vendor.t(seconds.value),
y: common_vendor.t(month.value),
z: common_vendor.t(day.value),
A: common_vendor.t(weekday.value),
B: common_assets._imports_8,
C: common_assets._imports_9,
D: !scaning.value,
E: common_assets._imports_10,
F: common_assets._imports_11,
G: common_vendor.o(gotoWindy),
H: common_assets._imports_12,
I: common_vendor.o(($event) => scaning.value = true),
J: common_vendor.o(($event) => scaning.value = true),
K: common_assets._imports_13,
L: common_vendor.o(addoldman),
M: common_assets._imports_14,
N: common_vendor.f(buttonArray.value, (item, index, i0) => {
return {
a: `/static/index/jumpbutton/${index}.png`,
b: common_vendor.t(item),
c: index
};
}),
O: `600rpx`,
P: which.value,
Q: common_vendor.o(swiperchange),
R: !scaning.value,
S: whichMenu.value === 2,
T: common_vendor.f(itemArray, (item, index, i0) => {
return {
a: `/static/index/itemsbutton/${index}${itemTarget.value === index ? 1 : 0}.png`,
b: common_vendor.t(item),
c: common_vendor.s(!index ? {
fontWeight: 600
} : {}),
d: common_vendor.n(itemTarget.value === index ? `bottom-button-target` : `bottom-button`),
e: common_vendor.o(($event) => itemTarget.value = index)
};
})
});
};
}
};
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