| 1 |
- import{d as m,bx as g,f,n as i,bk as w,bu as y,g as h,bf as C,s as S,o as I,q as T,c as e,by as s,t as n,B as D,P}from"./ResizeObserver.es.15fb4d98.js";import{I as x}from"./index.872052af.js";import{c as A}from"./validate.d2516287.js";import{C as b}from"./index.c6fb2143.js";import{R as p,C as r}from"./index.3931b8d8.js";import{F as d}from"./index.3dc0509b.js";import{C as R}from"./index.026c9d77.js";import"./index.172e089e.js";import"./index.565314d5.js";var G=m({name:"login-music",data(){return{loginType:"SMS",username:"",password:"",smsCode:"",countDownStatus:!0,countDownTime:1e3*120,imgCodeStatus:!1,showPopup:!1,showPopupMessage:"\u8BF7\u4F7F\u7528\u5FAE\u4FE1\u6253\u5F00",wxAppId:"",code:"",orchestraPath:"preApply",orchestraInfo:{},hasBuyInstruments:!1,registerStatus:"",testIsWeixin:!1}},computed:{codeDisable(){let t=!0;return this.username&&this.smsCode&&(t=!1),t}},mounted(){const{returnUrl:t}=this.$route.query;this.orchestraPath=t,g(),this.directNext(),!f().weixin&&!this.testIsWeixin&&(this.showPopup=!0),this.getDetails(),console.log(this.$route.query.returnUrl)},methods:{async getDetails(){try{if(!this.$route.query.id)return;const{data:o}=await i.get("/api-student/open/orchestra/detail/"+this.$route.query.id);this.orchestraInfo=o||{},o.canSignUp?o.registerOpen!=="ING"&&(this.showPopup=!0,this.showPopupMessage="\u8BE5\u4E50\u56E2\u5DF2\u622A\u6B62\u62A5\u540D"):(this.showPopup=!0,this.showPopupMessage="\u4E50\u56E2\u62A5\u540D\u65F6\u95F4\u5DF2\u8FC7\uFF0C\u8BF7\u7B49\u5F85\u901A\u77E5")}catch{}},async getAppIdAndCode(t){try{const{data:o}=await i.get("/api-student/open/paramConfig/wechatAppId");o&&(w(),y(o,t))}catch{}},async directNext(){if(h.user.status==="login"||h.user.status==="error"){const{returnUrl:t,isRegister:o,...u}=this.$route.query;let a=window.location.origin+window.location.pathname+"#"+t+"?"+C.stringify({...u});if(this.hasBuyInstruments&&this.registerStatus==="LEARNING"){a=window.location.origin+window.location.pathname+"#/preGoodsSuccess?t=pay",window.location.href=a;return}this.testIsWeixin?this.locationReplace(a):await this.getAppIdAndCode(a)}},locationReplace(t){history.replaceState?(history.replaceState(null,document.title,t),history.go(0)):location.replace(t)},async onLogin(){try{if(!this.orchestraInfo.canSignUp){this.showPopup=!0,this.showPopupMessage="\u5B66\u6821\u5DF2\u5173\u95ED";return}const t={username:this.username,client_id:"jmedu-student",client_secret:"jmedu-student",autoRegister:!0,password:this.smsCode,loginType:"SMS",grant_type:"password",extra:this.$route.query.id},{data:o}=await i.post("/api-oauth/userlogin",{requestType:"form",data:{...t}});S(o.token_type+" "+o.access_token);const u=await i.get("/api-student/user/getUserInfo",{initRequest:!0});I(u.data);const{returnUrl:a,id:c}=this.$route.query;if(a==="/preGoodsApply"){const l=await i.get("/api-student/orchestraRegister/registerStatus/"+c);this.hasBuyInstruments=l.data.hasBuyInstruments||!1,this.registerStatus=l.data.registerStatus||""}this.directNext()}catch{}},async onSendCode(){if(!A(this.username))return T("\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u624B\u673A\u53F7\u7801");this.imgCodeStatus=!0},onCodeSend(){this.countDownStatus=!1,this.$nextTick(()=>{this.$refs.countDownRef.start()})},onFinished(){this.countDownStatus=!0,this.$refs.countDownRef.reset()},onChange(){this.loginType==="PWD"?this.loginType="SMS":this.loginType==="SMS"&&(this.loginType="PWD")}},render(){return e("div",{class:s.login},[e("div",{class:s.loginTitle},[this.orchestraInfo.loginTitle]),e(b,{class:s.margin34,border:!1},{default:()=>[e(p,{style:{marginBottom:"16px"}},{default:()=>[e(r,{span:24,class:s.formTitle},{default:()=>[n("\u624B\u673A\u53F7")]}),e(r,{span:24,class:"van-hairline--bottom"},{default:()=>[e(d,{modelValue:this.username,"onUpdate:modelValue":t=>this.username=t,name:"\u624B\u673A\u53F7",placeholder:"\u8BF7\u8F93\u5165\u60A8\u7684\u624B\u673A\u53F7",type:"tel",maxlength:11},null)]})]}),e(p,null,{default:()=>[e(r,{span:24,class:s.formTitle},{default:()=>[n("\u9A8C\u8BC1\u7801")]}),e(r,{span:24,class:"van-hairline--bottom"},{default:()=>[e(d,{modelValue:this.smsCode,"onUpdate:modelValue":t=>this.smsCode=t,name:"\u9A8C\u8BC1\u7801",placeholder:"\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801",type:"tel",maxlength:6},{button:()=>this.countDownStatus?e("span",{class:s.codeText,onClick:this.onSendCode},[n("\u83B7\u53D6\u9A8C\u8BC1\u7801")]):e(R,{ref:"countDownRef","auto-start":!1,time:this.countDownTime,onFinish:this.onFinished,format:"ss\u79D2"},null)})]})]})]}),e("div",{class:s.margin34},[e(D,{round:!0,block:!0,type:"primary",disabled:this.codeDisable,onClick:this.onLogin},{default:()=>[n("\u63D0\u4EA4")]})]),this.imgCodeStatus?e(x,{value:this.imgCodeStatus,"onUpdate:value":t=>this.imgCodeStatus=t,phone:this.username,type:"REGISTER",onClose:()=>{this.imgCodeStatus=!1},onSendCode:this.onCodeSend},null):null,e(P,{show:this.showPopup,"onUpdate:show":t=>this.showPopup=t,round:!0,style:{width:"88%"},closeOnClickOverlay:!1,class:s.wxPopupDialog},{default:()=>[e("div",{class:s.popupContainer},[e("p",{class:s.title},[n("\u6E29\u99A8\u63D0\u793A")]),e("p",{class:s.popupTips,innerHTML:this.showPopupMessage},null)])]})])}});export{G as default};
|