1 |
- import{c as h,R as l,C as i,I as c}from"./validate.21d85312.js";import{d as m,bi as f,f as g,m as n,bj as w,bk as C,g as d,s as y,n as S,o as D,c as e,bl as s,q as a,B as T,P as A}from"./index.1c621181.js";import{q as x}from"./index.339fc024.js";import{C as P}from"./index.2db9d877.js";import{F as p}from"./index.c7a20c76.js";import{C as b}from"./index.2f8c39d9.js";import"./index.4c221cbe.js";import"./index.fd5ae97b.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:"",orchestraInfo:{},testIsWeixin:!1}},computed:{codeDisable(){let t=!0;return this.username&&this.smsCode&&(t=!1),t}},mounted(){f(),this.directNext(),!g().weixin&&!this.testIsWeixin&&(this.showPopup=!0),this.getDetails()},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||(this.showPopup=!0,this.showPopupMessage="\u5B66\u6821\u5DF2\u5173\u95ED")}catch{}},async getAppIdAndCode(t){try{const{data:o}=await n.get("/api-student/open/paramConfig/wechatAppId");o&&(w(),C(o,t))}catch{}},directNext(){if(d.user.status==="login"||d.user.status==="error"){const{returnUrl:t,isRegister:o,...u}=this.$route.query,r=window.location.origin+window.location.pathname+"#"+t+"?"+x.stringify({...u});this.testIsWeixin?this.locationReplace(r):this.getAppIdAndCode(r)}},locationReplace(t){console.log(history.replaceState,"window.history.replaceState",t),history.replaceState?(history.replaceState(null,document.title,t),history.go(0)):location.replace(t)},async onLogin(){try{this.orchestraInfo.canSignUp||(this.showPopup=!0,this.showPopupMessage="\u5B66\u6821\u5DF2\u5173\u95ED");const t={username:this.username,client_id:"jmedu-student",client_secret:"jmedu-student",autoRegister:!0,password:this.smsCode,loginType:"SMS",grant_type:"password"},{data:o}=await n.post("/api-oauth/userlogin",{requestType:"form",data:{...t}});y(o.token_type+" "+o.access_token);const u=await n.get("/api-student/user/getUserInfo",{initRequest:!0});S(u.data),this.directNext()}catch{}},async onSendCode(){if(!h(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},[a("\u60A8\u597D\uFF0C"),e("br",null,null),a(" \u6B22\u8FCE\u4F7F\u7528\u7BA1\u4E50\u56E2\u5B66\u5458\u7AEF")]),e(P,{class:s.margin34,border:!1},{default:()=>[e(l,{style:{marginBottom:"16px"}},{default:()=>[e(i,{span:24,class:s.formTitle},{default:()=>[a("\u624B\u673A\u53F7")]}),e(i,{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(l,null,{default:()=>[e(i,{span:24,class:s.formTitle},{default:()=>[a("\u9A8C\u8BC1\u7801")]}),e(i,{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(b,{ref:"countDownRef","auto-start":!1,time:this.countDownTime,onFinish:this.onFinished,format:"ss\u79D2"},null)})]})]})]}),e("div",{class:s.margin34},[e(T,{round:!0,block:!0,type:"primary",disabled:this.codeDisable,onClick:this.onLogin},{default:()=>[a("\u63D0\u4EA4")]})]),this.imgCodeStatus?e(c,{value:this.imgCodeStatus,"onUpdate:value":t=>this.imgCodeStatus=t,phone:this.username,type:"REGISTER",onClose:()=>{this.imgCodeStatus=!1},onSendCode:this.onCodeSend},null):null,e(A,{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},[this.showPopupMessage])])]})])}});export{E as default};
|