1 |
- import{d as m,bm as g,f,m as n,bf as w,bg as y,g as l,be as C,s as S,n as A,o as D,c as e,bn as s,F as P,q as a,B as I,P as T}from"./index.332c7f08.js";import{c as x,R as h,C as r,I as b}from"./validate.fcf4be6d.js";import{C as B}from"./index.324108a5.js";import{F as p}from"./index.1ed6273e.js";import{C as F}from"./index.9227cf35.js";import"./index.96a8db5e.js";import"./index.91135ff9.js";var E=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,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 n.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 n.get("/api-student/open/paramConfig/wechatAppId");o&&(w(),y(o,t))}catch{}},async directNext(){if(l.user.status==="login"||l.user.status==="error"){const{returnUrl:t,isRegister:o,...u}=this.$route.query;let i=window.location.origin+window.location.pathname+"#"+t+"?"+C.stringify({...u});if(this.hasBuyInstruments){i=window.location.origin+window.location.pathname+"#/preGoodsSuccess?t=pay",window.location.href=i;return}this.testIsWeixin?this.locationReplace(i):await this.getAppIdAndCode(i)}},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 n.post("/api-oauth/userlogin",{requestType:"form",data:{...t}});S(o.token_type+" "+o.access_token);const u=await n.get("/api-student/user/getUserInfo",{initRequest:!0});A(u.data);const{returnUrl:i,id:d}=this.$route.query;if(i==="/preGoodsApply"){const c=await n.get("/api-student/orchestraRegister/registerStatus/"+d);this.hasBuyInstruments=c.data.hasBuyInstruments||!1}this.directNext()}catch{}},async onSendCode(){if(!x(this.username))return D("\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.orchestraPath==="/preGoodsApply"?"\u4E50\u56E2\u62A5\u540D":e(P,null,[a("\u60A8\u597D\uFF0C"),e("br",null,null),a(" \u6B22\u8FCE\u4F7F\u7528\u7BA1\u4E50\u56E2\u5B66\u5458\u7AEF")," "])]),e(B,{class:s.margin34,border:!1},{default:()=>[e(h,{style:{marginBottom:"16px"}},{default:()=>[e(r,{span:24,class:s.formTitle},{default:()=>[a("\u624B\u673A\u53F7")]}),e(r,{span:24,class:"van-hairline--bottom"},{default:()=>[e(p,{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(h,null,{default:()=>[e(r,{span:24,class:s.formTitle},{default:()=>[a("\u9A8C\u8BC1\u7801")]}),e(r,{span:24,class:"van-hairline--bottom"},{default:()=>[e(p,{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},[a("\u83B7\u53D6\u9A8C\u8BC1\u7801")]):e(F,{ref:"countDownRef","auto-start":!1,time:this.countDownTime,onFinish:this.onFinished,format:"ss\u79D2"},null)})]})]})]}),e("div",{class:s.margin34},[e(I,{round:!0,block:!0,type:"primary",disabled:this.codeDisable,onClick:this.onLogin},{default:()=>[a("\u63D0\u4EA4")]})]),this.imgCodeStatus?e(b,{value:this.imgCodeStatus,"onUpdate:value":t=>this.imgCodeStatus=t,phone:this.username,type:"REGISTER",onClose:()=>{this.imgCodeStatus=!1},onSendCode:this.onCodeSend},null):null,e(T,{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},[a("\u6E29\u99A8\u63D0\u793A")]),e("p",{class:s.popupTips,innerHTML:this.showPopupMessage},null)])]})])}});export{E as default};
|