1 |
- import{i as C}from"./icon_back-c5ec0a72-1743496079034.js";import{P as T,T as k,b as I,c as N,i as x,a as A}from"./index-f6cdd761-1743496079034.js";import{i as B}from"./icon_default-d1bcaf5f-1743496079034.js";import{i as P}from"./icon_separator-e0f6c575-1743496079034.js";import{u as L,i as R,a as b,b as z}from"./useSpeak-f0fad1e8-1743496079034.js";import{d as F,a as W,u as E,e as f,a5 as D,J as U,q as M,f as t,x as O,b5 as q,b6 as y,w as h,k as r,j as G,a9 as j}from"./index-32ff339b-1743496079034.js";import{T as $}from"./index-f645f05d-1743496079034.js";import{e as V}from"./api-a4f14706-1743496079034.js";import{N as J}from"./Slider-6d04791b-1743496079034.js";const H="_container_1rt1w_1",K="_iconBack_1rt1w_6",Q="_separator_1rt1w_39",X="_wrap_1rt1w_44",Y="_wrapBottom_1rt1w_50",Z="_content_1rt1w_53",tt="_tools_1rt1w_60",et="_contentWrap_1rt1w_74",st="_musicList_1rt1w_82",it="_instrumentGroup_1rt1w_96",at="_instrumentImg_1rt1w_104",nt="_otherImg_1rt1w_110",ot="_instrumentName_1rt1w_117",lt="_instrumentTag_1rt1w_125",ct="_wrapList_1rt1w_130",rt="_titlec_1rt1w_140",ut="_icon2_1rt1w_150",_t="_empty_1rt1w_157",mt="_itemContainer_1rt1w_163",dt="_item_1rt1w_163",pt="_active_1rt1w_185",wt="_arrow_1rt1w_188",gt="_img_1rt1w_191",ft="_title_1rt1w_140",yt="_titleName_1rt1w_220",ht="_titleDes_1rt1w_227",St="_btn_1rt1w_237",vt="_showPlayLoading_1rt1w_261",Ct="_loadingWrap_1rt1w_264",Tt="_musicStaff_1rt1w_269",kt="_musicTitle_1rt1w_284",It="_musicTitleLeft_1rt1w_294",Nt="_icon1_1rt1w_298",xt="_icon3_1rt1w_299",At="_musicTitleRight_1rt1w_311",Bt="_textRead_1rt1w_311",Pt="_textClose_1rt1w_312",Lt="_icon_1rt1w_6",Rt="_musicContent_1rt1w_338",bt="_staffImgs_1rt1w_357",zt="_changeSizeSection_1rt1w_374",Ft="_iconT_1rt1w_387",Wt="_iconAddT_1rt1w_391",Et="_iconPlusT_1rt1w_392",Dt="_selectionCouser_1rt1w_419",Ut="_hide_1rt1w_424",Mt="_textStart_1rt1w_428",Ot="_textReadOnly_1rt1w_429",s={container:H,iconBack:K,separator:Q,wrap:X,wrapBottom:Y,content:Z,tools:tt,contentWrap:et,musicList:st,instrumentGroup:it,instrumentImg:at,otherImg:nt,instrumentName:ot,instrumentTag:lt,wrapList:ct,titlec:rt,icon2:ut,empty:_t,itemContainer:mt,item:dt,active:pt,arrow:wt,img:gt,title:ft,titleName:yt,titleDes:ht,btn:St,showPlayLoading:vt,loadingWrap:Ct,musicStaff:Tt,musicTitle:kt,musicTitleLeft:It,icon1:Nt,icon3:xt,musicTitleRight:At,textRead:Bt,textClose:Pt,icon:Lt,musicContent:Rt,staffImgs:bt,changeSizeSection:zt,iconT:Ft,iconAddT:Wt,iconPlusT:Et,selectionCouser:Dt,hide:Ut,textStart:Mt,textReadOnly:Ot},Xt=F({name:"instrument-detail",setup(){const d=W(),w=E(),n=L(),l=f({page:1,rows:20,status:!0,name:"",type:d.query.type}),e=f({loading:!1,finshed:!1,reshing:!1,details:{},list:[],listActive:0,playState:"pause",showPlayer:!1,showPreivew:!1,previewUrl:"",showCloseBtn:!0,fontSize:18});D(()=>e.playState,()=>{e.playState==="play"&&n.onCloseSpeak()});const S=U(()=>e.list[e.listActive]||{}),_=a=>{const i=e.list.findIndex(u=>u.id===a.id);i>-1&&(e.listActive===i?e.playState=e.playState==="play"?"pause":"play":e.playState="play",e.showPlayer=!0,e.listActive=i)},m=a=>{a==="play"?e.playState="play":a==="pause"?e.playState="pause":a==="pre"?e.list[e.listActive-1]&&_(e.list[e.listActive-1]):a==="next"&&e.list[e.listActive+1]&&_(e.list[e.listActive+1])},v=async()=>{var g;e.loading=!0;let a={};try{a=await V({id:d.query.id})}catch(c){console.log(c)}e.reshing&&(e.list=[],e.reshing=!1),e.finshed=!0,e.list=a.data.knowledgeWikiResources||[],e.list.forEach(c=>{c.audioFileUrl=c.url,c.musicSheetName=c.name});const i=a.data.knowledgeWikiCategories||[];a.data.knowledgeName=i.length>0?i[0].knowledgeWikiCategoryTypeName:"",a.data.intros=a.data.intros.replace(/<video/gi,'<video style="width: 100% !important;" controlslist="nodownload"');const o=new DOMParser().parseFromString(a.data.intros,"text/html"),p=document.createElement("div");p.classList.add("html-to-dom"),p.appendChild(n.processNode(o.body)),(g=document.querySelector("#musicContent"))==null||g.appendChild(p),e.details=a.data,e.loading=!1};return M(async()=>{v()}),()=>{var a;return t("div",{class:s.container},[t(O,{align:"center",wrapItem:!1,size:16},{default:()=>[t("img",{style:{cursor:"pointer"},src:C,class:s.iconBack,onClick:()=>{const i=l.type==="MUSICIAN"?"/content-musician":"/content-instruments";w.push({path:i})}},null),t(q,{separator:""},{default:()=>[t(y,{onClick:()=>{const i=l.type==="MUSICIAN"?"/content-musician":"/content-instruments";w.push({path:i})}},{default:()=>[l.type==="MUSICIAN"?"音乐家":"乐器百科"]}),t("img",{class:s.separator,src:P},null),t(y,null,{default:()=>[d.query.name]})]})]}),t("div",{class:[s.wrap,e.showPlayer?s.wrapBottom:""]},[t("div",{class:s.content},[t("div",{class:s.contentWrap},[t("div",{class:[s.musicList,"musicList-container"]},[t("div",{class:s.wrapList},[t("div",{class:s.instrumentGroup},[t(h,{class:[s.instrumentImg,l.type==="MUSICIAN"&&s.otherImg],src:(a=e.details)==null?void 0:a.avatar,objectFit:"cover"},null),t("p",{class:s.instrumentName},[e.details.name]),t("p",{class:s.instrumentTag},[e.details.knowledgeName])]),t("div",{class:s.titlec},[t("i",{class:s.icon2},null),r("代表作")]),e.list.map((i,u)=>t("div",{class:s.itemContainer},[t("div",{class:[s.item],onClick:o=>{o.stopPropagation(),_(i)}},[t("div",{class:s.img},[t(h,{lazy:!0,objectFit:"cover",previewDisabled:!0,src:i.titleImg||B,onLoad:o=>{o.target.dataset.loaded="true"}},null),t(T,{class:[e.listActive===u&&e.playState==="play"?"":s.showPlayLoading]},null)]),t("div",{class:s.title},[t("div",{class:s.titleName},[t(k,{text:i.name,style:{marginRight:"12px"}},null)])]),t(G,{color:"#259CFE",textColor:"#fff",round:!0,class:s.btn,type:"primary",onClick:o=>{o.stopPropagation(),_(i)}},{default:()=>[r("播放"),t("img",{src:e.listActive===u&&e.playState==="play"?I:N},null)]}),t("img",{class:s.arrow,src:x},null)])])),!e.finshed&&t("div",{class:s.loadingWrap},[t(j,{show:!0},null)]),!e.loading&&e.list.length===0&&t("div",{class:s.empty},[t($,{description:"暂无代表作"},null)])])]),t("div",{class:s.musicStaff},[t("div",{class:s.musicTitle},[t("div",{class:s.musicTitleLeft},[t("i",{class:l.type==="MUSICIAN"?s.icon3:s.icon1},null),l.type==="MUSICIAN"?"个人简介":"乐器简介"]),t("div",{class:s.musicTitleRight},[n.isSpeak.value?t("span",{class:s.textClose,onClick:n.onCloseSpeak},[t("i",{class:s.icon},null),r("关闭朗读")]):t("span",{class:s.textRead,onClick:()=>{n.onAllSpeak(),m("pause")}},[t("i",{class:s.icon},null),r("全文朗读")])])]),t("div",{class:[s.musicContent],id:"musicContent",style:{fontSize:e.fontSize+"px"}},[t("div",{id:"selectionCouser",class:[s.selectionCouser,!n.showDom.value&&s.hide]},[t("span",{class:s.textStart,onClick:()=>{n.onTextStart(),m("pause")}},[r("开始朗读"),t("i",{class:s.icon},null)]),t("span",{class:s.textReadOnly,onClick:()=>{n.onTextReadOnly(),m("pause")}},[r("只读这段"),t("i",{class:s.icon},null)])])])]),t("div",{class:s.changeSizeSection},[t("img",{src:R,class:s.iconT},null),t("img",{src:b,class:s.iconAddT,onClick:()=>{e.fontSize>=32||(e.fontSize+=1)}},null),t(J,{value:e.fontSize,"onUpdate:value":i=>e.fontSize=i,placement:"left",vertical:!0,min:12,max:32},null),t("img",{src:z,class:s.iconPlusT,onClick:()=>{e.fontSize<=12||(e.fontSize-=1)}},null)])])])]),e.list.length!==0&&t(A,{show:e.showPlayer,playState:e.playState,item:S.value,onChange:i=>m(i),onShow:i=>{e.showPlayer=i}},null)])}}});export{Xt as default};
|