auth-login.26807b7e.js 2.7 KB

12
  1. import{d as p,g as s,b0 as m,bq as l,n as d,T as f,p as a,i as g,j as n,z as r,B as I}from"./index.e6d6174e.js";import{I as i}from"./index.67c54471.js";import{r as k,a as u,s as c,b as t}from"./index.87ef10a9.js";import{l as y}from"./logo.bcac726b.js";import"./auth.5a63a717.js";import"./routes-common.786ac133.js";var v="./assets/icon-student-default.0e847d86.png",_=p({name:"login-music",data(){return{username:"",imgCodeStatus:!1}},mounted(){this.username=s.orchestraInfo.phone,k(),m("webViewOnResume",()=>{a({api:"getUserAccount"}).then(async o=>{const e=o.content;s.orchestraInfo.token=e.token.split(" ")[1],s.orchestraInfo.phone=e.phone,s.orchestraInfo.nickname=e.nickname,s.orchestraInfo.avatar=e.avatar,s.orchestraInfo.unionId=e.unionId||0,this.username=s.orchestraInfo.phone,e.unionId&&this.$route.path==="/home-auth"&&this.getUserInfo()})})},unmounted(){l("webViewOnResume",()=>{})},methods:{onLoginSuccess(){d({api:"bindUserAccount",content:{phone:this.username}}),setTimeout(()=>{f("\u6388\u6743\u6210\u529F")},100),setTimeout(()=>{this.getUserInfo()},1e3)},async getUserInfo(){try{const o=await u.post("/api-auth/smsLogin",{requestType:"form",data:{clientId:"student",clientSecret:"student",phone:s.orchestraInfo.phone,token:s.orchestraInfo.token,isSurportRegister:!0}}),{authentication:e}=o.data;c(e.token_type+" "+e.access_token),a({api:"setCache",content:{key:"h5-colexiu-token",value:e.token_type+" "+e.access_token}});const h=await u.get("/api-student/student/queryUserInfo",{initRequest:!0});g(h.data),this.$router.push("/home")}catch{}},async onLogin(){try{const o=await u.post("/api-auth/smsLogin",{requestType:"form",data:{clientId:"student",clientSecret:"student",phone:this.username,token:s.orchestraInfo.token,isSurportRegister:!0}}),{authentication:e}=o.data;c(e.token_type+" "+e.access_token),a({api:"setCache",content:{key:"h5-colexiu-token",value:e.token_type+" "+e.access_token}}),this.onLoginSuccess()}catch{}}},render(){return n("div",{class:t.login},[n("div",{class:t.container},[n("div",{class:[t.userInfo,t.loginCenter]},[n(i,{src:s.orchestraInfo.avatar||v,class:t.img,fit:"cover"},null),n("p",{class:t.name},[s.orchestraInfo.name])]),n("div",{class:[t.tips,t.loginCenter]},[n(i,{src:y,class:t.logo,fit:"contain"},null),n("p",{class:t.text},[r("\u540C\u610F\u9177\u4E50\u79C0\u83B7\u53D6\u60A8\u7684\u7BA1\u4E50\u56E2\u4FE1\u606F\u5E76\u767B\u5F55")]),n("p",{class:t.phone},[this.username])])]),n("div",{class:t.btnGroup},[n(I,{round:!0,color:"#FF8057",class:t.btn,onClick:this.onLogin},{default:()=>[r("\u6388\u6743\u767B\u5F55")]}),n("span",{class:t.moreBtn,onClick:()=>{this.$router.push("/home-login")}},[r("\u5176\u4ED6\u624B\u673A\u53F7\u767B\u5F55")])])])}});export{_ as default};