1 |
- import{i as _e,C as z,a as ae,b as fe,c as Ue,d as Ae,e as Ge}from"./isCollaose-e08ab26c.js";import{P as se}from"./index-6373e63a.js";import{i as $e,A as Be,m as le,f as oe,a as De,b as je,c as Me,d as we}from"./index-ffbc9d6f.js";import{T as ne}from"./index-0224b3e0.js";import{r as ie}from"./searchArray-28951398.js";import{u as J}from"./catchData-ed74c53e.js";import{d as D,e as B,r as _,n as N,f as e,v as $,j as x,k as b,N as q,g as P,y as H,b3 as ce,L as F,a2 as ue,a3 as re,a4 as de,F as U,A as Q,w as ke,t as W,b as X,x as ge,di as Ne,dj as V,P as Pe,_ as Oe,dk as Ve,h as he,J as me,C as Ce,dl as ze,m as Ie,p as He,q as Z}from"./index-ed98db36.js";import{T as pe}from"./index-a6b6ac0b.js";import{g as K,s as C}from"./index-6dd6a41d.js";import{C as We,p as ee,a as ye}from"./index-3ef56cd2.js";import{N as Ke}from"./Scrollbar-f3aa24c4.js";import"./icon-collect-active-cbdaa75d.js";import"./index-592512c7.js";import"./searchs-1f038725.js";import"./contants-e12e4ed1.js";const Je="_listWrap_sirzm_1",qe="_list_sirzm_1",Qe="_searchGroup_sirzm_46",Xe="_btnType_sirzm_50",Ye="_inputSearch_sirzm_84",Ze="_searchCatatory_sirzm_103",et="_addTrain_sirzm_110",te={listWrap:Je,list:qe,searchGroup:Qe,btnType:Xe,inputSearch:Ye,searchCatatory:Ze,addTrain:et},tt="_list_1ryw9_1",at="_searchGroup_1ryw9_9",st="_btnType_1ryw9_13",lt="_inputSearch_1ryw9_48",ot="_searchCatatory_1ryw9_72",nt="_addTrain_1ryw9_79",it="_teachingModal_1ryw9_91",ct="_spaceSection_1ryw9_94",ut="_collapseWrap_1ryw9_101",rt="_collaoseBtn_1ryw9_107",dt="_isStart_1ryw9_112",pt="_collapsSection_1ryw9_115",ft="_isHidden_1ryw9_118",L={list:tt,searchGroup:at,btnType:st,inputSearch:lt,searchCatatory:ot,addTrain:nt,teachingModal:it,spaceSection:ct,collapseWrap:ut,collaoseBtn:rt,isStart:dt,collapsSection:pt,isHidden:ft};function be(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!ce(o)}const gt=D({name:"search-group",emits:["search","add"],setup(o,{emit:l}){const t=J(),u=B({type:"MUSIC",name:"",bookVersionId:null,subjectId:null}),d=()=>{l("search",u)},n=_(),c=_([]),g=_(0),s=_(0),a=_(0),r=_(!1),p=i=>{i!=null&&i.selfElRef&&c.value.push(i.selfElRef.parentNode)},f=i=>{r.value=i,m()},m=()=>{c.value=[...new Set(c.value)];let i=-1;c.value.forEach((h,y)=>{y===0?(a.value=1,i=h.offsetLeft):h.offsetLeft===i&&y!=0&&a.value++,r.value?h.style.display="block":a.value>1?h.style.display="none":h.style.display="block"})};return N(async()=>{await t.getMusicSheetCategory(),await t.getSubjects(),g.value=n.value.offsetHeight,s.value=n.value.offsetHeight/a.value,m()}),()=>{let i,h;return e("div",{class:L.searchGroup},[e("div",{class:[L.searchCatatory]},[e($,{size:"small",class:L.btnType},be(i=ie.map(y=>e(x,{type:u.type===y.value?"primary":"default",secondary:u.type!==y.value,round:!0,size:"small",focusable:!1,onClick:()=>{u.type=y.value,d()}},{default:()=>[y.label]})))?i:{default:()=>[i]}),e(x,{type:"primary",class:L.addTrain,focusable:!1,strong:!0,onClick:()=>l("add")},{default:()=>[e("img",{src:$e},null),b("添加自定义教材")]})]),e(q,{labelAlign:"left",labelPlacement:"left"},{default:()=>[u.type==="MUSIC"&&e("div",{class:[L.collapsSection]},[e(P,{label:"教材:"},{default:()=>[e("div",{class:[L.collapseWrap,r.value?"":L.isHidden],ref:n},[e($,{class:[L.spaceSection]},{default:()=>[t.getAllMusicCategories.map(y=>e(x,{ref:p,secondary:u.bookVersionId===y.id,quaternary:u.bookVersionId!==y.id,strong:!0,focusable:!1,type:u.bookVersionId===y.id?"primary":"default",onClick:()=>{u.bookVersionId=y.id,d()}},{default:()=>[y.name]})),a.value>1&&e("div",{style:{height:"var(--n-blank-height)",position:"absolute",display:"flex",alignItems:"center"},onClick:()=>{f(!r.value)}},[e(H,{previewDisabled:!0,src:_e,class:[L.collaoseBtn,r.value?L.isStart:""]},null)])]})])]})]),e(P,{label:"乐器:"},{default:()=>[e($,{class:L.spaceSection},be(h=t.getSubjectAllList.map(y=>e(x,{secondary:u.subjectId===y.id,quaternary:u.subjectId!==y.id,strong:!0,focusable:!1,type:u.subjectId===y.id?"primary":"default",onClick:()=>{u.subjectId=y.id,d()}},{default:()=>[y.name]})))?h:{default:()=>[h]})]}),e(ne,{class:L.inputSearch,round:!0,onSearch:y=>{u.name=y,d()}},null)]})])}}}),ht=D({name:"shareResources-guide",emits:["close"],setup(o,{emit:l}){const t=B({box:{height:"0px"},show:!1,steps:[{ele:"",eleRect:{},img:K("shareResources1.png"),handStyle:{top:"0.91rem"},imgStyle:{top:F(-4),left:F(-263),width:F(553),height:F(229)},btnsStyle:{bottom:F(30),left:F(-102)},eleRectPadding:{left:14,top:14,width:28,height:28},boxStyle:{borderRadius:"30px"}},{ele:"",img:K("shareResources2.png"),imgStyle:{left:F(134),width:F(515),height:F(227)},btnsStyle:{bottom:F(75),left:F(253)},eleRectPadding:{left:7,top:7,width:14,height:14},boxStyle:{borderRadius:"15px"},type:"bottom"}],step:0}),u=_(!1),d=localStorage.getItem("teacher-guideInfo");d&&JSON.parse(d).shareResourcesGuide?u.value=!1:u.value=!0;const n=()=>{var r,p,f,m;const a=document.getElementById("shareResources-".concat(t.step));if(a){const i=a.getBoundingClientRect(),h=((r=t.steps[t.step].eleRectPadding)==null?void 0:r.left)||0,y=((p=t.steps[t.step].eleRectPadding)==null?void 0:p.top)||0,v=((f=t.steps[t.step].eleRectPadding)==null?void 0:f.width)||0,O=((m=t.steps[t.step].eleRectPadding)==null?void 0:m.height)||0;"shareResources-".concat(t.step)=="shareResources-1"?(t.box={left:i.x-h+"px",top:i.y-y+"px",width:(i.width+v)*2+v+"px",height:i.height+O+"px"},console.log(t.box.width,"---",i.width)):t.box={left:i.x-h+"px",top:i.y-y+"px",width:i.width+v+"px",height:i.height+O+"px"},console.log("coai-".concat(t.step),t.box)}else g()};N(()=>{n(),window.addEventListener("resize",c)});const c=()=>{n()};ue(()=>{window.removeEventListener("resize",c)});const g=()=>{if(t.step>=4){s();return}t.step=t.step+1,n()},s=()=>{let a=JSON.parse(localStorage.getItem("teacher-guideInfo")||"{}")||null;a?a.shareResourcesGuide=!0:a={shareResourcesGuide:!0},localStorage.setItem("teacher-guideInfo",JSON.stringify(a)),u.value=!1};return()=>e(U,null,[u.value?re(e("div",{"onUpdate:show":a=>u.value=a,class:["n-modal-mask","n-modal-mask-guide"]},[e("div",{class:C.content,onClick:()=>g()},[e("div",{class:C.backBtn,onClick:a=>{a.stopPropagation(),s()}},[b("跳过")]),e("div",{class:C.box,style:{...t.box,...t.steps[t.step].boxStyle},id:"modeType-".concat(t.step)},[t.steps.map((a,r)=>{var p,f,m,i;return e("div",{onClick:h=>h.stopPropagation(),class:C.item,style:a.type=="bottom"?{display:r===t.step?"":"none",left:"".concat((p=a.eleRect)==null?void 0:p.left,"px"),top:"-".concat((f=a.imgStyle)==null?void 0:f.height)}:{display:r===t.step?"":"none",left:"".concat((m=a.eleRect)==null?void 0:m.left,"px"),top:"".concat((i=t.box)==null?void 0:i.height)}},[e("img",{class:C.img,style:a.imgStyle,src:a.img},null),e("div",{class:C.btns,style:a.btnsStyle},[t.step+1==t.steps.length?e(U,null,[e("div",{class:[C.endBtn],onClick:()=>s()},[b("完成")]),e("div",{class:C.nextBtn,onClick:()=>{t.step=0,n()}},[b("再看一遍")])]):e("div",{class:C.btn,onClick:()=>g()},[b("下一步 ("),t.step+1,b("/"),t.steps.length,b(")")])])])})])])]),[[de,u.value,"show"]]):null])}}),mt=D({name:"share-resources",setup(){const o=B({searchWord:"",loading:!1,pageTotal:0,pagination:{page:1,rows:20},searchGroup:{type:"MUSIC",name:"",bookVersionId:null,subjectId:null,sourceType:2},tableList:[],teachingStatus:!1,show:!1,item:{}}),l=_(!1),t=async()=>{try{o.loading=!0;const{data:n}=await le({...o.searchGroup,...o.pagination});o.loading=!1,o.pageTotal=Number(n.total);const c=n.rows||[],g=[];c.forEach(s=>{g.push({id:s.id,coverImg:s.coverImg,type:s.type,title:s.name,isCollect:!!s.favoriteFlag,isSelected:s.sourceFrom==="PLATFORM",content:s.content})}),o.tableList=g||[],setTimeout(()=>{l.value=!0},500)}catch(n){o.loading=!1}},u=async n=>{o.pagination.page=1,o.searchGroup=Object.assign(o.searchGroup,n),t()},d=async n=>{try{await oe({materialId:n.id,favoriteFlag:n.isCollect?0:1,type:n.type}),n.isCollect=!n.isCollect}catch(c){}};return N(()=>{t()}),()=>e(U,null,[e(gt,{onSearch:n=>u(n),onAdd:()=>o.teachingStatus=!0},null),e(Q,{show:o.loading,"onUpdate:show":n=>o.loading=n,style:{"min-height":"50vh"}},{default:()=>[e("div",{class:L.list},[o.tableList.map((n,c)=>e(U,null,[c==0?e(z,ke({id:"shareResources-1"},{item:n,disabledMouseHover:!1,onClick:g=>{g.type!=="IMG"&&(o.show=!0,o.item=g)},onCollect:g=>d(g)}),null):e(z,{item:n,disabledMouseHover:!1,onClick:g=>{g.type!=="IMG"&&(o.show=!0,o.item=g)},onCollect:g=>d(g)},null)])),!o.loading&&o.tableList.length<=0&&e(pe,{description:"暂无共享资源"},null)])]}),e(se,{page:o.pagination.page,"onUpdate:page":n=>o.pagination.page=n,pageSize:o.pagination.rows,"onUpdate:pageSize":n=>o.pagination.rows=n,pageTotal:o.pageTotal,"onUpdate:pageTotal":n=>o.pageTotal=n,onList:t},null),e(ae,{show:o.show,"onUpdate:show":n=>o.show=n,item:o.item},null),e(W,{show:o.teachingStatus,"onUpdate:show":n=>o.teachingStatus=n,preset:"card",showIcon:!1,class:["modalTitle background",L.teachingModal],title:"自定义教材",blockScroll:!1},{default:()=>[e(Be,{onClose:()=>o.teachingStatus=!1},null)]}),l.value?e(ht,null,null):null])}}),yt="_list_l11tk_1",bt="_searchGroup_l11tk_8",vt="_btnType_l11tk_12",St="_inputSearch_l11tk_47",_t="_searchCatatory_l11tk_71",wt="_addTrain_l11tk_79",kt="_error_l11tk_86",Ct="_iconUpload_l11tk_93",It="_iconEdit_l11tk_97",Ft="_iconSelectAll_l11tk_101",Tt="_iconDelete_l11tk_105",Rt="_iconPen_l11tk_109",xt="_itemSection_l11tk_113",Et="_itemBg_l11tk_116",Lt="_itemBgChecked_l11tk_125",Ut="_resourceDefault_l11tk_128",At="_spaceSection_l11tk_135",Gt="_attendClassModal_l11tk_141",$t="_removeVisiable_l11tk_147",Bt="_studentRemove_l11tk_150",Dt="_btnGroupModal_l11tk_162",k={list:yt,searchGroup:bt,btnType:vt,inputSearch:St,searchCatatory:_t,addTrain:wt,error:kt,iconUpload:Ct,iconEdit:It,iconSelectAll:Ft,iconDelete:Tt,iconPen:Rt,itemSection:xt,itemBg:Et,itemBgChecked:Lt,resourceDefault:Ut,spaceSection:At,attendClassModal:Gt,removeVisiable:$t,studentRemove:Bt,btnGroupModal:Dt},jt=""+new URL("icon-upload-f2c85ccb.svg",import.meta.url).href,Mt=""+new URL("icon-edit-d03e6631.svg",import.meta.url).href,Nt=""+new URL("icon-selectall-3ee6dc36.svg",import.meta.url).href,Pt=""+new URL("icon-selectall-default-60353fd8.svg",import.meta.url).href,Ot=""+new URL("icon-pen-51cdbe9d.svg",import.meta.url).href,Vt=""+new URL("icon-delete-9580edeb.svg",import.meta.url).href;function ve(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!ce(o)}const zt=D({name:"search-group",emits:["search","upload","edit","selectAll","delete","update"],setup(o,{emit:l}){const t=_([]),u=J(),d=B({type:"",name:"",bookVersionId:null,subjectId:null}),n=B({isEdit:!1,isSelectAll:!1}),c=()=>{l("search",d)};return N(async()=>{t.value=[{label:"全部",value:""},...ie],await u.getSubjects()}),()=>{let g,s;return e("div",{class:k.searchGroup},[e("div",{class:k.searchCatatory},[e($,{size:"small",class:k.btnType},ve(g=t.value.map(a=>a.value!=="MUSIC"&&e(x,{type:d.type===a.value?"primary":"default",secondary:d.type!==a.value,round:!0,size:"small",focusable:!1,onClick:()=>{d.type=a.value,c()}},{default:()=>[a.label]})))?g:{default:()=>[g]}),e($,null,{default:()=>[n.isEdit?e(U,null,[e(x,{type:"primary",class:k.addTrain,focusable:!1,strong:!0,onClick:()=>{n.isSelectAll=!n.isSelectAll,l("selectAll",n.isSelectAll)}},{default:()=>[e("img",{src:n.isSelectAll?Nt:Pt,class:k.iconSelectAll},null),b("全选")]}),e(x,{type:"error",class:[k.addTrain,k.error],focusable:!1,strong:!0,onClick:()=>l("delete")},{default:()=>[e("img",{src:Vt,class:k.iconDelete},null),b("删除")]}),e(x,{type:"primary",class:k.addTrain,focusable:!1,strong:!0,onClick:()=>l("update")},{default:()=>[e("img",{src:Ot,class:k.iconPen},null),b("修改")]}),e(x,{type:"primary",class:k.addTrain,focusable:!1,strong:!0,onClick:()=>{n.isEdit=!1,l("edit",n.isEdit)}},{default:()=>[b("完成编辑")]})]):e(U,null,[e(x,ke({type:"primary",class:k.addTrain,focusable:!1},{id:"myResources-0"},{strong:!0,onClick:()=>l("upload")}),{default:()=>[e("img",{src:jt,class:k.iconUpload},null),b("上传资源")]}),e(x,{type:"primary",class:k.addTrain,focusable:!1,strong:!0,onClick:()=>{n.isEdit=!0,l("edit",n.isEdit)}},{default:()=>[e("img",{src:Mt,class:k.iconEdit},null),b("编辑资源")]})])]})]),e(q,{labelAlign:"left",labelPlacement:"left"},{default:()=>[e(P,{label:"乐器:"},{default:()=>[e($,{class:k.spaceSection},ve(s=u.getSubjectAllList.map(a=>e(x,{secondary:d.subjectId===a.id,quaternary:d.subjectId!==a.id,strong:!0,focusable:!1,type:d.subjectId===a.id?"primary":"default",onClick:()=>{d.subjectId=a.id,c()}},{default:()=>[a.name]})))?s:{default:()=>[s]})]}),e(ne,{class:k.inputSearch,round:!0,onSearch:a=>{d.name=a,c()}},null)]})])}}}),Ht="_uploadModal_xk0km_1",Wt="_formModal_xk0km_4",Kt="_formSpace_xk0km_8",Jt="_previewModal_xk0km_11",qt="_image_xk0km_23",Qt="_titleType_xk0km_32",Xt="_iconUploadDelete_xk0km_40",Yt="_commonType_xk0km_49",Zt="_formItem_xk0km_72",ea="_btnGroup_xk0km_94",ta="_uploadFile_xk0km_101",aa="_uploadBtn_xk0km_104",sa="_iconUploadAdd_xk0km_121",E={uploadModal:Ht,formModal:Wt,formSpace:Kt,previewModal:Jt,image:qt,titleType:Qt,iconUploadDelete:Xt,commonType:Yt,formItem:Zt,btnGroup:ea,uploadFile:ta,uploadBtn:aa,iconUploadAdd:sa},la=""+new URL("icon-upload-add-2a8f7a9d.svg",import.meta.url).href,oa=D({name:"upload-file",props:{fileList:{type:String,default:""},imageList:{type:Array,default:()=>[]},accept:{type:String,default:".jpg,.png,.jpeg,.gif"},showType:{type:String,default:"default"},showFileList:{type:Boolean,default:!0},max:{type:Number,default:1},multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},bucketName:{type:String,default:"gyt"},path:{type:String,default:""},fileName:{type:String,default:""},cropper:{type:Boolean,default:!1},options:{type:Object,default:()=>({viewMode:0,autoCrop:!0,enlarge:1,autoCropWidth:200,autoCropHeight:200,fixedBox:!1,previewsCircle:!0,title:"上传图片"})}},emits:["update:fileList","close","readFileInputEventAsArrayBuffer","remove","finished"],setup(o,{emit:l,expose:t,slots:u}){const d="https://".concat(o.bucketName,".ks3-cn-beijing.ksyuncs.com/"),n=X(),c=_(!1),g=_(!1),s=_(),a=_(),r=B({policy:"",signature:"",key:"",KSSAccessKeyId:"",acl:"public-read",name:""}),p=_([]),f=()=>{if(o.fileList){const w=o.fileList.split("/");p.value=[{id:new Date().getTime().toString(),name:w[w.length-1],status:"finished",url:o.fileList}]}else p.value=[]};f(),ge(()=>o.imageList,()=>{f()}),ge(()=>o.fileList,()=>{f()}),t({handleClearFile:()=>{var w;(w=a.value)==null||w.clear()}});const i=_(),h=async w=>{const S=w.file;let I=!0;const T=S.type.includes("image")?V.IMG:S.type.includes("audio")?V.SONG:V.VIDEO,A=T==="IMG"?2:T==="SONG"?20:500;if(A&&(I=S.file.size/1024/1024<A,!I))return n.error("文件大小不能超过".concat(A,"M")),!1;if(!I)return I;if(o.cropper&&T==="IMG")return y(S.file,R=>{const M=Object.assign({},o.options,{img:R,name:S.file.name});c.value=!0,setTimeout(()=>{var j;(j=i.value)==null||j.edit(M)},100)}),!1;try{g.value=!0;const R=S.file.name,M=R.slice(R.lastIndexOf(".")),j="".concat(o.path).concat(o.fileName||Date.now()+M),Le={filename:j,bucketName:o.bucketName,postData:{filename:j,acl:"public-read",key:j,unknowValueField:[]}},{data:Y}=await ee(Le);r.policy=Y.policy,r.signature=Y.signature,r.key=j,r.KSSAccessKeyId=Y.kssAccessKeyId,r.name=j,s.value=S.file}catch(R){return g.value=!1,!1}return!0},y=async(w,S)=>{const I=new FileReader;I.addEventListener("load",()=>S(I.result)),I.readAsDataURL(w)},v=w=>{O(w)},O=async w=>{const S=d+r.key,I=Fe(S);let T="";I==="IMG"?T=S:I==="SONG"?T=Pe.SONG_DEFAULT_COVER:I==="VIDEO"&&(T=await Re()),l("update:fileList",S),l("readFileInputEventAsArrayBuffer",s.value),l("finished",{coverImg:T,content:S}),w.file.url=S,c.value=!1,g.value=!1},Te=w=>new Promise(S=>{const I=document.createElement("video");I.currentTime=1,I.src=URL.createObjectURL(w),I.addEventListener("loadeddata",function(){const T=document.createElement("canvas"),A=I.videoWidth,R=I.videoHeight;T.width=A,T.height=R,T.getContext("2d").drawImage(I,0,0,A,R),console.log(T),T.toBlob(M=>{console.log(M),S(M)})})}),Re=async()=>{try{g.value=!0;const w=await Te(s.value),S="".concat(o.path).concat(Date.now()+".png"),I={filename:S,bucketName:o.bucketName,postData:{filename:S,acl:"public-read",key:S,unknowValueField:[]}},{data:T}=await ee(I),A={policy:T.policy,signature:T.signature,key:S,acl:"public-read",KSSAccessKeyId:T.kssAccessKeyId,name:S},R=new FormData;for(const j in A)R.append(j,A[j]);return R.append("file",w),await ye.post(d,R),d+S}finally{g.value=!1}},xe=async()=>{l("update:fileList",""),l("remove"),g.value=!1},Ee=async w=>{try{const S="".concat(o.path).concat(o.fileName||new Date().getTime()+".png"),I={filename:S,bucketName:o.bucketName,postData:{filename:S,acl:"public-read",key:S,unknowValueField:[]}},{data:T}=await ee(I);r.policy=T.policy,r.signature=T.signature,r.key=S,r.KSSAccessKeyId=T.kssAccessKeyId,r.name=S;const A=new FormData;for(const R in r)A.append(R,r[R]);A.append("file",w),await ye.post(d,A).then(()=>{const R=d+r.key,M=R.split("/");p.value=[{id:new Date().getTime().toString(),name:M[M.length-1],status:"finished",url:R}],l("update:fileList",R),l("finished",{coverImg:R,content:R}),c.value=!1})}catch(S){return!1}};return()=>e("div",{class:E.uploadFile},[e(Q,{show:g.value,description:"上传中..."},{default:()=>[e(Ne,{ref:a,action:d,data:r,fileList:p.value,"onUpdate:fileList":w=>p.value=w,accept:o.accept,multiple:o.multiple,max:o.max,disabled:o.disabled,showFileList:o.showFileList,showPreviewButton:!0,onBeforeUpload:w=>h(w),onFinish:w=>v(w),onRemove:()=>xe()},{default:()=>[o.showType==="default"&&e("div",{class:E.uploadBtn},[e("img",{src:la,class:E.iconUploadAdd},null),e("p",null,[b("上传")])]),o.showType==="custom"&&u.custom&&u.custom()]})]}),e(W,{show:c.value,"onUpdate:show":w=>c.value=w,preset:"dialog",showIcon:!1,class:["modalTitle background"],title:"上传图片",style:{width:"800px"}},{default:()=>[e(We,{ref:i,onClose:()=>c.value=!1,onCropperOk:Ee},null)]})])}}),na=""+new URL("icon-upload-delete-cc3d5959.svg",import.meta.url).href,Fe=o=>o.indexOf(".mp3")>-1?V.SONG:o.indexOf(".mp4")>-1?V.VIDEO:V.IMG,ia=D({name:"upload-modal",props:{list:{type:Array,default:()=>[]}},emits:["close","confirm"],setup(o,{emit:l}){const t=J(),u=_(),d=X(),n=_(),c=B({list:[],uploading:!1,uploadUrl:"",name:"",subjectIds:[]}),g=f=>{let m=fe;switch(f){case"IMG":m=fe;break;case"VIDEO":m=Ge;break;case"SONG":m=Ae;break;case"MUSIC":m=Ue;break}return m},s=async()=>{var f;(f=u.value)==null||f.validate(async m=>{if(m){Ce(ze);return}c.uploading=!0;try{const i=[];c.list.forEach(h=>{i.push({subjectIds:h.subjectIds.join(","),openFlag:h.openFlag,coverImg:h.coverImg,name:h.name,type:h.type,enableFlag:1,content:h.content,id:h.id||null})}),r.value?await De(i):await je(i),c.list=[],d.success("保存成功"),l("close",!0),l("confirm")}catch(i){}c.uploading=!1})},a=f=>{c.list.splice(f,1)},r=Oe(()=>o.list.length>0);N(async()=>{const f=o.list||[],m=[];f.forEach(i=>{m.push({subjectIds:i.subjectId?i.subjectId.split(",").map(h=>Number(h)):[],openFlag:i.openFlag,coverImg:i.coverImg,name:i.title,type:i.type,enableFlag:i.enableFlag,content:i.content,id:i.id})}),c.list=m||[],await t.getSubjects()});const p=(f,m)=>{f.subjectIds=m.map(i=>i.id)};return()=>e("div",{class:E.uploadModal},[e(Ke,{style:{"max-height":"55vh"}},{default:()=>[e(q,{ref:u,labelPlacement:"left",labelWidth:120,model:c,class:E.formModal},{default:()=>[e($,{class:E.formSpace},{default:()=>[c.list.map((f,m)=>e("div",{class:E.formItem,key:m},[e("div",{class:E.previewModal},[e(H,{class:[E.titleType],src:g(f.type),previewDisabled:!0,objectFit:"cover"},null),!r.value&&e("img",{class:[E.iconUploadDelete],src:na,onClick:()=>a(m)},null),e(H,{class:[E.cover,E.image],lazy:!0,previewDisabled:!0,src:f.coverImg,objectFit:"cover"},null),e("div",{class:E.commonType},[b("公开资源:"),e(Ve,{size:"small",value:f.openFlag,"onUpdate:value":i=>f.openFlag=i},null)])]),e(P,{showFeedback:!1,path:"list.".concat(m,".name"),rule:[{required:!0,message:"请输入资源名称",trigger:["input","blur"]}]},{default:()=>[e(he,{value:f.name,"onUpdate:value":i=>f.name=i,placeholder:"请输入资源名称",maxlength:25,clearable:!0},null)]}),e(P,{path:"list[".concat(m,"].subjectIds"),showFeedback:!1,rule:[{required:!0,message:"请选择素材可用乐器",trigger:"change",type:"array"}]},{default:()=>[e(me,{value:f.subjectIds,"onUpdate:value":i=>f.subjectIds=i,placeholder:"请选择素材可用乐器(可多选)",options:t.getSubjectList,labelField:"name",valueField:"id",multiple:!0,maxTagCount:2,clearable:!0},{action:()=>e(U,null,[e(x,{text:!0,style:" --n-width: 100% ",onClick:()=>p(f,t.getSubjectList)},{default:()=>[b("全选")]})])})]})])),!r.value&&e("div",{class:E.formItem},[e(oa,{fileList:c.uploadUrl,"onUpdate:fileList":f=>c.uploadUrl=f,accept:".jpg,jpeg,.png,audio/mp3,video/mp4",showFileList:!1,ref:n,options:{autoCropWidth:320,autoCropHeight:180,fixedBox:!0},onFinished:f=>{c.list.push({subjectIds:c.subjectIds||[],openFlag:!0,coverImg:f.coverImg,name:c.name||"",type:Fe(f.content),enableFlag:1,content:f.content}),c.uploadUrl="",c.name="",c.subjectIds=[],n.value.handleClearFile()}},null),e(P,{showFeedback:!1},{default:()=>[e(he,{value:c.name,"onUpdate:value":f=>c.name=f,placeholder:"请输入资源名称",maxlength:25,clearable:!0},null)]}),e(P,{showFeedback:!1},{default:()=>[e(me,{value:c.subjectIds,"onUpdate:value":f=>c.subjectIds=f,placeholder:"请选择素材可用乐器(可多选)",options:t.getSubjectList,labelField:"name",valueField:"id",multiple:!0,maxTagCount:2,clearable:!0},{action:()=>e(U,null,[e(x,{text:!0,style:" --n-width: 100% ",onClick:()=>p(c,t.getSubjectList)},{default:()=>[b("全选")]})])})]})])]})]})]}),e($,{class:E.btnGroup,justify:"center"},{default:()=>[e(x,{round:!0,onClick:()=>l("close")},{default:()=>[b("取消")]}),e(x,{round:!0,type:"primary",loading:c.uploading,disabled:c.list.length===0,onClick:s},{default:()=>[b("确定")]})]})])}}),ca=""+new URL("resource-default-3665de4e.svg",import.meta.url).href,ua=""+new URL("resource-checked-d5b0de21.svg",import.meta.url).href,ra=D({name:"myResources-guide",emits:["close"],setup(o,{emit:l}){const t=B({box:{height:"0px"},show:!1,steps:[{ele:"",eleRect:{},img:K("myResourecs1.png"),handStyle:{top:"0.91rem"},imgStyle:{top:F(-4),left:F(-240),width:F(556),height:F(257)},btnsStyle:{bottom:F(30),left:F(-80)},eleRectPadding:{left:14,top:14,width:28,height:28},boxStyle:{borderRadius:"30px"}}],step:0}),u=_(!1),d=localStorage.getItem("teacher-guideInfo");d&&JSON.parse(d).myResourcesGuide?u.value=!1:u.value=!0;const n=()=>{var r,p,f,m;const a=document.getElementById("myResources-".concat(t.step));if(a){const i=a.getBoundingClientRect(),h=((r=t.steps[t.step].eleRectPadding)==null?void 0:r.left)||0,y=((p=t.steps[t.step].eleRectPadding)==null?void 0:p.top)||0,v=((f=t.steps[t.step].eleRectPadding)==null?void 0:f.width)||0,O=((m=t.steps[t.step].eleRectPadding)==null?void 0:m.height)||0;t.box={left:i.x-h+"px",top:i.y-y+"px",width:i.width+v+"px",height:i.height+O+"px"},console.log("coai-".concat(t.step),t.box)}else g()};N(()=>{n(),window.addEventListener("resize",c)});const c=()=>{n()};ue(()=>{window.removeEventListener("resize",c)});const g=()=>{if(t.step>=4){s();return}t.step=t.step+1,n()},s=()=>{let a=JSON.parse(localStorage.getItem("teacher-guideInfo")||"{}")||null;a?a.myResourcesGuide=!0:a={myResourcesGuide:!0},localStorage.setItem("teacher-guideInfo",JSON.stringify(a)),u.value=!1};return()=>e(U,null,[u.value?re(e("div",{"onUpdate:show":a=>u.value=a,class:["n-modal-mask","n-modal-mask-guide"]},[e("div",{class:C.content,onClick:()=>g()},[e("div",{class:C.backBtn,onClick:a=>{a.stopPropagation(),s()}},[b("跳过")]),e("div",{class:C.box,style:{...t.box,...t.steps[t.step].boxStyle},id:"modeType-".concat(t.step)},[t.steps.map((a,r)=>{var p,f,m,i;return e("div",{onClick:h=>h.stopPropagation(),class:C.item,style:a.type=="bottom"?{display:r===t.step?"":"none",left:"".concat((p=a.eleRect)==null?void 0:p.left,"px"),top:"-".concat((f=a.imgStyle)==null?void 0:f.height)}:{display:r===t.step?"":"none",left:"".concat((m=a.eleRect)==null?void 0:m.left,"px"),top:"".concat((i=t.box)==null?void 0:i.height)}},[e("img",{class:C.img,style:a.imgStyle,src:a.img},null),e("div",{class:C.btns,style:a.btnsStyle},[t.step+1==t.steps.length?e(U,null,[e("div",{class:[C.endBtn],onClick:()=>s()},[b("完成")])]):e("div",{class:C.btn,onClick:()=>g()},[b("下一步 ("),t.step+1,b("/"),t.steps.length,b(")")])])])})])])]),[[de,u.value,"show"]]):null])}}),da=D({name:"share-resources",setup(){const o=X();Ie();const l=B({searchWord:"",loading:!1,pageTotal:0,pagination:{page:1,rows:20},searchGroup:{type:"",name:"",bookVersionId:null,subjectId:null,sourceType:3},tableList:[],uploadStatus:!1,show:!1,item:{},editStatus:!1,editList:[],editIds:[],removeVisiable:!1,removeContent:"是否删除该资源?",type:"remove",removeItem:{}}),t=_(!1),u=async()=>{try{l.loading=!0;const{data:s}=await le({...l.searchGroup,...l.pagination});l.loading=!1,l.pageTotal=Number(s.total);const a=s.rows||[],r=[];a.forEach(p=>{r.push({id:p.id,coverImg:p.coverImg,type:p.type,title:p.name,isCollect:!!p.favoriteFlag,isSelected:p.sourceFrom==="PLATFORM",content:p.content,subjectId:p.subjectIds,enableFlag:p.enableFlag?1:0,openFlag:p.openFlag})}),l.tableList=r||[],setTimeout(()=>{t.value=!0},500)}catch(s){l.loading=!1}},d=async s=>{try{await oe({materialId:s.id,favoriteFlag:s.isCollect?0:1,type:s.type}),s.isCollect=!s.isCollect}catch(a){}},n=async s=>{l.pagination.page=1,l.searchGroup=Object.assign(l.searchGroup,s),u()},c=async()=>{try{await Me(l.editIds),o.success("删除成功"),n(l.searchGroup),l.editIds=[]}catch(s){}},g=async()=>{try{await we({id:l.removeItem.id}),o.success("删除成功"),n(l.searchGroup)}catch(s){}};return N(()=>{u()}),()=>e(U,null,[e(zt,{onSearch:s=>n(s),onUpload:()=>{l.editList=[],l.uploadStatus=!0},onUpdate:()=>{const s=[];if(l.tableList.forEach(a=>{l.editIds.indexOf(a.id)>-1&&s.push(a)}),l.editList=s||[],l.editList.length<=0){o.error("至少选择一条资源进行编辑");return}l.uploadStatus=!0},onEdit:s=>{l.editStatus=s,l.editStatus||(l.editIds=[])},onSelectAll:s=>{if(s){const a=[];l.tableList.forEach(r=>{a.push(r.id)}),l.editIds=a}else l.editIds=[]},onDelete:()=>{if(l.editIds.length<=0){o.error("至少选择一条资源进行删除");return}l.type="delete",l.removeContent="是否删除该资源?",l.removeVisiable=!0}},null),e(Q,{show:l.loading,"onUpdate:show":s=>l.loading=s,style:{"min-height":"50vh"}},{default:()=>[e("div",{class:k.list},[l.tableList.map(s=>e("div",{class:k.itemSection},[e(z,{item:s,disabledMouseHover:!1,offShelf:!s.enableFlag,onOffShelf:()=>{l.type="remove",l.removeContent="该资源已下架,是否删除?",l.removeVisiable=!0},onClick:a=>{a.type==="IMG"||!s.enableFlag||(l.show=!0,l.item=a)},onCollect:a=>d(a)},null),l.editStatus&&e("div",{class:[k.itemBg,l.editIds.includes(s.id)?k.itemBgChecked:""],onClick:()=>{const a=l.editIds.indexOf(s.id);a>-1?l.editIds.splice(a,1):l.editIds.push(s.id)}},[e("img",{src:l.editIds.includes(s.id)?ua:ca,class:k.resourceDefault},null)])])),!l.loading&&l.tableList.length<=0&&e(pe,{style:{paddingTop:"30px"},description:"暂无资源"},null)])]}),e(se,{page:l.pagination.page,"onUpdate:page":s=>l.pagination.page=s,pageSize:l.pagination.rows,"onUpdate:pageSize":s=>l.pagination.rows=s,pageTotal:l.pageTotal,"onUpdate:pageTotal":s=>l.pageTotal=s,onList:u},null),e(ae,{show:l.show,"onUpdate:show":s=>l.show=s,item:l.item},null),e(W,{show:l.uploadStatus,"onUpdate:show":s=>l.uploadStatus=s,preset:"card",showIcon:!1,class:["modalTitle background",k.attendClassModal],title:l.editStatus?"修改资源":"上传资源",blockScroll:!1},{default:()=>[e(ia,{onClose:()=>l.uploadStatus=!1,onConfirm:()=>{l.editIds=[],l.editList=[],n(l.searchGroup)},list:l.editList},null)]}),t.value?e(ra,null,null):null,e(W,{show:l.removeVisiable,"onUpdate:show":s=>l.removeVisiable=s,preset:"card",class:["modalTitle",k.removeVisiable],title:"提示"},{default:()=>[e("div",{class:k.studentRemove},[e("p",null,[l.removeContent]),e($,{class:k.btnGroupModal,justify:"center"},{default:()=>[e(x,{round:!0,type:"primary",onClick:()=>{l.type==="remove"?g():c(),l.removeVisiable=!1}},{default:()=>[b("确定")]}),e(x,{round:!0,onClick:()=>l.removeVisiable=!1},{default:()=>[b("取消")]})]})])]})])}}),pa="_list_2oig9_1",fa="_searchGroup_2oig9_9",ga="_btnType_2oig9_13",ha="_inputSearch_2oig9_48",ma="_searchCatatory_2oig9_72",ya="_addTrain_2oig9_79",ba="_spaceSection_2oig9_91",va="_collapseWrap_2oig9_97",Sa="_collaoseBtn_2oig9_103",_a="_isStart_2oig9_108",wa="_collapsSection_2oig9_111",ka="_isHidden_2oig9_114",G={list:pa,searchGroup:fa,btnType:ga,inputSearch:ha,searchCatatory:ma,addTrain:ya,spaceSection:ba,collapseWrap:va,collaoseBtn:Sa,isStart:_a,collapsSection:wa,isHidden:ka};function Se(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!ce(o)}const Ca=D({name:"search-group",emits:["search"],setup(o,{emit:l}){const t=J(),u=_([]),d=B({type:"",name:"",bookVersionId:null,subjectId:null}),n=()=>{l("search",d)},c=_(),g=_([]),s=_(0),a=_(0),r=_(0),p=_(!1),f=h=>{h!=null&&h.selfElRef&&g.value.push(h.selfElRef.parentNode)},m=h=>{p.value=h,i()},i=()=>{g.value=[...new Set(g.value)];let h=-1;g.value.forEach((y,v)=>{v===0?(r.value=1,h=y.offsetLeft):y.offsetLeft===h&&v!=0&&r.value++,p.value?y.style.display="block":r.value>1?y.style.display="none":y.style.display="block"})};return N(async()=>{u.value=[{label:"全部",value:""},...ie],await t.getMusicSheetCategory(),await t.getSubjects()}),()=>{let h,y;return e("div",{class:G.searchGroup},[e("div",{class:G.searchCatatory},[e($,{size:"small",class:G.btnType},Se(h=u.value.map(v=>e(x,{type:d.type===v.value?"primary":"default",secondary:d.type!==v.value,round:!0,size:"small",focusable:!1,onClick:()=>{d.type=v.value,n(),Ce(()=>{d.type==="MUSIC"&&(s.value=c.value.offsetHeight,a.value=c.value.offsetHeight/r.value,i())})}},{default:()=>[v.label]})))?h:{default:()=>[h]})]),e(q,{labelAlign:"left",labelPlacement:"left"},{default:()=>[d.type==="MUSIC"&&e("div",{class:[G.collapsSection]},[e(P,{label:"教材:"},{default:()=>[e("div",{class:[G.collapseWrap,p.value?"":G.isHidden],ref:c},[e($,{class:[G.spaceSection]},{default:()=>[t.getAllMusicCategories.map(v=>e(x,{ref:f,secondary:d.bookVersionId===v.id,quaternary:d.bookVersionId!==v.id,strong:!0,focusable:!1,type:d.bookVersionId===v.id?"primary":"default",onClick:()=>{d.bookVersionId=v.id,n()}},{default:()=>[v.name]})),r.value>1&&e("div",{style:{height:"var(--n-blank-height)",position:"absolute",display:"flex",alignItems:"center"},onClick:()=>{m(!p.value)}},[e(H,{previewDisabled:!0,src:_e,class:[G.collaoseBtn,p.value?G.isStart:""]},null)])]})])]})]),e(P,{label:"乐器:"},{default:()=>[e($,{class:G.spaceSection},Se(y=t.getSubjectAllList.map(v=>e(x,{secondary:d.subjectId===v.id,quaternary:d.subjectId!==v.id,strong:!0,focusable:!1,type:d.subjectId===v.id?"primary":"default",onClick:()=>{d.subjectId=v.id,n()}},{default:()=>[v.name]})))?y:{default:()=>[y]})]}),e(ne,{class:G.inputSearch,round:!0,onSearch:v=>{d.name=v,n()}},null)]})])}}}),Ia=D({name:"myColloge-guide",emits:["close"],setup(o,{emit:l}){const t=B({box:{height:"0px"},show:!1,steps:[{ele:"",img:K("myColloge1.png"),imgStyle:{top:F(-4),left:F(630),width:F(458),height:F(291)},btnsStyle:{bottom:F(96),left:F(790)},eleRectPadding:{left:7,top:7,width:14,height:14},type:"bottom"}],step:0}),u=_(!1),d=localStorage.getItem("teacher-guideInfo");d&&JSON.parse(d).myColloge?u.value=!1:u.value=!0;const n=()=>{var r,p,f,m;const a=document.getElementById("myColloge-".concat(t.step));if(a){const i=a.getBoundingClientRect(),h=((r=t.steps[t.step].eleRectPadding)==null?void 0:r.left)||0,y=((p=t.steps[t.step].eleRectPadding)==null?void 0:p.top)||0,v=((f=t.steps[t.step].eleRectPadding)==null?void 0:f.width)||0,O=((m=t.steps[t.step].eleRectPadding)==null?void 0:m.height)||0;t.box={left:i.x-h+"px",top:i.y-y+"px",width:i.width+v+"px",height:i.height+O+"px"},console.log("coai-".concat(t.step),t.box)}else g()};N(()=>{n(),window.addEventListener("resize",c)});const c=()=>{n()};ue(()=>{window.removeEventListener("resize",c)});const g=()=>{if(t.step>=4){s();return}t.step=t.step+1,n()},s=()=>{let a=JSON.parse(localStorage.getItem("teacher-guideInfo")||"{}")||null;a?a.myColloge=!0:a={myColloge:!0},localStorage.setItem("teacher-guideInfo",JSON.stringify(a)),u.value=!1};return()=>e(U,null,[u.value?re(e("div",{"onUpdate:show":a=>u.value=a,class:["n-modal-mask","n-modal-mask-guide"]},[e("div",{class:C.content,onClick:()=>g()},[e("div",{class:C.backBtn,onClick:a=>{a.stopPropagation(),s()}},[b("跳过")]),e("div",{class:C.box,style:{...t.box},id:"modeType-".concat(t.step)},[t.steps.map((a,r)=>{var p,f,m,i;return e("div",{onClick:h=>h.stopPropagation(),class:C.item,style:a.type=="bottom"?{display:r===t.step?"":"none",left:"".concat((p=a.eleRect)==null?void 0:p.left,"px"),top:"-".concat((f=a.imgStyle)==null?void 0:f.height)}:{display:r===t.step?"":"none",left:"".concat((m=a.eleRect)==null?void 0:m.left,"px"),top:"".concat((i=t.box)==null?void 0:i.height)}},[e("img",{class:C.img,style:a.imgStyle,src:a.img},null),e("div",{class:C.btns,style:a.btnsStyle},[t.step+1==t.steps.length?e(U,null,[e("div",{class:[C.endBtn],onClick:()=>s()},[b("完成")])]):e("div",{class:C.btn,onClick:()=>g()},[b("下一步 ("),t.step+1,b("/"),t.steps.length,b(")")])])])})])])]),[[de,u.value,"show"]]):null])}}),Fa=D({name:"share-resources",setup(){const o=X(),l=Ie(),t=B({searchWord:"",loading:!1,pageTotal:0,pagination:{page:1,rows:20},searchGroup:{type:"",name:"",bookVersionId:null,subjectId:null,sourceType:4},tableList:[],show:!1,item:{}}),u=async()=>{try{t.loading=!0;const{data:s}=await le({...t.searchGroup,...t.pagination});t.loading=!1,t.pageTotal=Number(s.total);const a=s.rows||[],r=[];a.forEach(p=>{r.push({id:p.id,coverImg:p.coverImg,type:p.type,title:p.name,isCollect:!!p.favoriteFlag,isSelected:p.sourceFrom==="PLATFORM",content:p.content,subjectId:p.subjectIds,enableFlag:p.enableFlag?1:0,openFlag:p.openFlag})}),t.tableList=r||[],setTimeout(()=>{d.value=!0},500)}catch(s){t.loading=!1}},d=_(!1),n=async s=>{t.pagination.page=1,t.searchGroup=Object.assign(t.searchGroup,s),u()},c=async s=>{try{await oe({materialId:s.id,favoriteFlag:s.isCollect?0:1,type:s.type}),s.isCollect=!s.isCollect,n(t.searchGroup)}catch(a){}},g=async s=>{try{l.warning({title:"提示",content:"该资源已下架,是否删除?",positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{await we({id:s.id}),o.success("删除成功"),n(t.searchGroup)}})}catch(a){}};return N(()=>{u()}),()=>e(U,null,[e(Ca,{onSearch:s=>n(s)},null),e(Q,{show:t.loading,"onUpdate:show":s=>t.loading=s,style:{"min-height":"50vh"}},{default:()=>[e("div",{class:G.list,id:"myColloge-0"},[t.tableList.map(s=>e(z,{item:s,offShelf:!s.enableFlag,onOffShelf:()=>g(s),disabledMouseHover:!1,onClick:a=>{a.type==="IMG"||!s.enableFlag||(t.show=!0,t.item=a)},onCollect:a=>c(a)},null)),!t.loading&&t.tableList.length<=0&&e(pe,{description:"暂无收藏资源"},null)])]}),e(se,{page:t.pagination.page,"onUpdate:page":s=>t.pagination.page=s,pageSize:t.pagination.rows,"onUpdate:pageSize":s=>t.pagination.rows=s,pageTotal:t.pageTotal,"onUpdate:pageTotal":s=>t.pageTotal=s,onList:u},null),e(ae,{show:t.show,"onUpdate:show":s=>t.show=s,item:t.item},null),d.value?e(Ia,null,null):null])}}),Oa=D({name:"student-studentList",setup(){return()=>e("div",{class:te.listWrap},[e(He,{defaultValue:"myResources",paneClass:te.paneTitle,justifyContent:"center",paneWrapperClass:te.paneWrapperContainer},{default:()=>[e(Z,{name:"myResources",tab:"我的资源"},{default:()=>[e(da,null,null)]}),e(Z,{name:"shareResources",tab:"共享资源"},{default:()=>[e(mt,null,null)],tab:()=>e("span",{id:"shareResources-0"},[b("共享资源")])}),e(Z,{name:"myCollect",tab:"我的收藏"},{default:()=>[e(Fa,null,null)]})]})])}});export{Oa as default};
|