hldy_xcx/unpackage/dist/dev/mp-weixin/pages/oldmanindex/index.js

252 lines
9.5 KiB
JavaScript
Raw Normal View History

2025-09-15 17:23:33 +08:00
"use strict";
const common_vendor = require("../../common/vendor.js");
const pages_oldmanindex_api = require("./api.js");
if (!Math) {
(model + downMenu)();
}
const downMenu = () => "../../compontent/public/oldmandownmenu.js";
const model = () => "../../compontent/public/model.js";
const _sfc_main = {
__name: "index",
setup(__props) {
const show = common_vendor.ref(false);
const content = common_vendor.ref("");
2025-09-26 13:30:13 +08:00
const buttonArray = common_vendor.ref(["护理服务", "医疗服务", "账单查询", "视频监视", "外出申请", "长者信息", "监护人"]);
2025-09-15 17:23:33 +08:00
const which = common_vendor.ref(0);
2025-09-19 17:12:59 +08:00
const timeText = common_vendor.ref("");
const dateText = common_vendor.ref("");
const weekdayText = common_vendor.ref("");
const fullText = common_vendor.ref("");
let timer = null;
const pad = (n) => String(n).padStart(2, "0");
function formatParts(d) {
const hh = pad(d.getHours());
const mm = pad(d.getMinutes());
const ss = pad(d.getSeconds());
const month = pad(d.getMonth() + 1);
const day = pad(d.getDate());
const weekdayMap = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
return {
time: `${hh}:${mm}:${ss}`,
date: `${month}${day}`,
weekday: weekdayMap[d.getDay()]
};
}
function updateWithDate(d = /* @__PURE__ */ new Date()) {
const {
time,
date,
weekday
} = formatParts(d);
timeText.value = time;
dateText.value = date;
weekdayText.value = weekday;
fullText.value = `${time} ${date} ${weekday}`;
}
common_vendor.onLoad(() => {
updateWithDate();
timer = setInterval(() => updateWithDate(), 1e3);
});
common_vendor.onUnload(() => {
if (timer)
clearInterval(timer);
});
2025-09-23 17:15:17 +08:00
const clickButton = (item, index) => {
switch (index) {
2025-09-26 13:30:13 +08:00
case 5:
2025-09-26 16:46:17 +08:00
pages_oldmanindex_api.queryElders(item.elderId, item.orgCode).then((res) => {
common_vendor.index.navigateTo({
url: `/pages/addoldman/oldmanall?element=${JSON.stringify(res.result[0])}`
2025-09-25 17:30:11 +08:00
});
2025-09-26 16:46:17 +08:00
});
2025-09-25 17:30:11 +08:00
break;
2025-09-26 13:30:13 +08:00
case 6:
2025-09-26 16:46:17 +08:00
pages_oldmanindex_api.queryElders(item.elderId, item.orgCode).then((res) => {
common_vendor.index.navigateTo({
url: `/pages/addoldman/jianhurenall?element=${JSON.stringify(res.result[0])}`
2025-09-25 17:30:11 +08:00
});
2025-09-26 16:46:17 +08:00
});
2025-09-23 17:15:17 +08:00
break;
}
};
2025-09-15 17:23:33 +08:00
const jumpSaoyisao = () => {
common_vendor.index.navigateTo({
url: "/pages/oldmanindex/saoyisao"
});
};
2025-09-19 17:12:59 +08:00
const jumpInput = () => {
common_vendor.index.navigateTo({
url: "/pages/oldmanindex/input"
});
};
2025-09-15 17:23:33 +08:00
const clickSmallball = () => {
2025-09-19 17:12:59 +08:00
common_vendor.index.setStorageSync("jumpIndex", 0);
2025-09-15 17:23:33 +08:00
common_vendor.index.navigateTo({
url: "/pages/yuangongindex/message"
});
};
2025-09-19 17:12:59 +08:00
const searchjigou = (item) => {
common_vendor.index.setStorageSync("baddata", "");
common_vendor.index.setStorageSync("specicalid", "");
common_vendor.index.setStorageSync("backhuancun", {});
let data = {
nuId: item.nuId,
orgCode: item.orgCode
};
common_vendor.index.setStorageSync("oldman", data);
common_vendor.index.navigateTo({
url: "/pages/addoldman/oldIDcard"
});
};
2025-09-15 17:23:33 +08:00
const changecard = (e) => {
which.value = e;
whichMenu.value = which.value;
};
const moveend = () => {
which.value = menuArray.value.length;
whichMenu.value = which.value;
};
const whichMenu = common_vendor.ref(0);
const swiperchange = (res) => {
whichMenu.value = res.detail.current;
which.value = res.detail.current;
};
const moveHeight = common_vendor.ref(0);
common_vendor.onMounted(() => {
let capsule = null;
if (typeof common_vendor.index.getMenuButtonBoundingClientRect === "function") {
try {
capsule = common_vendor.index.getMenuButtonBoundingClientRect();
} catch (e) {
capsule = null;
}
moveHeight.value = capsule.top;
}
});
common_vendor.onUnmounted(() => {
});
const menuArray = common_vendor.ref([]);
const loadingData = () => {
common_vendor.index.getStorage({
key: "openid",
success: function(res) {
pages_oldmanindex_api.getIndex(res.data).then((res2) => {
menuArray.value = [];
2025-09-19 17:12:59 +08:00
menuArray.value = res2.result;
2025-09-15 17:23:33 +08:00
menuArray.value.push({
applyStatus: `-1`
});
});
}
});
};
const hong = common_vendor.ref(0);
common_vendor.onShow(() => {
loadingData();
pages_oldmanindex_api.isRead().then((res) => {
if (res.result) {
hong.value = res.result;
}
});
});
2025-09-23 17:15:17 +08:00
common_vendor.onPullDownRefresh(() => {
loadingData();
pages_oldmanindex_api.isRead().then((res) => {
if (res.result) {
hong.value = res.result;
}
});
common_vendor.index.stopPullDownRefresh();
});
2025-09-15 17:23:33 +08:00
return (_ctx, _cache) => {
return common_vendor.e({
a: hong.value
}, hong.value ? {
b: common_vendor.t(hong.value)
} : {}, {
c: `${moveHeight.value}px`,
d: common_vendor.o(clickSmallball),
2025-09-19 17:12:59 +08:00
e: common_vendor.o(($event) => show.value = false),
f: common_vendor.p({
2025-09-15 17:23:33 +08:00
show: show.value,
content: content.value
}),
2025-09-19 17:12:59 +08:00
g: common_vendor.f(menuArray.value, (item, index, i0) => {
2025-09-15 17:23:33 +08:00
return common_vendor.e({
2025-09-19 17:12:59 +08:00
a: item.applyStatus != `-1` && item.elderInfo
}, item.applyStatus != `-1` && item.elderInfo ? {
2025-09-26 13:30:13 +08:00
b: common_vendor.t(item.elderInfo && item.elderInfo.nuId),
c: common_vendor.t(timeText.value),
d: common_vendor.t(dateText.value),
e: common_vendor.t(weekdayText.value),
f: common_vendor.t(item.humidDeviceList && item.humidDeviceList[0] && item.humidDeviceList[0].humidity !== void 0 && item.humidDeviceList[0].humidity !== null ? item.humidDeviceList[0].humidity : "—"),
g: common_vendor.t(item.humidDeviceList && item.humidDeviceList[0] && item.humidDeviceList[0].temperature !== void 0 && item.humidDeviceList[0].temperature !== null ? item.humidDeviceList[0].temperature : "—"),
h: common_vendor.t(item.elderInfo && item.elderInfo.name),
i: common_vendor.t(item.nuName),
j: common_vendor.t(item.departName),
k: common_vendor.f(buttonArray.value, (item0, index2, i1) => {
2025-09-15 17:23:33 +08:00
return {
2025-09-26 13:30:13 +08:00
a: `https://www.focusnu.com/media/directive/index/oldmanphoto/${index2}.png`,
2025-09-23 17:15:17 +08:00
b: common_vendor.t(item0),
c: index2,
d: common_vendor.o(($event) => clickButton(item, index2), index2)
2025-09-15 17:23:33 +08:00
};
2025-09-26 13:30:13 +08:00
}),
l: `https://www.focusnu.com/media/directive/index/oldmanphoto/more.png`
2025-09-15 17:23:33 +08:00
} : {}, {
2025-09-26 13:30:13 +08:00
m: item.applyStatus != `-1` && !item.elderInfo
2025-09-19 17:12:59 +08:00
}, item.applyStatus != `-1` && !item.elderInfo ? {
2025-09-26 13:30:13 +08:00
n: common_vendor.t(timeText.value),
o: common_vendor.t(dateText.value),
p: common_vendor.t(weekdayText.value),
q: common_vendor.t(item.humidDeviceList && item.humidDeviceList[0] && item.humidDeviceList[0].temperature !== void 0 && item.humidDeviceList[0].temperature !== null ? item.humidDeviceList[0].temperature : "—"),
r: common_vendor.t(item.humidDeviceList && item.humidDeviceList[0] && item.humidDeviceList[0].humidity !== void 0 && item.humidDeviceList[0].humidity !== null ? item.humidDeviceList[0].humidity : "—")
2025-09-19 17:12:59 +08:00
} : {}, {
2025-09-26 13:30:13 +08:00
s: item.applyStatus != `-1` && !item.elderInfo
2025-09-19 17:12:59 +08:00
}, item.applyStatus != `-1` && !item.elderInfo ? {
2025-09-26 13:30:13 +08:00
t: common_vendor.t(item.nuName),
v: common_vendor.o(($event) => searchjigou(item), index)
2025-09-19 17:12:59 +08:00
} : {}, {
2025-09-26 13:30:13 +08:00
w: item.applyStatus == `-1`
2025-09-15 17:23:33 +08:00
}, item.applyStatus == `-1` ? {
2025-09-26 13:30:13 +08:00
x: `https://www.focusnu.com/media/directive/index/saoyisaowhite.png`,
y: common_vendor.o(jumpSaoyisao, index),
z: `https://www.focusnu.com/media/directive/index/shoudong.png`,
A: common_vendor.o(jumpInput, index)
2025-09-15 17:23:33 +08:00
} : {}, {
2025-09-26 13:30:13 +08:00
B: item.applyStatus != `-1` && !item.elderInfo
2025-09-25 17:30:11 +08:00
}, item.applyStatus != `-1` && !item.elderInfo ? {
2025-09-26 13:30:13 +08:00
C: common_vendor.t(item.departName)
2025-09-15 17:23:33 +08:00
} : {}, {
2025-09-26 13:30:13 +08:00
D: index
2025-09-15 17:23:33 +08:00
});
}),
2025-09-19 17:12:59 +08:00
h: `100vh`,
i: which.value,
j: common_vendor.o(swiperchange),
k: common_vendor.f(menuArray.value, (item, index, i0) => {
2025-09-15 17:23:33 +08:00
return common_vendor.e({
a: index != menuArray.value.length - 1
}, index != menuArray.value.length - 1 ? {
b: common_vendor.n(whichMenu.value == index ? `black-box` : `gray-box`)
} : {}, {
c: index == menuArray.value.length - 1
}, index == menuArray.value.length - 1 ? {
d: `https://www.focusnu.com/media/directive/index/bluejia.png`,
e: common_vendor.o(moveend, index)
} : {}, {
f: index,
g: common_vendor.o(($event) => changecard(index), index)
});
}),
2025-09-19 17:12:59 +08:00
l: common_vendor.p({
2025-09-15 17:23:33 +08:00
itemTarget: 0
})
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-9cf2c967"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/oldmanindex/index.js.map