|
|
|
+import{f as a,d as n,g as s,u,y as l,i as h,b as d,a as g,n as f,j as r,C as c,R as m,F as p}from"./ResizeObserver.es.49c7a68d.js";const y="_error_l30mv_1",A="_info_l30mv_9";var x={error:y,info:A};const R=a();var $=n({name:"Auth",data(){return{loading:!1}},computed:{isExternal(){return this.$route.meta.isExternal&&!R.isStudent||!1},isNeedView(){return s.user.status==="login"||this.$route.path==="/login"||this.isExternal}},mounted(){!this.isExternal&&this.setAuth()},methods:{async setAuth(){const{query:i}=this.$route,o=i.userInfo||i.Authorization;if(o&&u(o),!this.loading){if(s.user.status==="init"||s.user.status==="error"){this.loading=!0;try{let t=await l.get("/api-student/student/queryUserInfo",{initRequest:!0});h(t.data)}catch(t){const e=t.message;e.indexOf("403")===-1&&e.indexOf("authentication")===-1?d():g()}this.loading=!1}if(s.user.status==="logout")if(a().isApp)f({api:"login"});else try{const t=this.$route,e={returnUrl:this.$route.path,...this.$route.query};t.meta.isRegister&&(e.isRegister=t.meta.isRegister),this.$router.replace({path:"/login",query:e})}catch{}}}},render(){return r(p,null,[s.user.status==="error"?r("div",{class:x.error},[r(c,{type:"notFond",classImgSize:"CERT",tips:"\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5",buttonText:"\u91CD\u65B0\u52A0\u8F7D",plain:!0,onClick:this.setAuth},null)]):this.isNeedView?r(m,null,null):null])}});export{$ as A};
|