index-22d0dff6-1734950731618.js 5.4 KB

1
  1. import{i as g}from"./icon_back-c5ec0a72-1734950731618.js";import{u as T,i as k,a as x,b as B}from"./useSpeak-591a8844-1734950731618.js";import{c as L,d as D}from"./api-9f0dec79-1734950731618.js";import{T as f}from"./index-043f1db0-1734950731618.js";import{d as R,u as b,r as p,e as z,q as A,f as t,x as K,aS as E,aT as I,k as d,E as C}from"./index-efb66432-1734950731618.js";import{N as P}from"./Slider-f8e18c57-1734950731618.js";const N="_container_136sw_1",F="_iconBack_136sw_6",O="_separator_136sw_43",W="_wrap_136sw_48",$="_wrapBottom_136sw_54",q="_contentWrap_136sw_57",M="_content_136sw_57",U="_scrollBar_136sw_74",V="_empty_136sw_78",H="_directoryList_136sw_83",j="_treeParent_136sw_96",G="_treeChild_136sw_99",J="_treeItem_136sw_102",Q="_childItem_136sw_111",X="_title_136sw_111",Y="_dir_136sw_83",Z="_titleSelect_136sw_133",ee="_arrow_136sw_141",te="_arrowSelect_136sw_148",se="_childArrow_136sw_152",le="_childSelect_136sw_162",ce="_musicStaff_136sw_169",ae="_musicTitle_136sw_192",ne="_musicContent_136sw_200",oe="_musicTitleRight_136sw_216",ie="_textRead_136sw_222",re="_textClose_136sw_223",de="_icon_136sw_6",ue="_changeSizeSection_136sw_249",_e="_iconT_136sw_262",we="_iconAddT_136sw_266",me="_iconPlusT_136sw_267",pe="_selectionCouser_136sw_294",he="_hide_136sw_299",Se="_textStart_136sw_303",fe="_textReadOnly_136sw_304",e={container:N,iconBack:F,separator:O,wrap:W,wrapBottom:$,contentWrap:q,content:M,scrollBar:U,empty:V,directoryList:H,treeParent:j,treeChild:G,treeItem:J,childItem:Q,title:X,dir:Y,titleSelect:Z,arrow:ee,arrowSelect:te,childArrow:se,childSelect:le,musicStaff:ce,musicTitle:ae,musicContent:ne,musicTitleRight:oe,textRead:ie,textClose:re,icon:de,changeSizeSection:ue,iconT:_e,iconAddT:we,iconPlusT:me,selectionCouser:pe,hide:he,textStart:Se,textReadOnly:fe},xe=R({name:"cotnent-knowledge",setup(){const y=b(),i=p(!1),o=p(!1),a=T(),h=p(),l=z({fontSize:18,tableList:[],selectKey:null,details:{}}),v=async()=>{i.value=!0,o.value=!0;try{const{data:n}=await L({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 D({id:l.selectKey}),c=new DOMParser().parseFromString(s.desc,"text/html"),_=document.querySelectorAll(".only-child-select");_.length>0&&_.forEach(r=>{r.remove()});const w=c.body.childNodes;w==null||w.forEach(r=>{r==null||r.classList.add("only-child-select")});const m=document.createElement("div");m.classList.add("html-to-dom"),m.appendChild(a.processNode(c.body)),(n=document.querySelector("#musicContent"))==null||n.appendChild(m),l.details=s}catch(s){}o.value=!1};return A(()=>{v()}),()=>{var n;return t("div",{class:e.container},[t(K,{align:"center",wrapItem:!1,size:16},{default:()=>[t("img",{style:{cursor:"pointer"},src:g,class:e.iconBack,onClick:()=>{y.push("/")}},null),t(E,{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(),h.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(f,{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:h,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(f,null,null)]}})]),t("div",{class:e.changeSizeSection},[t("img",{src:k,class:e.iconT},null),t("img",{src:x,class:e.iconAddT,onClick:()=>{l.fontSize>=32||(l.fontSize+=1)}},null),t(P,{value:l.fontSize,"onUpdate:value":s=>l.fontSize=s,vertical:!0,min:12,max:32},null),t("img",{src:B,class:e.iconPlusT,onClick:()=>{l.fontSize<=12||(l.fontSize-=1)}},null)])])])])])}}});export{xe as default};