select-subject.f61520d8.js 2.0 KB

1
  1. import{d as c,g as n,w as l,j as t,z as i,F as o,B as u}from"./index.e6d6174e.js";import{T as d}from"./index.05f2b7dd.js";import{S as h}from"./index.9093bc60.js";const p="_filterTitle_1bpah_1",m="_searchResult_1bpah_9",b="_searchTitle_1bpah_14",f="_radio_1bpah_19",y="_btn_1bpah_56";var s={filterTitle:p,searchResult:m,searchTitle:b,"radio-group":"_radio-group_1bpah_19",radio:f,"organ-radio":"_organ-radio_1bpah_49",btn:y},S=c({name:"selectSubject",props:{isReset:{type:Boolean,default:!1},searchParams:{type:Object,default:{name:"",id:""}},type:{type:String,default:"MUSIC"},onComfirm:{type:Function,default:e=>{}}},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:e}=await l.get(`${this.apiSuffix}/subject/subjectSelect?type=${this.type}`);Array.isArray(e)&&(this.subjectList=e)}},render(){return t(o,null,[t("div",{class:s.filterTitle},[i("\u5168\u90E8\u58F0\u90E8")]),t("div",{class:s.searchResult,style:{maxHeight:"45vh",overflowY:"auto"}},[this.subjectList.map(e=>e.subjects&&e.subjects.length>0&&t(o,null,[t("div",{class:s.searchTitle},[e.name]),t("div",{class:[s["radio-group"],s.radio,s["organ-radio"]]},[e.subjects.map(a=>{const r=a.id===Number(this.subject.id);return t(d,{size:"large",plain:r,type:r?"primary":"default",round:!0,onClick:()=>{this.subject={...a}}},{default:()=>[a.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:()=>[i("\u91CD \u7F6E")]}),t(u,{type:"primary",round:!0,block:!0,onClick:()=>{this.onComfirm({...this.subject})}},{default:()=>[i("\u786E \u8BA4")]})])]})])}});export{S};