237 lines
8.8 KiB
JavaScript
237 lines
8.8 KiB
JavaScript
"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("");
|
|
const buttonArray = common_vendor.ref(["长者信息", "监护人信息", "充值缴费", "退住管理 ", "长者功能", "长者功能", "长者功能"]);
|
|
const which = common_vendor.ref(0);
|
|
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);
|
|
});
|
|
const clickButton = (item, index) => {
|
|
switch (index) {
|
|
case 0:
|
|
pages_oldmanindex_api.queryElders(item.elderId).then((res) => {
|
|
common_vendor.index.__f__("log", "at pages/oldmanindex/index.vue:344", "AAAAA", res.result[0]);
|
|
});
|
|
break;
|
|
}
|
|
};
|
|
const jumpSaoyisao = () => {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/oldmanindex/saoyisao"
|
|
});
|
|
};
|
|
const jumpInput = () => {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/oldmanindex/input"
|
|
});
|
|
};
|
|
const clickSmallball = () => {
|
|
common_vendor.index.setStorageSync("jumpIndex", 0);
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/yuangongindex/message"
|
|
});
|
|
};
|
|
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"
|
|
});
|
|
};
|
|
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 = [];
|
|
menuArray.value = res2.result;
|
|
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;
|
|
}
|
|
});
|
|
});
|
|
common_vendor.onPullDownRefresh(() => {
|
|
loadingData();
|
|
pages_oldmanindex_api.isRead().then((res) => {
|
|
if (res.result) {
|
|
hong.value = res.result;
|
|
}
|
|
});
|
|
common_vendor.index.stopPullDownRefresh();
|
|
});
|
|
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),
|
|
e: common_vendor.o(($event) => show.value = false),
|
|
f: common_vendor.p({
|
|
show: show.value,
|
|
content: content.value
|
|
}),
|
|
g: common_vendor.f(menuArray.value, (item, index, i0) => {
|
|
return common_vendor.e({
|
|
a: item.applyStatus != `-1` && item.elderInfo
|
|
}, item.applyStatus != `-1` && item.elderInfo ? {
|
|
b: common_vendor.t(item.elderInfo && item.elderInfo.name),
|
|
c: common_vendor.t(item.elderInfo && item.elderInfo.nuId),
|
|
d: common_vendor.t(item.humidDeviceList && item.humidDeviceList[0] && item.humidDeviceList[0].temperature !== void 0 && item.humidDeviceList[0].temperature !== null ? item.humidDeviceList[0].temperature : "—"),
|
|
e: common_vendor.t(item.humidDeviceList && item.humidDeviceList[0] && item.humidDeviceList[0].humidity !== void 0 && item.humidDeviceList[0].humidity !== null ? item.humidDeviceList[0].humidity : "—"),
|
|
f: common_vendor.f(buttonArray.value, (item0, index2, i1) => {
|
|
return {
|
|
a: `https://www.focusnu.com/media/directive/index/oldmanmenu/${index2}.png`,
|
|
b: common_vendor.t(item0),
|
|
c: index2,
|
|
d: common_vendor.o(($event) => clickButton(item, index2), index2)
|
|
};
|
|
})
|
|
} : {}, {
|
|
g: item.applyStatus != `-1` && !item.elderInfo
|
|
}, item.applyStatus != `-1` && !item.elderInfo ? {
|
|
h: common_vendor.t(timeText.value),
|
|
i: common_vendor.t(dateText.value),
|
|
j: common_vendor.t(weekdayText.value),
|
|
k: common_vendor.t(item.humidDeviceList && item.humidDeviceList[0] && item.humidDeviceList[0].temperature !== void 0 && item.humidDeviceList[0].temperature !== null ? item.humidDeviceList[0].temperature : "—"),
|
|
l: common_vendor.t(item.humidDeviceList && item.humidDeviceList[0] && item.humidDeviceList[0].humidity !== void 0 && item.humidDeviceList[0].humidity !== null ? item.humidDeviceList[0].humidity : "—")
|
|
} : {}, {
|
|
m: item.applyStatus != `-1` && !item.elderInfo
|
|
}, item.applyStatus != `-1` && !item.elderInfo ? {
|
|
n: common_vendor.t(item.nuName),
|
|
o: common_vendor.o(($event) => searchjigou(item), index)
|
|
} : {}, {
|
|
p: item.applyStatus == `-1`
|
|
}, item.applyStatus == `-1` ? {
|
|
q: `https://www.focusnu.com/media/directive/index/saoyisaowhite.png`,
|
|
r: common_vendor.o(jumpSaoyisao, index),
|
|
s: `https://www.focusnu.com/media/directive/index/shoudong.png`,
|
|
t: common_vendor.o(jumpInput, index)
|
|
} : {}, {
|
|
v: item.applyStatus != `-1`
|
|
}, item.applyStatus != `-1` ? {
|
|
w: common_vendor.t(item.departName)
|
|
} : {}, {
|
|
x: index
|
|
});
|
|
}),
|
|
h: `100vh`,
|
|
i: which.value,
|
|
j: common_vendor.o(swiperchange),
|
|
k: common_vendor.f(menuArray.value, (item, index, i0) => {
|
|
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)
|
|
});
|
|
}),
|
|
l: common_vendor.p({
|
|
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
|