Files
陈誉午 994b267f5c feat: 电子药箱小程序 - 4Tab药品管理
- 电子药箱: 药品库存管理 + 手动录入 + 今日用药打卡
- 药品百科: 搜索 + 分类筛选 + 20种药品静态数据
- 惠教中心: 4条药品使用指南课程
- 我的: 家庭成员信息管理
- 自定义TabBar + navigation-bar组件
- SVG药品分类插图
2026-07-29 11:20:52 +08:00

1 line
4.5 KiB
JavaScript

"use strict";var _NOTIFICATION_PRIORIT;function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _defineProperty(t,i,o){return(i=_toPropertyKey(i))in t?Object.defineProperty(t,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[i]=o,t}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"===_typeof(i)?i:String(i)}function _toPrimitive(t,i){if("object"!==_typeof(t)||null===t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var e=o.call(t,i||"default");if("object"!==_typeof(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===i?String:Number)(t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.toggleNotificationStateWithToast=exports.toggleNotificationState=exports.syncNotificationState=exports.isOpenSwitch=exports.isNotificationSendTypeEnabled=exports.hasEnabledSystemNotification=exports.getNotificationStorageKey=exports.getNotificationPriority=exports.NOTIFICATION_SEND_TYPE=void 0;var STORAGE_PREFIX="volc_live_notification_",NOTIFICATION_OPEN_TOAST_TITLE="已开启其他用户的表情及互动特效显示",NOTIFICATION_CLOSE_TOAST_TITLE="已关闭其他用户的表情及互动特效显示",isOpenSwitch=function(t){return 1===t||!0===t||"1"===t||"true"===t};exports.isOpenSwitch=isOpenSwitch;var hasEnabledSystemNotification=function(t){return Object.values(t||{}).some(isOpenSwitch)};exports.hasEnabledSystemNotification=hasEnabledSystemNotification;var SEND_TYPE_SWITCH_KEY={1:"IsEntryMessageEnable",2:"IsGiftMessageEnable",3:"IsLotteryMessageEnable",4:"IsRedPacketMessageEnable",5:"IsDynamicEmojiMessageEnable",6:"IsCustomMessageEnable"},NOTIFICATION_SEND_TYPE={ENTRY:1,GIFT:2,LOTTERY:3,LUCKMONEY:4,DYNAMIC_EMOJI:5,CUSTOM:6};exports.NOTIFICATION_SEND_TYPE=NOTIFICATION_SEND_TYPE;var NOTIFICATION_PRIORITY=(_defineProperty(_NOTIFICATION_PRIORIT={},NOTIFICATION_SEND_TYPE.ENTRY,1),_defineProperty(_NOTIFICATION_PRIORIT,NOTIFICATION_SEND_TYPE.GIFT,2),_defineProperty(_NOTIFICATION_PRIORIT,NOTIFICATION_SEND_TYPE.CUSTOM,3),_defineProperty(_NOTIFICATION_PRIORIT,NOTIFICATION_SEND_TYPE.LOTTERY,4),_defineProperty(_NOTIFICATION_PRIORIT,NOTIFICATION_SEND_TYPE.LUCKMONEY,5),_NOTIFICATION_PRIORIT),isNotificationSendTypeEnabled=function(t,i){var o=SEND_TYPE_SWITCH_KEY[Number(i)];return!!o&&isOpenSwitch(null==t?void 0:t[o])};exports.isNotificationSendTypeEnabled=isNotificationSendTypeEnabled;var getNotificationPriority=function(t){return NOTIFICATION_PRIORITY[Number(t)]||0};exports.getNotificationPriority=getNotificationPriority;var getActivityId=function(t,i){var o,e,n;return(null==i?void 0:i.ActivityId)||(null==i||null===(o=i.Basic)||void 0===o?void 0:o.ActivityId)||(null==t||null===(e=t.get)||void 0===e?void 0:e.call(t,"mainInfo.activityId"))||(null==t||null===(n=t.get)||void 0===n?void 0:n.call(t,"mainInfo.ActivityId"))||""},getNotificationStorageKey=function(t,i){return"".concat(STORAGE_PREFIX).concat(getActivityId(t,i)||"default")};exports.getNotificationStorageKey=getNotificationStorageKey;var readStoredOpen=function(t){try{var i=wx.getStorageSync(t);if(0===i||"0"===i||!1===i)return!1;if(1===i||"1"===i||!0===i)return!0}catch(t){}return null},syncNotificationState=function(t,i){if(t){var o=hasEnabledSystemNotification(null==i?void 0:i.MessageSwitch),e=getNotificationStorageKey(t,i),n=readStoredOpen(e),a=o&&(null===n||n),r=t.get("notification")||{};r.storageKey===e&&r.isShowNotificationButton===o&&r.isNotificationOpen===a||t.set({"notification.storageKey":e,"notification.isShowNotificationButton":o,"notification.isNotificationOpen":a})}};exports.syncNotificationState=syncNotificationState;var toggleNotificationState=function(t){if(!t)return!0;var i=t.get("notification")||{},o=!i.isNotificationOpen;try{wx.setStorageSync(i.storageKey||"".concat(STORAGE_PREFIX,"default"),o?1:0)}catch(t){console.error("save notification state failed",t)}return t.set({"notification.storageKey":i.storageKey||"".concat(STORAGE_PREFIX,"default"),"notification.isShowNotificationButton":!1!==i.isShowNotificationButton,"notification.isNotificationOpen":o}),o};exports.toggleNotificationState=toggleNotificationState;var toggleNotificationStateWithToast=function(t){var i=toggleNotificationState(t);return wx.showToast({title:i?NOTIFICATION_OPEN_TOAST_TITLE:NOTIFICATION_CLOSE_TOAST_TITLE,icon:"none"}),i};exports.toggleNotificationStateWithToast=toggleNotificationStateWithToast;