import{d as h,f as r,a1 as k,a2 as m,a3 as v}from"./vue-vendor-CxLCUzY4.js";import{bQ as u,ba as A,bA as y,ab as _,u as L,K as T,bj as w,bR as c}from"./index-CYriLmQo.js";import"./antd-vue-vendor-CDWW6V_M.js";import"./vxe-table-vendor-B5h3MVdD.js";const q=h({__name:"OAuth2Login",setup(x){const l=r(u()),e=r({thirdApp:!1,wxWork:!1,dingtalk:!1}),{currentRoute:g}=k(),s=g.value;u()||A.replace({path:y.BASE_LOGIN,query:s.query}),l.value&&p();function p(){/wxwork/i.test(navigator.userAgent)&&(e.value.thirdApp=!0,e.value.wxWork=!0),/dingtalk/i.test(navigator.userAgent)&&(e.value.thirdApp=!0,e.value.dingtalk=!0),d()}function d(){if(e.value.thirdApp)if(s.query.oauth2LoginToken){let n=s.query.oauth2LoginToken;f({token:n,thirdType:s.query.thirdType,tenantId:w})}else e.value.wxWork?c("wechat_enterprise"):e.value.dingtalk&&c("dingtalk")}function f(n){const a=_(),{notification:i}=L(),{t:o}=T();a.ThirdLogin(n).then(t=>{t&&t.userInfo?i.success({message:o("sys.login.loginSuccessTitle"),description:`${o("sys.login.loginSuccessDesc")}: ${t.userInfo.realname}`,duration:3}):i.error({message:o("sys.login.errorTip"),description:((t.response||{}).data||{}).message||t.message||o("sys.login.networkExceptionMsg"),duration:4})})}return(n,a)=>(m(),v("div"))}});export{q as default};
