index-13ad0ba0-1731319840132.js 5.3 KB

1
  1. import{i as v}from"./icon_back-c5ec0a72-1731319840132.js";import{u as g,i as T,a as k,b as x}from"./useSpeak-f6847790-1731319840132.js";import{c as B,d as L}from"./api-70d4d585-1731319840132.js";import{T as f}from"./index-eedcb178-1731319840132.js";import{d as D,u as R,r as p,e as b,q as z,f as t,x as A,aS as K,aT as I,k as d,E as h}from"./index-6198d9d3-1731319840132.js";import{N as E}from"./Slider-25b157fd-1731319840132.js";const P="_container_136sw_1",N="_iconBack_136sw_6",F="_separator_136sw_43",O="_wrap_136sw_48",W="_wrapBottom_136sw_54",$="_contentWrap_136sw_57",q="_content_136sw_57",M="_scrollBar_136sw_74",U="_empty_136sw_78",V="_directoryList_136sw_83",H="_treeParent_136sw_96",j="_treeChild_136sw_99",G="_treeItem_136sw_102",J="_childItem_136sw_111",Q="_title_136sw_111",X="_dir_136sw_83",Y="_titleSelect_136sw_133",Z="_arrow_136sw_141",ee="_arrowSelect_136sw_148",te="_childArrow_136sw_152",se="_childSelect_136sw_162",le="_musicStaff_136sw_169",ce="_musicTitle_136sw_192",ae="_musicContent_136sw_200",ne="_musicTitleRight_136sw_216",oe="_textRead_136sw_222",ie="_textClose_136sw_223",re="_icon_136sw_6",de="_changeSizeSection_136sw_249",ue="_iconT_136sw_262",_e="_iconAddT_136sw_266",we="_iconPlusT_136sw_267",pe="_selectionCouser_136sw_294",me="_hide_136sw_299",Se="_textStart_136sw_303",fe="_textReadOnly_136sw_304",e={container:P,iconBack:N,separator:F,wrap:O,wrapBottom:W,contentWrap:$,content:q,scrollBar:M,empty:U,directoryList:V,treeParent:H,treeChild:j,treeItem:G,childItem:J,title:Q,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:we,selectionCouser:pe,hide:me,textStart:Se,textReadOnly:fe},ke=D({name:"cotnent-knowledge",setup(){const C=R(),i=p(!1),o=p(!1),a=g(),m=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 w=c.body.childNodes;w==null||w.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:()=>{C.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(h,{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(),m.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(h,{show:o.value,ref:m,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: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};