if (typeof Promise !== "undefined" && !Promise.prototype.finally) { Promise.prototype.finally = function(callback) { const promise = this.constructor; return this.then( (value) => promise.resolve(callback()).then(() => value), (reason) => promise.resolve(callback()).then(() => { throw reason; }) ); }; } ; if (typeof uni !== "undefined" && uni && uni.requireGlobal) { const global2 = uni.requireGlobal(); ArrayBuffer = global2.ArrayBuffer; Int8Array = global2.Int8Array; Uint8Array = global2.Uint8Array; Uint8ClampedArray = global2.Uint8ClampedArray; Int16Array = global2.Int16Array; Uint16Array = global2.Uint16Array; Int32Array = global2.Int32Array; Uint32Array = global2.Uint32Array; Float32Array = global2.Float32Array; Float64Array = global2.Float64Array; BigInt64Array = global2.BigInt64Array; BigUint64Array = global2.BigUint64Array; } ; if (uni.restoreGlobal) { uni.restoreGlobal(Vue, weex, plus, setTimeout, clearTimeout, setInterval, clearInterval); } (function(vue, shared) { "use strict"; const ON_SHOW = "onShow"; const ON_HIDE = "onHide"; const ON_LAUNCH = "onLaunch"; const ON_LOAD = "onLoad"; function formatAppLog(type, filename, ...args) { if (uni.__log__) { uni.__log__(type, filename, ...args); } else { console[type].apply(console, [...args, filename]); } } function resolveEasycom(component, easycom) { return shared.isString(component) ? easycom : component; } const createHook = (lifecycle) => (hook, target = vue.getCurrentInstance()) => { !vue.isInSSRComponentSetup && vue.injectHook(lifecycle, hook, target); }; const onShow = /* @__PURE__ */ createHook(ON_SHOW); const onHide = /* @__PURE__ */ createHook(ON_HIDE); const onLaunch = /* @__PURE__ */ createHook(ON_LAUNCH); const onLoad = /* @__PURE__ */ createHook(ON_LOAD); const icons = { "id": "2852637", "name": "uniui图标库", "font_family": "uniicons", "css_prefix_text": "uniui-", "description": "", "glyphs": [ { "icon_id": "25027049", "name": "yanse", "font_class": "color", "unicode": "e6cf", "unicode_decimal": 59087 }, { "icon_id": "25027048", "name": "wallet", "font_class": "wallet", "unicode": "e6b1", "unicode_decimal": 59057 }, { "icon_id": "25015720", "name": "settings-filled", "font_class": "settings-filled", "unicode": "e6ce", "unicode_decimal": 59086 }, { "icon_id": "25015434", "name": "shimingrenzheng-filled", "font_class": "auth-filled", "unicode": "e6cc", "unicode_decimal": 59084 }, { "icon_id": "24934246", "name": "shop-filled", "font_class": "shop-filled", "unicode": "e6cd", "unicode_decimal": 59085 }, { "icon_id": "24934159", "name": "staff-filled-01", "font_class": "staff-filled", "unicode": "e6cb", "unicode_decimal": 59083 }, { "icon_id": "24932461", "name": "VIP-filled", "font_class": "vip-filled", "unicode": "e6c6", "unicode_decimal": 59078 }, { "icon_id": "24932462", "name": "plus_circle_fill", "font_class": "plus-filled", "unicode": "e6c7", "unicode_decimal": 59079 }, { "icon_id": "24932463", "name": "folder_add-filled", "font_class": "folder-add-filled", "unicode": "e6c8", "unicode_decimal": 59080 }, { "icon_id": "24932464", "name": "yanse-filled", "font_class": "color-filled", "unicode": "e6c9", "unicode_decimal": 59081 }, { "icon_id": "24932465", "name": "tune-filled", "font_class": "tune-filled", "unicode": "e6ca", "unicode_decimal": 59082 }, { "icon_id": "24932455", "name": "a-rilidaka-filled", "font_class": "calendar-filled", "unicode": "e6c0", "unicode_decimal": 59072 }, { "icon_id": "24932456", "name": "notification-filled", "font_class": "notification-filled", "unicode": "e6c1", "unicode_decimal": 59073 }, { "icon_id": "24932457", "name": "wallet-filled", "font_class": "wallet-filled", "unicode": "e6c2", "unicode_decimal": 59074 }, { "icon_id": "24932458", "name": "paihangbang-filled", "font_class": "medal-filled", "unicode": "e6c3", "unicode_decimal": 59075 }, { "icon_id": "24932459", "name": "gift-filled", "font_class": "gift-filled", "unicode": "e6c4", "unicode_decimal": 59076 }, { "icon_id": "24932460", "name": "fire-filled", "font_class": "fire-filled", "unicode": "e6c5", "unicode_decimal": 59077 }, { "icon_id": "24928001", "name": "refreshempty", "font_class": "refreshempty", "unicode": "e6bf", "unicode_decimal": 59071 }, { "icon_id": "24926853", "name": "location-ellipse", "font_class": "location-filled", "unicode": "e6af", "unicode_decimal": 59055 }, { "icon_id": "24926735", "name": "person-filled", "font_class": "person-filled", "unicode": "e69d", "unicode_decimal": 59037 }, { "icon_id": "24926703", "name": "personadd-filled", "font_class": "personadd-filled", "unicode": "e698", "unicode_decimal": 59032 }, { "icon_id": "24923351", "name": "back", "font_class": "back", "unicode": "e6b9", "unicode_decimal": 59065 }, { "icon_id": "24923352", "name": "forward", "font_class": "forward", "unicode": "e6ba", "unicode_decimal": 59066 }, { "icon_id": "24923353", "name": "arrowthinright", "font_class": "arrow-right", "unicode": "e6bb", "unicode_decimal": 59067 }, { "icon_id": "24923353", "name": "arrowthinright", "font_class": "arrowthinright", "unicode": "e6bb", "unicode_decimal": 59067 }, { "icon_id": "24923354", "name": "arrowthinleft", "font_class": "arrow-left", "unicode": "e6bc", "unicode_decimal": 59068 }, { "icon_id": "24923354", "name": "arrowthinleft", "font_class": "arrowthinleft", "unicode": "e6bc", "unicode_decimal": 59068 }, { "icon_id": "24923355", "name": "arrowthinup", "font_class": "arrow-up", "unicode": "e6bd", "unicode_decimal": 59069 }, { "icon_id": "24923355", "name": "arrowthinup", "font_class": "arrowthinup", "unicode": "e6bd", "unicode_decimal": 59069 }, { "icon_id": "24923356", "name": "arrowthindown", "font_class": "arrow-down", "unicode": "e6be", "unicode_decimal": 59070 }, { "icon_id": "24923356", "name": "arrowthindown", "font_class": "arrowthindown", "unicode": "e6be", "unicode_decimal": 59070 }, { "icon_id": "24923349", "name": "arrowdown", "font_class": "bottom", "unicode": "e6b8", "unicode_decimal": 59064 }, { "icon_id": "24923349", "name": "arrowdown", "font_class": "arrowdown", "unicode": "e6b8", "unicode_decimal": 59064 }, { "icon_id": "24923346", "name": "arrowright", "font_class": "right", "unicode": "e6b5", "unicode_decimal": 59061 }, { "icon_id": "24923346", "name": "arrowright", "font_class": "arrowright", "unicode": "e6b5", "unicode_decimal": 59061 }, { "icon_id": "24923347", "name": "arrowup", "font_class": "top", "unicode": "e6b6", "unicode_decimal": 59062 }, { "icon_id": "24923347", "name": "arrowup", "font_class": "arrowup", "unicode": "e6b6", "unicode_decimal": 59062 }, { "icon_id": "24923348", "name": "arrowleft", "font_class": "left", "unicode": "e6b7", "unicode_decimal": 59063 }, { "icon_id": "24923348", "name": "arrowleft", "font_class": "arrowleft", "unicode": "e6b7", "unicode_decimal": 59063 }, { "icon_id": "24923334", "name": "eye", "font_class": "eye", "unicode": "e651", "unicode_decimal": 58961 }, { "icon_id": "24923335", "name": "eye-filled", "font_class": "eye-filled", "unicode": "e66a", "unicode_decimal": 58986 }, { "icon_id": "24923336", "name": "eye-slash", "font_class": "eye-slash", "unicode": "e6b3", "unicode_decimal": 59059 }, { "icon_id": "24923337", "name": "eye-slash-filled", "font_class": "eye-slash-filled", "unicode": "e6b4", "unicode_decimal": 59060 }, { "icon_id": "24923305", "name": "info-filled", "font_class": "info-filled", "unicode": "e649", "unicode_decimal": 58953 }, { "icon_id": "24923299", "name": "reload-01", "font_class": "reload", "unicode": "e6b2", "unicode_decimal": 59058 }, { "icon_id": "24923195", "name": "mic_slash_fill", "font_class": "micoff-filled", "unicode": "e6b0", "unicode_decimal": 59056 }, { "icon_id": "24923165", "name": "map-pin-ellipse", "font_class": "map-pin-ellipse", "unicode": "e6ac", "unicode_decimal": 59052 }, { "icon_id": "24923166", "name": "map-pin", "font_class": "map-pin", "unicode": "e6ad", "unicode_decimal": 59053 }, { "icon_id": "24923167", "name": "location", "font_class": "location", "unicode": "e6ae", "unicode_decimal": 59054 }, { "icon_id": "24923064", "name": "starhalf", "font_class": "starhalf", "unicode": "e683", "unicode_decimal": 59011 }, { "icon_id": "24923065", "name": "star", "font_class": "star", "unicode": "e688", "unicode_decimal": 59016 }, { "icon_id": "24923066", "name": "star-filled", "font_class": "star-filled", "unicode": "e68f", "unicode_decimal": 59023 }, { "icon_id": "24899646", "name": "a-rilidaka", "font_class": "calendar", "unicode": "e6a0", "unicode_decimal": 59040 }, { "icon_id": "24899647", "name": "fire", "font_class": "fire", "unicode": "e6a1", "unicode_decimal": 59041 }, { "icon_id": "24899648", "name": "paihangbang", "font_class": "medal", "unicode": "e6a2", "unicode_decimal": 59042 }, { "icon_id": "24899649", "name": "font", "font_class": "font", "unicode": "e6a3", "unicode_decimal": 59043 }, { "icon_id": "24899650", "name": "gift", "font_class": "gift", "unicode": "e6a4", "unicode_decimal": 59044 }, { "icon_id": "24899651", "name": "link", "font_class": "link", "unicode": "e6a5", "unicode_decimal": 59045 }, { "icon_id": "24899652", "name": "notification", "font_class": "notification", "unicode": "e6a6", "unicode_decimal": 59046 }, { "icon_id": "24899653", "name": "staff", "font_class": "staff", "unicode": "e6a7", "unicode_decimal": 59047 }, { "icon_id": "24899654", "name": "VIP", "font_class": "vip", "unicode": "e6a8", "unicode_decimal": 59048 }, { "icon_id": "24899655", "name": "folder_add", "font_class": "folder-add", "unicode": "e6a9", "unicode_decimal": 59049 }, { "icon_id": "24899656", "name": "tune", "font_class": "tune", "unicode": "e6aa", "unicode_decimal": 59050 }, { "icon_id": "24899657", "name": "shimingrenzheng", "font_class": "auth", "unicode": "e6ab", "unicode_decimal": 59051 }, { "icon_id": "24899565", "name": "person", "font_class": "person", "unicode": "e699", "unicode_decimal": 59033 }, { "icon_id": "24899566", "name": "email-filled", "font_class": "email-filled", "unicode": "e69a", "unicode_decimal": 59034 }, { "icon_id": "24899567", "name": "phone-filled", "font_class": "phone-filled", "unicode": "e69b", "unicode_decimal": 59035 }, { "icon_id": "24899568", "name": "phone", "font_class": "phone", "unicode": "e69c", "unicode_decimal": 59036 }, { "icon_id": "24899570", "name": "email", "font_class": "email", "unicode": "e69e", "unicode_decimal": 59038 }, { "icon_id": "24899571", "name": "personadd", "font_class": "personadd", "unicode": "e69f", "unicode_decimal": 59039 }, { "icon_id": "24899558", "name": "chatboxes-filled", "font_class": "chatboxes-filled", "unicode": "e692", "unicode_decimal": 59026 }, { "icon_id": "24899559", "name": "contact", "font_class": "contact", "unicode": "e693", "unicode_decimal": 59027 }, { "icon_id": "24899560", "name": "chatbubble-filled", "font_class": "chatbubble-filled", "unicode": "e694", "unicode_decimal": 59028 }, { "icon_id": "24899561", "name": "contact-filled", "font_class": "contact-filled", "unicode": "e695", "unicode_decimal": 59029 }, { "icon_id": "24899562", "name": "chatboxes", "font_class": "chatboxes", "unicode": "e696", "unicode_decimal": 59030 }, { "icon_id": "24899563", "name": "chatbubble", "font_class": "chatbubble", "unicode": "e697", "unicode_decimal": 59031 }, { "icon_id": "24881290", "name": "upload-filled", "font_class": "upload-filled", "unicode": "e68e", "unicode_decimal": 59022 }, { "icon_id": "24881292", "name": "upload", "font_class": "upload", "unicode": "e690", "unicode_decimal": 59024 }, { "icon_id": "24881293", "name": "weixin", "font_class": "weixin", "unicode": "e691", "unicode_decimal": 59025 }, { "icon_id": "24881274", "name": "compose", "font_class": "compose", "unicode": "e67f", "unicode_decimal": 59007 }, { "icon_id": "24881275", "name": "qq", "font_class": "qq", "unicode": "e680", "unicode_decimal": 59008 }, { "icon_id": "24881276", "name": "download-filled", "font_class": "download-filled", "unicode": "e681", "unicode_decimal": 59009 }, { "icon_id": "24881277", "name": "pengyouquan", "font_class": "pyq", "unicode": "e682", "unicode_decimal": 59010 }, { "icon_id": "24881279", "name": "sound", "font_class": "sound", "unicode": "e684", "unicode_decimal": 59012 }, { "icon_id": "24881280", "name": "trash-filled", "font_class": "trash-filled", "unicode": "e685", "unicode_decimal": 59013 }, { "icon_id": "24881281", "name": "sound-filled", "font_class": "sound-filled", "unicode": "e686", "unicode_decimal": 59014 }, { "icon_id": "24881282", "name": "trash", "font_class": "trash", "unicode": "e687", "unicode_decimal": 59015 }, { "icon_id": "24881284", "name": "videocam-filled", "font_class": "videocam-filled", "unicode": "e689", "unicode_decimal": 59017 }, { "icon_id": "24881285", "name": "spinner-cycle", "font_class": "spinner-cycle", "unicode": "e68a", "unicode_decimal": 59018 }, { "icon_id": "24881286", "name": "weibo", "font_class": "weibo", "unicode": "e68b", "unicode_decimal": 59019 }, { "icon_id": "24881288", "name": "videocam", "font_class": "videocam", "unicode": "e68c", "unicode_decimal": 59020 }, { "icon_id": "24881289", "name": "download", "font_class": "download", "unicode": "e68d", "unicode_decimal": 59021 }, { "icon_id": "24879601", "name": "help", "font_class": "help", "unicode": "e679", "unicode_decimal": 59001 }, { "icon_id": "24879602", "name": "navigate-filled", "font_class": "navigate-filled", "unicode": "e67a", "unicode_decimal": 59002 }, { "icon_id": "24879603", "name": "plusempty", "font_class": "plusempty", "unicode": "e67b", "unicode_decimal": 59003 }, { "icon_id": "24879604", "name": "smallcircle", "font_class": "smallcircle", "unicode": "e67c", "unicode_decimal": 59004 }, { "icon_id": "24879605", "name": "minus-filled", "font_class": "minus-filled", "unicode": "e67d", "unicode_decimal": 59005 }, { "icon_id": "24879606", "name": "micoff", "font_class": "micoff", "unicode": "e67e", "unicode_decimal": 59006 }, { "icon_id": "24879588", "name": "closeempty", "font_class": "closeempty", "unicode": "e66c", "unicode_decimal": 58988 }, { "icon_id": "24879589", "name": "clear", "font_class": "clear", "unicode": "e66d", "unicode_decimal": 58989 }, { "icon_id": "24879590", "name": "navigate", "font_class": "navigate", "unicode": "e66e", "unicode_decimal": 58990 }, { "icon_id": "24879591", "name": "minus", "font_class": "minus", "unicode": "e66f", "unicode_decimal": 58991 }, { "icon_id": "24879592", "name": "image", "font_class": "image", "unicode": "e670", "unicode_decimal": 58992 }, { "icon_id": "24879593", "name": "mic", "font_class": "mic", "unicode": "e671", "unicode_decimal": 58993 }, { "icon_id": "24879594", "name": "paperplane", "font_class": "paperplane", "unicode": "e672", "unicode_decimal": 58994 }, { "icon_id": "24879595", "name": "close", "font_class": "close", "unicode": "e673", "unicode_decimal": 58995 }, { "icon_id": "24879596", "name": "help-filled", "font_class": "help-filled", "unicode": "e674", "unicode_decimal": 58996 }, { "icon_id": "24879597", "name": "plus-filled", "font_class": "paperplane-filled", "unicode": "e675", "unicode_decimal": 58997 }, { "icon_id": "24879598", "name": "plus", "font_class": "plus", "unicode": "e676", "unicode_decimal": 58998 }, { "icon_id": "24879599", "name": "mic-filled", "font_class": "mic-filled", "unicode": "e677", "unicode_decimal": 58999 }, { "icon_id": "24879600", "name": "image-filled", "font_class": "image-filled", "unicode": "e678", "unicode_decimal": 59e3 }, { "icon_id": "24855900", "name": "locked-filled", "font_class": "locked-filled", "unicode": "e668", "unicode_decimal": 58984 }, { "icon_id": "24855901", "name": "info", "font_class": "info", "unicode": "e669", "unicode_decimal": 58985 }, { "icon_id": "24855903", "name": "locked", "font_class": "locked", "unicode": "e66b", "unicode_decimal": 58987 }, { "icon_id": "24855884", "name": "camera-filled", "font_class": "camera-filled", "unicode": "e658", "unicode_decimal": 58968 }, { "icon_id": "24855885", "name": "chat-filled", "font_class": "chat-filled", "unicode": "e659", "unicode_decimal": 58969 }, { "icon_id": "24855886", "name": "camera", "font_class": "camera", "unicode": "e65a", "unicode_decimal": 58970 }, { "icon_id": "24855887", "name": "circle", "font_class": "circle", "unicode": "e65b", "unicode_decimal": 58971 }, { "icon_id": "24855888", "name": "checkmarkempty", "font_class": "checkmarkempty", "unicode": "e65c", "unicode_decimal": 58972 }, { "icon_id": "24855889", "name": "chat", "font_class": "chat", "unicode": "e65d", "unicode_decimal": 58973 }, { "icon_id": "24855890", "name": "circle-filled", "font_class": "circle-filled", "unicode": "e65e", "unicode_decimal": 58974 }, { "icon_id": "24855891", "name": "flag", "font_class": "flag", "unicode": "e65f", "unicode_decimal": 58975 }, { "icon_id": "24855892", "name": "flag-filled", "font_class": "flag-filled", "unicode": "e660", "unicode_decimal": 58976 }, { "icon_id": "24855893", "name": "gear-filled", "font_class": "gear-filled", "unicode": "e661", "unicode_decimal": 58977 }, { "icon_id": "24855894", "name": "home", "font_class": "home", "unicode": "e662", "unicode_decimal": 58978 }, { "icon_id": "24855895", "name": "home-filled", "font_class": "home-filled", "unicode": "e663", "unicode_decimal": 58979 }, { "icon_id": "24855896", "name": "gear", "font_class": "gear", "unicode": "e664", "unicode_decimal": 58980 }, { "icon_id": "24855897", "name": "smallcircle-filled", "font_class": "smallcircle-filled", "unicode": "e665", "unicode_decimal": 58981 }, { "icon_id": "24855898", "name": "map-filled", "font_class": "map-filled", "unicode": "e666", "unicode_decimal": 58982 }, { "icon_id": "24855899", "name": "map", "font_class": "map", "unicode": "e667", "unicode_decimal": 58983 }, { "icon_id": "24855825", "name": "refresh-filled", "font_class": "refresh-filled", "unicode": "e656", "unicode_decimal": 58966 }, { "icon_id": "24855826", "name": "refresh", "font_class": "refresh", "unicode": "e657", "unicode_decimal": 58967 }, { "icon_id": "24855808", "name": "cloud-upload", "font_class": "cloud-upload", "unicode": "e645", "unicode_decimal": 58949 }, { "icon_id": "24855809", "name": "cloud-download-filled", "font_class": "cloud-download-filled", "unicode": "e646", "unicode_decimal": 58950 }, { "icon_id": "24855810", "name": "cloud-download", "font_class": "cloud-download", "unicode": "e647", "unicode_decimal": 58951 }, { "icon_id": "24855811", "name": "cloud-upload-filled", "font_class": "cloud-upload-filled", "unicode": "e648", "unicode_decimal": 58952 }, { "icon_id": "24855813", "name": "redo", "font_class": "redo", "unicode": "e64a", "unicode_decimal": 58954 }, { "icon_id": "24855814", "name": "images-filled", "font_class": "images-filled", "unicode": "e64b", "unicode_decimal": 58955 }, { "icon_id": "24855815", "name": "undo-filled", "font_class": "undo-filled", "unicode": "e64c", "unicode_decimal": 58956 }, { "icon_id": "24855816", "name": "more", "font_class": "more", "unicode": "e64d", "unicode_decimal": 58957 }, { "icon_id": "24855817", "name": "more-filled", "font_class": "more-filled", "unicode": "e64e", "unicode_decimal": 58958 }, { "icon_id": "24855818", "name": "undo", "font_class": "undo", "unicode": "e64f", "unicode_decimal": 58959 }, { "icon_id": "24855819", "name": "images", "font_class": "images", "unicode": "e650", "unicode_decimal": 58960 }, { "icon_id": "24855821", "name": "paperclip", "font_class": "paperclip", "unicode": "e652", "unicode_decimal": 58962 }, { "icon_id": "24855822", "name": "settings", "font_class": "settings", "unicode": "e653", "unicode_decimal": 58963 }, { "icon_id": "24855823", "name": "search", "font_class": "search", "unicode": "e654", "unicode_decimal": 58964 }, { "icon_id": "24855824", "name": "redo-filled", "font_class": "redo-filled", "unicode": "e655", "unicode_decimal": 58965 }, { "icon_id": "24841702", "name": "list", "font_class": "list", "unicode": "e644", "unicode_decimal": 58948 }, { "icon_id": "24841489", "name": "mail-open-filled", "font_class": "mail-open-filled", "unicode": "e63a", "unicode_decimal": 58938 }, { "icon_id": "24841491", "name": "hand-thumbsdown-filled", "font_class": "hand-down-filled", "unicode": "e63c", "unicode_decimal": 58940 }, { "icon_id": "24841492", "name": "hand-thumbsdown", "font_class": "hand-down", "unicode": "e63d", "unicode_decimal": 58941 }, { "icon_id": "24841493", "name": "hand-thumbsup-filled", "font_class": "hand-up-filled", "unicode": "e63e", "unicode_decimal": 58942 }, { "icon_id": "24841494", "name": "hand-thumbsup", "font_class": "hand-up", "unicode": "e63f", "unicode_decimal": 58943 }, { "icon_id": "24841496", "name": "heart-filled", "font_class": "heart-filled", "unicode": "e641", "unicode_decimal": 58945 }, { "icon_id": "24841498", "name": "mail-open", "font_class": "mail-open", "unicode": "e643", "unicode_decimal": 58947 }, { "icon_id": "24841488", "name": "heart", "font_class": "heart", "unicode": "e639", "unicode_decimal": 58937 }, { "icon_id": "24839963", "name": "loop", "font_class": "loop", "unicode": "e633", "unicode_decimal": 58931 }, { "icon_id": "24839866", "name": "pulldown", "font_class": "pulldown", "unicode": "e632", "unicode_decimal": 58930 }, { "icon_id": "24813798", "name": "scan", "font_class": "scan", "unicode": "e62a", "unicode_decimal": 58922 }, { "icon_id": "24813786", "name": "bars", "font_class": "bars", "unicode": "e627", "unicode_decimal": 58919 }, { "icon_id": "24813788", "name": "cart-filled", "font_class": "cart-filled", "unicode": "e629", "unicode_decimal": 58921 }, { "icon_id": "24813790", "name": "checkbox", "font_class": "checkbox", "unicode": "e62b", "unicode_decimal": 58923 }, { "icon_id": "24813791", "name": "checkbox-filled", "font_class": "checkbox-filled", "unicode": "e62c", "unicode_decimal": 58924 }, { "icon_id": "24813794", "name": "shop", "font_class": "shop", "unicode": "e62f", "unicode_decimal": 58927 }, { "icon_id": "24813795", "name": "headphones", "font_class": "headphones", "unicode": "e630", "unicode_decimal": 58928 }, { "icon_id": "24813796", "name": "cart", "font_class": "cart", "unicode": "e631", "unicode_decimal": 58929 } ] }; const _export_sfc = (sfc, props) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props) { target[key] = val; } return target; }; const getVal$1 = (val) => { const reg = /^[0-9]*$/g; return typeof val === "number" || reg.test(val) ? val + "px" : val; }; const _sfc_main$p = { name: "UniIcons", emits: ["click"], props: { type: { type: String, default: "" }, color: { type: String, default: "#333333" }, size: { type: [Number, String], default: 16 }, customPrefix: { type: String, default: "" } }, data() { return { icons: icons.glyphs }; }, computed: { unicode() { let code = this.icons.find((v2) => v2.font_class === this.type); if (code) { return unescape(`%u${code.unicode}`); } return ""; }, iconSize() { return getVal$1(this.size); } }, methods: { _onClick() { this.$emit("click"); } } }; function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock( "text", { style: vue.normalizeStyle({ color: $props.color, "font-size": $options.iconSize }), class: vue.normalizeClass(["uni-icons", ["uniui-" + $props.type, $props.customPrefix, $props.customPrefix ? $props.type : ""]]), onClick: _cache[0] || (_cache[0] = (...args) => $options._onClick && $options._onClick(...args)) }, null, 6 /* CLASS, STYLE */ ); } const __easycom_0$3 = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render$g], ["__scopeId", "data-v-d31e1c47"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-icons/components/uni-icons/uni-icons.vue"]]); const _sfc_main$o = { name: "uniFormsItem", options: { virtualHost: true }, provide() { return { uniFormItem: this }; }, inject: { form: { from: "uniForm", default: null } }, props: { // 表单校验规则 rules: { type: Array, default() { return null; } }, // 表单域的属性名,在使用校验规则时必填 name: { type: [String, Array], default: "" }, required: { type: Boolean, default: false }, label: { type: String, default: "" }, // label的宽度 ,默认 80 labelWidth: { type: [String, Number], default: "" }, // label 居中方式,默认 left 取值 left/center/right labelAlign: { type: String, default: "" }, // 强制显示错误信息 errorMessage: { type: [String, Boolean], default: "" }, // 1.4.0 弃用,统一使用 form 的校验时机 // validateTrigger: { // type: String, // default: '' // }, // 1.4.0 弃用,统一使用 form 的label 位置 // labelPosition: { // type: String, // default: '' // }, // 1.4.0 以下属性已经废弃,请使用 #label 插槽代替 leftIcon: String, iconColor: { type: String, default: "#606266" } }, data() { return { errMsg: "", userRules: null, localLabelAlign: "left", localLabelWidth: "65px", localLabelPos: "left", border: false, isFirstBorder: false }; }, computed: { // 处理错误信息 msg() { return this.errorMessage || this.errMsg; } }, watch: { // 规则发生变化通知子组件更新 "form.formRules"(val) { this.init(); }, "form.labelWidth"(val) { this.localLabelWidth = this._labelWidthUnit(val); }, "form.labelPosition"(val) { this.localLabelPos = this._labelPosition(); }, "form.labelAlign"(val) { } }, created() { this.init(true); if (this.name && this.form) { this.$watch( () => { const val = this.form._getDataValue(this.name, this.form.localData); return val; }, (value, oldVal) => { const isEqual2 = this.form._isEqual(value, oldVal); if (!isEqual2) { const val = this.itemSetValue(value); this.onFieldChange(val, false); } }, { immediate: false } ); } }, unmounted() { this.__isUnmounted = true; this.unInit(); }, methods: { /** * 外部调用方法 * 设置规则 ,主要用于小程序自定义检验规则 * @param {Array} rules 规则源数据 */ setRules(rules = null) { this.userRules = rules; this.init(false); }, // 兼容老版本表单组件 setValue() { }, /** * 外部调用方法 * 校验数据 * @param {any} value 需要校验的数据 * @param {boolean} 是否立即校验 * @return {Array|null} 校验内容 */ async onFieldChange(value, formtrigger = true) { const { formData, localData, errShowType, validateCheck, validateTrigger, _isRequiredField, _realName } = this.form; const name = _realName(this.name); if (!value) { value = this.form.formData[name]; } const ruleLen = this.itemRules.rules && this.itemRules.rules.length; if (!this.validator || !ruleLen || ruleLen === 0) return; const isRequiredField2 = _isRequiredField(this.itemRules.rules || []); let result = null; if (validateTrigger === "bind" || formtrigger) { result = await this.validator.validateUpdate( { [name]: value }, formData ); if (!isRequiredField2 && (value === void 0 || value === "")) { result = null; } if (result && result.errorMessage) { if (errShowType === "undertext") { this.errMsg = !result ? "" : result.errorMessage; } if (errShowType === "toast") { uni.showToast({ title: result.errorMessage || "校验错误", icon: "none" }); } if (errShowType === "modal") { uni.showModal({ title: "提示", content: result.errorMessage || "校验错误" }); } } else { this.errMsg = ""; } validateCheck(result ? result : null); } else { this.errMsg = ""; } return result ? result : null; }, /** * 初始组件数据 */ init(type = false) { const { validator, formRules, childrens, formData, localData, _realName, labelWidth, _getDataValue, _setDataValue } = this.form || {}; this.localLabelAlign = this._justifyContent(); this.localLabelWidth = this._labelWidthUnit(labelWidth); this.localLabelPos = this._labelPosition(); this.form && type && childrens.push(this); if (!validator || !formRules) return; if (!this.form.isFirstBorder) { this.form.isFirstBorder = true; this.isFirstBorder = true; } if (this.group) { if (!this.group.isFirstBorder) { this.group.isFirstBorder = true; this.isFirstBorder = true; } } this.border = this.form.border; const name = _realName(this.name); const itemRule = this.userRules || this.rules; if (typeof formRules === "object" && itemRule) { formRules[name] = { rules: itemRule }; validator.updateSchema(formRules); } const itemRules = formRules[name] || {}; this.itemRules = itemRules; this.validator = validator; this.itemSetValue(_getDataValue(this.name, localData)); }, unInit() { if (this.form) { const { childrens, formData, _realName } = this.form; childrens.forEach((item, index) => { if (item === this) { this.form.childrens.splice(index, 1); delete formData[_realName(item.name)]; } }); } }, // 设置item 的值 itemSetValue(value) { const name = this.form._realName(this.name); const rules = this.itemRules.rules || []; const val = this.form._getValue(name, value, rules); this.form._setDataValue(name, this.form.formData, val); return val; }, /** * 移除该表单项的校验结果 */ clearValidate() { this.errMsg = ""; }, // 是否显示星号 _isRequired() { return this.required; }, // 处理对齐方式 _justifyContent() { if (this.form) { const { labelAlign } = this.form; let labelAli = this.labelAlign ? this.labelAlign : labelAlign; if (labelAli === "left") return "flex-start"; if (labelAli === "center") return "center"; if (labelAli === "right") return "flex-end"; } return "flex-start"; }, // 处理 label宽度单位 ,继承父元素的值 _labelWidthUnit(labelWidth) { return this.num2px(this.labelWidth ? this.labelWidth : labelWidth || (this.label ? 65 : "auto")); }, // 处理 label 位置 _labelPosition() { if (this.form) return this.form.labelPosition || "left"; return "left"; }, /** * 触发时机 * @param {Object} rule 当前规则内时机 * @param {Object} itemRlue 当前组件时机 * @param {Object} parentRule 父组件时机 */ isTrigger(rule, itemRlue, parentRule) { if (rule === "submit" || !rule) { if (rule === void 0) { if (itemRlue !== "bind") { if (!itemRlue) { return parentRule === "" ? "bind" : "submit"; } return "submit"; } return "bind"; } return "submit"; } return "bind"; }, num2px(num) { if (typeof num === "number") { return `${num}px`; } return num; } } }; function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock( "view", { class: vue.normalizeClass(["uni-forms-item", ["is-direction-" + $data.localLabelPos, $data.border ? "uni-forms-item--border" : "", $data.border && $data.isFirstBorder ? "is-first-border" : ""]]) }, [ vue.renderSlot(_ctx.$slots, "label", {}, () => [ vue.createElementVNode( "view", { class: vue.normalizeClass(["uni-forms-item__label", { "no-label": !$props.label && !$props.required }]), style: vue.normalizeStyle({ width: $data.localLabelWidth, justifyContent: $data.localLabelAlign }) }, [ $props.required ? (vue.openBlock(), vue.createElementBlock("text", { key: 0, class: "is-required" }, "*")) : vue.createCommentVNode("v-if", true), vue.createElementVNode( "text", null, vue.toDisplayString($props.label), 1 /* TEXT */ ) ], 6 /* CLASS, STYLE */ ) ], true), vue.createElementVNode("view", { class: "uni-forms-item__content" }, [ vue.renderSlot(_ctx.$slots, "default", {}, void 0, true), vue.createElementVNode( "view", { class: vue.normalizeClass(["uni-forms-item__error", { "msg--active": $options.msg }]) }, [ vue.createElementVNode( "text", null, vue.toDisplayString($options.msg), 1 /* TEXT */ ) ], 2 /* CLASS */ ) ]) ], 2 /* CLASS */ ); } const __easycom_1$2 = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$f], ["__scopeId", "data-v-462874dd"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue"]]); var pattern = { email: /^\S+?@\S+?\.\S+?$/, idcard: /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/, url: new RegExp( "^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$", "i" ) }; const FORMAT_MAPPING = { "int": "integer", "bool": "boolean", "double": "number", "long": "number", "password": "string" // "fileurls": 'array' }; function formatMessage(args, resources = "") { var defaultMessage = ["label"]; defaultMessage.forEach((item) => { if (args[item] === void 0) { args[item] = ""; } }); let str = resources; for (let key in args) { let reg = new RegExp("{" + key + "}"); str = str.replace(reg, args[key]); } return str; } function isEmptyValue(value, type) { if (value === void 0 || value === null) { return true; } if (typeof value === "string" && !value) { return true; } if (Array.isArray(value) && !value.length) { return true; } if (type === "object" && !Object.keys(value).length) { return true; } return false; } const types = { integer(value) { return types.number(value) && parseInt(value, 10) === value; }, string(value) { return typeof value === "string"; }, number(value) { if (isNaN(value)) { return false; } return typeof value === "number"; }, "boolean": function(value) { return typeof value === "boolean"; }, "float": function(value) { return types.number(value) && !types.integer(value); }, array(value) { return Array.isArray(value); }, object(value) { return typeof value === "object" && !types.array(value); }, date(value) { return value instanceof Date; }, timestamp(value) { if (!this.integer(value) || Math.abs(value).toString().length > 16) { return false; } return true; }, file(value) { return typeof value.url === "string"; }, email(value) { return typeof value === "string" && !!value.match(pattern.email) && value.length < 255; }, url(value) { return typeof value === "string" && !!value.match(pattern.url); }, pattern(reg, value) { try { return new RegExp(reg).test(value); } catch (e2) { return false; } }, method(value) { return typeof value === "function"; }, idcard(value) { return typeof value === "string" && !!value.match(pattern.idcard); }, "url-https"(value) { return this.url(value) && value.startsWith("https://"); }, "url-scheme"(value) { return value.startsWith("://"); }, "url-web"(value) { return false; } }; class RuleValidator { constructor(message) { this._message = message; } async validateRule(fieldKey, fieldValue, value, data, allData) { var result = null; let rules = fieldValue.rules; let hasRequired = rules.findIndex((item) => { return item.required; }); if (hasRequired < 0) { if (value === null || value === void 0) { return result; } if (typeof value === "string" && !value.length) { return result; } } var message = this._message; if (rules === void 0) { return message["default"]; } for (var i2 = 0; i2 < rules.length; i2++) { let rule = rules[i2]; let vt2 = this._getValidateType(rule); Object.assign(rule, { label: fieldValue.label || `["${fieldKey}"]` }); if (RuleValidatorHelper[vt2]) { result = RuleValidatorHelper[vt2](rule, value, message); if (result != null) { break; } } if (rule.validateExpr) { let now = Date.now(); let resultExpr = rule.validateExpr(value, allData, now); if (resultExpr === false) { result = this._getMessage(rule, rule.errorMessage || this._message["default"]); break; } } if (rule.validateFunction) { result = await this.validateFunction(rule, value, data, allData, vt2); if (result !== null) { break; } } } if (result !== null) { result = message.TAG + result; } return result; } async validateFunction(rule, value, data, allData, vt2) { let result = null; try { let callbackMessage = null; const res = await rule.validateFunction(rule, value, allData || data, (message) => { callbackMessage = message; }); if (callbackMessage || typeof res === "string" && res || res === false) { result = this._getMessage(rule, callbackMessage || res, vt2); } } catch (e2) { result = this._getMessage(rule, e2.message, vt2); } return result; } _getMessage(rule, message, vt2) { return formatMessage(rule, message || rule.errorMessage || this._message[vt2] || message["default"]); } _getValidateType(rule) { var result = ""; if (rule.required) { result = "required"; } else if (rule.format) { result = "format"; } else if (rule.arrayType) { result = "arrayTypeFormat"; } else if (rule.range) { result = "range"; } else if (rule.maximum !== void 0 || rule.minimum !== void 0) { result = "rangeNumber"; } else if (rule.maxLength !== void 0 || rule.minLength !== void 0) { result = "rangeLength"; } else if (rule.pattern) { result = "pattern"; } else if (rule.validateFunction) { result = "validateFunction"; } return result; } } const RuleValidatorHelper = { required(rule, value, message) { if (rule.required && isEmptyValue(value, rule.format || typeof value)) { return formatMessage(rule, rule.errorMessage || message.required); } return null; }, range(rule, value, message) { const { range, errorMessage } = rule; let list = new Array(range.length); for (let i2 = 0; i2 < range.length; i2++) { const item = range[i2]; if (types.object(item) && item.value !== void 0) { list[i2] = item.value; } else { list[i2] = item; } } let result = false; if (Array.isArray(value)) { result = new Set(value.concat(list)).size === list.length; } else { if (list.indexOf(value) > -1) { result = true; } } if (!result) { return formatMessage(rule, errorMessage || message["enum"]); } return null; }, rangeNumber(rule, value, message) { if (!types.number(value)) { return formatMessage(rule, rule.errorMessage || message.pattern.mismatch); } let { minimum, maximum, exclusiveMinimum, exclusiveMaximum } = rule; let min = exclusiveMinimum ? value <= minimum : value < minimum; let max = exclusiveMaximum ? value >= maximum : value > maximum; if (minimum !== void 0 && min) { return formatMessage(rule, rule.errorMessage || message["number"][exclusiveMinimum ? "exclusiveMinimum" : "minimum"]); } else if (maximum !== void 0 && max) { return formatMessage(rule, rule.errorMessage || message["number"][exclusiveMaximum ? "exclusiveMaximum" : "maximum"]); } else if (minimum !== void 0 && maximum !== void 0 && (min || max)) { return formatMessage(rule, rule.errorMessage || message["number"].range); } return null; }, rangeLength(rule, value, message) { if (!types.string(value) && !types.array(value)) { return formatMessage(rule, rule.errorMessage || message.pattern.mismatch); } let min = rule.minLength; let max = rule.maxLength; let val = value.length; if (min !== void 0 && val < min) { return formatMessage(rule, rule.errorMessage || message["length"].minLength); } else if (max !== void 0 && val > max) { return formatMessage(rule, rule.errorMessage || message["length"].maxLength); } else if (min !== void 0 && max !== void 0 && (val < min || val > max)) { return formatMessage(rule, rule.errorMessage || message["length"].range); } return null; }, pattern(rule, value, message) { if (!types["pattern"](rule.pattern, value)) { return formatMessage(rule, rule.errorMessage || message.pattern.mismatch); } return null; }, format(rule, value, message) { var customTypes = Object.keys(types); var format = FORMAT_MAPPING[rule.format] ? FORMAT_MAPPING[rule.format] : rule.format || rule.arrayType; if (customTypes.indexOf(format) > -1) { if (!types[format](value)) { return formatMessage(rule, rule.errorMessage || message.typeError); } } return null; }, arrayTypeFormat(rule, value, message) { if (!Array.isArray(value)) { return formatMessage(rule, rule.errorMessage || message.typeError); } for (let i2 = 0; i2 < value.length; i2++) { const element = value[i2]; let formatResult = this.format(rule, element, message); if (formatResult !== null) { return formatResult; } } return null; } }; class SchemaValidator extends RuleValidator { constructor(schema, options) { super(SchemaValidator.message); this._schema = schema; this._options = options || null; } updateSchema(schema) { this._schema = schema; } async validate(data, allData) { let result = this._checkFieldInSchema(data); if (!result) { result = await this.invokeValidate(data, false, allData); } return result.length ? result[0] : null; } async validateAll(data, allData) { let result = this._checkFieldInSchema(data); if (!result) { result = await this.invokeValidate(data, true, allData); } return result; } async validateUpdate(data, allData) { let result = this._checkFieldInSchema(data); if (!result) { result = await this.invokeValidateUpdate(data, false, allData); } return result.length ? result[0] : null; } async invokeValidate(data, all, allData) { let result = []; let schema = this._schema; for (let key in schema) { let value = schema[key]; let errorMessage = await this.validateRule(key, value, data[key], data, allData); if (errorMessage != null) { result.push({ key, errorMessage }); if (!all) break; } } return result; } async invokeValidateUpdate(data, all, allData) { let result = []; for (let key in data) { let errorMessage = await this.validateRule(key, this._schema[key], data[key], data, allData); if (errorMessage != null) { result.push({ key, errorMessage }); if (!all) break; } } return result; } _checkFieldInSchema(data) { var keys = Object.keys(data); var keys2 = Object.keys(this._schema); if (new Set(keys.concat(keys2)).size === keys2.length) { return ""; } var noExistFields = keys.filter((key) => { return keys2.indexOf(key) < 0; }); var errorMessage = formatMessage({ field: JSON.stringify(noExistFields) }, SchemaValidator.message.TAG + SchemaValidator.message["defaultInvalid"]); return [{ key: "invalid", errorMessage }]; } } function Message() { return { TAG: "", default: "验证错误", defaultInvalid: "提交的字段{field}在数据库中并不存在", validateFunction: "验证无效", required: "{label}必填", "enum": "{label}超出范围", timestamp: "{label}格式无效", whitespace: "{label}不能为空", typeError: "{label}类型无效", date: { format: "{label}日期{value}格式无效", parse: "{label}日期无法解析,{value}无效", invalid: "{label}日期{value}无效" }, length: { minLength: "{label}长度不能少于{minLength}", maxLength: "{label}长度不能超过{maxLength}", range: "{label}必须介于{minLength}和{maxLength}之间" }, number: { minimum: "{label}不能小于{minimum}", maximum: "{label}不能大于{maximum}", exclusiveMinimum: "{label}不能小于等于{minimum}", exclusiveMaximum: "{label}不能大于等于{maximum}", range: "{label}必须介于{minimum}and{maximum}之间" }, pattern: { mismatch: "{label}格式不匹配" } }; } SchemaValidator.message = new Message(); const deepCopy = (val) => { return JSON.parse(JSON.stringify(val)); }; const typeFilter = (format) => { return format === "int" || format === "double" || format === "number" || format === "timestamp"; }; const getValue = (key, value, rules) => { const isRuleNumType = rules.find((val) => val.format && typeFilter(val.format)); const isRuleBoolType = rules.find((val) => val.format && val.format === "boolean" || val.format === "bool"); if (!!isRuleNumType) { if (!value && value !== 0) { value = null; } else { value = isNumber(Number(value)) ? Number(value) : value; } } if (!!isRuleBoolType) { value = isBoolean(value) ? value : false; } return value; }; const setDataValue = (field, formdata, value) => { formdata[field] = value; return value || ""; }; const getDataValue = (field, data) => { return objGet(data, field); }; const realName = (name, data = {}) => { const base_name = _basePath(name); if (typeof base_name === "object" && Array.isArray(base_name) && base_name.length > 1) { const realname = base_name.reduce((a2, b2) => a2 += `#${b2}`, "_formdata_"); return realname; } return base_name[0] || name; }; const isRealName = (name) => { const reg = /^_formdata_#*/; return reg.test(name); }; const rawData = (object = {}, name) => { let newData = JSON.parse(JSON.stringify(object)); let formData = {}; for (let i2 in newData) { let path = name2arr(i2); objSet(formData, path, newData[i2]); } return formData; }; const name2arr = (name) => { let field = name.replace("_formdata_#", ""); field = field.split("#").map((v2) => isNumber(v2) ? Number(v2) : v2); return field; }; const objSet = (object, path, value) => { if (typeof object !== "object") return object; _basePath(path).reduce((o2, k2, i2, _2) => { if (i2 === _2.length - 1) { o2[k2] = value; return null; } else if (k2 in o2) { return o2[k2]; } else { o2[k2] = /^[0-9]{1,}$/.test(_2[i2 + 1]) ? [] : {}; return o2[k2]; } }, object); return object; }; function _basePath(path) { if (Array.isArray(path)) return path; return path.replace(/\[/g, ".").replace(/\]/g, "").split("."); } const objGet = (object, path, defaultVal = "undefined") => { let newPath = _basePath(path); let val = newPath.reduce((o2, k2) => { return (o2 || {})[k2]; }, object); return !val || val !== void 0 ? val : defaultVal; }; const isNumber = (num) => { return !isNaN(Number(num)); }; const isBoolean = (bool) => { return typeof bool === "boolean"; }; const isRequiredField = (rules) => { let isNoField = false; for (let i2 = 0; i2 < rules.length; i2++) { const ruleData = rules[i2]; if (ruleData.required) { isNoField = true; break; } } return isNoField; }; const isEqual = (a2, b2) => { if (a2 === b2) { return a2 !== 0 || 1 / a2 === 1 / b2; } if (a2 == null || b2 == null) { return a2 === b2; } var classNameA = toString.call(a2), classNameB = toString.call(b2); if (classNameA !== classNameB) { return false; } switch (classNameA) { case "[object RegExp]": case "[object String]": return "" + a2 === "" + b2; case "[object Number]": if (+a2 !== +a2) { return +b2 !== +b2; } return +a2 === 0 ? 1 / +a2 === 1 / b2 : +a2 === +b2; case "[object Date]": case "[object Boolean]": return +a2 === +b2; } if (classNameA == "[object Object]") { var propsA = Object.getOwnPropertyNames(a2), propsB = Object.getOwnPropertyNames(b2); if (propsA.length != propsB.length) { return false; } for (var i2 = 0; i2 < propsA.length; i2++) { var propName = propsA[i2]; if (a2[propName] !== b2[propName]) { return false; } } return true; } if (classNameA == "[object Array]") { if (a2.toString() == b2.toString()) { return true; } return false; } }; const _sfc_main$n = { name: "uniForms", emits: ["validate", "submit"], options: { virtualHost: true }, props: { // 即将弃用 value: { type: Object, default() { return null; } }, // vue3 替换 value 属性 modelValue: { type: Object, default() { return null; } }, // 1.4.0 开始将不支持 v-model ,且废弃 value 和 modelValue model: { type: Object, default() { return null; } }, // 表单校验规则 rules: { type: Object, default() { return {}; } }, //校验错误信息提示方式 默认 undertext 取值 [undertext|toast|modal] errShowType: { type: String, default: "undertext" }, // 校验触发器方式 默认 bind 取值 [bind|submit] validateTrigger: { type: String, default: "submit" }, // label 位置,默认 left 取值 top/left labelPosition: { type: String, default: "left" }, // label 宽度 labelWidth: { type: [String, Number], default: "" }, // label 居中方式,默认 left 取值 left/center/right labelAlign: { type: String, default: "left" }, border: { type: Boolean, default: false } }, provide() { return { uniForm: this }; }, data() { return { // 表单本地值的记录,不应该与传如的值进行关联 formData: {}, formRules: {} }; }, computed: { // 计算数据源变化的 localData() { const localVal = this.model || this.modelValue || this.value; if (localVal) { return deepCopy(localVal); } return {}; } }, watch: { // 监听数据变化 ,暂时不使用,需要单独赋值 // localData: {}, // 监听规则变化 rules: { handler: function(val, oldVal) { this.setRules(val); }, deep: true, immediate: true } }, created() { let getbinddata = getApp().$vm.$.appContext.config.globalProperties.binddata; if (!getbinddata) { getApp().$vm.$.appContext.config.globalProperties.binddata = function(name, value, formName) { if (formName) { this.$refs[formName].setValue(name, value); } else { let formVm; for (let i2 in this.$refs) { const vm = this.$refs[i2]; if (vm && vm.$options && vm.$options.name === "uniForms") { formVm = vm; break; } } if (!formVm) return formatAppLog("error", "at uni_modules/uni-forms/components/uni-forms/uni-forms.vue:182", "当前 uni-froms 组件缺少 ref 属性"); formVm.setValue(name, value); } }; } this.childrens = []; this.inputChildrens = []; this.setRules(this.rules); }, methods: { /** * 外部调用方法 * 设置规则 ,主要用于小程序自定义检验规则 * @param {Array} rules 规则源数据 */ setRules(rules) { this.formRules = Object.assign({}, this.formRules, rules); this.validator = new SchemaValidator(rules); }, /** * 外部调用方法 * 设置数据,用于设置表单数据,公开给用户使用 , 不支持在动态表单中使用 * @param {Object} key * @param {Object} value */ setValue(key, value) { let example = this.childrens.find((child) => child.name === key); if (!example) return null; this.formData[key] = getValue(key, value, this.formRules[key] && this.formRules[key].rules || []); return example.onFieldChange(this.formData[key]); }, /** * 外部调用方法 * 手动提交校验表单 * 对整个表单进行校验的方法,参数为一个回调函数。 * @param {Array} keepitem 保留不参与校验的字段 * @param {type} callback 方法回调 */ validate(keepitem, callback) { return this.checkAll(this.formData, keepitem, callback); }, /** * 外部调用方法 * 部分表单校验 * @param {Array|String} props 需要校验的字段 * @param {Function} 回调函数 */ validateField(props = [], callback) { props = [].concat(props); let invalidFields = {}; this.childrens.forEach((item) => { const name = realName(item.name); if (props.indexOf(name) !== -1) { invalidFields = Object.assign({}, invalidFields, { [name]: this.formData[name] }); } }); return this.checkAll(invalidFields, [], callback); }, /** * 外部调用方法 * 移除表单项的校验结果。传入待移除的表单项的 prop 属性或者 prop 组成的数组,如不传则移除整个表单的校验结果 * @param {Array|String} props 需要移除校验的字段 ,不填为所有 */ clearValidate(props = []) { props = [].concat(props); this.childrens.forEach((item) => { if (props.length === 0) { item.errMsg = ""; } else { const name = realName(item.name); if (props.indexOf(name) !== -1) { item.errMsg = ""; } } }); }, /** * 外部调用方法 ,即将废弃 * 手动提交校验表单 * 对整个表单进行校验的方法,参数为一个回调函数。 * @param {Array} keepitem 保留不参与校验的字段 * @param {type} callback 方法回调 */ submit(keepitem, callback, type) { for (let i2 in this.dataValue) { const itemData = this.childrens.find((v2) => v2.name === i2); if (itemData) { if (this.formData[i2] === void 0) { this.formData[i2] = this._getValue(i2, this.dataValue[i2]); } } } if (!type) { formatAppLog("warn", "at uni_modules/uni-forms/components/uni-forms/uni-forms.vue:289", "submit 方法即将废弃,请使用validate方法代替!"); } return this.checkAll(this.formData, keepitem, callback, "submit"); }, // 校验所有 async checkAll(invalidFields, keepitem, callback, type) { if (!this.validator) return; let childrens = []; for (let i2 in invalidFields) { const item = this.childrens.find((v2) => realName(v2.name) === i2); if (item) { childrens.push(item); } } if (!callback && typeof keepitem === "function") { callback = keepitem; } let promise; if (!callback && typeof callback !== "function" && Promise) { promise = new Promise((resolve, reject) => { callback = function(valid, invalidFields2) { !valid ? resolve(invalidFields2) : reject(valid); }; }); } let results = []; let tempFormData = JSON.parse(JSON.stringify(invalidFields)); for (let i2 in childrens) { const child = childrens[i2]; let name = realName(child.name); const result = await child.onFieldChange(tempFormData[name]); if (result) { results.push(result); if (this.errShowType === "toast" || this.errShowType === "modal") break; } } if (Array.isArray(results)) { if (results.length === 0) results = null; } if (Array.isArray(keepitem)) { keepitem.forEach((v2) => { let vName = realName(v2); let value = getDataValue(v2, this.localData); if (value !== void 0) { tempFormData[vName] = value; } }); } if (type === "submit") { this.$emit("submit", { detail: { value: tempFormData, errors: results } }); } else { this.$emit("validate", results); } let resetFormData = {}; resetFormData = rawData(tempFormData, this.name); callback && typeof callback === "function" && callback(results, resetFormData); if (promise && callback) { return promise; } else { return null; } }, /** * 返回validate事件 * @param {Object} result */ validateCheck(result) { this.$emit("validate", result); }, _getValue: getValue, _isRequiredField: isRequiredField, _setDataValue: setDataValue, _getDataValue: getDataValue, _realName: realName, _isRealName: isRealName, _isEqual: isEqual } }; function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock("view", { class: "uni-forms" }, [ vue.createElementVNode("form", null, [ vue.renderSlot(_ctx.$slots, "default", {}, void 0, true) ]) ]); } const __easycom_2$1 = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$e], ["__scopeId", "data-v-9a1e3c32"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-forms/components/uni-forms/uni-forms.vue"]]); var hostUrl = "http://zhongyao.fscuc.cn"; var hostUrl2 = "http://zy-web.fscuc.cn"; const service = (params2 = {}) => { return new Promise((resolve, reject) => { formatAppLog("log", "at static/js/request.js:12", "params.data.data", params2.data.data); let query = ""; let tokens = ""; if (params2.data.data) { params2.data.data; } if (params2.data.token) { tokens = params2.data.token; } if (params2.data.query) ; else { query = params2.url; } formatAppLog("log", "at static/js/request.js:29", "params.data.token", tokens); uni.request({ url: hostUrl + query, // 接收请求的API header: { "Authorization": "Bearer " + tokens // 'Accept': 'application/json, text/plain, */*', // 'Content-Type': 'application/json', // 'Access-Control-Allow-Origin': '*', }, method: params2.method || "POST", // 接收请求的方式,如果不传默认为POST data: params2.data.data, //JSON.stringify(params.data.data), // 接收请求的data,不传默认为空 success: (res) => { if (res.statusCode !== 200 && res.statusCode !== 201) { return uni.$showMsg("请求失败!请联系平台客服", 2e3); } else { resolve(res); } }, fail: (err) => { return uni.$showMsg("请求接口失败!", 2e3); } }); }); }; const login = (params2 = {}) => { return new Promise((resolve, reject) => { formatAppLog("log", "at static/js/request.js:64", "request login ", hostUrl); uni.request({ url: hostUrl + "/login/v2", method: params2.method || "POST", data: JSON.stringify(params2), success: (res) => { if (res.statusCode !== 200 && res.statusCode !== 201) { return uni.$showMsg("请求失败!请联系平台客服", 2e3); } else { resolve(res); } }, fail: (err) => { return uni.$showMsg("请求接口失败!", 2e3); } }); }); }; const sendToUser = (params2 = {}) => { return new Promise((resolve, reject) => { uni.request({ url: hostUrl2 + "/userPrescription/sendToUser", method: "POST", data: params2.data, headers: { Authorization: "Bearer " + params2.token }, success: (res) => { if (res.statusCode !== 200 && res.statusCode !== 201) { return uni.$showMsg("请求失败!请联系平台客服", 2e3); } else { resolve(res); } }, fail: (err) => { return uni.$showMsg("请求接口失败!", 2e3); } }); }); }; const selectOrderDetail = (params2 = {}) => { return new Promise((resolve, reject) => { uni.request({ // url: 'http://zhongyao.fscuc.cn' + '/login/v2', url: hostUrl + `/prescription/prescriptionCore/selectOrderDetail?id=${params2.data.id}&preNo=${params2.data.preNo}&depolyStatus=${params2.data.depolyStatus}`, method: params2.method || "POST", data: JSON.stringify(params2), header: { "Authorization": "Bearer " + params2.data.token }, success: (res) => { if (res.statusCode !== 200 && res.statusCode !== 201) { return uni.$showMsg("请求失败!请联系平台客服", 2e3); } else { resolve(res); } }, fail: (err) => { return uni.$showMsg("请求接口失败!", 2e3); } }); }); }; const releaseOrder = (params2 = {}) => { return new Promise((resolve, reject) => { uni.request({ // url: 'http://zhongyao.fscuc.cn' + '/login/v2', url: hostUrl + `/pharmacistStatus/releaseOrder?ids=${params2.data.ids}`, method: params2.method || "POST", data: JSON.stringify(params2), header: { "Authorization": "Bearer " + params2.data.token }, success: (res) => { if (res.statusCode !== 200 && res.statusCode !== 201) { return uni.$showMsg("请求失败!请联系平台客服", 2e3); } else { resolve(res); } }, fail: (err) => { return uni.$showMsg("请求接口失败!", 2e3); } }); }); }; const receiveOrderList = (data) => { return service({ url: "/prescription/prescriptionCore/receiveOrderList", method: "POST", data }); }; const updateWorkStatus = (data) => { return service({ url: "/pharmacistStatus/updateWorkStatus", method: "POST", data }); }; const updateOnlineStatus = (data) => { return service({ url: "/pharmacistOnlineStatus/updateOnlineStatus", method: "POST", data }); }; const saveDepoly = (data) => { return service({ url: "/file/saveCoreFile", method: "POST", data }); }; const saveReview = (data) => { return service({ url: "/prescription/prescriptionCore/reviewPrescription", method: "POST", data }); }; const __default__$5 = { name: "" }; const _sfc_main$m = /* @__PURE__ */ Object.assign(__default__$5, { setup(__props) { const showPassword = vue.ref(false); const formData = vue.ref({ username: "", password: "", remember: false }); onLoad(() => { const sRemember = false; if (uni.getStorageSync("remember")) { JSON.parse(uni.getStorageSync("remember")); } formatAppLog("log", "at pages/login/login.vue:59", "onLoad sRemember", sRemember); }); const submit = async () => { formatAppLog("log", "at pages/login/login.vue:68", "formData", formData.value); if (formData.value.name && formData.value.password && formData.value.remember === true) { uni.setStorageSync("username", formData.value.name); uni.setStorageSync("password", formData.value.password); uni.setStorageSync("remember", formData.value.remember); uni.setStorageSync("workStatus", formData.value.remember); } const params2 = { username: formData.value.username, password: formData.value.password, code: "2" }; let { data: res } = await login(params2); formatAppLog("log", "at pages/login/login.vue:82", "res", res.code); if (res.code === 200 && res.token && res.userId) { uni.setStorageSync("token", res.token); uni.setStorageSync("userId", res.userId); formatAppLog("log", "at pages/login/login.vue:88", "11"); formatAppLog("log", "at pages/login/login.vue:89", "res.token", res.token); const param = { token: res.token, data: JSON.stringify({ pharmacistUserId: res.userId, onlineStatus: 0 }) }; formatAppLog("log", "at pages/login/login.vue:95", "res.param", param); await updateOnlineStatus(param); uni.redirectTo({ url: "/pages/index/index" }); } else { formatAppLog("log", "at pages/login/login.vue:102", "登录失败"); uni.$showMsg("登录失败", 1500); } }; const handleChange = () => { formData.value.remember = !formData.value.remember; formatAppLog("log", "at pages/login/login.vue:112", "formData.value.username", formData.value.username); formatAppLog("log", "at pages/login/login.vue:113", "formData.value.password", formData.value.password); formatAppLog("log", "at pages/login/login.vue:114", "formData.value.remember", formData.value.remember); if (formData.value.remember === true) { uni.setStorageSync("username", formData.value.username); uni.setStorageSync("password", formData.value.password); uni.setStorageSync("remember", true); } else { uni.removeStorageSync("username"); uni.removeStorageSync("password"); uni.removeStorageSync("remember"); } }; const changePassword = () => { showPassword.value = !showPassword.value; }; vue.onMounted(() => { const username = uni.getStorageSync("username"); const password = uni.getStorageSync("password"); const remember = uni.getStorageSync("remember"); if (typeof username === typeof password === "string" && remember) { formData.value.username = username; formData.value.password = password; formData.value.remember = remember; } }); return (_ctx, _cache) => { const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_0$3); const _component_uni_forms_item = resolveEasycom(vue.resolveDynamicComponent("uni-forms-item"), __easycom_1$2); const _component_uni_forms = resolveEasycom(vue.resolveDynamicComponent("uni-forms"), __easycom_2$1); return vue.openBlock(), vue.createElementBlock("view", { class: "main" }, [ vue.createElementVNode("view", { class: "login" }, [ vue.createElementVNode("view", { class: "logo" }, [ vue.createElementVNode("image", { class: "faceu", aspectFill: "", src: "/static/login@2x.png" }) ]), vue.createElementVNode("view", { class: "title" }, [ vue.createElementVNode("text", { class: "text" }, "中药处方煎配溯源管理") ]), vue.createVNode(_component_uni_forms, { model: formData.value }, { default: vue.withCtx(() => [ vue.createVNode(_component_uni_forms_item, { name: "name" }, { default: vue.withCtx(() => [ vue.createVNode(_component_uni_icons, { class: "item", type: "person-filled", color: "#999999", size: "30" }), vue.createElementVNode("view", { class: "input" }, [ vue.withDirectives(vue.createElementVNode( "input", { type: "text", class: "item", "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => formData.value.username = $event), placeholder: "请输入账号" }, null, 512 /* NEED_PATCH */ ), [ [vue.vModelText, formData.value.username] ]) ]) ]), _: 1 /* STABLE */ }), vue.createVNode(_component_uni_forms_item, { name: "password" }, { default: vue.withCtx(() => [ vue.createVNode(_component_uni_icons, { type: "locked", class: "item", color: "#999999", size: "30" }), vue.createElementVNode("view", { class: "input" }, [ vue.withDirectives(vue.createElementVNode("input", { class: "item", "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => formData.value.password = $event), password: showPassword.value, placeholder: "请输入密码" }, null, 8, ["password"]), [ [vue.vModelText, formData.value.password] ]), vue.createVNode(_component_uni_icons, { "custom-prefix": "iconfont", class: "item", type: showPassword.value ? "icon-biyanjing" : "icon-yanjing", color: "#999999", size: "30", onClick: changePassword }, null, 8, ["type"]) ]) ]), _: 1 /* STABLE */ }), vue.createElementVNode("label", { for: "", class: "radio" }, [ vue.createElementVNode("switch", { checked: formData.value.remember, style: { "transform": "scale(0.7)" }, onChange: handleChange }, null, 40, ["checked"]), vue.createTextVNode(" 记住密码 ") ]) ]), _: 1 /* STABLE */ }, 8, ["model"]), vue.createElementVNode("button", { class: "button", onClick: submit }, "登录") ]) ]); }; } }); const PagesLoginLogin = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__file", "/Users/sunwubin/source/pharmacy/pages/login/login.vue"]]); function obj2strClass(obj) { let classess = ""; for (let key in obj) { const val = obj[key]; if (val) { classess += `${key} `; } } return classess; } function obj2strStyle(obj) { let style = ""; for (let key in obj) { const val = obj[key]; style += `${key}:${val};`; } return style; } const _sfc_main$l = { name: "uni-easyinput", emits: ["click", "iconClick", "update:modelValue", "input", "focus", "blur", "confirm", "clear", "eyes", "change", "keyboardheightchange"], model: { prop: "modelValue", event: "update:modelValue" }, options: { virtualHost: true }, inject: { form: { from: "uniForm", default: null }, formItem: { from: "uniFormItem", default: null } }, props: { name: String, value: [Number, String], modelValue: [Number, String], type: { type: String, default: "text" }, clearable: { type: Boolean, default: true }, autoHeight: { type: Boolean, default: false }, placeholder: { type: String, default: " " }, placeholderStyle: String, focus: { type: Boolean, default: false }, disabled: { type: Boolean, default: false }, maxlength: { type: [Number, String], default: 140 }, confirmType: { type: String, default: "done" }, clearSize: { type: [Number, String], default: 24 }, inputBorder: { type: Boolean, default: true }, prefixIcon: { type: String, default: "" }, suffixIcon: { type: String, default: "" }, trim: { type: [Boolean, String], default: false }, cursorSpacing: { type: Number, default: 0 }, passwordIcon: { type: Boolean, default: true }, primaryColor: { type: String, default: "#2979ff" }, styles: { type: Object, default() { return { color: "#333", backgroundColor: "#fff", disableColor: "#F7F6F6", borderColor: "#e5e5e5" }; } }, errorMessage: { type: [String, Boolean], default: "" } }, data() { return { focused: false, val: "", showMsg: "", border: false, isFirstBorder: false, showClearIcon: false, showPassword: false, focusShow: false, localMsg: "", isEnter: false // 用于判断当前是否是使用回车操作 }; }, computed: { // 输入框内是否有值 isVal() { const val = this.val; if (val || val === 0) { return true; } return false; }, msg() { return this.localMsg || this.errorMessage; }, // 因为uniapp的input组件的maxlength组件必须要数值,这里转为数值,用户可以传入字符串数值 inputMaxlength() { return Number(this.maxlength); }, // 处理外层样式的style boxStyle() { return `color:${this.inputBorder && this.msg ? "#e43d33" : this.styles.color};`; }, // input 内容的类和样式处理 inputContentClass() { return obj2strClass({ "is-input-border": this.inputBorder, "is-input-error-border": this.inputBorder && this.msg, "is-textarea": this.type === "textarea", "is-disabled": this.disabled, "is-focused": this.focusShow }); }, inputContentStyle() { const focusColor = this.focusShow ? this.primaryColor : this.styles.borderColor; const borderColor = this.inputBorder && this.msg ? "#dd524d" : focusColor; return obj2strStyle({ "border-color": borderColor || "#e5e5e5", "background-color": this.disabled ? this.styles.disableColor : this.styles.backgroundColor }); }, // input右侧样式 inputStyle() { const paddingRight = this.type === "password" || this.clearable || this.prefixIcon ? "" : "10px"; return obj2strStyle({ "padding-right": paddingRight, "padding-left": this.prefixIcon ? "" : "10px" }); } }, watch: { value(newVal) { this.val = newVal; }, modelValue(newVal) { this.val = newVal; }, focus(newVal) { this.$nextTick(() => { this.focused = this.focus; this.focusShow = this.focus; }); } }, created() { this.init(); if (this.form && this.formItem) { this.$watch("formItem.errMsg", (newVal) => { this.localMsg = newVal; }); } }, mounted() { this.$nextTick(() => { this.focused = this.focus; this.focusShow = this.focus; }); }, methods: { /** * 初始化变量值 */ init() { if (this.value || this.value === 0) { this.val = this.value; } else if (this.modelValue || this.modelValue === 0 || this.modelValue === "") { this.val = this.modelValue; } else { this.val = null; } }, /** * 点击图标时触发 * @param {Object} type */ onClickIcon(type) { this.$emit("iconClick", type); }, /** * 显示隐藏内容,密码框时生效 */ onEyes() { this.showPassword = !this.showPassword; this.$emit("eyes", this.showPassword); }, /** * 输入时触发 * @param {Object} event */ onInput(event) { let value = event.detail.value; if (this.trim) { if (typeof this.trim === "boolean" && this.trim) { value = this.trimStr(value); } if (typeof this.trim === "string") { value = this.trimStr(value, this.trim); } } if (this.errMsg) this.errMsg = ""; this.val = value; this.$emit("input", value); this.$emit("update:modelValue", value); }, /** * 外部调用方法 * 获取焦点时触发 * @param {Object} event */ onFocus() { this.$nextTick(() => { this.focused = true; }); this.$emit("focus", null); }, _Focus(event) { this.focusShow = true; this.$emit("focus", event); }, /** * 外部调用方法 * 失去焦点时触发 * @param {Object} event */ onBlur() { this.focused = false; this.$emit("focus", null); }, _Blur(event) { event.detail.value; this.focusShow = false; this.$emit("blur", event); if (this.isEnter === false) { this.$emit("change", this.val); } if (this.form && this.formItem) { const { validateTrigger } = this.form; if (validateTrigger === "blur") { this.formItem.onFieldChange(); } } }, /** * 按下键盘的发送键 * @param {Object} e */ onConfirm(e2) { this.$emit("confirm", this.val); this.isEnter = true; this.$emit("change", this.val); this.$nextTick(() => { this.isEnter = false; }); }, /** * 清理内容 * @param {Object} event */ onClear(event) { this.val = ""; this.$emit("input", ""); this.$emit("update:modelValue", ""); this.$emit("clear"); }, /** * 键盘高度发生变化的时候触发此事件 * 兼容性:微信小程序2.7.0+、App 3.1.0+ * @param {Object} event */ onkeyboardheightchange(event) { this.$emit("keyboardheightchange", event); }, /** * 去除空格 */ trimStr(str, pos = "both") { if (pos === "both") { return str.trim(); } else if (pos === "left") { return str.trimLeft(); } else if (pos === "right") { return str.trimRight(); } else if (pos === "start") { return str.trimStart(); } else if (pos === "end") { return str.trimEnd(); } else if (pos === "all") { return str.replace(/\s+/g, ""); } else if (pos === "none") { return str; } return str; } } }; function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) { const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_0$3); return vue.openBlock(), vue.createElementBlock( "view", { class: vue.normalizeClass(["uni-easyinput", { "uni-easyinput-error": $options.msg }]), style: vue.normalizeStyle($options.boxStyle) }, [ vue.createElementVNode( "view", { class: vue.normalizeClass(["uni-easyinput__content", $options.inputContentClass]), style: vue.normalizeStyle($options.inputContentStyle) }, [ $props.prefixIcon ? (vue.openBlock(), vue.createBlock(_component_uni_icons, { key: 0, class: "content-clear-icon", type: $props.prefixIcon, color: "#c0c4cc", onClick: _cache[0] || (_cache[0] = ($event) => $options.onClickIcon("prefix")), size: "22" }, null, 8, ["type"])) : vue.createCommentVNode("v-if", true), $props.type === "textarea" ? (vue.openBlock(), vue.createElementBlock("textarea", { key: 1, class: vue.normalizeClass(["uni-easyinput__content-textarea", { "input-padding": $props.inputBorder }]), name: $props.name, value: $data.val, placeholder: $props.placeholder, placeholderStyle: $props.placeholderStyle, disabled: $props.disabled, "placeholder-class": "uni-easyinput__placeholder-class", maxlength: $options.inputMaxlength, focus: $data.focused, autoHeight: $props.autoHeight, "cursor-spacing": $props.cursorSpacing, onInput: _cache[1] || (_cache[1] = (...args) => $options.onInput && $options.onInput(...args)), onBlur: _cache[2] || (_cache[2] = (...args) => $options._Blur && $options._Blur(...args)), onFocus: _cache[3] || (_cache[3] = (...args) => $options._Focus && $options._Focus(...args)), onConfirm: _cache[4] || (_cache[4] = (...args) => $options.onConfirm && $options.onConfirm(...args)), onKeyboardheightchange: _cache[5] || (_cache[5] = (...args) => $options.onkeyboardheightchange && $options.onkeyboardheightchange(...args)) }, null, 42, ["name", "value", "placeholder", "placeholderStyle", "disabled", "maxlength", "focus", "autoHeight", "cursor-spacing"])) : (vue.openBlock(), vue.createElementBlock("input", { key: 2, type: $props.type === "password" ? "text" : $props.type, class: "uni-easyinput__content-input", style: vue.normalizeStyle($options.inputStyle), name: $props.name, value: $data.val, password: !$data.showPassword && $props.type === "password", placeholder: $props.placeholder, placeholderStyle: $props.placeholderStyle, "placeholder-class": "uni-easyinput__placeholder-class", disabled: $props.disabled, maxlength: $options.inputMaxlength, focus: $data.focused, confirmType: $props.confirmType, "cursor-spacing": $props.cursorSpacing, onFocus: _cache[6] || (_cache[6] = (...args) => $options._Focus && $options._Focus(...args)), onBlur: _cache[7] || (_cache[7] = (...args) => $options._Blur && $options._Blur(...args)), onInput: _cache[8] || (_cache[8] = (...args) => $options.onInput && $options.onInput(...args)), onConfirm: _cache[9] || (_cache[9] = (...args) => $options.onConfirm && $options.onConfirm(...args)), onKeyboardheightchange: _cache[10] || (_cache[10] = (...args) => $options.onkeyboardheightchange && $options.onkeyboardheightchange(...args)) }, null, 44, ["type", "name", "value", "password", "placeholder", "placeholderStyle", "disabled", "maxlength", "focus", "confirmType", "cursor-spacing"])), $props.type === "password" && $props.passwordIcon ? (vue.openBlock(), vue.createElementBlock( vue.Fragment, { key: 3 }, [ vue.createCommentVNode(" 开启密码时显示小眼睛 "), $options.isVal ? (vue.openBlock(), vue.createBlock(_component_uni_icons, { key: 0, class: vue.normalizeClass(["content-clear-icon", { "is-textarea-icon": $props.type === "textarea" }]), type: $data.showPassword ? "eye-slash-filled" : "eye-filled", size: 22, color: $data.focusShow ? $props.primaryColor : "#c0c4cc", onClick: $options.onEyes }, null, 8, ["class", "type", "color", "onClick"])) : vue.createCommentVNode("v-if", true) ], 64 /* STABLE_FRAGMENT */ )) : $props.suffixIcon ? (vue.openBlock(), vue.createElementBlock( vue.Fragment, { key: 4 }, [ $props.suffixIcon ? (vue.openBlock(), vue.createBlock(_component_uni_icons, { key: 0, class: "content-clear-icon", type: $props.suffixIcon, color: "#c0c4cc", onClick: _cache[11] || (_cache[11] = ($event) => $options.onClickIcon("suffix")), size: "22" }, null, 8, ["type"])) : vue.createCommentVNode("v-if", true) ], 64 /* STABLE_FRAGMENT */ )) : (vue.openBlock(), vue.createElementBlock( vue.Fragment, { key: 5 }, [ $props.clearable && $options.isVal && !$props.disabled && $props.type !== "textarea" ? (vue.openBlock(), vue.createBlock(_component_uni_icons, { key: 0, class: vue.normalizeClass(["content-clear-icon", { "is-textarea-icon": $props.type === "textarea" }]), type: "clear", size: $props.clearSize, color: $options.msg ? "#dd524d" : $data.focusShow ? $props.primaryColor : "#c0c4cc", onClick: $options.onClear }, null, 8, ["class", "size", "color", "onClick"])) : vue.createCommentVNode("v-if", true) ], 64 /* STABLE_FRAGMENT */ )), vue.renderSlot(_ctx.$slots, "right", {}, void 0, true) ], 6 /* CLASS, STYLE */ ) ], 6 /* CLASS, STYLE */ ); } const __easycom_0$2 = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$d], ["__scopeId", "data-v-09fd5285"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue"]]); let Calendar$1 = class Calendar { constructor({ selected, startDate, endDate, range } = {}) { this.date = this.getDateObj(/* @__PURE__ */ new Date()); this.selected = selected || []; this.startDate = startDate; this.endDate = endDate; this.range = range; this.cleanMultipleStatus(); this.weeks = {}; this.lastHover = false; } /** * 设置日期 * @param {Object} date */ setDate(date) { const selectDate = this.getDateObj(date); this.getWeeks(selectDate.fullDate); } /** * 清理多选状态 */ cleanMultipleStatus() { this.multipleStatus = { before: "", after: "", data: [] }; } setStartDate(startDate) { this.startDate = startDate; } setEndDate(endDate) { this.endDate = endDate; } getPreMonthObj(date) { date = fixIosDateFormat(date); date = new Date(date); const oldMonth = date.getMonth(); date.setMonth(oldMonth - 1); const newMonth = date.getMonth(); if (oldMonth !== 0 && newMonth - oldMonth === 0) { date.setMonth(newMonth - 1); } return this.getDateObj(date); } getNextMonthObj(date) { date = fixIosDateFormat(date); date = new Date(date); const oldMonth = date.getMonth(); date.setMonth(oldMonth + 1); const newMonth = date.getMonth(); if (newMonth - oldMonth > 1) { date.setMonth(newMonth - 1); } return this.getDateObj(date); } /** * 获取指定格式Date对象 */ getDateObj(date) { date = fixIosDateFormat(date); date = new Date(date); return { fullDate: getDate(date), year: date.getFullYear(), month: addZero(date.getMonth() + 1), date: addZero(date.getDate()), day: date.getDay() }; } /** * 获取上一个月日期集合 */ getPreMonthDays(amount, dateObj) { const result = []; for (let i2 = amount - 1; i2 >= 0; i2--) { const month = dateObj.month > 1 ? dateObj.month - 1 : 12; const year = month === 12 ? dateObj.year - 1 : dateObj.year; const date = new Date(year, month, -i2).getDate(); const fullDate = `${year}-${addZero(month)}-${addZero(date)}`; let multiples = this.multipleStatus.data; let multiplesStatus = -1; if (this.range && multiples) { multiplesStatus = multiples.findIndex((item) => { return this.dateEqual(item, fullDate); }); } const checked = multiplesStatus !== -1; const extraInfo = this.selected && this.selected.find((item) => { if (this.dateEqual(fullDate, item.date)) { return item; } }); result.push({ fullDate, year, month, date, multiple: this.range ? checked : false, beforeMultiple: this.isLogicBefore(fullDate, this.multipleStatus.before, this.multipleStatus.after), afterMultiple: this.isLogicAfter(fullDate, this.multipleStatus.before, this.multipleStatus.after), disable: this.startDate && !dateCompare(this.startDate, fullDate) || this.endDate && !dateCompare(fullDate, this.endDate), isToday: fullDate === this.date.fullDate, userChecked: false, extraInfo }); } return result; } /** * 获取本月日期集合 */ getCurrentMonthDays(amount, dateObj) { const result = []; const fullDate = this.date.fullDate; for (let i2 = 1; i2 <= amount; i2++) { const currentDate = `${dateObj.year}-${dateObj.month}-${addZero(i2)}`; const isToday = fullDate === currentDate; const extraInfo = this.selected && this.selected.find((item) => { if (this.dateEqual(currentDate, item.date)) { return item; } }); if (this.startDate) { dateCompare(this.startDate, currentDate); } if (this.endDate) { dateCompare(currentDate, this.endDate); } let multiples = this.multipleStatus.data; let multiplesStatus = -1; if (this.range && multiples) { multiplesStatus = multiples.findIndex((item) => { return this.dateEqual(item, currentDate); }); } const checked = multiplesStatus !== -1; result.push({ fullDate: currentDate, year: dateObj.year, month: dateObj.month, date: i2, multiple: this.range ? checked : false, beforeMultiple: this.isLogicBefore(currentDate, this.multipleStatus.before, this.multipleStatus.after), afterMultiple: this.isLogicAfter(currentDate, this.multipleStatus.before, this.multipleStatus.after), disable: this.startDate && !dateCompare(this.startDate, currentDate) || this.endDate && !dateCompare(currentDate, this.endDate), isToday, userChecked: false, extraInfo }); } return result; } /** * 获取下一个月日期集合 */ _getNextMonthDays(amount, dateObj) { const result = []; dateObj.month + 1; for (let i2 = 1; i2 <= amount; i2++) { const month = dateObj.month === 12 ? 1 : dateObj.month * 1 + 1; const year = month === 1 ? dateObj.year + 1 : dateObj.year; const fullDate = `${year}-${addZero(month)}-${addZero(i2)}`; let multiples = this.multipleStatus.data; let multiplesStatus = -1; if (this.range && multiples) { multiplesStatus = multiples.findIndex((item) => { return this.dateEqual(item, fullDate); }); } const checked = multiplesStatus !== -1; const extraInfo = this.selected && this.selected.find((item) => { if (this.dateEqual(fullDate, item.date)) { return item; } }); result.push({ fullDate, year, date: i2, month, multiple: this.range ? checked : false, beforeMultiple: this.isLogicBefore(fullDate, this.multipleStatus.before, this.multipleStatus.after), afterMultiple: this.isLogicAfter(fullDate, this.multipleStatus.before, this.multipleStatus.after), disable: this.startDate && !dateCompare(this.startDate, fullDate) || this.endDate && !dateCompare(fullDate, this.endDate), isToday: fullDate === this.date.fullDate, userChecked: false, extraInfo }); } return result; } /** * 获取当前日期详情 * @param {Object} date */ getInfo(date) { if (!date) { date = /* @__PURE__ */ new Date(); } return this.calendar.find((item) => item.fullDate === this.getDateObj(date).fullDate); } /** * 比较时间是否相等 */ dateEqual(before, after) { before = new Date(fixIosDateFormat(before)); after = new Date(fixIosDateFormat(after)); return before.valueOf() === after.valueOf(); } /** * 比较真实起始日期 */ isLogicBefore(currentDate, before, after) { let logicBefore = before; if (before && after) { logicBefore = dateCompare(before, after) ? before : after; } return this.dateEqual(logicBefore, currentDate); } isLogicAfter(currentDate, before, after) { let logicAfter = after; if (before && after) { logicAfter = dateCompare(before, after) ? after : before; } return this.dateEqual(logicAfter, currentDate); } /** * 获取日期范围内所有日期 * @param {Object} begin * @param {Object} end */ geDateAll(begin, end) { var arr = []; var ab = begin.split("-"); var ae2 = end.split("-"); var db = /* @__PURE__ */ new Date(); db.setFullYear(ab[0], ab[1] - 1, ab[2]); var de2 = /* @__PURE__ */ new Date(); de2.setFullYear(ae2[0], ae2[1] - 1, ae2[2]); var unixDb = db.getTime() - 24 * 60 * 60 * 1e3; var unixDe = de2.getTime() - 24 * 60 * 60 * 1e3; for (var k2 = unixDb; k2 <= unixDe; ) { k2 = k2 + 24 * 60 * 60 * 1e3; arr.push(this.getDateObj(new Date(parseInt(k2))).fullDate); } return arr; } /** * 获取多选状态 */ setMultiple(fullDate) { if (!this.range) return; let { before, after } = this.multipleStatus; if (before && after) { if (!this.lastHover) { this.lastHover = true; return; } this.multipleStatus.before = fullDate; this.multipleStatus.after = ""; this.multipleStatus.data = []; this.multipleStatus.fulldate = ""; this.lastHover = false; } else { if (!before) { this.multipleStatus.before = fullDate; this.lastHover = false; } else { this.multipleStatus.after = fullDate; if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) { this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after); } else { this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before); } this.lastHover = true; } } this.getWeeks(fullDate); } /** * 鼠标 hover 更新多选状态 */ setHoverMultiple(fullDate) { if (!this.range || this.lastHover) return; const { before } = this.multipleStatus; if (!before) { this.multipleStatus.before = fullDate; } else { this.multipleStatus.after = fullDate; if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) { this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after); } else { this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before); } } this.getWeeks(fullDate); } /** * 更新默认值多选状态 */ setDefaultMultiple(before, after) { this.multipleStatus.before = before; this.multipleStatus.after = after; if (before && after) { if (dateCompare(before, after)) { this.multipleStatus.data = this.geDateAll(before, after); this.getWeeks(after); } else { this.multipleStatus.data = this.geDateAll(after, before); this.getWeeks(before); } } } /** * 获取每周数据 * @param {Object} dateData */ getWeeks(dateData) { const { year, month } = this.getDateObj(dateData); const preMonthDayAmount = new Date(year, month - 1, 1).getDay(); const preMonthDays = this.getPreMonthDays(preMonthDayAmount, this.getDateObj(dateData)); const currentMonthDayAmount = new Date(year, month, 0).getDate(); const currentMonthDays = this.getCurrentMonthDays(currentMonthDayAmount, this.getDateObj(dateData)); const nextMonthDayAmount = 42 - preMonthDayAmount - currentMonthDayAmount; const nextMonthDays = this._getNextMonthDays(nextMonthDayAmount, this.getDateObj(dateData)); const calendarDays = [...preMonthDays, ...currentMonthDays, ...nextMonthDays]; const weeks = new Array(6); for (let i2 = 0; i2 < calendarDays.length; i2++) { const index = Math.floor(i2 / 7); if (!weeks[index]) { weeks[index] = new Array(7); } weeks[index][i2 % 7] = calendarDays[i2]; } this.calendar = calendarDays; this.weeks = weeks; } }; function getDateTime(date, hideSecond) { return `${getDate(date)} ${getTime(date, hideSecond)}`; } function getDate(date) { date = fixIosDateFormat(date); date = new Date(date); const year = date.getFullYear(); const month = date.getMonth() + 1; const day = date.getDate(); return `${year}-${addZero(month)}-${addZero(day)}`; } function getTime(date, hideSecond) { date = fixIosDateFormat(date); date = new Date(date); const hour = date.getHours(); const minute = date.getMinutes(); const second = date.getSeconds(); return hideSecond ? `${addZero(hour)}:${addZero(minute)}` : `${addZero(hour)}:${addZero(minute)}:${addZero(second)}`; } function addZero(num) { if (num < 10) { num = `0${num}`; } return num; } function getDefaultSecond(hideSecond) { return hideSecond ? "00:00" : "00:00:00"; } function dateCompare(startDate, endDate) { startDate = new Date(fixIosDateFormat(startDate)); endDate = new Date(fixIosDateFormat(endDate)); return startDate <= endDate; } function checkDate(date) { const dateReg = /((19|20)\d{2})(-|\/)\d{1,2}(-|\/)\d{1,2}/g; return date.match(dateReg); } const dateTimeReg = /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])( [0-5]?[0-9]:[0-5]?[0-9]:[0-5]?[0-9])?$/; function fixIosDateFormat(value) { if (typeof value === "string" && dateTimeReg.test(value)) { value = value.replace(/-/g, "/"); } return value; } const _sfc_main$k = { props: { weeks: { type: Object, default() { return {}; } }, calendar: { type: Object, default: () => { return {}; } }, selected: { type: Array, default: () => { return []; } }, checkHover: { type: Boolean, default: false } }, methods: { choiceDate(weeks) { this.$emit("change", weeks); }, handleMousemove(weeks) { this.$emit("handleMouse", weeks); } } }; function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock( "view", { class: vue.normalizeClass(["uni-calendar-item__weeks-box", { "uni-calendar-item--disable": $props.weeks.disable, "uni-calendar-item--before-checked-x": $props.weeks.beforeMultiple, "uni-calendar-item--multiple": $props.weeks.multiple, "uni-calendar-item--after-checked-x": $props.weeks.afterMultiple }]), onClick: _cache[0] || (_cache[0] = ($event) => $options.choiceDate($props.weeks)), onMouseenter: _cache[1] || (_cache[1] = ($event) => $options.handleMousemove($props.weeks)) }, [ vue.createElementVNode( "view", { class: vue.normalizeClass(["uni-calendar-item__weeks-box-item", { "uni-calendar-item--checked": $props.calendar.fullDate === $props.weeks.fullDate && ($props.calendar.userChecked || !$props.checkHover), "uni-calendar-item--checked-range-text": $props.checkHover, "uni-calendar-item--before-checked": $props.weeks.beforeMultiple, "uni-calendar-item--multiple": $props.weeks.multiple, "uni-calendar-item--after-checked": $props.weeks.afterMultiple, "uni-calendar-item--disable": $props.weeks.disable }]) }, [ $props.selected && $props.weeks.extraInfo ? (vue.openBlock(), vue.createElementBlock("text", { key: 0, class: "uni-calendar-item__weeks-box-circle" })) : vue.createCommentVNode("v-if", true), vue.createElementVNode( "text", { class: "uni-calendar-item__weeks-box-text uni-calendar-item__weeks-box-text-disable uni-calendar-item--checked-text" }, vue.toDisplayString($props.weeks.date), 1 /* TEXT */ ) ], 2 /* CLASS */ ), vue.createElementVNode( "view", { class: vue.normalizeClass({ "uni-calendar-item--today": $props.weeks.isToday }) }, null, 2 /* CLASS */ ) ], 34 /* CLASS, HYDRATE_EVENTS */ ); } const calendarItem = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$c], ["__scopeId", "data-v-3c762a01"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue"]]); const isObject = (val) => val !== null && typeof val === "object"; const defaultDelimiters = ["{", "}"]; class BaseFormatter { constructor() { this._caches = /* @__PURE__ */ Object.create(null); } interpolate(message, values, delimiters = defaultDelimiters) { if (!values) { return [message]; } let tokens = this._caches[message]; if (!tokens) { tokens = parse(message, delimiters); this._caches[message] = tokens; } return compile(tokens, values); } } const RE_TOKEN_LIST_VALUE = /^(?:\d)+/; const RE_TOKEN_NAMED_VALUE = /^(?:\w)+/; function parse(format, [startDelimiter, endDelimiter]) { const tokens = []; let position = 0; let text = ""; while (position < format.length) { let char = format[position++]; if (char === startDelimiter) { if (text) { tokens.push({ type: "text", value: text }); } text = ""; let sub = ""; char = format[position++]; while (char !== void 0 && char !== endDelimiter) { sub += char; char = format[position++]; } const isClosed = char === endDelimiter; const type = RE_TOKEN_LIST_VALUE.test(sub) ? "list" : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? "named" : "unknown"; tokens.push({ value: sub, type }); } else { text += char; } } text && tokens.push({ type: "text", value: text }); return tokens; } function compile(tokens, values) { const compiled = []; let index = 0; const mode = Array.isArray(values) ? "list" : isObject(values) ? "named" : "unknown"; if (mode === "unknown") { return compiled; } while (index < tokens.length) { const token2 = tokens[index]; switch (token2.type) { case "text": compiled.push(token2.value); break; case "list": compiled.push(values[parseInt(token2.value, 10)]); break; case "named": if (mode === "named") { compiled.push(values[token2.value]); } else { { console.warn(`Type of token '${token2.type}' and format of value '${mode}' don't match!`); } } break; case "unknown": { console.warn(`Detect 'unknown' type of token!`); } break; } index++; } return compiled; } const LOCALE_ZH_HANS = "zh-Hans"; const LOCALE_ZH_HANT = "zh-Hant"; const LOCALE_EN = "en"; const LOCALE_FR = "fr"; const LOCALE_ES = "es"; const hasOwnProperty = Object.prototype.hasOwnProperty; const hasOwn = (val, key) => hasOwnProperty.call(val, key); const defaultFormatter = new BaseFormatter(); function include(str, parts) { return !!parts.find((part) => str.indexOf(part) !== -1); } function startsWith(str, parts) { return parts.find((part) => str.indexOf(part) === 0); } function normalizeLocale(locale, messages2) { if (!locale) { return; } locale = locale.trim().replace(/_/g, "-"); if (messages2 && messages2[locale]) { return locale; } locale = locale.toLowerCase(); if (locale === "chinese") { return LOCALE_ZH_HANS; } if (locale.indexOf("zh") === 0) { if (locale.indexOf("-hans") > -1) { return LOCALE_ZH_HANS; } if (locale.indexOf("-hant") > -1) { return LOCALE_ZH_HANT; } if (include(locale, ["-tw", "-hk", "-mo", "-cht"])) { return LOCALE_ZH_HANT; } return LOCALE_ZH_HANS; } let locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES]; if (messages2 && Object.keys(messages2).length > 0) { locales = Object.keys(messages2); } const lang = startsWith(locale, locales); if (lang) { return lang; } } class I18n { constructor({ locale, fallbackLocale, messages: messages2, watcher, formater }) { this.locale = LOCALE_EN; this.fallbackLocale = LOCALE_EN; this.message = {}; this.messages = {}; this.watchers = []; if (fallbackLocale) { this.fallbackLocale = fallbackLocale; } this.formater = formater || defaultFormatter; this.messages = messages2 || {}; this.setLocale(locale || LOCALE_EN); if (watcher) { this.watchLocale(watcher); } } setLocale(locale) { const oldLocale = this.locale; this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale; if (!this.messages[this.locale]) { this.messages[this.locale] = {}; } this.message = this.messages[this.locale]; if (oldLocale !== this.locale) { this.watchers.forEach((watcher) => { watcher(this.locale, oldLocale); }); } } getLocale() { return this.locale; } watchLocale(fn) { const index = this.watchers.push(fn) - 1; return () => { this.watchers.splice(index, 1); }; } add(locale, message, override = true) { const curMessages = this.messages[locale]; if (curMessages) { if (override) { Object.assign(curMessages, message); } else { Object.keys(message).forEach((key) => { if (!hasOwn(curMessages, key)) { curMessages[key] = message[key]; } }); } } else { this.messages[locale] = message; } } f(message, values, delimiters) { return this.formater.interpolate(message, values, delimiters).join(""); } t(key, locale, values) { let message = this.message; if (typeof locale === "string") { locale = normalizeLocale(locale, this.messages); locale && (message = this.messages[locale]); } else { values = locale; } if (!hasOwn(message, key)) { console.warn(`Cannot translate the value of keypath ${key}. Use the value of keypath as default.`); return key; } return this.formater.interpolate(message[key], values).join(""); } } function watchAppLocale(appVm, i18n) { if (appVm.$watchLocale) { appVm.$watchLocale((newLocale) => { i18n.setLocale(newLocale); }); } else { appVm.$watch(() => appVm.$locale, (newLocale) => { i18n.setLocale(newLocale); }); } } function getDefaultLocale() { if (typeof uni !== "undefined" && uni.getLocale) { return uni.getLocale(); } if (typeof global !== "undefined" && global.getLocale) { return global.getLocale(); } return LOCALE_EN; } function initVueI18n(locale, messages2 = {}, fallbackLocale, watcher) { if (typeof locale !== "string") { [locale, messages2] = [ messages2, locale ]; } if (typeof locale !== "string") { locale = getDefaultLocale(); } if (typeof fallbackLocale !== "string") { fallbackLocale = typeof __uniConfig !== "undefined" && __uniConfig.fallbackLocale || LOCALE_EN; } const i18n = new I18n({ locale, fallbackLocale, messages: messages2, watcher }); let t2 = (key, values) => { if (typeof getApp !== "function") { t2 = function(key2, values2) { return i18n.t(key2, values2); }; } else { let isWatchedAppLocale = false; t2 = function(key2, values2) { const appVm = getApp().$vm; if (appVm) { appVm.$locale; if (!isWatchedAppLocale) { isWatchedAppLocale = true; watchAppLocale(appVm, i18n); } } return i18n.t(key2, values2); }; } return t2(key, values); }; return { i18n, f(message, values, delimiters) { return i18n.f(message, values, delimiters); }, t(key, values) { return t2(key, values); }, add(locale2, message, override = true) { return i18n.add(locale2, message, override); }, watch(fn) { return i18n.watchLocale(fn); }, getLocale() { return i18n.getLocale(); }, setLocale(newLocale) { return i18n.setLocale(newLocale); } }; } const en$1 = { "uni-datetime-picker.selectDate": "select date", "uni-datetime-picker.selectTime": "select time", "uni-datetime-picker.selectDateTime": "select date and time", "uni-datetime-picker.startDate": "start date", "uni-datetime-picker.endDate": "end date", "uni-datetime-picker.startTime": "start time", "uni-datetime-picker.endTime": "end time", "uni-datetime-picker.ok": "ok", "uni-datetime-picker.clear": "clear", "uni-datetime-picker.cancel": "cancel", "uni-datetime-picker.year": "-", "uni-datetime-picker.month": "", "uni-calender.MON": "MON", "uni-calender.TUE": "TUE", "uni-calender.WED": "WED", "uni-calender.THU": "THU", "uni-calender.FRI": "FRI", "uni-calender.SAT": "SAT", "uni-calender.SUN": "SUN", "uni-calender.confirm": "confirm" }; const zhHans$1 = { "uni-datetime-picker.selectDate": "选择日期", "uni-datetime-picker.selectTime": "选择时间", "uni-datetime-picker.selectDateTime": "选择日期时间", "uni-datetime-picker.startDate": "开始时间", "uni-datetime-picker.endDate": "结束时间", "uni-datetime-picker.startTime": "开始时间", "uni-datetime-picker.endTime": "结束时间", "uni-datetime-picker.ok": "确定", "uni-datetime-picker.clear": "清除", "uni-datetime-picker.cancel": "取消", "uni-datetime-picker.year": "年", "uni-datetime-picker.month": "月", "uni-calender.SUN": "日", "uni-calender.MON": "一", "uni-calender.TUE": "二", "uni-calender.WED": "三", "uni-calender.THU": "四", "uni-calender.FRI": "五", "uni-calender.SAT": "六", "uni-calender.confirm": "确认" }; const zhHant$1 = { "uni-datetime-picker.selectDate": "選擇日期", "uni-datetime-picker.selectTime": "選擇時間", "uni-datetime-picker.selectDateTime": "選擇日期時間", "uni-datetime-picker.startDate": "開始日期", "uni-datetime-picker.endDate": "結束日期", "uni-datetime-picker.startTime": "開始时间", "uni-datetime-picker.endTime": "結束时间", "uni-datetime-picker.ok": "確定", "uni-datetime-picker.clear": "清除", "uni-datetime-picker.cancel": "取消", "uni-datetime-picker.year": "年", "uni-datetime-picker.month": "月", "uni-calender.SUN": "日", "uni-calender.MON": "一", "uni-calender.TUE": "二", "uni-calender.WED": "三", "uni-calender.THU": "四", "uni-calender.FRI": "五", "uni-calender.SAT": "六", "uni-calender.confirm": "確認" }; const i18nMessages = { en: en$1, "zh-Hans": zhHans$1, "zh-Hant": zhHant$1 }; const { t: t$4 } = initVueI18n(i18nMessages); const _sfc_main$j = { name: "UniDatetimePicker", data() { return { indicatorStyle: `height: 50px;`, visible: false, fixNvueBug: {}, dateShow: true, timeShow: true, title: "日期和时间", // 输入框当前时间 time: "", // 当前的年月日时分秒 year: 1920, month: 0, day: 0, hour: 0, minute: 0, second: 0, // 起始时间 startYear: 1920, startMonth: 1, startDay: 1, startHour: 0, startMinute: 0, startSecond: 0, // 结束时间 endYear: 2120, endMonth: 12, endDay: 31, endHour: 23, endMinute: 59, endSecond: 59 }; }, props: { type: { type: String, default: "datetime" }, value: { type: [String, Number], default: "" }, modelValue: { type: [String, Number], default: "" }, start: { type: [Number, String], default: "" }, end: { type: [Number, String], default: "" }, returnType: { type: String, default: "string" }, disabled: { type: [Boolean, String], default: false }, border: { type: [Boolean, String], default: true }, hideSecond: { type: [Boolean, String], default: false } }, watch: { modelValue: { handler(newVal) { if (newVal) { this.parseValue(fixIosDateFormat(newVal)); this.initTime(false); } else { this.time = ""; this.parseValue(Date.now()); } }, immediate: true }, type: { handler(newValue) { if (newValue === "date") { this.dateShow = true; this.timeShow = false; this.title = "日期"; } else if (newValue === "time") { this.dateShow = false; this.timeShow = true; this.title = "时间"; } else { this.dateShow = true; this.timeShow = true; this.title = "日期和时间"; } }, immediate: true }, start: { handler(newVal) { this.parseDatetimeRange(fixIosDateFormat(newVal), "start"); }, immediate: true }, end: { handler(newVal) { this.parseDatetimeRange(fixIosDateFormat(newVal), "end"); }, immediate: true }, // 月、日、时、分、秒可选范围变化后,检查当前值是否在范围内,不在则当前值重置为可选范围第一项 months(newVal) { this.checkValue("month", this.month, newVal); }, days(newVal) { this.checkValue("day", this.day, newVal); }, hours(newVal) { this.checkValue("hour", this.hour, newVal); }, minutes(newVal) { this.checkValue("minute", this.minute, newVal); }, seconds(newVal) { this.checkValue("second", this.second, newVal); } }, computed: { // 当前年、月、日、时、分、秒选择范围 years() { return this.getCurrentRange("year"); }, months() { return this.getCurrentRange("month"); }, days() { return this.getCurrentRange("day"); }, hours() { return this.getCurrentRange("hour"); }, minutes() { return this.getCurrentRange("minute"); }, seconds() { return this.getCurrentRange("second"); }, // picker 当前值数组 ymd() { return [this.year - this.minYear, this.month - this.minMonth, this.day - this.minDay]; }, hms() { return [this.hour - this.minHour, this.minute - this.minMinute, this.second - this.minSecond]; }, // 当前 date 是 start currentDateIsStart() { return this.year === this.startYear && this.month === this.startMonth && this.day === this.startDay; }, // 当前 date 是 end currentDateIsEnd() { return this.year === this.endYear && this.month === this.endMonth && this.day === this.endDay; }, // 当前年、月、日、时、分、秒的最小值和最大值 minYear() { return this.startYear; }, maxYear() { return this.endYear; }, minMonth() { if (this.year === this.startYear) { return this.startMonth; } else { return 1; } }, maxMonth() { if (this.year === this.endYear) { return this.endMonth; } else { return 12; } }, minDay() { if (this.year === this.startYear && this.month === this.startMonth) { return this.startDay; } else { return 1; } }, maxDay() { if (this.year === this.endYear && this.month === this.endMonth) { return this.endDay; } else { return this.daysInMonth(this.year, this.month); } }, minHour() { if (this.type === "datetime") { if (this.currentDateIsStart) { return this.startHour; } else { return 0; } } if (this.type === "time") { return this.startHour; } }, maxHour() { if (this.type === "datetime") { if (this.currentDateIsEnd) { return this.endHour; } else { return 23; } } if (this.type === "time") { return this.endHour; } }, minMinute() { if (this.type === "datetime") { if (this.currentDateIsStart && this.hour === this.startHour) { return this.startMinute; } else { return 0; } } if (this.type === "time") { if (this.hour === this.startHour) { return this.startMinute; } else { return 0; } } }, maxMinute() { if (this.type === "datetime") { if (this.currentDateIsEnd && this.hour === this.endHour) { return this.endMinute; } else { return 59; } } if (this.type === "time") { if (this.hour === this.endHour) { return this.endMinute; } else { return 59; } } }, minSecond() { if (this.type === "datetime") { if (this.currentDateIsStart && this.hour === this.startHour && this.minute === this.startMinute) { return this.startSecond; } else { return 0; } } if (this.type === "time") { if (this.hour === this.startHour && this.minute === this.startMinute) { return this.startSecond; } else { return 0; } } }, maxSecond() { if (this.type === "datetime") { if (this.currentDateIsEnd && this.hour === this.endHour && this.minute === this.endMinute) { return this.endSecond; } else { return 59; } } if (this.type === "time") { if (this.hour === this.endHour && this.minute === this.endMinute) { return this.endSecond; } else { return 59; } } }, /** * for i18n */ selectTimeText() { return t$4("uni-datetime-picker.selectTime"); }, okText() { return t$4("uni-datetime-picker.ok"); }, clearText() { return t$4("uni-datetime-picker.clear"); }, cancelText() { return t$4("uni-datetime-picker.cancel"); } }, mounted() { }, methods: { /** * @param {Object} item * 小于 10 在前面加个 0 */ lessThanTen(item) { return item < 10 ? "0" + item : item; }, /** * 解析时分秒字符串,例如:00:00:00 * @param {String} timeString */ parseTimeType(timeString) { if (timeString) { let timeArr = timeString.split(":"); this.hour = Number(timeArr[0]); this.minute = Number(timeArr[1]); this.second = Number(timeArr[2]); } }, /** * 解析选择器初始值,类型可以是字符串、时间戳,例如:2000-10-02、'08:30:00'、 1610695109000 * @param {String | Number} datetime */ initPickerValue(datetime) { let defaultValue = null; if (datetime) { defaultValue = this.compareValueWithStartAndEnd(datetime, this.start, this.end); } else { defaultValue = Date.now(); defaultValue = this.compareValueWithStartAndEnd(defaultValue, this.start, this.end); } this.parseValue(defaultValue); }, /** * 初始值规则: * - 用户设置初始值 value * - 设置了起始时间 start、终止时间 end,并 start < value < end,初始值为 value, 否则初始值为 start * - 只设置了起始时间 start,并 start < value,初始值为 value,否则初始值为 start * - 只设置了终止时间 end,并 value < end,初始值为 value,否则初始值为 end * - 无起始终止时间,则初始值为 value * - 无初始值 value,则初始值为当前本地时间 Date.now() * @param {Object} value * @param {Object} dateBase */ compareValueWithStartAndEnd(value, start, end) { let winner = null; value = this.superTimeStamp(value); start = this.superTimeStamp(start); end = this.superTimeStamp(end); if (start && end) { if (value < start) { winner = new Date(start); } else if (value > end) { winner = new Date(end); } else { winner = new Date(value); } } else if (start && !end) { winner = start <= value ? new Date(value) : new Date(start); } else if (!start && end) { winner = value <= end ? new Date(value) : new Date(end); } else { winner = new Date(value); } return winner; }, /** * 转换为可比较的时间戳,接受日期、时分秒、时间戳 * @param {Object} value */ superTimeStamp(value) { let dateBase = ""; if (this.type === "time" && value && typeof value === "string") { const now = /* @__PURE__ */ new Date(); const year = now.getFullYear(); const month = now.getMonth() + 1; const day = now.getDate(); dateBase = year + "/" + month + "/" + day + " "; } if (Number(value)) { value = parseInt(value); dateBase = 0; } return this.createTimeStamp(dateBase + value); }, /** * 解析默认值 value,字符串、时间戳 * @param {Object} defaultTime */ parseValue(value) { if (!value) { return; } if (this.type === "time" && typeof value === "string") { this.parseTimeType(value); } else { let defaultDate = null; defaultDate = new Date(value); if (this.type !== "time") { this.year = defaultDate.getFullYear(); this.month = defaultDate.getMonth() + 1; this.day = defaultDate.getDate(); } if (this.type !== "date") { this.hour = defaultDate.getHours(); this.minute = defaultDate.getMinutes(); this.second = defaultDate.getSeconds(); } } if (this.hideSecond) { this.second = 0; } }, /** * 解析可选择时间范围 start、end,年月日字符串、时间戳 * @param {Object} defaultTime */ parseDatetimeRange(point, pointType) { if (!point) { if (pointType === "start") { this.startYear = 1920; this.startMonth = 1; this.startDay = 1; this.startHour = 0; this.startMinute = 0; this.startSecond = 0; } if (pointType === "end") { this.endYear = 2120; this.endMonth = 12; this.endDay = 31; this.endHour = 23; this.endMinute = 59; this.endSecond = 59; } return; } if (this.type === "time") { const pointArr = point.split(":"); this[pointType + "Hour"] = Number(pointArr[0]); this[pointType + "Minute"] = Number(pointArr[1]); this[pointType + "Second"] = Number(pointArr[2]); } else { if (!point) { pointType === "start" ? this.startYear = this.year - 60 : this.endYear = this.year + 60; return; } if (Number(point)) { point = parseInt(point); } const hasTime = /[0-9]:[0-9]/; if (this.type === "datetime" && pointType === "end" && typeof point === "string" && !hasTime.test( point )) { point = point + " 23:59:59"; } const pointDate = new Date(point); this[pointType + "Year"] = pointDate.getFullYear(); this[pointType + "Month"] = pointDate.getMonth() + 1; this[pointType + "Day"] = pointDate.getDate(); if (this.type === "datetime") { this[pointType + "Hour"] = pointDate.getHours(); this[pointType + "Minute"] = pointDate.getMinutes(); this[pointType + "Second"] = pointDate.getSeconds(); } } }, // 获取 年、月、日、时、分、秒 当前可选范围 getCurrentRange(value) { const range = []; for (let i2 = this["min" + this.capitalize(value)]; i2 <= this["max" + this.capitalize(value)]; i2++) { range.push(i2); } return range; }, // 字符串首字母大写 capitalize(str) { return str.charAt(0).toUpperCase() + str.slice(1); }, // 检查当前值是否在范围内,不在则当前值重置为可选范围第一项 checkValue(name, value, values) { if (values.indexOf(value) === -1) { this[name] = values[0]; } }, // 每个月的实际天数 daysInMonth(year, month) { return new Date(year, month, 0).getDate(); }, //兼容 iOS、safari 日期格式 fixIosDateFormat(value) { if (typeof value === "string") { value = value.replace(/-/g, "/"); } return value; }, /** * 生成时间戳 * @param {Object} time */ createTimeStamp(time) { if (!time) return; if (typeof time === "number") { return time; } else { time = time.replace(/-/g, "/"); if (this.type === "date") { time = time + " 00:00:00"; } return Date.parse(time); } }, /** * 生成日期或时间的字符串 */ createDomSting() { const yymmdd = this.year + "-" + this.lessThanTen(this.month) + "-" + this.lessThanTen(this.day); let hhmmss = this.lessThanTen(this.hour) + ":" + this.lessThanTen(this.minute); if (!this.hideSecond) { hhmmss = hhmmss + ":" + this.lessThanTen(this.second); } if (this.type === "date") { return yymmdd; } else if (this.type === "time") { return hhmmss; } else { return yymmdd + " " + hhmmss; } }, /** * 初始化返回值,并抛出 change 事件 */ initTime(emit = true) { this.time = this.createDomSting(); if (!emit) return; if (this.returnType === "timestamp" && this.type !== "time") { this.$emit("change", this.createTimeStamp(this.time)); this.$emit("input", this.createTimeStamp(this.time)); this.$emit("update:modelValue", this.createTimeStamp(this.time)); } else { this.$emit("change", this.time); this.$emit("input", this.time); this.$emit("update:modelValue", this.time); } }, /** * 用户选择日期或时间更新 data * @param {Object} e */ bindDateChange(e2) { const val = e2.detail.value; this.year = this.years[val[0]]; this.month = this.months[val[1]]; this.day = this.days[val[2]]; }, bindTimeChange(e2) { const val = e2.detail.value; this.hour = this.hours[val[0]]; this.minute = this.minutes[val[1]]; this.second = this.seconds[val[2]]; }, /** * 初始化弹出层 */ initTimePicker() { if (this.disabled) return; const value = fixIosDateFormat(this.time); this.initPickerValue(value); this.visible = !this.visible; }, /** * 触发或关闭弹框 */ tiggerTimePicker(e2) { this.visible = !this.visible; }, /** * 用户点击“清空”按钮,清空当前值 */ clearTime() { this.time = ""; this.$emit("change", this.time); this.$emit("input", this.time); this.$emit("update:modelValue", this.time); this.tiggerTimePicker(); }, /** * 用户点击“确定”按钮 */ setTime() { this.initTime(); this.tiggerTimePicker(); } } }; function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock("view", { class: "uni-datetime-picker" }, [ vue.createElementVNode("view", { onClick: _cache[0] || (_cache[0] = (...args) => $options.initTimePicker && $options.initTimePicker(...args)) }, [ vue.renderSlot(_ctx.$slots, "default", {}, () => [ vue.createElementVNode( "view", { class: vue.normalizeClass(["uni-datetime-picker-timebox-pointer", { "uni-datetime-picker-disabled": $props.disabled, "uni-datetime-picker-timebox": $props.border }]) }, [ vue.createElementVNode( "text", { class: "uni-datetime-picker-text" }, vue.toDisplayString($data.time), 1 /* TEXT */ ), !$data.time ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "uni-datetime-picker-time" }, [ vue.createElementVNode( "text", { class: "uni-datetime-picker-text" }, vue.toDisplayString($options.selectTimeText), 1 /* TEXT */ ) ])) : vue.createCommentVNode("v-if", true) ], 2 /* CLASS */ ) ], true) ]), $data.visible ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, id: "mask", class: "uni-datetime-picker-mask", onClick: _cache[1] || (_cache[1] = (...args) => $options.tiggerTimePicker && $options.tiggerTimePicker(...args)) })) : vue.createCommentVNode("v-if", true), $data.visible ? (vue.openBlock(), vue.createElementBlock( "view", { key: 1, class: vue.normalizeClass(["uni-datetime-picker-popup", [$data.dateShow && $data.timeShow ? "" : "fix-nvue-height"]]), style: vue.normalizeStyle($data.fixNvueBug) }, [ vue.createElementVNode("view", { class: "uni-title" }, [ vue.createElementVNode( "text", { class: "uni-datetime-picker-text" }, vue.toDisplayString($options.selectTimeText), 1 /* TEXT */ ) ]), $data.dateShow ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "uni-datetime-picker__container-box" }, [ vue.createElementVNode("picker-view", { class: "uni-datetime-picker-view", "indicator-style": $data.indicatorStyle, value: $options.ymd, onChange: _cache[2] || (_cache[2] = (...args) => $options.bindDateChange && $options.bindDateChange(...args)) }, [ vue.createElementVNode("picker-view-column", null, [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList($options.years, (item, index) => { return vue.openBlock(), vue.createElementBlock("view", { class: "uni-datetime-picker-item", key: index }, [ vue.createElementVNode( "text", { class: "uni-datetime-picker-item" }, vue.toDisplayString($options.lessThanTen(item)), 1 /* TEXT */ ) ]); }), 128 /* KEYED_FRAGMENT */ )) ]), vue.createElementVNode("picker-view-column", null, [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList($options.months, (item, index) => { return vue.openBlock(), vue.createElementBlock("view", { class: "uni-datetime-picker-item", key: index }, [ vue.createElementVNode( "text", { class: "uni-datetime-picker-item" }, vue.toDisplayString($options.lessThanTen(item)), 1 /* TEXT */ ) ]); }), 128 /* KEYED_FRAGMENT */ )) ]), vue.createElementVNode("picker-view-column", null, [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList($options.days, (item, index) => { return vue.openBlock(), vue.createElementBlock("view", { class: "uni-datetime-picker-item", key: index }, [ vue.createElementVNode( "text", { class: "uni-datetime-picker-item" }, vue.toDisplayString($options.lessThanTen(item)), 1 /* TEXT */ ) ]); }), 128 /* KEYED_FRAGMENT */ )) ]) ], 40, ["indicator-style", "value"]), vue.createCommentVNode(" 兼容 nvue 不支持伪类 "), vue.createElementVNode("text", { class: "uni-datetime-picker-sign sign-left" }, "-"), vue.createElementVNode("text", { class: "uni-datetime-picker-sign sign-right" }, "-") ])) : vue.createCommentVNode("v-if", true), $data.timeShow ? (vue.openBlock(), vue.createElementBlock("view", { key: 1, class: "uni-datetime-picker__container-box" }, [ vue.createElementVNode("picker-view", { class: vue.normalizeClass(["uni-datetime-picker-view", [$props.hideSecond ? "time-hide-second" : ""]]), "indicator-style": $data.indicatorStyle, value: $options.hms, onChange: _cache[3] || (_cache[3] = (...args) => $options.bindTimeChange && $options.bindTimeChange(...args)) }, [ vue.createElementVNode("picker-view-column", null, [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList($options.hours, (item, index) => { return vue.openBlock(), vue.createElementBlock("view", { class: "uni-datetime-picker-item", key: index }, [ vue.createElementVNode( "text", { class: "uni-datetime-picker-item" }, vue.toDisplayString($options.lessThanTen(item)), 1 /* TEXT */ ) ]); }), 128 /* KEYED_FRAGMENT */ )) ]), vue.createElementVNode("picker-view-column", null, [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList($options.minutes, (item, index) => { return vue.openBlock(), vue.createElementBlock("view", { class: "uni-datetime-picker-item", key: index }, [ vue.createElementVNode( "text", { class: "uni-datetime-picker-item" }, vue.toDisplayString($options.lessThanTen(item)), 1 /* TEXT */ ) ]); }), 128 /* KEYED_FRAGMENT */ )) ]), !$props.hideSecond ? (vue.openBlock(), vue.createElementBlock("picker-view-column", { key: 0 }, [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList($options.seconds, (item, index) => { return vue.openBlock(), vue.createElementBlock("view", { class: "uni-datetime-picker-item", key: index }, [ vue.createElementVNode( "text", { class: "uni-datetime-picker-item" }, vue.toDisplayString($options.lessThanTen(item)), 1 /* TEXT */ ) ]); }), 128 /* KEYED_FRAGMENT */ )) ])) : vue.createCommentVNode("v-if", true) ], 42, ["indicator-style", "value"]), vue.createCommentVNode(" 兼容 nvue 不支持伪类 "), vue.createElementVNode( "text", { class: vue.normalizeClass(["uni-datetime-picker-sign", [$props.hideSecond ? "sign-center" : "sign-left"]]) }, ":", 2 /* CLASS */ ), !$props.hideSecond ? (vue.openBlock(), vue.createElementBlock("text", { key: 0, class: "uni-datetime-picker-sign sign-right" }, ":")) : vue.createCommentVNode("v-if", true) ])) : vue.createCommentVNode("v-if", true), vue.createElementVNode("view", { class: "uni-datetime-picker-btn" }, [ vue.createElementVNode("view", { onClick: _cache[4] || (_cache[4] = (...args) => $options.clearTime && $options.clearTime(...args)) }, [ vue.createElementVNode( "text", { class: "uni-datetime-picker-btn-text" }, vue.toDisplayString($options.clearText), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "uni-datetime-picker-btn-group" }, [ vue.createElementVNode("view", { class: "uni-datetime-picker-cancel", onClick: _cache[5] || (_cache[5] = (...args) => $options.tiggerTimePicker && $options.tiggerTimePicker(...args)) }, [ vue.createElementVNode( "text", { class: "uni-datetime-picker-btn-text" }, vue.toDisplayString($options.cancelText), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { onClick: _cache[6] || (_cache[6] = (...args) => $options.setTime && $options.setTime(...args)) }, [ vue.createElementVNode( "text", { class: "uni-datetime-picker-btn-text" }, vue.toDisplayString($options.okText), 1 /* TEXT */ ) ]) ]) ]) ], 6 /* CLASS, STYLE */ )) : vue.createCommentVNode("v-if", true) ]); } const TimePicker = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$b], ["__scopeId", "data-v-1d532b70"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue"]]); const { t: t$3 } = initVueI18n(i18nMessages); const _sfc_main$i = { components: { calendarItem, timePicker: TimePicker }, props: { date: { type: String, default: "" }, defTime: { type: [String, Object], default: "" }, selectableTimes: { type: [Object], default() { return {}; } }, selected: { type: Array, default() { return []; } }, startDate: { type: String, default: "" }, endDate: { type: String, default: "" }, startPlaceholder: { type: String, default: "" }, endPlaceholder: { type: String, default: "" }, range: { type: Boolean, default: false }, hasTime: { type: Boolean, default: false }, insert: { type: Boolean, default: true }, showMonth: { type: Boolean, default: true }, clearDate: { type: Boolean, default: true }, checkHover: { type: Boolean, default: true }, hideSecond: { type: [Boolean], default: false }, pleStatus: { type: Object, default() { return { before: "", after: "", data: [], fulldate: "" }; } }, defaultValue: { type: [String, Object, Array], default: "" } }, data() { return { show: false, weeks: [], calendar: {}, nowDate: {}, aniMaskShow: false, firstEnter: true, time: "", timeRange: { startTime: "", endTime: "" }, tempSingleDate: "", tempRange: { before: "", after: "" } }; }, watch: { date: { immediate: true, handler(newVal) { if (!this.range) { this.tempSingleDate = newVal; setTimeout(() => { this.init(newVal); }, 100); } } }, defTime: { immediate: true, handler(newVal) { if (!this.range) { this.time = newVal; } else { this.timeRange.startTime = newVal.start; this.timeRange.endTime = newVal.end; } } }, startDate(val) { if (!this.cale) { return; } this.cale.setStartDate(val); this.cale.setDate(this.nowDate.fullDate); this.weeks = this.cale.weeks; }, endDate(val) { if (!this.cale) { return; } this.cale.setEndDate(val); this.cale.setDate(this.nowDate.fullDate); this.weeks = this.cale.weeks; }, selected(newVal) { if (!this.cale) { return; } this.cale.setSelectInfo(this.nowDate.fullDate, newVal); this.weeks = this.cale.weeks; }, pleStatus: { immediate: true, handler(newVal) { const { before, after, fulldate, which } = newVal; this.tempRange.before = before; this.tempRange.after = after; setTimeout(() => { if (fulldate) { this.cale.setHoverMultiple(fulldate); if (before && after) { this.cale.lastHover = true; if (this.rangeWithinMonth(after, before)) return; this.setDate(before); } else { this.cale.setMultiple(fulldate); this.setDate(this.nowDate.fullDate); this.calendar.fullDate = ""; this.cale.lastHover = false; } } else { if (!this.cale) { return; } this.cale.setDefaultMultiple(before, after); if (which === "left" && before) { this.setDate(before); this.weeks = this.cale.weeks; } else if (after) { this.setDate(after); this.weeks = this.cale.weeks; } this.cale.lastHover = true; } }, 16); } } }, computed: { timepickerStartTime() { const activeDate = this.range ? this.tempRange.before : this.calendar.fullDate; return activeDate === this.startDate ? this.selectableTimes.start : ""; }, timepickerEndTime() { const activeDate = this.range ? this.tempRange.after : this.calendar.fullDate; return activeDate === this.endDate ? this.selectableTimes.end : ""; }, /** * for i18n */ selectDateText() { return t$3("uni-datetime-picker.selectDate"); }, startDateText() { return this.startPlaceholder || t$3("uni-datetime-picker.startDate"); }, endDateText() { return this.endPlaceholder || t$3("uni-datetime-picker.endDate"); }, okText() { return t$3("uni-datetime-picker.ok"); }, yearText() { return t$3("uni-datetime-picker.year"); }, monthText() { return t$3("uni-datetime-picker.month"); }, MONText() { return t$3("uni-calender.MON"); }, TUEText() { return t$3("uni-calender.TUE"); }, WEDText() { return t$3("uni-calender.WED"); }, THUText() { return t$3("uni-calender.THU"); }, FRIText() { return t$3("uni-calender.FRI"); }, SATText() { return t$3("uni-calender.SAT"); }, SUNText() { return t$3("uni-calender.SUN"); }, confirmText() { return t$3("uni-calender.confirm"); } }, created() { this.cale = new Calendar$1({ selected: this.selected, startDate: this.startDate, endDate: this.endDate, range: this.range }); this.init(this.date); }, methods: { leaveCale() { this.firstEnter = true; }, handleMouse(weeks) { if (weeks.disable) return; if (this.cale.lastHover) return; let { before, after } = this.cale.multipleStatus; if (!before) return; this.calendar = weeks; this.cale.setHoverMultiple(this.calendar.fullDate); this.weeks = this.cale.weeks; if (this.firstEnter) { this.$emit("firstEnterCale", this.cale.multipleStatus); this.firstEnter = false; } }, rangeWithinMonth(A2, B2) { const [yearA, monthA] = A2.split("-"); const [yearB, monthB] = B2.split("-"); return yearA === yearB && monthA === monthB; }, // 蒙版点击事件 maskClick() { this.close(); this.$emit("maskClose"); }, clearCalender() { if (this.range) { this.timeRange.startTime = ""; this.timeRange.endTime = ""; this.tempRange.before = ""; this.tempRange.after = ""; this.cale.multipleStatus.before = ""; this.cale.multipleStatus.after = ""; this.cale.multipleStatus.data = []; this.cale.lastHover = false; } else { this.time = ""; this.tempSingleDate = ""; } this.calendar.fullDate = ""; this.setDate(/* @__PURE__ */ new Date()); }, bindDateChange(e2) { const value = e2.detail.value + "-1"; this.setDate(value); }, /** * 初始化日期显示 * @param {Object} date */ init(date) { if (!this.cale) { return; } this.cale.setDate(date || /* @__PURE__ */ new Date()); this.weeks = this.cale.weeks; this.nowDate = this.cale.getInfo(date); this.calendar = { ...this.nowDate }; if (!date) { this.calendar.fullDate = ""; if (this.defaultValue && !this.range) { const defaultDate = new Date(this.defaultValue); const fullDate = getDate(defaultDate); const year = defaultDate.getFullYear(); const month = defaultDate.getMonth() + 1; const date2 = defaultDate.getDate(); const day = defaultDate.getDay(); this.calendar = { fullDate, year, month, date: date2, day }, this.tempSingleDate = fullDate; this.time = getTime(defaultDate, this.hideSecond); } } }, /** * 打开日历弹窗 */ open() { if (this.clearDate && !this.insert) { this.cale.cleanMultipleStatus(); this.init(this.date); } this.show = true; this.$nextTick(() => { setTimeout(() => { this.aniMaskShow = true; }, 50); }); }, /** * 关闭日历弹窗 */ close() { this.aniMaskShow = false; this.$nextTick(() => { setTimeout(() => { this.show = false; this.$emit("close"); }, 300); }); }, /** * 确认按钮 */ confirm() { this.setEmit("confirm"); this.close(); }, /** * 变化触发 */ change() { if (!this.insert) return; this.setEmit("change"); }, /** * 选择月份触发 */ monthSwitch() { let { year, month } = this.nowDate; this.$emit("monthSwitch", { year, month: Number(month) }); }, /** * 派发事件 * @param {Object} name */ setEmit(name) { if (!this.range) { if (!this.calendar.fullDate) { this.calendar = this.cale.getInfo(/* @__PURE__ */ new Date()); this.tempSingleDate = this.calendar.fullDate; } if (this.hasTime && !this.time) { this.time = getTime(/* @__PURE__ */ new Date(), this.hideSecond); } } let { year, month, date, fullDate, extraInfo } = this.calendar; this.$emit(name, { range: this.cale.multipleStatus, year, month, date, time: this.time, timeRange: this.timeRange, fulldate: fullDate, extraInfo: extraInfo || {} }); }, /** * 选择天触发 * @param {Object} weeks */ choiceDate(weeks) { if (weeks.disable) return; this.calendar = weeks; this.calendar.userChecked = true; this.cale.setMultiple(this.calendar.fullDate, true); this.weeks = this.cale.weeks; this.tempSingleDate = this.calendar.fullDate; const beforeDate = new Date(this.cale.multipleStatus.before).getTime(); const afterDate = new Date(this.cale.multipleStatus.after).getTime(); if (beforeDate > afterDate && afterDate) { this.tempRange.before = this.cale.multipleStatus.after; this.tempRange.after = this.cale.multipleStatus.before; } else { this.tempRange.before = this.cale.multipleStatus.before; this.tempRange.after = this.cale.multipleStatus.after; } this.change(); }, changeMonth(type) { let newDate; if (type === "pre") { newDate = this.cale.getPreMonthObj(this.nowDate.fullDate).fullDate; } else if (type === "next") { newDate = this.cale.getNextMonthObj(this.nowDate.fullDate).fullDate; } this.setDate(newDate); this.monthSwitch(); }, /** * 设置日期 * @param {Object} date */ setDate(date) { this.cale.setDate(date); this.weeks = this.cale.weeks; this.nowDate = this.cale.getInfo(date); } } }; function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) { const _component_calendar_item = vue.resolveComponent("calendar-item"); const _component_time_picker = vue.resolveComponent("time-picker"); const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_0$3); return vue.openBlock(), vue.createElementBlock( "view", { class: "uni-calendar", onMouseleave: _cache[9] || (_cache[9] = (...args) => $options.leaveCale && $options.leaveCale(...args)) }, [ !$props.insert && $data.show ? (vue.openBlock(), vue.createElementBlock( "view", { key: 0, class: vue.normalizeClass(["uni-calendar__mask", { "uni-calendar--mask-show": $data.aniMaskShow }]), onClick: _cache[0] || (_cache[0] = (...args) => $options.maskClick && $options.maskClick(...args)) }, null, 2 /* CLASS */ )) : vue.createCommentVNode("v-if", true), $props.insert || $data.show ? (vue.openBlock(), vue.createElementBlock( "view", { key: 1, class: vue.normalizeClass(["uni-calendar__content", { "uni-calendar--fixed": !$props.insert, "uni-calendar--ani-show": $data.aniMaskShow, "uni-calendar__content-mobile": $data.aniMaskShow }]) }, [ vue.createElementVNode( "view", { class: vue.normalizeClass(["uni-calendar__header", { "uni-calendar__header-mobile": !$props.insert }]) }, [ vue.createElementVNode("view", { class: "uni-calendar__header-btn-box", onClick: _cache[1] || (_cache[1] = vue.withModifiers(($event) => $options.changeMonth("pre"), ["stop"])) }, [ vue.createElementVNode("view", { class: "uni-calendar__header-btn uni-calendar--left" }) ]), vue.createElementVNode("picker", { mode: "date", value: $props.date, fields: "month", onChange: _cache[2] || (_cache[2] = (...args) => $options.bindDateChange && $options.bindDateChange(...args)) }, [ vue.createElementVNode( "text", { class: "uni-calendar__header-text" }, vue.toDisplayString(($data.nowDate.year || "") + $options.yearText + ($data.nowDate.month || "") + $options.monthText), 1 /* TEXT */ ) ], 40, ["value"]), vue.createElementVNode("view", { class: "uni-calendar__header-btn-box", onClick: _cache[3] || (_cache[3] = vue.withModifiers(($event) => $options.changeMonth("next"), ["stop"])) }, [ vue.createElementVNode("view", { class: "uni-calendar__header-btn uni-calendar--right" }) ]), !$props.insert ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "dialog-close", onClick: _cache[4] || (_cache[4] = (...args) => $options.close && $options.close(...args)) }, [ vue.createElementVNode("view", { class: "dialog-close-plus", "data-id": "close" }), vue.createElementVNode("view", { class: "dialog-close-plus dialog-close-rotate", "data-id": "close" }) ])) : vue.createCommentVNode("v-if", true) ], 2 /* CLASS */ ), vue.createElementVNode("view", { class: "uni-calendar__box" }, [ $props.showMonth ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "uni-calendar__box-bg" }, [ vue.createElementVNode( "text", { class: "uni-calendar__box-bg-text" }, vue.toDisplayString($data.nowDate.month), 1 /* TEXT */ ) ])) : vue.createCommentVNode("v-if", true), vue.createElementVNode("view", { class: "uni-calendar__weeks", style: { "padding-bottom": "7px" } }, [ vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [ vue.createElementVNode( "text", { class: "uni-calendar__weeks-day-text" }, vue.toDisplayString($options.SUNText), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [ vue.createElementVNode( "text", { class: "uni-calendar__weeks-day-text" }, vue.toDisplayString($options.MONText), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [ vue.createElementVNode( "text", { class: "uni-calendar__weeks-day-text" }, vue.toDisplayString($options.TUEText), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [ vue.createElementVNode( "text", { class: "uni-calendar__weeks-day-text" }, vue.toDisplayString($options.WEDText), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [ vue.createElementVNode( "text", { class: "uni-calendar__weeks-day-text" }, vue.toDisplayString($options.THUText), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [ vue.createElementVNode( "text", { class: "uni-calendar__weeks-day-text" }, vue.toDisplayString($options.FRIText), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [ vue.createElementVNode( "text", { class: "uni-calendar__weeks-day-text" }, vue.toDisplayString($options.SATText), 1 /* TEXT */ ) ]) ]), (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList($data.weeks, (item, weekIndex) => { return vue.openBlock(), vue.createElementBlock("view", { class: "uni-calendar__weeks", key: weekIndex }, [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList(item, (weeks, weeksIndex) => { return vue.openBlock(), vue.createElementBlock("view", { class: "uni-calendar__weeks-item", key: weeksIndex }, [ vue.createVNode(_component_calendar_item, { class: "uni-calendar-item--hook", weeks, calendar: $data.calendar, selected: $props.selected, checkHover: $props.range, onChange: $options.choiceDate, onHandleMouse: $options.handleMouse }, null, 8, ["weeks", "calendar", "selected", "checkHover", "onChange", "onHandleMouse"]) ]); }), 128 /* KEYED_FRAGMENT */ )) ]); }), 128 /* KEYED_FRAGMENT */ )) ]), !$props.insert && !$props.range && $props.hasTime ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "uni-date-changed uni-calendar--fixed-top", style: { "padding": "0 80px" } }, [ vue.createElementVNode( "view", { class: "uni-date-changed--time-date" }, vue.toDisplayString($data.tempSingleDate ? $data.tempSingleDate : $options.selectDateText), 1 /* TEXT */ ), vue.createVNode(_component_time_picker, { type: "time", start: $options.timepickerStartTime, end: $options.timepickerEndTime, modelValue: $data.time, "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => $data.time = $event), disabled: !$data.tempSingleDate, border: false, "hide-second": $props.hideSecond, class: "time-picker-style" }, null, 8, ["start", "end", "modelValue", "disabled", "hide-second"]) ])) : vue.createCommentVNode("v-if", true), !$props.insert && $props.range && $props.hasTime ? (vue.openBlock(), vue.createElementBlock("view", { key: 1, class: "uni-date-changed uni-calendar--fixed-top" }, [ vue.createElementVNode("view", { class: "uni-date-changed--time-start" }, [ vue.createElementVNode( "view", { class: "uni-date-changed--time-date" }, vue.toDisplayString($data.tempRange.before ? $data.tempRange.before : $options.startDateText), 1 /* TEXT */ ), vue.createVNode(_component_time_picker, { type: "time", start: $options.timepickerStartTime, modelValue: $data.timeRange.startTime, "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => $data.timeRange.startTime = $event), border: false, "hide-second": $props.hideSecond, disabled: !$data.tempRange.before, class: "time-picker-style" }, null, 8, ["start", "modelValue", "hide-second", "disabled"]) ]), vue.createElementVNode("view", { style: { "line-height": "50px" } }, [ vue.createVNode(_component_uni_icons, { type: "arrowthinright", color: "#999" }) ]), vue.createElementVNode("view", { class: "uni-date-changed--time-end" }, [ vue.createElementVNode( "view", { class: "uni-date-changed--time-date" }, vue.toDisplayString($data.tempRange.after ? $data.tempRange.after : $options.endDateText), 1 /* TEXT */ ), vue.createVNode(_component_time_picker, { type: "time", end: $options.timepickerEndTime, modelValue: $data.timeRange.endTime, "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => $data.timeRange.endTime = $event), border: false, "hide-second": $props.hideSecond, disabled: !$data.tempRange.after, class: "time-picker-style" }, null, 8, ["end", "modelValue", "hide-second", "disabled"]) ]) ])) : vue.createCommentVNode("v-if", true), !$props.insert ? (vue.openBlock(), vue.createElementBlock("view", { key: 2, class: "uni-date-changed uni-date-btn--ok" }, [ vue.createElementVNode( "view", { class: "uni-datetime-picker--btn", onClick: _cache[8] || (_cache[8] = (...args) => $options.confirm && $options.confirm(...args)) }, vue.toDisplayString($options.confirmText), 1 /* TEXT */ ) ])) : vue.createCommentVNode("v-if", true) ], 2 /* CLASS */ )) : vue.createCommentVNode("v-if", true) ], 32 /* HYDRATE_EVENTS */ ); } const Calendar = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$a], ["__scopeId", "data-v-1d379219"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue"]]); const _sfc_main$h = { name: "UniDatetimePicker", options: { virtualHost: true }, components: { Calendar, TimePicker }, data() { return { isRange: false, hasTime: false, displayValue: "", inputDate: "", calendarDate: "", pickerTime: "", calendarRange: { startDate: "", startTime: "", endDate: "", endTime: "" }, displayRangeValue: { startDate: "", endDate: "" }, tempRange: { startDate: "", startTime: "", endDate: "", endTime: "" }, // 左右日历同步数据 startMultipleStatus: { before: "", after: "", data: [], fulldate: "" }, endMultipleStatus: { before: "", after: "", data: [], fulldate: "" }, pickerVisible: false, pickerPositionStyle: null, isEmitValue: false, isPhone: false, isFirstShow: true, i18nT: () => { } }; }, props: { type: { type: String, default: "datetime" }, value: { type: [String, Number, Array, Date], default: "" }, modelValue: { type: [String, Number, Array, Date], default: "" }, start: { type: [Number, String], default: "" }, end: { type: [Number, String], default: "" }, returnType: { type: String, default: "string" }, placeholder: { type: String, default: "" }, startPlaceholder: { type: String, default: "" }, endPlaceholder: { type: String, default: "" }, rangeSeparator: { type: String, default: "-" }, border: { type: [Boolean], default: true }, disabled: { type: [Boolean], default: false }, clearIcon: { type: [Boolean], default: true }, hideSecond: { type: [Boolean], default: false }, defaultValue: { type: [String, Object, Array], default: "" } }, watch: { type: { immediate: true, handler(newVal) { this.hasTime = newVal.indexOf("time") !== -1; this.isRange = newVal.indexOf("range") !== -1; } }, modelValue: { immediate: true, handler(newVal) { if (this.isEmitValue) { this.isEmitValue = false; return; } this.initPicker(newVal); } }, start: { immediate: true, handler(newVal) { if (!newVal) return; this.calendarRange.startDate = getDate(newVal); if (this.hasTime) { this.calendarRange.startTime = getTime(newVal); } } }, end: { immediate: true, handler(newVal) { if (!newVal) return; this.calendarRange.endDate = getDate(newVal); if (this.hasTime) { this.calendarRange.endTime = getTime(newVal, this.hideSecond); } } } }, computed: { timepickerStartTime() { const activeDate = this.isRange ? this.tempRange.startDate : this.inputDate; return activeDate === this.calendarRange.startDate ? this.calendarRange.startTime : ""; }, timepickerEndTime() { const activeDate = this.isRange ? this.tempRange.endDate : this.inputDate; return activeDate === this.calendarRange.endDate ? this.calendarRange.endTime : ""; }, mobileCalendarTime() { const timeRange = { start: this.tempRange.startTime, end: this.tempRange.endTime }; return this.isRange ? timeRange : this.pickerTime; }, mobSelectableTime() { return { start: this.calendarRange.startTime, end: this.calendarRange.endTime }; }, datePopupWidth() { return this.isRange ? 653 : 301; }, /** * for i18n */ singlePlaceholderText() { return this.placeholder || (this.type === "date" ? this.selectDateText : this.selectDateTimeText); }, startPlaceholderText() { return this.startPlaceholder || this.startDateText; }, endPlaceholderText() { return this.endPlaceholder || this.endDateText; }, selectDateText() { return this.i18nT("uni-datetime-picker.selectDate"); }, selectDateTimeText() { return this.i18nT("uni-datetime-picker.selectDateTime"); }, selectTimeText() { return this.i18nT("uni-datetime-picker.selectTime"); }, startDateText() { return this.startPlaceholder || this.i18nT("uni-datetime-picker.startDate"); }, startTimeText() { return this.i18nT("uni-datetime-picker.startTime"); }, endDateText() { return this.endPlaceholder || this.i18nT("uni-datetime-picker.endDate"); }, endTimeText() { return this.i18nT("uni-datetime-picker.endTime"); }, okText() { return this.i18nT("uni-datetime-picker.ok"); }, clearText() { return this.i18nT("uni-datetime-picker.clear"); }, showClearIcon() { return this.clearIcon && !this.disabled && (this.displayValue || this.displayRangeValue.startDate && this.displayRangeValue.endDate); } }, created() { this.initI18nT(); this.platform(); }, methods: { initI18nT() { const vueI18n = initVueI18n(i18nMessages); this.i18nT = vueI18n.t; }, initPicker(newVal) { if (!newVal && !this.defaultValue || Array.isArray(newVal) && !newVal.length) { this.$nextTick(() => { this.clear(false); }); return; } if (!Array.isArray(newVal) && !this.isRange) { if (newVal) { this.displayValue = this.inputDate = this.calendarDate = getDate(newVal); if (this.hasTime) { this.pickerTime = getTime(newVal, this.hideSecond); this.displayValue = `${this.displayValue} ${this.pickerTime}`; } } else if (this.defaultValue) { this.inputDate = this.calendarDate = getDate(this.defaultValue); if (this.hasTime) { this.pickerTime = getTime(this.defaultValue, this.hideSecond); } } } else { const [before, after] = newVal; if (!before && !after) return; const beforeDate = getDate(before); const beforeTime = getTime(before, this.hideSecond); const afterDate = getDate(after); const afterTime = getTime(after, this.hideSecond); const startDate = beforeDate; const endDate = afterDate; this.displayRangeValue.startDate = this.tempRange.startDate = startDate; this.displayRangeValue.endDate = this.tempRange.endDate = endDate; if (this.hasTime) { this.displayRangeValue.startDate = `${beforeDate} ${beforeTime}`; this.displayRangeValue.endDate = `${afterDate} ${afterTime}`; this.tempRange.startTime = beforeTime; this.tempRange.endTime = afterTime; } const defaultRange = { before: beforeDate, after: afterDate }; this.startMultipleStatus = Object.assign({}, this.startMultipleStatus, defaultRange, { which: "right" }); this.endMultipleStatus = Object.assign({}, this.endMultipleStatus, defaultRange, { which: "left" }); } }, updateLeftCale(e2) { const left = this.$refs.left; left.cale.setHoverMultiple(e2.after); left.setDate(this.$refs.left.nowDate.fullDate); }, updateRightCale(e2) { const right = this.$refs.right; right.cale.setHoverMultiple(e2.after); right.setDate(this.$refs.right.nowDate.fullDate); }, platform() { if (typeof navigator !== "undefined") { this.isPhone = navigator.userAgent.toLowerCase().indexOf("mobile") !== -1; return; } const { windowWidth } = uni.getSystemInfoSync(); this.isPhone = windowWidth <= 500; this.windowWidth = windowWidth; }, show() { if (this.disabled) { return; } this.platform(); if (this.isPhone) { setTimeout(() => { this.$refs.mobile.open(); }, 0); return; } this.pickerPositionStyle = { top: "10px" }; const dateEditor = uni.createSelectorQuery().in(this).select(".uni-date-editor"); dateEditor.boundingClientRect((rect) => { if (this.windowWidth - rect.left < this.datePopupWidth) { this.pickerPositionStyle.right = 0; } }).exec(); setTimeout(() => { this.pickerVisible = !this.pickerVisible; if (!this.isPhone && this.isRange && this.isFirstShow) { this.isFirstShow = false; const { startDate, endDate } = this.calendarRange; if (startDate && endDate) { if (this.diffDate(startDate, endDate) < 30) { this.$refs.right.changeMonth("pre"); } } else { this.$refs.right.changeMonth("next"); this.$refs.right.cale.lastHover = false; } } }, 50); }, close() { setTimeout(() => { this.pickerVisible = false; this.$emit("maskClick", this.value); this.$refs.mobile && this.$refs.mobile.close(); }, 20); }, setEmit(value) { if (this.returnType === "timestamp" || this.returnType === "date") { if (!Array.isArray(value)) { if (!this.hasTime) { value = value + " 00:00:00"; } value = this.createTimestamp(value); if (this.returnType === "date") { value = new Date(value); } } else { if (!this.hasTime) { value[0] = value[0] + " 00:00:00"; value[1] = value[1] + " 00:00:00"; } value[0] = this.createTimestamp(value[0]); value[1] = this.createTimestamp(value[1]); if (this.returnType === "date") { value[0] = new Date(value[0]); value[1] = new Date(value[1]); } } } this.$emit("update:modelValue", value); this.$emit("input", value); this.$emit("change", value); this.isEmitValue = true; }, createTimestamp(date) { date = fixIosDateFormat(date); return Date.parse(new Date(date)); }, singleChange(e2) { this.calendarDate = this.inputDate = e2.fulldate; if (this.hasTime) return; this.confirmSingleChange(); }, confirmSingleChange() { if (!checkDate(this.inputDate)) { const now = /* @__PURE__ */ new Date(); this.calendarDate = this.inputDate = getDate(now); this.pickerTime = getTime(now, this.hideSecond); } let startLaterInputDate = false; let startDate, startTime; if (this.start) { let startString = this.start; if (typeof this.start === "number") { startString = getDateTime(this.start, this.hideSecond); } [startDate, startTime] = startString.split(" "); if (this.start && !dateCompare(startDate, this.inputDate)) { startLaterInputDate = true; this.inputDate = startDate; } } let endEarlierInputDate = false; let endDate, endTime; if (this.end) { let endString = this.end; if (typeof this.end === "number") { endString = getDateTime(this.end, this.hideSecond); } [endDate, endTime] = endString.split(" "); if (this.end && !dateCompare(this.inputDate, endDate)) { endEarlierInputDate = true; this.inputDate = endDate; } } if (this.hasTime) { if (startLaterInputDate) { this.pickerTime = startTime || getDefaultSecond(this.hideSecond); } if (endEarlierInputDate) { this.pickerTime = endTime || getDefaultSecond(this.hideSecond); } if (!this.pickerTime) { this.pickerTime = getTime(Date.now(), this.hideSecond); } this.displayValue = `${this.inputDate} ${this.pickerTime}`; } else { this.displayValue = this.inputDate; } this.setEmit(this.displayValue); this.pickerVisible = false; }, leftChange(e2) { const { before, after } = e2.range; this.rangeChange(before, after); const obj = { before: e2.range.before, after: e2.range.after, data: e2.range.data, fulldate: e2.fulldate }; this.startMultipleStatus = Object.assign({}, this.startMultipleStatus, obj); }, rightChange(e2) { const { before, after } = e2.range; this.rangeChange(before, after); const obj = { before: e2.range.before, after: e2.range.after, data: e2.range.data, fulldate: e2.fulldate }; this.endMultipleStatus = Object.assign({}, this.endMultipleStatus, obj); }, mobileChange(e2) { if (this.isRange) { const { before, after } = e2.range; if (!before || !after) { return; } this.handleStartAndEnd(before, after, true); if (this.hasTime) { const { startTime, endTime } = e2.timeRange; this.tempRange.startTime = startTime; this.tempRange.endTime = endTime; } this.confirmRangeChange(); } else { if (this.hasTime) { this.displayValue = e2.fulldate + " " + e2.time; } else { this.displayValue = e2.fulldate; } this.setEmit(this.displayValue); } this.$refs.mobile.close(); }, rangeChange(before, after) { if (!(before && after)) return; this.handleStartAndEnd(before, after, true); if (this.hasTime) return; this.confirmRangeChange(); }, confirmRangeChange() { if (!this.tempRange.startDate || !this.tempRange.endDate) { this.pickerVisible = false; return; } if (!checkDate(this.tempRange.startDate)) { this.tempRange.startDate = getDate(Date.now()); } if (!checkDate(this.tempRange.endDate)) { this.tempRange.endDate = getDate(Date.now()); } let start, end; let startDateLaterRangeStartDate = false; let startDateLaterRangeEndDate = false; let startDate, startTime; if (this.start) { let startString = this.start; if (typeof this.start === "number") { startString = getDateTime(this.start, this.hideSecond); } [startDate, startTime] = startString.split(" "); if (this.start && !dateCompare(this.start, this.tempRange.startDate)) { startDateLaterRangeStartDate = true; this.tempRange.startDate = startDate; } if (this.start && !dateCompare(this.start, this.tempRange.endDate)) { startDateLaterRangeEndDate = true; this.tempRange.endDate = startDate; } } let endDateEarlierRangeStartDate = false; let endDateEarlierRangeEndDate = false; let endDate, endTime; if (this.end) { let endString = this.end; if (typeof this.end === "number") { endString = getDateTime(this.end, this.hideSecond); } [endDate, endTime] = endString.split(" "); if (this.end && !dateCompare(this.tempRange.startDate, this.end)) { endDateEarlierRangeStartDate = true; this.tempRange.startDate = endDate; } if (this.end && !dateCompare(this.tempRange.endDate, this.end)) { endDateEarlierRangeEndDate = true; this.tempRange.endDate = endDate; } } if (!this.hasTime) { start = this.displayRangeValue.startDate = this.tempRange.startDate; end = this.displayRangeValue.endDate = this.tempRange.endDate; } else { if (startDateLaterRangeStartDate) { this.tempRange.startTime = startTime || getDefaultSecond(this.hideSecond); } else if (endDateEarlierRangeStartDate) { this.tempRange.startTime = endTime || getDefaultSecond(this.hideSecond); } if (!this.tempRange.startTime) { this.tempRange.startTime = getTime(Date.now(), this.hideSecond); } if (startDateLaterRangeEndDate) { this.tempRange.endTime = startTime || getDefaultSecond(this.hideSecond); } else if (endDateEarlierRangeEndDate) { this.tempRange.endTime = endTime || getDefaultSecond(this.hideSecond); } if (!this.tempRange.endTime) { this.tempRange.endTime = getTime(Date.now(), this.hideSecond); } start = this.displayRangeValue.startDate = `${this.tempRange.startDate} ${this.tempRange.startTime}`; end = this.displayRangeValue.endDate = `${this.tempRange.endDate} ${this.tempRange.endTime}`; } if (!dateCompare(start, end)) { [start, end] = [end, start]; } this.displayRangeValue.startDate = start; this.displayRangeValue.endDate = end; const displayRange = [start, end]; this.setEmit(displayRange); this.pickerVisible = false; }, handleStartAndEnd(before, after, temp = false) { if (!(before && after)) return; const type = temp ? "tempRange" : "range"; const isStartEarlierEnd = dateCompare(before, after); this[type].startDate = isStartEarlierEnd ? before : after; this[type].endDate = isStartEarlierEnd ? after : before; }, /** * 比较时间大小 */ dateCompare(startDate, endDate) { startDate = new Date(startDate.replace("-", "/").replace("-", "/")); endDate = new Date(endDate.replace("-", "/").replace("-", "/")); return startDate <= endDate; }, /** * 比较时间差 */ diffDate(startDate, endDate) { startDate = new Date(startDate.replace("-", "/").replace("-", "/")); endDate = new Date(endDate.replace("-", "/").replace("-", "/")); const diff = (endDate - startDate) / (24 * 60 * 60 * 1e3); return Math.abs(diff); }, clear(needEmit = true) { if (!this.isRange) { this.displayValue = ""; this.inputDate = ""; this.pickerTime = ""; if (this.isPhone) { this.$refs.mobile && this.$refs.mobile.clearCalender(); } else { this.$refs.pcSingle && this.$refs.pcSingle.clearCalender(); } if (needEmit) { this.$emit("change", ""); this.$emit("input", ""); this.$emit("update:modelValue", ""); } } else { this.displayRangeValue.startDate = ""; this.displayRangeValue.endDate = ""; this.tempRange.startDate = ""; this.tempRange.startTime = ""; this.tempRange.endDate = ""; this.tempRange.endTime = ""; if (this.isPhone) { this.$refs.mobile && this.$refs.mobile.clearCalender(); } else { this.$refs.left && this.$refs.left.clearCalender(); this.$refs.right && this.$refs.right.clearCalender(); this.$refs.right && this.$refs.right.changeMonth("next"); } if (needEmit) { this.$emit("change", []); this.$emit("input", []); this.$emit("update:modelValue", []); } } } } }; function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) { const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_0$3); const _component_time_picker = vue.resolveComponent("time-picker"); const _component_Calendar = vue.resolveComponent("Calendar"); return vue.openBlock(), vue.createElementBlock("view", { class: "uni-date" }, [ vue.createElementVNode("view", { class: "uni-date-editor", onClick: _cache[1] || (_cache[1] = (...args) => $options.show && $options.show(...args)) }, [ vue.renderSlot(_ctx.$slots, "default", {}, () => [ vue.createElementVNode( "view", { class: vue.normalizeClass(["uni-date-editor--x", { "uni-date-editor--x__disabled": $props.disabled, "uni-date-x--border": $props.border }]) }, [ !$data.isRange ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "uni-date-x uni-date-single" }, [ vue.createVNode(_component_uni_icons, { class: "icon-calendar", type: "calendar", color: "#c0c4cc", size: "22" }), vue.createElementVNode( "view", { class: "uni-date__x-input" }, vue.toDisplayString($data.displayValue || $options.singlePlaceholderText), 1 /* TEXT */ ) ])) : (vue.openBlock(), vue.createElementBlock("view", { key: 1, class: "uni-date-x uni-date-range" }, [ vue.createVNode(_component_uni_icons, { class: "icon-calendar", type: "calendar", color: "#c0c4cc", size: "22" }), vue.createElementVNode( "view", { class: "uni-date__x-input text-center" }, vue.toDisplayString($data.displayRangeValue.startDate || $options.startPlaceholderText), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "range-separator" }, vue.toDisplayString($props.rangeSeparator), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "uni-date__x-input text-center" }, vue.toDisplayString($data.displayRangeValue.endDate || $options.endPlaceholderText), 1 /* TEXT */ ) ])), $options.showClearIcon ? (vue.openBlock(), vue.createElementBlock("view", { key: 2, class: "uni-date__icon-clear", onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => $options.clear && $options.clear(...args), ["stop"])) }, [ vue.createVNode(_component_uni_icons, { type: "clear", color: "#c0c4cc", size: "22" }) ])) : vue.createCommentVNode("v-if", true) ], 2 /* CLASS */ ) ], true) ]), vue.withDirectives(vue.createElementVNode( "view", { class: "uni-date-mask--pc", onClick: _cache[2] || (_cache[2] = (...args) => $options.close && $options.close(...args)) }, null, 512 /* NEED_PATCH */ ), [ [vue.vShow, $data.pickerVisible] ]), !$data.isPhone ? vue.withDirectives((vue.openBlock(), vue.createElementBlock( "view", { key: 0, ref: "datePicker", class: "uni-date-picker__container" }, [ !$data.isRange ? (vue.openBlock(), vue.createElementBlock( "view", { key: 0, class: "uni-date-single--x", style: vue.normalizeStyle($data.pickerPositionStyle) }, [ vue.createElementVNode("view", { class: "uni-popper__arrow" }), $data.hasTime ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "uni-date-changed popup-x-header" }, [ vue.withDirectives(vue.createElementVNode("input", { class: "uni-date__input text-center", type: "text", "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.inputDate = $event), placeholder: $options.selectDateText }, null, 8, ["placeholder"]), [ [vue.vModelText, $data.inputDate] ]), vue.createVNode(_component_time_picker, { type: "time", modelValue: $data.pickerTime, "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => $data.pickerTime = $event), border: false, disabled: !$data.inputDate, start: $options.timepickerStartTime, end: $options.timepickerEndTime, hideSecond: $props.hideSecond, style: { "width": "100%" } }, { default: vue.withCtx(() => [ vue.withDirectives(vue.createElementVNode("input", { class: "uni-date__input text-center", type: "text", "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $data.pickerTime = $event), placeholder: $options.selectTimeText, disabled: !$data.inputDate }, null, 8, ["placeholder", "disabled"]), [ [vue.vModelText, $data.pickerTime] ]) ]), _: 1 /* STABLE */ }, 8, ["modelValue", "disabled", "start", "end", "hideSecond"]) ])) : vue.createCommentVNode("v-if", true), vue.createVNode(_component_Calendar, { ref: "pcSingle", showMonth: false, "start-date": $data.calendarRange.startDate, "end-date": $data.calendarRange.endDate, date: $data.calendarDate, onChange: $options.singleChange, "default-value": $props.defaultValue, style: { "padding": "0 8px" } }, null, 8, ["start-date", "end-date", "date", "onChange", "default-value"]), $data.hasTime ? (vue.openBlock(), vue.createElementBlock("view", { key: 1, class: "popup-x-footer" }, [ vue.createElementVNode( "text", { class: "confirm-text", onClick: _cache[6] || (_cache[6] = (...args) => $options.confirmSingleChange && $options.confirmSingleChange(...args)) }, vue.toDisplayString($options.okText), 1 /* TEXT */ ) ])) : vue.createCommentVNode("v-if", true) ], 4 /* STYLE */ )) : (vue.openBlock(), vue.createElementBlock( "view", { key: 1, class: "uni-date-range--x", style: vue.normalizeStyle($data.pickerPositionStyle) }, [ vue.createElementVNode("view", { class: "uni-popper__arrow" }), $data.hasTime ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "popup-x-header uni-date-changed" }, [ vue.createElementVNode("view", { class: "popup-x-header--datetime" }, [ vue.withDirectives(vue.createElementVNode("input", { class: "uni-date__input uni-date-range__input", type: "text", "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => $data.tempRange.startDate = $event), placeholder: $options.startDateText }, null, 8, ["placeholder"]), [ [vue.vModelText, $data.tempRange.startDate] ]), vue.createVNode(_component_time_picker, { type: "time", modelValue: $data.tempRange.startTime, "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => $data.tempRange.startTime = $event), start: $options.timepickerStartTime, border: false, disabled: !$data.tempRange.startDate, hideSecond: $props.hideSecond }, { default: vue.withCtx(() => [ vue.withDirectives(vue.createElementVNode("input", { class: "uni-date__input uni-date-range__input", type: "text", "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => $data.tempRange.startTime = $event), placeholder: $options.startTimeText, disabled: !$data.tempRange.startDate }, null, 8, ["placeholder", "disabled"]), [ [vue.vModelText, $data.tempRange.startTime] ]) ]), _: 1 /* STABLE */ }, 8, ["modelValue", "start", "disabled", "hideSecond"]) ]), vue.createVNode(_component_uni_icons, { type: "arrowthinright", color: "#999", style: { "line-height": "40px" } }), vue.createElementVNode("view", { class: "popup-x-header--datetime" }, [ vue.withDirectives(vue.createElementVNode("input", { class: "uni-date__input uni-date-range__input", type: "text", "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => $data.tempRange.endDate = $event), placeholder: $options.endDateText }, null, 8, ["placeholder"]), [ [vue.vModelText, $data.tempRange.endDate] ]), vue.createVNode(_component_time_picker, { type: "time", modelValue: $data.tempRange.endTime, "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => $data.tempRange.endTime = $event), end: $options.timepickerEndTime, border: false, disabled: !$data.tempRange.endDate, hideSecond: $props.hideSecond }, { default: vue.withCtx(() => [ vue.withDirectives(vue.createElementVNode("input", { class: "uni-date__input uni-date-range__input", type: "text", "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => $data.tempRange.endTime = $event), placeholder: $options.endTimeText, disabled: !$data.tempRange.endDate }, null, 8, ["placeholder", "disabled"]), [ [vue.vModelText, $data.tempRange.endTime] ]) ]), _: 1 /* STABLE */ }, 8, ["modelValue", "end", "disabled", "hideSecond"]) ]) ])) : vue.createCommentVNode("v-if", true), vue.createElementVNode("view", { class: "popup-x-body" }, [ vue.createVNode(_component_Calendar, { ref: "left", showMonth: false, "start-date": $data.calendarRange.startDate, "end-date": $data.calendarRange.endDate, range: true, pleStatus: $data.endMultipleStatus, onChange: $options.leftChange, onFirstEnterCale: $options.updateRightCale, style: { "padding": "0 8px" } }, null, 8, ["start-date", "end-date", "pleStatus", "onChange", "onFirstEnterCale"]), vue.createVNode(_component_Calendar, { ref: "right", showMonth: false, "start-date": $data.calendarRange.startDate, "end-date": $data.calendarRange.endDate, range: true, onChange: $options.rightChange, pleStatus: $data.startMultipleStatus, onFirstEnterCale: $options.updateLeftCale, style: { "padding": "0 8px", "border-left": "1px solid #F1F1F1" } }, null, 8, ["start-date", "end-date", "onChange", "pleStatus", "onFirstEnterCale"]) ]), $data.hasTime ? (vue.openBlock(), vue.createElementBlock("view", { key: 1, class: "popup-x-footer" }, [ vue.createElementVNode( "text", { onClick: _cache[13] || (_cache[13] = (...args) => $options.clear && $options.clear(...args)) }, vue.toDisplayString($options.clearText), 1 /* TEXT */ ), vue.createElementVNode( "text", { class: "confirm-text", onClick: _cache[14] || (_cache[14] = (...args) => $options.confirmRangeChange && $options.confirmRangeChange(...args)) }, vue.toDisplayString($options.okText), 1 /* TEXT */ ) ])) : vue.createCommentVNode("v-if", true) ], 4 /* STYLE */ )) ], 512 /* NEED_PATCH */ )), [ [vue.vShow, $data.pickerVisible] ]) : vue.createCommentVNode("v-if", true), $data.isPhone ? (vue.openBlock(), vue.createBlock(_component_Calendar, { key: 1, ref: "mobile", clearDate: false, date: $data.calendarDate, defTime: $options.mobileCalendarTime, "start-date": $data.calendarRange.startDate, "end-date": $data.calendarRange.endDate, selectableTimes: $options.mobSelectableTime, startPlaceholder: $props.startPlaceholder, endPlaceholder: $props.endPlaceholder, "default-value": $props.defaultValue, pleStatus: $data.endMultipleStatus, showMonth: false, range: $data.isRange, hasTime: $data.hasTime, insert: false, hideSecond: $props.hideSecond, onConfirm: $options.mobileChange, onMaskClose: $options.close }, null, 8, ["date", "defTime", "start-date", "end-date", "selectableTimes", "startPlaceholder", "endPlaceholder", "default-value", "pleStatus", "range", "hasTime", "hideSecond", "onConfirm", "onMaskClose"])) : vue.createCommentVNode("v-if", true) ]); } const __easycom_1$1 = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$9], ["__scopeId", "data-v-9802168a"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue"]]); const _sfc_main$g = { name: "UniTag", emits: ["click"], props: { type: { // 标签类型default、primary、success、warning、error、royal type: String, default: "default" }, size: { // 标签大小 normal, small type: String, default: "normal" }, // 标签内容 text: { type: String, default: "" }, disabled: { // 是否为禁用状态 type: [Boolean, String], default: false }, inverted: { // 是否为空心 type: [Boolean, String], default: false }, circle: { // 是否为圆角样式 type: [Boolean, String], default: false }, mark: { // 是否为标记样式 type: [Boolean, String], default: false }, customStyle: { type: String, default: "" } }, computed: { classes() { const { type, disabled, inverted, circle, mark, size, isTrue } = this; const classArr = [ "uni-tag--" + type, "uni-tag--" + size, isTrue(disabled) ? "uni-tag--disabled" : "", isTrue(inverted) ? "uni-tag--" + type + "--inverted" : "", isTrue(circle) ? "uni-tag--circle" : "", isTrue(mark) ? "uni-tag--mark" : "", // type === 'default' ? 'uni-tag--default' : 'uni-tag-text', isTrue(inverted) ? "uni-tag--inverted uni-tag-text--" + type : "", size === "small" ? "uni-tag-text--small" : "" ]; return classArr.join(" "); } }, methods: { isTrue(value) { return value === true || value === "true"; }, onClick() { if (this.isTrue(this.disabled)) return; this.$emit("click"); } } }; function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) { return $props.text ? (vue.openBlock(), vue.createElementBlock( "text", { key: 0, class: vue.normalizeClass(["uni-tag", $options.classes]), style: vue.normalizeStyle($props.customStyle), onClick: _cache[0] || (_cache[0] = (...args) => $options.onClick && $options.onClick(...args)) }, vue.toDisplayString($props.text), 7 /* TEXT, CLASS, STYLE */ )) : vue.createCommentVNode("v-if", true); } const __easycom_2 = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$8], ["__scopeId", "data-v-1f94d070"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-tag/components/uni-tag/uni-tag.vue"]]); const popup = { data() { return {}; }, created() { this.popup = this.getParent(); }, methods: { /** * 获取父元素实例 */ getParent(name = "uniPopup") { let parent = this.$parent; let parentName = parent.$options.name; while (parentName !== name) { parent = parent.$parent; if (!parent) return false; parentName = parent.$options.name; } return parent; } } }; const en = { "uni-popup.cancel": "cancel", "uni-popup.ok": "ok", "uni-popup.placeholder": "pleace enter", "uni-popup.title": "Hint", "uni-popup.shareTitle": "Share to" }; const zhHans = { "uni-popup.cancel": "取消", "uni-popup.ok": "确定", "uni-popup.placeholder": "请输入", "uni-popup.title": "提示", "uni-popup.shareTitle": "分享到" }; const zhHant = { "uni-popup.cancel": "取消", "uni-popup.ok": "確定", "uni-popup.placeholder": "請輸入", "uni-popup.title": "提示", "uni-popup.shareTitle": "分享到" }; const messages = { en, "zh-Hans": zhHans, "zh-Hant": zhHant }; const { t: t$2 } = initVueI18n(messages); const _sfc_main$f = { name: "uniPopupDialog", mixins: [popup], emits: ["confirm", "close"], props: { inputType: { type: String, default: "text" }, value: { type: [String, Number], default: "" }, placeholder: { type: [String, Number], default: "" }, type: { type: String, default: "error" }, mode: { type: String, default: "base" }, title: { type: String, default: "" }, content: { type: String, default: "" }, beforeClose: { type: Boolean, default: false }, cancelText: { type: String, default: "" }, confirmText: { type: String, default: "" } }, data() { return { dialogType: "error", focus: false, val: "" }; }, computed: { okText() { return this.confirmText || t$2("uni-popup.ok"); }, closeText() { return this.cancelText || t$2("uni-popup.cancel"); }, placeholderText() { return this.placeholder || t$2("uni-popup.placeholder"); }, titleText() { return this.title || t$2("uni-popup.title"); } }, watch: { type(val) { this.dialogType = val; }, mode(val) { if (val === "input") { this.dialogType = "info"; } }, value(val) { this.val = val; } }, created() { this.popup.disableMask(); if (this.mode === "input") { this.dialogType = "info"; this.val = this.value; } else { this.dialogType = this.type; } }, mounted() { this.focus = true; }, methods: { /** * 点击确认按钮 */ onOk() { if (this.mode === "input") { this.$emit("confirm", this.val); } else { this.$emit("confirm"); } if (this.beforeClose) return; this.popup.close(); }, /** * 点击取消按钮 */ closeDialog() { this.$emit("close"); if (this.beforeClose) return; this.popup.close(); }, close() { this.popup.close(); } } }; function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock("view", { class: "uni-popup-dialog" }, [ vue.createElementVNode("view", { class: "uni-dialog-title" }, [ vue.createElementVNode( "text", { class: vue.normalizeClass(["uni-dialog-title-text", ["uni-popup__" + $data.dialogType]]) }, vue.toDisplayString($options.titleText), 3 /* TEXT, CLASS */ ) ]), $props.mode === "base" ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "uni-dialog-content" }, [ vue.renderSlot(_ctx.$slots, "default", {}, () => [ vue.createElementVNode( "text", { class: "uni-dialog-content-text" }, vue.toDisplayString($props.content), 1 /* TEXT */ ) ], true) ])) : (vue.openBlock(), vue.createElementBlock("view", { key: 1, class: "uni-dialog-content" }, [ vue.renderSlot(_ctx.$slots, "default", {}, () => [ vue.withDirectives(vue.createElementVNode("input", { class: "uni-dialog-input", "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.val = $event), type: $props.inputType, placeholder: $options.placeholderText, focus: $data.focus }, null, 8, ["type", "placeholder", "focus"]), [ [vue.vModelDynamic, $data.val] ]) ], true) ])), vue.createElementVNode("view", { class: "uni-dialog-button-group" }, [ vue.createElementVNode("view", { class: "uni-dialog-button", onClick: _cache[1] || (_cache[1] = (...args) => $options.closeDialog && $options.closeDialog(...args)) }, [ vue.createElementVNode( "text", { class: "uni-dialog-button-text" }, vue.toDisplayString($options.closeText), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "uni-dialog-button uni-border-left", onClick: _cache[2] || (_cache[2] = (...args) => $options.onOk && $options.onOk(...args)) }, [ vue.createElementVNode( "text", { class: "uni-dialog-button-text uni-button-color" }, vue.toDisplayString($options.okText), 1 /* TEXT */ ) ]) ]) ]); } const __easycom_4 = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$7], ["__scopeId", "data-v-d78c88b7"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue"]]); class MPAnimation { constructor(options, _this) { this.options = options; this.animation = uni.createAnimation({ ...options }); this.currentStepAnimates = {}; this.next = 0; this.$ = _this; } _nvuePushAnimates(type, args) { let aniObj = this.currentStepAnimates[this.next]; let styles = {}; if (!aniObj) { styles = { styles: {}, config: {} }; } else { styles = aniObj; } if (animateTypes1.includes(type)) { if (!styles.styles.transform) { styles.styles.transform = ""; } let unit = ""; if (type === "rotate") { unit = "deg"; } styles.styles.transform += `${type}(${args + unit}) `; } else { styles.styles[type] = `${args}`; } this.currentStepAnimates[this.next] = styles; } _animateRun(styles = {}, config = {}) { let ref = this.$.$refs["ani"].ref; if (!ref) return; return new Promise((resolve, reject) => { nvueAnimation.transition(ref, { styles, ...config }, (res) => { resolve(); }); }); } _nvueNextAnimate(animates, step = 0, fn) { let obj = animates[step]; if (obj) { let { styles, config } = obj; this._animateRun(styles, config).then(() => { step += 1; this._nvueNextAnimate(animates, step, fn); }); } else { this.currentStepAnimates = {}; typeof fn === "function" && fn(); this.isEnd = true; } } step(config = {}) { this.animation.step(config); return this; } run(fn) { this.$.animationData = this.animation.export(); this.$.timer = setTimeout(() => { typeof fn === "function" && fn(); }, this.$.durationTime); } } const animateTypes1 = [ "matrix", "matrix3d", "rotate", "rotate3d", "rotateX", "rotateY", "rotateZ", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "skew", "skewX", "skewY", "translate", "translate3d", "translateX", "translateY", "translateZ" ]; const animateTypes2 = ["opacity", "backgroundColor"]; const animateTypes3 = ["width", "height", "left", "right", "top", "bottom"]; animateTypes1.concat(animateTypes2, animateTypes3).forEach((type) => { MPAnimation.prototype[type] = function(...args) { this.animation[type](...args); return this; }; }); function createAnimation(option, _this) { if (!_this) return; clearTimeout(_this.timer); return new MPAnimation(option, _this); } const _sfc_main$e = { name: "uniTransition", emits: ["click", "change"], props: { show: { type: Boolean, default: false }, modeClass: { type: [Array, String], default() { return "fade"; } }, duration: { type: Number, default: 300 }, styles: { type: Object, default() { return {}; } }, customClass: { type: String, default: "" }, onceRender: { type: Boolean, default: false } }, data() { return { isShow: false, transform: "", opacity: 1, animationData: {}, durationTime: 300, config: {} }; }, watch: { show: { handler(newVal) { if (newVal) { this.open(); } else { if (this.isShow) { this.close(); } } }, immediate: true } }, computed: { // 生成样式数据 stylesObject() { let styles = { ...this.styles, "transition-duration": this.duration / 1e3 + "s" }; let transform = ""; for (let i2 in styles) { let line = this.toLine(i2); transform += line + ":" + styles[i2] + ";"; } return transform; }, // 初始化动画条件 transformStyles() { return "transform:" + this.transform + ";opacity:" + this.opacity + ";" + this.stylesObject; } }, created() { this.config = { duration: this.duration, timingFunction: "ease", transformOrigin: "50% 50%", delay: 0 }; this.durationTime = this.duration; }, methods: { /** * ref 触发 初始化动画 */ init(obj = {}) { if (obj.duration) { this.durationTime = obj.duration; } this.animation = createAnimation(Object.assign(this.config, obj), this); }, /** * 点击组件触发回调 */ onClick() { this.$emit("click", { detail: this.isShow }); }, /** * ref 触发 动画分组 * @param {Object} obj */ step(obj, config = {}) { if (!this.animation) return; for (let i2 in obj) { try { if (typeof obj[i2] === "object") { this.animation[i2](...obj[i2]); } else { this.animation[i2](obj[i2]); } } catch (e2) { formatAppLog("error", "at uni_modules/uni-transition/components/uni-transition/uni-transition.vue:148", `方法 ${i2} 不存在`); } } this.animation.step(config); return this; }, /** * ref 触发 执行动画 */ run(fn) { if (!this.animation) return; this.animation.run(fn); }, // 开始过度动画 open() { clearTimeout(this.timer); this.transform = ""; this.isShow = true; let { opacity, transform } = this.styleInit(false); if (typeof opacity !== "undefined") { this.opacity = opacity; } this.transform = transform; this.$nextTick(() => { this.timer = setTimeout(() => { this.animation = createAnimation(this.config, this); this.tranfromInit(false).step(); this.animation.run(); this.$emit("change", { detail: this.isShow }); }, 20); }); }, // 关闭过度动画 close(type) { if (!this.animation) return; this.tranfromInit(true).step().run(() => { this.isShow = false; this.animationData = null; this.animation = null; let { opacity, transform } = this.styleInit(false); this.opacity = opacity || 1; this.transform = transform; this.$emit("change", { detail: this.isShow }); }); }, // 处理动画开始前的默认样式 styleInit(type) { let styles = { transform: "" }; let buildStyle = (type2, mode) => { if (mode === "fade") { styles.opacity = this.animationType(type2)[mode]; } else { styles.transform += this.animationType(type2)[mode] + " "; } }; if (typeof this.modeClass === "string") { buildStyle(type, this.modeClass); } else { this.modeClass.forEach((mode) => { buildStyle(type, mode); }); } return styles; }, // 处理内置组合动画 tranfromInit(type) { let buildTranfrom = (type2, mode) => { let aniNum = null; if (mode === "fade") { aniNum = type2 ? 0 : 1; } else { aniNum = type2 ? "-100%" : "0"; if (mode === "zoom-in") { aniNum = type2 ? 0.8 : 1; } if (mode === "zoom-out") { aniNum = type2 ? 1.2 : 1; } if (mode === "slide-right") { aniNum = type2 ? "100%" : "0"; } if (mode === "slide-bottom") { aniNum = type2 ? "100%" : "0"; } } this.animation[this.animationMode()[mode]](aniNum); }; if (typeof this.modeClass === "string") { buildTranfrom(type, this.modeClass); } else { this.modeClass.forEach((mode) => { buildTranfrom(type, mode); }); } return this.animation; }, animationType(type) { return { fade: type ? 1 : 0, "slide-top": `translateY(${type ? "0" : "-100%"})`, "slide-right": `translateX(${type ? "0" : "100%"})`, "slide-bottom": `translateY(${type ? "0" : "100%"})`, "slide-left": `translateX(${type ? "0" : "-100%"})`, "zoom-in": `scaleX(${type ? 1 : 0.8}) scaleY(${type ? 1 : 0.8})`, "zoom-out": `scaleX(${type ? 1 : 1.2}) scaleY(${type ? 1 : 1.2})` }; }, // 内置动画类型与实际动画对应字典 animationMode() { return { fade: "opacity", "slide-top": "translateY", "slide-right": "translateX", "slide-bottom": "translateY", "slide-left": "translateX", "zoom-in": "scale", "zoom-out": "scale" }; }, // 驼峰转中横线 toLine(name) { return name.replace(/([A-Z])/g, "-$1").toLowerCase(); } } }; function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) { return vue.withDirectives((vue.openBlock(), vue.createElementBlock("view", { ref: "ani", animation: $data.animationData, class: vue.normalizeClass($props.customClass), style: vue.normalizeStyle($options.transformStyles), onClick: _cache[0] || (_cache[0] = (...args) => $options.onClick && $options.onClick(...args)) }, [ vue.renderSlot(_ctx.$slots, "default") ], 14, ["animation"])), [ [vue.vShow, $data.isShow] ]); } const __easycom_0$1 = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$6], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-transition/components/uni-transition/uni-transition.vue"]]); const _sfc_main$d = { name: "uniPopup", components: {}, emits: ["change", "maskClick"], props: { // 开启动画 animation: { type: Boolean, default: true }, // 弹出层类型,可选值,top: 顶部弹出层;bottom:底部弹出层;center:全屏弹出层 // message: 消息提示 ; dialog : 对话框 type: { type: String, default: "center" }, // maskClick isMaskClick: { type: Boolean, default: null }, // TODO 2 个版本后废弃属性 ,使用 isMaskClick maskClick: { type: Boolean, default: null }, backgroundColor: { type: String, default: "none" }, safeArea: { type: Boolean, default: true }, maskBackgroundColor: { type: String, default: "rgba(0, 0, 0, 0.4)" } }, watch: { /** * 监听type类型 */ type: { handler: function(type) { if (!this.config[type]) return; this[this.config[type]](true); }, immediate: true }, isDesktop: { handler: function(newVal) { if (!this.config[newVal]) return; this[this.config[this.type]](true); }, immediate: true }, /** * 监听遮罩是否可点击 * @param {Object} val */ maskClick: { handler: function(val) { this.mkclick = val; }, immediate: true }, isMaskClick: { handler: function(val) { this.mkclick = val; }, immediate: true }, // H5 下禁止底部滚动 showPopup(show) { } }, data() { return { duration: 300, ani: [], showPopup: false, showTrans: false, popupWidth: 0, popupHeight: 0, config: { top: "top", bottom: "bottom", center: "center", left: "left", right: "right", message: "top", dialog: "center", share: "bottom" }, maskClass: { position: "fixed", bottom: 0, top: 0, left: 0, right: 0, backgroundColor: "rgba(0, 0, 0, 0.4)" }, transClass: { position: "fixed", left: 0, right: 0 }, maskShow: true, mkclick: true, popupstyle: this.isDesktop ? "fixforpc-top" : "top" }; }, computed: { isDesktop() { return this.popupWidth >= 500 && this.popupHeight >= 500; }, bg() { if (this.backgroundColor === "" || this.backgroundColor === "none") { return "transparent"; } return this.backgroundColor; } }, mounted() { const fixSize = () => { const { windowWidth, windowHeight, windowTop, safeArea, screenHeight, safeAreaInsets } = uni.getSystemInfoSync(); this.popupWidth = windowWidth; this.popupHeight = windowHeight + (windowTop || 0); if (safeArea && this.safeArea) { this.safeAreaInsets = safeAreaInsets.bottom; } else { this.safeAreaInsets = 0; } }; fixSize(); }, // TODO vue3 unmounted() { this.setH5Visible(); }, created() { if (this.isMaskClick === null && this.maskClick === null) { this.mkclick = true; } else { this.mkclick = this.isMaskClick !== null ? this.isMaskClick : this.maskClick; } if (this.animation) { this.duration = 300; } else { this.duration = 0; } this.messageChild = null; this.clearPropagation = false; this.maskClass.backgroundColor = this.maskBackgroundColor; }, methods: { setH5Visible() { }, /** * 公用方法,不显示遮罩层 */ closeMask() { this.maskShow = false; }, /** * 公用方法,遮罩层禁止点击 */ disableMask() { this.mkclick = false; }, // TODO nvue 取消冒泡 clear(e2) { e2.stopPropagation(); this.clearPropagation = true; }, open(direction) { if (this.showPopup) { return; } let innerType = ["top", "center", "bottom", "left", "right", "message", "dialog", "share"]; if (!(direction && innerType.indexOf(direction) !== -1)) { direction = this.type; } if (!this.config[direction]) { formatAppLog("error", "at uni_modules/uni-popup/components/uni-popup/uni-popup.vue:279", "缺少类型:", direction); return; } this[this.config[direction]](); this.$emit("change", { show: true, type: direction }); }, close(type) { this.showTrans = false; this.$emit("change", { show: false, type: this.type }); clearTimeout(this.timer); this.timer = setTimeout(() => { this.showPopup = false; }, 300); }, // TODO 处理冒泡事件,头条的冒泡事件有问题 ,先这样兼容 touchstart() { this.clearPropagation = false; }, onTap() { if (this.clearPropagation) { this.clearPropagation = false; return; } this.$emit("maskClick"); if (!this.mkclick) return; this.close(); }, /** * 顶部弹出样式处理 */ top(type) { this.popupstyle = this.isDesktop ? "fixforpc-top" : "top"; this.ani = ["slide-top"]; this.transClass = { position: "fixed", left: 0, right: 0, backgroundColor: this.bg }; if (type) return; this.showPopup = true; this.showTrans = true; this.$nextTick(() => { if (this.messageChild && this.type === "message") { this.messageChild.timerClose(); } }); }, /** * 底部弹出样式处理 */ bottom(type) { this.popupstyle = "bottom"; this.ani = ["slide-bottom"]; this.transClass = { position: "fixed", left: 0, right: 0, bottom: 0, paddingBottom: this.safeAreaInsets + "px", backgroundColor: this.bg }; if (type) return; this.showPopup = true; this.showTrans = true; }, /** * 中间弹出样式处理 */ center(type) { this.popupstyle = "center"; this.ani = ["zoom-out", "fade"]; this.transClass = { position: "fixed", display: "flex", flexDirection: "column", bottom: 0, left: 0, right: 0, top: 0, justifyContent: "center", alignItems: "center" }; if (type) return; this.showPopup = true; this.showTrans = true; }, left(type) { this.popupstyle = "left"; this.ani = ["slide-left"]; this.transClass = { position: "fixed", left: 0, bottom: 0, top: 0, backgroundColor: this.bg, display: "flex", flexDirection: "column" }; if (type) return; this.showPopup = true; this.showTrans = true; }, right(type) { this.popupstyle = "right"; this.ani = ["slide-right"]; this.transClass = { position: "fixed", bottom: 0, right: 0, top: 0, backgroundColor: this.bg, display: "flex", flexDirection: "column" }; if (type) return; this.showPopup = true; this.showTrans = true; } } }; function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) { const _component_uni_transition = resolveEasycom(vue.resolveDynamicComponent("uni-transition"), __easycom_0$1); return $data.showPopup ? (vue.openBlock(), vue.createElementBlock( "view", { key: 0, class: vue.normalizeClass(["uni-popup", [$data.popupstyle, $options.isDesktop ? "fixforpc-z-index" : ""]]) }, [ vue.createElementVNode( "view", { onTouchstart: _cache[1] || (_cache[1] = (...args) => $options.touchstart && $options.touchstart(...args)) }, [ $data.maskShow ? (vue.openBlock(), vue.createBlock(_component_uni_transition, { key: "1", name: "mask", "mode-class": "fade", styles: $data.maskClass, duration: $data.duration, show: $data.showTrans, onClick: $options.onTap }, null, 8, ["styles", "duration", "show", "onClick"])) : vue.createCommentVNode("v-if", true), vue.createVNode(_component_uni_transition, { key: "2", "mode-class": $data.ani, name: "content", styles: $data.transClass, duration: $data.duration, show: $data.showTrans, onClick: $options.onTap }, { default: vue.withCtx(() => [ vue.createElementVNode( "view", { class: vue.normalizeClass(["uni-popup__wrapper", [$data.popupstyle]]), style: vue.normalizeStyle({ backgroundColor: $options.bg }), onClick: _cache[0] || (_cache[0] = (...args) => $options.clear && $options.clear(...args)) }, [ vue.renderSlot(_ctx.$slots, "default", {}, void 0, true) ], 6 /* CLASS, STYLE */ ) ]), _: 3 /* FORWARDED */ }, 8, ["mode-class", "styles", "duration", "show", "onClick"]) ], 32 /* HYDRATE_EVENTS */ ) ], 2 /* CLASS */ )) : vue.createCommentVNode("v-if", true); } const __easycom_5 = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$5], ["__scopeId", "data-v-4dd3c44b"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-popup/components/uni-popup/uni-popup.vue"]]); const __default__$4 = { name: "NavBar" }; const _sfc_main$c = /* @__PURE__ */ Object.assign(__default__$4, { props: { userInfo: { default: function() { return {}; }, type: Object } }, emits: ["updateUser"], setup(__props, { emit }) { const props = __props; const { proxy } = vue.getCurrentInstance(); formatAppLog("log", "at components/nav-bar/nav-bar.vue:54", "props.userInfo.workStatus", props.userInfo.workStatus); vue.onMounted(() => { }); const dialogToggle = () => { proxy.$refs.alertDialog.open(); }; const dialogConfirm = () => { handleChange(); }; const dialogClose = () => { formatAppLog("log", "at components/nav-bar/nav-bar.vue:69", "guanbi"); }; const handleChange = async () => { formatAppLog("log", "at components/nav-bar/nav-bar.vue:74", "props.userInfo.workStatus》》》", props.userInfo.workStatus); uni.getStorageSync("token"); const userId = uni.getStorageSync("userId"); if (props.userInfo.workStatus) { const params2 = { token: uni.getStorageSync("token"), data: { pharmacistUserId: userId, workStatus: props.userInfo.workStatus === "1" ? "0" : "1" } }; formatAppLog("log", "at components/nav-bar/nav-bar.vue:85", "params.data.workStatus", params2); const { data: res } = await updateWorkStatus(params2); if (res.code === 200) { uni.setStorageSync("workStatus", params2.data.workStatus); emit("updateUser", params2.data.workStatus); } emit("updateUser", props.userInfo.workStatus); } }; const handleScanbara = () => { uni.scanCode({ scanType: ["barCode"], success: function(res) { formatAppLog("log", "at components/nav-bar/nav-bar.vue:101", "条码类型:" + res.scanType); formatAppLog("log", "at components/nav-bar/nav-bar.vue:102", "条码内容:" + res.result); if (res.result) { uni.navigateTo({ url: `/pages/review/review?preNo=${res.result}&depolyStatus=2` }); } } }); }; const handleLogout = async () => { formatAppLog("log", "at components/nav-bar/nav-bar.vue:113", "handleLogout", 555); const tokens = uni.getStorageSync("token"); const userId = uni.getStorageSync("userId"); const params2 = { token: tokens, data: { pharmacistUserId: userId, onlineStatus: 1 } }; await updateOnlineStatus(params2); uni.redirectTo({ url: "/pages/login/login" }); }; return (_ctx, _cache) => { const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_0$3); const _component_uni_popup_dialog = resolveEasycom(vue.resolveDynamicComponent("uni-popup-dialog"), __easycom_4); const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_5); return vue.openBlock(), vue.createElementBlock( vue.Fragment, null, [ vue.createElementVNode("view", { class: "nav" }, [ vue.createElementVNode("view", { class: "navbar" }, [ vue.createElementVNode("button", { class: "scanbara", onClick: handleScanbara }, "复核扫码"), vue.createElementVNode( "view", { class: "status" }, vue.toDisplayString(props.userInfo.workStatus === "0" ? "接单中" : "暂停接单"), 1 /* TEXT */ ), vue.createElementVNode("view", { class: "userinfo" }, [ vue.createElementVNode( "button", { class: "lef", onClick: dialogToggle }, vue.toDisplayString(props.userInfo.workStatus === "0" ? "暂停接单" : "开始接单"), 1 /* TEXT */ ), vue.createElementVNode("image", { class: "mid", aspectFill: "", src: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/cat-1.png" }), vue.createElementVNode("view", { class: "rig" }, [ vue.createElementVNode( "text", { class: "name" }, vue.toDisplayString(props.userInfo.name ? props.userInfo.name : "张三三"), 1 /* TEXT */ ), vue.createElementVNode("view", { size: "mini", onClick: handleLogout, class: "logout" }, [ vue.createTextVNode("退出"), vue.createVNode(_component_uni_icons, { class: "item", type: "forward", color: "#ff", size: "16" }) ]) ]) ]) ]) ]), props.userInfo.workStatus === "0" ? (vue.openBlock(), vue.createElementBlock("view", { key: 0 }, [ vue.createVNode( _component_uni_popup, { ref: "alertDialog", type: "dialog" }, { default: vue.withCtx(() => [ vue.createVNode(_component_uni_popup_dialog, { type: "center", cancelText: "取消", confirmText: "同意", title: "温馨提示", content: "你确定要暂停接单吗?", onConfirm: dialogConfirm, onClose: dialogClose }) ]), _: 1 /* STABLE */ }, 512 /* NEED_PATCH */ ) ])) : (vue.openBlock(), vue.createElementBlock("view", { key: 1 }, [ vue.createVNode( _component_uni_popup, { ref: "alertDialog", type: "dialog" }, { default: vue.withCtx(() => [ vue.createVNode(_component_uni_popup_dialog, { type: "center", cancelText: "取消", confirmText: "同意", title: "温馨提示", content: "你确定要开始接单吗?", onConfirm: dialogConfirm, onClose: dialogClose }) ]), _: 1 /* STABLE */ }, 512 /* NEED_PATCH */ ) ])) ], 64 /* STABLE_FRAGMENT */ ); }; } }); const NavBar = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-e9345f2e"], ["__file", "/Users/sunwubin/source/pharmacy/components/nav-bar/nav-bar.vue"]]); const __default__$3 = { name: "OrderCard" }; const _sfc_main$b = /* @__PURE__ */ Object.assign(__default__$3, { props: { v: { default: function() { return { name: "", deployState: 0, preNo: "" }; }, type: Object }, // 当前tab c: { default: 0, type: Number } }, setup(__props) { const props = __props; formatAppLog("log", "at components/order-card/order-card.vue:67", "props.v", props.v); const deployStateName = vue.computed(() => { switch (props.v.deployState) { case "1": return "抓药"; case "2": return "复核"; case "3": return "浸泡"; case "4": return "煎煮"; case "5": return "打包"; default: return "异常状态"; } }); const handleDetail = () => { formatAppLog("log", "at components/order-card/order-card.vue:86", "handleDetail", props.v, props.c); if (props.c === 0) { uni.navigateTo({ url: `/pages/edit/edit?id=${props.v.id}` // url:`/pages/review/review?id=&preNo=${props.v.preNo}&deployState=${props.v.deployState}` }); } else { uni.navigateTo({ url: `/pages/detail/detail?id=${props.v.id}` }); } }; return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("view", { class: "container", onClick: handleDetail }, [ vue.createElementVNode("view", { class: "t" }, [ vue.createElementVNode("view", { class: "d1" }), vue.createElementVNode("view", { class: "d2" }, [ vue.createElementVNode( "view", { class: "dtim" }, "时间:" + vue.toDisplayString(props.v.prescriptionTime), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "d3" }, [ vue.createElementVNode( "view", { class: "presno" }, "处方号:" + vue.toDisplayString(props.v.preNo), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "d4" }, [ vue.createElementVNode( "view", { class: vue.normalizeClass(["source", { "zy": props.v.preMzZy === "1" }]) }, vue.toDisplayString(props.v.preMzZy === "1" ? "门诊" : "住院"), 3 /* TEXT, CLASS */ ) ]) ]), vue.createElementVNode("view", { class: "m" }, [ vue.createElementVNode("image", { class: "faceu", aspectFill: "", src: props.v.sex === "男" ? "/static/hz.png" : "/static/hy.png" }, null, 8, ["src"]), vue.createElementVNode("view", { class: "patie" }, [ vue.createElementVNode( "view", { class: "name" }, vue.toDisplayString(props.v.name), 1 /* TEXT */ ), vue.createElementVNode("view", { class: "seage" }, [ vue.createElementVNode("image", { class: "img", aspectFill: "", src: props.v.sex === "男" ? "/static/male.png" : "/static/female.png" }, null, 8, ["src"]), vue.createElementVNode( "view", { class: "sex" }, vue.toDisplayString(props.v.sex), 1 /* TEXT */ ), vue.createElementVNode("view", { class: "sep" }, "|"), vue.createElementVNode( "view", { class: "age" }, vue.toDisplayString(__props.v.age) + "岁", 1 /* TEXT */ ) ]), vue.createElementVNode( "view", { class: "case" }, vue.toDisplayString(props.v.disName) + " - " + vue.toDisplayString(props.v.symName), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "pres" }, [ vue.createElementVNode( "view", { class: "department" }, "就诊科室:" + vue.toDisplayString(props.v.department), 1 /* TEXT */ ), vue.createElementVNode("view", { class: "presInfo" }, [ vue.createTextVNode(" 处方信息: "), vue.createElementVNode( "text", { class: "tips" }, vue.toDisplayString(props.v.dosageForm) + "," + vue.toDisplayString(props.v.number) + "剂 ", 1 /* TEXT */ ) ]) ]) ]), vue.createElementVNode("view", { class: "b" }, [ vue.createElementVNode( "view", { class: "zt" }, "当前处方状态: " + vue.toDisplayString(vue.unref(deployStateName)), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "je" }, "处方金额:" + vue.toDisplayString(props.v.prescriptionSum) + "元", 1 /* TEXT */ ) ]) ]); }; } }); const OrderCard = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-1ab9fcf6"], ["__file", "/Users/sunwubin/source/pharmacy/components/order-card/order-card.vue"]]); const _sfc_main$a = { __name: "index", setup(__props) { const userInfo = vue.ref({}); const searchVal = vue.ref(""); const tabList = vue.ref([ { title: "今日待完成", status: 0 }, { title: "历史处方", status: 1 } ]); const currentStatus = vue.ref(0); const tabActive = vue.ref(0); const tabName = vue.ref("今日待完成"); const orderList = vue.ref([ { id: 1, prescriptionTime: "2023-07-06 14:54", faceurl: "/static/hz.png", name: "张三三", sex: "女", age: 23, disName: "胃脘痛病", symName: "脾胃虚寒证", deployState: "调配", preNo: 10230516091026, department: "中医内科", dosageForm: "汤剂", number: 3, prescriptionSum: 135.62, preMzZy: "1" }, { id: 2, prescriptionTime: "2023-07-06 14:54", faceurl: "/static/hz.png", name: "张三三", sex: "女", age: 23, disName: "胃脘痛病", symName: "脾胃虚寒证", deployState: "调配", preNo: 10230516091026, department: "中医内科", dosageForm: "汤剂", number: 3, prescriptionSum: 135.62, preMzZy: "1" }, { id: 3, prescriptionTime: "2023-07-06 14:54", faceurl: "/static/hz.png", name: "张三三", sex: "女", age: 23, disName: "胃脘痛病", symName: "脾胃虚寒证", deployState: "调配", preNo: 10230516091026, department: "中医内科", dosageForm: "汤剂", number: 3, prescriptionSum: 135.62, preMzZy: "2" }, { id: 4, prescriptionTime: "2023-07-06 14:54", faceurl: "/static/hz.png", name: "张三三", sex: "女", age: 23, disName: "胃脘痛病", symName: "脾胃虚寒证", deployState: "调配", preNo: 10230516091026, department: "中医内科", dosageForm: "汤剂", number: 3, prescriptionSum: 135.62, preMzZy: "1" }, { id: 5, prescriptionTime: "2023-07-06 14:54", faceurl: "/static/hz.png", name: "张三三", sex: "女", age: 23, disName: "胃脘痛病", symName: "脾胃虚寒证", deployState: "调配", preNo: 10230516091026, department: "中医内科", dosageForm: "汤剂", number: 3, prescriptionSum: 135.62, preMzZy: "2" } ]); const isBottom = vue.ref(false); const officeArr = vue.ref(["全部", "中医骨伤科门诊一", "中医内科门诊一", "中医儿科门诊"]); const officeIndex = vue.ref(0); const typeArr = vue.ref(["姓名:", "处方号:"]); const typeIndex = vue.ref(0); const searchTime = vue.ref([]); const searchDepartment = vue.ref(""); const searchName = vue.ref(""); const searchPreNo = vue.ref(""); const searchSex = vue.ref(""); const searchPreMzZy = vue.ref(""); const searchStatus = vue.ref(""); const searchTags = vue.ref([]); const tags = vue.ref(["全部", "门诊", "住院", "男", "女", "煎煮", "发药"]); vue.ref([ { name: "抓药", id: "1" }, { name: "复核", id: "2" }, { name: "浸泡", id: "3" }, { name: "煎煮", id: "4" }, { name: "打包", id: "5" } ]); const page = vue.ref(0); const total = vue.ref(0); const pageSize = vue.ref(10); vue.ref(""); vue.getCurrentInstance(); vue.onMounted(() => { }); onLoad(async () => { const token2 = uni.getStorageSync("token"); userInfo.value.name = uni.getStorageSync("username"); userInfo.value.workStatus = uni.getStorageSync("workStatus"); const params2 = { token: token2, data: JSON.stringify({ currentUserId: parseInt(uni.getStorageSync("userId")) || 0, page: page.value, pageSize: pageSize.value, status: currentStatus.value }) }; const { data: res } = await receiveOrderList(params2); if (res.code === 200) { total.value = res.total; orderList.value = res.rows; } }); const updateUser = (v2) => { formatAppLog("log", "at pages/index/index.vue:192", "updateUserStatus", v2); userInfo.value.workStatus = v2; }; const updateList = (v2) => { formatAppLog("log", "at pages/index/index.vue:197", "updateList", v2); }; const handleSearch = async () => { const token2 = uni.getStorageSync("token"); formatAppLog("log", "at pages/index/index.vue:202", "handleSearch token", token2); formatAppLog("log", "at pages/index/index.vue:203", "handleSearch searchVal", searchVal.value); formatAppLog("log", "at pages/index/index.vue:204", "currentStatus.value", currentStatus.value); searchVal.value = searchVal.value.trim(); if (currentStatus.value === 0 && searchVal.value) { const params2 = { token: token2, data: JSON.stringify({ currentUserId: parseInt(uni.getStorageSync("userId")) || 0, name: searchVal.value, page: page.value, pageSize: pageSize.value, status: currentStatus.value }) }; const { data: res } = await receiveOrderList(params2); if (res.code === 200) { total.value = res.total; orderList.value = res.rows; } } if (currentStatus.value === 1) { const params2 = { token: token2, data: JSON.stringify({ currentUserId: parseInt(uni.getStorageSync("userId")) || 0, startTime: searchTime.value[0] || "", endTime: searchTime.value[1] || "", name: searchVal.value || "", preNo: searchPreNo.value || "", prescriptionStatus: searchStatus.value || "", sex: searchSex.value || "", preMzZy: searchPreMzZy.value || "", page: page.value, pageSize: pageSize.value, status: currentStatus.value || 0 }) }; formatAppLog("log", "at pages/index/index.vue:240", "params", params2); const { data: res } = await receiveOrderList(params2); if (res.code === 200) { total.value = res.total; orderList.value = res.rows; } } }; const handleRefresh = async () => { formatAppLog("log", "at pages/index/index.vue:251", "yijianshifang >orderList>>", orderList.value); let ids = ""; orderList.value.forEach((v2) => { if (v2.id) { ids = ids + v2.id + ","; formatAppLog("log", "at pages/index/index.vue:255", "yijianshifang >orderList>>", ids); } }); formatAppLog("log", "at pages/index/index.vue:258", "yijianshifang >orderList>>666", ids); const params2 = { token: uni.getStorageSync("token"), data: { ids } }; const { data: res } = await releaseOrder(params2); if (res.code === 200) { params2 = { token, data: JSON.stringify({ currentUserId: parseInt(uni.getStorageSync("userId")), page: page.value, pageSize: pageSize.value, status: currentStatus.value }) }; const { data: res2 } = await receiveOrderList(params2); if (res2.code === 200) { total.value = res2.total; orderList.value = res2.rows; } } }; const handleGetOffice = (e2) => { formatAppLog("log", "at pages/index/index.vue:284", "handleGetOffice", e2.detail.value); formatAppLog("log", "at pages/index/index.vue:285", "officeIndex", officeIndex); formatAppLog("log", "at pages/index/index.vue:286", "officeIndex", officeIndex); officeIndex.value = e2.detail.value; }; const handleGetType = (e2) => { formatAppLog("log", "at pages/index/index.vue:291", "handleGetType", e2.detail.value); formatAppLog("log", "at pages/index/index.vue:292", "typeIndex", typeIndex); formatAppLog("log", "at pages/index/index.vue:293", "typeArr", typeIndex); typeIndex.value = e2.detail.value; if (typeIndex.value === 1) { searchName.value = ""; } else { searchPreNo.value = ""; } }; const handleGetTags = (v2) => { formatAppLog("log", "at pages/index/index.vue:303", "handleGetTags", v2); if (!searchTags.value.includes(v2)) { searchTags.value.push(v2); } else { searchTags.value.splice(searchTags.value.indexOf(v2), 1); } switch (v2) { case "全部": if (searchTags.value.includes(v2)) { searchTags.value = ["全部"]; searchTime.value = []; searchDepartment.value = ""; searchName.value = ""; searchPreNo.value = ""; searchSex.value = ""; searchPreMzZy.value = ""; searchStatus.value = ""; } break; case "门诊": if (searchTags.value.includes(v2) && searchTags.value.includes("住院")) { searchTags.value.splice(searchTags.value.indexOf("住院"), 1); } if (searchTags.value.includes("全部")) { searchTags.value.splice(searchTags.value.indexOf("全部"), 1); } searchPreMzZy.value = "1"; break; case "住院": if (searchTags.value.includes(v2) && searchTags.value.includes("门诊")) { searchTags.value.splice(searchTags.value.indexOf("门诊"), 1); } if (searchTags.value.includes("全部")) { searchTags.value.splice(searchTags.value.indexOf("全部"), 1); } searchPreMzZy.value = "2"; break; case "男": if (searchTags.value.includes(v2) && searchTags.value.includes("女")) { searchTags.value.splice(searchTags.value.indexOf("女"), 1); } if (searchTags.value.includes("全部")) { searchTags.value.splice(searchTags.value.indexOf("全部"), 1); } searchSex.value = "男"; break; case "女": if (searchTags.value.includes(v2) && searchTags.value.includes("男")) { searchTags.value.splice(searchTags.value.indexOf("男"), 1); } if (searchTags.value.includes("全部")) { searchTags.value.splice(searchTags.value.indexOf("全部"), 1); } searchSex.value = "女"; break; case "煎煮": if (searchTags.value.includes(v2) && searchTags.value.includes("发药")) { searchTags.value.splice(searchTags.value.indexOf("发药"), 1); } if (searchTags.value.includes("全部")) { searchTags.value.splice(searchTags.value.indexOf("全部"), 1); } searchStatus.value = "煎煮"; break; case "发药": if (searchTags.value.includes(v2) && searchTags.value.includes("煎煮")) { searchTags.value.splice(searchTags.value.indexOf("煎煮"), 1); } if (searchTags.value.includes("全部")) { searchTags.value.splice(searchTags.value.indexOf("全部"), 1); } searchStatus.value = "发药"; break; default: searchTags.value = ["全部"]; } }; const checkIndex = async (index) => { tabActive.value = index; tabName.value = tabList.value[index].title; currentStatus.value = parseInt(tabList.value[index].status); const token2 = uni.getStorageSync("token"); const params2 = { token: token2, data: { status: currentStatus.value, page: page.value, pageSize: pageSize.value } }; formatAppLog("log", "at pages/index/index.vue:395", "checkIndex params", params2); const { data: res } = await receiveOrderList(params2); if (res.code === 200) { total.value = res.total; orderList.value = res.rows; } }; return (_ctx, _cache) => { const _component_uni_easyinput = resolveEasycom(vue.resolveDynamicComponent("uni-easyinput"), __easycom_0$2); const _component_uni_datetime_picker = resolveEasycom(vue.resolveDynamicComponent("uni-datetime-picker"), __easycom_1$1); const _component_uni_tag = resolveEasycom(vue.resolveDynamicComponent("uni-tag"), __easycom_2); return vue.openBlock(), vue.createElementBlock("view", { class: "main" }, [ vue.createVNode(NavBar, { "user-info": userInfo.value, onUpdateUser: updateUser }, null, 8, ["user-info"]), vue.createElementVNode("view", { class: "body" }, [ vue.createElementVNode("view", { class: "tab-box" }, [ vue.createElementVNode("view", { class: "tab-bar" }, [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList(tabList.value, (tab, index) => { return vue.openBlock(), vue.createElementBlock("view", { class: vue.normalizeClass(["tab_item", { "active": tabActive.value == index }]), key: index, onClick: ($event) => checkIndex(index) }, [ vue.createElementVNode( "text", { class: "text" }, vue.toDisplayString(tab.title) + vue.toDisplayString(index === 0 ? "(" + orderList.value.length + ")" : ""), 1 /* TEXT */ ) ], 10, ["onClick"]); }), 128 /* KEYED_FRAGMENT */ )) ]), vue.createElementVNode("view", { class: "search-bar" }, [ tabActive.value === 0 ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "today" }, [ vue.createElementVNode("view", { class: "search" }, [ vue.createVNode(_component_uni_easyinput, { prefixIcon: "search", modelValue: searchVal.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchVal.value = $event), placeholder: "请输入姓名" }, null, 8, ["modelValue"]) ]), vue.createElementVNode("button", { type: "primary", onClick: handleSearch, class: "search-button" }, "搜索"), vue.createElementVNode("button", { type: "primary", disabled: userInfo.value.workStatus === "1" ? false : true, onClick: handleRefresh, class: vue.normalizeClass(userInfo.value.workStatus === "1" ? "refresh" : "refresh active") }, "一键释放", 10, ["disabled"]) ])) : (vue.openBlock(), vue.createElementBlock("view", { key: 1, class: "history" }, [ vue.createElementVNode("view", { class: "searchchoice" }, [ vue.createElementVNode("view", { class: "row1" }, [ vue.createElementVNode("view", { class: "timequan" }, [ vue.createElementVNode("text", { class: "time_t" }, "时间区间:"), vue.createVNode(_component_uni_datetime_picker, { modelValue: searchTime.value, "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => searchTime.value = $event), type: "datetimerange", "hide-second": true, class: "datepick", rangeSeparator: " - " }, null, 8, ["modelValue"]), vue.createCommentVNode(` `), vue.createCommentVNode(' ') ]) ]), vue.createElementVNode("view", { class: "row2" }, [ vue.createElementVNode("view", { class: "office" }, [ vue.createElementVNode("view", { class: "time_t" }, " 科室: "), vue.createElementVNode("picker", { onChange: handleGetOffice, value: officeIndex.value, range: officeArr.value }, [ vue.createElementVNode( "view", { class: "uni-input" }, vue.toDisplayString(officeArr.value[officeIndex.value]), 1 /* TEXT */ ) ], 40, ["value", "range"]) ]), vue.createElementVNode("view", { class: "presid" }, [ vue.createElementVNode("picker", { onChange: handleGetType, value: typeIndex.value, range: typeArr.value }, [ vue.createElementVNode( "view", { class: "uni-input" }, vue.toDisplayString(typeArr.value[typeIndex.value]), 1 /* TEXT */ ) ], 40, ["value", "range"]) ]), typeIndex.value === 0 ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "search" }, [ vue.createVNode(_component_uni_easyinput, { prefixIcon: "search", modelValue: searchName.value, "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => searchName.value = $event), placeholder: "请输入姓名" }, null, 8, ["modelValue"]) ])) : (vue.openBlock(), vue.createElementBlock("view", { key: 1, class: "search" }, [ vue.createVNode(_component_uni_easyinput, { prefixIcon: "search", modelValue: searchPreNo.value, "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => searchPreNo.value = $event), placeholder: "请输入处方号" }, null, 8, ["modelValue"]) ])), vue.createElementVNode("button", { type: "primary", onClick: handleSearch, class: "search-button" }, "搜索") ]), vue.createElementVNode("view", { class: "row3" }, [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList(tags.value, (v2, i2) => { return vue.openBlock(), vue.createElementBlock("view", { class: "tag-view", key: i2 }, [ vue.createVNode(_component_uni_tag, { circle: true, inverted: !searchTags.value.includes(v2), text: v2, onClick: ($event) => handleGetTags(v2) }, null, 8, ["inverted", "text", "onClick"]) ]); }), 128 /* KEYED_FRAGMENT */ )) ]) ]) ])) ]) ]), vue.createElementVNode("view", { class: "tab-content" }, [ vue.createElementVNode("view", { class: "order-list" }, [ orderList.value.length > 0 ? (vue.openBlock(), vue.createElementBlock("scroll-view", { key: 0, class: "order-list-wrap", "scroll-y": "true", "scroll-top": 50 }, [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList(orderList.value, (v2, i2) => { return vue.openBlock(), vue.createElementBlock( vue.Fragment, { key: i2 }, [ v2 ? (vue.openBlock(), vue.createBlock(OrderCard, { key: 0, v: v2, index: i2, c: tabActive.value, class: "order-card", onUpdateList: updateList }, null, 8, ["v", "index", "c"])) : vue.createCommentVNode("v-if", true) ], 64 /* STABLE_FRAGMENT */ ); }), 128 /* KEYED_FRAGMENT */ )) ])) : (vue.openBlock(), vue.createElementBlock("view", { key: 1, class: "text" }, [ vue.createElementVNode("image", { class: "zwsj", aspectFill: "", src: "/static/zwsj.png" }, null, 8, ["src"]) ])) ]), isBottom.value ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "order-bottom" }, [ vue.createElementVNode("view", { class: "text" }, "-- 没有更多数据 --") ])) : vue.createCommentVNode("v-if", true) ]) ]) ]); }; } }; const PagesIndexIndex = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__file", "/Users/sunwubin/source/pharmacy/pages/index/index.vue"]]); const _sfc_main$9 = { name: "UniStatusBar", data() { return { statusBarHeight: uni.getSystemInfoSync().statusBarHeight + "px" }; } }; function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock( "view", { style: vue.normalizeStyle({ height: $data.statusBarHeight }), class: "uni-status-bar" }, [ vue.renderSlot(_ctx.$slots, "default", {}, void 0, true) ], 4 /* STYLE */ ); } const statusBar = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$4], ["__scopeId", "data-v-7920e3e0"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar.vue"]]); const getVal = (val) => typeof val === "number" ? val + "px" : val; const _sfc_main$8 = { name: "UniNavBar", components: { statusBar }, emits: ["clickLeft", "clickRight", "clickTitle"], props: { dark: { type: Boolean, default: false }, title: { type: String, default: "" }, leftText: { type: String, default: "" }, rightText: { type: String, default: "" }, leftIcon: { type: String, default: "" }, rightIcon: { type: String, default: "" }, fixed: { type: [Boolean, String], default: false }, color: { type: String, default: "" }, backgroundColor: { type: String, default: "" }, statusBar: { type: [Boolean, String], default: false }, shadow: { type: [Boolean, String], default: false }, border: { type: [Boolean, String], default: true }, height: { type: [Number, String], default: 44 }, leftWidth: { type: [Number, String], default: 60 }, rightWidth: { type: [Number, String], default: 60 }, stat: { type: [Boolean, String], default: "" } }, computed: { themeBgColor() { if (this.dark) { if (this.backgroundColor) { return this.backgroundColor; } else { return this.dark ? "#333" : "#FFF"; } } return this.backgroundColor || "#FFF"; }, themeColor() { if (this.dark) { if (this.color) { return this.color; } else { return this.dark ? "#fff" : "#333"; } } return this.color || "#333"; }, navbarHeight() { return getVal(this.height); }, leftIconWidth() { return getVal(this.leftWidth); }, rightIconWidth() { return getVal(this.rightWidth); } }, mounted() { if (uni.report && this.stat && this.title !== "") { uni.report("title", this.title); } }, methods: { onClickLeft() { this.$emit("clickLeft"); }, onClickRight() { this.$emit("clickRight"); }, onClickTitle() { this.$emit("clickTitle"); } } }; function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) { const _component_status_bar = vue.resolveComponent("status-bar"); const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_0$3); return vue.openBlock(), vue.createElementBlock( "view", { class: vue.normalizeClass(["uni-navbar", { "uni-dark": $props.dark, "uni-nvue-fixed": $props.fixed }]) }, [ vue.createElementVNode( "view", { class: vue.normalizeClass(["uni-navbar__content", { "uni-navbar--fixed": $props.fixed, "uni-navbar--shadow": $props.shadow, "uni-navbar--border": $props.border }]), style: vue.normalizeStyle({ "background-color": $options.themeBgColor, "border-bottom-color": $options.themeColor }) }, [ $props.statusBar ? (vue.openBlock(), vue.createBlock(_component_status_bar, { key: 0 })) : vue.createCommentVNode("v-if", true), vue.createElementVNode( "view", { style: vue.normalizeStyle({ color: $options.themeColor, backgroundColor: $options.themeBgColor, height: $options.navbarHeight }), class: "uni-navbar__header" }, [ vue.createElementVNode( "view", { onClick: _cache[0] || (_cache[0] = (...args) => $options.onClickLeft && $options.onClickLeft(...args)), class: "uni-navbar__header-btns uni-navbar__header-btns-left", style: vue.normalizeStyle({ width: $options.leftIconWidth }) }, [ vue.renderSlot(_ctx.$slots, "left", {}, () => [ $props.leftIcon.length > 0 ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "uni-navbar__content_view" }, [ vue.createVNode(_component_uni_icons, { color: $options.themeColor, type: $props.leftIcon, size: "34" }, null, 8, ["color", "type"]) ])) : vue.createCommentVNode("v-if", true), $props.leftText.length ? (vue.openBlock(), vue.createElementBlock( "view", { key: 1, class: vue.normalizeClass([{ "uni-navbar-btn-icon-left": !$props.leftIcon.length > 0 }, "uni-navbar-btn-text"]) }, [ vue.createElementVNode( "text", { style: vue.normalizeStyle({ color: $options.themeColor, fontSize: "34px" }) }, vue.toDisplayString($props.leftText), 5 /* TEXT, STYLE */ ) ], 2 /* CLASS */ )) : vue.createCommentVNode("v-if", true) ], true) ], 4 /* STYLE */ ), vue.createElementVNode("view", { class: "uni-navbar__header-container", onClick: _cache[1] || (_cache[1] = (...args) => $options.onClickTitle && $options.onClickTitle(...args)) }, [ vue.renderSlot(_ctx.$slots, "default", {}, () => [ $props.title.length > 0 ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "uni-navbar__header-container-inner" }, [ vue.createElementVNode( "text", { class: "uni-nav-bar-text uni-ellipsis-1", style: vue.normalizeStyle({ color: $options.themeColor }) }, vue.toDisplayString($props.title), 5 /* TEXT, STYLE */ ) ])) : vue.createCommentVNode("v-if", true) ], true) ]), vue.createElementVNode( "view", { onClick: _cache[2] || (_cache[2] = (...args) => $options.onClickRight && $options.onClickRight(...args)), class: "uni-navbar__header-btns uni-navbar__header-btns-right", style: vue.normalizeStyle({ width: $options.rightIconWidth }) }, [ vue.renderSlot(_ctx.$slots, "right", {}, () => [ $props.rightIcon.length ? (vue.openBlock(), vue.createElementBlock("view", { key: 0 }, [ vue.createVNode(_component_uni_icons, { color: $options.themeColor, type: $props.rightIcon, size: "22" }, null, 8, ["color", "type"]) ])) : vue.createCommentVNode("v-if", true), $props.rightText.length && !$props.rightIcon.length ? (vue.openBlock(), vue.createElementBlock("view", { key: 1, class: "uni-navbar-btn-text" }, [ vue.createElementVNode( "text", { class: "uni-nav-bar-right-text", style: vue.normalizeStyle({ color: $options.themeColor }) }, vue.toDisplayString($props.rightText), 5 /* TEXT, STYLE */ ) ])) : vue.createCommentVNode("v-if", true) ], true) ], 4 /* STYLE */ ) ], 4 /* STYLE */ ) ], 6 /* CLASS, STYLE */ ), $props.fixed ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "uni-navbar__placeholder" }, [ $props.statusBar ? (vue.openBlock(), vue.createBlock(_component_status_bar, { key: 0 })) : vue.createCommentVNode("v-if", true), vue.createElementVNode( "view", { class: "uni-navbar__placeholder-view", style: vue.normalizeStyle({ height: $options.navbarHeight }) }, null, 4 /* STYLE */ ) ])) : vue.createCommentVNode("v-if", true) ], 2 /* CLASS */ ); } const __easycom_0 = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$3], ["__scopeId", "data-v-26544265"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue"]]); var __assign = function() { return (__assign = Object.assign || function(t2) { for (var e2, i2 = 1, r2 = arguments.length; i2 < r2; i2++) for (var o2 in e2 = arguments[i2]) Object.prototype.hasOwnProperty.call(e2, o2) && (t2[o2] = e2[o2]); return t2; }).apply(this, arguments); }; function __awaiter(t2, n2, h2, a2) { return new (h2 = h2 || Promise)(function(i2, e2) { function r2(t3) { try { s2(a2.next(t3)); } catch (t4) { e2(t4); } } function o2(t3) { try { s2(a2.throw(t3)); } catch (t4) { e2(t4); } } function s2(t3) { var e3; t3.done ? i2(t3.value) : ((e3 = t3.value) instanceof h2 ? e3 : new h2(function(t4) { t4(e3); })).then(r2, o2); } s2((a2 = a2.apply(t2, n2 || [])).next()); }); } function __generator(i2, r2) { var o2, s2, n2, h2 = { label: 0, sent: function() { if (1 & n2[0]) throw n2[1]; return n2[1]; }, trys: [], ops: [] }, t2 = { next: e2(0), throw: e2(1), return: e2(2) }; return "function" == typeof Symbol && (t2[Symbol.iterator] = function() { return this; }), t2; function e2(e3) { return function(t3) { return function(e4) { if (o2) throw new TypeError("Generator is already executing."); for (; h2; ) try { if (o2 = 1, s2 && (n2 = 2 & e4[0] ? s2.return : e4[0] ? s2.throw || ((n2 = s2.return) && n2.call(s2), 0) : s2.next) && !(n2 = n2.call(s2, e4[1])).done) return n2; switch (s2 = 0, (e4 = n2 ? [2 & e4[0], n2.value] : e4)[0]) { case 0: case 1: n2 = e4; break; case 4: return h2.label++, { value: e4[1], done: false }; case 5: h2.label++, s2 = e4[1], e4 = [0]; continue; case 7: e4 = h2.ops.pop(), h2.trys.pop(); continue; default: if (!(n2 = 0 < (n2 = h2.trys).length && n2[n2.length - 1]) && (6 === e4[0] || 2 === e4[0])) { h2 = 0; continue; } if (3 === e4[0] && (!n2 || e4[1] > n2[0] && e4[1] < n2[3])) { h2.label = e4[1]; break; } if (6 === e4[0] && h2.label < n2[1]) { h2.label = n2[1], n2 = e4; break; } if (n2 && h2.label < n2[2]) { h2.label = n2[2], h2.ops.push(e4); break; } n2[2] && h2.ops.pop(), h2.trys.pop(); continue; } e4 = r2.call(i2, h2); } catch (t4) { e4 = [6, t4], s2 = 0; } finally { o2 = n2 = 0; } if (5 & e4[0]) throw e4[1]; return { value: e4[0] ? e4[1] : void 0, done: true }; }([e3, t3]); }; } } var PATTERNS = [[2, 1, 2, 2, 2, 2, 0, 0], [2, 2, 2, 1, 2, 2, 0, 0], [2, 2, 2, 2, 2, 1, 0, 0], [1, 2, 1, 2, 2, 3, 0, 0], [1, 2, 1, 3, 2, 2, 0, 0], [1, 3, 1, 2, 2, 2, 0, 0], [1, 2, 2, 2, 1, 3, 0, 0], [1, 2, 2, 3, 1, 2, 0, 0], [1, 3, 2, 2, 1, 2, 0, 0], [2, 2, 1, 2, 1, 3, 0, 0], [2, 2, 1, 3, 1, 2, 0, 0], [2, 3, 1, 2, 1, 2, 0, 0], [1, 1, 2, 2, 3, 2, 0, 0], [1, 2, 2, 1, 3, 2, 0, 0], [1, 2, 2, 2, 3, 1, 0, 0], [1, 1, 3, 2, 2, 2, 0, 0], [1, 2, 3, 1, 2, 2, 0, 0], [1, 2, 3, 2, 2, 1, 0, 0], [2, 2, 3, 2, 1, 1, 0, 0], [2, 2, 1, 1, 3, 2, 0, 0], [2, 2, 1, 2, 3, 1, 0, 0], [2, 1, 3, 2, 1, 2, 0, 0], [2, 2, 3, 1, 1, 2, 0, 0], [3, 1, 2, 1, 3, 1, 0, 0], [3, 1, 1, 2, 2, 2, 0, 0], [3, 2, 1, 1, 2, 2, 0, 0], [3, 2, 1, 2, 2, 1, 0, 0], [3, 1, 2, 2, 1, 2, 0, 0], [3, 2, 2, 1, 1, 2, 0, 0], [3, 2, 2, 2, 1, 1, 0, 0], [2, 1, 2, 1, 2, 3, 0, 0], [2, 1, 2, 3, 2, 1, 0, 0], [2, 3, 2, 1, 2, 1, 0, 0], [1, 1, 1, 3, 2, 3, 0, 0], [1, 3, 1, 1, 2, 3, 0, 0], [1, 3, 1, 3, 2, 1, 0, 0], [1, 1, 2, 3, 1, 3, 0, 0], [1, 3, 2, 1, 1, 3, 0, 0], [1, 3, 2, 3, 1, 1, 0, 0], [2, 1, 1, 3, 1, 3, 0, 0], [2, 3, 1, 1, 1, 3, 0, 0], [2, 3, 1, 3, 1, 1, 0, 0], [1, 1, 2, 1, 3, 3, 0, 0], [1, 1, 2, 3, 3, 1, 0, 0], [1, 3, 2, 1, 3, 1, 0, 0], [1, 1, 3, 1, 2, 3, 0, 0], [1, 1, 3, 3, 2, 1, 0, 0], [1, 3, 3, 1, 2, 1, 0, 0], [3, 1, 3, 1, 2, 1, 0, 0], [2, 1, 1, 3, 3, 1, 0, 0], [2, 3, 1, 1, 3, 1, 0, 0], [2, 1, 3, 1, 1, 3, 0, 0], [2, 1, 3, 3, 1, 1, 0, 0], [2, 1, 3, 1, 3, 1, 0, 0], [3, 1, 1, 1, 2, 3, 0, 0], [3, 1, 1, 3, 2, 1, 0, 0], [3, 3, 1, 1, 2, 1, 0, 0], [3, 1, 2, 1, 1, 3, 0, 0], [3, 1, 2, 3, 1, 1, 0, 0], [3, 3, 2, 1, 1, 1, 0, 0], [3, 1, 4, 1, 1, 1, 0, 0], [2, 2, 1, 4, 1, 1, 0, 0], [4, 3, 1, 1, 1, 1, 0, 0], [1, 1, 1, 2, 2, 4, 0, 0], [1, 1, 1, 4, 2, 2, 0, 0], [1, 2, 1, 1, 2, 4, 0, 0], [1, 2, 1, 4, 2, 1, 0, 0], [1, 4, 1, 1, 2, 2, 0, 0], [1, 4, 1, 2, 2, 1, 0, 0], [1, 1, 2, 2, 1, 4, 0, 0], [1, 1, 2, 4, 1, 2, 0, 0], [1, 2, 2, 1, 1, 4, 0, 0], [1, 2, 2, 4, 1, 1, 0, 0], [1, 4, 2, 1, 1, 2, 0, 0], [1, 4, 2, 2, 1, 1, 0, 0], [2, 4, 1, 2, 1, 1, 0, 0], [2, 2, 1, 1, 1, 4, 0, 0], [4, 1, 3, 1, 1, 1, 0, 0], [2, 4, 1, 1, 1, 2, 0, 0], [1, 3, 4, 1, 1, 1, 0, 0], [1, 1, 1, 2, 4, 2, 0, 0], [1, 2, 1, 1, 4, 2, 0, 0], [1, 2, 1, 2, 4, 1, 0, 0], [1, 1, 4, 2, 1, 2, 0, 0], [1, 2, 4, 1, 1, 2, 0, 0], [1, 2, 4, 2, 1, 1, 0, 0], [4, 1, 1, 2, 1, 2, 0, 0], [4, 2, 1, 1, 1, 2, 0, 0], [4, 2, 1, 2, 1, 1, 0, 0], [2, 1, 2, 1, 4, 1, 0, 0], [2, 1, 4, 1, 2, 1, 0, 0], [4, 1, 2, 1, 2, 1, 0, 0], [1, 1, 1, 1, 4, 3, 0, 0], [1, 1, 1, 3, 4, 1, 0, 0], [1, 3, 1, 1, 4, 1, 0, 0], [1, 1, 4, 1, 1, 3, 0, 0], [1, 1, 4, 3, 1, 1, 0, 0], [4, 1, 1, 1, 1, 3, 0, 0], [4, 1, 1, 3, 1, 1, 0, 0], [1, 1, 3, 1, 4, 1, 0, 0], [1, 1, 4, 1, 3, 1, 0, 0], [3, 1, 1, 1, 4, 1, 0, 0], [4, 1, 1, 1, 3, 1, 0, 0], [2, 1, 1, 4, 1, 2, 0, 0], [2, 1, 1, 2, 1, 4, 0, 0], [2, 1, 1, 2, 3, 2, 0, 0], [2, 3, 3, 1, 1, 1, 2, 0]], UNIT_CONVERSION = function(t2) { return uni.upx2px(Number(t2)); }, getPixelRatio = function(t2) { return uni.getSystemInfoSync()[t2 || "pixelRatio"]; }, getTimeDate = function() { var t2 = /* @__PURE__ */ new Date(); return t2.toLocaleDateString().replace(/\//g, "-") + " " + t2.toTimeString().slice(0, 8); }, GETSIZE = { "MP-ALIPAY": function(t2) { return UNIT_CONVERSION(t2) * getPixelRatio(); }, "MP-WEIXIN": function(t2) { return UNIT_CONVERSION(t2); }, "MP-BAIDU": function(t2) { return UNIT_CONVERSION(t2); }, "MP-TOUTIAO": function(t2) { return UNIT_CONVERSION(t2); }, "MP-QQ": function(t2) { return UNIT_CONVERSION(t2); }, "MP-LARK": function(t2) { return UNIT_CONVERSION(t2); }, "MP-KUAISHOU": function(t2) { return UNIT_CONVERSION(t2); }, "MP-360": function(t2) { return UNIT_CONVERSION(t2); }, "QUICKAPP-WEBVIEW": function(t2) { return UNIT_CONVERSION(t2); }, "QUICKAPP-WEBVIEW-UNION": function(t2) { return UNIT_CONVERSION(t2); }, "QUICKAPP-WEBVIEW-HUAWEI": function(t2) { return UNIT_CONVERSION(t2); }, MP: function(t2) { return UNIT_CONVERSION(t2); }, "APP-PLUS": function(t2) { return UNIT_CONVERSION(t2); }, NVUE: function(t2) { return UNIT_CONVERSION(t2); }, H5: function(t2) { return UNIT_CONVERSION(t2); }, none: function(t2) { return UNIT_CONVERSION(t2); } }, UtF16TO8 = function(t2) { for (var e2, i2 = t2.toString(), r2 = "", o2 = 0; o2 < i2.length; o2++) 1 <= (e2 = i2.charCodeAt(o2)) && e2 <= 127 ? r2 += i2.charAt(o2) : (2047 < e2 ? (r2 += String.fromCharCode(224 | e2 >> 12 & 15), r2 += String.fromCharCode(128 | e2 >> 6 & 63)) : r2 += String.fromCharCode(192 | e2 >> 6 & 31), r2 += String.fromCharCode(128 | e2 >> 0 & 63)); return r2; }, SaveCodeImg = function(t2) { var i2 = UNIT_CONVERSION(Number(t2.width)), r2 = UNIT_CONVERSION(Number(t2.height)), e2 = getPixelRatio("pixelRatio"), o2 = i2 * e2, s2 = r2 * e2; return "MP-ALIPAY" == t2.source && (i2 = o2, r2 = s2), formatAppLog("log", "at uni_modules/wmf-code/js_sdk/index.js:1", i2, r2), new Promise(function(e3) { "[object String]" == Object.prototype.toString.call(t2.id) ? uni.canvasToTempFilePath({ canvasId: t2.id, width: i2, height: r2, destWidth: o2, destHeight: s2, fileType: t2.type || "jpg", quality: t2.quality || 1, complete: function(t3) { e3(t3); } }, t2.ctx) : "[object Object]" == Object.prototype.toString.call(t2.id) && t2.id.toTempFilePath(0, 0, i2, r2, o2, s2, t2.type || "png", 1, function(t3) { e3(t3); }); }); }, SetGradient = function(t2, e2, i2, r2) { i2 = t2.createLinearGradient(0, 0, e2, i2); return 1 === r2.length && (i2.addColorStop(0, r2[0]), i2.addColorStop(1, r2[0])), 2 === r2.length && (i2.addColorStop(0, r2[0]), i2.addColorStop(1, r2[1])), 3 === r2.length && (i2.addColorStop(0, r2[0]), i2.addColorStop(0.5, r2[1]), i2.addColorStop(1, r2[2])), 4 === r2.length && (i2.addColorStop(0, r2[0]), i2.addColorStop(0.35, r2[1]), i2.addColorStop(0.7, r2[2]), i2.addColorStop(1, r2[3])), 5 === r2.length && (i2.addColorStop(0, r2[0]), i2.addColorStop(0.35, r2[1]), i2.addColorStop(0.6, r2[2]), i2.addColorStop(0.8, r2[3]), i2.addColorStop(1, r2[4])), 6 === r2.length && (i2.addColorStop(0, r2[0]), i2.addColorStop(0.25, r2[1]), i2.addColorStop(0.45, r2[2]), i2.addColorStop(0.65, r2[3]), i2.addColorStop(0.85, r2[4]), i2.addColorStop(1, r2[5])), 7 === r2.length && (i2.addColorStop(0, r2[0]), i2.addColorStop(0.15, r2[1]), i2.addColorStop(0.35, r2[2]), i2.addColorStop(0.45, r2[3]), i2.addColorStop(0.65, r2[4]), i2.addColorStop(0.85, r2[5]), i2.addColorStop(1, r2[6])), 8 === r2.length && (i2.addColorStop(0, r2[0]), i2.addColorStop(0.1, r2[1]), i2.addColorStop(0.25, r2[2]), i2.addColorStop(0.45, r2[3]), i2.addColorStop(0.65, r2[4]), i2.addColorStop(0.85, r2[5]), i2.addColorStop(0.9, r2[6]), i2.addColorStop(1, r2[7])), 9 === r2.length && (i2.addColorStop(0, r2[0]), i2.addColorStop(0.2, r2[1]), i2.addColorStop(0.3, r2[2]), i2.addColorStop(0.5, r2[3]), i2.addColorStop(0.6, r2[4]), i2.addColorStop(0.7, r2[5]), i2.addColorStop(0.8, r2[6]), i2.addColorStop(0.9, r2[7]), i2.addColorStop(1, r2[8])), 10 <= r2.length && (i2.addColorStop(0, r2[0]), i2.addColorStop(0.1, r2[1]), i2.addColorStop(0.2, r2[2]), i2.addColorStop(0.3, r2[3]), i2.addColorStop(0.4, r2[4]), i2.addColorStop(0.5, r2[5]), i2.addColorStop(0.6, r2[6]), i2.addColorStop(0.7, r2[7]), i2.addColorStop(0.85, r2[8]), i2.addColorStop(1, r2[9])), i2; }, StringToCode128 = function(t2) { var s2 = { currcs: 5 }, e2 = GetBytes(t2), i2 = 126 == e2[0] ? 1 : 0, t2 = 0 < e2.length ? CodeSetAllowedFor(e2[i2++]) : 2, i2 = 0 < e2.length ? CodeSetAllowedFor(e2[i2++]) : 2; s2.currcs = getBestStartSet(t2, i2), s2.currcs = function(t3, e3) { for (var i3 = 0; i3 < t3.length; i3++) { var r3 = t3[i3]; if ((r3 < 48 || 57 < r3) && 126 != r3) return e3; } return 5; }(e2, s2.currcs); var r2 = []; switch (s2.currcs) { case 3: r2.push(103); break; case 4: r2.push(104); break; default: r2.push(105); } for (var o2 = 0; o2 < e2.length; o2++) { var n2 = e2[o2]; n2 in REPLACE_CODES && (r2.push(REPLACE_CODES[n2]), n2 = e2[++o2]); var h2 = e2.length > o2 + 1 ? e2[o2 + 1] : -1, r2 = r2.concat(function(t3, e3, i3) { var r3 = [], o3 = -1; if (charCompatible(t3, i3)) 5 == i3 && (-1 == e3 ? (o3 = 100, i3 = 4) : charCompatible(e3, i3) || (i3 = charCompatible(e3, 3) ? (o3 = 101, 3) : (o3 = 100, 4))); else if (-1 == e3 || charCompatible(e3, i3)) o3 = 98; else switch (i3) { case 3: o3 = 100, i3 = 4; break; case 4: o3 = 101, i3 = 3; } return -1 != o3 ? (r3.push(o3), r3.push(codeValue(t3))) : 5 == i3 ? r3.push(codeValue(t3, e3)) : r3.push(codeValue(t3)), s2.currcs = i3, r3; }(n2, h2, s2.currcs)); 5 == s2.currcs && o2++; } for (var a2 = r2[0], l2 = 1; l2 < r2.length; l2++) a2 += l2 * r2[l2]; return r2.push(a2 % 103), r2.push(106), r2; }, GetBytes = function(t2) { for (var e2 = [], i2 = 0; i2 < t2.length; i2++) e2.push(t2.charCodeAt(i2)); return e2; }, CodeSetAllowedFor = function(t2) { return 48 <= t2 && t2 <= 57 ? 1 : 32 <= t2 && t2 <= 95 ? 2 : t2 < 32 ? 3 : 4; }, getBestStartSet = function(t2, e2) { var i2 = 0; return i2 += 3 == t2 ? 1 : 0, i2 += 4 == t2 ? -1 : 0, i2 += 3 == e2 ? 1 : 0, 0 < (i2 += 4 == e2 ? -1 : 0) ? 3 : 4; }, codeValue = function(t2, e2) { return void 0 === e2 ? 32 <= t2 ? t2 - 32 : t2 + 64 : parseInt(String.fromCharCode(t2) + String.fromCharCode(e2)); }, charCompatible = function(t2, e2) { t2 = codeSetAllowedFor(t2); return 1 == t2 || (2 == t2 || (3 == t2 && 3 == e2 || 4 == t2 && 4 == e2)); }, codeSetAllowedFor = function(t2) { return 48 <= t2 && t2 <= 57 ? 1 : 32 <= t2 && t2 <= 95 ? 2 : t2 < 32 ? 3 : 4; }, REPLACE_CODES = { CHAR_TILDE: 102 }, BarCode128 = StringToCode128, OperationCode = function(t2, e2) { var i2, r2; t2.code ? t2.id ? (r2 = (/* @__PURE__ */ new Date()).getTime(), "[object String]" == Object.prototype.toString.call(t2.id) ? (i2 = uni.createCanvasContext(t2.id, t2.ctx || null), BarCodeCanvas(r2, t2, i2, e2)) : "[object Object]" == Object.prototype.toString.call(t2.id) && (i2 = t2.id, BarCodeCanvas(r2, t2, i2, e2))) : formatAppLog("warn", "at uni_modules/wmf-code/js_sdk/index.js:1", "没有找到条形码canvas id或者实列!") : formatAppLog("warn", "at uni_modules/wmf-code/js_sdk/index.js:1", "没有找到条形码code"); }, BarCodeCanvas = function(t2, e2, i2, r2) { var o2 = e2.text ? (e2.text.size || 40) + (e2.text.padding || 20) : 0, s2 = GETSIZE[e2.source || "none"](e2.width), n2 = GETSIZE[e2.source || "none"](e2.height), h2 = UtF16TO8(e2.code); i2.setFillStyle(e2.bgColor || "#FFFFFF"), "horizontal" == e2.orient ? i2.fillRect(0, 0, s2, GETSIZE[e2.source || "none"](e2.height + o2)) : i2.fillRect(0, 0, GETSIZE[e2.source || "none"](e2.height + o2), s2), i2.setFillStyle(e2.bgColor || "#FFFFFF"); o2 = new GraphicContentInit(i2, s2, n2); e2.color ? SetBarCodeColors(i2, s2, n2, e2.color || ["#000000"], e2.orient) : i2.setFillStyle("#000000"), SetBarCodeType[e2.type || "CODE128"](h2, o2, n2, e2.orient, e2.text), e2.text && setBarCodeText(i2, e2.text, s2, n2, e2.source || "H5", e2.orient || "horizontal"), starDraw$1(i2, e2, t2, r2); }, starDraw$1 = function(t2, s2, n2, h2) { var e2 = this; setTimeout(function() { t2.draw(false, function(o2) { return __awaiter(e2, void 0, void 0, function() { var e3, i2, r2; return __generator(this, function(t3) { switch (t3.label) { case 0: return h2 ? (e3 = h2, i2 = [__assign({}, o2)], r2 = { createTime: getTimeDate(), takeUpTime: (/* @__PURE__ */ new Date()).getTime() - n2 }, [4, SaveCodeImg({ width: "vertical" == s2.orient ? s2.height : s2.width, height: "vertical" == s2.orient ? s2.width : s2.height, id: s2.id, source: s2.source, ctx: s2.ctx || null })]) : [3, 2]; case 1: return e3.apply(void 0, [__assign.apply(void 0, i2.concat([(r2.img = t3.sent(), r2.model = getPixelRatio("model"), r2.system = getPixelRatio("system"), r2.platform = getPixelRatio("platform"), r2.code = s2.code, r2.source = s2.source, r2.with = UNIT_CONVERSION(s2.width), r2.height = UNIT_CONVERSION(s2.height), r2.id = "[object String]" == Object.prototype.toString.call(s2.id) ? s2.id : "nvue", r2)]))]), [3, 3]; case 2: t3.label = 3; case 3: return [2]; } }); }); }); }); }, SetBarCodeColors = function(t2, e2, i2, r2, o2) { r2 = SetGradient(t2, "vertical" == (o2 = void 0 === o2 ? "horizontal" : o2) ? i2 : e2, "vertical" == o2 ? e2 : i2, r2); t2.setFillStyle(r2); }, setBarCodeText = function(t2, e2, i2, r2, o2, s2) { var n2 = e2.color || ["#000000"], h2 = SetGradient(t2, i2, r2, n2); t2.setGlobalAlpha((null == e2 ? void 0 : e2.opacity) || 1), t2.setTextAlign("center"), t2.setTextBaseline("middle"), t2.setFillStyle("#000000"), t2.setFontSize(UNIT_CONVERSION(e2.size || 40)), "H5" == o2 ? t2.setFillStyle(h2) : t2.setFillStyle(n2[0]); n2 = "bottom" == e2.position ? r2 + UNIT_CONVERSION((e2.padding || 40) + (e2.size || 20) / 2) : UNIT_CONVERSION(e2.size) / 2; "vertical" == s2 ? (t2.rotate(90 * Math.PI / 180), "bottom" == e2.position ? (t2.translate(i2, -r2), t2.fillText(e2.content, -i2 / 2, -UNIT_CONVERSION(e2.padding || 20 + (e2.size || 40) / 2))) : (t2.translate(-i2 / 2, -n2), t2.fillText(e2.content, i2, -n2))) : t2.fillText(e2.content, i2 / 2, n2), t2.setGlobalAlpha(1); }, SetBarCodeType = { CODE128: function(t2, e2, i2, r2, o2) { void 0 === r2 && (r2 = "horizontal"); var s2 = BarCode128(t2), n2 = e2.area.width / (11 * (s2.length - 3) + 35), h2 = e2.area.left, t2 = 0; o2 && "bottom" != o2.position && (t2 = UNIT_CONVERSION(((null == o2 ? void 0 : o2.size) || 40) + ((null == o2 ? void 0 : o2.padding) || 20))); for (var a2 = e2.area.top + t2, l2 = i2 - e2.area.top, c2 = 0; c2 < s2.length; c2++) for (var d2 = s2[c2], f2 = 0; f2 < 8; f2 += 2) { var u2 = PATTERNS[d2][f2] * n2, p2 = PATTERNS[d2][f2 + 1] * n2; 0 < u2 && e2.fillFgRect("vertical" == r2 ? a2 : h2, "vertical" == r2 ? h2 : a2, "vertical" == r2 ? l2 : u2, "vertical" == r2 ? u2 : l2), h2 += u2 + p2; } }, CODE39: function(t2, e2, i2) { formatAppLog("error", "at uni_modules/wmf-code/js_sdk/index.js:1", "条形码编码类型:CODE39暂未实现"); }, EAN13: function(t2, e2, i2) { -1 !== t2.search(/^[0-9]{12}$/) ? formatAppLog("error", "at uni_modules/wmf-code/js_sdk/index.js:1", "条形码编码类型:EAN暂未实现") : formatAppLog("error", "at uni_modules/wmf-code/js_sdk/index.js:1", "条形码编码:code不符合EAN13规范"); }, UPCE: function(t2, e2, i2) { -1 !== t2.search(/^[0-9]{6}$/) ? formatAppLog("error", "at uni_modules/wmf-code/js_sdk/index.js:1", "条形码编码类型:EAN暂未实现") : formatAppLog("error", "at uni_modules/wmf-code/js_sdk/index.js:1", "条形码编码:code不符合UPCE规范"); }, UPC: function(t2, e2, i2) { -1 !== t2.search(/^[0-9]{1}$/) ? formatAppLog("error", "at uni_modules/wmf-code/js_sdk/index.js:1", "条形码编码类型:EAN暂未实现") : formatAppLog("error", "at uni_modules/wmf-code/js_sdk/index.js:1", "条形码编码:code不符合UPC规范"); }, ITF: function(t2, e2, i2) { -1 !== t2.search(/^([0-9]{2})+$/) ? formatAppLog("error", "at uni_modules/wmf-code/js_sdk/index.js:1", "条形码编码类型:ITF暂未实现") : formatAppLog("error", "at uni_modules/wmf-code/js_sdk/index.js:1", "条形码编码:code不符合ITF规范"); }, ITF14: function(t2, e2, i2) { -1 !== t2.search(/^[0-9]{14}$/) ? formatAppLog("error", "at uni_modules/wmf-code/js_sdk/index.js:1", "条形码编码类型:ITF14暂未实现") : formatAppLog("error", "at uni_modules/wmf-code/js_sdk/index.js:1", "条形码编码:code不符合ITF14规范"); }, MSI: function(t2, e2, i2) { -1 !== t2.search(/^[0-9]+$/) ? formatAppLog("error", "at uni_modules/wmf-code/js_sdk/index.js:1", "条形码编码类型:MSI暂未实现") : formatAppLog("error", "at uni_modules/wmf-code/js_sdk/index.js:1", "条形码编码:code不符合MSI规范"); }, Codabar: function(t2, e2, i2) { -1 !== t2.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/) ? formatAppLog("error", "at uni_modules/wmf-code/js_sdk/index.js:1", "条形码编码类型:Codabar暂未实现") : formatAppLog("error", "at uni_modules/wmf-code/js_sdk/index.js:1", "条形码编码:code不符合Codabar规范"); }, Pharmacode: function(t2, e2, i2) { !isNaN(parseInt(t2, 10)) && 3 <= Number(t2) && Number(t2) <= 131070 ? formatAppLog("error", "at uni_modules/wmf-code/js_sdk/index.js:1", "条形码编码类型:Pharmacode暂未实现") : formatAppLog("error", "at uni_modules/wmf-code/js_sdk/index.js:1", "条形码编码:code不符合Pharmacode类型"); } }, GraphicContentInit = function() { function t2(t3, e2, i2) { this.borderSize = 0, this.paddingWidth = 0, this.ctx = t3, this.width = e2, this.height = i2, this.quiet = Math.round(this.width / 40), this.area = { width: e2 - 2 * this.paddingWidth - 2 * this.quiet, height: i2 - 2 * this.borderSize, top: this.borderSize - 4, left: this.borderSize + this.quiet }, this.fillBgRect(0, 0, e2, i2), this.fillBgRect(0, this.borderSize, e2, i2 - 2 * this.borderSize); } return t2.prototype.fillFgRect = function(t3, e2, i2, r2) { this.FILLRECT(t3, e2, i2, r2); }, t2.prototype.fillBgRect = function(t3, e2, i2, r2) { this.FILLRECT(t3, e2, i2, r2); }, t2.prototype.FILLRECT = function(t3, e2, i2, r2) { this.ctx.fillRect(t3, e2, i2, r2); }, t2; }(), BarCode = OperationCode, GetImg = SaveCodeImg, GetPixelRatio = getPixelRatio, GetPx = UNIT_CONVERSION; function isArray(arr) { return Object.prototype.toString.call(arr) === "[object Array]"; } function deepClone(obj) { if ([null, void 0, NaN, false].includes(obj)) return obj; if (typeof obj !== "object" && typeof obj !== "function") { return obj; } var o2 = isArray(obj) ? [] : {}; for (let i2 in obj) { if (obj.hasOwnProperty(i2)) { o2[i2] = typeof obj[i2] === "object" ? deepClone(obj[i2]) : obj[i2]; } } return o2; } function getUUid(len2 = 32, firstU = true, radix = null) { let chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""); let uuid = []; radix = radix || chars.length; if (len2) { for (let i2 = 0; i2 < len2; i2++) uuid[i2] = chars[0 | Math.random() * radix]; } else { let r2; uuid[8] = uuid[13] = uuid[18] = uuid[23] = "-"; uuid[14] = "4"; for (let i2 = 0; i2 < 36; i2++) { if (!uuid[i2]) { r2 = 0 | Math.random() * 16; uuid[i2] = chars[i2 == 19 ? r2 & 3 | 8 : r2]; } } } if (firstU) { uuid.shift(); return "u" + uuid.join(""); } else { return uuid.join(""); } } function platform() { let val = null; val = "VUE3"; val = "APP-PLUS"; return val; } const _sfc_main$7 = { __name: "w-barcode", props: { options: { type: Object, required: true, default: () => { return {}; } } }, emits: ["generate", "press", "error"], setup(__props, { expose, emit: emits }) { const props = __props; const opt = props.options; const that = vue.getCurrentInstance(); const HSize = opt.text ? opt.text.size || 40 + opt.text.padding || 20 : 0; let info = vue.reactive({ id: getUUid(), destWidth: GetPixelRatio() * GetPx(opt.width) + "px", destHeight: GetPixelRatio() * GetPx(opt.height + HSize) + "px", width: GetPx(opt.width) + "px", height: GetPx(opt.height + HSize) + "px", orient: opt.orient || "horizontal", listCode: [] }); vue.onMounted(() => { SpecialTreatment(opt); vue.nextTick(() => { generateCode(opt); }); }); vue.watch(() => props.options, (val) => { SpecialTreatment(val); const HSize2 = val.text ? val.text.size || 40 + val.text.padding || 20 : 0; info.destWidth = GetPixelRatio() * GetPx(val.width) + "px", info.destHeight = GetPixelRatio() * GetPx(val.height + HSize2) + "px", info.orient = val.orient || "horizontal", info.width = GetPx(val.width) + "px", info.height = GetPx(val.height + HSize2) + "px", setTimeout(() => { generateCode(val); }, 100); }, { deep: true }); const generateCode = (val) => { try { const parameter = { ...val, orient: info.orient, source: platform(), id: info.id, ctx: that }; BarCode(parameter, (res) => { emits("generate", res); }); } catch (err) { formatAppLog("warn", "at uni_modules/wmf-code/components/w-barcode/w-barcode.vue:81", err); } }; const GetCodeImg = async () => { try { return await GetImg({ id: info.id, source: platform(), width: opt.orient == "vertical" ? opt.height : opt.width, height: opt.orient == "vertical" ? opt.width : opt.height, ctx: that }); } catch (e2) { formatAppLog("warn", "at uni_modules/wmf-code/components/w-barcode/w-barcode.vue:86", e2); } }; const SpecialTreatment = (val) => { let obj = deepClone(val); obj.id = info.id; info.listCode = [obj]; }; const longtap = (e2) => { emits("press", e2); }; const handleError = (e2) => { emits("error", e2.detail); }; expose({ GetCodeImg }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("view", { onLongtap: vue.withModifiers(longtap, ["stop"]) }, [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList(vue.unref(info).listCode, (item) => { return vue.openBlock(), vue.createElementBlock("canvas", { width: vue.unref(info).orient == "vertical" ? vue.unref(info).destHeight : vue.unref(info).destWidth, height: vue.unref(info).orient == "vertical" ? vue.unref(info).destWidth : vue.unref(info).destHeight, "canvas-id": item.id, id: item.id, style: vue.normalizeStyle({ width: vue.unref(info).orient == "vertical" ? vue.unref(info).height : vue.unref(info).width, height: vue.unref(info).orient == "vertical" ? vue.unref(info).width : vue.unref(info).height }), key: item.id, onError: handleError }, null, 44, ["width", "height", "canvas-id", "id"]); }), 128 /* KEYED_FRAGMENT */ )) ], 40, ["onLongtap"]); }; } }; const __easycom_1 = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__file", "/Users/sunwubin/source/pharmacy/uni_modules/wmf-code/components/w-barcode/w-barcode.vue"]]); const __default__$2 = { name: "" }; const _sfc_main$6 = /* @__PURE__ */ Object.assign(__default__$2, { setup(__props) { vue.ref(11220822134401); const preseObj = vue.ref({ code: "", color: ["#000"], // 条形码的颜色 bgColor: "#FFFFFF", // 背景色 width: 200, // 宽度 height: 50 // 高度 }); vue.ref({ width: 112.5, height: 112.5, border: { color: "#DDDDDD", width: 1, style: "solid", radius: "4px" } }); vue.ref([]); vue.ref({ height: 80, displayValue: false }); const v2 = vue.ref({ preNo: "11220822134401", presType: "普通处方", name: "李某", sex: "男", age: 35, contactNumber: "13888888888", status: "发药", department: "中医内科", disName: "胃脘痛病", symName: "脾胃虚寒证", prescriptionTime: "2023-06-01 15:58", address: "浙江省某某事某某去某某事中医院门诊楼三楼302是", rp: [ { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "" } ], number: 3, pies_tips: "待见", dosageForm: "汤剂", prescriptionUsage: "煎服", concentration: "200ml", frequency: "一日三次", medicationTime: "饭后服", entrust: "注意多休息,饮食清单。", prescriptionSum: "187.00", daijianCost: "30.00", distributionCost: "10.00", prescriptionTotleSum: "227.00", yljgName: "杭州某某高级中医院", operateList: [ { py: "kf", title: "开方", operater: "" }, { py: "sh", title: "审核", operater: "" }, { py: "tp", title: "调配", operater: "" }, { py: "fh", title: "复核", operater: "" }, { py: "jp", title: "浸泡", operater: "" }, { py: "jz", title: "煎煮", operater: "" }, { py: "db", title: "打包", operater: "" }, { py: "fy", title: "发药", operater: "" } ], // extra_doc:'A医生', // check_doc:'B医生', // depoly:'调陪人', // review:'复核人', // steep:'浸泡', // cook:'煎煮人', // pack:'大宝人', // dispen:'发药人', // }, entrust1111: "1、本处方当日有效\n 2、取药时请您当面核对。。。。 \n 3、延长处方用量时间原油:慢性病 其他老年病 外地 其他" }); vue.onMounted(() => { }); onLoad(async (options) => { formatAppLog("log", "at pages/detail/detail.vue:235", "options", options); uni.getStorageSync("userId"); const params2 = { token: uni.getStorageSync("token"), data: { id: options.id || "", preNo: options.preId || "", depolyStatus: options.depolyStatus || "" } }; formatAppLog("log", "at pages/detail/detail.vue:245", "params", params2); const { data: res } = await selectOrderDetail(params2); if (res.code === 200) { v2.prescriptionTime = res.data.prescriptionTime, v2.value.name = res.data.name, v2.value.sex = res.data.sex, v2.value.age = res.data.age, v2.value.contactNumber = res.data.contactNumber; v2.value.address = res.data.address; v2.value.concentration = res.data.concentration; v2.value.frequency = res.data.frequency; v2.value.medicationTime = res.data.medicationTime; v2.value.disName = res.data.disName, v2.value.symName = res.data.symName, v2.value.preNo = res.data.preNo, formatAppLog("log", "at pages/detail/detail.vue:263", "onLoad v.value.preNo", v2.value.preNo); preseObj.value.code = v2.value.preNo; v2.value.department = res.data.department, v2.value.dosageForm = res.data.dosageForm, v2.value.prescriptionUsage = res.data.prescriptionUsage, v2.value.number = res.data.number, v2.value.prescriptionSum = res.data.prescriptionSum, v2.value.prescriptionTotalSum = res.data.prescriptionTotalSum, v2.value.daijianCost = res.data.daijianCost, v2.value.distributionCost = res.data.distributionCost, v2.value.prescriptionTotleSum = res.data.prescriptionTotleSum, v2.value.entrust = res.data.entrust, v2.value.rp = res.data.detailList; v2.value.yljgName = res.data.yljgName || ""; v2.value.status = res.data.status, formatAppLog("log", "at pages/detail/detail.vue:281", "res.data.status", res.data.status); switch (res.data.status) { case "1": v2.value.status = "配药"; break; case "2": v2.value.status = "煎药"; break; case "3": v2.value.status = "发药"; break; case "4": v2.value.status = "配送"; break; case "5": v2.value.status = "已分配"; break; case "6": v2.value.status = "已传送"; break; default: v2.value.status = "配药"; } v2.value.operateList[0].operater = res.data.doctor || ""; v2.value.operateList[1].operater = res.data.checkBy || ""; v2.value.operateList[2].operater = res.data.tiaopeiName || ""; const length = res.data.operateList; if (length > 0) { res.data.operateList.forEach((item) => { switch (item.type) { case "2": v2.value.operateList[3].operater = item.createBy; break; case "3": v2.value.operateList[4].operater = item.createBy; break; case "4": v2.value.operateList[5].operater = item.createBy; break; case "5": v2.value.operateList[6].operater = item.createBy; break; case "6": v2.value.operateList[7].operater = item.createBy; break; } }); } } }); const handleBack = () => { uni.navigateBack({ delta: 1 }); }; return (_ctx, _cache) => { const _component_uni_nav_bar = resolveEasycom(vue.resolveDynamicComponent("uni-nav-bar"), __easycom_0); const _component_w_barcode = resolveEasycom(vue.resolveDynamicComponent("w-barcode"), __easycom_1); const _component_uni_tag = resolveEasycom(vue.resolveDynamicComponent("uni-tag"), __easycom_2); return vue.openBlock(), vue.createElementBlock("view", { class: "main" }, [ vue.createVNode(_component_uni_nav_bar, { dark: "", fixed: true, "background-color": "#18C7B0", "status-bar": "", "left-icon": "left", height: "62.5rpx", width: "750rpx", title: "处方详情", onClickLeft: handleBack }), vue.createElementVNode("view", { class: "content" }, [ vue.createElementVNode("view", { class: "header" }, [ vue.createElementVNode("view", { class: "ti" }, [ vue.createElementVNode("view", { class: "left" }, [ vue.createElementVNode("view", { class: "baracode" }, [ vue.createVNode(_component_w_barcode, { options: preseObj.value }, null, 8, ["options"]), vue.createElementVNode( "view", { class: "barnum" }, vue.toDisplayString(v2.value.preNo), 1 /* TEXT */ ) ]) ]), vue.createElementVNode("view", { class: "mid" }, [ vue.createElementVNode("text", { class: "title" }, "中药处方笺") ]), vue.createElementVNode("view", { class: "rig" }, [ vue.createElementVNode( "text", { class: "title" }, vue.toDisplayString(v2.value.type == "1" ? "中药处方" : v2.value.type == "1" ? "中药制剂" : ""), 1 /* TEXT */ ) ]) ]), vue.createElementVNode("view", { class: "patiinfo" }, [ vue.createElementVNode("view", { class: "r1" }, [ vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "姓名:"), vue.createTextVNode( vue.toDisplayString(v2.value.name), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "性别:"), vue.createTextVNode( vue.toDisplayString(v2.value.sex), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "年龄:"), vue.createTextVNode( vue.toDisplayString(v2.value.age) + "岁", 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "电话:"), vue.createTextVNode( vue.toDisplayString(v2.value.contactNumber), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "当前处方状态:"), vue.createTextVNode( vue.toDisplayString(v2.value.state == "1" ? "配药" : v2.value.state == "2" ? "煎药" : v2.value.state == "3" ? "发药" : v2.value.state == "4" ? "配送" : ""), 1 /* TEXT */ ) ]) ]), vue.createElementVNode("view", { class: "r2" }, [ vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "就诊科室:"), vue.createTextVNode( vue.toDisplayString(v2.value.department), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "临床诊断:"), vue.createTextVNode( vue.toDisplayString(v2.value.disName) + "—" + vue.toDisplayString(v2.value.symName), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "开方时间:"), vue.createTextVNode( vue.toDisplayString(v2.value.prescriptionTime), 1 /* TEXT */ ) ]) ]), vue.createElementVNode("view", { class: "r3" }, [ vue.createElementVNode("span", { class: "we" }, "联系地址:"), vue.createTextVNode( vue.toDisplayString(v2.value.address), 1 /* TEXT */ ) ]) ]) ]), vue.createElementVNode("view", { class: "rp" }, [ vue.createElementVNode("view", { class: "title" }, [ vue.createElementVNode("text", { class: "text" }, "Rp:") ]), vue.createElementVNode("view", { class: "lists" }, [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList(v2.value.rp, (x2, i2) => { return vue.openBlock(), vue.createElementBlock("view", { class: "item", key: i2 }, [ vue.createElementVNode("view", { class: "le tag-view" }, [ vue.createVNode(_component_uni_tag, { text: x2.matName + x2.matDose + x2.matUnitName }, null, 8, ["text"]) ]), vue.createElementVNode("view", { class: "rig" }, [ vue.createElementVNode( "view", { class: "up" }, vue.toDisplayString(x2.matUsageName), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "do" }, vue.toDisplayString(x2.sign), 1 /* TEXT */ ) ]) ]); }), 128 /* KEYED_FRAGMENT */ )) ]), vue.createElementVNode("view", { class: "footer" }, [ vue.createElementVNode("view", { class: "js" }, [ vue.createTextVNode( " 剂数:" + vue.toDisplayString(v2.value.number) + " ", 1 /* TEXT */ ), v2.value.daijianCost !== "" ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "pies_tips" }, " (代煎) ")) : vue.createCommentVNode("v-if", true) ]), vue.createElementVNode( "view", { class: "js" }, vue.toDisplayString(v2.value.dosageForm), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "js" }, vue.toDisplayString(v2.value.prescriptionUsage), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "js" }, "每次" + vue.toDisplayString(v2.value.concentration), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "js" }, vue.toDisplayString(v2.value.frequency), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "freque" }, vue.toDisplayString(v2.value.medicationTime), 1 /* TEXT */ ) ]), vue.createElementVNode( "view", { class: "rp-tips" }, vue.toDisplayString(v2.value.entrust), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "amountarea" }, [ vue.createElementVNode("view", { class: "amount" }, [ vue.createElementVNode("view", { class: "r1" }, [ vue.createElementVNode( "view", { class: "pijw" }, "药品金额:" + vue.toDisplayString(v2.value.prescriptionSum), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "r2" }, [ vue.createElementVNode( "view", { class: "jyf" }, "煎药费:" + vue.toDisplayString(v2.value.daijianCost), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "psf" }, "配送费:" + vue.toDisplayString(v2.value.distributionCost), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "r3" }, [ vue.createTextVNode( " 总金额:" + vue.toDisplayString(v2.value.prescriptionTotalSum) + " ", 1 /* TEXT */ ), vue.createCommentVNode(' ') ]) ]), vue.createElementVNode("view", { class: "service" }, [ vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "开方:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[0].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "审核:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[1].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "调配:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[2].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "复核:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[3].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "浸泡:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[4].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "煎煮:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[5].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "打包:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[6].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "发药:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[7].operater || ""), 1 /* TEXT */ ) ]) ]) ]), vue.createElementVNode("view", { class: "comment" }, [ vue.createElementVNode("view", { class: "z" }, "注:"), vue.createElementVNode( "text", null, vue.toDisplayString(v2.value.entrust1111), 1 /* TEXT */ ) ]) ]) ]); }; } }); const PagesDetailDetail = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "/Users/sunwubin/source/pharmacy/pages/detail/detail.vue"]]); const pages = [ { path: "pages/login/login", style: { navigationBarTitleText: "", enablePullDownRefresh: false, navigationStyle: "custom" } }, { path: "pages/index/index", style: { navigationStyle: "custom" } }, { path: "pages/detail/detail", style: { navigationBarTitleText: "调配详情", navigationStyle: "custom", enablePullDownRefresh: false } }, { path: "pages/edit/edit", style: { navigationBarTitleText: "", navigationStyle: "custom", enablePullDownRefresh: false } }, { path: "pages/review/review", style: { navigationBarTitleText: "", enablePullDownRefresh: false, navigationStyle: "custom" } } ]; const globalStyle = { navigationBarTextStyle: "black", navigationBarTitleText: "中药处方煎配", navigationBarBackgroundColor: "#F8F8F8", backgroundColor: "#F8F8F8", rpxCalcMaxDeviceWidth: 0, rpxCalcBaseDeviceWidth: 686 }; const uniIdRouter = {}; const t$1 = { pages, globalStyle, uniIdRouter }; function n(e2) { return e2 && e2.__esModule && Object.prototype.hasOwnProperty.call(e2, "default") ? e2.default : e2; } function s(e2, t2, n2) { return e2(n2 = { path: t2, exports: {}, require: function(e3, t3) { return function() { throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs"); }(null == t3 && n2.path); } }, n2.exports), n2.exports; } var r = s(function(e2, t2) { var n2; e2.exports = (n2 = n2 || function(e3, t3) { var n3 = Object.create || function() { function e4() { } return function(t4) { var n4; return e4.prototype = t4, n4 = new e4(), e4.prototype = null, n4; }; }(), s2 = {}, r2 = s2.lib = {}, i2 = r2.Base = { extend: function(e4) { var t4 = n3(this); return e4 && t4.mixIn(e4), t4.hasOwnProperty("init") && this.init !== t4.init || (t4.init = function() { t4.$super.init.apply(this, arguments); }), t4.init.prototype = t4, t4.$super = this, t4; }, create: function() { var e4 = this.extend(); return e4.init.apply(e4, arguments), e4; }, init: function() { }, mixIn: function(e4) { for (var t4 in e4) e4.hasOwnProperty(t4) && (this[t4] = e4[t4]); e4.hasOwnProperty("toString") && (this.toString = e4.toString); }, clone: function() { return this.init.prototype.extend(this); } }, o2 = r2.WordArray = i2.extend({ init: function(e4, n4) { e4 = this.words = e4 || [], this.sigBytes = n4 != t3 ? n4 : 4 * e4.length; }, toString: function(e4) { return (e4 || c2).stringify(this); }, concat: function(e4) { var t4 = this.words, n4 = e4.words, s3 = this.sigBytes, r3 = e4.sigBytes; if (this.clamp(), s3 % 4) for (var i3 = 0; i3 < r3; i3++) { var o3 = n4[i3 >>> 2] >>> 24 - i3 % 4 * 8 & 255; t4[s3 + i3 >>> 2] |= o3 << 24 - (s3 + i3) % 4 * 8; } else for (i3 = 0; i3 < r3; i3 += 4) t4[s3 + i3 >>> 2] = n4[i3 >>> 2]; return this.sigBytes += r3, this; }, clamp: function() { var t4 = this.words, n4 = this.sigBytes; t4[n4 >>> 2] &= 4294967295 << 32 - n4 % 4 * 8, t4.length = e3.ceil(n4 / 4); }, clone: function() { var e4 = i2.clone.call(this); return e4.words = this.words.slice(0), e4; }, random: function(t4) { for (var n4, s3 = [], r3 = function(t5) { t5 = t5; var n5 = 987654321, s4 = 4294967295; return function() { var r4 = ((n5 = 36969 * (65535 & n5) + (n5 >> 16) & s4) << 16) + (t5 = 18e3 * (65535 & t5) + (t5 >> 16) & s4) & s4; return r4 /= 4294967296, (r4 += 0.5) * (e3.random() > 0.5 ? 1 : -1); }; }, i3 = 0; i3 < t4; i3 += 4) { var a3 = r3(4294967296 * (n4 || e3.random())); n4 = 987654071 * a3(), s3.push(4294967296 * a3() | 0); } return new o2.init(s3, t4); } }), a2 = s2.enc = {}, c2 = a2.Hex = { stringify: function(e4) { for (var t4 = e4.words, n4 = e4.sigBytes, s3 = [], r3 = 0; r3 < n4; r3++) { var i3 = t4[r3 >>> 2] >>> 24 - r3 % 4 * 8 & 255; s3.push((i3 >>> 4).toString(16)), s3.push((15 & i3).toString(16)); } return s3.join(""); }, parse: function(e4) { for (var t4 = e4.length, n4 = [], s3 = 0; s3 < t4; s3 += 2) n4[s3 >>> 3] |= parseInt(e4.substr(s3, 2), 16) << 24 - s3 % 8 * 4; return new o2.init(n4, t4 / 2); } }, u2 = a2.Latin1 = { stringify: function(e4) { for (var t4 = e4.words, n4 = e4.sigBytes, s3 = [], r3 = 0; r3 < n4; r3++) { var i3 = t4[r3 >>> 2] >>> 24 - r3 % 4 * 8 & 255; s3.push(String.fromCharCode(i3)); } return s3.join(""); }, parse: function(e4) { for (var t4 = e4.length, n4 = [], s3 = 0; s3 < t4; s3++) n4[s3 >>> 2] |= (255 & e4.charCodeAt(s3)) << 24 - s3 % 4 * 8; return new o2.init(n4, t4); } }, h2 = a2.Utf8 = { stringify: function(e4) { try { return decodeURIComponent(escape(u2.stringify(e4))); } catch (e5) { throw new Error("Malformed UTF-8 data"); } }, parse: function(e4) { return u2.parse(unescape(encodeURIComponent(e4))); } }, l2 = r2.BufferedBlockAlgorithm = i2.extend({ reset: function() { this._data = new o2.init(), this._nDataBytes = 0; }, _append: function(e4) { "string" == typeof e4 && (e4 = h2.parse(e4)), this._data.concat(e4), this._nDataBytes += e4.sigBytes; }, _process: function(t4) { var n4 = this._data, s3 = n4.words, r3 = n4.sigBytes, i3 = this.blockSize, a3 = r3 / (4 * i3), c3 = (a3 = t4 ? e3.ceil(a3) : e3.max((0 | a3) - this._minBufferSize, 0)) * i3, u3 = e3.min(4 * c3, r3); if (c3) { for (var h3 = 0; h3 < c3; h3 += i3) this._doProcessBlock(s3, h3); var l3 = s3.splice(0, c3); n4.sigBytes -= u3; } return new o2.init(l3, u3); }, clone: function() { var e4 = i2.clone.call(this); return e4._data = this._data.clone(), e4; }, _minBufferSize: 0 }); r2.Hasher = l2.extend({ cfg: i2.extend(), init: function(e4) { this.cfg = this.cfg.extend(e4), this.reset(); }, reset: function() { l2.reset.call(this), this._doReset(); }, update: function(e4) { return this._append(e4), this._process(), this; }, finalize: function(e4) { return e4 && this._append(e4), this._doFinalize(); }, blockSize: 16, _createHelper: function(e4) { return function(t4, n4) { return new e4.init(n4).finalize(t4); }; }, _createHmacHelper: function(e4) { return function(t4, n4) { return new d2.HMAC.init(e4, n4).finalize(t4); }; } }); var d2 = s2.algo = {}; return s2; }(Math), n2); }), i = r, o = (s(function(e2, t2) { var n2; e2.exports = (n2 = i, function(e3) { var t3 = n2, s2 = t3.lib, r2 = s2.WordArray, i2 = s2.Hasher, o2 = t3.algo, a2 = []; !function() { for (var t4 = 0; t4 < 64; t4++) a2[t4] = 4294967296 * e3.abs(e3.sin(t4 + 1)) | 0; }(); var c2 = o2.MD5 = i2.extend({ _doReset: function() { this._hash = new r2.init([1732584193, 4023233417, 2562383102, 271733878]); }, _doProcessBlock: function(e4, t4) { for (var n3 = 0; n3 < 16; n3++) { var s3 = t4 + n3, r3 = e4[s3]; e4[s3] = 16711935 & (r3 << 8 | r3 >>> 24) | 4278255360 & (r3 << 24 | r3 >>> 8); } var i3 = this._hash.words, o3 = e4[t4 + 0], c3 = e4[t4 + 1], p2 = e4[t4 + 2], f2 = e4[t4 + 3], g2 = e4[t4 + 4], m2 = e4[t4 + 5], y2 = e4[t4 + 6], _2 = e4[t4 + 7], w2 = e4[t4 + 8], v2 = e4[t4 + 9], I2 = e4[t4 + 10], S2 = e4[t4 + 11], b2 = e4[t4 + 12], k2 = e4[t4 + 13], C = e4[t4 + 14], T2 = e4[t4 + 15], P2 = i3[0], A2 = i3[1], E2 = i3[2], O = i3[3]; P2 = u2(P2, A2, E2, O, o3, 7, a2[0]), O = u2(O, P2, A2, E2, c3, 12, a2[1]), E2 = u2(E2, O, P2, A2, p2, 17, a2[2]), A2 = u2(A2, E2, O, P2, f2, 22, a2[3]), P2 = u2(P2, A2, E2, O, g2, 7, a2[4]), O = u2(O, P2, A2, E2, m2, 12, a2[5]), E2 = u2(E2, O, P2, A2, y2, 17, a2[6]), A2 = u2(A2, E2, O, P2, _2, 22, a2[7]), P2 = u2(P2, A2, E2, O, w2, 7, a2[8]), O = u2(O, P2, A2, E2, v2, 12, a2[9]), E2 = u2(E2, O, P2, A2, I2, 17, a2[10]), A2 = u2(A2, E2, O, P2, S2, 22, a2[11]), P2 = u2(P2, A2, E2, O, b2, 7, a2[12]), O = u2(O, P2, A2, E2, k2, 12, a2[13]), E2 = u2(E2, O, P2, A2, C, 17, a2[14]), P2 = h2(P2, A2 = u2(A2, E2, O, P2, T2, 22, a2[15]), E2, O, c3, 5, a2[16]), O = h2(O, P2, A2, E2, y2, 9, a2[17]), E2 = h2(E2, O, P2, A2, S2, 14, a2[18]), A2 = h2(A2, E2, O, P2, o3, 20, a2[19]), P2 = h2(P2, A2, E2, O, m2, 5, a2[20]), O = h2(O, P2, A2, E2, I2, 9, a2[21]), E2 = h2(E2, O, P2, A2, T2, 14, a2[22]), A2 = h2(A2, E2, O, P2, g2, 20, a2[23]), P2 = h2(P2, A2, E2, O, v2, 5, a2[24]), O = h2(O, P2, A2, E2, C, 9, a2[25]), E2 = h2(E2, O, P2, A2, f2, 14, a2[26]), A2 = h2(A2, E2, O, P2, w2, 20, a2[27]), P2 = h2(P2, A2, E2, O, k2, 5, a2[28]), O = h2(O, P2, A2, E2, p2, 9, a2[29]), E2 = h2(E2, O, P2, A2, _2, 14, a2[30]), P2 = l2(P2, A2 = h2(A2, E2, O, P2, b2, 20, a2[31]), E2, O, m2, 4, a2[32]), O = l2(O, P2, A2, E2, w2, 11, a2[33]), E2 = l2(E2, O, P2, A2, S2, 16, a2[34]), A2 = l2(A2, E2, O, P2, C, 23, a2[35]), P2 = l2(P2, A2, E2, O, c3, 4, a2[36]), O = l2(O, P2, A2, E2, g2, 11, a2[37]), E2 = l2(E2, O, P2, A2, _2, 16, a2[38]), A2 = l2(A2, E2, O, P2, I2, 23, a2[39]), P2 = l2(P2, A2, E2, O, k2, 4, a2[40]), O = l2(O, P2, A2, E2, o3, 11, a2[41]), E2 = l2(E2, O, P2, A2, f2, 16, a2[42]), A2 = l2(A2, E2, O, P2, y2, 23, a2[43]), P2 = l2(P2, A2, E2, O, v2, 4, a2[44]), O = l2(O, P2, A2, E2, b2, 11, a2[45]), E2 = l2(E2, O, P2, A2, T2, 16, a2[46]), P2 = d2(P2, A2 = l2(A2, E2, O, P2, p2, 23, a2[47]), E2, O, o3, 6, a2[48]), O = d2(O, P2, A2, E2, _2, 10, a2[49]), E2 = d2(E2, O, P2, A2, C, 15, a2[50]), A2 = d2(A2, E2, O, P2, m2, 21, a2[51]), P2 = d2(P2, A2, E2, O, b2, 6, a2[52]), O = d2(O, P2, A2, E2, f2, 10, a2[53]), E2 = d2(E2, O, P2, A2, I2, 15, a2[54]), A2 = d2(A2, E2, O, P2, c3, 21, a2[55]), P2 = d2(P2, A2, E2, O, w2, 6, a2[56]), O = d2(O, P2, A2, E2, T2, 10, a2[57]), E2 = d2(E2, O, P2, A2, y2, 15, a2[58]), A2 = d2(A2, E2, O, P2, k2, 21, a2[59]), P2 = d2(P2, A2, E2, O, g2, 6, a2[60]), O = d2(O, P2, A2, E2, S2, 10, a2[61]), E2 = d2(E2, O, P2, A2, p2, 15, a2[62]), A2 = d2(A2, E2, O, P2, v2, 21, a2[63]), i3[0] = i3[0] + P2 | 0, i3[1] = i3[1] + A2 | 0, i3[2] = i3[2] + E2 | 0, i3[3] = i3[3] + O | 0; }, _doFinalize: function() { var t4 = this._data, n3 = t4.words, s3 = 8 * this._nDataBytes, r3 = 8 * t4.sigBytes; n3[r3 >>> 5] |= 128 << 24 - r3 % 32; var i3 = e3.floor(s3 / 4294967296), o3 = s3; n3[15 + (r3 + 64 >>> 9 << 4)] = 16711935 & (i3 << 8 | i3 >>> 24) | 4278255360 & (i3 << 24 | i3 >>> 8), n3[14 + (r3 + 64 >>> 9 << 4)] = 16711935 & (o3 << 8 | o3 >>> 24) | 4278255360 & (o3 << 24 | o3 >>> 8), t4.sigBytes = 4 * (n3.length + 1), this._process(); for (var a3 = this._hash, c3 = a3.words, u3 = 0; u3 < 4; u3++) { var h3 = c3[u3]; c3[u3] = 16711935 & (h3 << 8 | h3 >>> 24) | 4278255360 & (h3 << 24 | h3 >>> 8); } return a3; }, clone: function() { var e4 = i2.clone.call(this); return e4._hash = this._hash.clone(), e4; } }); function u2(e4, t4, n3, s3, r3, i3, o3) { var a3 = e4 + (t4 & n3 | ~t4 & s3) + r3 + o3; return (a3 << i3 | a3 >>> 32 - i3) + t4; } function h2(e4, t4, n3, s3, r3, i3, o3) { var a3 = e4 + (t4 & s3 | n3 & ~s3) + r3 + o3; return (a3 << i3 | a3 >>> 32 - i3) + t4; } function l2(e4, t4, n3, s3, r3, i3, o3) { var a3 = e4 + (t4 ^ n3 ^ s3) + r3 + o3; return (a3 << i3 | a3 >>> 32 - i3) + t4; } function d2(e4, t4, n3, s3, r3, i3, o3) { var a3 = e4 + (n3 ^ (t4 | ~s3)) + r3 + o3; return (a3 << i3 | a3 >>> 32 - i3) + t4; } t3.MD5 = i2._createHelper(c2), t3.HmacMD5 = i2._createHmacHelper(c2); }(Math), n2.MD5); }), s(function(e2, t2) { var n2; e2.exports = (n2 = i, void function() { var e3 = n2, t3 = e3.lib.Base, s2 = e3.enc.Utf8; e3.algo.HMAC = t3.extend({ init: function(e4, t4) { e4 = this._hasher = new e4.init(), "string" == typeof t4 && (t4 = s2.parse(t4)); var n3 = e4.blockSize, r2 = 4 * n3; t4.sigBytes > r2 && (t4 = e4.finalize(t4)), t4.clamp(); for (var i2 = this._oKey = t4.clone(), o2 = this._iKey = t4.clone(), a2 = i2.words, c2 = o2.words, u2 = 0; u2 < n3; u2++) a2[u2] ^= 1549556828, c2[u2] ^= 909522486; i2.sigBytes = o2.sigBytes = r2, this.reset(); }, reset: function() { var e4 = this._hasher; e4.reset(), e4.update(this._iKey); }, update: function(e4) { return this._hasher.update(e4), this; }, finalize: function(e4) { var t4 = this._hasher, n3 = t4.finalize(e4); return t4.reset(), t4.finalize(this._oKey.clone().concat(n3)); } }); }()); }), s(function(e2, t2) { e2.exports = i.HmacMD5; })), a = s(function(e2, t2) { e2.exports = i.enc.Utf8; }), c = s(function(e2, t2) { var n2; e2.exports = (n2 = i, function() { var e3 = n2, t3 = e3.lib.WordArray; function s2(e4, n3, s3) { for (var r2 = [], i2 = 0, o2 = 0; o2 < n3; o2++) if (o2 % 4) { var a2 = s3[e4.charCodeAt(o2 - 1)] << o2 % 4 * 2, c2 = s3[e4.charCodeAt(o2)] >>> 6 - o2 % 4 * 2; r2[i2 >>> 2] |= (a2 | c2) << 24 - i2 % 4 * 8, i2++; } return t3.create(r2, i2); } e3.enc.Base64 = { stringify: function(e4) { var t4 = e4.words, n3 = e4.sigBytes, s3 = this._map; e4.clamp(); for (var r2 = [], i2 = 0; i2 < n3; i2 += 3) for (var o2 = (t4[i2 >>> 2] >>> 24 - i2 % 4 * 8 & 255) << 16 | (t4[i2 + 1 >>> 2] >>> 24 - (i2 + 1) % 4 * 8 & 255) << 8 | t4[i2 + 2 >>> 2] >>> 24 - (i2 + 2) % 4 * 8 & 255, a2 = 0; a2 < 4 && i2 + 0.75 * a2 < n3; a2++) r2.push(s3.charAt(o2 >>> 6 * (3 - a2) & 63)); var c2 = s3.charAt(64); if (c2) for (; r2.length % 4; ) r2.push(c2); return r2.join(""); }, parse: function(e4) { var t4 = e4.length, n3 = this._map, r2 = this._reverseMap; if (!r2) { r2 = this._reverseMap = []; for (var i2 = 0; i2 < n3.length; i2++) r2[n3.charCodeAt(i2)] = i2; } var o2 = n3.charAt(64); if (o2) { var a2 = e4.indexOf(o2); -1 !== a2 && (t4 = a2); } return s2(e4, t4, r2); }, _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" }; }(), n2.enc.Base64); }); const u = "FUNCTION", h = "OBJECT", l = "CLIENT_DB", d = "pending", p = "fullfilled", f = "rejected"; function g(e2) { return Object.prototype.toString.call(e2).slice(8, -1).toLowerCase(); } function m(e2) { return "object" === g(e2); } function y(e2) { return "function" == typeof e2; } function _(e2) { return function() { try { return e2.apply(e2, arguments); } catch (e3) { console.error(e3); } }; } const w = "REJECTED", v = "NOT_PENDING"; class I { constructor({ createPromise: e2, retryRule: t2 = w } = {}) { this.createPromise = e2, this.status = null, this.promise = null, this.retryRule = t2; } get needRetry() { if (!this.status) return true; switch (this.retryRule) { case w: return this.status === f; case v: return this.status !== d; } } exec() { return this.needRetry ? (this.status = d, this.promise = this.createPromise().then((e2) => (this.status = p, Promise.resolve(e2)), (e2) => (this.status = f, Promise.reject(e2))), this.promise) : this.promise; } } function S(e2) { return e2 && "string" == typeof e2 ? JSON.parse(e2) : e2; } const b = true, k = "app", T = S([]), P = k, A = S(""), E = S("[]") || []; let x = ""; try { x = "__UNI__F501A17"; } catch (e2) { } let R = {}; function U(e2, t2 = {}) { var n2, s2; return n2 = R, s2 = e2, Object.prototype.hasOwnProperty.call(n2, s2) || (R[e2] = t2), R[e2]; } R = uni._globalUniCloudObj ? uni._globalUniCloudObj : uni._globalUniCloudObj = {}; const L = ["invoke", "success", "fail", "complete"], N = U("_globalUniCloudInterceptor"); function D(e2, t2) { N[e2] || (N[e2] = {}), m(t2) && Object.keys(t2).forEach((n2) => { L.indexOf(n2) > -1 && function(e3, t3, n3) { let s2 = N[e3][t3]; s2 || (s2 = N[e3][t3] = []), -1 === s2.indexOf(n3) && y(n3) && s2.push(n3); }(e2, n2, t2[n2]); }); } function F(e2, t2) { N[e2] || (N[e2] = {}), m(t2) ? Object.keys(t2).forEach((n2) => { L.indexOf(n2) > -1 && function(e3, t3, n3) { const s2 = N[e3][t3]; if (!s2) return; const r2 = s2.indexOf(n3); r2 > -1 && s2.splice(r2, 1); }(e2, n2, t2[n2]); }) : delete N[e2]; } function M(e2, t2) { return e2 && 0 !== e2.length ? e2.reduce((e3, n2) => e3.then(() => n2(t2)), Promise.resolve()) : Promise.resolve(); } function q(e2, t2) { return N[e2] && N[e2][t2] || []; } function K(e2) { D("callObject", e2); } const j = U("_globalUniCloudListener"), B = "response", $ = "needLogin", W = "refreshToken", z = "clientdb", J = "cloudfunction", H = "cloudobject"; function G(e2) { return j[e2] || (j[e2] = []), j[e2]; } function V(e2, t2) { const n2 = G(e2); n2.includes(t2) || n2.push(t2); } function Y(e2, t2) { const n2 = G(e2), s2 = n2.indexOf(t2); -1 !== s2 && n2.splice(s2, 1); } function Q(e2, t2) { const n2 = G(e2); for (let e3 = 0; e3 < n2.length; e3++) { (0, n2[e3])(t2); } } let X, Z = false; function ee() { return X || (X = new Promise((e2) => { Z && e2(), function t2() { if ("function" == typeof getCurrentPages) { const t3 = getCurrentPages(); t3 && t3[0] && (Z = true, e2()); } Z || setTimeout(() => { t2(); }, 30); }(); }), X); } function te(e2) { const t2 = {}; for (const n2 in e2) { const s2 = e2[n2]; y(s2) && (t2[n2] = _(s2)); } return t2; } class ne extends Error { constructor(e2) { super(e2.message), this.errMsg = e2.message || e2.errMsg || "unknown system error", this.code = this.errCode = e2.code || e2.errCode || "SYSTEM_ERROR", this.errSubject = this.subject = e2.subject || e2.errSubject, this.cause = e2.cause, this.requestId = e2.requestId; } toJson(e2 = 0) { if (!(e2 >= 10)) return e2++, { errCode: this.errCode, errMsg: this.errMsg, errSubject: this.errSubject, cause: this.cause && this.cause.toJson ? this.cause.toJson(e2) : this.cause }; } } var se = { request: (e2) => uni.request(e2), uploadFile: (e2) => uni.uploadFile(e2), setStorageSync: (e2, t2) => uni.setStorageSync(e2, t2), getStorageSync: (e2) => uni.getStorageSync(e2), removeStorageSync: (e2) => uni.removeStorageSync(e2), clearStorageSync: () => uni.clearStorageSync() }; function re(e2) { return e2 && re(e2.__v_raw) || e2; } function ie() { return { token: se.getStorageSync("uni_id_token") || se.getStorageSync("uniIdToken"), tokenExpired: se.getStorageSync("uni_id_token_expired") }; } function oe({ token: e2, tokenExpired: t2 } = {}) { e2 && se.setStorageSync("uni_id_token", e2), t2 && se.setStorageSync("uni_id_token_expired", t2); } let ae, ce; function ue() { return ae || (ae = uni.getSystemInfoSync()), ae; } function he() { let e2, t2; try { if (uni.getLaunchOptionsSync) { if (uni.getLaunchOptionsSync.toString().indexOf("not yet implemented") > -1) return; const { scene: n2, channel: s2 } = uni.getLaunchOptionsSync(); e2 = s2, t2 = n2; } } catch (e3) { } return { channel: e2, scene: t2 }; } function le() { const e2 = uni.getLocale && uni.getLocale() || "en"; if (ce) return { ...ce, locale: e2, LOCALE: e2 }; const t2 = ue(), { deviceId: n2, osName: s2, uniPlatform: r2, appId: i2 } = t2, o2 = ["pixelRatio", "brand", "model", "system", "language", "version", "platform", "host", "SDKVersion", "swanNativeVersion", "app", "AppPlatform", "fontSizeSetting"]; for (let e3 = 0; e3 < o2.length; e3++) { delete t2[o2[e3]]; } return ce = { PLATFORM: r2, OS: s2, APPID: i2, DEVICEID: n2, ...he(), ...t2 }, { ...ce, locale: e2, LOCALE: e2 }; } var de = { sign: function(e2, t2) { let n2 = ""; return Object.keys(e2).sort().forEach(function(t3) { e2[t3] && (n2 = n2 + "&" + t3 + "=" + e2[t3]); }), n2 = n2.slice(1), o(n2, t2).toString(); }, wrappedRequest: function(e2, t2) { return new Promise((n2, s2) => { t2(Object.assign(e2, { complete(e3) { e3 || (e3 = {}); const t3 = e3.data && e3.data.header && e3.data.header["x-serverless-request-id"] || e3.header && e3.header["request-id"]; if (!e3.statusCode || e3.statusCode >= 400) return s2(new ne({ code: "SYS_ERR", message: e3.errMsg || "request:fail", requestId: t3 })); const r2 = e3.data; if (r2.error) return s2(new ne({ code: r2.error.code, message: r2.error.message, requestId: t3 })); r2.result = r2.data, r2.requestId = t3, delete r2.data, n2(r2); } })); }); }, toBase64: function(e2) { return c.stringify(a.parse(e2)); } }, pe = { "uniCloud.init.paramRequired": "{param} required", "uniCloud.uploadFile.fileError": "filePath should be instance of File" }; const { t: fe } = initVueI18n({ "zh-Hans": { "uniCloud.init.paramRequired": "缺少参数:{param}", "uniCloud.uploadFile.fileError": "filePath应为File对象" }, "zh-Hant": { "uniCloud.init.paramRequired": "缺少参数:{param}", "uniCloud.uploadFile.fileError": "filePath应为File对象" }, en: pe, fr: { "uniCloud.init.paramRequired": "{param} required", "uniCloud.uploadFile.fileError": "filePath should be instance of File" }, es: { "uniCloud.init.paramRequired": "{param} required", "uniCloud.uploadFile.fileError": "filePath should be instance of File" }, ja: pe }, "zh-Hans"); var ge = class { constructor(e2) { ["spaceId", "clientSecret"].forEach((t2) => { if (!Object.prototype.hasOwnProperty.call(e2, t2)) throw new Error(fe("uniCloud.init.paramRequired", { param: t2 })); }), this.config = Object.assign({}, { endpoint: 0 === e2.spaceId.indexOf("mp-") ? "https://api.next.bspapp.com" : "https://api.bspapp.com" }, e2), this.config.provider = "aliyun", this.config.requestUrl = this.config.endpoint + "/client", this.config.envType = this.config.envType || "public", this.config.accessTokenKey = "access_token_" + this.config.spaceId, this.adapter = se, this._getAccessTokenPromiseHub = new I({ createPromise: () => this.requestAuth(this.setupRequest({ method: "serverless.auth.user.anonymousAuthorize", params: "{}" }, "auth")).then((e3) => { if (!e3.result || !e3.result.accessToken) throw new ne({ code: "AUTH_FAILED", message: "获取accessToken失败" }); this.setAccessToken(e3.result.accessToken); }), retryRule: v }); } get hasAccessToken() { return !!this.accessToken; } setAccessToken(e2) { this.accessToken = e2; } requestWrapped(e2) { return de.wrappedRequest(e2, this.adapter.request); } requestAuth(e2) { return this.requestWrapped(e2); } request(e2, t2) { return Promise.resolve().then(() => this.hasAccessToken ? t2 ? this.requestWrapped(e2) : this.requestWrapped(e2).catch((t3) => new Promise((e3, n2) => { !t3 || "GATEWAY_INVALID_TOKEN" !== t3.code && "InvalidParameter.InvalidToken" !== t3.code ? n2(t3) : e3(); }).then(() => this.getAccessToken()).then(() => { const t4 = this.rebuildRequest(e2); return this.request(t4, true); })) : this.getAccessToken().then(() => { const t3 = this.rebuildRequest(e2); return this.request(t3, true); })); } rebuildRequest(e2) { const t2 = Object.assign({}, e2); return t2.data.token = this.accessToken, t2.header["x-basement-token"] = this.accessToken, t2.header["x-serverless-sign"] = de.sign(t2.data, this.config.clientSecret), t2; } setupRequest(e2, t2) { const n2 = Object.assign({}, e2, { spaceId: this.config.spaceId, timestamp: Date.now() }), s2 = { "Content-Type": "application/json" }; return "auth" !== t2 && (n2.token = this.accessToken, s2["x-basement-token"] = this.accessToken), s2["x-serverless-sign"] = de.sign(n2, this.config.clientSecret), { url: this.config.requestUrl, method: "POST", data: n2, dataType: "json", header: s2 }; } getAccessToken() { return this._getAccessTokenPromiseHub.exec(); } async authorize() { await this.getAccessToken(); } callFunction(e2) { const t2 = { method: "serverless.function.runtime.invoke", params: JSON.stringify({ functionTarget: e2.name, functionArgs: e2.data || {} }) }; return this.request(this.setupRequest(t2)); } getOSSUploadOptionsFromPath(e2) { const t2 = { method: "serverless.file.resource.generateProximalSign", params: JSON.stringify(e2) }; return this.request(this.setupRequest(t2)); } uploadFileToOSS({ url: e2, formData: t2, name: n2, filePath: s2, fileType: r2, onUploadProgress: i2 }) { return new Promise((o2, a2) => { const c2 = this.adapter.uploadFile({ url: e2, formData: t2, name: n2, filePath: s2, fileType: r2, header: { "X-OSS-server-side-encrpytion": "AES256" }, success(e3) { e3 && e3.statusCode < 400 ? o2(e3) : a2(new ne({ code: "UPLOAD_FAILED", message: "文件上传失败" })); }, fail(e3) { a2(new ne({ code: e3.code || "UPLOAD_FAILED", message: e3.message || e3.errMsg || "文件上传失败" })); } }); "function" == typeof i2 && c2 && "function" == typeof c2.onProgressUpdate && c2.onProgressUpdate((e3) => { i2({ loaded: e3.totalBytesSent, total: e3.totalBytesExpectedToSend }); }); }); } reportOSSUpload(e2) { const t2 = { method: "serverless.file.resource.report", params: JSON.stringify(e2) }; return this.request(this.setupRequest(t2)); } async uploadFile({ filePath: e2, cloudPath: t2, fileType: n2 = "image", cloudPathAsRealPath: s2 = false, onUploadProgress: r2, config: i2 }) { if ("string" !== g(t2)) throw new ne({ code: "INVALID_PARAM", message: "cloudPath必须为字符串类型" }); if (!(t2 = t2.trim())) throw new ne({ code: "INVALID_PARAM", message: "cloudPath不可为空" }); if (/:\/\//.test(t2)) throw new ne({ code: "INVALID_PARAM", message: "cloudPath不合法" }); const o2 = i2 && i2.envType || this.config.envType; if (s2 && ("/" !== t2[0] && (t2 = "/" + t2), t2.indexOf("\\") > -1)) throw new ne({ code: "INVALID_PARAM", message: "使用cloudPath作为路径时,cloudPath不可包含“\\”" }); const a2 = (await this.getOSSUploadOptionsFromPath({ env: o2, filename: s2 ? t2.split("/").pop() : t2, fileId: s2 ? t2 : void 0 })).result, c2 = "https://" + a2.cdnDomain + "/" + a2.ossPath, { securityToken: u2, accessKeyId: h2, signature: l2, host: d2, ossPath: p2, id: f2, policy: m2, ossCallbackUrl: y2 } = a2, _2 = { "Cache-Control": "max-age=2592000", "Content-Disposition": "attachment", OSSAccessKeyId: h2, Signature: l2, host: d2, id: f2, key: p2, policy: m2, success_action_status: 200 }; if (u2 && (_2["x-oss-security-token"] = u2), y2) { const e3 = JSON.stringify({ callbackUrl: y2, callbackBody: JSON.stringify({ fileId: f2, spaceId: this.config.spaceId }), callbackBodyType: "application/json" }); _2.callback = de.toBase64(e3); } const w2 = { url: "https://" + a2.host, formData: _2, fileName: "file", name: "file", filePath: e2, fileType: n2 }; if (await this.uploadFileToOSS(Object.assign({}, w2, { onUploadProgress: r2 })), y2) return { success: true, filePath: e2, fileID: c2 }; if ((await this.reportOSSUpload({ id: f2 })).success) return { success: true, filePath: e2, fileID: c2 }; throw new ne({ code: "UPLOAD_FAILED", message: "文件上传失败" }); } getTempFileURL({ fileList: e2 } = {}) { return new Promise((t2, n2) => { Array.isArray(e2) && 0 !== e2.length || n2(new ne({ code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" })), t2({ fileList: e2.map((e3) => ({ fileID: e3, tempFileURL: e3 })) }); }); } async getFileInfo({ fileList: e2 } = {}) { if (!Array.isArray(e2) || 0 === e2.length) throw new ne({ code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" }); const t2 = { method: "serverless.file.resource.info", params: JSON.stringify({ id: e2.map((e3) => e3.split("?")[0]).join(",") }) }; return { fileList: (await this.request(this.setupRequest(t2))).result }; } }; var me = { init(e2) { const t2 = new ge(e2), n2 = { signInAnonymously: function() { return t2.authorize(); }, getLoginState: function() { return Promise.resolve(false); } }; return t2.auth = function() { return n2; }, t2.customAuth = t2.auth, t2; } }; const ye = "undefined" != typeof location && "http:" === location.protocol ? "http:" : "https:"; var _e; !function(e2) { e2.local = "local", e2.none = "none", e2.session = "session"; }(_e || (_e = {})); var we = function() { }; const ve = () => { let e2; if (!Promise) { e2 = () => { }, e2.promise = {}; const t3 = () => { throw new ne({ message: 'Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.' }); }; return Object.defineProperty(e2.promise, "then", { get: t3 }), Object.defineProperty(e2.promise, "catch", { get: t3 }), e2; } const t2 = new Promise((t3, n2) => { e2 = (e3, s2) => e3 ? n2(e3) : t3(s2); }); return e2.promise = t2, e2; }; function Ie(e2) { return void 0 === e2; } function Se(e2) { return "[object Null]" === Object.prototype.toString.call(e2); } var be; function ke(e2) { const t2 = (n2 = e2, "[object Array]" === Object.prototype.toString.call(n2) ? e2 : [e2]); var n2; for (const e3 of t2) { const { isMatch: t3, genAdapter: n3, runtime: s2 } = e3; if (t3()) return { adapter: n3(), runtime: s2 }; } } !function(e2) { e2.WEB = "web", e2.WX_MP = "wx_mp"; }(be || (be = {})); const Ce = { adapter: null, runtime: void 0 }, Te = ["anonymousUuidKey"]; class Pe extends we { constructor() { super(), Ce.adapter.root.tcbObject || (Ce.adapter.root.tcbObject = {}); } setItem(e2, t2) { Ce.adapter.root.tcbObject[e2] = t2; } getItem(e2) { return Ce.adapter.root.tcbObject[e2]; } removeItem(e2) { delete Ce.adapter.root.tcbObject[e2]; } clear() { delete Ce.adapter.root.tcbObject; } } function Ae(e2, t2) { switch (e2) { case "local": return t2.localStorage || new Pe(); case "none": return new Pe(); default: return t2.sessionStorage || new Pe(); } } class Ee { constructor(e2) { if (!this._storage) { this._persistence = Ce.adapter.primaryStorage || e2.persistence, this._storage = Ae(this._persistence, Ce.adapter); const t2 = `access_token_${e2.env}`, n2 = `access_token_expire_${e2.env}`, s2 = `refresh_token_${e2.env}`, r2 = `anonymous_uuid_${e2.env}`, i2 = `login_type_${e2.env}`, o2 = `user_info_${e2.env}`; this.keys = { accessTokenKey: t2, accessTokenExpireKey: n2, refreshTokenKey: s2, anonymousUuidKey: r2, loginTypeKey: i2, userInfoKey: o2 }; } } updatePersistence(e2) { if (e2 === this._persistence) return; const t2 = "local" === this._persistence; this._persistence = e2; const n2 = Ae(e2, Ce.adapter); for (const e3 in this.keys) { const s2 = this.keys[e3]; if (t2 && Te.includes(e3)) continue; const r2 = this._storage.getItem(s2); Ie(r2) || Se(r2) || (n2.setItem(s2, r2), this._storage.removeItem(s2)); } this._storage = n2; } setStore(e2, t2, n2) { if (!this._storage) return; const s2 = { version: n2 || "localCachev1", content: t2 }, r2 = JSON.stringify(s2); try { this._storage.setItem(e2, r2); } catch (e3) { throw e3; } } getStore(e2, t2) { try { if (!this._storage) return; } catch (e3) { return ""; } t2 = t2 || "localCachev1"; const n2 = this._storage.getItem(e2); if (!n2) return ""; if (n2.indexOf(t2) >= 0) { return JSON.parse(n2).content; } return ""; } removeStore(e2) { this._storage.removeItem(e2); } } const Oe = {}, xe = {}; function Re(e2) { return Oe[e2]; } class Ue { constructor(e2, t2) { this.data = t2 || null, this.name = e2; } } class Le extends Ue { constructor(e2, t2) { super("error", { error: e2, data: t2 }), this.error = e2; } } const Ne = new class { constructor() { this._listeners = {}; } on(e2, t2) { return function(e3, t3, n2) { n2[e3] = n2[e3] || [], n2[e3].push(t3); }(e2, t2, this._listeners), this; } off(e2, t2) { return function(e3, t3, n2) { if (n2 && n2[e3]) { const s2 = n2[e3].indexOf(t3); -1 !== s2 && n2[e3].splice(s2, 1); } }(e2, t2, this._listeners), this; } fire(e2, t2) { if (e2 instanceof Le) return console.error(e2.error), this; const n2 = "string" == typeof e2 ? new Ue(e2, t2 || {}) : e2; const s2 = n2.name; if (this._listens(s2)) { n2.target = this; const e3 = this._listeners[s2] ? [...this._listeners[s2]] : []; for (const t3 of e3) t3.call(this, n2); } return this; } _listens(e2) { return this._listeners[e2] && this._listeners[e2].length > 0; } }(); function De(e2, t2) { Ne.on(e2, t2); } function Fe(e2, t2 = {}) { Ne.fire(e2, t2); } function Me(e2, t2) { Ne.off(e2, t2); } const qe = "loginStateChanged", Ke = "loginStateExpire", je = "loginTypeChanged", Be = "anonymousConverted", $e = "refreshAccessToken"; var We; !function(e2) { e2.ANONYMOUS = "ANONYMOUS", e2.WECHAT = "WECHAT", e2.WECHAT_PUBLIC = "WECHAT-PUBLIC", e2.WECHAT_OPEN = "WECHAT-OPEN", e2.CUSTOM = "CUSTOM", e2.EMAIL = "EMAIL", e2.USERNAME = "USERNAME", e2.NULL = "NULL"; }(We || (We = {})); const ze = ["auth.getJwt", "auth.logout", "auth.signInWithTicket", "auth.signInAnonymously", "auth.signIn", "auth.fetchAccessTokenWithRefreshToken", "auth.signUpWithEmailAndPassword", "auth.activateEndUserMail", "auth.sendPasswordResetEmail", "auth.resetPasswordWithToken", "auth.isUsernameRegistered"], Je = { "X-SDK-Version": "1.3.5" }; function He(e2, t2, n2) { const s2 = e2[t2]; e2[t2] = function(t3) { const r2 = {}, i2 = {}; n2.forEach((n3) => { const { data: s3, headers: o3 } = n3.call(e2, t3); Object.assign(r2, s3), Object.assign(i2, o3); }); const o2 = t3.data; return o2 && (() => { var e3; if (e3 = o2, "[object FormData]" !== Object.prototype.toString.call(e3)) t3.data = { ...o2, ...r2 }; else for (const e4 in r2) o2.append(e4, r2[e4]); })(), t3.headers = { ...t3.headers || {}, ...i2 }, s2.call(e2, t3); }; } function Ge() { const e2 = Math.random().toString(16).slice(2); return { data: { seqId: e2 }, headers: { ...Je, "x-seqid": e2 } }; } class Ve { constructor(e2 = {}) { var t2; this.config = e2, this._reqClass = new Ce.adapter.reqClass({ timeout: this.config.timeout, timeoutMsg: `请求在${this.config.timeout / 1e3}s内未完成,已中断`, restrictedMethods: ["post"] }), this._cache = Re(this.config.env), this._localCache = (t2 = this.config.env, xe[t2]), He(this._reqClass, "post", [Ge]), He(this._reqClass, "upload", [Ge]), He(this._reqClass, "download", [Ge]); } async post(e2) { return await this._reqClass.post(e2); } async upload(e2) { return await this._reqClass.upload(e2); } async download(e2) { return await this._reqClass.download(e2); } async refreshAccessToken() { let e2, t2; this._refreshAccessTokenPromise || (this._refreshAccessTokenPromise = this._refreshAccessToken()); try { e2 = await this._refreshAccessTokenPromise; } catch (e3) { t2 = e3; } if (this._refreshAccessTokenPromise = null, this._shouldRefreshAccessTokenHook = null, t2) throw t2; return e2; } async _refreshAccessToken() { const { accessTokenKey: e2, accessTokenExpireKey: t2, refreshTokenKey: n2, loginTypeKey: s2, anonymousUuidKey: r2 } = this._cache.keys; this._cache.removeStore(e2), this._cache.removeStore(t2); let i2 = this._cache.getStore(n2); if (!i2) throw new ne({ message: "未登录CloudBase" }); const o2 = { refresh_token: i2 }, a2 = await this.request("auth.fetchAccessTokenWithRefreshToken", o2); if (a2.data.code) { const { code: e3 } = a2.data; if ("SIGN_PARAM_INVALID" === e3 || "REFRESH_TOKEN_EXPIRED" === e3 || "INVALID_REFRESH_TOKEN" === e3) { if (this._cache.getStore(s2) === We.ANONYMOUS && "INVALID_REFRESH_TOKEN" === e3) { const e4 = this._cache.getStore(r2), t3 = this._cache.getStore(n2), s3 = await this.send("auth.signInAnonymously", { anonymous_uuid: e4, refresh_token: t3 }); return this.setRefreshToken(s3.refresh_token), this._refreshAccessToken(); } Fe(Ke), this._cache.removeStore(n2); } throw new ne({ code: a2.data.code, message: `刷新access token失败:${a2.data.code}` }); } if (a2.data.access_token) return Fe($e), this._cache.setStore(e2, a2.data.access_token), this._cache.setStore(t2, a2.data.access_token_expire + Date.now()), { accessToken: a2.data.access_token, accessTokenExpire: a2.data.access_token_expire }; a2.data.refresh_token && (this._cache.removeStore(n2), this._cache.setStore(n2, a2.data.refresh_token), this._refreshAccessToken()); } async getAccessToken() { const { accessTokenKey: e2, accessTokenExpireKey: t2, refreshTokenKey: n2 } = this._cache.keys; if (!this._cache.getStore(n2)) throw new ne({ message: "refresh token不存在,登录状态异常" }); let s2 = this._cache.getStore(e2), r2 = this._cache.getStore(t2), i2 = true; return this._shouldRefreshAccessTokenHook && !await this._shouldRefreshAccessTokenHook(s2, r2) && (i2 = false), (!s2 || !r2 || r2 < Date.now()) && i2 ? this.refreshAccessToken() : { accessToken: s2, accessTokenExpire: r2 }; } async request(e2, t2, n2) { const s2 = `x-tcb-trace_${this.config.env}`; let r2 = "application/x-www-form-urlencoded"; const i2 = { action: e2, env: this.config.env, dataVersion: "2019-08-16", ...t2 }; if (-1 === ze.indexOf(e2)) { const { refreshTokenKey: e3 } = this._cache.keys; this._cache.getStore(e3) && (i2.access_token = (await this.getAccessToken()).accessToken); } let o2; if ("storage.uploadFile" === e2) { o2 = new FormData(); for (let e3 in o2) o2.hasOwnProperty(e3) && void 0 !== o2[e3] && o2.append(e3, i2[e3]); r2 = "multipart/form-data"; } else { r2 = "application/json", o2 = {}; for (let e3 in i2) void 0 !== i2[e3] && (o2[e3] = i2[e3]); } let a2 = { headers: { "content-type": r2 } }; n2 && n2.onUploadProgress && (a2.onUploadProgress = n2.onUploadProgress); const c2 = this._localCache.getStore(s2); c2 && (a2.headers["X-TCB-Trace"] = c2); const { parse: u2, inQuery: h2, search: l2 } = t2; let d2 = { env: this.config.env }; u2 && (d2.parse = true), h2 && (d2 = { ...h2, ...d2 }); let p2 = function(e3, t3, n3 = {}) { const s3 = /\?/.test(t3); let r3 = ""; for (let e4 in n3) "" === r3 ? !s3 && (t3 += "?") : r3 += "&", r3 += `${e4}=${encodeURIComponent(n3[e4])}`; return /^http(s)?\:\/\//.test(t3 += r3) ? t3 : `${e3}${t3}`; }(ye, "//tcb-api.tencentcloudapi.com/web", d2); l2 && (p2 += l2); const f2 = await this.post({ url: p2, data: o2, ...a2 }), g2 = f2.header && f2.header["x-tcb-trace"]; if (g2 && this._localCache.setStore(s2, g2), 200 !== Number(f2.status) && 200 !== Number(f2.statusCode) || !f2.data) throw new ne({ code: "NETWORK_ERROR", message: "network request error" }); return f2; } async send(e2, t2 = {}) { const n2 = await this.request(e2, t2, { onUploadProgress: t2.onUploadProgress }); if ("ACCESS_TOKEN_EXPIRED" === n2.data.code && -1 === ze.indexOf(e2)) { await this.refreshAccessToken(); const n3 = await this.request(e2, t2, { onUploadProgress: t2.onUploadProgress }); if (n3.data.code) throw new ne({ code: n3.data.code, message: n3.data.message }); return n3.data; } if (n2.data.code) throw new ne({ code: n2.data.code, message: n2.data.message }); return n2.data; } setRefreshToken(e2) { const { accessTokenKey: t2, accessTokenExpireKey: n2, refreshTokenKey: s2 } = this._cache.keys; this._cache.removeStore(t2), this._cache.removeStore(n2), this._cache.setStore(s2, e2); } } const Ye = {}; function Qe(e2) { return Ye[e2]; } class Xe { constructor(e2) { this.config = e2, this._cache = Re(e2.env), this._request = Qe(e2.env); } setRefreshToken(e2) { const { accessTokenKey: t2, accessTokenExpireKey: n2, refreshTokenKey: s2 } = this._cache.keys; this._cache.removeStore(t2), this._cache.removeStore(n2), this._cache.setStore(s2, e2); } setAccessToken(e2, t2) { const { accessTokenKey: n2, accessTokenExpireKey: s2 } = this._cache.keys; this._cache.setStore(n2, e2), this._cache.setStore(s2, t2); } async refreshUserInfo() { const { data: e2 } = await this._request.send("auth.getUserInfo", {}); return this.setLocalUserInfo(e2), e2; } setLocalUserInfo(e2) { const { userInfoKey: t2 } = this._cache.keys; this._cache.setStore(t2, e2); } } class Ze { constructor(e2) { if (!e2) throw new ne({ code: "PARAM_ERROR", message: "envId is not defined" }); this._envId = e2, this._cache = Re(this._envId), this._request = Qe(this._envId), this.setUserInfo(); } linkWithTicket(e2) { if ("string" != typeof e2) throw new ne({ code: "PARAM_ERROR", message: "ticket must be string" }); return this._request.send("auth.linkWithTicket", { ticket: e2 }); } linkWithRedirect(e2) { e2.signInWithRedirect(); } updatePassword(e2, t2) { return this._request.send("auth.updatePassword", { oldPassword: t2, newPassword: e2 }); } updateEmail(e2) { return this._request.send("auth.updateEmail", { newEmail: e2 }); } updateUsername(e2) { if ("string" != typeof e2) throw new ne({ code: "PARAM_ERROR", message: "username must be a string" }); return this._request.send("auth.updateUsername", { username: e2 }); } async getLinkedUidList() { const { data: e2 } = await this._request.send("auth.getLinkedUidList", {}); let t2 = false; const { users: n2 } = e2; return n2.forEach((e3) => { e3.wxOpenId && e3.wxPublicId && (t2 = true); }), { users: n2, hasPrimaryUid: t2 }; } setPrimaryUid(e2) { return this._request.send("auth.setPrimaryUid", { uid: e2 }); } unlink(e2) { return this._request.send("auth.unlink", { platform: e2 }); } async update(e2) { const { nickName: t2, gender: n2, avatarUrl: s2, province: r2, country: i2, city: o2 } = e2, { data: a2 } = await this._request.send("auth.updateUserInfo", { nickName: t2, gender: n2, avatarUrl: s2, province: r2, country: i2, city: o2 }); this.setLocalUserInfo(a2); } async refresh() { const { data: e2 } = await this._request.send("auth.getUserInfo", {}); return this.setLocalUserInfo(e2), e2; } setUserInfo() { const { userInfoKey: e2 } = this._cache.keys, t2 = this._cache.getStore(e2); ["uid", "loginType", "openid", "wxOpenId", "wxPublicId", "unionId", "qqMiniOpenId", "email", "hasPassword", "customUserId", "nickName", "gender", "avatarUrl"].forEach((e3) => { this[e3] = t2[e3]; }), this.location = { country: t2.country, province: t2.province, city: t2.city }; } setLocalUserInfo(e2) { const { userInfoKey: t2 } = this._cache.keys; this._cache.setStore(t2, e2), this.setUserInfo(); } } class et { constructor(e2) { if (!e2) throw new ne({ code: "PARAM_ERROR", message: "envId is not defined" }); this._cache = Re(e2); const { refreshTokenKey: t2, accessTokenKey: n2, accessTokenExpireKey: s2 } = this._cache.keys, r2 = this._cache.getStore(t2), i2 = this._cache.getStore(n2), o2 = this._cache.getStore(s2); this.credential = { refreshToken: r2, accessToken: i2, accessTokenExpire: o2 }, this.user = new Ze(e2); } get isAnonymousAuth() { return this.loginType === We.ANONYMOUS; } get isCustomAuth() { return this.loginType === We.CUSTOM; } get isWeixinAuth() { return this.loginType === We.WECHAT || this.loginType === We.WECHAT_OPEN || this.loginType === We.WECHAT_PUBLIC; } get loginType() { return this._cache.getStore(this._cache.keys.loginTypeKey); } } class tt extends Xe { async signIn() { this._cache.updatePersistence("local"); const { anonymousUuidKey: e2, refreshTokenKey: t2 } = this._cache.keys, n2 = this._cache.getStore(e2) || void 0, s2 = this._cache.getStore(t2) || void 0, r2 = await this._request.send("auth.signInAnonymously", { anonymous_uuid: n2, refresh_token: s2 }); if (r2.uuid && r2.refresh_token) { this._setAnonymousUUID(r2.uuid), this.setRefreshToken(r2.refresh_token), await this._request.refreshAccessToken(), Fe(qe), Fe(je, { env: this.config.env, loginType: We.ANONYMOUS, persistence: "local" }); const e3 = new et(this.config.env); return await e3.user.refresh(), e3; } throw new ne({ message: "匿名登录失败" }); } async linkAndRetrieveDataWithTicket(e2) { const { anonymousUuidKey: t2, refreshTokenKey: n2 } = this._cache.keys, s2 = this._cache.getStore(t2), r2 = this._cache.getStore(n2), i2 = await this._request.send("auth.linkAndRetrieveDataWithTicket", { anonymous_uuid: s2, refresh_token: r2, ticket: e2 }); if (i2.refresh_token) return this._clearAnonymousUUID(), this.setRefreshToken(i2.refresh_token), await this._request.refreshAccessToken(), Fe(Be, { env: this.config.env }), Fe(je, { loginType: We.CUSTOM, persistence: "local" }), { credential: { refreshToken: i2.refresh_token } }; throw new ne({ message: "匿名转化失败" }); } _setAnonymousUUID(e2) { const { anonymousUuidKey: t2, loginTypeKey: n2 } = this._cache.keys; this._cache.removeStore(t2), this._cache.setStore(t2, e2), this._cache.setStore(n2, We.ANONYMOUS); } _clearAnonymousUUID() { this._cache.removeStore(this._cache.keys.anonymousUuidKey); } } class nt extends Xe { async signIn(e2) { if ("string" != typeof e2) throw new ne({ code: "PARAM_ERROR", message: "ticket must be a string" }); const { refreshTokenKey: t2 } = this._cache.keys, n2 = await this._request.send("auth.signInWithTicket", { ticket: e2, refresh_token: this._cache.getStore(t2) || "" }); if (n2.refresh_token) return this.setRefreshToken(n2.refresh_token), await this._request.refreshAccessToken(), Fe(qe), Fe(je, { env: this.config.env, loginType: We.CUSTOM, persistence: this.config.persistence }), await this.refreshUserInfo(), new et(this.config.env); throw new ne({ message: "自定义登录失败" }); } } class st extends Xe { async signIn(e2, t2) { if ("string" != typeof e2) throw new ne({ code: "PARAM_ERROR", message: "email must be a string" }); const { refreshTokenKey: n2 } = this._cache.keys, s2 = await this._request.send("auth.signIn", { loginType: "EMAIL", email: e2, password: t2, refresh_token: this._cache.getStore(n2) || "" }), { refresh_token: r2, access_token: i2, access_token_expire: o2 } = s2; if (r2) return this.setRefreshToken(r2), i2 && o2 ? this.setAccessToken(i2, o2) : await this._request.refreshAccessToken(), await this.refreshUserInfo(), Fe(qe), Fe(je, { env: this.config.env, loginType: We.EMAIL, persistence: this.config.persistence }), new et(this.config.env); throw s2.code ? new ne({ code: s2.code, message: `邮箱登录失败: ${s2.message}` }) : new ne({ message: "邮箱登录失败" }); } async activate(e2) { return this._request.send("auth.activateEndUserMail", { token: e2 }); } async resetPasswordWithToken(e2, t2) { return this._request.send("auth.resetPasswordWithToken", { token: e2, newPassword: t2 }); } } class rt extends Xe { async signIn(e2, t2) { if ("string" != typeof e2) throw new ne({ code: "PARAM_ERROR", message: "username must be a string" }); "string" != typeof t2 && (t2 = "", console.warn("password is empty")); const { refreshTokenKey: n2 } = this._cache.keys, s2 = await this._request.send("auth.signIn", { loginType: We.USERNAME, username: e2, password: t2, refresh_token: this._cache.getStore(n2) || "" }), { refresh_token: r2, access_token_expire: i2, access_token: o2 } = s2; if (r2) return this.setRefreshToken(r2), o2 && i2 ? this.setAccessToken(o2, i2) : await this._request.refreshAccessToken(), await this.refreshUserInfo(), Fe(qe), Fe(je, { env: this.config.env, loginType: We.USERNAME, persistence: this.config.persistence }), new et(this.config.env); throw s2.code ? new ne({ code: s2.code, message: `用户名密码登录失败: ${s2.message}` }) : new ne({ message: "用户名密码登录失败" }); } } class it { constructor(e2) { this.config = e2, this._cache = Re(e2.env), this._request = Qe(e2.env), this._onAnonymousConverted = this._onAnonymousConverted.bind(this), this._onLoginTypeChanged = this._onLoginTypeChanged.bind(this), De(je, this._onLoginTypeChanged); } get currentUser() { const e2 = this.hasLoginState(); return e2 && e2.user || null; } get loginType() { return this._cache.getStore(this._cache.keys.loginTypeKey); } anonymousAuthProvider() { return new tt(this.config); } customAuthProvider() { return new nt(this.config); } emailAuthProvider() { return new st(this.config); } usernameAuthProvider() { return new rt(this.config); } async signInAnonymously() { return new tt(this.config).signIn(); } async signInWithEmailAndPassword(e2, t2) { return new st(this.config).signIn(e2, t2); } signInWithUsernameAndPassword(e2, t2) { return new rt(this.config).signIn(e2, t2); } async linkAndRetrieveDataWithTicket(e2) { this._anonymousAuthProvider || (this._anonymousAuthProvider = new tt(this.config)), De(Be, this._onAnonymousConverted); return await this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e2); } async signOut() { if (this.loginType === We.ANONYMOUS) throw new ne({ message: "匿名用户不支持登出操作" }); const { refreshTokenKey: e2, accessTokenKey: t2, accessTokenExpireKey: n2 } = this._cache.keys, s2 = this._cache.getStore(e2); if (!s2) return; const r2 = await this._request.send("auth.logout", { refresh_token: s2 }); return this._cache.removeStore(e2), this._cache.removeStore(t2), this._cache.removeStore(n2), Fe(qe), Fe(je, { env: this.config.env, loginType: We.NULL, persistence: this.config.persistence }), r2; } async signUpWithEmailAndPassword(e2, t2) { return this._request.send("auth.signUpWithEmailAndPassword", { email: e2, password: t2 }); } async sendPasswordResetEmail(e2) { return this._request.send("auth.sendPasswordResetEmail", { email: e2 }); } onLoginStateChanged(e2) { De(qe, () => { const t3 = this.hasLoginState(); e2.call(this, t3); }); const t2 = this.hasLoginState(); e2.call(this, t2); } onLoginStateExpired(e2) { De(Ke, e2.bind(this)); } onAccessTokenRefreshed(e2) { De($e, e2.bind(this)); } onAnonymousConverted(e2) { De(Be, e2.bind(this)); } onLoginTypeChanged(e2) { De(je, () => { const t2 = this.hasLoginState(); e2.call(this, t2); }); } async getAccessToken() { return { accessToken: (await this._request.getAccessToken()).accessToken, env: this.config.env }; } hasLoginState() { const { refreshTokenKey: e2 } = this._cache.keys; return this._cache.getStore(e2) ? new et(this.config.env) : null; } async isUsernameRegistered(e2) { if ("string" != typeof e2) throw new ne({ code: "PARAM_ERROR", message: "username must be a string" }); const { data: t2 } = await this._request.send("auth.isUsernameRegistered", { username: e2 }); return t2 && t2.isRegistered; } getLoginState() { return Promise.resolve(this.hasLoginState()); } async signInWithTicket(e2) { return new nt(this.config).signIn(e2); } shouldRefreshAccessToken(e2) { this._request._shouldRefreshAccessTokenHook = e2.bind(this); } getUserInfo() { return this._request.send("auth.getUserInfo", {}).then((e2) => e2.code ? e2 : { ...e2.data, requestId: e2.seqId }); } getAuthHeader() { const { refreshTokenKey: e2, accessTokenKey: t2 } = this._cache.keys, n2 = this._cache.getStore(e2); return { "x-cloudbase-credentials": this._cache.getStore(t2) + "/@@/" + n2 }; } _onAnonymousConverted(e2) { const { env: t2 } = e2.data; t2 === this.config.env && this._cache.updatePersistence(this.config.persistence); } _onLoginTypeChanged(e2) { const { loginType: t2, persistence: n2, env: s2 } = e2.data; s2 === this.config.env && (this._cache.updatePersistence(n2), this._cache.setStore(this._cache.keys.loginTypeKey, t2)); } } const ot = function(e2, t2) { t2 = t2 || ve(); const n2 = Qe(this.config.env), { cloudPath: s2, filePath: r2, onUploadProgress: i2, fileType: o2 = "image" } = e2; return n2.send("storage.getUploadMetadata", { path: s2 }).then((e3) => { const { data: { url: a2, authorization: c2, token: u2, fileId: h2, cosFileId: l2 }, requestId: d2 } = e3, p2 = { key: s2, signature: c2, "x-cos-meta-fileid": l2, success_action_status: "201", "x-cos-security-token": u2 }; n2.upload({ url: a2, data: p2, file: r2, name: s2, fileType: o2, onUploadProgress: i2 }).then((e4) => { 201 === e4.statusCode ? t2(null, { fileID: h2, requestId: d2 }) : t2(new ne({ code: "STORAGE_REQUEST_FAIL", message: `STORAGE_REQUEST_FAIL: ${e4.data}` })); }).catch((e4) => { t2(e4); }); }).catch((e3) => { t2(e3); }), t2.promise; }, at = function(e2, t2) { t2 = t2 || ve(); const n2 = Qe(this.config.env), { cloudPath: s2 } = e2; return n2.send("storage.getUploadMetadata", { path: s2 }).then((e3) => { t2(null, e3); }).catch((e3) => { t2(e3); }), t2.promise; }, ct = function({ fileList: e2 }, t2) { if (t2 = t2 || ve(), !e2 || !Array.isArray(e2)) return { code: "INVALID_PARAM", message: "fileList必须是非空的数组" }; for (let t3 of e2) if (!t3 || "string" != typeof t3) return { code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" }; const n2 = { fileid_list: e2 }; return Qe(this.config.env).send("storage.batchDeleteFile", n2).then((e3) => { e3.code ? t2(null, e3) : t2(null, { fileList: e3.data.delete_list, requestId: e3.requestId }); }).catch((e3) => { t2(e3); }), t2.promise; }, ut = function({ fileList: e2 }, t2) { t2 = t2 || ve(), e2 && Array.isArray(e2) || t2(null, { code: "INVALID_PARAM", message: "fileList必须是非空的数组" }); let n2 = []; for (let s3 of e2) "object" == typeof s3 ? (s3.hasOwnProperty("fileID") && s3.hasOwnProperty("maxAge") || t2(null, { code: "INVALID_PARAM", message: "fileList的元素必须是包含fileID和maxAge的对象" }), n2.push({ fileid: s3.fileID, max_age: s3.maxAge })) : "string" == typeof s3 ? n2.push({ fileid: s3 }) : t2(null, { code: "INVALID_PARAM", message: "fileList的元素必须是字符串" }); const s2 = { file_list: n2 }; return Qe(this.config.env).send("storage.batchGetDownloadUrl", s2).then((e3) => { e3.code ? t2(null, e3) : t2(null, { fileList: e3.data.download_list, requestId: e3.requestId }); }).catch((e3) => { t2(e3); }), t2.promise; }, ht = async function({ fileID: e2 }, t2) { const n2 = (await ut.call(this, { fileList: [{ fileID: e2, maxAge: 600 }] })).fileList[0]; if ("SUCCESS" !== n2.code) return t2 ? t2(n2) : new Promise((e3) => { e3(n2); }); const s2 = Qe(this.config.env); let r2 = n2.download_url; if (r2 = encodeURI(r2), !t2) return s2.download({ url: r2 }); t2(await s2.download({ url: r2 })); }, lt = function({ name: e2, data: t2, query: n2, parse: s2, search: r2 }, i2) { const o2 = i2 || ve(); let a2; try { a2 = t2 ? JSON.stringify(t2) : ""; } catch (e3) { return Promise.reject(e3); } if (!e2) return Promise.reject(new ne({ code: "PARAM_ERROR", message: "函数名不能为空" })); const c2 = { inQuery: n2, parse: s2, search: r2, function_name: e2, request_data: a2 }; return Qe(this.config.env).send("functions.invokeFunction", c2).then((e3) => { if (e3.code) o2(null, e3); else { let t3 = e3.data.response_data; if (s2) o2(null, { result: t3, requestId: e3.requestId }); else try { t3 = JSON.parse(e3.data.response_data), o2(null, { result: t3, requestId: e3.requestId }); } catch (e4) { o2(new ne({ message: "response data must be json" })); } } return o2.promise; }).catch((e3) => { o2(e3); }), o2.promise; }, dt = { timeout: 15e3, persistence: "session" }, pt = {}; class ft { constructor(e2) { this.config = e2 || this.config, this.authObj = void 0; } init(e2) { switch (Ce.adapter || (this.requestClient = new Ce.adapter.reqClass({ timeout: e2.timeout || 5e3, timeoutMsg: `请求在${(e2.timeout || 5e3) / 1e3}s内未完成,已中断` })), this.config = { ...dt, ...e2 }, true) { case this.config.timeout > 6e5: console.warn("timeout大于可配置上限[10分钟],已重置为上限数值"), this.config.timeout = 6e5; break; case this.config.timeout < 100: console.warn("timeout小于可配置下限[100ms],已重置为下限数值"), this.config.timeout = 100; } return new ft(this.config); } auth({ persistence: e2 } = {}) { if (this.authObj) return this.authObj; const t2 = e2 || Ce.adapter.primaryStorage || dt.persistence; var n2; return t2 !== this.config.persistence && (this.config.persistence = t2), function(e3) { const { env: t3 } = e3; Oe[t3] = new Ee(e3), xe[t3] = new Ee({ ...e3, persistence: "local" }); }(this.config), n2 = this.config, Ye[n2.env] = new Ve(n2), this.authObj = new it(this.config), this.authObj; } on(e2, t2) { return De.apply(this, [e2, t2]); } off(e2, t2) { return Me.apply(this, [e2, t2]); } callFunction(e2, t2) { return lt.apply(this, [e2, t2]); } deleteFile(e2, t2) { return ct.apply(this, [e2, t2]); } getTempFileURL(e2, t2) { return ut.apply(this, [e2, t2]); } downloadFile(e2, t2) { return ht.apply(this, [e2, t2]); } uploadFile(e2, t2) { return ot.apply(this, [e2, t2]); } getUploadMetadata(e2, t2) { return at.apply(this, [e2, t2]); } registerExtension(e2) { pt[e2.name] = e2; } async invokeExtension(e2, t2) { const n2 = pt[e2]; if (!n2) throw new ne({ message: `扩展${e2} 必须先注册` }); return await n2.invoke(t2, this); } useAdapters(e2) { const { adapter: t2, runtime: n2 } = ke(e2) || {}; t2 && (Ce.adapter = t2), n2 && (Ce.runtime = n2); } } var gt = new ft(); function mt(e2, t2, n2) { void 0 === n2 && (n2 = {}); var s2 = /\?/.test(t2), r2 = ""; for (var i2 in n2) "" === r2 ? !s2 && (t2 += "?") : r2 += "&", r2 += i2 + "=" + encodeURIComponent(n2[i2]); return /^http(s)?:\/\//.test(t2 += r2) ? t2 : "" + e2 + t2; } class yt { post(e2) { const { url: t2, data: n2, headers: s2 } = e2; return new Promise((e3, r2) => { se.request({ url: mt("https:", t2), data: n2, method: "POST", header: s2, success(t3) { e3(t3); }, fail(e4) { r2(e4); } }); }); } upload(e2) { return new Promise((t2, n2) => { const { url: s2, file: r2, data: i2, headers: o2, fileType: a2 } = e2, c2 = se.uploadFile({ url: mt("https:", s2), name: "file", formData: Object.assign({}, i2), filePath: r2, fileType: a2, header: o2, success(e3) { const n3 = { statusCode: e3.statusCode, data: e3.data || {} }; 200 === e3.statusCode && i2.success_action_status && (n3.statusCode = parseInt(i2.success_action_status, 10)), t2(n3); }, fail(e3) { n2(new Error(e3.errMsg || "uploadFile:fail")); } }); "function" == typeof e2.onUploadProgress && c2 && "function" == typeof c2.onProgressUpdate && c2.onProgressUpdate((t3) => { e2.onUploadProgress({ loaded: t3.totalBytesSent, total: t3.totalBytesExpectedToSend }); }); }); } } const _t = { setItem(e2, t2) { se.setStorageSync(e2, t2); }, getItem: (e2) => se.getStorageSync(e2), removeItem(e2) { se.removeStorageSync(e2); }, clear() { se.clearStorageSync(); } }; var wt = { genAdapter: function() { return { root: {}, reqClass: yt, localStorage: _t, primaryStorage: "local" }; }, isMatch: function() { return true; }, runtime: "uni_app" }; gt.useAdapters(wt); const vt = gt, It = vt.init; vt.init = function(e2) { e2.env = e2.spaceId; const t2 = It.call(this, e2); t2.config.provider = "tencent", t2.config.spaceId = e2.spaceId; const n2 = t2.auth; return t2.auth = function(e3) { const t3 = n2.call(this, e3); return ["linkAndRetrieveDataWithTicket", "signInAnonymously", "signOut", "getAccessToken", "getLoginState", "signInWithTicket", "getUserInfo"].forEach((e4) => { var n3; t3[e4] = (n3 = t3[e4], function(e5) { e5 = e5 || {}; const { success: t4, fail: s2, complete: r2 } = te(e5); if (!(t4 || s2 || r2)) return n3.call(this, e5); n3.call(this, e5).then((e6) => { t4 && t4(e6), r2 && r2(e6); }, (e6) => { s2 && s2(e6), r2 && r2(e6); }); }).bind(t3); }), t3; }, t2.customAuth = t2.auth, t2; }; var St = vt; var bt = class extends ge { getAccessToken() { return new Promise((e2, t2) => { const n2 = "Anonymous_Access_token"; this.setAccessToken(n2), e2(n2); }); } setupRequest(e2, t2) { const n2 = Object.assign({}, e2, { spaceId: this.config.spaceId, timestamp: Date.now() }), s2 = { "Content-Type": "application/json" }; "auth" !== t2 && (n2.token = this.accessToken, s2["x-basement-token"] = this.accessToken), s2["x-serverless-sign"] = de.sign(n2, this.config.clientSecret); const r2 = le(); s2["x-client-info"] = encodeURIComponent(JSON.stringify(r2)); const { token: i2 } = ie(); return s2["x-client-token"] = i2, { url: this.config.requestUrl, method: "POST", data: n2, dataType: "json", header: JSON.parse(JSON.stringify(s2)) }; } uploadFileToOSS({ url: e2, formData: t2, name: n2, filePath: s2, fileType: r2, onUploadProgress: i2 }) { return new Promise((o2, a2) => { const c2 = this.adapter.uploadFile({ url: e2, formData: t2, name: n2, filePath: s2, fileType: r2, success(e3) { e3 && e3.statusCode < 400 ? o2(e3) : a2(new ne({ code: "UPLOAD_FAILED", message: "文件上传失败" })); }, fail(e3) { a2(new ne({ code: e3.code || "UPLOAD_FAILED", message: e3.message || e3.errMsg || "文件上传失败" })); } }); "function" == typeof i2 && c2 && "function" == typeof c2.onProgressUpdate && c2.onProgressUpdate((e3) => { i2({ loaded: e3.totalBytesSent, total: e3.totalBytesExpectedToSend }); }); }); } uploadFile({ filePath: e2, cloudPath: t2, fileType: n2 = "image", onUploadProgress: s2 }) { if (!t2) throw new ne({ code: "CLOUDPATH_REQUIRED", message: "cloudPath不可为空" }); let r2; return this.getOSSUploadOptionsFromPath({ cloudPath: t2 }).then((t3) => { const { url: i2, formData: o2, name: a2 } = t3.result; r2 = t3.result.fileUrl; const c2 = { url: i2, formData: o2, name: a2, filePath: e2, fileType: n2 }; return this.uploadFileToOSS(Object.assign({}, c2, { onUploadProgress: s2 })); }).then(() => this.reportOSSUpload({ cloudPath: t2 })).then((t3) => new Promise((n3, s3) => { t3.success ? n3({ success: true, filePath: e2, fileID: r2 }) : s3(new ne({ code: "UPLOAD_FAILED", message: "文件上传失败" })); })); } deleteFile({ fileList: e2 }) { const t2 = { method: "serverless.file.resource.delete", params: JSON.stringify({ fileList: e2 }) }; return this.request(this.setupRequest(t2)).then((e3) => { if (e3.success) return e3.result; throw new ne({ code: "DELETE_FILE_FAILED", message: "删除文件失败" }); }); } getTempFileURL({ fileList: e2 } = {}) { if (!Array.isArray(e2) || 0 === e2.length) throw new ne({ code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" }); const t2 = { method: "serverless.file.resource.getTempFileURL", params: JSON.stringify({ fileList: e2 }) }; return this.request(this.setupRequest(t2)).then((e3) => { if (e3.success) return { fileList: e3.result.fileList.map((e4) => ({ fileID: e4.fileID, tempFileURL: e4.tempFileURL })) }; throw new ne({ code: "GET_TEMP_FILE_URL_FAILED", message: "获取临时文件链接失败" }); }); } }; var kt = { init(e2) { const t2 = new bt(e2), n2 = { signInAnonymously: function() { return t2.authorize(); }, getLoginState: function() { return Promise.resolve(false); } }; return t2.auth = function() { return n2; }, t2.customAuth = t2.auth, t2; } }; function Ct({ data: e2 }) { let t2; t2 = le(); const n2 = JSON.parse(JSON.stringify(e2 || {})); if (Object.assign(n2, { clientInfo: t2 }), !n2.uniIdToken) { const { token: e3 } = ie(); e3 && (n2.uniIdToken = e3); } return n2; } async function Tt({ name: e2, data: t2 } = {}) { await this.__dev__.initLocalNetwork(); const { localAddress: n2, localPort: s2 } = this.__dev__, r2 = { aliyun: "aliyun", tencent: "tcb" }[this.config.provider], i2 = this.config.spaceId, o2 = `http://${n2}:${s2}/system/check-function`, a2 = `http://${n2}:${s2}/cloudfunctions/${e2}`; return new Promise((t3, n3) => { se.request({ method: "POST", url: o2, data: { name: e2, platform: P, provider: r2, spaceId: i2 }, timeout: 3e3, success(e3) { t3(e3); }, fail() { t3({ data: { code: "NETWORK_ERROR", message: "连接本地调试服务失败,请检查客户端是否和主机在同一局域网下,自动切换为已部署的云函数。" } }); } }); }).then(({ data: e3 } = {}) => { const { code: t3, message: n3 } = e3 || {}; return { code: 0 === t3 ? 0 : t3 || "SYS_ERR", message: n3 || "SYS_ERR" }; }).then(({ code: n3, message: s3 }) => { if (0 !== n3) { switch (n3) { case "MODULE_ENCRYPTED": console.error(`此云函数(${e2})依赖加密公共模块不可本地调试,自动切换为云端已部署的云函数`); break; case "FUNCTION_ENCRYPTED": console.error(`此云函数(${e2})已加密不可本地调试,自动切换为云端已部署的云函数`); break; case "ACTION_ENCRYPTED": console.error(s3 || "需要访问加密的uni-clientDB-action,自动切换为云端环境"); break; case "NETWORK_ERROR": { const e3 = "连接本地调试服务失败,请检查客户端是否和主机在同一局域网下"; throw console.error(e3), new Error(e3); } case "SWITCH_TO_CLOUD": break; default: { const e3 = `检测本地调试服务出现错误:${s3},请检查网络环境或重启客户端再试`; throw console.error(e3), new Error(e3); } } return this._callCloudFunction({ name: e2, data: t2 }); } return new Promise((e3, n4) => { const s4 = Ct.call(this, { data: t2 }); se.request({ method: "POST", url: a2, data: { provider: r2, platform: P, param: s4 }, success: ({ statusCode: t3, data: s5 } = {}) => !t3 || t3 >= 400 ? n4(new ne({ code: s5.code || "SYS_ERR", message: s5.message || "request:fail" })) : e3({ result: s5 }), fail(e4) { n4(new ne({ code: e4.code || e4.errCode || "SYS_ERR", message: e4.message || e4.errMsg || "request:fail" })); } }); }); }); } const Pt = [{ rule: /fc_function_not_found|FUNCTION_NOT_FOUND/, content: ",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间", mode: "append" }]; var At = /[\\^$.*+?()[\]{}|]/g, Et = RegExp(At.source); function Ot(e2, t2, n2) { return e2.replace(new RegExp((s2 = t2) && Et.test(s2) ? s2.replace(At, "\\$&") : s2, "g"), n2); var s2; } const Rt = "request", Ut = "response", Lt = "both"; const yn = { code: 2e4, message: "System error" }, _n = { code: 20101, message: "Invalid client" }; function In(e2) { const { errSubject: t2, subject: n2, errCode: s2, errMsg: r2, code: i2, message: o2, cause: a2 } = e2 || {}; return new ne({ subject: t2 || n2 || "uni-secure-network", code: s2 || i2 || yn.code, message: r2 || o2, cause: a2 }); } let bn; function An({ secretType: e2 } = {}) { return e2 === Rt || e2 === Ut || e2 === Lt; } function En({ name: e2, data: t2 = {} } = {}) { return "DCloud-clientDB" === e2 && "encryption" === t2.redirectTo && "getAppClientKey" === t2.action; } function On({ provider: e2, spaceId: t2, functionName: n2 } = {}) { const { appId: s2, uniPlatform: r2, osName: i2 } = ue(); let o2 = r2; "app" === r2 && (o2 = i2); const a2 = function({ provider: e3, spaceId: t3 } = {}) { const n3 = T; if (!n3) return {}; e3 = function(e4) { return "tencent" === e4 ? "tcb" : e4; }(e3); const s3 = n3.find((n4) => n4.provider === e3 && n4.spaceId === t3); return s3 && s3.config; }({ provider: e2, spaceId: t2 }); if (!a2 || !a2.accessControl || !a2.accessControl.enable) return false; const c2 = a2.accessControl.function || {}, u2 = Object.keys(c2); if (0 === u2.length) return true; const h2 = function(e3, t3) { let n3, s3, r3; for (let i3 = 0; i3 < e3.length; i3++) { const o3 = e3[i3]; o3 !== t3 ? "*" !== o3 ? o3.split(",").map((e4) => e4.trim()).indexOf(t3) > -1 && (s3 = o3) : r3 = o3 : n3 = o3; } return n3 || s3 || r3; }(u2, n2); if (!h2) return false; if ((c2[h2] || []).find((e3 = {}) => e3.appId === s2 && (e3.platform || "").toLowerCase() === o2.toLowerCase())) return true; throw console.error(`此应用[appId: ${s2}, platform: ${o2}]不在云端配置的允许访问的应用列表内,参考:https://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client`), In(_n); } function xn({ functionName: e2, result: t2, logPvd: n2 }) { if (this.__dev__.debugLog && t2 && t2.requestId) { const s2 = JSON.stringify({ spaceId: this.config.spaceId, functionName: e2, requestId: t2.requestId }); console.log(`[${n2}-request]${s2}[/${n2}-request]`); } } function Rn(e2) { const t2 = e2.callFunction, n2 = function(n3) { const s2 = n3.name; n3.data = Ct.call(e2, { data: n3.data }); const r2 = { aliyun: "aliyun", tencent: "tcb", tcb: "tcb" }[this.config.provider], i2 = An(n3), o2 = En(n3), a2 = i2 || o2; return t2.call(this, n3).then((e3) => (e3.errCode = 0, !a2 && xn.call(this, { functionName: s2, result: e3, logPvd: r2 }), Promise.resolve(e3)), (e3) => (!a2 && xn.call(this, { functionName: s2, result: e3, logPvd: r2 }), e3 && e3.message && (e3.message = function({ message: e4 = "", extraInfo: t3 = {}, formatter: n4 = [] } = {}) { for (let s3 = 0; s3 < n4.length; s3++) { const { rule: r3, content: i3, mode: o3 } = n4[s3], a3 = e4.match(r3); if (!a3) continue; let c2 = i3; for (let e5 = 1; e5 < a3.length; e5++) c2 = Ot(c2, `{$${e5}}`, a3[e5]); for (const e5 in t3) c2 = Ot(c2, `{${e5}}`, t3[e5]); return "replace" === o3 ? c2 : e4 + c2; } return e4; }({ message: `[${n3.name}]: ${e3.message}`, formatter: Pt, extraInfo: { functionName: s2 } })), Promise.reject(e3))); }; e2.callFunction = function(t3) { const { provider: s2, spaceId: r2 } = e2.config, i2 = t3.name; let o2, a2; if (t3.data = t3.data || {}, e2.__dev__.debugInfo && !e2.__dev__.debugInfo.forceRemote && E ? (e2._callCloudFunction || (e2._callCloudFunction = n2, e2._callLocalFunction = Tt), o2 = Tt) : o2 = n2, o2 = o2.bind(e2), En(t3)) a2 = n2.call(e2, t3); else if (An(t3)) { a2 = new bn({ secretType: t3.secretType, uniCloudIns: e2 }).wrapEncryptDataCallFunction(n2.bind(e2))(t3); } else if (On({ provider: s2, spaceId: r2, functionName: i2 })) { a2 = new bn({ secretType: t3.secretType, uniCloudIns: e2 }).wrapVerifyClientCallFunction(n2.bind(e2))(t3); } else a2 = o2(t3); return Object.defineProperty(a2, "result", { get: () => (console.warn("当前返回结果为Promise类型,不可直接访问其result属性,详情请参考:https://uniapp.dcloud.net.cn/uniCloud/faq?id=promise"), {}) }), a2; }; } bn = class { constructor() { throw In({ message: `Platform ${P} is not enabled, please check whether secure network module is enabled in your manifest.json` }); } }; const Un = Symbol("CLIENT_DB_INTERNAL"); function Ln(e2, t2) { return e2.then = "DoNotReturnProxyWithAFunctionNamedThen", e2._internalType = Un, e2.inspect = null, e2.__v_raw = void 0, new Proxy(e2, { get(e3, n2, s2) { if ("_uniClient" === n2) return null; if ("symbol" == typeof n2) return e3[n2]; if (n2 in e3 || "string" != typeof n2) { const t3 = e3[n2]; return "function" == typeof t3 ? t3.bind(e3) : t3; } return t2.get(e3, n2, s2); } }); } function Nn(e2) { return { on: (t2, n2) => { e2[t2] = e2[t2] || [], e2[t2].indexOf(n2) > -1 || e2[t2].push(n2); }, off: (t2, n2) => { e2[t2] = e2[t2] || []; const s2 = e2[t2].indexOf(n2); -1 !== s2 && e2[t2].splice(s2, 1); } }; } const Dn = ["db.Geo", "db.command", "command.aggregate"]; function Fn(e2, t2) { return Dn.indexOf(`${e2}.${t2}`) > -1; } function Mn(e2) { switch (g(e2 = re(e2))) { case "array": return e2.map((e3) => Mn(e3)); case "object": return e2._internalType === Un || Object.keys(e2).forEach((t2) => { e2[t2] = Mn(e2[t2]); }), e2; case "regexp": return { $regexp: { source: e2.source, flags: e2.flags } }; case "date": return { $date: e2.toISOString() }; default: return e2; } } function qn(e2) { return e2 && e2.content && e2.content.$method; } class Kn { constructor(e2, t2, n2) { this.content = e2, this.prevStage = t2 || null, this.udb = null, this._database = n2; } toJSON() { let e2 = this; const t2 = [e2.content]; for (; e2.prevStage; ) e2 = e2.prevStage, t2.push(e2.content); return { $db: t2.reverse().map((e3) => ({ $method: e3.$method, $param: Mn(e3.$param) })) }; } toString() { return JSON.stringify(this.toJSON()); } getAction() { const e2 = this.toJSON().$db.find((e3) => "action" === e3.$method); return e2 && e2.$param && e2.$param[0]; } getCommand() { return { $db: this.toJSON().$db.filter((e2) => "action" !== e2.$method) }; } get isAggregate() { let e2 = this; for (; e2; ) { const t2 = qn(e2), n2 = qn(e2.prevStage); if ("aggregate" === t2 && "collection" === n2 || "pipeline" === t2) return true; e2 = e2.prevStage; } return false; } get isCommand() { let e2 = this; for (; e2; ) { if ("command" === qn(e2)) return true; e2 = e2.prevStage; } return false; } get isAggregateCommand() { let e2 = this; for (; e2; ) { const t2 = qn(e2), n2 = qn(e2.prevStage); if ("aggregate" === t2 && "command" === n2) return true; e2 = e2.prevStage; } return false; } getNextStageFn(e2) { const t2 = this; return function() { return jn({ $method: e2, $param: Mn(Array.from(arguments)) }, t2, t2._database); }; } get count() { return this.isAggregate ? this.getNextStageFn("count") : function() { return this._send("count", Array.from(arguments)); }; } get remove() { return this.isCommand ? this.getNextStageFn("remove") : function() { return this._send("remove", Array.from(arguments)); }; } get() { return this._send("get", Array.from(arguments)); } get add() { return this.isCommand ? this.getNextStageFn("add") : function() { return this._send("add", Array.from(arguments)); }; } update() { return this._send("update", Array.from(arguments)); } end() { return this._send("end", Array.from(arguments)); } get set() { return this.isCommand ? this.getNextStageFn("set") : function() { throw new Error("JQL禁止使用set方法"); }; } _send(e2, t2) { const n2 = this.getAction(), s2 = this.getCommand(); if (s2.$db.push({ $method: e2, $param: Mn(t2) }), b) { const e3 = s2.$db.find((e4) => "collection" === e4.$method), t3 = e3 && e3.$param; t3 && 1 === t3.length && "string" == typeof e3.$param[0] && e3.$param[0].indexOf(",") > -1 && console.warn("检测到使用JQL语法联表查询时,未使用getTemp先过滤主表数据,在主表数据量大的情况下可能会查询缓慢。\n- 如何优化请参考此文档:https://uniapp.dcloud.net.cn/uniCloud/jql?id=lookup-with-temp \n- 如果主表数据量很小请忽略此信息,项目发行时不会出现此提示。"); } return this._database._callCloudFunction({ action: n2, command: s2 }); } } function jn(e2, t2, n2) { return Ln(new Kn(e2, t2, n2), { get(e3, t3) { let s2 = "db"; return e3 && e3.content && (s2 = e3.content.$method), Fn(s2, t3) ? jn({ $method: t3 }, e3, n2) : function() { return jn({ $method: t3, $param: Mn(Array.from(arguments)) }, e3, n2); }; } }); } function Bn({ path: e2, method: t2 }) { return class { constructor() { this.param = Array.from(arguments); } toJSON() { return { $newDb: [...e2.map((e3) => ({ $method: e3 })), { $method: t2, $param: this.param }] }; } toString() { return JSON.stringify(this.toJSON()); } }; } function $n(e2, t2 = {}) { return Ln(new e2(t2), { get: (e3, t3) => Fn("db", t3) ? jn({ $method: t3 }, null, e3) : function() { return jn({ $method: t3, $param: Mn(Array.from(arguments)) }, null, e3); } }); } class Wn extends class { constructor({ uniClient: e2 = {}, isJQL: t2 = false } = {}) { this._uniClient = e2, this._authCallBacks = {}, this._dbCallBacks = {}, e2._isDefault && (this._dbCallBacks = U("_globalUniCloudDatabaseCallback")), t2 || (this.auth = Nn(this._authCallBacks)), this._isJQL = t2, Object.assign(this, Nn(this._dbCallBacks)), this.env = Ln({}, { get: (e3, t3) => ({ $env: t3 }) }), this.Geo = Ln({}, { get: (e3, t3) => Bn({ path: ["Geo"], method: t3 }) }), this.serverDate = Bn({ path: [], method: "serverDate" }), this.RegExp = Bn({ path: [], method: "RegExp" }); } getCloudEnv(e2) { if ("string" != typeof e2 || !e2.trim()) throw new Error("getCloudEnv参数错误"); return { $env: e2.replace("$cloudEnv_", "") }; } _callback(e2, t2) { const n2 = this._dbCallBacks; n2[e2] && n2[e2].forEach((e3) => { e3(...t2); }); } _callbackAuth(e2, t2) { const n2 = this._authCallBacks; n2[e2] && n2[e2].forEach((e3) => { e3(...t2); }); } multiSend() { const e2 = Array.from(arguments), t2 = e2.map((e3) => { const t3 = e3.getAction(), n2 = e3.getCommand(); if ("getTemp" !== n2.$db[n2.$db.length - 1].$method) throw new Error("multiSend只支持子命令内使用getTemp"); return { action: t3, command: n2 }; }); return this._callCloudFunction({ multiCommand: t2, queryList: e2 }); } } { _parseResult(e2) { return this._isJQL ? e2.result : e2; } _callCloudFunction({ action: e2, command: t2, multiCommand: n2, queryList: s2 }) { function r2(e3, t3) { if (n2 && s2) for (let n3 = 0; n3 < s2.length; n3++) { const r3 = s2[n3]; r3.udb && "function" == typeof r3.udb.setResult && (t3 ? r3.udb.setResult(t3) : r3.udb.setResult(e3.result.dataList[n3])); } } const i2 = this, o2 = this._isJQL ? "databaseForJQL" : "database"; function a2(e3) { return i2._callback("error", [e3]), M(q(o2, "fail"), e3).then(() => M(q(o2, "complete"), e3)).then(() => (r2(null, e3), Q(B, { type: z, content: e3 }), Promise.reject(e3))); } const c2 = M(q(o2, "invoke")), u2 = this._uniClient; return c2.then(() => u2.callFunction({ name: "DCloud-clientDB", type: l, data: { action: e2, command: t2, multiCommand: n2 } })).then((e3) => { const { code: t3, message: n3, token: s3, tokenExpired: c3, systemInfo: u3 = [] } = e3.result; if (u3) for (let e4 = 0; e4 < u3.length; e4++) { const { level: t4, message: n4, detail: s4 } = u3[e4], r3 = console["warn" === t4 ? "error" : t4] || console.log; let i3 = "[System Info]" + n4; s4 && (i3 = `${i3} 详细信息:${s4}`), r3(i3); } if (t3) { return a2(new ne({ code: t3, message: n3, requestId: e3.requestId })); } e3.result.errCode = e3.result.errCode || e3.result.code, e3.result.errMsg = e3.result.errMsg || e3.result.message, s3 && c3 && (oe({ token: s3, tokenExpired: c3 }), this._callbackAuth("refreshToken", [{ token: s3, tokenExpired: c3 }]), this._callback("refreshToken", [{ token: s3, tokenExpired: c3 }]), Q(W, { token: s3, tokenExpired: c3 })); const h2 = [{ prop: "affectedDocs", tips: "affectedDocs不再推荐使用,请使用inserted/deleted/updated/data.length替代" }, { prop: "code", tips: "code不再推荐使用,请使用errCode替代" }, { prop: "message", tips: "message不再推荐使用,请使用errMsg替代" }]; for (let t4 = 0; t4 < h2.length; t4++) { const { prop: n4, tips: s4 } = h2[t4]; if (n4 in e3.result) { const t5 = e3.result[n4]; Object.defineProperty(e3.result, n4, { get: () => (console.warn(s4), t5) }); } } return function(e4) { return M(q(o2, "success"), e4).then(() => M(q(o2, "complete"), e4)).then(() => { r2(e4, null); const t4 = i2._parseResult(e4); return Q(B, { type: z, content: t4 }), Promise.resolve(t4); }); }(e3); }, (e3) => { /fc_function_not_found|FUNCTION_NOT_FOUND/g.test(e3.message) && console.warn("clientDB未初始化,请在web控制台保存一次schema以开启clientDB"); return a2(new ne({ code: e3.code || "SYSTEM_ERROR", message: e3.message, requestId: e3.requestId })); }); } } const zn = "token无效,跳转登录页面", Jn = "token过期,跳转登录页面", Hn = { TOKEN_INVALID_TOKEN_EXPIRED: Jn, TOKEN_INVALID_INVALID_CLIENTID: zn, TOKEN_INVALID: zn, TOKEN_INVALID_WRONG_TOKEN: zn, TOKEN_INVALID_ANONYMOUS_USER: zn }, Gn = { "uni-id-token-expired": Jn, "uni-id-check-token-failed": zn, "uni-id-token-not-exist": zn, "uni-id-check-device-feature-failed": zn }; function Vn(e2, t2) { let n2 = ""; return n2 = e2 ? `${e2}/${t2}` : t2, n2.replace(/^\//, ""); } function Yn(e2 = [], t2 = "") { const n2 = [], s2 = []; return e2.forEach((e3) => { true === e3.needLogin ? n2.push(Vn(t2, e3.path)) : false === e3.needLogin && s2.push(Vn(t2, e3.path)); }), { needLoginPage: n2, notNeedLoginPage: s2 }; } function Qn(e2) { return e2.split("?")[0].replace(/^\//, ""); } function Xn() { return function(e2) { let t2 = e2 && e2.$page && e2.$page.fullPath || ""; return t2 ? ("/" !== t2.charAt(0) && (t2 = "/" + t2), t2) : t2; }(function() { const e2 = getCurrentPages(); return e2[e2.length - 1]; }()); } function Zn() { return Qn(Xn()); } function es(e2 = "", t2 = {}) { if (!e2) return false; if (!(t2 && t2.list && t2.list.length)) return false; const n2 = t2.list, s2 = Qn(e2); return n2.some((e3) => e3.pagePath === s2); } const ts = !!t$1.uniIdRouter; const { loginPage: ns, routerNeedLogin: ss, resToLogin: rs, needLoginPage: is, notNeedLoginPage: os, loginPageInTabBar: as } = function({ pages: e2 = [], subPackages: n2 = [], uniIdRouter: s2 = {}, tabBar: r2 = {} } = t$1) { const { loginPage: i2, needLogin: o2 = [], resToLogin: a2 = true } = s2, { needLoginPage: c2, notNeedLoginPage: u2 } = Yn(e2), { needLoginPage: h2, notNeedLoginPage: l2 } = function(e3 = []) { const t2 = [], n3 = []; return e3.forEach((e4) => { const { root: s3, pages: r3 = [] } = e4, { needLoginPage: i3, notNeedLoginPage: o3 } = Yn(r3, s3); t2.push(...i3), n3.push(...o3); }), { needLoginPage: t2, notNeedLoginPage: n3 }; }(n2); return { loginPage: i2, routerNeedLogin: o2, resToLogin: a2, needLoginPage: [...c2, ...h2], notNeedLoginPage: [...u2, ...l2], loginPageInTabBar: es(i2, r2) }; }(); if (is.indexOf(ns) > -1) throw new Error(`Login page [${ns}] should not be "needLogin", please check your pages.json`); function cs(e2) { const t2 = Zn(); if ("/" === e2.charAt(0)) return e2; const [n2, s2] = e2.split("?"), r2 = n2.replace(/^\//, "").split("/"), i2 = t2.split("/"); i2.pop(); for (let e3 = 0; e3 < r2.length; e3++) { const t3 = r2[e3]; ".." === t3 ? i2.pop() : "." !== t3 && i2.push(t3); } return "" === i2[0] && i2.shift(), "/" + i2.join("/") + (s2 ? "?" + s2 : ""); } function us(e2) { const t2 = Qn(cs(e2)); return !(os.indexOf(t2) > -1) && (is.indexOf(t2) > -1 || ss.some((t3) => function(e3, t4) { return new RegExp(t4).test(e3); }(e2, t3))); } function hs({ redirect: e2 }) { const t2 = Qn(e2), n2 = Qn(ns); return Zn() !== n2 && t2 !== n2; } function ls({ api: e2, redirect: t2 } = {}) { if (!t2 || !hs({ redirect: t2 })) return; const n2 = function(e3, t3) { return "/" !== e3.charAt(0) && (e3 = "/" + e3), t3 ? e3.indexOf("?") > -1 ? e3 + `&uniIdRedirectUrl=${encodeURIComponent(t3)}` : e3 + `?uniIdRedirectUrl=${encodeURIComponent(t3)}` : e3; }(ns, t2); as ? "navigateTo" !== e2 && "redirectTo" !== e2 || (e2 = "switchTab") : "switchTab" === e2 && (e2 = "navigateTo"); const s2 = { navigateTo: uni.navigateTo, redirectTo: uni.redirectTo, switchTab: uni.switchTab, reLaunch: uni.reLaunch }; setTimeout(() => { s2[e2]({ url: n2 }); }); } function ds({ url: e2 } = {}) { const t2 = { abortLoginPageJump: false, autoToLoginPage: false }, n2 = function() { const { token: e3, tokenExpired: t3 } = ie(); let n3; if (e3) { if (t3 < Date.now()) { const e4 = "uni-id-token-expired"; n3 = { errCode: e4, errMsg: Gn[e4] }; } } else { const e4 = "uni-id-check-token-failed"; n3 = { errCode: e4, errMsg: Gn[e4] }; } return n3; }(); if (us(e2) && n2) { n2.uniIdRedirectUrl = e2; if (G($).length > 0) return setTimeout(() => { Q($, n2); }, 0), t2.abortLoginPageJump = true, t2; t2.autoToLoginPage = true; } return t2; } function ps() { !function() { const e3 = Xn(), { abortLoginPageJump: t2, autoToLoginPage: n2 } = ds({ url: e3 }); t2 || n2 && ls({ api: "redirectTo", redirect: e3 }); }(); const e2 = ["navigateTo", "redirectTo", "reLaunch", "switchTab"]; for (let t2 = 0; t2 < e2.length; t2++) { const n2 = e2[t2]; uni.addInterceptor(n2, { invoke(e3) { const { abortLoginPageJump: t3, autoToLoginPage: s2 } = ds({ url: e3.url }); return t3 ? e3 : s2 ? (ls({ api: n2, redirect: cs(e3.url) }), false) : e3; } }); } } function fs() { this.onResponse((e2) => { const { type: t2, content: n2 } = e2; let s2 = false; switch (t2) { case "cloudobject": s2 = function(e3) { if ("object" != typeof e3) return false; const { errCode: t3 } = e3 || {}; return t3 in Gn; }(n2); break; case "clientdb": s2 = function(e3) { if ("object" != typeof e3) return false; const { errCode: t3 } = e3 || {}; return t3 in Hn; }(n2); } s2 && function(e3 = {}) { const t3 = G($); ee().then(() => { const n3 = Xn(); if (n3 && hs({ redirect: n3 })) return t3.length > 0 ? Q($, Object.assign({ uniIdRedirectUrl: n3 }, e3)) : void (ns && ls({ api: "navigateTo", redirect: n3 })); }); }(n2); }); } function gs(e2) { !function(e3) { e3.onResponse = function(e4) { V(B, e4); }, e3.offResponse = function(e4) { Y(B, e4); }; }(e2), function(e3) { e3.onNeedLogin = function(e4) { V($, e4); }, e3.offNeedLogin = function(e4) { Y($, e4); }, ts && (U("_globalUniCloudStatus").needLoginInit || (U("_globalUniCloudStatus").needLoginInit = true, ee().then(() => { ps.call(e3); }), rs && fs.call(e3))); }(e2), function(e3) { e3.onRefreshToken = function(e4) { V(W, e4); }, e3.offRefreshToken = function(e4) { Y(W, e4); }; }(e2); } let ms; const ys = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", _s = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/; function ws() { const e2 = ie().token || "", t2 = e2.split("."); if (!e2 || 3 !== t2.length) return { uid: null, role: [], permission: [], tokenExpired: 0 }; let n2; try { n2 = JSON.parse((s2 = t2[1], decodeURIComponent(ms(s2).split("").map(function(e3) { return "%" + ("00" + e3.charCodeAt(0).toString(16)).slice(-2); }).join("")))); } catch (e3) { throw new Error("获取当前用户信息出错,详细错误信息为:" + e3.message); } var s2; return n2.tokenExpired = 1e3 * n2.exp, delete n2.exp, delete n2.iat, n2; } ms = "function" != typeof atob ? function(e2) { if (e2 = String(e2).replace(/[\t\n\f\r ]+/g, ""), !_s.test(e2)) throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded."); var t2; e2 += "==".slice(2 - (3 & e2.length)); for (var n2, s2, r2 = "", i2 = 0; i2 < e2.length; ) t2 = ys.indexOf(e2.charAt(i2++)) << 18 | ys.indexOf(e2.charAt(i2++)) << 12 | (n2 = ys.indexOf(e2.charAt(i2++))) << 6 | (s2 = ys.indexOf(e2.charAt(i2++))), r2 += 64 === n2 ? String.fromCharCode(t2 >> 16 & 255) : 64 === s2 ? String.fromCharCode(t2 >> 16 & 255, t2 >> 8 & 255) : String.fromCharCode(t2 >> 16 & 255, t2 >> 8 & 255, 255 & t2); return r2; } : atob; var vs = s(function(e2, t2) { Object.defineProperty(t2, "__esModule", { value: true }); const n2 = "chooseAndUploadFile:ok", s2 = "chooseAndUploadFile:fail"; function r2(e3, t3) { return e3.tempFiles.forEach((e4, n3) => { e4.name || (e4.name = e4.path.substring(e4.path.lastIndexOf("/") + 1)), t3 && (e4.fileType = t3), e4.cloudPath = Date.now() + "_" + n3 + e4.name.substring(e4.name.lastIndexOf(".")); }), e3.tempFilePaths || (e3.tempFilePaths = e3.tempFiles.map((e4) => e4.path)), e3; } function i2(e3, t3, { onChooseFile: s3, onUploadProgress: r3 }) { return t3.then((e4) => { if (s3) { const t4 = s3(e4); if (void 0 !== t4) return Promise.resolve(t4).then((t5) => void 0 === t5 ? e4 : t5); } return e4; }).then((t4) => false === t4 ? { errMsg: n2, tempFilePaths: [], tempFiles: [] } : function(e4, t5, s4 = 5, r4) { (t5 = Object.assign({}, t5)).errMsg = n2; const i3 = t5.tempFiles, o2 = i3.length; let a2 = 0; return new Promise((n3) => { for (; a2 < s4; ) c2(); function c2() { const s5 = a2++; if (s5 >= o2) return void (!i3.find((e5) => !e5.url && !e5.errMsg) && n3(t5)); const u2 = i3[s5]; e4.uploadFile({ filePath: u2.path, cloudPath: u2.cloudPath, fileType: u2.fileType, onUploadProgress(e5) { e5.index = s5, e5.tempFile = u2, e5.tempFilePath = u2.path, r4 && r4(e5); } }).then((e5) => { u2.url = e5.fileID, s5 < o2 && c2(); }).catch((e5) => { u2.errMsg = e5.errMsg || e5.message, s5 < o2 && c2(); }); } }); }(e3, t4, 5, r3)); } t2.initChooseAndUploadFile = function(e3) { return function(t3 = { type: "all" }) { return "image" === t3.type ? i2(e3, function(e4) { const { count: t4, sizeType: n3, sourceType: i3 = ["album", "camera"], extension: o2 } = e4; return new Promise((e5, a2) => { uni.chooseImage({ count: t4, sizeType: n3, sourceType: i3, extension: o2, success(t5) { e5(r2(t5, "image")); }, fail(e6) { a2({ errMsg: e6.errMsg.replace("chooseImage:fail", s2) }); } }); }); }(t3), t3) : "video" === t3.type ? i2(e3, function(e4) { const { camera: t4, compressed: n3, maxDuration: i3, sourceType: o2 = ["album", "camera"], extension: a2 } = e4; return new Promise((e5, c2) => { uni.chooseVideo({ camera: t4, compressed: n3, maxDuration: i3, sourceType: o2, extension: a2, success(t5) { const { tempFilePath: n4, duration: s3, size: i4, height: o3, width: a3 } = t5; e5(r2({ errMsg: "chooseVideo:ok", tempFilePaths: [n4], tempFiles: [{ name: t5.tempFile && t5.tempFile.name || "", path: n4, size: i4, type: t5.tempFile && t5.tempFile.type || "", width: a3, height: o3, duration: s3, fileType: "video", cloudPath: "" }] }, "video")); }, fail(e6) { c2({ errMsg: e6.errMsg.replace("chooseVideo:fail", s2) }); } }); }); }(t3), t3) : i2(e3, function(e4) { const { count: t4, extension: n3 } = e4; return new Promise((e5, i3) => { let o2 = uni.chooseFile; if ("undefined" != typeof wx && "function" == typeof wx.chooseMessageFile && (o2 = wx.chooseMessageFile), "function" != typeof o2) return i3({ errMsg: s2 + " 请指定 type 类型,该平台仅支持选择 image 或 video。" }); o2({ type: "all", count: t4, extension: n3, success(t5) { e5(r2(t5)); }, fail(e6) { i3({ errMsg: e6.errMsg.replace("chooseFile:fail", s2) }); } }); }); }(t3), t3); }; }; }), Is = n(vs); const Ss = "manual"; function bs(e2) { return { props: { localdata: { type: Array, default: () => [] }, options: { type: [Object, Array], default: () => ({}) }, spaceInfo: { type: Object, default: () => ({}) }, collection: { type: [String, Array], default: "" }, action: { type: String, default: "" }, field: { type: String, default: "" }, orderby: { type: String, default: "" }, where: { type: [String, Object], default: "" }, pageData: { type: String, default: "add" }, pageCurrent: { type: Number, default: 1 }, pageSize: { type: Number, default: 20 }, getcount: { type: [Boolean, String], default: false }, gettree: { type: [Boolean, String], default: false }, gettreepath: { type: [Boolean, String], default: false }, startwith: { type: String, default: "" }, limitlevel: { type: Number, default: 10 }, groupby: { type: String, default: "" }, groupField: { type: String, default: "" }, distinct: { type: [Boolean, String], default: false }, foreignKey: { type: String, default: "" }, loadtime: { type: String, default: "auto" }, manual: { type: Boolean, default: false } }, data: () => ({ mixinDatacomLoading: false, mixinDatacomHasMore: false, mixinDatacomResData: [], mixinDatacomErrorMessage: "", mixinDatacomPage: {} }), created() { this.mixinDatacomPage = { current: this.pageCurrent, size: this.pageSize, count: 0 }, this.$watch(() => { var e3 = []; return ["pageCurrent", "pageSize", "localdata", "collection", "action", "field", "orderby", "where", "getont", "getcount", "gettree", "groupby", "groupField", "distinct"].forEach((t2) => { e3.push(this[t2]); }), e3; }, (e3, t2) => { if (this.loadtime === Ss) return; let n2 = false; const s2 = []; for (let r2 = 2; r2 < e3.length; r2++) e3[r2] !== t2[r2] && (s2.push(e3[r2]), n2 = true); e3[0] !== t2[0] && (this.mixinDatacomPage.current = this.pageCurrent), this.mixinDatacomPage.size = this.pageSize, this.onMixinDatacomPropsChange(n2, s2); }); }, methods: { onMixinDatacomPropsChange(e3, t2) { }, mixinDatacomEasyGet({ getone: e3 = false, success: t2, fail: n2 } = {}) { this.mixinDatacomLoading || (this.mixinDatacomLoading = true, this.mixinDatacomErrorMessage = "", this.mixinDatacomGet().then((n3) => { this.mixinDatacomLoading = false; const { data: s2, count: r2 } = n3.result; this.getcount && (this.mixinDatacomPage.count = r2), this.mixinDatacomHasMore = s2.length < this.pageSize; const i2 = e3 ? s2.length ? s2[0] : void 0 : s2; this.mixinDatacomResData = i2, t2 && t2(i2); }).catch((e4) => { this.mixinDatacomLoading = false, this.mixinDatacomErrorMessage = e4, n2 && n2(e4); })); }, mixinDatacomGet(t2 = {}) { let n2 = e2.database(this.spaceInfo); const s2 = t2.action || this.action; s2 && (n2 = n2.action(s2)); const r2 = t2.collection || this.collection; n2 = Array.isArray(r2) ? n2.collection(...r2) : n2.collection(r2); const i2 = t2.where || this.where; i2 && Object.keys(i2).length && (n2 = n2.where(i2)); const o2 = t2.field || this.field; o2 && (n2 = n2.field(o2)); const a2 = t2.foreignKey || this.foreignKey; a2 && (n2 = n2.foreignKey(a2)); const c2 = t2.groupby || this.groupby; c2 && (n2 = n2.groupBy(c2)); const u2 = t2.groupField || this.groupField; u2 && (n2 = n2.groupField(u2)); true === (void 0 !== t2.distinct ? t2.distinct : this.distinct) && (n2 = n2.distinct()); const h2 = t2.orderby || this.orderby; h2 && (n2 = n2.orderBy(h2)); const l2 = void 0 !== t2.pageCurrent ? t2.pageCurrent : this.mixinDatacomPage.current, d2 = void 0 !== t2.pageSize ? t2.pageSize : this.mixinDatacomPage.size, p2 = void 0 !== t2.getcount ? t2.getcount : this.getcount, f2 = void 0 !== t2.gettree ? t2.gettree : this.gettree, g2 = void 0 !== t2.gettreepath ? t2.gettreepath : this.gettreepath, m2 = { getCount: p2 }, y2 = { limitLevel: void 0 !== t2.limitlevel ? t2.limitlevel : this.limitlevel, startWith: void 0 !== t2.startwith ? t2.startwith : this.startwith }; return f2 && (m2.getTree = y2), g2 && (m2.getTreePath = y2), n2 = n2.skip(d2 * (l2 - 1)).limit(d2).get(m2), n2; } } }; } function ks(e2) { return function(t2, n2 = {}) { n2 = function(e3, t3 = {}) { return e3.customUI = t3.customUI || e3.customUI, e3.parseSystemError = t3.parseSystemError || e3.parseSystemError, Object.assign(e3.loadingOptions, t3.loadingOptions), Object.assign(e3.errorOptions, t3.errorOptions), "object" == typeof t3.secretMethods && (e3.secretMethods = t3.secretMethods), e3; }({ customUI: false, loadingOptions: { title: "加载中...", mask: true }, errorOptions: { type: "modal", retry: false } }, n2); const { customUI: s2, loadingOptions: r2, errorOptions: i2, parseSystemError: o2 } = n2, a2 = !s2; return new Proxy({}, { get: (s3, c2) => function({ fn: e3, interceptorName: t3, getCallbackArgs: n3 } = {}) { return async function(...s4) { const r3 = n3 ? n3({ params: s4 }) : {}; let i3, o3; try { return await M(q(t3, "invoke"), { ...r3 }), i3 = await e3(...s4), await M(q(t3, "success"), { ...r3, result: i3 }), i3; } catch (e4) { throw o3 = e4, await M(q(t3, "fail"), { ...r3, error: o3 }), o3; } finally { await M(q(t3, "complete"), o3 ? { ...r3, error: o3 } : { ...r3, result: i3 }); } }; }({ fn: async function s4(...u2) { let l2; a2 && uni.showLoading({ title: r2.title, mask: r2.mask }); const d2 = { name: t2, type: h, data: { method: c2, params: u2 } }; "object" == typeof n2.secretMethods && function(e3, t3) { const n3 = t3.data.method, s5 = e3.secretMethods || {}, r3 = s5[n3] || s5["*"]; r3 && (t3.secretType = r3); }(n2, d2); let p2 = false; try { l2 = await e2.callFunction(d2); } catch (e3) { p2 = true, l2 = { result: new ne(e3) }; } const { errSubject: f2, errCode: g2, errMsg: m2, newToken: y2 } = l2.result || {}; if (a2 && uni.hideLoading(), y2 && y2.token && y2.tokenExpired && (oe(y2), Q(W, { ...y2 })), g2) { let e3 = m2; if (p2 && o2) { e3 = (await o2({ objectName: t2, methodName: c2, params: u2, errSubject: f2, errCode: g2, errMsg: m2 })).errMsg || m2; } if (a2) if ("toast" === i2.type) uni.showToast({ title: e3, icon: "none" }); else { if ("modal" !== i2.type) throw new Error(`Invalid errorOptions.type: ${i2.type}`); { const { confirm: t3 } = await async function({ title: e4, content: t4, showCancel: n4, cancelText: s5, confirmText: r3 } = {}) { return new Promise((i3, o3) => { uni.showModal({ title: e4, content: t4, showCancel: n4, cancelText: s5, confirmText: r3, success(e5) { i3(e5); }, fail() { i3({ confirm: false, cancel: true }); } }); }); }({ title: "提示", content: e3, showCancel: i2.retry, cancelText: "取消", confirmText: i2.retry ? "重试" : "确定" }); if (i2.retry && t3) return s4(...u2); } } const n3 = new ne({ subject: f2, code: g2, message: m2, requestId: l2.requestId }); throw n3.detail = l2.result, Q(B, { type: H, content: n3 }), n3; } return Q(B, { type: H, content: l2.result }), l2.result; }, interceptorName: "callObject", getCallbackArgs: function({ params: e3 } = {}) { return { objectName: t2, methodName: c2, params: e3 }; } }) }); }; } function Cs(e2) { return U("_globalUniCloudSecureNetworkCache__{spaceId}".replace("{spaceId}", e2.config.spaceId)); } async function Ts({ openid: e2, callLoginByWeixin: t2 = false } = {}) { Cs(this); throw new Error(`[SecureNetwork] API \`initSecureNetworkByWeixin\` is not supported on platform \`${P}\``); } async function Ps(e2) { const t2 = Cs(this); return t2.initPromise || (t2.initPromise = Ts.call(this, e2)), t2.initPromise; } function As(e2) { return function({ openid: t2, callLoginByWeixin: n2 = false } = {}) { return Ps.call(e2, { openid: t2, callLoginByWeixin: n2 }); }; } function Es(e2) { const t2 = { getSystemInfo: uni.getSystemInfo, getPushClientId: uni.getPushClientId }; return function(n2) { return new Promise((s2, r2) => { t2[e2]({ ...n2, success(e3) { s2(e3); }, fail(e3) { r2(e3); } }); }); }; } class Os extends class { constructor() { this._callback = {}; } addListener(e2, t2) { this._callback[e2] || (this._callback[e2] = []), this._callback[e2].push(t2); } on(e2, t2) { return this.addListener(e2, t2); } removeListener(e2, t2) { if (!t2) throw new Error('The "listener" argument must be of type function. Received undefined'); const n2 = this._callback[e2]; if (!n2) return; const s2 = function(e3, t3) { for (let n3 = e3.length - 1; n3 >= 0; n3--) if (e3[n3] === t3) return n3; return -1; }(n2, t2); n2.splice(s2, 1); } off(e2, t2) { return this.removeListener(e2, t2); } removeAllListener(e2) { delete this._callback[e2]; } emit(e2, ...t2) { const n2 = this._callback[e2]; if (n2) for (let e3 = 0; e3 < n2.length; e3++) n2[e3](...t2); } } { constructor() { super(), this._uniPushMessageCallback = this._receivePushMessage.bind(this), this._currentMessageId = -1, this._payloadQueue = []; } init() { return Promise.all([Es("getSystemInfo")(), Es("getPushClientId")()]).then(([{ appId: e2 } = {}, { cid: t2 } = {}] = []) => { if (!e2) throw new Error("Invalid appId, please check the manifest.json file"); if (!t2) throw new Error("Invalid push client id"); this._appId = e2, this._pushClientId = t2, this._seqId = Date.now() + "-" + Math.floor(9e5 * Math.random() + 1e5), this.emit("open"), this._initMessageListener(); }, (e2) => { throw this.emit("error", e2), this.close(), e2; }); } async open() { return this.init(); } _isUniCloudSSE(e2) { if ("receive" !== e2.type) return false; const t2 = e2 && e2.data && e2.data.payload; return !(!t2 || "UNI_CLOUD_SSE" !== t2.channel || t2.seqId !== this._seqId); } _receivePushMessage(e2) { if (!this._isUniCloudSSE(e2)) return; const t2 = e2 && e2.data && e2.data.payload, { action: n2, messageId: s2, message: r2 } = t2; this._payloadQueue.push({ action: n2, messageId: s2, message: r2 }), this._consumMessage(); } _consumMessage() { for (; ; ) { const e2 = this._payloadQueue.find((e3) => e3.messageId === this._currentMessageId + 1); if (!e2) break; this._currentMessageId++, this._parseMessagePayload(e2); } } _parseMessagePayload(e2) { const { action: t2, messageId: n2, message: s2 } = e2; "end" === t2 ? this._end({ messageId: n2, message: s2 }) : "message" === t2 && this._appendMessage({ messageId: n2, message: s2 }); } _appendMessage({ messageId: e2, message: t2 } = {}) { this.emit("message", t2); } _end({ messageId: e2, message: t2 } = {}) { this.emit("end", t2), this.close(); } _initMessageListener() { uni.onPushMessage(this._uniPushMessageCallback); } _destroy() { uni.offPushMessage(this._uniPushMessageCallback); } toJSON() { return { appId: this._appId, pushClientId: this._pushClientId, seqId: this._seqId }; } close() { this._destroy(), this.emit("close"); } } async function xs(e2, t2) { const n2 = `http://${e2}:${t2}/system/ping`; try { const e3 = await (s2 = { url: n2, timeout: 500 }, new Promise((e4, t3) => { se.request({ ...s2, success(t4) { e4(t4); }, fail(e5) { t3(e5); } }); })); return !(!e3.data || 0 !== e3.data.code); } catch (e3) { return false; } var s2; } async function Rs(e2) { { const { osName: e3, osVersion: t3 } = ue(); "ios" === e3 && function(e4) { if (!e4 || "string" != typeof e4) return 0; const t4 = e4.match(/^(\d+)./); return t4 && t4[1] ? parseInt(t4[1]) : 0; }(t3) >= 14 && console.warn("iOS 14及以上版本连接uniCloud本地调试服务需要允许客户端查找并连接到本地网络上的设备(仅开发模式生效,发行模式会连接uniCloud云端服务)"); } const t2 = e2.__dev__; if (!t2.debugInfo) return; const { address: n2, servePort: s2 } = t2.debugInfo, { address: r2 } = await async function(e3, t3) { let n3; for (let s3 = 0; s3 < e3.length; s3++) { const r3 = e3[s3]; if (await xs(r3, t3)) { n3 = r3; break; } } return { address: n3, port: t3 }; }(n2, s2); if (r2) return t2.localAddress = r2, void (t2.localPort = s2); const i2 = console["error"]; let o2 = ""; if ("remote" === t2.debugInfo.initialLaunchType ? (t2.debugInfo.forceRemote = true, o2 = "当前客户端和HBuilderX不在同一局域网下(或其他网络原因无法连接HBuilderX),uniCloud本地调试服务不对当前客户端生效。\n- 如果不使用uniCloud本地调试服务,请直接忽略此信息。\n- 如需使用uniCloud本地调试服务,请将客户端与主机连接到同一局域网下并重新运行到客户端。") : o2 = "无法连接uniCloud本地调试服务,请检查当前客户端是否与主机在同一局域网下。\n- 如需使用uniCloud本地调试服务,请将客户端与主机连接到同一局域网下并重新运行到客户端。", o2 += "\n- 如果在HBuilderX开启的状态下切换过网络环境,请重启HBuilderX后再试\n- 检查系统防火墙是否拦截了HBuilderX自带的nodejs\n- 检查是否错误的使用拦截器修改uni.request方法的参数", 0 === P.indexOf("mp-") && (o2 += "\n- 小程序中如何使用uniCloud,请参考:https://uniapp.dcloud.net.cn/uniCloud/publish.html#useinmp"), !t2.debugInfo.forceRemote) throw new Error(o2); i2(o2); } function Us(e2) { e2._initPromiseHub || (e2._initPromiseHub = new I({ createPromise: function() { let t2 = Promise.resolve(); var n2; n2 = 1, t2 = new Promise((e3) => { setTimeout(() => { e3(); }, n2); }); const s2 = e2.auth(); return t2.then(() => s2.getLoginState()).then((e3) => e3 ? Promise.resolve() : s2.signInAnonymously()); } })); } const Ls = { tcb: St, tencent: St, aliyun: me, private: kt }; let Ns = new class { init(e2) { let t2 = {}; const n2 = Ls[e2.provider]; if (!n2) throw new Error("未提供正确的provider参数"); t2 = n2.init(e2), function(e3) { const t3 = {}; e3.__dev__ = t3, t3.debugLog = "app" === P; const n3 = A; n3 && !n3.code && (t3.debugInfo = n3); const s2 = new I({ createPromise: function() { return Rs(e3); } }); t3.initLocalNetwork = function() { return s2.exec(); }; }(t2), Us(t2), Rn(t2), function(e3) { const t3 = e3.uploadFile; e3.uploadFile = function(e4) { return t3.call(this, e4); }; }(t2), function(e3) { e3.database = function(t3) { if (t3 && Object.keys(t3).length > 0) return e3.init(t3).database(); if (this._database) return this._database; const n3 = $n(Wn, { uniClient: e3 }); return this._database = n3, n3; }, e3.databaseForJQL = function(t3) { if (t3 && Object.keys(t3).length > 0) return e3.init(t3).databaseForJQL(); if (this._databaseForJQL) return this._databaseForJQL; const n3 = $n(Wn, { uniClient: e3, isJQL: true }); return this._databaseForJQL = n3, n3; }; }(t2), function(e3) { e3.getCurrentUserInfo = ws, e3.chooseAndUploadFile = Is.initChooseAndUploadFile(e3), Object.assign(e3, { get mixinDatacom() { return bs(e3); } }), e3.SSEChannel = Os, e3.initSecureNetworkByWeixin = As(e3), e3.importObject = ks(e3); }(t2); return ["callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile", "chooseAndUploadFile"].forEach((e3) => { if (!t2[e3]) return; const n3 = t2[e3]; t2[e3] = function() { return n3.apply(t2, Array.from(arguments)); }, t2[e3] = function(e4, t3) { return function(n4) { let s2 = false; if ("callFunction" === t3) { const e5 = n4 && n4.type || u; s2 = e5 !== u; } const r2 = "callFunction" === t3 && !s2, i2 = this._initPromiseHub.exec(); n4 = n4 || {}; const { success: o2, fail: a2, complete: c2 } = te(n4), h2 = i2.then(() => s2 ? Promise.resolve() : M(q(t3, "invoke"), n4)).then(() => e4.call(this, n4)).then((e5) => s2 ? Promise.resolve(e5) : M(q(t3, "success"), e5).then(() => M(q(t3, "complete"), e5)).then(() => (r2 && Q(B, { type: J, content: e5 }), Promise.resolve(e5))), (e5) => s2 ? Promise.reject(e5) : M(q(t3, "fail"), e5).then(() => M(q(t3, "complete"), e5)).then(() => (Q(B, { type: J, content: e5 }), Promise.reject(e5)))); if (!(o2 || a2 || c2)) return h2; h2.then((e5) => { o2 && o2(e5), c2 && c2(e5), r2 && Q(B, { type: J, content: e5 }); }, (e5) => { a2 && a2(e5), c2 && c2(e5), r2 && Q(B, { type: J, content: e5 }); }); }; }(t2[e3], e3).bind(t2); }), t2.init = this.init, t2; } }(); (() => { const e2 = E; let t2 = {}; if (e2 && 1 === e2.length) t2 = e2[0], Ns = Ns.init(t2), Ns._isDefault = true; else { const t3 = ["auth", "callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile", "database", "getCurrentUSerInfo", "importObject"]; let n2; n2 = e2 && e2.length > 0 ? "应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间" : "应用未关联服务空间,请在uniCloud目录右键关联服务空间", t3.forEach((e3) => { Ns[e3] = function() { return console.error(n2), Promise.reject(new ne({ code: "SYS_ERR", message: n2 })); }; }); } Object.assign(Ns, { get mixinDatacom() { return bs(Ns); } }), gs(Ns), Ns.addInterceptor = D, Ns.removeInterceptor = F, Ns.interceptObject = K; })(); var Ds = Ns; const ERR_MSG_OK = "chooseAndUploadFile:ok"; const ERR_MSG_FAIL = "chooseAndUploadFile:fail"; function chooseImage(opts) { const { count, sizeType = ["original", "compressed"], sourceType, extension } = opts; return new Promise((resolve, reject) => { uni.chooseImage({ count, sizeType, sourceType, extension, success(res) { resolve(normalizeChooseAndUploadFileRes(res, "image")); }, fail(res) { reject({ errMsg: res.errMsg.replace("chooseImage:fail", ERR_MSG_FAIL) }); } }); }); } function chooseVideo(opts) { const { camera, compressed, maxDuration, sourceType, extension } = opts; return new Promise((resolve, reject) => { uni.chooseVideo({ camera, compressed, maxDuration, sourceType, extension, success(res) { const { tempFilePath, duration, size, height, width } = res; resolve(normalizeChooseAndUploadFileRes({ errMsg: "chooseVideo:ok", tempFilePaths: [tempFilePath], tempFiles: [ { name: res.tempFile && res.tempFile.name || "", path: tempFilePath, size, type: res.tempFile && res.tempFile.type || "", width, height, duration, fileType: "video", cloudPath: "" } ] }, "video")); }, fail(res) { reject({ errMsg: res.errMsg.replace("chooseVideo:fail", ERR_MSG_FAIL) }); } }); }); } function chooseAll(opts) { const { count, extension } = opts; return new Promise((resolve, reject) => { let chooseFile = uni.chooseFile; if (typeof wx !== "undefined" && typeof wx.chooseMessageFile === "function") { chooseFile = wx.chooseMessageFile; } if (typeof chooseFile !== "function") { return reject({ errMsg: ERR_MSG_FAIL + " 请指定 type 类型,该平台仅支持选择 image 或 video。" }); } chooseFile({ type: "all", count, extension, success(res) { resolve(normalizeChooseAndUploadFileRes(res)); }, fail(res) { reject({ errMsg: res.errMsg.replace("chooseFile:fail", ERR_MSG_FAIL) }); } }); }); } function normalizeChooseAndUploadFileRes(res, fileType) { res.tempFiles.forEach((item, index) => { if (!item.name) { item.name = item.path.substring(item.path.lastIndexOf("/") + 1); } if (fileType) { item.fileType = fileType; } item.cloudPath = Date.now() + "_" + index + item.name.substring(item.name.lastIndexOf(".")); }); if (!res.tempFilePaths) { res.tempFilePaths = res.tempFiles.map((file) => file.path); } return res; } function uploadCloudFiles(files, max = 5, onUploadProgress) { files = JSON.parse(JSON.stringify(files)); const len2 = files.length; let count = 0; let self = this; return new Promise((resolve) => { while (count < max) { next(); } function next() { let cur = count++; if (cur >= len2) { !files.find((item) => !item.url && !item.errMsg) && resolve(files); return; } const fileItem = files[cur]; const index = self.files.findIndex((v2) => v2.uuid === fileItem.uuid); fileItem.url = ""; delete fileItem.errMsg; Ds.uploadFile({ filePath: fileItem.path, cloudPath: fileItem.cloudPath, fileType: fileItem.fileType, onUploadProgress: (res) => { res.index = index; onUploadProgress && onUploadProgress(res); } }).then((res) => { fileItem.url = res.fileID; fileItem.index = index; if (cur < len2) { next(); } }).catch((res) => { fileItem.errMsg = res.errMsg || res.message; fileItem.index = index; if (cur < len2) { next(); } }); } }); } function uploadFiles(choosePromise, { onChooseFile, onUploadProgress }) { return choosePromise.then((res) => { if (onChooseFile) { const customChooseRes = onChooseFile(res); if (typeof customChooseRes !== "undefined") { return Promise.resolve(customChooseRes).then((chooseRes) => typeof chooseRes === "undefined" ? res : chooseRes); } } return res; }).then((res) => { if (res === false) { return { errMsg: ERR_MSG_OK, tempFilePaths: [], tempFiles: [] }; } return res; }); } function chooseAndUploadFile(opts = { type: "all" }) { if (opts.type === "image") { return uploadFiles(chooseImage(opts), opts); } else if (opts.type === "video") { return uploadFiles(chooseVideo(opts), opts); } return uploadFiles(chooseAll(opts), opts); } const get_file_ext = (name) => { const last_len = name.lastIndexOf("."); const len2 = name.length; return { name: name.substring(0, last_len), ext: name.substring(last_len + 1, len2) }; }; const get_extname = (fileExtname) => { if (!Array.isArray(fileExtname)) { let extname = fileExtname.replace(/(\[|\])/g, ""); return extname.split(","); } else { return fileExtname; } }; const get_files_and_is_max = (res, _extname) => { let filePaths = []; let files = []; if (!_extname || _extname.length === 0) { return { filePaths, files }; } res.tempFiles.forEach((v2) => { let fileFullName = get_file_ext(v2.name); const extname = fileFullName.ext.toLowerCase(); if (_extname.indexOf(extname) !== -1) { files.push(v2); filePaths.push(v2.path); } }); if (files.length !== res.tempFiles.length) { uni.showToast({ title: `当前选择了${res.tempFiles.length}个文件 ,${res.tempFiles.length - files.length} 个文件格式不正确`, icon: "none", duration: 5e3 }); } return { filePaths, files }; }; const get_file_info = (filepath) => { return new Promise((resolve, reject) => { uni.getImageInfo({ src: filepath, success(res) { resolve(res); }, fail(err) { reject(err); } }); }); }; const get_file_data = async (files, type = "image") => { let fileFullName = get_file_ext(files.name); const extname = fileFullName.ext.toLowerCase(); let filedata = { name: files.name, uuid: files.uuid, extname: extname || "", cloudPath: files.cloudPath, fileType: files.fileType, url: files.path || files.path, size: files.size, //单位是字节 image: {}, path: files.path, video: {} }; if (type === "image") { const imageinfo = await get_file_info(files.path); delete filedata.video; filedata.image.width = imageinfo.width; filedata.image.height = imageinfo.height; filedata.image.location = imageinfo.path; } else { delete filedata.image; } return filedata; }; const _sfc_main$5 = { name: "uploadImage", emits: ["uploadFiles", "choose", "delFile"], props: { filesList: { type: Array, default() { return []; } }, disabled: { type: Boolean, default: false }, disablePreview: { type: Boolean, default: false }, limit: { type: [Number, String], default: 9 }, imageStyles: { type: Object, default() { return { width: "auto", height: "auto", border: {} }; } }, delIcon: { type: Boolean, default: true }, readonly: { type: Boolean, default: false } }, computed: { styles() { let styles = { width: "auto", height: "auto", border: {} }; return Object.assign(styles, this.imageStyles); }, boxStyle() { const { width = "auto", height = "auto" } = this.styles; let obj = {}; if (height === "auto") { if (width !== "auto") { obj.height = this.value2px(width); obj["padding-top"] = 0; } else { obj.height = 0; } } else { obj.height = this.value2px(height); obj["padding-top"] = 0; } if (width === "auto") { if (height !== "auto") { obj.width = this.value2px(height); } else { obj.width = "33.3%"; } } else { obj.width = this.value2px(width); } let classles = ""; for (let i2 in obj) { classles += `${i2}:${obj[i2]};`; } return classles; }, borderStyle() { let { border } = this.styles; let obj = {}; const widthDefaultValue = 1; const radiusDefaultValue = 3; if (typeof border === "boolean") { obj.border = border ? "1px #eee solid" : "none"; } else { let width = border && border.width || widthDefaultValue; width = this.value2px(width); let radius = border && border.radius || radiusDefaultValue; radius = this.value2px(radius); obj = { "border-width": width, "border-style": border && border.style || "solid", "border-color": border && border.color || "#eee", "border-radius": radius }; } let classles = ""; for (let i2 in obj) { classles += `${i2}:${obj[i2]};`; } return classles; } }, methods: { uploadFiles(item, index) { this.$emit("uploadFiles", item); }, choose() { this.$emit("choose"); }, delFile(index) { this.$emit("delFile", index); }, prviewImage(img, index) { let urls = []; if (Number(this.limit) === 1 && this.disablePreview && !this.disabled) { this.$emit("choose"); } if (this.disablePreview) return; this.filesList.forEach((i2) => { urls.push(i2.url); }); uni.previewImage({ urls, current: index }); }, value2px(value) { if (typeof value === "number") { value += "px"; } else { if (value.indexOf("%") === -1) { value = value.indexOf("px") !== -1 ? value : value + "px"; } } return value; } } }; function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock("view", { class: "uni-file-picker__container" }, [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList($props.filesList, (item, index) => { return vue.openBlock(), vue.createElementBlock( "view", { class: "file-picker__box", key: index, style: vue.normalizeStyle($options.boxStyle) }, [ vue.createElementVNode( "view", { class: "file-picker__box-content", style: vue.normalizeStyle($options.borderStyle) }, [ vue.createElementVNode("image", { class: "file-image", src: item.url, mode: "aspectFill", onClick: vue.withModifiers(($event) => $options.prviewImage(item, index), ["stop"]) }, null, 8, ["src", "onClick"]), $props.delIcon && !$props.readonly ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "icon-del-box", onClick: vue.withModifiers(($event) => $options.delFile(index), ["stop"]) }, [ vue.createElementVNode("view", { class: "icon-del" }), vue.createElementVNode("view", { class: "icon-del rotate" }) ], 8, ["onClick"])) : vue.createCommentVNode("v-if", true), item.progress && item.progress !== 100 || item.progress === 0 ? (vue.openBlock(), vue.createElementBlock("view", { key: 1, class: "file-picker__progress" }, [ vue.createElementVNode("progress", { class: "file-picker__progress-item", percent: item.progress === -1 ? 0 : item.progress, "stroke-width": "4", backgroundColor: item.errMsg ? "#ff5a5f" : "#EBEBEB" }, null, 8, ["percent", "backgroundColor"]) ])) : vue.createCommentVNode("v-if", true), item.errMsg ? (vue.openBlock(), vue.createElementBlock("view", { key: 2, class: "file-picker__mask", onClick: vue.withModifiers(($event) => $options.uploadFiles(item, index), ["stop"]) }, " 点击重试 ", 8, ["onClick"])) : vue.createCommentVNode("v-if", true) ], 4 /* STYLE */ ) ], 4 /* STYLE */ ); }), 128 /* KEYED_FRAGMENT */ )), $props.filesList.length < $props.limit && !$props.readonly ? (vue.openBlock(), vue.createElementBlock( "view", { key: 0, class: "file-picker__box", style: vue.normalizeStyle($options.boxStyle) }, [ vue.createElementVNode( "view", { class: "file-picker__box-content is-add", style: vue.normalizeStyle($options.borderStyle), onClick: _cache[0] || (_cache[0] = (...args) => $options.choose && $options.choose(...args)) }, [ vue.renderSlot(_ctx.$slots, "default", {}, () => [ vue.createElementVNode("view", { class: "icon-add" }), vue.createElementVNode("view", { class: "icon-add rotate" }) ], true) ], 4 /* STYLE */ ) ], 4 /* STYLE */ )) : vue.createCommentVNode("v-if", true) ]); } const uploadImage = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$2], ["__scopeId", "data-v-bdfc07e0"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue"]]); const _sfc_main$4 = { name: "uploadFile", emits: ["uploadFiles", "choose", "delFile"], props: { filesList: { type: Array, default() { return []; } }, delIcon: { type: Boolean, default: true }, limit: { type: [Number, String], default: 9 }, showType: { type: String, default: "" }, listStyles: { type: Object, default() { return { // 是否显示边框 border: true, // 是否显示分隔线 dividline: true, // 线条样式 borderStyle: {} }; } }, readonly: { type: Boolean, default: false } }, computed: { list() { let files = []; this.filesList.forEach((v2) => { files.push(v2); }); return files; }, styles() { let styles = { border: true, dividline: true, "border-style": {} }; return Object.assign(styles, this.listStyles); }, borderStyle() { let { borderStyle, border } = this.styles; let obj = {}; if (!border) { obj.border = "none"; } else { let width = borderStyle && borderStyle.width || 1; width = this.value2px(width); let radius = borderStyle && borderStyle.radius || 5; radius = this.value2px(radius); obj = { "border-width": width, "border-style": borderStyle && borderStyle.style || "solid", "border-color": borderStyle && borderStyle.color || "#eee", "border-radius": radius }; } let classles = ""; for (let i2 in obj) { classles += `${i2}:${obj[i2]};`; } return classles; }, borderLineStyle() { let obj = {}; let { borderStyle } = this.styles; if (borderStyle && borderStyle.color) { obj["border-color"] = borderStyle.color; } if (borderStyle && borderStyle.width) { let width = borderStyle && borderStyle.width || 1; let style = borderStyle && borderStyle.style || 0; if (typeof width === "number") { width += "px"; } else { width = width.indexOf("px") ? width : width + "px"; } obj["border-width"] = width; if (typeof style === "number") { style += "px"; } else { style = style.indexOf("px") ? style : style + "px"; } obj["border-top-style"] = style; } let classles = ""; for (let i2 in obj) { classles += `${i2}:${obj[i2]};`; } return classles; } }, methods: { uploadFiles(item, index) { this.$emit("uploadFiles", { item, index }); }, choose() { this.$emit("choose"); }, delFile(index) { this.$emit("delFile", index); }, value2px(value) { if (typeof value === "number") { value += "px"; } else { value = value.indexOf("px") !== -1 ? value : value + "px"; } return value; } } }; function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock("view", { class: "uni-file-picker__files" }, [ !$props.readonly ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "files-button", onClick: _cache[0] || (_cache[0] = (...args) => $options.choose && $options.choose(...args)) }, [ vue.renderSlot(_ctx.$slots, "default", {}, void 0, true) ])) : vue.createCommentVNode("v-if", true), vue.createCommentVNode(` :class="{'is-text-box':showType === 'list'}" `), $options.list.length > 0 ? (vue.openBlock(), vue.createElementBlock( "view", { key: 1, class: "uni-file-picker__lists is-text-box", style: vue.normalizeStyle($options.borderStyle) }, [ vue.createCommentVNode(" ,'is-list-card':showType === 'list-card' "), (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList($options.list, (item, index) => { return vue.openBlock(), vue.createElementBlock( "view", { class: vue.normalizeClass(["uni-file-picker__lists-box", { "files-border": index !== 0 && $options.styles.dividline }]), key: index, style: vue.normalizeStyle(index !== 0 && $options.styles.dividline && $options.borderLineStyle) }, [ vue.createElementVNode("view", { class: "uni-file-picker__item" }, [ vue.createCommentVNode(` :class="{'is-text-image':showType === 'list'}" `), vue.createCommentVNode(' \n \n '), vue.createElementVNode( "view", { class: "files__name" }, vue.toDisplayString(item.name), 1 /* TEXT */ ), $props.delIcon && !$props.readonly ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "icon-del-box icon-files", onClick: ($event) => $options.delFile(index) }, [ vue.createElementVNode("view", { class: "icon-del icon-files" }), vue.createElementVNode("view", { class: "icon-del rotate" }) ], 8, ["onClick"])) : vue.createCommentVNode("v-if", true) ]), item.progress && item.progress !== 100 || item.progress === 0 ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "file-picker__progress" }, [ vue.createElementVNode("progress", { class: "file-picker__progress-item", percent: item.progress === -1 ? 0 : item.progress, "stroke-width": "4", backgroundColor: item.errMsg ? "#ff5a5f" : "#EBEBEB" }, null, 8, ["percent", "backgroundColor"]) ])) : vue.createCommentVNode("v-if", true), item.status === "error" ? (vue.openBlock(), vue.createElementBlock("view", { key: 1, class: "file-picker__mask", onClick: vue.withModifiers(($event) => $options.uploadFiles(item, index), ["stop"]) }, " 点击重试 ", 8, ["onClick"])) : vue.createCommentVNode("v-if", true) ], 6 /* CLASS, STYLE */ ); }), 128 /* KEYED_FRAGMENT */ )) ], 4 /* STYLE */ )) : vue.createCommentVNode("v-if", true) ]); } const uploadFile = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$1], ["__scopeId", "data-v-a54939c6"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-file-picker/components/uni-file-picker/upload-file.vue"]]); const _sfc_main$3 = { name: "uniFilePicker", components: { uploadImage, uploadFile }, options: { virtualHost: true }, emits: ["select", "success", "fail", "progress", "delete", "update:modelValue", "input"], props: { modelValue: { type: [Array, Object], default() { return []; } }, disabled: { type: Boolean, default: false }, disablePreview: { type: Boolean, default: false }, delIcon: { type: Boolean, default: true }, // 自动上传 autoUpload: { type: Boolean, default: true }, // 最大选择个数 ,h5只能限制单选或是多选 limit: { type: [Number, String], default: 9 }, // 列表样式 grid | list | list-card mode: { type: String, default: "grid" }, // 选择文件类型 image/video/all fileMediatype: { type: String, default: "image" }, // 文件类型筛选 fileExtname: { type: [Array, String], default() { return []; } }, title: { type: String, default: "" }, listStyles: { type: Object, default() { return { // 是否显示边框 border: true, // 是否显示分隔线 dividline: true, // 线条样式 borderStyle: {} }; } }, imageStyles: { type: Object, default() { return { width: "auto", height: "auto" }; } }, readonly: { type: Boolean, default: false }, returnType: { type: String, default: "array" }, sizeType: { type: Array, default() { return ["original", "compressed"]; } }, sourceType: { type: Array, default() { return ["album", "camera"]; } } }, data() { return { files: [], localValue: [] }; }, watch: { modelValue: { handler(newVal, oldVal) { this.setValue(newVal, oldVal); }, immediate: true } }, computed: { filesList() { let files = []; this.files.forEach((v2) => { files.push(v2); }); return files; }, showType() { if (this.fileMediatype === "image") { return this.mode; } return "list"; }, limitLength() { if (this.returnType === "object") { return 1; } if (!this.limit) { return 1; } if (this.limit >= 9) { return 9; } return this.limit; } }, created() { if (!(Ds.config && Ds.config.provider)) { this.noSpace = true; Ds.chooseAndUploadFile = chooseAndUploadFile; } this.form = this.getForm("uniForms"); this.formItem = this.getForm("uniFormsItem"); if (this.form && this.formItem) { if (this.formItem.name) { this.rename = this.formItem.name; this.form.inputChildrens.push(this); } } }, methods: { /** * 公开用户使用,清空文件 * @param {Object} index */ clearFiles(index) { if (index !== 0 && !index) { this.files = []; this.$nextTick(() => { this.setEmit(); }); } else { this.files.splice(index, 1); } this.$nextTick(() => { this.setEmit(); }); }, /** * 公开用户使用,继续上传 */ upload() { let files = []; this.files.forEach((v2, index) => { if (v2.status === "ready" || v2.status === "error") { files.push(Object.assign({}, v2)); } }); return this.uploadFiles(files); }, async setValue(newVal, oldVal) { const newData = async (v2) => { const reg = /cloud:\/\/([\w.]+\/?)\S*/; let url = ""; if (v2.fileID) { url = v2.fileID; } else { url = v2.url; } if (reg.test(url)) { v2.fileID = url; v2.url = await this.getTempFileURL(url); } if (v2.url) v2.path = v2.url; return v2; }; if (this.returnType === "object") { if (newVal) { await newData(newVal); } else { newVal = {}; } } else { if (!newVal) newVal = []; for (let i2 = 0; i2 < newVal.length; i2++) { let v2 = newVal[i2]; await newData(v2); } } this.localValue = newVal; if (this.form && this.formItem && !this.is_reset) { this.is_reset = false; this.formItem.setValue(this.localValue); } let filesData = Object.keys(newVal).length > 0 ? newVal : []; this.files = [].concat(filesData); }, /** * 选择文件 */ choose() { if (this.disabled) return; if (this.files.length >= Number(this.limitLength) && this.showType !== "grid" && this.returnType === "array") { uni.showToast({ title: `您最多选择 ${this.limitLength} 个文件`, icon: "none" }); return; } this.chooseFiles(); }, /** * 选择文件并上传 */ chooseFiles() { const _extname = get_extname(this.fileExtname); Ds.chooseAndUploadFile({ type: this.fileMediatype, compressed: false, sizeType: this.sizeType, sourceType: this.sourceType, // TODO 如果为空,video 有问题 extension: _extname.length > 0 ? _extname : void 0, count: this.limitLength - this.files.length, //默认9 onChooseFile: this.chooseFileCallback, onUploadProgress: (progressEvent) => { this.setProgress(progressEvent, progressEvent.index); } }).then((result) => { this.setSuccessAndError(result.tempFiles); }).catch((err) => { formatAppLog("log", "at uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue:371", "选择失败", err); }); }, /** * 选择文件回调 * @param {Object} res */ async chooseFileCallback(res) { const _extname = get_extname(this.fileExtname); const is_one = Number(this.limitLength) === 1 && this.disablePreview && !this.disabled || this.returnType === "object"; if (is_one) { this.files = []; } let { filePaths, files } = get_files_and_is_max(res, _extname); if (!(_extname && _extname.length > 0)) { filePaths = res.tempFilePaths; files = res.tempFiles; } let currentData = []; for (let i2 = 0; i2 < files.length; i2++) { if (this.limitLength - this.files.length <= 0) break; files[i2].uuid = Date.now(); let filedata = await get_file_data(files[i2], this.fileMediatype); filedata.progress = 0; filedata.status = "ready"; this.files.push(filedata); currentData.push({ ...filedata, file: files[i2] }); } this.$emit("select", { tempFiles: currentData, tempFilePaths: filePaths }); res.tempFiles = files; if (!this.autoUpload || this.noSpace) { res.tempFiles = []; } }, /** * 批传 * @param {Object} e */ uploadFiles(files) { files = [].concat(files); return uploadCloudFiles.call(this, files, 5, (res) => { this.setProgress(res, res.index, true); }).then((result) => { this.setSuccessAndError(result); return result; }).catch((err) => { formatAppLog("log", "at uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue:437", err); }); }, /** * 成功或失败 */ async setSuccessAndError(res, fn) { let successData = []; let errorData = []; let tempFilePath = []; let errorTempFilePath = []; for (let i2 = 0; i2 < res.length; i2++) { const item = res[i2]; const index = item.uuid ? this.files.findIndex((p2) => p2.uuid === item.uuid) : item.index; if (index === -1 || !this.files) break; if (item.errMsg === "request:fail") { this.files[index].url = item.path; this.files[index].status = "error"; this.files[index].errMsg = item.errMsg; errorData.push(this.files[index]); errorTempFilePath.push(this.files[index].url); } else { this.files[index].errMsg = ""; this.files[index].fileID = item.url; const reg = /cloud:\/\/([\w.]+\/?)\S*/; if (reg.test(item.url)) { this.files[index].url = await this.getTempFileURL(item.url); } else { this.files[index].url = item.url; } this.files[index].status = "success"; this.files[index].progress += 1; successData.push(this.files[index]); tempFilePath.push(this.files[index].fileID); } } if (successData.length > 0) { this.setEmit(); this.$emit("success", { tempFiles: this.backObject(successData), tempFilePaths: tempFilePath }); } if (errorData.length > 0) { this.$emit("fail", { tempFiles: this.backObject(errorData), tempFilePaths: errorTempFilePath }); } }, /** * 获取进度 * @param {Object} progressEvent * @param {Object} index * @param {Object} type */ setProgress(progressEvent, index, type) { this.files.length; const percentCompleted = Math.round(progressEvent.loaded * 100 / progressEvent.total); let idx = index; if (!type) { idx = this.files.findIndex((p2) => p2.uuid === progressEvent.tempFile.uuid); } if (idx === -1 || !this.files[idx]) return; this.files[idx].progress = percentCompleted - 1; this.$emit("progress", { index: idx, progress: parseInt(percentCompleted), tempFile: this.files[idx] }); }, /** * 删除文件 * @param {Object} index */ delFile(index) { this.$emit("delete", { tempFile: this.files[index], tempFilePath: this.files[index].url }); this.files.splice(index, 1); this.$nextTick(() => { this.setEmit(); }); }, /** * 获取文件名和后缀 * @param {Object} name */ getFileExt(name) { const last_len = name.lastIndexOf("."); const len2 = name.length; return { name: name.substring(0, last_len), ext: name.substring(last_len + 1, len2) }; }, /** * 处理返回事件 */ setEmit() { let data = []; if (this.returnType === "object") { data = this.backObject(this.files)[0]; this.localValue = data ? data : null; } else { data = this.backObject(this.files); if (!this.localValue) { this.localValue = []; } this.localValue = [...data]; } this.$emit("update:modelValue", this.localValue); }, /** * 处理返回参数 * @param {Object} files */ backObject(files) { let newFilesData = []; files.forEach((v2) => { newFilesData.push({ extname: v2.extname, fileType: v2.fileType, image: v2.image, name: v2.name, path: v2.path, size: v2.size, fileID: v2.fileID, url: v2.url, // 修改删除一个文件后不能再上传的bug, #694 uuid: v2.uuid, status: v2.status, cloudPath: v2.cloudPath }); }); return newFilesData; }, async getTempFileURL(fileList) { fileList = { fileList: [].concat(fileList) }; const urls = await Ds.getTempFileURL(fileList); return urls.fileList[0].tempFileURL || ""; }, /** * 获取父元素实例 */ getForm(name = "uniForms") { let parent = this.$parent; let parentName = parent.$options.name; while (parentName !== name) { parent = parent.$parent; if (!parent) return false; parentName = parent.$options.name; } return parent; } } }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_upload_image = vue.resolveComponent("upload-image"); const _component_upload_file = vue.resolveComponent("upload-file"); return vue.openBlock(), vue.createElementBlock("view", { class: "uni-file-picker" }, [ $props.title ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "uni-file-picker__header" }, [ vue.createElementVNode( "text", { class: "file-title" }, vue.toDisplayString($props.title), 1 /* TEXT */ ), vue.createElementVNode( "text", { class: "file-count" }, vue.toDisplayString($options.filesList.length) + "/" + vue.toDisplayString($options.limitLength), 1 /* TEXT */ ) ])) : vue.createCommentVNode("v-if", true), $props.fileMediatype === "image" && $options.showType === "grid" ? (vue.openBlock(), vue.createBlock(_component_upload_image, { key: 1, readonly: $props.readonly, "image-styles": $props.imageStyles, "files-list": $options.filesList, limit: $options.limitLength, disablePreview: $props.disablePreview, delIcon: $props.delIcon, onUploadFiles: $options.uploadFiles, onChoose: $options.choose, onDelFile: $options.delFile }, { default: vue.withCtx(() => [ vue.renderSlot(_ctx.$slots, "default", {}, () => [ vue.createElementVNode("view", { class: "is-add" }, [ vue.createElementVNode("view", { class: "icon-add" }), vue.createElementVNode("view", { class: "icon-add rotate" }) ]) ], true) ]), _: 3 /* FORWARDED */ }, 8, ["readonly", "image-styles", "files-list", "limit", "disablePreview", "delIcon", "onUploadFiles", "onChoose", "onDelFile"])) : vue.createCommentVNode("v-if", true), $props.fileMediatype !== "image" || $options.showType !== "grid" ? (vue.openBlock(), vue.createBlock(_component_upload_file, { key: 2, readonly: $props.readonly, "list-styles": $props.listStyles, "files-list": $options.filesList, showType: $options.showType, delIcon: $props.delIcon, onUploadFiles: $options.uploadFiles, onChoose: $options.choose, onDelFile: $options.delFile }, { default: vue.withCtx(() => [ vue.renderSlot(_ctx.$slots, "default", {}, () => [ vue.createElementVNode("button", { type: "primary", size: "mini" }, "选择文件") ], true) ]), _: 3 /* FORWARDED */ }, 8, ["readonly", "list-styles", "files-list", "showType", "delIcon", "onUploadFiles", "onChoose", "onDelFile"])) : vue.createCommentVNode("v-if", true) ]); } const __easycom_3 = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render], ["__scopeId", "data-v-6223573f"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue"]]); const __default__$1 = { name: "" }; const _sfc_main$2 = /* @__PURE__ */ Object.assign(__default__$1, { setup(__props) { const urlConfig = vue.ref("http://zhongyao.fscuc.cn"); const preseObj = vue.ref({ code: "", color: ["#000"], // 条形码的颜色 bgColor: "#FFFFFF", // 背景色 width: 200, // 宽度 height: 50 // 高度 }); vue.ref([ { name: "配药", id: "1" }, { name: "煎药", id: "2" }, { name: "发药", id: "3" }, { name: "配送", id: "4" } ]); vue.ref([ { name: "中药处方", id: "1" }, { name: "中药制剂", id: "2" } ]); const { proxy } = vue.getCurrentInstance(); const imageStyles = vue.ref({ width: 112.5, height: 112.5, border: { color: "#DDDDDD", width: 1, style: "solid", radius: "4px" } }); vue.ref([]); vue.ref({ height: 80, displayValue: false }); const selectRps = vue.ref([]); const isPrint = vue.ref(true); vue.ref([]); const v2 = vue.ref({ preNo: "11220822134401", presType: "普通处方", name: "李某", sex: "男", age: 35, contactNumber: "13888888888", status: "发药", department: "中医内科", disName: "胃脘痛病", symName: "脾胃虚寒证", prescriptionTime: "2023-06-01 15:58", address: "浙江省某某事某某去某某事中医院门诊楼三楼302是", rp: [ { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "" } ], number: 3, pies_tips: "待见", dosageForm: "汤剂", prescriptionUsage: "煎服", concentration: "200ml", frequency: "一日三次", medicationTime: "饭后服", entrust: "注意多休息,饮食清单。", prescriptionSum: "187.00", daijianCost: "30.00", distributionCost: "10.00", prescriptionTotleSum: "227.00", yljgName: "杭州某某高级中医院", operateList: [ { py: "kf", title: "开方", operater: "" }, { py: "sh", title: "审核", operater: "" }, { py: "tp", title: "调配", operater: "" }, { py: "fh", title: "复核", operater: "" }, { py: "jp", title: "浸泡", operater: "" }, { py: "jz", title: "煎煮", operater: "" }, { py: "db", title: "打包", operater: "" }, { py: "fy", title: "发药", operater: "" } ], // extra_doc:'A医生', // check_doc:'B医生', // depoly:'调陪人', // review:'复核人', // steep:'浸泡', // cook:'煎煮人', // pack:'大宝人', // dispen:'发药人', // }, entrust1111: "1、本处方当日有效\n 2、取药时请您当面核对。。。。 \n 3、延长处方用量时间原油:慢性病 其他老年病 外地 其他" }); const editForm = vue.ref({ urls: [], userId: uni.getStorageSync("userId"), comments: "", weight: v2.value.weight, coreId: v2.value.preNo }); vue.onMounted(() => { }); const bindTextInput = (e2) => { formatAppLog("log", "at pages/edit/edit.vue:322", e2.detail.value); }; onLoad(async (options) => { formatAppLog("log", "at pages/edit/edit.vue:326", "options", options); uni.getStorageSync("userId"); const params2 = { token: uni.getStorageSync("token"), data: { id: options.id || "", preNo: options.preId || "", depolyStatus: options.depolyStatus || "" } }; formatAppLog("log", "at pages/edit/edit.vue:337", "params", params2); const { data: res } = await selectOrderDetail(params2); if (res.code === 200) { v2.prescriptionTime = res.data.prescriptionTime, v2.value.name = res.data.name, v2.value.sex = res.data.sex, v2.value.age = res.data.age, v2.value.contactNumber = res.data.contactNumber; v2.value.address = res.data.address; v2.value.concentration = res.data.concentration; v2.value.frequency = res.data.frequency; v2.value.medicationTime = res.data.medicationTime; v2.value.disName = res.data.disName, v2.value.symName = res.data.symName, v2.value.preNo = res.data.preNo, formatAppLog("log", "at pages/edit/edit.vue:354", "onLoad v.value.preNo", v2.value.preNo); preseObj.value.code = v2.value.preNo; v2.value.department = res.data.department, v2.value.dosageForm = res.data.dosageForm, v2.value.prescriptionUsage = res.data.prescriptionUsage, v2.value.number = res.data.number, v2.value.prescriptionSum = res.data.prescriptionSum, v2.value.prescriptionTotalSum = res.data.prescriptionTotalSum, v2.value.daijianCost = res.data.daijianCost, v2.value.distributionCost = res.data.distributionCost, v2.value.prescriptionTotleSum = res.data.prescriptionTotleSum, v2.value.entrust = res.data.entrust, v2.value.rp = res.data.detailList; v2.value.yljgName = res.data.yljgName || ""; v2.value.status = res.data.status, formatAppLog("log", "at pages/edit/edit.vue:372", "res.data.status", res.data.status); switch (res.data.status) { case "1": v2.value.status = "配药"; break; case "2": v2.value.status = "煎药"; break; case "3": v2.value.status = "发药"; break; case "4": v2.value.status = "配送"; break; case "5": v2.value.status = "已分配"; break; case "6": v2.value.status = "已传送"; break; default: v2.value.status = "配药"; } v2.value.operateList[0].operater = res.data.doctor || ""; v2.value.operateList[1].operater = res.data.checkBy || ""; v2.value.operateList[2].operater = res.data.tiaopeiName || ""; const length = res.data.operateList; if (length > 0) { res.data.operateList.forEach((item) => { switch (item.type) { case "2": v2.value.operateList[3].operater = item.createBy; break; case "3": v2.value.operateList[4].operater = item.createBy; break; case "4": v2.value.operateList[5].operater = item.createBy; break; case "5": v2.value.operateList[6].operater = item.createBy; break; case "6": v2.value.operateList[7].operater = item.createBy; break; } }); } } }); const handleGetRps = (v3) => { formatAppLog("log", "at pages/edit/edit.vue:427", "handleGetRps", v3); if (!selectRps.value.includes(v3)) { selectRps.value.push(v3); } else { selectRps.value.splice(selectRps.value.indexOf(v3), 1); } }; const handleChange = () => { isPrint.value = !isPrint.value; formatAppLog("log", "at pages/edit/edit.vue:437", "handleChange", isPrint.value); }; const handleBack = () => { uni.navigateBack({ delta: 1 }); }; const handleSubmit = async () => { formatAppLog("log", "at pages/edit/edit.vue:447", "handleSubmit>>>", editForm.value); formatAppLog("log", "at pages/edit/edit.vue:448", "直接调用接口,然后打印"); const { data: res } = await saveDepoly({ token: uni.getStorageSync("token"), data: JSON.stringify(editForm.value) }); if (res.code === 200) { formatAppLog("log", "at pages/edit/edit.vue:454", "depoly success>>>"); } if (isPrint.value) { print("#printMe"); await sendToUser({ token: uni.getStorageSync("token"), data: JSON.stringify({ id: uni.getStorageSync("userId") }) }); uni.redirectTo({ url: "/pages/index/index" }); } else { proxy.$refs.alertDialog.open("center"); } }; const dialogConfirm = async () => { formatAppLog("log", "at pages/edit/edit.vue:479", "dialogConfirm直接调用接口,然后打印"); print("#printMe"); await sendToUser({ token: uni.getStorageSync("token"), data: JSON.stringify({ id: uni.getStorageSync("userId") }) }); uni.redirectTo({ url: "/pages/index/index" }); }; const dialogClose = () => { formatAppLog("log", "at pages/edit/edit.vue:491", "dialogClose直接调用接口,不打印"); uni.redirectTo({ url: "/pages/index/index" }); }; const selectUpload = (e2) => { uni.showLoading({ title: "上传中" }); const tempFilePaths = e2.tempFilePaths; for (var i2 = 0; i2 < tempFilePaths.length; i2++) { e2.tempFiles[i2]; uni.uploadFile({ url: urlConfig.value + "/common/upload", header: { "Authorization": "Bearer " + uni.getStorageSync("token") }, formData: { secretFlag: "N", fileLocation: 5 }, filePath: tempFilePaths[i2], name: "file", success: (uploadFileRes) => { uni.hideLoading(); formatAppLog("log", "at pages/edit/edit.vue:517", "upload success>>", uploadFileRes); const back = JSON.parse(uploadFileRes.data); formatAppLog("log", "at pages/edit/edit.vue:519", "upload success back >>", back); if (back.code == 200) { editForm.value.urls.push(back.url); } }, fail: () => { uni.hideLoading(); uni.showToast("上传失败,请联系开发!"); }, complete: function() { uni.hideLoading(); } }); } }; return (_ctx, _cache) => { const _component_uni_nav_bar = resolveEasycom(vue.resolveDynamicComponent("uni-nav-bar"), __easycom_0); const _component_w_barcode = resolveEasycom(vue.resolveDynamicComponent("w-barcode"), __easycom_1); const _component_uni_tag = resolveEasycom(vue.resolveDynamicComponent("uni-tag"), __easycom_2); const _component_uni_file_picker = resolveEasycom(vue.resolveDynamicComponent("uni-file-picker"), __easycom_3); const _component_uni_popup_dialog = resolveEasycom(vue.resolveDynamicComponent("uni-popup-dialog"), __easycom_4); const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_5); return vue.openBlock(), vue.createElementBlock("view", { class: "main" }, [ vue.createVNode(_component_uni_nav_bar, { dark: "", fixed: true, "background-color": "#18C7B0", "status-bar": "", "left-icon": "left", height: "62.5rpx", width: "750rpx", title: "调配详情", onClickLeft: handleBack }), vue.createElementVNode("view", { class: "content" }, [ vue.createElementVNode("view", { class: "header" }, [ vue.createElementVNode("view", { class: "ti" }, [ vue.createElementVNode("view", { class: "left" }, [ vue.createElementVNode("view", { class: "baracode" }, [ vue.createVNode(_component_w_barcode, { options: preseObj.value }, null, 8, ["options"]), vue.createElementVNode( "view", { class: "barnum" }, vue.toDisplayString(v2.value.preNo), 1 /* TEXT */ ) ]) ]), vue.createElementVNode("view", { class: "mid" }, [ vue.createElementVNode("text", { class: "title" }, "中药处方笺") ]), vue.createElementVNode("view", { class: "rig" }, [ vue.createElementVNode( "text", { class: "title" }, vue.toDisplayString(v2.value.type == "1" ? "中药处方" : v2.value.type == "1" ? "中药制剂" : ""), 1 /* TEXT */ ) ]) ]), vue.createElementVNode("view", { class: "patiinfo" }, [ vue.createElementVNode("view", { class: "r1" }, [ vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "姓名:"), vue.createTextVNode( vue.toDisplayString(v2.value.name), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "性别:"), vue.createTextVNode( vue.toDisplayString(v2.value.sex), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "年龄:"), vue.createTextVNode( vue.toDisplayString(v2.value.age) + "岁", 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "电话:"), vue.createTextVNode( vue.toDisplayString(v2.value.contactNumber), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "当前处方状态:"), vue.createTextVNode( vue.toDisplayString(v2.value.state == "1" ? "配药" : v2.value.state == "2" ? "煎药" : v2.value.state == "3" ? "发药" : v2.value.state == "4" ? "配送" : ""), 1 /* TEXT */ ) ]) ]), vue.createElementVNode("view", { class: "r2" }, [ vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "就诊科室:"), vue.createTextVNode( vue.toDisplayString(v2.value.department), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "临床诊断:"), vue.createTextVNode( vue.toDisplayString(v2.value.disName) + "—" + vue.toDisplayString(v2.value.symName), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "开方时间:"), vue.createTextVNode( vue.toDisplayString(v2.value.prescriptionTime), 1 /* TEXT */ ) ]) ]), vue.createElementVNode("view", { class: "r3" }, [ vue.createElementVNode("span", { class: "we" }, "联系地址:"), vue.createTextVNode( vue.toDisplayString(v2.value.address), 1 /* TEXT */ ) ]) ]) ]), vue.createElementVNode("view", { class: "rp" }, [ vue.createElementVNode("view", { class: "title" }, [ vue.createElementVNode("text", { class: "text" }, "Rp:") ]), vue.createElementVNode("view", { class: "lists" }, [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList(v2.value.rp, (x2, i2) => { return vue.openBlock(), vue.createElementBlock("view", { class: "item", key: i2 }, [ vue.createElementVNode("view", { class: "le tag-view" }, [ vue.createVNode(_component_uni_tag, { inverted: !selectRps.value.includes(x2), text: x2.matName + x2.matDose + x2.matUnitName, onClick: ($event) => handleGetRps(x2) }, null, 8, ["inverted", "text", "onClick"]) ]), vue.createElementVNode("view", { class: "rig" }, [ vue.createElementVNode( "view", { class: "up" }, vue.toDisplayString(x2.matUsageName), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "do" }, vue.toDisplayString(x2.sign), 1 /* TEXT */ ) ]) ]); }), 128 /* KEYED_FRAGMENT */ )) ]), vue.createElementVNode("view", { class: "footer" }, [ vue.createElementVNode("view", { class: "js" }, [ vue.createTextVNode( " 剂数:" + vue.toDisplayString(v2.value.number) + " ", 1 /* TEXT */ ), v2.value.daijianCost !== "" ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "pies_tips" }, " (代煎) ")) : vue.createCommentVNode("v-if", true) ]), vue.createElementVNode( "view", { class: "js" }, vue.toDisplayString(v2.value.dosageForm), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "js" }, vue.toDisplayString(v2.value.prescriptionUsage), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "js" }, "每次" + vue.toDisplayString(v2.value.concentration), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "js" }, vue.toDisplayString(v2.value.frequency), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "freque" }, vue.toDisplayString(v2.value.medicationTime), 1 /* TEXT */ ) ]), vue.createElementVNode( "view", { class: "rp-tips" }, vue.toDisplayString(v2.value.entrust), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "amountarea" }, [ vue.createElementVNode("view", { class: "amount" }, [ vue.createElementVNode("view", { class: "r1" }, [ vue.createElementVNode( "view", { class: "pijw" }, "药品金额:" + vue.toDisplayString(v2.value.prescriptionSum), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "r2" }, [ vue.createElementVNode( "view", { class: "jyf" }, "煎药费:" + vue.toDisplayString(v2.value.daijianCost), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "psf" }, "配送费:" + vue.toDisplayString(v2.value.distributionCost), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "r3" }, [ vue.createTextVNode( " 总金额:" + vue.toDisplayString(v2.value.prescriptionTotalSum) + " ", 1 /* TEXT */ ), vue.createCommentVNode(' ') ]) ]), vue.createElementVNode("view", { class: "service" }, [ vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "开方:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[0].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "审核:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[1].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "调配:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[2].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "复核:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[3].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "浸泡:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[4].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "煎煮:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[5].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "打包:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[6].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "发药:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[7].operater || ""), 1 /* TEXT */ ) ]) ]) ]), vue.createElementVNode("view", { class: "comment" }, [ vue.createElementVNode("view", { class: "z" }, "注:"), vue.createElementVNode( "text", null, vue.toDisplayString(v2.value.entrust1111), 1 /* TEXT */ ) ]) ]), vue.createElementVNode("view", { class: "upload" }, [ vue.createElementVNode("view", { class: "title" }, "上传照片"), vue.createVNode(_component_uni_file_picker, { "image-styles": imageStyles.value, fileMediatype: "image", mode: "grid", limit: 3, "del-icon": false, "auto-upload": false, onSelect: selectUpload }, null, 8, ["image-styles"]) ]), vue.createElementVNode("view", { class: "cooment" }, [ vue.createElementVNode("view", { class: "title" }, "备注内容"), vue.createElementVNode("view", { class: "tex" }, [ vue.withDirectives(vue.createElementVNode( "textarea", { placeholder: "请输入备注内容", "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => editForm.value.comments = $event), "placeholder-style": "font-size: 15rpx;", height: "60rpx", onInput: bindTextInput, class: "input" }, null, 544 /* HYDRATE_EVENTS, NEED_PATCH */ ), [ [vue.vModelText, editForm.value.comments] ]) ]) ]), vue.createElementVNode("view", { class: "radio" }, [ vue.createElementVNode("label", { for: "" }, [ vue.createElementVNode("switch", { checked: isPrint.value, style: { "transform": "scale(0.7)" }, onChange: handleChange }, null, 40, ["checked"]), vue.createTextVNode(" 上传时直接打印标签 ") ]) ]), vue.createElementVNode("view", { class: "submit" }, [ vue.createElementVNode("button", { type: "primary", class: "bu", onClick: handleSubmit }, "上传") ]), vue.createElementVNode("view", { class: "popup" }, [ vue.createVNode( _component_uni_popup, { ref: "alertDialog", type: "dialog" }, { default: vue.withCtx(() => [ vue.createVNode(_component_uni_popup_dialog, { type: "center", cancelText: "不打印", confirmText: "打印", title: "打印标签", onConfirm: dialogConfirm, onClose: dialogClose }, { default: vue.withCtx(() => [ vue.createElementVNode("view", { class: "cotent", id: "printMe" }, [ vue.createElementVNode( "view", { class: "title" }, vue.toDisplayString(v2.value.yljgName || "默默事中医院取药标签打印(门诊)"), 1 /* TEXT */ ), vue.createElementVNode("view", { class: "body" }, [ vue.createElementVNode("view", { class: "lef" }, [ vue.createElementVNode("view", { class: "baracode" }, [ vue.createVNode(_component_w_barcode, { class: "cav", options: preseObj.value }, null, 8, ["options"]), vue.createElementVNode( "view", { class: "barnum" }, vue.toDisplayString(v2.value.preNo), 1 /* TEXT */ ) ]) ]), vue.createElementVNode("view", { class: "rig" }, [ vue.createElementVNode("view", { class: "hz" }, [ vue.createTextVNode("患者:"), vue.createElementVNode( "view", { class: "bold" }, vue.toDisplayString(v2.value.name) + "," + vue.toDisplayString(v2.value.sex) + "," + vue.toDisplayString(v2.value.age) + "岁", 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "hz" }, [ vue.createTextVNode("出生日期:"), vue.createElementVNode( "view", { class: "bold" }, vue.toDisplayString(v2.value.birth), 1 /* TEXT */ ) ]) ]) ]) ]) ]), _: 1 /* STABLE */ }) ]), _: 1 /* STABLE */ }, 512 /* NEED_PATCH */ ) ]) ]); }; } }); const PagesEditEdit = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "/Users/sunwubin/source/pharmacy/pages/edit/edit.vue"]]); const __default__ = { name: "" }; const _sfc_main$1 = /* @__PURE__ */ Object.assign(__default__, { setup(__props) { const urlConfig = vue.ref("http://zhongyao.fscuc.cn"); const preseObj = vue.ref({ code: "", color: ["#000"], // 条形码的颜色 bgColor: "#FFFFFF", // 背景色 width: 200, // 宽度 height: 50 // 高度 }); vue.getCurrentInstance(); const imageStyles = vue.ref({ width: 112.5, height: 112.5, border: { color: "#DDDDDD", width: 1, style: "solid", radius: "4px" } }); vue.ref([]); vue.ref({ height: 80, displayValue: false }); const selectRps = vue.ref([]); vue.ref(true); vue.ref([]); const v2 = vue.ref({ preNo: "11220822134401", presType: "普通处方", name: "李某", sex: "男", age: 35, contactNumber: "13888888888", status: "发药", department: "中医内科", disName: "胃脘痛病", symName: "脾胃虚寒证", prescriptionTime: "2023-06-01 15:58", address: "浙江省某某事某某去某某事中医院门诊楼三楼302是", rp: [ { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "包煎", sign: "医生签名" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "", sign: "" }, { matName: "车前子", matDose: "6", matUnitName: "g", tips: "先煎", sign: "" } ], number: 3, weight: "0", pies_tips: "待见", dosageForm: "汤剂", prescriptionUsage: "煎服", concentration: "200ml", frequency: "一日三次", medicationTime: "饭后服", entrust: "注意多休息,饮食清单。", prescriptionSum: "187.00", daijianCost: "30.00", distributionCost: "10.00", prescriptionTotleSum: "227.00", yljgName: "杭州某某高级中医院", operateList: [ { py: "kf", title: "开方", operater: "" }, { py: "sh", title: "审核", operater: "" }, { py: "tp", title: "调配", operater: "" }, { py: "fh", title: "复核", operater: "" }, { py: "jp", title: "浸泡", operater: "" }, { py: "jz", title: "煎煮", operater: "" }, { py: "db", title: "打包", operater: "" }, { py: "fy", title: "发药", operater: "" } ], entrust1111: "1、本处方当日有效\n 2、取药时请您当面核对。。。。 \n 3、延长处方用量时间原油:慢性病 其他老年病 外地 其他" }); const editForm = vue.ref({ urls: [], userId: uni.getStorageSync("userId"), comments: "", weight: v2.value.weight, coreId: v2.value.preNo }); vue.onMounted(() => { }); const bindTextInput = (e2) => { formatAppLog("log", "at pages/review/review.vue:284", e2.detail.value); }; onLoad(async (options) => { formatAppLog("log", "at pages/review/review.vue:288", "options", options); uni.getStorageSync("userId"); const params2 = { token: uni.getStorageSync("token"), data: { id: options.id || "", preNo: options.preNo || "", depolyStatus: options.deployState || "" } }; formatAppLog("log", "at pages/review/review.vue:299", "params", params2); const { data: res } = await selectOrderDetail(params2); if (res.code === 200) { v2.prescriptionTime = res.data.prescriptionTime, v2.value.name = res.data.name, v2.value.sex = res.data.sex, v2.value.age = res.data.age, v2.value.contactNumber = res.data.contactNumber; v2.value.address = res.data.address; v2.value.concentration = res.data.concentration; v2.value.frequency = res.data.frequency; v2.value.medicationTime = res.data.medicationTime; v2.value.disName = res.data.disName, v2.value.symName = res.data.symName, v2.value.preNo = res.data.preNo, formatAppLog("log", "at pages/review/review.vue:316", "onLoad v.value.preNo", v2.value.preNo); preseObj.value.code = v2.value.preNo; v2.value.department = res.data.department, v2.value.dosageForm = res.data.dosageForm, v2.value.prescriptionUsage = res.data.prescriptionUsage, v2.value.number = res.data.number, v2.value.prescriptionSum = res.data.prescriptionSum, v2.value.prescriptionTotalSum = res.data.prescriptionTotalSum, v2.value.daijianCost = res.data.daijianCost, v2.value.distributionCost = res.data.distributionCost, v2.value.prescriptionTotleSum = res.data.prescriptionTotleSum, v2.value.entrust = res.data.entrust, v2.value.rp = res.data.detailList; v2.value.yljgName = res.data.yljgName || ""; v2.value.status = res.data.status, formatAppLog("log", "at pages/review/review.vue:334", "res.data.status", res.data.status); switch (res.data.status) { case "1": v2.value.status = "配药"; break; case "2": v2.value.status = "煎药"; break; case "3": v2.value.status = "发药"; break; case "4": v2.value.status = "配送"; break; case "5": v2.value.status = "已分配"; break; case "6": v2.value.status = "已传送"; break; default: v2.value.status = "配药"; } v2.value.operateList[0].operater = res.data.doctor || ""; v2.value.operateList[1].operater = res.data.checkBy || ""; v2.value.operateList[2].operater = res.data.tiaopeiName || ""; const length = res.data.operateList; if (length > 0) { res.data.operateList.forEach((item) => { switch (item.type) { case "2": v2.value.operateList[3].operater = item.createBy; break; case "3": v2.value.operateList[4].operater = item.createBy; break; case "4": v2.value.operateList[5].operater = item.createBy; break; case "5": v2.value.operateList[6].operater = item.createBy; break; case "6": v2.value.operateList[7].operater = item.createBy; break; } }); } const leng = v2.rp.length; formatAppLog("log", "at pages/review/review.vue:386", "rprprpprprpr", leng); let weight = 0; if (leng > 0) { for (let i2 = 0; i2 < len; i2++) { weight = weight + parseInt(v2.rp[i2].matDose); } } v2.value.weight = weight + ""; formatAppLog("log", "at pages/review/review.vue:394", "weigiht>>>", v2.value.weight); } }); const handleGetRps = (v3) => { formatAppLog("log", "at pages/review/review.vue:399", "handleGetRps", v3); if (!selectRps.value.includes(v3)) { selectRps.value.push(v3); } else { selectRps.value.splice(selectRps.value.indexOf(v3), 1); } }; const handleBack = () => { uni.navigateBack({ delta: 1 }); }; const handleSubmit = async () => { formatAppLog("log", "at pages/review/review.vue:419", "handleSubmit>>>", editForm.value); const { data: res } = await saveReview({ token: uni.getStorageSync("token"), data: JSON.stringify(editForm.value) }); if (res.code === 200) { formatAppLog("log", "at pages/review/review.vue:426", "depoly success>>>"); uni.redirectTo({ url: "/pages/index/index" }); } }; const selectUpload = (e2) => { uni.showLoading({ title: "上传中" }); const tempFilePaths = e2.tempFilePaths; for (var i2 = 0; i2 < tempFilePaths.length; i2++) { e2.tempFiles[i2]; uni.uploadFile({ url: urlConfig.value + "/common/upload", header: { "Authorization": "Bearer " + uni.getStorageSync("token") }, formData: { secretFlag: "N", fileLocation: 5 }, filePath: tempFilePaths[i2], name: "file", success: (uploadFileRes) => { uni.hideLoading(); formatAppLog("log", "at pages/review/review.vue:454", "upload success>>", uploadFileRes); const back = JSON.parse(uploadFileRes.data); formatAppLog("log", "at pages/review/review.vue:456", "upload success back >>", back); if (back.code == 200) { editForm.value.urls.push(back.url); } }, fail: () => { uni.hideLoading(); uni.showToast("上传失败,请联系开发!"); }, complete: function() { uni.hideLoading(); } }); } }; const handleOnblur = (e2) => { formatAppLog("log", "at pages/review/review.vue:474", "eeeeee", e2.detail.value); editForm.value.weight = e2.detail.value; formatAppLog("log", "at pages/review/review.vue:476", "eeeeee editForm.value.weight", editForm.value.weight); }; return (_ctx, _cache) => { const _component_uni_nav_bar = resolveEasycom(vue.resolveDynamicComponent("uni-nav-bar"), __easycom_0); const _component_w_barcode = resolveEasycom(vue.resolveDynamicComponent("w-barcode"), __easycom_1); const _component_uni_tag = resolveEasycom(vue.resolveDynamicComponent("uni-tag"), __easycom_2); const _component_uni_file_picker = resolveEasycom(vue.resolveDynamicComponent("uni-file-picker"), __easycom_3); return vue.openBlock(), vue.createElementBlock("view", { class: "main" }, [ vue.createVNode(_component_uni_nav_bar, { dark: "", fixed: true, "background-color": "#18C7B0", "status-bar": "", "left-icon": "left", height: "62.5rpx", width: "750rpx", title: "复核详情", onClickLeft: handleBack }), vue.createElementVNode("view", { class: "content" }, [ vue.createElementVNode("view", { class: "header" }, [ vue.createElementVNode("view", { class: "ti" }, [ vue.createElementVNode("view", { class: "left" }, [ vue.createElementVNode("view", { class: "baracode" }, [ vue.createVNode(_component_w_barcode, { options: preseObj.value }, null, 8, ["options"]), vue.createElementVNode( "view", { class: "barnum" }, vue.toDisplayString(v2.value.preNo), 1 /* TEXT */ ) ]) ]), vue.createElementVNode("view", { class: "mid" }, [ vue.createElementVNode("text", { class: "title" }, "中药处方笺") ]), vue.createElementVNode("view", { class: "rig" }, [ vue.createElementVNode( "text", { class: "title" }, vue.toDisplayString(v2.value.type == "1" ? "中药处方" : v2.value.type == "1" ? "中药制剂" : ""), 1 /* TEXT */ ) ]) ]), vue.createElementVNode("view", { class: "patiinfo" }, [ vue.createElementVNode("view", { class: "r1" }, [ vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "姓名:"), vue.createTextVNode( vue.toDisplayString(v2.value.name), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "性别:"), vue.createTextVNode( vue.toDisplayString(v2.value.sex), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "年龄:"), vue.createTextVNode( vue.toDisplayString(v2.value.age) + "岁", 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "电话:"), vue.createTextVNode( vue.toDisplayString(v2.value.contactNumber), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "当前处方状态:"), vue.createTextVNode( vue.toDisplayString(v2.value.state == "1" ? "配药" : v2.value.state == "2" ? "煎药" : v2.value.state == "3" ? "发药" : v2.value.state == "4" ? "配送" : ""), 1 /* TEXT */ ) ]) ]), vue.createElementVNode("view", { class: "r2" }, [ vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "就诊科室:"), vue.createTextVNode( vue.toDisplayString(v2.value.department), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "临床诊断:"), vue.createTextVNode( vue.toDisplayString(v2.value.disName) + "—" + vue.toDisplayString(v2.value.symName), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "row" }, [ vue.createElementVNode("span", { class: "we" }, "开方时间:"), vue.createTextVNode( vue.toDisplayString(v2.value.prescriptionTime), 1 /* TEXT */ ) ]) ]), vue.createElementVNode("view", { class: "r3" }, [ vue.createElementVNode("span", { class: "we" }, "联系地址:"), vue.createTextVNode( vue.toDisplayString(v2.value.address), 1 /* TEXT */ ) ]) ]) ]), vue.createElementVNode("view", { class: "rp" }, [ vue.createElementVNode("view", { class: "title" }, [ vue.createElementVNode("text", { class: "text" }, "Rp:") ]), vue.createElementVNode("view", { class: "lists" }, [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList(v2.value.rp, (x2, i2) => { return vue.openBlock(), vue.createElementBlock("view", { class: "item", key: i2 }, [ vue.createElementVNode("view", { class: "le tag-view" }, [ vue.createVNode(_component_uni_tag, { inverted: !selectRps.value.includes(x2), text: x2.matName + x2.matDose + x2.matUnitName, onClick: ($event) => handleGetRps(x2) }, null, 8, ["inverted", "text", "onClick"]) ]), vue.createElementVNode("view", { class: "rig" }, [ vue.createElementVNode( "view", { class: "up" }, vue.toDisplayString(x2.matUsageName), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "do" }, vue.toDisplayString(x2.sign), 1 /* TEXT */ ) ]) ]); }), 128 /* KEYED_FRAGMENT */ )) ]), vue.createElementVNode("view", { class: "footer" }, [ vue.createElementVNode("view", { class: "js" }, [ vue.createTextVNode( " 剂数:" + vue.toDisplayString(v2.value.number) + " ", 1 /* TEXT */ ), v2.value.daijianCost !== "" ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "pies_tips" }, " (代煎) ")) : vue.createCommentVNode("v-if", true) ]), vue.createElementVNode( "view", { class: "js" }, vue.toDisplayString(v2.value.dosageForm), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "js" }, vue.toDisplayString(v2.value.prescriptionUsage), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "js" }, "每次" + vue.toDisplayString(v2.value.concentration), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "js" }, vue.toDisplayString(v2.value.frequency), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "freque" }, vue.toDisplayString(v2.value.medicationTime), 1 /* TEXT */ ) ]), vue.createElementVNode( "view", { class: "rp-tips" }, vue.toDisplayString(v2.value.entrust), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "amountarea" }, [ vue.createElementVNode("view", { class: "amount" }, [ vue.createElementVNode("view", { class: "r1" }, [ vue.createElementVNode( "view", { class: "pijw" }, "药品金额:" + vue.toDisplayString(v2.value.prescriptionSum), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "r2" }, [ vue.createElementVNode( "view", { class: "jyf" }, "煎药费:" + vue.toDisplayString(v2.value.daijianCost), 1 /* TEXT */ ), vue.createElementVNode( "view", { class: "psf" }, "配送费:" + vue.toDisplayString(v2.value.distributionCost), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "r3" }, [ vue.createTextVNode( " 总金额:" + vue.toDisplayString(v2.value.prescriptionTotalSum) + " ", 1 /* TEXT */ ), vue.createCommentVNode(' ') ]) ]), vue.createElementVNode("view", { class: "service" }, [ vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "开方:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[0].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "审核:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[1].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "调配:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[2].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "复核:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[3].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "浸泡:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[4].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "煎煮:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[5].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "打包:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[6].operater || ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "kf" }, [ vue.createElementVNode("span", { class: "we" }, "发药:"), vue.createTextVNode( vue.toDisplayString(v2.value.operateList[7].operater || ""), 1 /* TEXT */ ) ]) ]) ]), vue.createElementVNode("view", { class: "comment" }, [ vue.createElementVNode("view", { class: "z" }, "注:"), vue.createElementVNode( "text", null, vue.toDisplayString(v2.value.entrust1111), 1 /* TEXT */ ) ]) ]), vue.createElementVNode("view", { class: "upload" }, [ vue.createElementVNode("view", { class: "title" }, "上传照片"), vue.createVNode(_component_uni_file_picker, { "image-styles": imageStyles.value, fileMediatype: "image", mode: "grid", limit: 3, "del-icon": false, "auto-upload": false, onSelect: selectUpload }, null, 8, ["image-styles"]) ]), vue.createElementVNode("view", { class: "weight" }, [ vue.createElementVNode("view", { class: "title" }, "复核重量"), vue.createElementVNode("view", { class: "tex" }, [ vue.createElementVNode("input", { class: "uni-input", type: "number", value: v2.value.weight, placeholder: "请输入", onInput: handleOnblur, "auto-blur": "/" }, null, 40, ["value"]), vue.createTextVNode(" g ") ]) ]), vue.createElementVNode("view", { class: "cooment" }, [ vue.createElementVNode("view", { class: "title" }, "备注内容"), vue.createElementVNode("view", { class: "tex" }, [ vue.withDirectives(vue.createElementVNode( "textarea", { placeholder: "请输入备注内容", "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => editForm.value.comments = $event), "placeholder-style": "font-size: 15rpx;", height: "60rpx", onInput: bindTextInput, class: "input" }, null, 544 /* HYDRATE_EVENTS, NEED_PATCH */ ), [ [vue.vModelText, editForm.value.comments] ]) ]) ]), vue.createElementVNode("view", { class: "submit" }, [ vue.createElementVNode("button", { type: "primary", class: "bu", onClick: handleSubmit }, "上传") ]) ]); }; } }); const PagesReviewReview = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "/Users/sunwubin/source/pharmacy/pages/review/review.vue"]]); __definePage("pages/login/login", PagesLoginLogin); __definePage("pages/index/index", PagesIndexIndex); __definePage("pages/detail/detail", PagesDetailDetail); __definePage("pages/edit/edit", PagesEditEdit); __definePage("pages/review/review", PagesReviewReview); const _WEBSOCKET = { //是否打开连接 isOpen: false, //连接socket connectSocket(url, successFunc = null, errorFunc = null) { try { uni.connectSocket({ url, success() { formatAppLog("log", "at static/js/websocket.js:11", "websocket连接成功!"); } }); uni.onSocketOpen((res) => { this.isOpen = true; formatAppLog("log", "at static/js/websocket.js:17", "WebSocket连接已打开!"); if (successFunc) { successFunc(res); } }); uni.onSocketError((res) => { this.isOpen = false; formatAppLog("log", "at static/js/websocket.js:25", "WebSocket连接打开失败,请检查!"); if (errorFunc) { errorFunc(res); } }); uni.onSocketMessage((res) => { formatAppLog("log", "at static/js/websocket.js:32", "收到服务器内容:" + res.data); params = { inApp: true, // app内横幅提醒 voice: true, // 声音提醒 vibration: true, // 振动提醒 messageType: "", //消息分类 messageTitle: "", //通知标题 messageContent: "中药煎配溯源管理来新处方啦!", messageImage: "" }; uni.$appPush(params); uni.redirectTo({ url: "/pages/index/index" }); }); uni.onSocketClose((res) => { formatAppLog("log", "at static/js/websocket.js:49", "WebSocket 已关闭!"); this.isOpen = false; }); } catch (error) { formatAppLog("log", "at static/js/websocket.js:53", "err:" + error); } }, //发送消息 sendMessage(msg = "", successFunc = null, errorFunc = null) { if (!this.isOpen || !msg) { if (errorFunc) { errorFunc("未传消息内容或连接未打开!"); } return; } uni.sendSocketMessage({ data: msg, success(res) { formatAppLog("log", "at static/js/websocket.js:67", "消息发送成功!"); if (successFunc) { successFunc(res); } }, fail(err) { formatAppLog("log", "at static/js/websocket.js:73", "消息发送失败!"); if (errorFunc) { errorFunc(err); } } }); }, //关闭连接 closeSocket() { if (!this.isOpen) { return; } uni.closeSocket(); } }; const _sfc_main = { __name: "App", setup(__props) { let globalTimer = null; onLaunch(async () => { formatAppLog("log", "at App.vue:14", "App onLaunch"); }); onShow(() => { formatAppLog("log", "at App.vue:32", "App Show"); uni.$on("login", (data) => { try { _WEBSOCKET.connectSocket(`wss://zhongyao.fscuc.cn/webSocket/sentMessage/${data.userId}`, () => { heartBeatTest(); }); } catch (error) { formatAppLog("log", "at App.vue:42", "App err:" + error); } }); }); onHide(() => { formatAppLog("log", "at App.vue:48", "App Hide"); uni.$off("login", (data) => { _WEBSOCKET.closeSocket(); }); }); const heartBeatTest = () => { clearInterval(globalTimer); globalTimer = setInterval(() => { _WEBSOCKET.sendMessage( JSON.stringify({ action: "ping" }), //与服务端约定好消息格式 null, () => { clearInterval(globalTimer); } ); }, 1e4); }; return () => { }; } }; const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/sunwubin/source/pharmacy/App.vue"]]); let appPush$1 = class appPush { constructor(option = {}) { formatAppLog("log", "at js_sdk/levine-APPPush/levine-APPPush/plugins/APPPush/app_push.js:3", option); this.inApp = option.inApp; this.voice = option.voice; this.vibration = option.vibration; this.messageType = option.messageType || ""; this.messageTitle = option.messageTitle || ""; this.messageTime = option.messageTime || "现在"; this.messageContent = option.messageContent || ""; this.messageImage = option.messageImage || ""; this.screenWidth = plus.screen.resolutionWidth; this.screenHeight = plus.screen.resolutionHeight; this.propotation = this.screenWidth / 750; this.popupViewWidth = this.propotation * 710; this.popupViewHeight = this.propotation * 192; this.viewContentPadding = this.propotation * 30; this.viewContentWidth = parseInt(this.popupViewWidth - this.viewContentPadding * 2); this.system = uni.getSystemInfoSync(); this.duration = 200; this.closeTime = 3e3; formatAppLog("log", "at js_sdk/levine-APPPush/levine-APPPush/plugins/APPPush/app_push.js:41", this.inApp, this.voice, this.vibration); this.top = this.propotation * 20 + this.system.statusBarHeight; this.initTop = -this.system.statusBarHeight; this.body = null; this.bodyBg = null; this.timer = null; this.flag = false; this.cur = { x: 0, y: 0, pageX: 0, pageY: 0 }; } // 生成弹框主体 createView() { let view = new plus.nativeObj.View("popupView", { // tag: 'rect', top: this.propotation * 20 + this.system.statusBarHeight, left: this.propotation * 20, height: this.popupViewHeight, width: this.popupViewWidth }); view.drawRect({ color: "#fff", radius: "10px" }); let viewContentList = [ { src: "/static/push/message-icon.png", id: "icon", tag: "img", position: { top: this.viewContentPadding + "px", left: this.viewContentPadding + "px", width: this.propotation * 24 + "px", height: this.propotation * 24 + "px" } }, { tag: "font", id: "pop-title", text: this.messageType, textStyles: { size: this.propotation * 24 + "px", align: "left", color: "#4F555B" }, position: { top: this.viewContentPadding + "px", left: this.propotation * 64 + "px", height: this.propotation * 24 + "px", width: this.viewContentWidth + "px" } }, { tag: "font", id: "time", text: this.messageTime, textStyles: { size: this.propotation * 24 + "px", align: "right", color: "#4F555B" }, position: { top: this.viewContentPadding + "px", left: this.viewContentPadding + "px", height: this.propotation * 24 + "px", width: this.viewContentWidth + "px" } }, { tag: "font", id: "push-title", text: this.messageTitle, textStyles: { size: this.propotation * 30 + "px", align: "left", color: "#202123", overflow: "ellipsis" }, position: { top: this.propotation * 82 + "px", left: this.propotation * 30 + "px", height: this.propotation * 30 + "px", width: this.propotation * 505 + "px" } }, { tag: "font", id: "push-content", text: this.messageContent, textStyles: { size: this.propotation * 24 + "px", align: "left", color: "#4F555B", overflow: "ellipsis" }, position: { top: this.propotation * 130 + "px", left: this.propotation * 30 + "px", height: this.propotation * 24 + "px", width: this.propotation * 505 + "px" } }, { src: this.messageImage, id: "image", tag: "img", position: { top: this.propotation * 68 + "px", // right: "0px", left: this.propotation * 586 + "px", width: this.propotation * 100 + "px", height: this.propotation * 100 + "px" } }, { src: "/static/push/img-bg.png", id: "img-bg", tag: "img", position: { top: this.propotation * 68 + "px", // right: "0px", left: this.propotation * 586 + "px", width: this.propotation * 100 + "px", height: this.propotation * 100 + "px" } } ]; view.draw(viewContentList); view.addEventListener("touchstart", (event) => { this.flag = true; var touch; if (event.touches) { touch = event.touches[0]; } else { touch = event; } this.cur.x = touch.clientX; this.cur.y = touch.clientY; this.cur.pageX = touch.pageX; this.cur.pageY = touch.pageY; }); view.addEventListener("touchmove", (event) => { var touch; if (event.touches) { touch = event.touches[0]; } else { touch = event; } let moveX = touch.pageX - this.cur.x; let moveY = touch.pageY - this.cur.y; let x2 = moveX; let y2 = moveY; if (x2 < 0) ; else if (x2 > this.popupViewWidth - this.popupViewWidth) ; if (y2 < 0) ; else if (y2 >= this.propotation * 20 + this.system.statusBarHeight) { y2 = this.propotation * 20 + this.system.statusBarHeight; } this.body.setStyle({ top: y2 + "px", left: x2 + "px" }); }); view.addEventListener("touchend", (event) => { var touch; if (event.touches) { touch = event.touches[0]; } else { touch = event; } let differX = Math.abs(this.cur.pageX) - Math.abs(touch.pageX); let differY = Math.abs(this.cur.pageY) - Math.abs(touch.pageY); this.flag = false; if (Math.abs(differX) > 5 || Math.abs(differY) > 5) { this.hide(); } else { formatAppLog("log", "at js_sdk/levine-APPPush/levine-APPPush/plugins/APPPush/app_push.js:243", "-------------------"); this.hide(); } }); this.body = view; } // 显示/关闭弹框动画 modelAnimationOpenOrClose(type) { var options = { type, duration: this.duration }; plus.nativeObj.View.startAnimation(options, this.body, () => { plus.nativeObj.View.clearAnimation(); }); } bgAnimationOpenOrClose(type) { var options = { type, duration: this.duration }; plus.nativeObj.View.startAnimation(options, this.bodyBg, () => { plus.nativeObj.View.clearAnimation(); }); } // closeAnimation() { // // push弹框距离最顶部的距离 // let top = (this.propotation * 20) + this.system.statusBarHeight // // 完全隐藏时的顶部距离 // let hideTop = -this.system.statusBarHeight // this.timer = setInterval(() => { // this.top = this.top - 2 // if(this.top < hideTop * 2) { // clearInterval(this.timer) // this.timer = null // } // this.body.setStyle({ // top:this.top // }) // }, 1) // } // 显示弹框 show() { this.tips(); if (this.inApp) { this.createView(); this.body.show(); setTimeout(() => { if (this.body) { this.hide(); } }, this.closeTime); } } // 关闭弹框 hide() { this.modelAnimationOpenOrClose("slide-out-right"); this.body.hide(); setTimeout(() => { plus.nativeObj.View.clearAnimation(); this.body = null; }, this.duration); } // 调用系统提示音和振动 tips() { if (this.voice) { let system = uni.getSystemInfoSync().platform; if (system == "ios") { let player = plus.audio.createPlayer("/static/audio/ios.mp3"); player.play(); } else { let main = plus.android.runtimeMainActivity(); let RingtoneManager = plus.android.importClass("android.media.RingtoneManager"); let uri = RingtoneManager.getActualDefaultRingtoneUri(main, RingtoneManager.TYPE_NOTIFICATION); formatAppLog("log", "at js_sdk/levine-APPPush/levine-APPPush/plugins/APPPush/app_push.js:333", uri); let MediaPlayer = plus.android.importClass("android.media.MediaPlayer"); let player = MediaPlayer.create(main, uri); player.setLooping(false); player.prepare(); player.start(); } } if (this.vibration) { plus.device.vibrate(); } } }; const appPush = { install: function(Vue2) { Vue2.prototype.$appPush = function(op = {}) { new appPush$1({ ...op }).show(); }; } }; class e { constructor(e2) { this.standards = { strict: "strict", loose: "loose", html5: "html5" }, this.previewBody = null, this.close = null, this.previewBodyUtilPrintBtn = null, this.selectArray = [], this.counter = 0, this.settings = { standard: this.standards.html5 }, Object.assign(this.settings, e2), this.init(); } init() { this.counter++, this.settings.id = `printArea_${this.counter}`; let e2 = ""; this.settings.url && !this.settings.asyncUrl && (e2 = this.settings.url); let t2 = this; if (this.settings.asyncUrl) return void t2.settings.asyncUrl(function(e3) { let i3 = t2.getPrintWindow(e3); t2.settings.preview ? t2.previewIfrmaeLoad() : t2.print(i3); }, t2.settings.vue); let i2 = this.getPrintWindow(e2); this.settings.url || this.write(i2.doc), this.settings.preview ? this.previewIfrmaeLoad() : this.print(i2); } addEvent(e2, t2, i2) { e2.addEventListener ? e2.addEventListener(t2, i2, false) : e2.attachEvent ? e2.attachEvent("on" + t2, i2) : e2["on" + t2] = i2; } previewIfrmaeLoad() { let e2 = document.getElementById("vue-pirnt-nb-previewBox"); if (e2) { let t2 = this, i2 = e2.querySelector("iframe"); this.settings.previewBeforeOpenCallback(), this.addEvent(i2, "load", function() { t2.previewBoxShow(), t2.removeCanvasImg(), t2.settings.previewOpenCallback(); }), this.addEvent(e2.querySelector(".previewBodyUtilPrintBtn"), "click", function() { t2.settings.beforeOpenCallback(), t2.settings.openCallback(), i2.contentWindow.print(), t2.settings.closeCallback(); }); } } removeCanvasImg() { let e2 = this; try { if (e2.elsdom) { let t2 = e2.elsdom.querySelectorAll(".canvasImg"); for (let e3 = 0; e3 < t2.length; e3++) t2[e3].remove(); } } catch (t2) { formatAppLog("log", "at node_modules/vue3-print-nb/dist/vue3-print-nb.es.js:1", t2); } } print(e2) { var t2 = this; let i2 = document.getElementById(this.settings.id) || e2.f, l2 = document.getElementById(this.settings.id).contentWindow || e2.f.contentWindow; t2.settings.beforeOpenCallback(), t2.addEvent(i2, "load", function() { l2.focus(), t2.settings.openCallback(), l2.print(), i2.remove(), t2.settings.closeCallback(), t2.removeCanvasImg(); }); } write(e2) { e2.open(), e2.write(`${this.docType()}${this.getHead()}${this.getBody()}`), e2.close(); } docType() { return this.settings.standard === this.standards.html5 ? "" : ``; } getHead() { let e2 = "", t2 = "", i2 = ""; this.settings.extraHead && this.settings.extraHead.replace(/([^,]+)/g, (t3) => { e2 += t3; }), [].forEach.call(document.querySelectorAll("link"), function(e3) { e3.href.indexOf(".css") >= 0 && (t2 += ``); }); let l2 = document.styleSheets; if (l2 && l2.length > 0) for (let r2 = 0; r2 < l2.length; r2++) try { if (l2[r2].cssRules || l2[r2].rules) { let e3 = l2[r2].cssRules || l2[r2].rules; for (let t3 = 0; t3 < e3.length; t3++) i2 += e3[t3].cssText; } } catch (s2) { formatAppLog("log", "at node_modules/vue3-print-nb/dist/vue3-print-nb.es.js:1", l2[r2].href + s2); } return this.settings.extraCss && this.settings.extraCss.replace(/([^,\s]+)/g, (e3) => { t2 += ``; }), `${this.settings.popTitle}${e2}${t2}`; } getBody() { let e2 = this.settings.ids; return e2 = e2.replace(new RegExp("#", "g"), ""), this.elsdom = this.beforeHanler(document.getElementById(e2)), "" + this.getFormData(this.elsdom).outerHTML + ""; } beforeHanler(e2) { let t2 = e2.querySelectorAll("canvas"); for (let i2 = 0; i2 < t2.length; i2++) if (!t2[i2].style.display) { let e3 = t2[i2].parentNode, l2 = t2[i2].toDataURL("image/png"), s2 = new Image(); s2.className = "canvasImg", s2.style.display = "none", s2.src = l2, e3.appendChild(s2); } return e2; } getFormData(e2) { let t2 = e2.cloneNode(true), i2 = t2.querySelectorAll("input,select,textarea"), l2 = t2.querySelectorAll(".canvasImg,canvas"), s2 = -1; for (let r2 = 0; r2 < l2.length; r2++) { let e3 = l2[r2].parentNode, t3 = l2[r2]; "canvas" === t3.tagName.toLowerCase() ? e3.removeChild(t3) : t3.style.display = "block"; } for (let r2 = 0; r2 < i2.length; r2++) { let t3 = i2[r2], l3 = t3.getAttribute("type"), n2 = i2[r2]; if (l3 || (l3 = "SELECT" === t3.tagName ? "select" : "TEXTAREA" === t3.tagName ? "textarea" : ""), "INPUT" === t3.tagName) "radio" === l3 || "checkbox" === l3 ? t3.checked && n2.setAttribute("checked", t3.checked) : (n2.value = t3.value, n2.setAttribute("value", t3.value)); else if ("select" === l3) { s2++; for (let i3 = 0; i3 < e2.querySelectorAll("select").length; i3++) { let l4 = e2.querySelectorAll("select")[i3]; if (!l4.getAttribute("newbs") && l4.setAttribute("newbs", i3), l4.getAttribute("newbs") == s2) { let i4 = e2.querySelectorAll("select")[s2].selectedIndex; t3.options[i4].setAttribute("selected", true); } } } else n2.innerHTML = t3.value, n2.setAttribute("html", t3.value); } return t2; } getPrintWindow(e2) { var t2 = this.Iframe(e2); return { f: t2, win: t2.contentWindow || t2, doc: t2.doc }; } previewBoxShow() { let e2 = document.getElementById("vue-pirnt-nb-previewBox"); e2 && (document.querySelector("html").setAttribute("style", "overflow: hidden"), e2.style.display = "block"); } previewBoxHide() { let e2 = document.getElementById("vue-pirnt-nb-previewBox"); e2 && (document.querySelector("html").setAttribute("style", "overflow: visible;"), e2.querySelector("iframe") && e2.querySelector("iframe").remove(), e2.style.display = "none"); } previewBox() { let e2 = document.getElementById("vue-pirnt-nb-previewBox"), t2 = "previewBody"; if (e2) return e2.querySelector("iframe") && e2.querySelector("iframe").remove(), { close: e2.querySelector(".previewClose"), previewBody: e2.querySelector(".previewBody") }; let i2 = document.createElement("div"); i2.setAttribute("id", "vue-pirnt-nb-previewBox"), i2.setAttribute("style", "position: fixed;top: 0px;left: 0px;width: 100%;height: 100%;background: white;display:none"), i2.style.zIndex = this.settings.zIndex; let l2 = document.createElement("div"); l2.setAttribute("class", "previewHeader"), l2.setAttribute("style", "padding: 5px 20px;"), l2.innerHTML = this.settings.previewTitle, i2.appendChild(l2), this.close = document.createElement("div"); let s2 = this.close; s2.setAttribute("class", "previewClose"), s2.setAttribute("style", "position: absolute;top: 5px;right: 20px;width: 25px;height: 20px;cursor: pointer;"); let r2 = document.createElement("div"), n2 = document.createElement("div"); r2.setAttribute("class", "closeBefore"), r2.setAttribute("style", "position: absolute;width: 3px;height: 100%;background: #040404;transform: rotate(45deg); top: 0px;left: 50%;"), n2.setAttribute("class", "closeAfter"), n2.setAttribute("style", "position: absolute;width: 3px;height: 100%;background: #040404;transform: rotate(-45deg); top: 0px;left: 50%;"), s2.appendChild(r2), s2.appendChild(n2), l2.appendChild(s2), this.previewBody = document.createElement("div"); let o2 = this.previewBody; o2.setAttribute("class", t2), o2.setAttribute("style", "display: flex;flex-direction: column; height: 100%;"), i2.appendChild(o2); let a2 = document.createElement("div"); a2.setAttribute("class", "previewBodyUtil"), a2.setAttribute("style", "height: 32px;background: #474747;position: relative;"), o2.appendChild(a2), this.previewBodyUtilPrintBtn = document.createElement("div"); let d2 = this.previewBodyUtilPrintBtn; return d2.setAttribute("class", "previewBodyUtilPrintBtn"), d2.innerHTML = this.settings.previewPrintBtnLabel, d2.setAttribute("style", "position: absolute;padding: 2px 10px;margin-top: 3px;left: 24px;font-size: 14px;color: white;cursor: pointer;background-color: rgba(0,0,0,.12);background-image: linear-gradient(hsla(0,0%,100%,.05),hsla(0,0%,100%,0));background-clip: padding-box;border: 1px solid rgba(0,0,0,.35);border-color: rgba(0,0,0,.32) rgba(0,0,0,.38) rgba(0,0,0,.42);box-shadow: inset 0 1px 0 hsla(0,0%,100%,.05), inset 0 0 1px hsla(0,0%,100%,.15), 0 1px 0 hsla(0,0%,100%,.05);"), a2.appendChild(d2), document.body.appendChild(i2), { close: this.close, previewBody: this.previewBody }; } iframeBox(e2, t2) { let i2 = document.createElement("iframe"); return i2.style.border = "0px", i2.style.position = "absolute", i2.style.width = "0px", i2.style.height = "0px", i2.style.right = "0px", i2.style.top = "0px", i2.setAttribute("id", e2), i2.setAttribute("src", t2), i2; } Iframe(e2) { let t2 = this.settings.id; e2 = e2 || (/* @__PURE__ */ new Date()).getTime(); let i2 = this, l2 = this.iframeBox(t2, e2); try { if (this.settings.preview) { l2.setAttribute("style", "border: 0px;flex: 1;"); let e3 = this.previewBox(), t3 = e3.previewBody, s2 = e3.close; t3.appendChild(l2), this.addEvent(s2, "click", function() { i2.previewBoxHide(); }); } else document.body.appendChild(l2); l2.doc = null, l2.doc = l2.contentDocument ? l2.contentDocument : l2.contentWindow ? l2.contentWindow.document : l2.document; } catch (s2) { throw new Error(s2 + ". iframes may not be supported in this browser."); } if (null == l2.doc) throw new Error("Cannot find document."); return l2; } } var t = { directiveName: "print", mounted(t2, i2, l2) { let s2 = i2.instance, r2 = ""; var n2, o2, a2; o2 = "click", a2 = () => { if ("string" == typeof i2.value) r2 = i2.value; else { if ("object" != typeof i2.value || !i2.value.id) return void window.print(); { r2 = i2.value.id; let e2 = r2.replace(new RegExp("#", "g"), ""); document.getElementById(e2) || (formatAppLog("log", "at node_modules/vue3-print-nb/dist/vue3-print-nb.es.js:1", "id in Error"), r2 = ""); } } d2(); }, (n2 = t2).addEventListener ? n2.addEventListener(o2, a2, false) : n2.attachEvent ? n2.attachEvent("on" + o2, a2) : n2["on" + o2] = a2; const d2 = () => { new e({ ids: r2, vue: s2, url: i2.value.url, standard: "", extraHead: i2.value.extraHead, extraCss: i2.value.extraCss, zIndex: i2.value.zIndex || 20002, previewTitle: i2.value.previewTitle || "打印预览", previewPrintBtnLabel: i2.value.previewPrintBtnLabel || "打印", popTitle: i2.value.popTitle, preview: i2.value.preview || false, asyncUrl: i2.value.asyncUrl, previewBeforeOpenCallback() { i2.value.previewBeforeOpenCallback && i2.value.previewBeforeOpenCallback(s2); }, previewOpenCallback() { i2.value.previewOpenCallback && i2.value.previewOpenCallback(s2); }, openCallback() { i2.value.openCallback && i2.value.openCallback(s2); }, closeCallback() { i2.value.closeCallback && i2.value.closeCallback(s2); }, beforeOpenCallback() { i2.value.beforeOpenCallback && i2.value.beforeOpenCallback(s2); } }); }; }, install: function(e2) { e2.directive("print", t); } }; uni.$showMsg = (title = "数据请求失败!", duration = 1500) => { uni.showToast({ title, duration, icon: "none" }); }; uni.$appPush = appPush; function createApp() { const app = vue.createVueApp(App); app.use(t); return { app }; } const { app: __app__, Vuex: __Vuex__, Pinia: __Pinia__ } = createApp(); uni.Vuex = __Vuex__; uni.Pinia = __Pinia__; __app__.provide("__globalStyles", __uniConfig.styles); __app__._component.mpType = "app"; __app__._component.render = () => { }; __app__.mount("#app"); })(Vue, uni.VueShared);