index-486c8951.js 7.4 KB

1
  1. import{d as V,P as M,q as R,r as k,e as w,x,y as Y,a as o,A as r,C as N,Q as T,z as G,N as p,E as l,D as f,R as U}from"./index-521a9826.js";import{C as P,M as z}from"./index-207eaba3.js";import{M as L}from"./index-9a28eb74.js";import{u as O}from"./student-register-store-b6550ec0.js";import{i as q}from"./icon-gift-94736468.js";import{M as Q}from"./index-c0ea6da9.js";import{F as H}from"./index-de2c0be1.js";import{F as i}from"./index-e6f760ef.js";import{R as J,a as S}from"./index-7811aba5.js";import{T as F}from"./index-544f4e19.js";import{P as B}from"./index-673d3e97.js";import"./index-163db0a7.js";import"./index-25b5c9d0.js";import"./index-fdaad3c0.js";import"./index-1ad6a58d.js";import"./Checker-1ada2d85.js";const W="_registerModal_w1mwo_1",X="_memberNumer_w1mwo_6",$="_iconGift_w1mwo_17",j="_infoTitle_w1mwo_22",K="_registerForm_w1mwo_28",Z="_tips_w1mwo_35",ee="_codeText_w1mwo_57",te="_codeTextDisabled_w1mwo_62",oe="_submitBtn_w1mwo_65",se="_radioSection_w1mwo_75",ae="_radioItem_w1mwo_82",a={registerModal:W,memberNumer:X,iconGift:$,infoTitle:j,registerForm:K,tips:Z,codeText:ee,codeTextDisabled:te,submitBtn:oe,radioSection:se,radioItem:ae},b=[];for(let c=1;c<=40;c++)b.push({text:c+"班",value:c});const be=V({name:"register-modal",emits:["close","submit"],setup(c,{emit:ue}){const g=M(),_=R();O().setShoolId(g.query.sId);const d=k(),C=w(()=>{let t=[];const u=[{text:"一年级",value:1},{text:"二年级",value:2},{text:"三年级",value:3},{text:"四年级",value:4},{text:"五年级",value:5}],n=[{text:"六年级",value:6}],m=[{text:"七年级",value:7},{text:"八年级",value:8},{text:"九年级",value:9}];return e.gradeYear==="FIVE_YEAR_SYSTEM"?t.push([...u]):e.gradeYear==="SIX_YEAR_SYSTEM"?t.push([...u,...n]):e.gradeYear==="THREE_YEAR_SYSTEM"?t.push([...m]):e.gradeYear==="FORE_YEAR_SYSTEM"?t.push([...n,...m]):t.push([...u,...n,...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,showTips:!1,showButton:!1,showMessage:"请使用微信打开"}),s=x({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:""}),y=()=>{e.countDownStatus=!1,G(()=>{d.value.start()})},E=()=>{if(!p(s.username))return l("请输入正确的手机号码");e.imgCodeStatus=!0},A=w(()=>!!p(s.username)),D=()=>{e.countDownStatus=!0,d.value.reset()},v=async()=>{try{if(I())return;e.loading=!0,await f.get("/edu-app/open/student/schoolQuery",{params:{schoolId:e.schoolId,mobile:s.username}});const{extra:t,...u}=s,n=await f.post("/edu-app/userlogin",{hideLoading:!1,requestType:"form",data:{...u,extra:JSON.stringify({...t,schoolId:e.schoolId})}});n.code===5436?(e.showTips=!0,e.showMessage="二维码已经失效,详情请咨询学校老师",e.showButton=!1):n.code===5435?(e.showTips=!0,e.showMessage="报名信息更新,请刷新后重新提交",e.showButton=!0):setTimeout(()=>{l("报名成功"),_.push("/download")},100)}catch(t){}finally{e.loading=!1}},I=()=>{if(s.extra.nickname)if(s.extra.currentGradeNum)if(s.extra.currentClass)if(p(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},h=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,s.extra.giftVipDay=t.giftVipDay,s.extra.registerType=t.registerType,U().weixin?(t.registerType!=="GIFT_VIP_DAY"||t.status===0)&&(e.showTips=!0,e.showMessage="二维码已经失效,详情请咨询学校老师",e.showButton=!1):e.showTips=!0}catch(t){}};return Y(()=>{h()}),()=>o("div",{class:a.registerModal},[e.giftVipDay?o("div",{class:a.memberNumer},[o("img",{src:q,class:a.iconGift},null),o("p",null,[r("现在报名立即赠送乐器AI学练工具有效期")," ",o("span",null,[e.giftVipDay]),r(" 天")])]):"",o(H,{labelAlign:"top",class:a.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(J,{"checked-color":"#ffcb75",modelValue:s.extra.gender,"onUpdate:modelValue":t=>s.extra.gender=t,direction:"horizontal"},{default:()=>[o(F,{size:"large",type:"primary",color:s.extra.gender!==1?"#EAEAEA":"#ffcb75",textColor:s.extra.gender!==1?"#AAA":"#5B2C03",class:a.radioSection,round:!0},{default:()=>[o(S,{class:a.radioItem,name:1},null),r("男")]}),o(F,{size:"large",type:"primary",color:s.extra.gender!==0?"#EAEAEA":"#ffcb75",textColor:s.extra.gender!==0?"#AAA":"#5B2C03",class:a.radioSection,round:!0},{default:()=>[o(S,{class:a.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:a.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:[a.codeText,A.value?"":a.codeTextDisabled],onClick:E},[r("获取验证码")]):o(P,{ref:t=>d.value=t,"auto-start":!1,time:e.countDownTime,onFinish:D,format:"ss秒"},null)})]}),o(Q,{position:"bottom"},{default:()=>[o(N,{type:"primary",class:a.submitBtn,color:"linear-gradient(121deg, #FFD892 0%, #FFCB75 100%)",block:!0,onClick:v,disabled:e.loading,loading:e.loading},{default:()=>[r("确认")]})]}),e.imgCodeStatus?o(L,{value:e.imgCodeStatus,"onUpdate:value":t=>e.imgCodeStatus=t,phone:s.username,type:"REGISTER",onClose:()=>{e.imgCodeStatus=!1},onSendCode:y},null):null,o(T,{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:C.value,onCancel:()=>e.gradeStatus=!1,onConfirm:t=>{const u=t.selectedOptions[0];s.extra.currentGradeNum=u.value,e.gradeNumText=u.text,e.gradeStatus=!1}},null)]}),o(T,{show:e.classStatus,"onUpdate:show":t=>e.classStatus=t,position:"bottom",round:!0,class:"popupBottomSearch"},{default:()=>[o(B,{showToolbar:!0,columns:b,onCancel:()=>e.classStatus=!1,onConfirm:t=>{const u=t.selectedOptions[0];s.extra.currentClass=u.value,e.currentClassText=u.text,e.classStatus=!1}},null)]}),o(z,{show:e.showTips,"onUpdate:show":t=>e.showTips=t,message:e.showMessage,showButton:e.showButton,buttonText:"刷新",onConfirm:async()=>{e.showTips=!1,await h(),s.password="",window.scrollTo({top:0,behavior:"smooth"})}},null)])}});export{be as default};