import{d as g,l as h,a as t,g as d,B as _,aj as m,ak as v,s as o,a4 as p,H as f,T as S,P as j,K as C,b as I}from"./App.03d0734f.js";import{I as L}from"./index.9b042762.js";const E="_container_1e2y6_1",N="_subjectcontent_1e2y6_24",F="_subjectlist_1e2y6_30",w="_subjectItem_1e2y6_38",k="_active_1e2y6_50",q="_button_1e2y6_55";var l={container:E,subjectcontent:N,subjectlist:F,subjectItem:w,active:k,button:q},y=g({name:"choosePartName",props:{isRem:{type:Boolean,default:!0},partNames:{type:Array,default:()=>[]},onSelectedPartName:{type:Function,default:e=>{}}},async mounted(){try{const e=await h.post("/subject/list");this.subjectList=e.data||[]}catch{}},data(){return{selectedPart:{},subjectList:[]}},methods:{onDetail(e){console.log(e),this.subjectList.forEach(r=>{r.checked=!1}),e.checked=!0,this.selectedPart=e}},render(){return t("div",{class:l.container},[t("h3",null,[d("\u8BF7\u9009\u62E9\u60A8\u7EC3\u4E60\u7684\u58F0\u90E8")]),t("div",{class:l.subjectcontent},[t("div",{class:l.subjectlist},[this.subjectList.map(e=>t("div",{key:e.id,onClick:()=>this.onDetail(e),class:[l.subjectItem,e.checked?l.active:null]},[e.name]))])]),t(_,{class:l.button,type:"primary",round:!0,block:!0,color:"#01C1B5",onClick:()=>this.onSelectedPartName(this.selectedPart)},{default:()=>[d("\u786E\u5B9A")]})])}});const B="_headerTips_1b9xq_1",x="_btn_1b9xq_23",T="_container_1b9xq_34",M="_content_1b9xq_39",P="_items_1b9xq_44",A="_inner_1b9xq_55",$="_img_1b9xq_59";var n={headerTips:B,btn:x,container:T,content:M,items:P,inner:A,img:$};const D=I();var O=g({name:"baseClass",components:{ChooseSubjectName:y},data(){return{list:[],show:!0,closeStatus:!0,courseNum:0}},mounted(){document.addEventListener("visibilitychange",this.visibilitychange,!1),localStorage.setItem("behaviorId",m()),this.FetchList(),v(["_trackEvent","\u4E91\u6559\u7EC3","\u5207\u6362\u9875\u9762","\u5206\u7C7B\u9875\u9762"]),o.subjectId=o.origanSubjectId,p()==="/api-student"&&this.FetchCourseInfo()},unmounted(){document.removeEventListener("visibilitychange",this.visibilitychange,!1)},computed:{chooseShow(){return!!(p()==="/api-student"&&!o.subjectLoading&&o.subjectId===0&&this.closeStatus)}},methods:{visibilitychange(){document.visibilityState!=="hidden"&&this.courseNum>0&&this.FetchCourseInfo()},async FetchCourseInfo(){try{const e=await h("/activityUserMapper/getStudentNoCourseInfo");this.courseNum=e.data.courseNum}catch{}},async FetchList(){try{const e=await h.get("/sysMusicScoreCategories/queryTree");this.list=await this.filterList(e.data||[])||[],this.show=this.list.length>0}catch{}},filterList(e){const r=o.tenantId;o.organId;let a=[];if(r!=1)return e;e.forEach(s=>{const u=s.sysMusicScoreCategoriesList||[];let c=[];s.id===38?a.includes(55)?c=u:a.includes(59)?u.forEach(i=>{i.id==30&&c.push(i)}):!a.includes(55)&&!a.includes(59)&&u.forEach(i=>{i.id!=30&&c.push(i)}):s.id===40?a.includes(59)?u.forEach(i=>{i.id!=47&&c.push(i)}):a.includes(59)||u.forEach(i=>{c.push(i)}):c=u,s.sysMusicScoreCategoriesList=c});let b=[];return e.forEach(s=>{s.id==40&&s.sysMusicScoreCategoriesList&&s.sysMusicScoreCategoriesList.length>0&&b.push(s),s.id!=40&&b.push(s)}),b},onClickLeft(){D.isApp&&f({api:"back"})},toDetail(e){var a;const r=e.sysMusicScoreCategoriesList?e.sysMusicScoreCategoriesList.length:0;sessionStorage.setItem("musicScoreList",JSON.stringify(e.sysMusicScoreCategoriesList)),r>1?this.$router.push({path:"/classify",query:{parentId:e.id,...this.$route.query}}):this.$router.push({path:"/list/"+(r==1?(a=e.sysMusicScoreCategoriesList[0])==null?void 0:a.id:e.id),query:{...this.$route.query}})},audition(){f({api:"openWebView",content:{url:location.origin+"/#/auditionLive",orientation:1,isHideTitle:!1,statusBarTextColor:!1,isOpenLight:!1}})},async onSelectedPartName(e){if(!e.id){S("\u8BF7\u9009\u62E9\u58F0\u90E8");return}try{await h.post("/student/updateSubject",{data:{subjectId:e.id}}),this.chooseShow=!1,o.subjectId=e.id,o.origanSubjectId=e.id}catch{}}},render(){return t("div",{class:n.container},[t(j,{show:this.chooseShow,teleport:"body",style:{borderRadius:"8px"}},{default:()=>[t(y,{onSelectedPartName:this.onSelectedPartName},null)]}),t("div",{class:n.content},[p()==="/api-student"&&this.courseNum>0&&t("div",{class:n.headerTips},[t("p",null,[d("\u968F\u5FC3\u5B66\u771F\u4EBA\u8F85\u5BFC\u8BFE\u5269\u4F59 "),t("span",null,[this.courseNum]),d(" \u8282")]),t(_,{class:n.btn,onClick:this.audition},{default:()=>[d("\u7ACB\u5373\u7EA6\u8BFE")]})]),t("div",{class:n.items},[this.show?this.list.map(e=>t("div",{key:e.id,onClick:()=>this.toDetail(e)},[t("div",{class:n.inner},[t(L,{src:e.coverImg,class:n.img},null)])])):t(C,{description:"\u6682\u65E0\u6570\u636E"},null)])])])}});export{O as default};