import{d as h,f as r,a1 as m,a2 as k,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 b,bR as c}from"./index-CLZzJyTP.js";import"./antd-vue-vendor-CahNzUUa.js";import"./vxe-table-vendor-Cdi8WfTx.js";const E=h({__name:"OAuth2Login",setup(w){const l=r(u()),e=r({thirdApp:!1,wxWork:!1,dingtalk:!1}),{currentRoute:p}=m(),s=p.value;u()||A.replace({path:y.BASE_LOGIN,query:s.query}),l.value&&g();function g(){/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:b})}else e.value.wxWork?c("wechat_enterprise"):e.value.dingtalk&&c("dingtalk")}function f(n){const a=_(),{notification:o}=L(),{t:i}=T();a.ThirdLogin(n).then(t=>{t&&t.userInfo?o.success({message:i("sys.login.loginSuccessTitle"),description:`${i("sys.login.loginSuccessDesc")}: ${t.userInfo.realname}`,duration:3}):o.error({message:"登录失败",description:((t.response||{}).data||{}).message||t.message||"请求出现错误，请稍后再试",duration:4})})}return(n,a)=>(k(),v("div"))}});export{E as default};
