1 |
- import{s as r,F as de}from"./forgotPassword-c437b2d7.js";import{d as ie}from"./teacherIcon-b8e3946d.js";import{m as ue,f as ce}from"./maleIcon-3fe0e51e.js";import{V as A,d as P,b as W,c as H,e as F,r as S,q as ne,f as e,o as $,k as d,N as V,cm as pe,cn as M,g as b,h as U,S as fe,U as C,j as f,y as O,ct as ge,aj as he,bd as me,ak as le,z as oe,cu as be,c8 as ve,x as ye,cg as Ce,a as Ie,w as ke,m as we,n as te}from"./index-bfbabd78.js";import{U as se}from"./index-846a90f4.js";import{N as K}from"./Cascader-b1fd90a6.js";import{T as _e,l as xe}from"./logo-062e9899.js";import"./api-ace97cd8.js";const Te=""+new URL("headerD-220e6507.png",import.meta.url).href,Fe=t=>A.post("/edu-app/teacher/page",{data:t}),Le=t=>A.post("/edu-app/teacher/add",{data:t}),Ee=t=>A.post("/edu-app/teacher/updateStatus",{data:t}),Ae=t=>A.post("/edu-app/user/resetPassword",{data:t,requestType:"form"}),Be=t=>A.post("/edu-app/school/update",{data:t}),re=()=>A.get("/edu-app/open/sysArea/queryAllProvince"),qe=P({name:"setting-personInfo",setup(){var v,I,x,k;const t=W(),n=H(),c=F({sexs:[{label:"男",value:1,class:"option"},{label:"女",value:0,class:"option"}],areaList:[]}),o=S(),s=F({provinceCode:n.info.provinceCode,cityCode:n.info.cityCode,regionCode:n.info.regionCode,nickname:n.info.nickname,phone:n.info.phone,gender:n.info.gender,schoolId:(I=(v=n.info.schoolInfos)==null?void 0:v[0])==null?void 0:I.id,tenantId:(k=(x=n.info.schoolInfos)==null?void 0:x[0])==null?void 0:k.tenantId,id:n.info.id,avatar:n.info.avatar}),l=F({disabled:!0,openChangePwd:!1,uploadShow:!0}),h=async()=>{const p=await re();(p==null?void 0:p.code)===200&&(c.areaList=p.data)};ne(()=>{h()});const L=()=>{o.value.validate(async p=>{if(!p){if(!s.provinceCode||!s.cityCode){t.error("请选择城区");return}await ge(s),console.log(s),n.getInfo(),l.disabled=!0,t.success("修改成功")}})};return()=>{var p,T;return e("div",{class:r.infoWrap},[e("div",{class:r.teacherInfoWrap},[e("div",{class:r.teacherHeadWrap},[e($,{previewDisabled:!0,class:r.headerD,src:Te},null),e($,{previewDisabled:!0,class:r.defultHeade,src:s.avatar||ie},null),e("div",{style:{display:l.disabled?"none":""},class:[r.defultHeade,r.changeHead]},[d("修改头像"),l.uploadShow&&e(se,{class:[r.uploadFile],cropper:!0,"onUpdate:fileList":i=>{s.avatar=i,l.uploadShow=!1,setTimeout(()=>{l.uploadShow=!0},100)}},null)])]),e("div",{class:r.headerInfo},[e("p",{class:r.headerTitle},[n.info.nickname,n.info.gender!==null&&e($,{previewDisabled:!0,class:r.sexIcon,src:n.info.gender?ue:ce},null)]),e("p",{class:r.headerSubTitle},[(T=(p=n.info.schoolInfos)==null?void 0:p[0])==null?void 0:T.name,d(" | 音乐老师")])])]),e("div",{class:r.setInfo},[e(V,{ref:o,model:s,disabled:l.disabled},{default:()=>[e(pe,{cols:3,"x-gap":"100"},{default:()=>[e(M,null,{default:()=>[e(b,{label:"姓名",path:"nickname",rule:[{required:!0,message:"请输入老师姓名",trigger:"blur"},{pattern:/^(?:[\u4e00-\u9fa5·]{2,16})$/,message:"请输入中文姓名,不要包含空格,及特殊符号",trigger:"blur"}]},{default:()=>[e(U,{maxlength:14,bordered:!l.disabled,placeholder:"请填写老师姓名",value:s.nickname,"onUpdate:value":i=>s.nickname=i},null)]})]}),e(M,null,{default:()=>[e(b,{label:"手机号",path:"phone",rule:[{required:!0,message:"请填写老师手机号",trigger:"blur"},{pattern:/^1[3456789]\d{9}$/,message:"手机号格式不正确",trigger:"blur"}]},{default:()=>[e(U,{bordered:!l.disabled,placeholder:"请填写老师手机号",value:s.phone,"onUpdate:value":i=>s.phone=i},null)]})]}),e(M,null,{default:()=>[e(b,{label:"性别",path:"gender",rule:[{required:!0,type:"number",message:"请选择性别",trigger:"blur"}]},{default:()=>[e(fe,{bordered:!l.disabled,class:r.select,showArrow:!l.disabled,placeholder:"请选择性别",options:c.sexs,value:s.gender,"onUpdate:value":i=>s.gender=i},null)]})]}),e(M,null,{default:()=>[e(b,{label:"城区",path:"provinceCode",rule:{required:!0,type:"number",message:"请选择城区",trigger:"change"}},{default:()=>[e(K,{bordered:!l.disabled,options:c.areaList,labelField:"name",valueField:"code",childrenField:"areas",checkStrategy:"child",expandTrigger:"hover",defaultValue:n.info.regionCode||n.info.cityCode||n.info.provinceCode,"onUpdate:value":(i,E,y)=>{var w,B,q;s.provinceCode=(w=y[0])==null?void 0:w.code,s.cityCode=(B=y[1])==null?void 0:B.code,s.regionCode=(q=y[2])==null?void 0:q.code}},null)]})]})]})]})]),l.disabled?e(C,{class:r.btnList,align:"center",justify:"end"},{default:()=>[e(f,{class:r.btn,color:"#198cfe",onClick:()=>l.openChangePwd=!0},{default:()=>[d("修改密码")]}),e(f,{class:r.btn,color:"#f24433",onClick:()=>l.disabled=!1},{default:()=>[d("修改信息")]})]}):e(C,{class:r.btnList,align:"center",justify:"end"},{default:()=>[e(f,{class:r.btn,onClick:()=>{var i;l.disabled=!0,(i=o.value)==null||i.restoreValidation()}},{default:()=>[d("取消")]}),e(f,{class:r.btn,type:"primary",onClick:()=>L()},{default:()=>[d("完成")]})]}),e(O,{class:r.changePwdModal,show:l.openChangePwd,"onUpdate:show":i=>l.openChangePwd=i,preset:"dialog",showIcon:!1,title:"修改密码"},{default:()=>[e(de,{phone:n.info.phone,onClose:()=>{l.openChangePwd=!1}},null)]})])}}}),Ne="_logo_1g0fd_1",De="_changeHead_1g0fd_8",Se="_uploadFile_1g0fd_29",Ue="_formWrap_1g0fd_37",Pe="_schoolInfo_1g0fd_62",Me="_errorBtn_1g0fd_83",$e="_addTeacher_1g0fd_86",He="_btnList_1g0fd_160",Re="_btn_1g0fd_160",g={logo:Ne,changeHead:De,uploadFile:Se,formWrap:Ue,schoolInfo:Pe,errorBtn:Me,addTeacher:$e,btnList:He,btn:Re},je={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},ze=le("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 112v288"},null,-1),Oe=le("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M400 256H112"},null,-1),We=[ze,Oe],Ve=P({name:"Add",render:function(n,c){return me(),he("svg",je,We)}}),Ke=P({name:"teacher-operation",emits:["close"],props:{areaList:{type:Array,default:()=>[]}},setup(t,{emit:n}){var v,I,x,k;const c=H(),o=F({provinceCode:"",cityCode:"",regionCode:"",tenantId:(I=(v=c.info.schoolInfos)==null?void 0:v[0])==null?void 0:I.tenantId,phone:null,schoolId:(k=(x=c.info.schoolInfos)==null?void 0:x[0])==null?void 0:k.id,nickname:null,gender:1}),s=S(!1),l=S(),h=W(),L=async()=>{l.value.validate(async p=>{if(!p){try{s.value=!0,await Le({...o}),h.success("添加成功")}catch(T){console.log(T)}setTimeout(()=>{s.value=!1,n("close")},100)}})};return()=>e("div",null,[e(V,{model:o,ref:l,showRequireMark:!1,"label-placement":"left","label-width":"126"},{default:()=>[e(b,{label:"老师姓名",path:"nickname",rule:[{required:!0,message:"请输入老师姓名",trigger:"blur"},{pattern:/^(?:[\u4e00-\u9fa5·]{2,16})$/,message:"请输入中文姓名,不要包含空格,及特殊符号",trigger:"blur"}]},{default:()=>[e(U,{value:o.nickname,"onUpdate:value":p=>o.nickname=p,placeholder:"请输入老师姓名",clearable:!0,maxlength:14},null)]}),e(b,{label:"老师性别",path:"gender",rule:[{required:!0,message:"请选择老师性别"}]},{default:()=>[e(C,null,{default:()=>[e(oe("n-button"),{class:"genderBtn",type:o.gender?"info":void 0,tertiary:!o.gender,onClick:()=>{o.gender=1}},{default:()=>[d("男")]}),e(oe("n-button"),{class:"genderBtn",type:o.gender?void 0:"info",tertiary:!!o.gender,onClick:()=>{o.gender=0}},{default:()=>[d("女")]})]})]}),e(b,{label:"城区",path:"provinceCode",rule:[{required:!0,message:"请选择城区",trigger:"change"}]},{default:()=>[e(K,{to:"body",placeholder:"请选择城区",options:t.areaList,labelField:"name",valueField:"code",childrenField:"areas",checkStrategy:"child",expandTrigger:"hover","onUpdate:value":(p,T,i)=>{var E,y,w;o.provinceCode=((E=i[0])==null?void 0:E.code)+"",o.cityCode=(y=i[1])==null?void 0:y.code,o.regionCode=(w=i[2])==null?void 0:w.code}},null)]}),e(b,{label:"手机号",path:"phone",rule:[{required:!0,message:"请输入正确的手机号码",trigger:"blur"},{pattern:/^((13[0-9])|(14(0|[5-7]|9))|(15([0-3]|[5-9]))|(16(2|[5-7]))|(17[0-8])|(18[0-9])|(19([0-3]|[5-9])))\d{8}$/,message:"请输入正确的手机号",trigger:"blur"}]},{default:()=>[e(U,{maxlength:11,value:o.phone,"onUpdate:value":p=>o.phone=p,placeholder:"请输入手机号",clearable:!0},null)]}),e("div",{class:"nalert"},[e(be,{type:"error",showIcon:!1,bordered:!1},{default:()=>[d("默认密码为ktyq+手机号后四位")]})])]}),e(C,{style:{padding:"20px 0 32px 0"},justify:"center"},{default:()=>[e(f,{class:"actionBtn",round:!0,type:"default",onClick:()=>n("close")},{default:()=>[d("取消")]}),e(f,{class:"actionBtn",round:!0,type:"primary",onClick:()=>L(),loading:s.value},{default:()=>[d("确定")]})]})])}}),Ge=P({name:"school-info",setup(){var E,y,w,B,q,G,Q,J,X,Y;const t=H(),n=F({areaList:[]}),c=F({name:(y=(E=t.info.schoolInfos)==null?void 0:E[0])==null?void 0:y.name,logo:((B=(w=t.info.schoolInfos)==null?void 0:w[0])==null?void 0:B.logo)||t.info.avatar,provinceCode:((G=(q=t.info.schoolInfos)==null?void 0:q[0])==null?void 0:G.provinceCode)||"",cityCode:((J=(Q=t.info.schoolInfos)==null?void 0:Q[0])==null?void 0:J.cityCode)||"",regionCode:((Y=(X=t.info.schoolInfos)==null?void 0:X[0])==null?void 0:Y.regionCode)||""}),o=F({loading:!1,schoolLoading:!0,dataList:[],disabled:!0,modal:!1,qrModal:!1}),s=()=>[{title:"老师姓名",key:"nickname",render:a=>e("div",{style:{userSelect:"all",cursor:"pointer"},onClick:()=>i(a.nickname)},[a.nickname])},{title:"手机号码",key:"phone",render:a=>e("div",{style:{userSelect:"all",cursor:"pointer"},onClick:()=>i(a.phone)},[a.phone])},{title:"性别",key:"questionTypeCode",render:a=>e("div",null,[a.gender?"男":"女"])},{title:"状态",key:"statusName",render:a=>e("div",null,[a.status==="ACTIVATION"?e(f,{text:!0},{default:()=>[d("启用")]}):e(f,{class:g.errorBtn,text:!0},{default:()=>[d("冻结")]})])},{title:"操作",key:"titleImg",render:a=>e(C,null,{default:()=>[e(f,{type:"primary",quaternary:!0,size:"small",onClick:()=>x(a)},{default:()=>[d("重置密码")]}),a.status==="ACTIVATION"?e(f,{disabled:a.jobType==="ADMIN",type:"primary",quaternary:!0,size:"small",onClick:()=>I(a)},{default:()=>[d("冻结")]}):e(f,{class:g.errorBtn,quaternary:!0,size:"small",onClick:()=>I(a)},{default:()=>[d("解冻")]})]})}],l=async()=>{const a=await re();(a==null?void 0:a.code)===200&&(n.areaList=a.data)},h=async()=>{var u,m,_;o.loading=!0;const a=await Fe({schoolId:(m=(u=t.info.schoolInfos)==null?void 0:u[0])==null?void 0:m.id,page:1,rows:1e3});o.loading=!1,(a==null?void 0:a.code)===200&&Array.isArray((_=a==null?void 0:a.data)==null?void 0:_.rows)&&(o.dataList=a.data.rows)};ne(()=>{l(),h()});const L=ve(),v=W(),I=a=>{const u=a.status==="LOCKED"?"解冻":"冻结";L.warning({title:"温馨提示",content:`是否${u}"${a.nickname}"?`,positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{await Ee({ids:[a.id],status:a.status==="LOCKED"?"ACTIVATION":"LOCKED"}),h(),v.success(u+"成功")}})},x=a=>{L.warning({title:"警告",content:`重置"${a.nickname}"的密码,是否继续?`,positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{await Ae({userId:a.id,password:"ktyq"+a.phone.substr(7),clientType:"TEACHER"}),v.success("重置成功")}})},k=S(),p=()=>{var a;(a=k.value)==null||a.validate(async u=>{var m;u||(o.schoolLoading=!1,await Be({...(m=t.info.schoolInfos)==null?void 0:m[0],...c}),o.schoolLoading=!0,v.success("修改成功"),o.disabled=!0)})},T=()=>{var m,_,N,D,R,j;const a=`tenantId=${(_=(m=t.info.schoolInfos)==null?void 0:m[0])==null?void 0:_.tenantId}&schoolId=${(D=(N=t.info.schoolInfos)==null?void 0:N[0])==null?void 0:D.id}&schoolName=${(j=(R=t.info.schoolInfos)==null?void 0:R[0])==null?void 0:j.name}`,u=`${location.origin}/classroom-app/#/teaher-register?`+a;return console.log(u),u},i=a=>{const u=document.createElement("input");u.value=a,document.body.appendChild(u),u.select(),u.setSelectionRange(0,u.value.length),document.execCommand("Copy"),document.body.removeChild(u),v.success("复制成功")};return()=>e("div",{class:g.schoolInfo},[e(V,{ref:k,class:g.formWrap,model:c,style:{padding:"30px 0"},disabled:o.disabled},{default:()=>[e(C,{size:[30,20]},{default:()=>[e("div",{class:g.logo},[e($,{previewDisabled:!1,width:100,height:100,src:c.logo},null),e("div",{style:{display:o.disabled?"none":""},class:g.changeHead},[d("修改头像"),o.schoolLoading&&e(se,{class:[g.uploadFile],cropper:!0,"onUpdate:fileList":a=>{c.logo=a}},null)])]),e(b,{label:"学校名称",path:"name",showRequireMark:!1,rule:[{required:!0,message:"请填写学校名称",trigger:"blur"}]},{default:()=>[e(U,{bordered:!o.disabled,maxlength:20,value:c.name,"onUpdate:value":a=>c.name=a},null)]}),e(b,{label:"城区"},{default:()=>{var a,u,m,_,N,D;return[e(K,{placeholder:"请选择城区",bordered:!o.disabled,options:n.areaList,labelField:"name",valueField:"code",childrenField:"areas",checkStrategy:"child",expandTrigger:"hover",defaultValue:((u=(a=t.info.schoolInfos)==null?void 0:a[0])==null?void 0:u.regionCode)||((_=(m=t.info.schoolInfos)==null?void 0:m[0])==null?void 0:_.cityCode)||((D=(N=t.info.schoolInfos)==null?void 0:N[0])==null?void 0:D.provinceCode),"onUpdate:value":(R,j,z)=>{var Z,ee,ae;c.provinceCode=(Z=z[0])==null?void 0:Z.code,c.cityCode=(ee=z[1])==null?void 0:ee.code,c.regionCode=(ae=z[2])==null?void 0:ae.code}},null)]}}),e(b,null,{default:()=>[o.disabled?e(C,{class:g.btnList,align:"center",justify:"end"},{default:()=>[e(f,{class:g.btn,color:"#f24433",onClick:()=>o.disabled=!1},{default:()=>[d("修改信息")]})]}):e(C,{class:g.btnList,align:"center",justify:"end"},{default:()=>[e(f,{class:g.btn,onClick:()=>o.disabled=!0},{default:()=>[d("取消")]}),e(f,{class:g.btn,loading:!o.schoolLoading,type:"primary",onClick:()=>p()},{default:()=>[d("完成")]})]})]})]})]}),e(C,{style:{padding:"32px 0"}},{default:()=>[e(f,{type:"primary",renderIcon:()=>e(ye,{component:e(Ve,null,null)},null),onClick:()=>o.modal=!0},{default:()=>[d("添加老师")]}),e(f,{type:"primary",onClick:()=>o.qrModal=!0},{default:()=>[d("老师注册二维码")]})]}),e(Ce,{loading:o.loading,columns:s(),data:o.dataList},null),e(O,{class:g.addTeacher,show:o.modal,"onUpdate:show":a=>o.modal=a,title:"添加老师",preset:"dialog",showIcon:!1},{default:()=>[e(Ke,{areaList:n.areaList,onClose:()=>{o.modal=!1,h()}},null)]}),e(O,{show:o.qrModal,"onUpdate:show":a=>o.qrModal=a,title:"二维码",preset:"dialog",showIcon:!1},{default:()=>[e("div",{style:{textAlign:"center"}},[e(_e,{logoSrc:xe,text:T(),size:300},null)])]})])}}),ta=P({name:"base-setting",setup(t,{emit:n,attrs:c}){const o=S("person"),s=H(),l=Ie();return l.query.activeTab&&(o.value=l.query.activeTab),ke(()=>l.query.activeTab,h=>{o.value=h}),()=>e("div",{class:r.listWrap},[e(we,{class:r.customTabs,value:o.value,"onUpdate:value":h=>o.value=h,size:"large",animated:!0,"pane-wrapper-style":"margin: 0 -4px","pane-style":"padding-left: 4px; padding-right: 4px; box-sizing: border-box;"},{default:()=>[e(te,{name:"person",tab:"个人信息"},{default:()=>[e(qe,null,null)]}),s.info.isSuperAdmin&&e(te,{name:"school",tab:"学校设置"},{default:()=>[e(Ge,null,null)]})]})])}});export{ta as default};
|