"use strict";
|
const common_vendor = require("../../common/vendor.js");
|
const _sfc_main = {
|
__name: "notification",
|
setup(__props) {
|
const settings = common_vendor.ref({
|
system: true,
|
appointment: true,
|
medical: true,
|
payment: true
|
});
|
const notifyMethods = common_vendor.ref({
|
app: true,
|
sms: true,
|
wechat: true
|
});
|
const messages = common_vendor.ref([
|
{
|
id: 1,
|
type: "appointment",
|
title: "预约提醒",
|
content: "您预约的明天上午9:30心内科张医生的门诊即将开始",
|
time: "10分钟前",
|
read: false
|
},
|
{
|
id: 2,
|
type: "payment",
|
title: "缴费提醒",
|
content: "您有一笔¥360.00的待缴费订单,请及时处理",
|
time: "1小时前",
|
read: false
|
},
|
{
|
id: 3,
|
type: "system",
|
title: "系统通知",
|
content: "系统将于今晚23:00-次日凌晨2:00进行维护升级",
|
time: "2小时前",
|
read: true
|
},
|
{
|
id: 4,
|
type: "medical",
|
title: "取药提醒",
|
content: "您的处方药已准备就绪,请到3号窗口取药",
|
time: "昨天",
|
read: true
|
}
|
]);
|
const toggleSetting = (key, value) => {
|
settings.value[key] = value;
|
common_vendor.index.showToast({
|
title: value ? "已开启" : "已关闭",
|
icon: "success"
|
});
|
};
|
const toggleNotifyMethod = (key, value) => {
|
notifyMethods.value[key] = value;
|
common_vendor.index.showToast({
|
title: value ? "已开启" : "已关闭",
|
icon: "success"
|
});
|
};
|
const getIconClass = (type) => {
|
const icons = {
|
system: "icon-system",
|
appointment: "icon-calendar",
|
medical: "icon-medical",
|
payment: "icon-wallet"
|
};
|
return icons[type];
|
};
|
const viewMessage = (message) => {
|
message.read = true;
|
common_vendor.index.__f__("log", "at pages/my/notification.vue:213", "查看消息:", message);
|
};
|
const clearMessages = () => {
|
common_vendor.index.showModal({
|
title: "提示",
|
content: "确定要清空所有消息吗?",
|
success: (res) => {
|
if (res.confirm) {
|
messages.value = [];
|
common_vendor.index.showToast({
|
title: "已清空",
|
icon: "success"
|
});
|
}
|
}
|
});
|
};
|
return (_ctx, _cache) => {
|
return {
|
a: settings.value.system,
|
b: common_vendor.o((e) => toggleSetting("system", e.detail.value)),
|
c: settings.value.appointment,
|
d: common_vendor.o((e) => toggleSetting("appointment", e.detail.value)),
|
e: settings.value.medical,
|
f: common_vendor.o((e) => toggleSetting("medical", e.detail.value)),
|
g: settings.value.payment,
|
h: common_vendor.o((e) => toggleSetting("payment", e.detail.value)),
|
i: common_vendor.o(clearMessages),
|
j: common_vendor.f(messages.value, (message, index, i0) => {
|
return common_vendor.e({
|
a: common_vendor.n(getIconClass(message.type)),
|
b: common_vendor.n(message.type),
|
c: common_vendor.t(message.title),
|
d: common_vendor.t(message.time),
|
e: common_vendor.t(message.content),
|
f: !message.read
|
}, !message.read ? {} : {}, {
|
g: index,
|
h: !message.read ? 1 : "",
|
i: common_vendor.o(($event) => viewMessage(message), index)
|
});
|
}),
|
k: notifyMethods.value.app,
|
l: common_vendor.o((e) => toggleNotifyMethod("app", e.detail.value)),
|
m: notifyMethods.value.sms,
|
n: common_vendor.o((e) => toggleNotifyMethod("sms", e.detail.value)),
|
o: notifyMethods.value.wechat,
|
p: common_vendor.o((e) => toggleNotifyMethod("wechat", e.detail.value)),
|
q: common_vendor.gei(_ctx, "")
|
};
|
};
|
}
|
};
|
wx.createPage(_sfc_main);
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/my/notification.js.map
|