1 |
- import{C as q,a as se,i as ge,b as Ee,c as Le,d as Ue}from"./index-b88fa978.js";import{P as le}from"./index-8a1099db.js";import{a as Ae,i as Ge,A as $e,m as oe,f as ne,b as De,c as je,d as Be,e as _e}from"./isCollaose-2c88cc95.js";import{T as ie}from"./index-a8268a6c.js";import{r as ce}from"./searchArray-28951398.js";import{u as H}from"./catchData-f90464b5.js";import{d as $,e as G,r as F,n as B,f as e,v as A,j as T,k as y,N as K,g as N,y as ae,b3 as ue,a1 as I,a2 as re,a3 as de,a4 as pe,F as L,A as J,w as we,t as z,b as Q,x as he,di as Me,dj as V,P as Ne,Z as Pe,dk as Oe,h as me,J as ye,C as Ve,dl as qe,m as Ce,p as ze,q as X}from"./index-a6d6496c.js";import{T as fe}from"./index-b2ac38ee.js";import{g as W,s as w}from"./index-5275be7c.js";import{C as We,p as Y,a as be}from"./index-5b06f876.js";import{N as He}from"./Scrollbar-e8335014.js";import"./icon-collect-active-f4557525.js";import"./index-f5050233.js";import"./searchs-1f038725.js";import"./contants-e12e4ed1.js";const Ke="_listWrap_fw7rw_1",Je="_list_fw7rw_1",Qe="_searchGroup_fw7rw_45",Ze="_btnType_fw7rw_49",Xe="_inputSearch_fw7rw_83",Ye="_searchCatatory_fw7rw_102",et="_addTrain_fw7rw_109",ee={listWrap:Ke,list:Je,searchGroup:Qe,btnType:Ze,inputSearch:Xe,searchCatatory:Ye,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",E={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 ve(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!ue(o)}const gt=$({name:"search-group",emits:["search","add"],setup(o,{emit:l}){const t=H(),u=G({type:"MUSIC",name:"",bookVersionId:null,subjectId:null}),r=()=>{l("search",u)},n=F(),c=F([]),g=F(0),s=F(0),a=F(0),p=F(!1),f=i=>{i!=null&&i.selfElRef&&c.value.push(i.selfElRef.parentNode)},d=i=>{p.value=i,h()},h=()=>{c.value=[...new Set(c.value)];let i=-1;c.value.forEach((m,v)=>{console.log(m.offsetLeft),v===0?(a.value=1,i=m.offsetLeft):m.offsetLeft===i&&v!=0&&a.value++,p.value?m.style.display="block":a.value>1?m.style.display="none":m.style.display="block"})};return B(async()=>{await t.getMusicSheetCategory(),await t.getSubjects(),g.value=n.value.offsetHeight,s.value=n.value.offsetHeight/a.value,h(),console.log(c.value[1].offsetHeight,n.value.offsetHeight/3)}),()=>{let i,m;return e("div",{class:E.searchGroup},[e("div",{class:[E.searchCatatory]},[e(A,{size:"small",class:E.btnType},ve(i=ce.map(v=>e(T,{type:u.type===v.value?"primary":"default",secondary:u.type!==v.value,round:!0,size:"small",focusable:!1,onClick:()=>{u.type=v.value,r()}},{default:()=>[v.label]})))?i:{default:()=>[i]}),e(T,{type:"primary",class:E.addTrain,focusable:!1,strong:!0,onClick:()=>l("add")},{default:()=>[e("img",{src:Ae},null),y("添加自定义教材")]})]),e(K,{labelAlign:"left",labelPlacement:"left"},{default:()=>[u.type==="MUSIC"&&e("div",{class:[E.collapsSection]},[e(N,{label:"教材:"},{default:()=>[e("div",{class:[E.collapseWrap,p.value?"":E.isHidden],ref:n},[e(A,{class:[E.spaceSection]},{default:()=>[t.getAllMusicCategories.map(v=>e(T,{ref:f,secondary:u.bookVersionId===v.id,quaternary:u.bookVersionId!==v.id,strong:!0,focusable:!1,type:u.bookVersionId===v.id?"primary":"default",onClick:()=>{u.bookVersionId=v.id,r()}},{default:()=>[v.name]})),e("div",{style:{height:"100%",display:"flex",alignItems:"center"},onClick:()=>{d(!p.value)}},[e(ae,{previewDisabled:!0,src:Ge,class:[E.collaoseBtn,p.value?E.isStart:""]},null)])]})])]})]),e(N,{label:"乐器:"},{default:()=>[e(A,{class:E.spaceSection},ve(m=t.getSubjectAllList.map(v=>e(T,{secondary:u.subjectId===v.id,quaternary:u.subjectId!==v.id,strong:!0,focusable:!1,type:u.subjectId===v.id?"primary":"default",onClick:()=>{u.subjectId=v.id,r()}},{default:()=>[v.name]})))?m:{default:()=>[m]})]}),e(ie,{class:E.inputSearch,round:!0,onSearch:v=>{u.name=v,r()}},null)]})])}}}),ht=$({name:"shareResources-guide",emits:["close"],setup(o,{emit:l}){const t=G({box:{height:"0px"},show:!1,steps:[{ele:"",eleRect:{},img:W("shareResources1.png"),handStyle:{top:"0.91rem"},imgStyle:{top:I(-4),left:I(-263),width:I(553),height:I(229)},btnsStyle:{bottom:I(30),left:I(-102)},eleRectPadding:{left:14,top:14,width:28,height:28},boxStyle:{borderRadius:"30px"}},{ele:"",img:W("shareResources2.png"),imgStyle:{left:I(134),width:I(515),height:I(227)},btnsStyle:{bottom:I(75),left:I(253)},eleRectPadding:{left:7,top:7,width:14,height:14},boxStyle:{borderRadius:"15px"},type:"bottom"}],step:0}),u=F(!1),r=localStorage.getItem("teacher-guideInfo");r&&JSON.parse(r).shareResourcesGuide?u.value=!1:u.value=!0;const n=()=>{var p,f,d,h;const a=document.getElementById(`shareResources-${t.step}`);if(a){const i=a.getBoundingClientRect(),m=((p=t.steps[t.step].eleRectPadding)==null?void 0:p.left)||0,v=((f=t.steps[t.step].eleRectPadding)==null?void 0:f.top)||0,M=((d=t.steps[t.step].eleRectPadding)==null?void 0:d.width)||0,P=((h=t.steps[t.step].eleRectPadding)==null?void 0:h.height)||0;`shareResources-${t.step}`=="shareResources-1"?(t.box={left:i.x-m+"px",top:i.y-v+"px",width:(i.width+M)*2+M+"px",height:i.height+P+"px"},console.log(t.box.width,"---",i.width)):t.box={left:i.x-m+"px",top:i.y-v+"px",width:i.width+M+"px",height:i.height+P+"px"},console.log(`coai-${t.step}`,t.box)}else g()};B(()=>{n(),window.addEventListener("resize",c)});const c=()=>{n()};re(()=>{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(L,null,[u.value?de(e("div",{"onUpdate:show":a=>u.value=a,class:["n-modal-mask","n-modal-mask-guide"]},[e("div",{class:w.content,onClick:()=>g()},[e("div",{class:w.backBtn,onClick:a=>{a.stopPropagation(),s()}},[y("跳过")]),e("div",{class:w.box,style:{...t.box,...t.steps[t.step].boxStyle},id:`modeType-${t.step}`},[t.steps.map((a,p)=>{var f,d,h,i;return e("div",{onClick:m=>m.stopPropagation(),class:w.item,style:a.type=="bottom"?{display:p===t.step?"":"none",left:`${(f=a.eleRect)==null?void 0:f.left}px`,top:`-${(d=a.imgStyle)==null?void 0:d.height}`}:{display:p===t.step?"":"none",left:`${(h=a.eleRect)==null?void 0:h.left}px`,top:`${(i=t.box)==null?void 0:i.height}`}},[e("img",{class:w.img,style:a.imgStyle,src:a.img},null),e("div",{class:w.btns,style:a.btnsStyle},[t.step+1==t.steps.length?e(L,null,[e("div",{class:[w.endBtn],onClick:()=>s()},[y("完成")]),e("div",{class:w.nextBtn,onClick:()=>{t.step=0,n()}},[y("再看一遍")])]):e("div",{class:w.btn,onClick:()=>g()},[y("下一步 ("),t.step+1,y("/"),t.steps.length,y(")")])])])})])])]),[[pe,u.value,"show"]]):null])}}),mt=$({name:"share-resources",setup(){const o=G({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=F(!1),t=async()=>{try{o.loading=!0;const{data:n}=await oe({...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()},r=async n=>{try{await ne({materialId:n.id,favoriteFlag:n.isCollect?0:1,type:n.type}),n.isCollect=!n.isCollect}catch(c){}};return B(()=>{t()}),()=>e(L,null,[e(gt,{onSearch:n=>u(n),onAdd:()=>o.teachingStatus=!0},null),e(J,{show:o.loading,"onUpdate:show":n=>o.loading=n,style:{"min-height":"50vh"}},{default:()=>[e("div",{class:E.list},[o.tableList.map((n,c)=>e(L,null,[c==0?e(q,we({id:"shareResources-1"},{item:n,disabledMouseHover:!1,onClick:g=>{g.type!=="IMG"&&(o.show=!0,o.item=g)},onCollect:g=>r(g)}),null):e(q,{item:n,disabledMouseHover:!1,onClick:g=>{g.type!=="IMG"&&(o.show=!0,o.item=g)},onCollect:g=>r(g)},null)])),!o.loading&&o.tableList.length<=0&&e(fe,{description:"暂无共享资源"},null)])]}),e(le,{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(se,{show:o.show,"onUpdate:show":n=>o.show=n,item:o.item},null),e(z,{show:o.teachingStatus,"onUpdate:show":n=>o.teachingStatus=n,preset:"card",showIcon:!1,class:["modalTitle background",E.teachingModal],title:"自定义教材",blockScroll:!1},{default:()=>[e($e,{onClose:()=>o.teachingStatus=!1},null)]}),l.value?e(ht,null,null):null])}}),yt="_list_14qgn_1",bt="_searchGroup_14qgn_8",vt="_btnType_14qgn_12",St="_inputSearch_14qgn_46",_t="_searchCatatory_14qgn_70",wt="_addTrain_14qgn_78",Ct="_error_14qgn_85",It="_iconUpload_14qgn_92",kt="_iconEdit_14qgn_96",Ft="_iconSelectAll_14qgn_100",xt="_iconDelete_14qgn_104",Tt="_iconPen_14qgn_108",Rt="_itemSection_14qgn_112",Et="_itemBg_14qgn_115",Lt="_itemBgChecked_14qgn_124",Ut="_resourceDefault_14qgn_127",At="_spaceSection_14qgn_134",Gt="_attendClassModal_14qgn_140",$t="_removeVisiable_14qgn_146",Dt="_studentRemove_14qgn_149",jt="_btnGroupModal_14qgn_161",_={list:yt,searchGroup:bt,btnType:vt,inputSearch:St,searchCatatory:_t,addTrain:wt,error:Ct,iconUpload:It,iconEdit:kt,iconSelectAll:Ft,iconDelete:xt,iconPen:Tt,itemSection:Rt,itemBg:Et,itemBgChecked:Lt,resourceDefault:Ut,spaceSection:At,attendClassModal:Gt,removeVisiable:$t,studentRemove:Dt,btnGroupModal:jt},Bt=""+new URL("icon-upload-80842027.svg",import.meta.url).href,Mt=""+new URL("icon-edit-b6bf632d.svg",import.meta.url).href,Nt=""+new URL("icon-selectall-3a19fad7.svg",import.meta.url).href,Pt=""+new URL("icon-selectall-default-48d9d555.svg",import.meta.url).href,Ot=""+new URL("icon-pen-ed9c4056.svg",import.meta.url).href,Vt=""+new URL("icon-delete-2a30d9a9.svg",import.meta.url).href;function Se(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!ue(o)}const qt=$({name:"search-group",emits:["search","upload","edit","selectAll","delete","update"],setup(o,{emit:l}){const t=F([]),u=H(),r=G({type:"",name:"",bookVersionId:null,subjectId:null}),n=G({isEdit:!1,isSelectAll:!1}),c=()=>{l("search",r)};return B(async()=>{t.value=[{label:"全部",value:""},...ce],await u.getSubjects()}),()=>{let g,s;return e("div",{class:_.searchGroup},[e("div",{class:_.searchCatatory},[e(A,{size:"small",class:_.btnType},Se(g=t.value.map(a=>a.value!=="MUSIC"&&e(T,{type:r.type===a.value?"primary":"default",secondary:r.type!==a.value,round:!0,size:"small",focusable:!1,onClick:()=>{r.type=a.value,c()}},{default:()=>[a.label]})))?g:{default:()=>[g]}),e(A,null,{default:()=>[n.isEdit?e(L,null,[e(T,{type:"primary",class:_.addTrain,focusable:!1,strong:!0,onClick:()=>{n.isSelectAll=!n.isSelectAll,l("selectAll",n.isSelectAll)}},{default:()=>[e("img",{src:n.isSelectAll?Nt:Pt,class:_.iconSelectAll},null),y("全选")]}),e(T,{type:"error",class:[_.addTrain,_.error],focusable:!1,strong:!0,onClick:()=>l("delete")},{default:()=>[e("img",{src:Vt,class:_.iconDelete},null),y("删除")]}),e(T,{type:"primary",class:_.addTrain,focusable:!1,strong:!0,onClick:()=>l("update")},{default:()=>[e("img",{src:Ot,class:_.iconPen},null),y("修改")]}),e(T,{type:"primary",class:_.addTrain,focusable:!1,strong:!0,onClick:()=>{n.isEdit=!1,l("edit",n.isEdit)}},{default:()=>[y("完成编辑")]})]):e(L,null,[e(T,we({type:"primary",class:_.addTrain,focusable:!1},{id:"myResources-0"},{strong:!0,onClick:()=>l("upload")}),{default:()=>[e("img",{src:Bt,class:_.iconUpload},null),y("上传资源")]}),e(T,{type:"primary",class:_.addTrain,focusable:!1,strong:!0,onClick:()=>{n.isEdit=!0,l("edit",n.isEdit)}},{default:()=>[e("img",{src:Mt,class:_.iconEdit},null),y("编辑资源")]})])]})]),e(K,{labelAlign:"left",labelPlacement:"left"},{default:()=>[e(N,{label:"乐器:"},{default:()=>[e(A,{class:_.spaceSection},Se(s=u.getSubjectAllList.map(a=>e(T,{secondary:r.subjectId===a.id,quaternary:r.subjectId!==a.id,strong:!0,focusable:!1,type:r.subjectId===a.id?"primary":"default",onClick:()=>{r.subjectId=a.id,c()}},{default:()=>[a.name]})))?s:{default:()=>[s]})]}),e(ie,{class:_.inputSearch,round:!0,onSearch:a=>{r.name=a,c()}},null)]})])}}}),zt="_uploadModal_xk0km_1",Wt="_formModal_xk0km_4",Ht="_formSpace_xk0km_8",Kt="_previewModal_xk0km_11",Jt="_image_xk0km_23",Qt="_titleType_xk0km_32",Zt="_iconUploadDelete_xk0km_40",Xt="_commonType_xk0km_49",Yt="_formItem_xk0km_72",ea="_btnGroup_xk0km_94",ta="_uploadFile_xk0km_101",aa="_uploadBtn_xk0km_104",sa="_iconUploadAdd_xk0km_121",R={uploadModal:zt,formModal:Wt,formSpace:Ht,previewModal:Kt,image:Jt,titleType:Qt,iconUploadDelete:Zt,commonType:Xt,formItem:Yt,btnGroup:ea,uploadFile:ta,uploadBtn:aa,iconUploadAdd:sa},la=""+new URL("icon-upload-add-e30dd125.svg",import.meta.url).href,oa=$({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 r=`https://${o.bucketName}.ks3-cn-beijing.ksyuncs.com/`,n=Q(),c=F(!1),g=F(!1),s=F(),a=F(),p=G({policy:"",signature:"",key:"",KSSAccessKeyId:"",acl:"public-read",name:""}),f=F([]),d=()=>{if(o.fileList){const S=o.fileList.split("/");f.value=[{id:new Date().getTime().toString(),name:S[S.length-1],status:"finished",url:o.fileList}]}else f.value=[]};d(),he(()=>o.imageList,()=>{d()}),he(()=>o.fileList,()=>{d()}),t({handleClearFile:()=>{var S;(S=a.value)==null||S.clear()}});const i=F(),m=async S=>{const b=S.file;let C=!0;const k=b.type.includes("image")?V.IMG:b.type.includes("audio")?V.SONG:V.VIDEO,U=k==="IMG"?2:k==="SONG"?20:500;if(U&&(C=b.file.size/1024/1024<U,!C))return n.error(`文件大小不能超过${U}M`),!1;if(!C)return C;if(o.cropper&&k==="IMG")return v(b.file,x=>{const j=Object.assign({},o.options,{img:x,name:b.file.name});c.value=!0,setTimeout(()=>{var D;(D=i.value)==null||D.edit(j)},100)}),!1;try{g.value=!0;const x=b.file.name,j=x.slice(x.lastIndexOf(".")),D=`${o.path}${o.fileName||Date.now()+j}`,Re={filename:D,bucketName:o.bucketName,postData:{filename:D,acl:"public-read",key:D,unknowValueField:[]}},{data:Z}=await Y(Re);p.policy=Z.policy,p.signature=Z.signature,p.key=D,p.KSSAccessKeyId=Z.kssAccessKeyId,p.name=D,s.value=b.file}catch(x){return g.value=!1,!1}return!0},v=async(S,b)=>{const C=new FileReader;C.addEventListener("load",()=>b(C.result)),C.readAsDataURL(S)},M=S=>{P(S)},P=async S=>{const b=r+p.key,C=Ie(b);let k="";C==="IMG"?k=b:C==="SONG"?k=Ne.SONG_DEFAULT_COVER:C==="VIDEO"&&(k=await Fe()),l("update:fileList",b),l("readFileInputEventAsArrayBuffer",s.value),l("finished",{coverImg:k,content:b}),S.file.url=b,c.value=!1,g.value=!1},ke=S=>new Promise(b=>{const C=document.createElement("video");C.currentTime=1,C.src=URL.createObjectURL(S),C.addEventListener("loadeddata",function(){const k=document.createElement("canvas"),U=C.videoWidth,x=C.videoHeight;k.width=U,k.height=x,k.getContext("2d").drawImage(C,0,0,U,x),console.log(k),k.toBlob(j=>{console.log(j),b(j)})})}),Fe=async()=>{try{g.value=!0;const S=await ke(s.value),b=`${o.path}${Date.now()+".png"}`,C={filename:b,bucketName:o.bucketName,postData:{filename:b,acl:"public-read",key:b,unknowValueField:[]}},{data:k}=await Y(C),U={policy:k.policy,signature:k.signature,key:b,acl:"public-read",KSSAccessKeyId:k.kssAccessKeyId,name:b},x=new FormData;for(const D in U)x.append(D,U[D]);return x.append("file",S),await be.post(r,x),r+b}finally{g.value=!1}},xe=async()=>{l("update:fileList",""),l("remove"),g.value=!1},Te=async S=>{try{const b=`${o.path}${o.fileName||new Date().getTime()+".png"}`,C={filename:b,bucketName:o.bucketName,postData:{filename:b,acl:"public-read",key:b,unknowValueField:[]}},{data:k}=await Y(C);p.policy=k.policy,p.signature=k.signature,p.key=b,p.KSSAccessKeyId=k.kssAccessKeyId,p.name=b;const U=new FormData;for(const x in p)U.append(x,p[x]);U.append("file",S),await be.post(r,U).then(()=>{const x=r+p.key,j=x.split("/");f.value=[{id:new Date().getTime().toString(),name:j[j.length-1],status:"finished",url:x}],l("update:fileList",x),l("finished",{coverImg:x,content:x}),c.value=!1})}catch(b){return!1}};return()=>e("div",{class:R.uploadFile},[e(J,{show:g.value,description:"上传中..."},{default:()=>[e(Me,{ref:a,action:r,data:p,fileList:f.value,"onUpdate:fileList":S=>f.value=S,accept:o.accept,multiple:o.multiple,max:o.max,disabled:o.disabled,showFileList:o.showFileList,showPreviewButton:!0,onBeforeUpload:S=>m(S),onFinish:S=>M(S),onRemove:()=>xe()},{default:()=>[o.showType==="default"&&e("div",{class:R.uploadBtn},[e("img",{src:la,class:R.iconUploadAdd},null),e("p",null,[y("上传")])]),o.showType==="custom"&&u.custom&&u.custom()]})]}),e(z,{show:c.value,"onUpdate:show":S=>c.value=S,preset:"dialog",showIcon:!1,class:["modalTitle background"],title:"上传图片",style:{width:"800px"}},{default:()=>[e(We,{ref:i,onClose:()=>c.value=!1,onCropperOk:Te},null)]})])}}),na=""+new URL("icon-upload-delete-4a696b5c.svg",import.meta.url).href,Ie=o=>o.indexOf(".mp3")>-1?V.SONG:o.indexOf(".mp4")>-1?V.VIDEO:V.IMG,ia=$({name:"upload-modal",props:{list:{type:Array,default:()=>[]}},emits:["close","confirm"],setup(o,{emit:l}){const t=H(),u=F(),r=Q(),n=F(),c=G({list:[],uploading:!1,uploadUrl:"",name:"",subjectIds:[]}),g=d=>{let h=ge;switch(d){case"IMG":h=ge;break;case"VIDEO":h=Ue;break;case"SONG":h=Le;break;case"MUSIC":h=Ee;break}return h},s=async()=>{var d;(d=u.value)==null||d.validate(async h=>{if(h){Ve(qe);return}c.uploading=!0;try{const i=[];c.list.forEach(m=>{i.push({subjectIds:m.subjectIds.join(","),openFlag:m.openFlag,coverImg:m.coverImg,name:m.name,type:m.type,enableFlag:1,content:m.content,id:m.id||null})}),p.value?await De(i):await je(i),c.list=[],r.success("保存成功"),l("close",!0),l("confirm")}catch(i){}c.uploading=!1})},a=d=>{c.list.splice(d,1)},p=Pe(()=>o.list.length>0);B(async()=>{const d=o.list||[],h=[];d.forEach(i=>{h.push({subjectIds:i.subjectId?i.subjectId.split(",").map(m=>Number(m)):[],openFlag:i.openFlag,coverImg:i.coverImg,name:i.title,type:i.type,enableFlag:i.enableFlag,content:i.content,id:i.id})}),c.list=h||[],await t.getSubjects()});const f=(d,h)=>{d.subjectIds=h.map(i=>i.id)};return()=>e("div",{class:R.uploadModal},[e(He,{style:{"max-height":"55vh"}},{default:()=>[e(K,{ref:u,labelPlacement:"left",labelWidth:120,model:c,class:R.formModal},{default:()=>[e(A,{class:R.formSpace},{default:()=>[c.list.map((d,h)=>e("div",{class:R.formItem,key:h},[e("div",{class:R.previewModal},[e(ae,{class:[R.titleType],src:g(d.type),previewDisabled:!0,objectFit:"cover"},null),!p.value&&e("img",{class:[R.iconUploadDelete],src:na,onClick:()=>a(h)},null),e(ae,{class:[R.cover,R.image],lazy:!0,previewDisabled:!0,src:d.coverImg,objectFit:"cover"},null),e("div",{class:R.commonType},[y("公开资源:"),e(Oe,{size:"small",value:d.openFlag,"onUpdate:value":i=>d.openFlag=i},null)])]),e(N,{showFeedback:!1,path:`list.${h}.name`,rule:[{required:!0,message:"请输入资源名称",trigger:["input","blur"]}]},{default:()=>[e(me,{value:d.name,"onUpdate:value":i=>d.name=i,placeholder:"请输入资源名称",maxlength:25,clearable:!0},null)]}),e(N,{path:`list[${h}].subjectIds`,showFeedback:!1,rule:[{required:!0,message:"请选择素材可用乐器",trigger:"change",type:"array"}]},{default:()=>[e(ye,{value:d.subjectIds,"onUpdate:value":i=>d.subjectIds=i,placeholder:"请选择素材可用乐器(可多选)",options:t.getSubjectList,labelField:"name",valueField:"id",multiple:!0,maxTagCount:2,clearable:!0},{action:()=>e(L,null,[e(T,{text:!0,style:" --n-width: 100% ",onClick:()=>f(d,t.getSubjectList)},{default:()=>[y("全选")]})])})]})])),!p.value&&e("div",{class:R.formItem},[e(oa,{fileList:c.uploadUrl,"onUpdate:fileList":d=>c.uploadUrl=d,accept:".jpg,jpeg,.png,audio/mp3,video/mp4",showFileList:!1,ref:n,options:{autoCropWidth:320,autoCropHeight:180,fixedBox:!0},onFinished:d=>{c.list.push({subjectIds:c.subjectIds||[],openFlag:!0,coverImg:d.coverImg,name:c.name||"",type:Ie(d.content),enableFlag:1,content:d.content}),c.uploadUrl="",c.name="",c.subjectIds=[],n.value.handleClearFile()}},null),e(N,{showFeedback:!1},{default:()=>[e(me,{value:c.name,"onUpdate:value":d=>c.name=d,placeholder:"请输入资源名称",maxlength:25,clearable:!0},null)]}),e(N,{showFeedback:!1},{default:()=>[e(ye,{value:c.subjectIds,"onUpdate:value":d=>c.subjectIds=d,placeholder:"请选择素材可用乐器(可多选)",options:t.getSubjectList,labelField:"name",valueField:"id",multiple:!0,maxTagCount:2,clearable:!0},{action:()=>e(L,null,[e(T,{text:!0,style:" --n-width: 100% ",onClick:()=>f(c,t.getSubjectList)},{default:()=>[y("全选")]})])})]})])]})]})]}),e(A,{class:R.btnGroup,justify:"center"},{default:()=>[e(T,{round:!0,onClick:()=>l("close")},{default:()=>[y("取消")]}),e(T,{round:!0,type:"primary",loading:c.uploading,disabled:c.list.length===0,onClick:s},{default:()=>[y("确定")]})]})])}}),ca=""+new URL("resource-default-ad56ce84.svg",import.meta.url).href,ua=""+new URL("resource-checked-e62fa301.svg",import.meta.url).href,ra=$({name:"myResources-guide",emits:["close"],setup(o,{emit:l}){const t=G({box:{height:"0px"},show:!1,steps:[{ele:"",eleRect:{},img:W("myResourecs1.png"),handStyle:{top:"0.91rem"},imgStyle:{top:I(-4),left:I(-240),width:I(556),height:I(257)},btnsStyle:{bottom:I(30),left:I(-80)},eleRectPadding:{left:14,top:14,width:28,height:28},boxStyle:{borderRadius:"30px"}}],step:0}),u=F(!1),r=localStorage.getItem("teacher-guideInfo");r&&JSON.parse(r).myResourcesGuide?u.value=!1:u.value=!0;const n=()=>{var p,f,d,h;const a=document.getElementById(`myResources-${t.step}`);if(a){const i=a.getBoundingClientRect(),m=((p=t.steps[t.step].eleRectPadding)==null?void 0:p.left)||0,v=((f=t.steps[t.step].eleRectPadding)==null?void 0:f.top)||0,M=((d=t.steps[t.step].eleRectPadding)==null?void 0:d.width)||0,P=((h=t.steps[t.step].eleRectPadding)==null?void 0:h.height)||0;t.box={left:i.x-m+"px",top:i.y-v+"px",width:i.width+M+"px",height:i.height+P+"px"},console.log(`coai-${t.step}`,t.box)}else g()};B(()=>{n(),window.addEventListener("resize",c)});const c=()=>{n()};re(()=>{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(L,null,[u.value?de(e("div",{"onUpdate:show":a=>u.value=a,class:["n-modal-mask","n-modal-mask-guide"]},[e("div",{class:w.content,onClick:()=>g()},[e("div",{class:w.backBtn,onClick:a=>{a.stopPropagation(),s()}},[y("跳过")]),e("div",{class:w.box,style:{...t.box,...t.steps[t.step].boxStyle},id:`modeType-${t.step}`},[t.steps.map((a,p)=>{var f,d,h,i;return e("div",{onClick:m=>m.stopPropagation(),class:w.item,style:a.type=="bottom"?{display:p===t.step?"":"none",left:`${(f=a.eleRect)==null?void 0:f.left}px`,top:`-${(d=a.imgStyle)==null?void 0:d.height}`}:{display:p===t.step?"":"none",left:`${(h=a.eleRect)==null?void 0:h.left}px`,top:`${(i=t.box)==null?void 0:i.height}`}},[e("img",{class:w.img,style:a.imgStyle,src:a.img},null),e("div",{class:w.btns,style:a.btnsStyle},[t.step+1==t.steps.length?e(L,null,[e("div",{class:[w.endBtn],onClick:()=>s()},[y("完成")])]):e("div",{class:w.btn,onClick:()=>g()},[y("下一步 ("),t.step+1,y("/"),t.steps.length,y(")")])])])})])])]),[[pe,u.value,"show"]]):null])}}),da=$({name:"share-resources",setup(){const o=Q();Ce();const l=G({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=F(!1),u=async()=>{try{l.loading=!0;const{data:s}=await oe({...l.searchGroup,...l.pagination});l.loading=!1,l.pageTotal=Number(s.total);const a=s.rows||[],p=[];a.forEach(f=>{p.push({id:f.id,coverImg:f.coverImg,type:f.type,title:f.name,isCollect:!!f.favoriteFlag,isSelected:f.sourceFrom==="PLATFORM",content:f.content,subjectId:f.subjectIds,enableFlag:f.enableFlag?1:0,openFlag:f.openFlag})}),l.tableList=p||[],setTimeout(()=>{t.value=!0},500)}catch(s){l.loading=!1}},r=async s=>{try{await ne({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 Be(l.editIds),o.success("删除成功"),n(l.searchGroup),l.editIds=[]}catch(s){}},g=async()=>{try{await _e({id:l.removeItem.id}),o.success("删除成功"),n(l.searchGroup)}catch(s){}};return B(()=>{u()}),()=>e(L,null,[e(qt,{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(p=>{a.push(p.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(J,{show:l.loading,"onUpdate:show":s=>l.loading=s,style:{"min-height":"50vh"}},{default:()=>[e("div",{class:_.list},[l.tableList.map(s=>e("div",{class:_.itemSection},[e(q,{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=>r(a)},null),l.editStatus&&e("div",{class:[_.itemBg,l.editIds.includes(s.id)?_.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:_.resourceDefault},null)])])),!l.loading&&l.tableList.length<=0&&e(fe,{style:{paddingTop:"30px"},description:"暂无资源"},null)])]}),e(le,{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(se,{show:l.show,"onUpdate:show":s=>l.show=s,item:l.item},null),e(z,{show:l.uploadStatus,"onUpdate:show":s=>l.uploadStatus=s,preset:"card",showIcon:!1,class:["modalTitle background",_.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(z,{show:l.removeVisiable,"onUpdate:show":s=>l.removeVisiable=s,preset:"card",class:["modalTitle",_.removeVisiable],title:"提示"},{default:()=>[e("div",{class:_.studentRemove},[e("p",null,[l.removeContent]),e(A,{class:_.btnGroupModal,justify:"center"},{default:()=>[e(T,{round:!0,type:"primary",onClick:()=>{l.type==="remove"?g():c(),l.removeVisiable=!1}},{default:()=>[y("确定")]}),e(T,{round:!0,onClick:()=>l.removeVisiable=!1},{default:()=>[y("取消")]})]})])]})])}}),pa="_list_xl13h_1",fa="_searchGroup_xl13h_9",ga="_btnType_xl13h_13",ha="_inputSearch_xl13h_47",ma="_searchCatatory_xl13h_71",ya="_addTrain_xl13h_78",ba="_spaceSection_xl13h_90",O={list:pa,searchGroup:fa,btnType:ga,inputSearch:ha,searchCatatory:ma,addTrain:ya,spaceSection:ba};function te(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!ue(o)}const va=$({name:"search-group",emits:["search"],setup(o,{emit:l}){const t=H(),u=F([]),r=G({type:"",name:"",bookVersionId:null,subjectId:null}),n=()=>{l("search",r)};return B(async()=>{u.value=[{label:"全部",value:""},...ce],await t.getMusicSheetCategory(),await t.getSubjects()}),()=>{let c,g,s;return e("div",{class:O.searchGroup},[e("div",{class:O.searchCatatory},[e(A,{size:"small",class:O.btnType},te(c=u.value.map(a=>e(T,{type:r.type===a.value?"primary":"default",secondary:r.type!==a.value,round:!0,size:"small",focusable:!1,onClick:()=>{r.type=a.value,n()}},{default:()=>[a.label]})))?c:{default:()=>[c]})]),e(K,{labelAlign:"left",labelPlacement:"left"},{default:()=>[r.type==="MUSIC"&&e(N,{label:"教材:"},{default:()=>[e(A,{class:O.spaceSection},te(g=t.getAllMusicCategories.map(a=>e(T,{secondary:r.bookVersionId===a.id,quaternary:r.bookVersionId!==a.id,strong:!0,focusable:!1,type:r.bookVersionId===a.id?"primary":"default",onClick:()=>{r.bookVersionId=a.id,n()}},{default:()=>[a.name]})))?g:{default:()=>[g]})]}),e(N,{label:"乐器:"},{default:()=>[e(A,{class:O.spaceSection},te(s=t.getSubjectAllList.map(a=>e(T,{secondary:r.subjectId===a.id,quaternary:r.subjectId!==a.id,strong:!0,focusable:!1,type:r.subjectId===a.id?"primary":"default",onClick:()=>{r.subjectId=a.id,n()}},{default:()=>[a.name]})))?s:{default:()=>[s]})]}),e(ie,{class:O.inputSearch,round:!0,onSearch:a=>{r.name=a,n()}},null)]})])}}}),Sa=$({name:"myColloge-guide",emits:["close"],setup(o,{emit:l}){const t=G({box:{height:"0px"},show:!1,steps:[{ele:"",img:W("myColloge1.png"),imgStyle:{top:I(-4),left:I(630),width:I(458),height:I(291)},btnsStyle:{bottom:I(96),left:I(790)},eleRectPadding:{left:7,top:7,width:14,height:14},type:"bottom"}],step:0}),u=F(!1),r=localStorage.getItem("teacher-guideInfo");r&&JSON.parse(r).myColloge?u.value=!1:u.value=!0;const n=()=>{var p,f,d,h;const a=document.getElementById(`myColloge-${t.step}`);if(a){const i=a.getBoundingClientRect(),m=((p=t.steps[t.step].eleRectPadding)==null?void 0:p.left)||0,v=((f=t.steps[t.step].eleRectPadding)==null?void 0:f.top)||0,M=((d=t.steps[t.step].eleRectPadding)==null?void 0:d.width)||0,P=((h=t.steps[t.step].eleRectPadding)==null?void 0:h.height)||0;t.box={left:i.x-m+"px",top:i.y-v+"px",width:i.width+M+"px",height:i.height+P+"px"},console.log(`coai-${t.step}`,t.box)}else g()};B(()=>{n(),window.addEventListener("resize",c)});const c=()=>{n()};re(()=>{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(L,null,[u.value?de(e("div",{"onUpdate:show":a=>u.value=a,class:["n-modal-mask","n-modal-mask-guide"]},[e("div",{class:w.content,onClick:()=>g()},[e("div",{class:w.backBtn,onClick:a=>{a.stopPropagation(),s()}},[y("跳过")]),e("div",{class:w.box,style:{...t.box},id:`modeType-${t.step}`},[t.steps.map((a,p)=>{var f,d,h,i;return e("div",{onClick:m=>m.stopPropagation(),class:w.item,style:a.type=="bottom"?{display:p===t.step?"":"none",left:`${(f=a.eleRect)==null?void 0:f.left}px`,top:`-${(d=a.imgStyle)==null?void 0:d.height}`}:{display:p===t.step?"":"none",left:`${(h=a.eleRect)==null?void 0:h.left}px`,top:`${(i=t.box)==null?void 0:i.height}`}},[e("img",{class:w.img,style:a.imgStyle,src:a.img},null),e("div",{class:w.btns,style:a.btnsStyle},[t.step+1==t.steps.length?e(L,null,[e("div",{class:[w.endBtn],onClick:()=>s()},[y("完成")])]):e("div",{class:w.btn,onClick:()=>g()},[y("下一步 ("),t.step+1,y("/"),t.steps.length,y(")")])])])})])])]),[[pe,u.value,"show"]]):null])}}),_a=$({name:"share-resources",setup(){const o=Q(),l=Ce(),t=G({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 oe({...t.searchGroup,...t.pagination});t.loading=!1,t.pageTotal=Number(s.total);const a=s.rows||[],p=[];a.forEach(f=>{p.push({id:f.id,coverImg:f.coverImg,type:f.type,title:f.name,isCollect:!!f.favoriteFlag,isSelected:f.sourceFrom==="PLATFORM",content:f.content,subjectId:f.subjectIds,enableFlag:f.enableFlag?1:0,openFlag:f.openFlag})}),t.tableList=p||[],setTimeout(()=>{r.value=!0},500)}catch(s){t.loading=!1}},r=F(!1),n=async s=>{t.pagination.page=1,t.searchGroup=Object.assign(t.searchGroup,s),u()},c=async s=>{try{await ne({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 _e({id:s.id}),o.success("删除成功"),n(t.searchGroup)}})}catch(a){}};return B(()=>{u()}),()=>e(L,null,[e(va,{onSearch:s=>n(s)},null),e(J,{show:t.loading,"onUpdate:show":s=>t.loading=s,style:{"min-height":"50vh"}},{default:()=>[e("div",{class:O.list,id:"myColloge-0"},[t.tableList.map(s=>e(q,{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(fe,{description:"暂无收藏资源"},null)])]}),e(le,{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(se,{show:t.show,"onUpdate:show":s=>t.show=s,item:t.item},null),r.value?e(Sa,null,null):null])}}),ja=$({name:"student-studentList",setup(){return()=>e("div",{class:ee.listWrap},[e(ze,{defaultValue:"myResources",paneClass:ee.paneTitle,justifyContent:"center",animated:!0,paneWrapperClass:ee.paneWrapperContainer},{default:()=>[e(X,{name:"myResources",tab:"我的资源"},{default:()=>[e(da,null,null)]}),e(X,{name:"shareResources",tab:"共享资源"},{default:()=>[e(mt,null,null)],tab:()=>e("span",{id:"shareResources-0"},[y("共享资源")])}),e(X,{name:"myCollect",tab:"我的收藏"},{default:()=>[e(_a,null,null)]})]})])}});export{ja as default};
|