index-c51076fb.js 8.0 KB

1
  1. import{d as V,P as k,q as Y,r as N,e as T,x as F,y as O,a as o,A as r,C as G,R as B,z as U,M as h,N as l,D as m,S as P}from"./index-869d77fb.js";import{C as z,M as L}from"./index-4a265525.js";import{M as q}from"./index-b9d9d40c.js";import{u as $}from"./student-register-store-a294a38a.js";import{i as H}from"./icon-gift-94736468.js";import{M as J}from"./index-3eb77ad0.js";import{M as Q}from"./index-b693844b.js";import{F as W}from"./index-988f61a4.js";import{F as i}from"./index-0153d173.js";import{R as X,a as C}from"./index-62365511.js";import{T as b}from"./index-70d6770d.js";import{P as _}from"./index-6f985828.js";import"./index-8150a3e4.js";import"./index-e76f2a88.js";import"./index-155c29c2.js";import"./index-1c6c2ec0.js";import"./Checker-4ac02e10.js";const j="_registerModal_w1mwo_1",K="_memberNumer_w1mwo_6",Z="_iconGift_w1mwo_17",ee="_infoTitle_w1mwo_22",te="_registerForm_w1mwo_28",oe="_tips_w1mwo_35",se="_codeText_w1mwo_57",ae="_codeTextDisabled_w1mwo_62",ue="_submitBtn_w1mwo_65",re="_radioSection_w1mwo_75",le="_radioItem_w1mwo_82",u={registerModal:j,memberNumer:K,iconGift:Z,infoTitle:ee,registerForm:te,tips:oe,codeText:se,codeTextDisabled:ae,submitBtn:ue,radioSection:re,radioItem:le},y=[];for(let c=1;c<=40;c++)y.push({text:c+"班",value:c});const Ee=V({name:"register-modal",emits:["close","submit"],setup(c,{emit:ne}){const g=k(),E=Y();$().setShoolId(g.query.sId);const p=N(),A=T(()=>{let t=[];const a=[{text:"一年级",value:1},{text:"二年级",value:2},{text:"三年级",value:3},{text:"四年级",value:4},{text:"五年级",value:5}],n=[{text:"六年级",value:6}],d=[{text:"七年级",value:7},{text:"八年级",value:8},{text:"九年级",value:9}];return e.gradeYear==="FIVE_YEAR_SYSTEM"?t.push([...a]):e.gradeYear==="SIX_YEAR_SYSTEM"?t.push([...a,...n]):e.gradeYear==="THREE_YEAR_SYSTEM"?t.push([...d]):e.gradeYear==="FORE_YEAR_SYSTEM"?t.push([...n,...d]):t.push([...a,...n,...d]),t}),e=F({countDownStatus:!0,countDownTime:1e3*120,modelValue:!1,imgCodeStatus:!1,gradeNumText:"",currentClassText:"",gradeStatus:!1,classStatus:!1,loading:!1,schoolId:g.query.sId,details:{},gradeYear:null,schoolType:null,giftVipDay:null,showTips:!1,showButton:!1,showMessage:"请使用微信打开",showOtherSchool:!1,showOtherMessage:""}),s=F({autoRegister:!0,client_id:"cooleshow-student",client_secret:"cooleshow-student",extra:{nickname:"",currentGradeNum:"",currentClass:"",gender:1,registerType:"",giftVipDay:0},grant_type:"password",loginType:"SMS",password:"",username:""}),D=()=>{e.countDownStatus=!1,U(()=>{p.value.start()})},M=()=>{if(!h(s.username))return l("请输入正确的手机号码");e.imgCodeStatus=!0},v=T(()=>!!h(s.username)),I=()=>{e.countDownStatus=!0,p.value.reset()},w=async(t=!1)=>{var a;try{if(R())return;if(e.loading=!0,!t){const f=await m.get(`/edu-app/open/student/studentSchool?mobile=${s.username}&code=${s.password}&type=REGISTER`);if(f&&f.schoolId!==e.schoolId){e.showOtherSchool=!0,e.showOtherMessage=`您已绑定【${e.details.name||""}】,提交后将更换到【${(a=f.data)==null?void 0:a.schoolName}】,是否确认提交?`;return}}await m.get("/edu-app/open/student/schoolQuery",{params:{schoolId:e.schoolId,mobile:s.username}});const{extra:n,...d}=s,x=await m.post("/edu-app/userlogin",{hideLoading:!1,requestType:"form",data:{...d,extra:JSON.stringify({...n,schoolId:e.schoolId})}});x.code===5436?(e.showTips=!0,e.showMessage="二维码已经失效,详情请咨询学校老师",e.showButton=!1):x.code===5435?(e.showTips=!0,e.showMessage="报名信息更新,请刷新后重新提交",e.showButton=!0):setTimeout(()=>{l("报名成功"),E.push("/download")},100)}catch(n){}finally{e.loading=!1}},R=()=>{if(s.extra.nickname)if(s.extra.currentGradeNum)if(s.extra.currentClass)if(h(s.username)){if(!s.password)return l("请输入验证码"),!0}else return l("请输入正确的手机号码"),!0;else return l("请选择所在班级"),!0;else return l("请选择所在年级"),!0;else return l("请输入学生姓名"),!0;return!1},S=async()=>{try{const{data:t}=await m.get("/edu-app/open/school/detail",{params:{id:e.schoolId},noAuthorization:!0});e.giftVipDay=t.giftVipDay,e.schoolType=t.schoolType,e.gradeYear=t.gradeYear,s.extra.giftVipDay=t.giftVipDay,s.extra.registerType=t.registerType,e.details=t,P().weixin?(t.registerType!=="GIFT_VIP_DAY"||t.status===0)&&(e.showTips=!0,e.showMessage="二维码已经失效,详情请咨询学校老师",e.showButton=!1):e.showTips=!0}catch(t){}};return O(()=>{S()}),()=>o("div",{class:u.registerModal},[e.giftVipDay?o("div",{class:u.memberNumer},[o("img",{src:H,class:u.iconGift},null),o("p",null,[r("现在报名立即赠送乐器AI学练工具有效期")," ",o("span",null,[e.giftVipDay]),r(" 天")])]):"",o(W,{labelAlign:"top",class:u.registerForm},{default:()=>[o(i,{clearable:!0,label:"学生姓名",placeholder:"请输入学生姓名",autocomplete:"off",maxlength:14,modelValue:s.extra.nickname,"onUpdate:modelValue":t=>s.extra.nickname=t},null),o(i,{clearable:!0,label:"学生性别",placeholder:"请选择性别",autocomplete:"off"},{input:()=>o(X,{"checked-color":"#ffcb75",modelValue:s.extra.gender,"onUpdate:modelValue":t=>s.extra.gender=t,direction:"horizontal"},{default:()=>[o(b,{size:"large",type:"primary",color:s.extra.gender!==1?"#EAEAEA":"#ffcb75",textColor:s.extra.gender!==1?"#AAA":"#5B2C03",class:u.radioSection,round:!0},{default:()=>[o(C,{class:u.radioItem,name:1},null),r("男")]}),o(b,{size:"large",type:"primary",color:s.extra.gender!==0?"#EAEAEA":"#ffcb75",textColor:s.extra.gender!==0?"#AAA":"#5B2C03",class:u.radioSection,round:!0},{default:()=>[o(C,{class:u.radioItem,name:0},null),r("女")]})]})}),o(i,{clearable:!0,label:"所在年级",placeholder:"请选择年级",isLink:!0,readonly:!0,clickable:!1,modelValue:e.gradeNumText,onClick:()=>e.gradeStatus=!0},null),o(i,{clearable:!0,label:"所在班级",placeholder:"请选择班级",isLink:!0,readonly:!0,clickable:!1,modelValue:e.currentClassText,onClick:()=>e.classStatus=!0},null),o(i,{clearable:!0,label:"联系方式(直接监护人)",placeholder:"请输入手机号码",type:"tel",autocomplete:"off",modelValue:s.username,"onUpdate:modelValue":t=>s.username=t,maxlength:11},{label:()=>o("div",null,[r("联系方式"),o("p",{class:u.tips},[r("手机号是音乐数字课堂的唯一登录账户")])])}),o(i,{center:!0,clearable:!0,label:"验证码",placeholder:"请输入验证码",autocomplete:"off",type:"number",modelValue:s.password,"onUpdate:modelValue":t=>s.password=t,maxlength:6},{button:()=>e.countDownStatus?o("span",{class:[u.codeText,v.value?"":u.codeTextDisabled],onClick:M},[r("获取验证码")]):o(z,{ref:t=>p.value=t,"auto-start":!1,time:e.countDownTime,onFinish:I,format:"ss秒"},null)})]}),o(J,{position:"bottom"},{default:()=>[o(G,{type:"primary",class:u.submitBtn,color:"linear-gradient(121deg, #FFD892 0%, #FFCB75 100%)",block:!0,onClick:()=>w(),disabled:e.loading,loading:e.loading},{default:()=>[r("确认")]})]}),e.imgCodeStatus?o(q,{value:e.imgCodeStatus,"onUpdate:value":t=>e.imgCodeStatus=t,phone:s.username,type:"REGISTER",onClose:()=>{e.imgCodeStatus=!1},onSendCode:D},null):null,o(B,{show:e.gradeStatus,"onUpdate:show":t=>e.gradeStatus=t,position:"bottom",round:!0,safeAreaInsetBottom:!0,lazyRender:!1,class:"popupBottomSearch"},{default:()=>[o(_,{showToolbar:!0,columns:A.value,onCancel:()=>e.gradeStatus=!1,onConfirm:t=>{const a=t.selectedOptions[0];s.extra.currentGradeNum=a.value,e.gradeNumText=a.text,e.gradeStatus=!1}},null)]}),o(B,{show:e.classStatus,"onUpdate:show":t=>e.classStatus=t,position:"bottom",round:!0,class:"popupBottomSearch"},{default:()=>[o(_,{showToolbar:!0,columns:y,onCancel:()=>e.classStatus=!1,onConfirm:t=>{const a=t.selectedOptions[0];s.extra.currentClass=a.value,e.currentClassText=a.text,e.classStatus=!1}},null)]}),o(L,{show:e.showTips,"onUpdate:show":t=>e.showTips=t,message:e.showMessage,showButton:e.showButton,buttonText:"刷新",onConfirm:async()=>{e.showTips=!1,await S(),s.password="",window.scrollTo({top:0,behavior:"smooth"})}},null),o(Q,{show:e.showOtherSchool,messageAlign:"left",message:e.showOtherMessage,showCancelButton:!0,onCancel:()=>e.showOtherSchool=!1,onConfirm:()=>{e.showOtherSchool=!1,w(!0)}},null)])}});export{Ee as default};