index-12efd9b3.js 6.7 KB

1
  1. import{d as V,U as k,q as R,r as Y,e as h,x,y as M,a as o,A as l,C as N,V as S,z as G,N as p,E as u,D as f}from"./index-d09fbffb.js";import{C as O,O as U}from"./index-5d676798.js";import{M as z}from"./index-64761d8a.js";import{u as L}from"./student-register-store-91c47dc6.js";import{i as q}from"./icon-gift-94736468.js";import{M as P}from"./index-de35d889.js";import{F as H}from"./index-4a1d0007.js";import{F as n}from"./index-cc78c517.js";import{R as J,a as w}from"./index-fc4da332.js";import{T as _}from"./index-065c5e5b.js";import{P as b}from"./index-407b64e6.js";import"./index-a2f6820f.js";import"./index-e8f59886.js";import"./index-d6bfa717.js";import"./index-14fc28c2.js";import"./Checker-ecd607a1.js";import"./index-64e48e63.js";import"./use-tab-status-d9d193fe.js";import"./index-4939fcd2.js";const Q="_registerModal_w1mwo_1",W="_memberNumer_w1mwo_6",X="_iconGift_w1mwo_17",$="_infoTitle_w1mwo_22",j="_registerForm_w1mwo_28",K="_tips_w1mwo_35",Z="_codeText_w1mwo_57",ee="_codeTextDisabled_w1mwo_62",te="_submitBtn_w1mwo_65",oe="_radioSection_w1mwo_75",ae="_radioItem_w1mwo_82",s={registerModal:Q,memberNumer:W,iconGift:X,infoTitle:$,registerForm:j,tips:K,codeText:Z,codeTextDisabled:ee,submitBtn:te,radioSection:oe,radioItem:ae},C=[];for(let i=1;i<=40;i++)C.push({text:i+"班",value:i});const Fe=V({name:"register-modal",emits:["close","submit"],setup(i,{emit:se}){const g=k(),T=R();L().setShoolId(g.query.sId);const d=Y(),y=h(()=>{let t=[];const r=[{text:"一年级",value:1},{text:"二年级",value:2},{text:"三年级",value:3},{text:"四年级",value:4},{text:"五年级",value:5}],c=[{text:"六年级",value:6}],m=[{text:"七年级",value:7},{text:"八年级",value:8},{text:"九年级",value:9}];return e.gradeYear==="FIVE_YEAR_SYSTEM"?t.push([...r]):e.gradeYear==="SIX_YEAR_SYSTEM"?t.push([...r,...c]):e.gradeYear==="THREE_YEAR_SYSTEM"?t.push([...m]):e.gradeYear==="FORE_YEAR_SYSTEM"?t.push([...c,...m]):t.push([...r,...c,...m]),t}),e=x({countDownStatus:!0,countDownTime:1e3*120,modelValue:!1,imgCodeStatus:!1,gradeNumText:"",currentClassText:"",gradeStatus:!1,classStatus:!1,loading:!1,schoolId:g.query.sId,gradeYear:null,schoolType:null,giftVipDay:null}),a=x({autoRegister:!0,client_id:"cooleshow-student",client_secret:"cooleshow-student",extra:{nickname:"",currentGradeNum:"",currentClass:"",gender:1},grant_type:"password",loginType:"SMS",password:"",username:""}),F=()=>{e.countDownStatus=!1,G(()=>{d.value.start()})},A=()=>{if(!p(a.username))return u("请输入正确的手机号码");e.imgCodeStatus=!0},E=h(()=>!!p(a.username)),v=()=>{e.countDownStatus=!0,d.value.reset()},D=async()=>{try{if(B())return;e.loading=!0,await f.get("/edu-app/open/student/schoolQuery",{params:{schoolId:e.schoolId,mobile:a.username}});const{extra:t,...r}=a,{data:c}=await f.post("/edu-app/userlogin",{hideLoading:!1,requestType:"form",data:{...r,extra:JSON.stringify({...t,schoolId:e.schoolId})}});setTimeout(()=>{u("报名成功"),T.push("/download")},100)}catch(t){}finally{e.loading=!1}},B=()=>{if(a.extra.nickname)if(a.extra.currentGradeNum)if(a.extra.currentClass)if(p(a.username)){if(!a.password)return u("请输入验证码"),!0}else return u("请输入正确的手机号码"),!0;else return u("请选择所在班级"),!0;else return u("请选择所在年级"),!0;else return u("请输入学生姓名"),!0;return!1},I=async()=>{try{const{data:t}=await f.get("/edu-app/open/school/detail",{params:{id:e.schoolId},noAuthorization:!0});e.giftVipDay=t.giftVipDay,e.schoolType=t.schoolType,e.gradeYear=t.gradeYear}catch(t){}};return M(()=>{I()}),()=>o("div",{class:s.registerModal},[e.giftVipDay?o("div",{class:s.memberNumer},[o("img",{src:q,class:s.iconGift},null),o("p",null,[l("现在报名立即赠送乐器AI学练工具有效期")," ",o("span",null,[e.giftVipDay]),l(" 天")])]):"",o(H,{labelAlign:"top",class:s.registerForm},{default:()=>[o(n,{clearable:!0,label:"学生姓名",placeholder:"请输入学生姓名",autocomplete:"off",maxlength:14,modelValue:a.extra.nickname,"onUpdate:modelValue":t=>a.extra.nickname=t},null),o(n,{clearable:!0,label:"学生性别",placeholder:"请选择性别",autocomplete:"off"},{input:()=>o(J,{"checked-color":"#ffcb75",modelValue:a.extra.gender,"onUpdate:modelValue":t=>a.extra.gender=t,direction:"horizontal"},{default:()=>[o(_,{size:"large",type:"primary",color:a.extra.gender!==1?"#EAEAEA":"#ffcb75",textColor:a.extra.gender!==1?"#AAA":"#5B2C03",class:s.radioSection,round:!0},{default:()=>[o(w,{class:s.radioItem,name:1},null),l("男")]}),o(_,{size:"large",type:"primary",color:a.extra.gender!==0?"#EAEAEA":"#ffcb75",textColor:a.extra.gender!==0?"#AAA":"#5B2C03",class:s.radioSection,round:!0},{default:()=>[o(w,{class:s.radioItem,name:0},null),l("女")]})]})}),o(n,{clearable:!0,label:"所在年级",placeholder:"请选择年级",isLink:!0,readonly:!0,clickable:!1,modelValue:e.gradeNumText,onClick:()=>e.gradeStatus=!0},null),o(n,{clearable:!0,label:"所在班级",placeholder:"请选择班级",isLink:!0,readonly:!0,clickable:!1,modelValue:e.currentClassText,onClick:()=>e.classStatus=!0},null),o(n,{clearable:!0,label:"联系方式(直接监护人)",placeholder:"请输入手机号码",type:"tel",autocomplete:"off",modelValue:a.username,"onUpdate:modelValue":t=>a.username=t,maxlength:11},{label:()=>o("div",null,[l("联系方式"),o("p",{class:s.tips},[l("手机号是音乐数字课堂的唯一登录账户")])])}),o(n,{center:!0,clearable:!0,label:"验证码",placeholder:"请输入验证码",autocomplete:"off",type:"number",modelValue:a.password,"onUpdate:modelValue":t=>a.password=t,maxlength:6},{button:()=>e.countDownStatus?o("span",{class:[s.codeText,E.value?"":s.codeTextDisabled],onClick:A},[l("获取验证码")]):o(O,{ref:t=>d.value=t,"auto-start":!1,time:e.countDownTime,onFinish:v,format:"ss秒"},null)})]}),o(P,{position:"bottom"},{default:()=>[o(N,{type:"primary",class:s.submitBtn,color:"linear-gradient(121deg, #FFD892 0%, #FFCB75 100%)",block:!0,onClick:D,disabled:e.loading,loading:e.loading},{default:()=>[l("确认")]})]}),e.imgCodeStatus?o(z,{value:e.imgCodeStatus,"onUpdate:value":t=>e.imgCodeStatus=t,phone:a.username,onClose:()=>{e.imgCodeStatus=!1},onSendCode:F},null):null,o(S,{show:e.gradeStatus,"onUpdate:show":t=>e.gradeStatus=t,position:"bottom",round:!0,safeAreaInsetBottom:!0,lazyRender:!1,class:"popupBottomSearch"},{default:()=>[o(b,{showToolbar:!0,columns:y.value,onCancel:()=>e.gradeStatus=!1,onConfirm:t=>{const r=t.selectedOptions[0];a.extra.currentGradeNum=r.value,e.gradeNumText=r.text,e.gradeStatus=!1}},null)]}),o(S,{show:e.classStatus,"onUpdate:show":t=>e.classStatus=t,position:"bottom",round:!0,class:"popupBottomSearch"},{default:()=>[o(b,{showToolbar:!0,columns:C,onCancel:()=>e.classStatus=!1,onConfirm:t=>{const r=t.selectedOptions[0];a.extra.currentClass=r.value,e.currentClassText=r.text,e.classStatus=!1}},null)]}),o(U,null,null)])}});export{Fe as default};