catchData-legacy-30876512-1743496079034.js 4.4 KB

1
  1. System.register(["./index-legacy-db852529-1743496079034.js","./deep-clone-legacy-0f45d9f6-1743496079034.js"],(function(e,t){"use strict";var s,a,r,i,n,u,l;return{setters:[e=>{s=e.ab,a=e.bi,r=e.aM,i=e.dt,n=e.du,u=e.dv},e=>{l=e.d}],execute:function(){e("m",(e=>s.post("/edu-app/material/queryPage",{data:e}))),e("f",(e=>s.post("/edu-app/material/favorite",{data:e}))),e("c",(e=>s.post("/edu-app/material/remove",{requestType:"form",data:e}))),e("g",(e=>s.post("/edu-app/lessonCourseware/save",{data:e}))),e("d",(e=>s.post("/edu-app/material/save",{data:e}))),e("b",(e=>s.post("/edu-app/material/updateAll",{data:e}))),e("a",(e=>s.post("/edu-app/material/removeMusic",{data:e})));const t=e("e",(e=>s.post("/edu-app/materialTag/page",{data:e})));e("u",a("catch-store",{state:()=>({bookVersionList:[],musicTypeList:[],subjectList:[],musicInstrumentList:[],subjectInstruemnts:[],musicTagTree:[],materialTags:[]}),getters:{getBookVersion(){return this.bookVersionList},getMusicCategories(){return this.musicTypeList},getMusicInstruments(){return this.musicInstrumentList},getAllMusicCategories(){return[{name:"全部",id:null},...this.musicTypeList]},getSubjectList(){return this.subjectList},getSubjectAllList(){return[{name:"全部",id:null},...this.subjectList]},getEnableSubjects(){const e=[];return this.subjectList.forEach((t=>{if(t.enableFlag){const{instruments:s,...a}=t;if(s&&s.length>0){const t=[];s?.forEach((e=>{e.enableFlag&&t.push(e)})),t.length>0&&e.push({...a,instruments:t})}}})),e},getSubjectInstruments(){return[{name:"全部",id:null,label:"全部",value:null},...this.subjectInstruemnts]},getSubjectInstrumentOnly(){return this.subjectInstruemnts},getMusicTagTree(){return this.musicTagTree},getMaterialTags(){return this.materialTags},getAllMaterialTags(){return[{label:"全部",value:null},...this.materialTags]}},actions:{setBookVersion(e){this.bookVersionList=e},setMusicCategories(e){this.musicTypeList=e},setSubjects(e){this.subjectList=e},setSubjectInstruemnts(e){this.subjectInstruemnts=e},setMusicInstruments(e){this.musicInstrumentList=e},setMusicTagTree(e){this.musicTagTree=e},setMaterialTags(e){this.materialTags=e},async getSubjects(){try{if(this.getSubjectList&&this.getSubjectList.length>0)return Promise.resolve();const{data:e}=await r({delFlag:0,page:1,rows:999}),t=e||[],s=[];return t.forEach((e=>{if(e.instruments&&e.instruments.length>0){e.value=e.id,e.label=e.name,e.instruments.forEach((e=>{e.label=e.name,e.value=e.id}));const t={value:e.id,label:e.name,id:e.id,name:e.name,instruments:[]};e.instruments&&(1==e.instruments.length?(t.value=e.instruments[0].id,t.label=e.instruments[0].name,t.id=e.id,t.name=e.name):e.instruments.length>1&&e.instruments.forEach((e=>{e.label=e.name,e.value=e.id,t.instruments.push({label:e.name,value:e.id,id:e.id,name:e.name})}))),s.push(t)}})),this.setSubjects(t.filter((e=>e.instruments&&e.instruments.length>0))||0),this.setSubjectInstruemnts(s||[]),Promise.resolve()}catch(e){return Promise.reject(e)}},getEnableSingleAllSubjects(e){e=e||[];const t=[];this.getSubjectList.forEach((s=>{const a=l(s);Array.isArray(a.instruments)&&a.instruments.forEach((t=>{e.includes(t.id)&&(t.enableFlag=!0,a.enableFlag=!0)})),t.push(a)}));const s=[];return t.forEach((e=>{if(e.enableFlag){const{instruments:t,...a}=e,r=[];t?.forEach((e=>{e.enableFlag&&r.push(e)})),r.length>0&&s.push({...a,instruments:r})}})),s},async getMusicSheetCategory(e=!1){try{if(this.getMusicCategories&&this.getMusicCategories.length>0&&!e)return Promise.resolve();const{data:t}=await i({enable:!0,page:1,rows:999});return this.setMusicCategories(t.rows||[]),Promise.resolve()}catch(t){return Promise.reject(t)}},async getMusicInstrument(){try{if(this.getMusicInstruments&&this.getMusicInstruments.length>0)return Promise.resolve();const{data:e}=await n({enableFlag:!0});return console.log(e,"data"),this.setMusicInstruments(e||[]),Promise.resolve()}catch(e){return Promise.reject(e)}},async getMusicTagTreeApi(){try{if(this.getMusicTagTree&&this.getMusicTagTree.length>0)return Promise.resolve();const{data:e}=await u(),t=e||[];return this.setMusicTagTree(t||[]),Promise.resolve()}catch(e){return Promise.reject(e)}},async getMaterialTagsApi(){try{if(this.getMaterialTags&&this.getMaterialTags.length>0)return Promise.resolve();const{data:e}=await t({page:1,rows:100}),s=e.rows||[],a=[];return s.forEach((e=>{a.push({label:e.name,value:e.id})})),this.setMaterialTags(a||[]),Promise.resolve()}catch(e){return Promise.reject(e)}}}}))}}}));