detail-48c1e1a8-1734950731618.js 7.2 KB

1
  1. import{i as C}from"./icon_back-c5ec0a72-1734950731618.js";import{P as w,T,b as k,c as I,i as N,a as x}from"./index-b40f8126-1734950731618.js";import{i as A}from"./icon_default-d1bcaf5f-1734950731618.js";import{i as B}from"./icon_separator-e0f6c575-1734950731618.js";import{u as P,i as L,a as R,b as z}from"./useSpeak-591a8844-1734950731618.js";import{d as b,a as E,u as F,e as y,A as W,U as D,q as U,f as t,x as M,aS as O,aT as h,w as S,k as r,j as G,E as j}from"./index-efb66432-1734950731618.js";import{T as $}from"./index-043f1db0-1734950731618.js";import{e as V}from"./api-9f0dec79-1734950731618.js";import{N as H}from"./Slider-f8e18c57-1734950731618.js";const J="_container_dq20o_1",K="_iconBack_dq20o_6",Q="_separator_dq20o_43",X="_wrap_dq20o_48",Y="_wrapBottom_dq20o_54",Z="_content_dq20o_57",tt="_tools_dq20o_64",et="_contentWrap_dq20o_78",st="_musicList_dq20o_86",ot="_instrumentGroup_dq20o_100",it="_instrumentImg_dq20o_108",at="_otherImg_dq20o_114",nt="_instrumentName_dq20o_121",lt="_instrumentTag_dq20o_129",ct="_wrapList_dq20o_134",rt="_titlec_dq20o_144",dt="_icon2_dq20o_154",ut="_empty_dq20o_161",_t="_itemContainer_dq20o_167",mt="_item_dq20o_167",pt="_active_dq20o_189",gt="_arrow_dq20o_192",ft="_img_dq20o_195",yt="_title_dq20o_144",ht="_titleName_dq20o_224",St="_titleDes_dq20o_231",qt="_btn_dq20o_241",vt="_showPlayLoading_dq20o_265",Ct="_loadingWrap_dq20o_268",wt="_musicStaff_dq20o_273",Tt="_musicTitle_dq20o_288",kt="_musicTitleLeft_dq20o_298",It="_icon1_dq20o_302",Nt="_icon3_dq20o_303",xt="_musicTitleRight_dq20o_315",At="_textRead_dq20o_315",Bt="_textClose_dq20o_316",Pt="_icon_dq20o_6",Lt="_musicContent_dq20o_342",Rt="_staffImgs_dq20o_361",zt="_changeSizeSection_dq20o_378",bt="_iconT_dq20o_391",Et="_iconAddT_dq20o_395",Ft="_iconPlusT_dq20o_396",Wt="_selectionCouser_dq20o_423",Dt="_hide_dq20o_428",Ut="_textStart_dq20o_432",Mt="_textReadOnly_dq20o_433",s={container:J,iconBack:K,separator:Q,wrap:X,wrapBottom:Y,content:Z,tools:tt,contentWrap:et,musicList:st,instrumentGroup:ot,instrumentImg:it,otherImg:at,instrumentName:nt,instrumentTag:lt,wrapList:ct,titlec:rt,icon2:dt,empty:ut,itemContainer:_t,item:mt,active:pt,arrow:gt,img:ft,title:yt,titleName:ht,titleDes:St,btn:qt,showPlayLoading:vt,loadingWrap:Ct,musicStaff:wt,musicTitle:Tt,musicTitleLeft:kt,icon1:It,icon3:Nt,musicTitleRight:xt,textRead:At,textClose:Bt,icon:Pt,musicContent:Lt,staffImgs:Rt,changeSizeSection:zt,iconT:bt,iconAddT:Et,iconPlusT:Ft,selectionCouser:Wt,hide:Dt,textStart:Ut,textReadOnly:Mt},Xt=b({name:"instrument-detail",setup(){const m=E(),g=F(),a=P(),l=y({page:1,rows:20,status:!0,name:"",type:m.query.type}),e=y({loading:!1,finshed:!1,reshing:!1,details:{},list:[],listActive:0,playState:"pause",showPlayer:!1,showPreivew:!1,previewUrl:"",showCloseBtn:!0,fontSize:18});W(()=>e.playState,()=>{e.playState==="play"&&a.onCloseSpeak()});const q=D(()=>e.list[e.listActive]||{}),u=i=>{const o=e.list.findIndex(d=>d.id===i.id);o>-1&&(e.listActive===o?e.playState=e.playState==="play"?"pause":"play":e.playState="play",e.showPlayer=!0,e.listActive=o)},_=i=>{i==="play"?e.playState="play":i==="pause"?e.playState="pause":i==="pre"?e.list[e.listActive-1]&&u(e.list[e.listActive-1]):i==="next"&&e.list[e.listActive+1]&&u(e.list[e.listActive+1])},v=async()=>{var f;e.loading=!0;let i={};try{i=await V({id:m.query.id})}catch(c){console.log(c)}e.reshing&&(e.list=[],e.reshing=!1),e.finshed=!0,e.list=i.data.knowledgeWikiResources||[],e.list.forEach(c=>{c.audioFileUrl=c.url,c.musicSheetName=c.name});const o=i.data.knowledgeWikiCategories||[];i.data.knowledgeName=o.length>0?o[0].knowledgeWikiCategoryTypeName:"",i.data.intros=i.data.intros.replace(/<video/gi,'<video style="width: 100% !important;" controlslist="nodownload"');const n=new DOMParser().parseFromString(i.data.intros,"text/html"),p=document.createElement("div");p.classList.add("html-to-dom"),p.appendChild(a.processNode(n.body)),(f=document.querySelector("#musicContent"))==null||f.appendChild(p),e.details=i.data,e.loading=!1};return U(async()=>{v()}),()=>{var i;return t("div",{class:s.container},[t(M,{align:"center",wrapItem:!1,size:16},{default:()=>[t("img",{style:{cursor:"pointer"},src:C,class:s.iconBack,onClick:()=>{const o=l.type==="MUSICIAN"?"/content-musician":"/content-instruments";g.push({path:o})}},null),t(O,{separator:""},{default:()=>[t(h,{onClick:()=>{const o=l.type==="MUSICIAN"?"/content-musician":"/content-instruments";g.push({path:o})}},{default:()=>[l.type==="MUSICIAN"?"音乐家":"乐器百科"]}),t("img",{class:s.separator,src:B},null),t(h,null,{default:()=>[m.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(S,{class:[s.instrumentImg,l.type==="MUSICIAN"&&s.otherImg],src:(i=e.details)==null?void 0:i.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((o,d)=>t("div",{class:s.itemContainer},[t("div",{class:[s.item],onClick:n=>{n.stopPropagation(),u(o)}},[t("div",{class:s.img},[t(S,{lazy:!0,objectFit:"cover",previewDisabled:!0,src:o.titleImg||A,onLoad:n=>{n.target.dataset.loaded="true"}},null),t(w,{class:[e.listActive===d&&e.playState==="play"?"":s.showPlayLoading]},null)]),t("div",{class:s.title},[t("div",{class:s.titleName},[t(T,{text:o.name,style:{marginRight:"12px"}},null)])]),t(G,{color:"#259CFE",textColor:"#fff",round:!0,class:s.btn,type:"primary",onClick:n=>{n.stopPropagation(),u(o)}},{default:()=>[r("播放"),t("img",{src:e.listActive===d&&e.playState==="play"?k:I},null)]}),t("img",{class:s.arrow,src:N},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},[a.isSpeak.value?t("span",{class:s.textClose,onClick:a.onCloseSpeak},[t("i",{class:s.icon},null),r("关闭朗读")]):t("span",{class:s.textRead,onClick:()=>{a.onAllSpeak(),_("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,!a.showDom.value&&s.hide]},[t("span",{class:s.textStart,onClick:()=>{a.onTextStart(),_("pause")}},[r("开始朗读"),t("i",{class:s.icon},null)]),t("span",{class:s.textReadOnly,onClick:()=>{a.onTextReadOnly(),_("pause")}},[r("只读这段"),t("i",{class:s.icon},null)])])])]),t("div",{class:s.changeSizeSection},[t("img",{src:L,class:s.iconT},null),t("img",{src:R,class:s.iconAddT,onClick:()=>{e.fontSize>=32||(e.fontSize+=1)}},null),t(H,{value:e.fontSize,"onUpdate:value":o=>e.fontSize=o,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(x,{show:e.showPlayer,playState:e.playState,item:q.value,onChange:o=>_(o),onShow:o=>{e.showPlayer=o}},null)])}}});export{Xt as default};