1 |
- import{i as v}from"./icon_back-c5ec0a72-1725962701482.js";import{u as g,i as T,a as k,b as x}from"./useSpeak-d0bb08b8-1725962701482.js";import{c as B,d as L}from"./api-95647aa3-1725962701482.js";import{T as h}from"./index-b03328a0-1725962701482.js";import{d as D,u as R,r as p,e as b,q as z,f as t,x as A,aP as K,aQ as I,k as d,E as C}from"./index-8151123c-1725962701482.js";import{N as E}from"./Slider-3d2a3287-1725962701482.js";const P="_container_12d7m_1",N="_iconBack_12d7m_6",F="_separator_12d7m_39",O="_wrap_12d7m_44",W="_wrapBottom_12d7m_50",$="_contentWrap_12d7m_53",q="_content_12d7m_53",M="_scrollBar_12d7m_70",U="_empty_12d7m_74",V="_directoryList_12d7m_79",H="_treeParent_12d7m_92",Q="_treeChild_12d7m_95",j="_treeItem_12d7m_98",G="_childItem_12d7m_107",J="_title_12d7m_107",X="_dir_12d7m_79",Y="_titleSelect_12d7m_129",Z="_arrow_12d7m_137",ee="_arrowSelect_12d7m_144",te="_childArrow_12d7m_148",se="_childSelect_12d7m_158",le="_musicStaff_12d7m_165",ce="_musicTitle_12d7m_188",ae="_musicContent_12d7m_196",ne="_musicTitleRight_12d7m_209",oe="_textRead_12d7m_215",ie="_textClose_12d7m_216",re="_icon_12d7m_6",de="_changeSizeSection_12d7m_242",ue="_iconT_12d7m_255",_e="_iconAddT_12d7m_259",me="_iconPlusT_12d7m_260",pe="_selectionCouser_12d7m_287",fe="_hide_12d7m_292",Se="_textStart_12d7m_296",he="_textReadOnly_12d7m_297",e={container:P,iconBack:N,separator:F,wrap:O,wrapBottom:W,contentWrap:$,content:q,scrollBar:M,empty:U,directoryList:V,treeParent:H,treeChild:Q,treeItem:j,childItem:G,title:J,dir:X,titleSelect:Y,arrow:Z,arrowSelect:ee,childArrow:te,childSelect:se,musicStaff:le,musicTitle:ce,musicContent:ae,musicTitleRight:ne,textRead:oe,textClose:ie,icon:re,changeSizeSection:de,iconT:ue,iconAddT:_e,iconPlusT:me,selectionCouser:pe,hide:fe,textStart:Se,textReadOnly:he},ke=D({name:"cotnent-knowledge",setup(){const w=R(),i=p(!1),o=p(!1),a=g(),f=p(),l=b({fontSize:18,tableList:[],selectKey:null,details:{}}),y=async()=>{i.value=!0,o.value=!0;try{const{data:n}=await B({type:"COURSEWARE"});if(l.tableList=n||[],l.tableList.length){const s=l.tableList[0].lessonCoursewareDetailKnowledgeDetailList;if(l.tableList[0].selected=!0,s&&s.length){const u=s[0];l.selectKey=u.id,await S()}}}catch(n){}o.value=!1,i.value=!1},S=async()=>{var n;o.value=!0;try{const{data:s}=await L({id:l.selectKey}),c=new DOMParser().parseFromString(s.desc,"text/html"),_=document.querySelectorAll(".only-child-select");_.length>0&&_.forEach(r=>{r.remove()});const m=c.body.childNodes;m==null||m.forEach(r=>{r==null||r.classList.add("only-child-select")}),(n=document.querySelector("#musicContent"))==null||n.appendChild(a.processNode(c.body)),l.details=s}catch(s){}o.value=!1};return z(()=>{y()}),()=>{var n;return t("div",{class:e.container},[t(A,{align:"center",wrapItem:!1,size:16},{default:()=>[t("img",{style:{cursor:"pointer"},src:v,class:e.iconBack,onClick:()=>{w.push("/")}},null),t(K,{separator:""},{default:()=>[t(I,{onClick:()=>{}},{default:()=>[d("乐理知识")]})]})]}),t("div",{class:[e.wrap]},[t("div",{class:e.content},[t("div",{class:e.contentWrap},[t("div",{class:e.directoryList},[t("div",{class:[e.scrollBar,!i.value&&l.tableList.length<=0?e.empty:""],style:{minHeight:"100%"}},[t(C,{show:i.value},{default:()=>[t("div",{class:[e.listSection]},[l.tableList.map((s,u)=>t("div",{class:e.treeParent,key:"parent"+u},[t("div",{class:[e.treeItem,e.parentItem],onClick:()=>{l.tableList.forEach(c=>{s.id!==c.id&&(c.selected=!1)}),s.selected=!s.selected}},[s.lessonCoursewareDetailKnowledgeDetailList&&s.lessonCoursewareDetailKnowledgeDetailList.length>0&&t("span",{class:[e.arrow,s.selected?e.arrowSelect:""]},null),t("p",{class:[e.title,s.selected?e.titleSelect:""]},[t("span",{class:[e.dir,s.selected?e.dirSelect:""]},null),s.name])]),s.selected&&s.lessonCoursewareDetailKnowledgeDetailList&&s.lessonCoursewareDetailKnowledgeDetailList.map((c,_)=>t("div",{key:"child"+_,class:[e.treeItem,e.childItem,e.animation,l.selectKey===c.id?e.childSelect:""],onClick:()=>{l.selectKey!==c.id&&(l.selectKey=c.id,S(),a.onCloseSpeak(),f.value.$el.scrollTo(0,0))}},[t("span",{class:e.childArrow},null),t("p",{class:e.title},[c.name])]))]))])]}),!i.value&&l.tableList.length<=0&&t(h,{style:{height:"100%"}},null)])]),t("div",{class:e.musicStaff},[t("div",{class:e.musicTitleRight},[a.isSpeak.value?t("span",{class:e.textClose,onClick:a.onCloseSpeak},[t("i",{class:e.icon},null),d("关闭朗读")]):t("span",{class:e.textRead,onClick:a.onAllSpeak},[t("i",{class:e.icon},null),d("全文朗读")])]),t(C,{show:o.value,ref:f,class:!o.value&&!((n=l.details)!=null&&n.desc)?e.empty:""},{default:()=>{var s;return[t("div",{class:e.musicContent,id:"musicContent",style:{fontSize:l.fontSize+"px"}},[t("div",{id:"selectionCouser",class:[e.selectionCouser,!a.showDom.value&&e.hide]},[t("span",{class:e.textStart,onClick:a.onTextStart},[d("开始朗读"),t("i",{class:e.icon},null)]),t("span",{class:e.textReadOnly,onClick:a.onTextReadOnly},[d("只读这段"),t("i",{class:e.icon},null)])])]),!o.value&&!((s=l.details)!=null&&s.desc)&&t(h,null,null)]}})]),t("div",{class:e.changeSizeSection},[t("img",{src:T,class:e.iconT},null),t("img",{src:k,class:e.iconAddT,onClick:()=>{l.fontSize>=32||(l.fontSize+=1)}},null),t(E,{value:l.fontSize,"onUpdate:value":s=>l.fontSize=s,vertical:!0,min:12,max:32},null),t("img",{src:x,class:e.iconPlusT,onClick:()=>{l.fontSize<=12||(l.fontSize-=1)}},null)])])])])])}}});export{ke as default};
|