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

1 line
6.1 KiB
JavaScript

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.syncLiveRoomBottomIconSourcesFromStore=exports.syncLiveRoomBottomIconSources=void 0;var _constant=require("../constant"),_bottomIcon=require("./bottom-icon"),_notification=require("../notification"),_notificationIcon=require("../notification-icon"),_shoppingIcon=require("./shopping-icon"),_playerIcon=require("./player-icon"),_utils=require("../utils"),_liveInfo=require("../live-info"),_defaultBottomIcon=require("./default-bottom-icon");function _typeof(o){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function ownKeys(o,e){var n=Object.keys(o);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(o);e&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable})),n.push.apply(n,t)}return n}function _objectSpread(o){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(n),!0).forEach(function(e){_defineProperty(o,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(n,e))})}return o}function _defineProperty(o,e,n){return(e=_toPropertyKey(e))in o?Object.defineProperty(o,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):o[e]=n,o}function _toPropertyKey(o){var e=_toPrimitive(o,"string");return"symbol"===_typeof(e)?e:String(e)}function _toPrimitive(o,e){if("object"!==_typeof(o)||null===o)return o;var n=o[Symbol.toPrimitive];if(void 0!==n){var t=n.call(o,e||"default");if("object"!==_typeof(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(o)}var LIVE_MENU_ICON_CONFIG={IMAGE_TEXT_LIVE:{menuType:_constant.MENU_TYPE.InteractiveTool,resolveVisible:function(o){var e,n,t;return(null==o||null===(e=o.Menus)||void 0===e||null===(n=e.Menus)||void 0===n?void 0:n.some(function(o){return o.Type===_constant.MENU_TYPE.InteractiveTool}))&&2!==(null==o||null===(t=o.ImageTextConfig)||void 0===t?void 0:t.DisplayEnable)},resolveIconUrl:function(o){var e,n;return(null==o||null===(e=o.Menus)||void 0===e||null===(n=e.VerticalIconUrl)||void 0===n?void 0:n.ImageTextIconUrl)||_constant.DefaultVerticalIconUrl[_constant.MENU_TYPE.InteractiveTool]}},RICHTEXT:{menuType:_constant.MENU_TYPE.ImageTextIntro,resolveVisible:function(o){var e,n;return null==o||null===(e=o.Menus)||void 0===e||null===(n=e.Menus)||void 0===n?void 0:n.some(function(o){return o.Type===_constant.MENU_TYPE.ImageTextIntro})},resolveIconUrl:function(o){var e,n;return(null==o||null===(e=o.Menus)||void 0===e||null===(n=e.VerticalIconUrl)||void 0===n?void 0:n.BandIconUrl)||_constant.DefaultVerticalIconUrl[_constant.MENU_TYPE.ImageTextIntro]}}},updateIconByKey=function(o,e,n){return(null==o?void 0:o.key)!==e?o:_objectSpread(_objectSpread({},o),n)},orderBottomIconList=function(o){var e=_defaultBottomIcon.DEFAULT_BOTTOM_ICON_ORDER.reduce(function(o,e,n){return o[e]=n,o},{});return(Array.isArray(o)?o:[]).slice().sort(function(o,n){var t=null==o?void 0:o.serverMenuIndex,r=null==n?void 0:n.serverMenuIndex,i=void 0!==t,c=void 0!==r;if(i&&c)return t-r;if(i)return-1;if(c)return 1;var l=e[null==o?void 0:o.key],u=e[null==n?void 0:n.key];return void 0===l&&void 0===u?0:void 0===l?1:void 0===u?-1:l-u})},ensureIconSource=function(o,e){return o.some(function(o){return(null==o?void 0:o.key)===e.key&&!o.__bottomIconPatchOnly})?o:o.concat(e)},normalizeSourceIcon=function(o){return o&&"object"===_typeof(o)?_objectSpread(_objectSpread({},o),{},{visible:!1!==o.visible,iconUrl:o.iconUrl||o.src||"",title:o.title||o.name||""}):o},getReplayPlayerConfig=function(o){var e;return(null==o?void 0:o.ReplayPlayerConfig)||(null==o||null===(e=o.Basic)||void 0===e?void 0:e.ReplayPlayerConfig)||null},findLiveMenuByType=function(o,e){var n;return((null==o||null===(n=o.Menus)||void 0===n?void 0:n.Menus)||[]).find(function(o){return(null==o?void 0:o.Type)===e})},syncLiveRoomBottomIconSources=function(o,e){var n,t,r=null==o?void 0:o.store,i=null==r||null===(n=r.get)||void 0===n?void 0:n.call(r,"iconList");if(Array.isArray(i)&&(0,_liveInfo.hasLiveInfoPayload)(e)){var c=i.filter(_bottomIcon.isBottomIconPatchSource),l=i.filter(function(o){return!(0,_bottomIcon.isBottomIconPatchSource)(o)});(0,_notification.syncNotificationState)(r,e);var u=(0,_shoppingIcon.resolveShoppingBottomIconSource)(e),a=LIVE_MENU_ICON_CONFIG.IMAGE_TEXT_LIVE,s=LIVE_MENU_ICON_CONFIG.RICHTEXT,v=findLiveMenuByType(e,a.menuType),y=findLiveMenuByType(e,s.menuType),I=r.get("notification")||{},f=(0,_bottomIcon.buildBackgroundPlaybackIconSource)(o),p=ensureIconSource(l,f).map(function(o){var n=o=normalizeSourceIcon(o);return n=updateIconByKey(n,_bottomIcon.BOTTOM_ICON_KEY.IMAGE_TEXT_LIVE,{visible:Boolean(a.resolveVisible(e)),showIn:"portrait",iconUrl:a.resolveIconUrl(e),serverMenuIndex:null==v?void 0:v.Index}),n=updateIconByKey(n,_bottomIcon.BOTTOM_ICON_KEY.SHOPPING,{visible:u.visible,iconUrl:u.iconUrl,serverMenuIndex:u.serverMenuIndex}),n=updateIconByKey(n,_bottomIcon.BOTTOM_ICON_KEY.RICHTEXT,{visible:Boolean(s.resolveVisible(e)),showIn:"portrait",iconUrl:s.resolveIconUrl(e),serverMenuIndex:null==y?void 0:y.Index}),updateIconByKey(n,_bottomIcon.BOTTOM_ICON_KEY.BACKGROUND_PLAYBACK,f)});p=(0,_playerIcon.applyPlayerIconAvailability)(p,{videoType:r.get("reportInfo.videoType"),status:null==e||null===(t=e.Basic)||void 0===t?void 0:t.Status,replayPlayerConfig:getReplayPlayerConfig(e)}),p=(0,_notificationIcon.withNotificationIconState)({iconList:p,isShow:I.isShowNotificationButton,isOpen:I.isNotificationOpen}),p=orderBottomIconList(p).concat(c),(0,_utils.isSmallPlainDataEqual)(i,p)||r.set("iconList",p)}};exports.syncLiveRoomBottomIconSources=syncLiveRoomBottomIconSources;var syncLiveRoomBottomIconSourcesFromStore=function(o){var e,n,t=null==o||null===(e=o.store)||void 0===e||null===(n=e.get)||void 0===n?void 0:n.call(e,"liveInfo");(0,_liveInfo.hasLiveInfoPayload)(t)&&syncLiveRoomBottomIconSources(o,t)};exports.syncLiveRoomBottomIconSourcesFromStore=syncLiveRoomBottomIconSourcesFromStore;