1 |
- import{d as c,g as n,y as d,j as t,A as a,F as o,B as u}from"./ResizeObserver.es.f28023e0.js";import{T as l}from"./index.af901340.js";import{S as h}from"./index.b0753b8c.js";const p="_filterTitle_g9vbz_1",b="_searchResult_g9vbz_9",m="_searchTitle_g9vbz_14",f="_radio_g9vbz_19",g="_btn_g9vbz_56";var e={filterTitle:p,searchResult:b,searchTitle:m,"radio-group":"_radio-group_g9vbz_19",radio:f,"organ-radio":"_organ-radio_g9vbz_49",btn:g},S=c({name:"selectSubject",props:{isReset:{type:Boolean,default:!1},searchParams:{type:Object,default:{name:"",id:""}},type:{type:String,default:"MUSIC"},isShowAllSubject:{type:Boolean,default:!1},onComfirm:{type:Function,default:s=>{}}},data(){return{subject:{name:"\u5168\u90E8\u58F0\u90E8",id:""},subjectList:[],apiSuffix:n.platformType==="STUDENT"?"/api-student":"/api-teacher"}},mounted(){console.log(this.subject,"12"),this.subject={name:this.searchParams.id?this.searchParams.name:"\u5168\u90E8\u58F0\u90E8",id:this.searchParams.id||""},this.getList()},methods:{async getList(){const{data:s}=await d.get(`${this.apiSuffix}/subject/subjectSelect?type=${this.type}`);Array.isArray(s)&&(this.subjectList=s)}},render(){return t(o,null,[t("div",{class:e.filterTitle},[a("\u5168\u90E8\u58F0\u90E8")]),t("div",{class:e.searchResult,style:{maxHeight:"45vh",overflowY:"auto"}},[this.isShowAllSubject&&t("div",{class:[e["radio-group"],e.radio,e["organ-radio"]]},[t(l,{size:"large",plain:this.subject.id=="",type:this.subject.id==""?"primary":"default",round:!0,onClick:()=>{this.subject={id:"",name:"\u5168\u90E8\u58F0\u90E8"}}},{default:()=>[a("\u5168\u90E8\u58F0\u90E8")]})]),this.subjectList.map(s=>s.subjects&&s.subjects.length>0&&t(o,null,[t("div",{class:e.searchTitle},[s.name]),t("div",{class:[e["radio-group"],e.radio,e["organ-radio"]]},[s.subjects.map(i=>{const r=i.id===Number(this.subject.id);return t(l,{size:"large",plain:r,type:r?"primary":"default",round:!0,onClick:()=>{this.subject={...i}}},{default:()=>[i.name]})})])]))]),t(h,{position:"bottom",offsetBottom:0},{default:()=>[t("div",{class:["btnGroup",this.isReset?"btnMore":""]},[this.isReset&&t(u,{type:"primary",plain:!0,round:!0,onClick:()=>{this.subject.name="\u5168\u90E8\u58F0\u90E8",this.subject.id="",this.onComfirm({...this.subject})}},{default:()=>[a("\u91CD \u7F6E")]}),t(u,{type:"primary",round:!0,block:!0,onClick:()=>{this.onComfirm({...this.subject})}},{default:()=>[a("\u786E \u8BA4")]})])]})])}});export{S};
|