(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["oauth2-app.login"],{5193:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t.$createElement;t._self._c;return t._m(0)},o=[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("div",{attrs:{id:"loader-wrapper"}},[n("div",{attrs:{id:"loader"}}),n("div",{staticClass:"loader-section section-left"}),n("div",{staticClass:"loader-section section-right"}),n("div",{staticClass:"load_title"},[t._v("正在登录 JeecgBoot 低代码平台，请耐心等待")])])])}],r=n("2f62"),s=n("ca00"),c=n("9fb0");function a(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function u(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?a(Object(n),!0).forEach((function(e){h(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function h(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var d={name:"OAuth2Login",data:function(){return{env:{thirdApp:!1,wxWork:!1,dingtalk:!1}}},beforeCreate:function(){Object(s["i"])()||this.$router.replace({path:"/user/login"})},created:function(){this.checkEnv(),this.doOAuth2Login()},methods:u(u({},Object(r["b"])(["ThirdLogin"])),{},{checkEnv:function(){/wxwork/i.test(navigator.userAgent)&&(this.env.thirdApp=!0,this.env.wxWork=!0),/dingtalk/i.test(navigator.userAgent)&&(this.env.thirdApp=!0,this.env.dingtalk=!0)},doOAuth2Login:function(){if(this.env.thirdApp)if(this.$route.query.oauth2LoginToken){this.thirdType=this.$route.query.thirdType;var t=this.$route.query.oauth2LoginToken;this.doThirdLogin(t)}else this.env.wxWork?this.doWechatEnterpriseOAuth2Login():this.env.dingtalk&&this.doDingTalkOAuth2Login()},doThirdLogin:function(t){var e=this,n={};n.thirdType=this.thirdType,n.token=t,this.ThirdLogin(n).then((function(t){t.success?e.loginSuccess():e.requestFailed(t)}))},loginSuccess:function(){this.$router.replace({path:c["n"]}),this.$notification.success({message:"欢迎",description:"".concat(Object(s["p"])(),"，欢迎回来")})},requestFailed:function(t){this.$error({title:"登录失败",content:((t.response||{}).data||{}).message||t.message||"请求出现错误，请稍后再试",okText:"重新登陆",onOk:function(){window.location.reload()},onCancel:function(){window.location.reload()}})},doWechatEnterpriseOAuth2Login:function(){this.sysOAuth2Login("wechat_enterprise")},doDingTalkOAuth2Login:function(){this.sysOAuth2Login("dingtalk")},sysOAuth2Login:function(t){var e="".concat(window._CONFIG["domianURL"],"/sys/thirdLogin/oauth2/").concat(t,"/login");e+="?state=".concat(encodeURIComponent(window.location.origin)),window.location.href=e}})},l=d,p=n("2877"),g=Object(p["a"])(l,i,o,!1,null,"45f56b19",null);e["default"]=g.exports}}]);