<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0,viewport-fit=cover">
	<!-- iOS 设备 begin -->
	<meta name="apple-mobile-web-app-title" content="标题">
	<!-- 添加到主屏后的标题（iOS 6 新增） -->
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta content="no" name="apple-touch-fullscreen">
	<meta content="yes" name="full-screen">
	<meta content="black" name="apple-mobile-web-app-status-bar-style">
	<meta content="telephone=yes,email=yes" name="format-detection">
	<meta content="address=no" name="format-detection">
	<!-- 禁止了把数字转化为拨号链接 -->
	<meta name="format-detection" content="telephone=no">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>信息验证登录中</title>
	<link rel="stylesheet" type="text/css" href="vsharinglogin/css/reset.css">
	<link rel="stylesheet" type="text/css" href="vsharinglogin/css/login.css">
	<link rel="stylesheet" href="./commons/css/awsui.css"/>
	<script type="text/javascript" src="./commons/js/jquery/scripts/jquery.js"></script>
	<script type="text/javascript" src="./commons/js/awsui.js"></script>
	<script type="text/javascript" src="./commons/js/public.js"></script>
	<style type="text/css">
		.loginname{
			text-align: center;
		    font-size: 18px;
		    font-weight: bold;
		    margin-top: 20px;
		    margin-bottom: 60px;
		    background: linear-gradient(180deg, #dbc893 0%, #5b422d 100%);
		    -webkit-background-clip: text;
		    color: transparent;
		}
		.aws-login-font{
			padding: 4px;
		    border-radius: 0;
		    border: 1px solid #ddd;
		    appearance: auto;
		}
		.loginlogo img{
			width: auto;
			max-width: 200px;
			max-height: 40px;
		}
	</style>
</head>
<body>
	<div hidden class="ssodiv" style="margin-left:auto;"></div>
	<div hidden class="loginbox">
		<div style="text-align:right;position:absolute;right:15px;top:15px;">
				<select class="aws-login-font" name="lang" id="lang">
					<option value=cn>中文</option>
					<option value=en>English</option>
					<!-- <option value=big5>繁體</option> -->
				</select>
		</div>
		<div class="loginform">
			<div class="loginlogo"><img src=""></div>
			<div class="loginname">赋能服务业务平台</div>
			<div>
				<div class="login">
					<div class="txtdiv clearfix">
						<span class="fl"><img src="vsharinglogin/img/icon_name.png"></span>
						<input id="USERID" type="text" placeholder="请输入账号" class="fl spectial lang_username">
						<!--<a href="javascript:;" class="xl"><img src="vsharinglogin/img/icon_x2.png"></a>-->
					</div>
					<div class="txtdiv clearfix">
						<span class="fl"><img src="vsharinglogin/img/icon_mima.png"></span>
						<input id="PWD" type="password" placeholder="请输入密码" class="fl lang_password">
					</div>
					<div class="" style="margin-top: 20px;">
						<input type="text" value="" placeholder="请输入校验码" class="jscode" style="width: calc(100% - 112px);height: 32px;border: 1px solid #ddd;box-sizing: border-box;">
						<canvas class="canvas" width="100" height="30" style="vertical-align: middle;box-sizing: border-box;border: 1px solid #ddd;cursor: pointer;"></canvas>
					</div>
					<div id="loginbtn" class="loginbtn">
						<a href="javascript:;" class="lang_login">登录</a>
					</div>
				</div>
				<div class="resetpwd" style="display: none;">
					<div class="txtdiv clearfix">
						<span class="fl"><img src="vsharinglogin/img/icon_name.png"></span>
						<input id="MOBILE_Reset" type="text" placeholder="请输入手机号" class="fl spectial lang_phone">
						<a href="javascript:;" class="xl"><img src="vsharinglogin/img/icon_x2.png"></a>
					</div>
					<!--<div class="txtdiv clearfix">
						<span class="fl"><img src="vsharinglogin/img/icon_mima.png"></span>
						<input id="oldPassword" type="text" placeholder="请输入旧密码" class="fl">
					</div>-->
					<div class="txtdiv clearfix">
						<span class="fl"><img src="vsharinglogin/img/icon_mima.png"></span>
						<input id="newPassword" type="password" placeholder="请输入新密码" class="fl lang_newPassword">
					</div>
					<div class="txtdiv clearfix">
						<span class="fl"><img src="vsharinglogin/img/icon_mima.png"></span>
						<input id="newPassword2" type="password" placeholder="确认新密码" class="fl lang_confirmPassword">
					</div>
					<div class="txtdiv clearfix">
						<input id="getResetCode" type="text" maxlength="6" placeholder="请输入验证码" class="fl lang_phoneCode" style="width:200px">
						<a href="javascript:;" class="fsy lang_getCode">获取验证码</a>
					</div>
					<div class="">
						<input type="text" value="" placeholder="请输入校验码" class="jscode" style="width: 150px;height: 30px;border: 1px solid #ddd;box-sizing: border-box;">
						<canvas class="canvas" width="100" height="30" style="vertical-align: middle;box-sizing: border-box;border: 1px solid #ddd;cursor: pointer;"></canvas>
					</div>
					<div id="goReset" class="loginbtn">
						<a href="javascript:;" class="lang_reset">重置</a>
					</div>
				</div>
				
				
				<div class="clearfix ifCode">
					<div class="tpRadio fl">
						<label>
							<input type="checkbox" class="input_check" name="choose">
							<span></span><span class="lang_rememberPassword">记住密码</span>
						</label>
					</div>
					<div class="fr">
						<a id="rl" href="vsharinglogin/login1.html" class="yzm lang_registOrCodeLogin">注册或验证码登录</a>
						<a href="vsharinglogin/login1.html" class="yzm lang_registOrCodeLogin2">验证码登录</a>
					</div>
					<div class="fr resetBtn" style="font-size: 1em;margin: 22px;">
						<a href="javascript:void(0)" class="lang_resetPassword">重置密码</a>
					</div>
					<div class="fr tologinBtn" style="font-size: 1em;margin: 22px;display: none;">
						<a href="javascript:void(0)" class="lang_usernameLogin">账号登录</a>
					</div>
				</div>
				<div class="clearfix" id="extbtns" style="text-align:right;position:absolute;right:150px;">
				
				</div>
			</div>
		</div>
	</div>
</body>
</html>
<script type="text/javascript" src="vsharinglogin/js/vsharing_common.js?v=2026.3.5"></script>
<script type="text/javascript" src="./vsharinglogin/js/lang.js?v=0.2"></script>
<script type="text/javascript">

(async () => {
	// 重置密码
	$(".resetBtn").click(function(){
		$(".login").css({"display":"none"});
		$(".resetBtn").css({"display":"none"});
		$(".resetpwd").css({"display":"block"});
		$(".tologinBtn").css({"display":"block"});
	});
	$(".tologinBtn").click(function(){
		$(".login").css({"display":"block"});
		$(".resetBtn").css({"display":"block"});
		$(".resetpwd").css({"display":"none"});
		$(".tologinBtn").css({"display":"none"});
	})
	// 环境  pc or mobile
	let uagent = VSUI.getUAgent();
		//uagent = 'welink';
	let userBrowser = VSUI.clientType();
	let	host = window.location.protocol+"//"+window.location.host; //当前根地址
		host += (window.location.href.indexOf("/portal?")<0)? "":"/portal";
	
	// 参数
	let urlParams = new URLSearchParams(window.location.search);
	let ext1 = urlParams.get('ext1') ?? "";
	let ext2 = urlParams.get('ext2') ?? "";
	let ext3 = urlParams.get('ext3') ?? "";
	let ext4 = urlParams.get('ext4') ?? "";
	let ext5 = urlParams.get('ext5') ?? "";

	let openid = 		urlParams.get('openid') ?? "";
	let client_id = 	urlParams.get('client_id') ?? "";
	let response_type = urlParams.get('response_type') ?? "";
	let state = 		urlParams.get('state') ?? "";
	let redirect_uri = 	urlParams.get('redirect_uri') ?? "";
	if (client_id) ext1 = client_id;
	
	$.ajax({
	   type : "get",async:false,url : "../vs/getlogin",
	   success : function(result) {
		   result = JSON.parse(result);
		   VSUI.setCookie("oauth_ticket",result.oauth_ticket,12*60*60*1000);
	   },
	   error : function(e){
		   console.log(e.status);
		   //$('body').append("error："+e.status)
	   }
	})
	
	debugger;
	// login规则
	let ext1Map = {};
	awsui.ajax.request({
		type: "POST", async: false,	url: "./r/jd?cmd=com.awspaas.user.apps.onlineoffice_getLogin&ext1="+ext1
			+"&client_id="+client_id+"&response_type="+response_type+"&state="+state+"&redirect_uri="+redirect_uri,
		ok: function (res) {
			let code = res.data.code;
			if (code=='200') {
				ext1Map = res.data.data;
			} else if(code=='4030' || code=='4031' || code=='4032' || code=='4033'){
				$('body').html(''); $.simpleAlert(res.data.msg,'error');
			} else if (res.data.redirect_uri) {
				VSUI.setCookie("oauth_ticket",res.data.oauth_ticket,12*60*60*1000);
				location.href = res.data.redirect_uri;
			}
		}
	});
	// 短信限制参数
	let JSCODE2 = ext1Map.JSCODE2;
	VSUI.setCookie('ipCode',JSCODE2);
	
	// 参数重整
	host = ext1Map.DEFAULT_WWW? ext1Map.DEFAULT_WWW:host;
	let wxApiHome = ext1Map.wxApiHome? ext1Map.wxApiHome:"https://open.weixin.qq.com";
	
	// final url
	let skipurl = null;
	let skipId = urlParams.get('i') ?? ""; //中间页
	if (skipId) {
		skipurl = "cmd=com.awspaas.user.apps.datamanager_enter&appId=datamanager&html=cskip&ext1="+skipId;
	} else {
		skipurl = VSUI.getCookie("skipurl");	//缓存页
		if(skipurl){
			skipurl = skipurl.substring(skipurl.indexOf("?")+1);
		} else {
			if (ext1Map.USESKIP=='1') {	//规则中间页
				skipurl = "cmd=com.awspaas.user.apps.datamanager_enter&appId=magicportal&html=cdata&ext1="+ext1+"&ext2="+ext2+"&ext3="+ext3+"&ext4="+ext4+"&ext5="+ext5;
			} else {					//配置页
				if (userBrowser=='pc'){
					skipurl = (ext1Map.LOGIN_GO)?ext1Map.LOGIN_GO:ext1Map.LOGIN_GO2;	
				} else {
					skipurl = (ext1Map.LOGIN_GO2)?ext1Map.LOGIN_GO2:ext1Map.LOGIN_GO;
				}
				skipurl = skipurl.includes('?')? skipurl.substring(skipurl.indexOf('?')+1):skipurl;
				if (skipurl.includes("sid=")) {
					let tempu = skipurl.substring(skipurl.indexOf("sid="));
						tempu = tempu.includes('&')? tempu.substring(0,tempu.indexOf('&')):tempu;
					skipurl = skipurl.replace("&"+tempu, '').replace(tempu, '');
				}
			}
		}
	}
	
	// 切换到验证码
	$(".yzm").attr("href","./login1.html?ext1="+ext1+(skipId? "&i="+skipId:""));
	if (window.location.href.indexOf('r=1')>0) {
		let ra = $(".lang_registOrCodeLogin").attr('href')
		window.location.href = ra;
	}
	// 访问与配置不符合
	if (ext1Map.DEFAULT_WWW && ext1Map.DEFAULT_WWW.indexOf(window.location.host)<0) {
		$('body').html('');
		$.simpleAlert('路径错误','error');
	}

	let ACCESS_LOGIN = ext1Map.ACCESS_LOGIN;//进入形式
	let LOGINTYPE = ext1Map.LOGINTYPE; 		//登录方式
	if (ACCESS_LOGIN=='0' || openid){
		if (uagent=="weixin" && LOGINTYPE.indexOf('3')>=0 && ext1Map.CORPID && ext1Map.AGENTID) {
			//企业微信登录
			let wxopenid = VSUI.getCookie("wxopenid");
			if (!wxopenid) {
				$("body").hide();
				let backurl = host+"/back_qywx.jsp?corpId="+ext1Map.CORPID+"&agentId="+ext1Map.AGENTID+"&lang="+language+"&"+skipurl;
				VSUI.setCookie("LOGIN_ID", ext1, 5*60*1000);
				window.location.href = wxApiHome+"/connect/oauth2/authorize?appid="+ext1Map.CORPID+"&redirect_uri="+encodeURIComponent(backurl)+"&response_type=code&scope=snsapi_base&state=v&agentid="+ext1Map.AGENTID+"#wechat_redirect";
			} else {
				$.simpleAlert('您还不是企业微信用户'+wxopenid,'error');
			}
			
		} else {
			// 登录页
			if (userBrowser==="pc" && host.indexOf('localhost')<0) 
				window.location.href = window.location.href.replace("login.","loginPC.");
				
			if (LOGINTYPE.indexOf('1')<0) { //只有短信 go
				if (LOGINTYPE.indexOf('2')>=0) 
					window.location.href = "./login1.html?ext1="+ext1+(skipId? "&i="+skipId:"");
			} else if (ext1Map.OPEN_REGISTER=='1' && ext1Map.REGISTER_DEPARTEMNT && ext1Map.REGISTER_ROLE) {	//有注册
				if (LOGINTYPE.indexOf('2')>=0 || LOGINTYPE.indexOf('4')>=0) {
					$(".yzm").parent().find('.lang_registOrCodeLogin2').remove();
				} else {
					$(".yzm").parent().html('');
				}
				
			} else {
				if (LOGINTYPE.indexOf('2')>=0) {
					$(".yzm").parent().find('.lang_registOrCodeLogin').remove();
				} else {
					$(".yzm").parent().html('');
				}
			}
			
			$(".loginbox").show();
			//扩展按钮
			if (ext1Map.EXTBTNS) {
				let bs =ext1Map.EXTBTNS.replace(/(\r\n)|\r|\n/g, '\n').split(/\n+/g);
				$.each(bs, function(i,n){
					if (n.trim()!='') {
						let ones = n.split('：');
						$('#extbtns').append('<a href="'+ones[1]+'">'+ones[0]+'</a>&nbsp&nbsp&nbsp');
					}
				});
			}

			//logo
			$(".loginlogo").find("img").attr("src", ext1Map.LOGO.replace('..','.'));
			$("title").html(getTitle(ext1Map.LOGIN_NAME));
			$(".loginname").html(getTitle(ext1Map.LOGIN_NAME));
			$("#lang").on('change',function(){
				setLangCookie(this.value, getTitle(ext1Map.LOGIN_NAME, this.value));
			});
			
			//校验码
			let show_num = '';
			if (ext1Map.JSCODE=='1') {
				show_num = draws(100,30);
				$('.canvas').click(function(){
					show_num = draws(100,30);
				});
			} else {
				$('.jscode').parent().hide();
			}

			//账号密码登录
			$("#loginbtn").click(function () {
				let USERID = $("#USERID").val().trim();
				let PWD = $("#PWD").val().trim();
				if(USERID=='' || PWD==''){
					$.simpleAlert(getLanguage("fillInfo"));
				} else if (ext1Map.JSCODE=='1' && $('.jscode:visible').val()!=show_num.join("") ){
					$.simpleAlert('校验码不一致');
				} else {
					awsui.ajax.request({
						type: "POST", async: false,
						url: "./r/jd?cmd=com.awspaas.user.apps.onlineoffice_login",
						data: "loginid="+ext1+"&USERID="+USERID+"&PWD="+encodeURIComponent(rsaEncrypt(PWD))+"&types=PWD"+"&loginType="+userBrowser
							+"&client_id="+client_id+"&response_type="+response_type+"&state="+state+"&redirect_uri="+redirect_uri,
						ok: function (res) {
							if (res.data.code=='200'){
								VSUI.setCookie("oauth_ticket",res.data.USERID,12*60*60*1000);
								if (client_id) {
									window.location.href = res.data.redirect_uri;
								} else {
									VSUI.loginOut();
									window.location.href = host+"/r/or?oauthName=token&uid="+res.data.USERID+"&lang="+language+"&"+skipurl;
								}
							} else if (res.data.code=='4000') {
									$.simpleAlert(res.data.msg);
							} else if (res.data.code=='4001'){
								if (res.data.msg) {
									$.simpleAlert(res.data.msg);
								} else {
									$.simpleAlert(getLanguage("userOrPasswoError"));
								}
							} else if (res.data.code=='4002'){
								$.simpleAlert(getLanguage("userOrPasswoError"));
							} else if (res.data.code=='4003'){
								$.simpleAlert(getLanguage("userCancel"));
							} else if(res.data.code=='4004'){
								$.simpleAlert(getLanguage("defPasswordNeedReset"));
							} else if(res.data.code=='4030'){
								$.simpleAlert(res.data.msg,'info',3000);
							} else if(res.data.code=='4031'){
								$.simpleAlert(res.data.msg,'info',3000);
							} else if(res.data.code=='4032'){
								$.simpleAlert(res.data.msg,'info',3000);
							} else if(res.data.code=='4033'){
								$.simpleAlert(res.data.msg,'info',3000);
							} else {
								$.simpleAlert(getLanguage("error"));
							}
						}
					});
				}
			});
			
			if(ext1Map.SEND_NOTICE){ //发送方法
				//密码重置
				$("#goReset").click(function(){
					let MOBILE = $("#MOBILE_Reset").val().trim();
					//let oldPassword = $("#oldPassword").val().trim();
					let newPassword = $("#newPassword").val().trim();
					let newPassword2 = $("#newPassword2").val().trim();
					let code = $("#getResetCode").val().trim();
					if(MOBILE=='' || code=='' || newPassword=='' || newPassword2==''){
						$.simpleAlert(getLanguage("fillInfo"));
					} else if(newPassword!=newPassword2){
						$.simpleAlert(getLanguage("passwordNotLike"));
					} else if (ext1Map.JSCODE=='1' && $('.jscode:visible').val()!=show_num.join("") ){
						$.simpleAlert('校验码不一致');
					} else {
						awsui.ajax.request({
							type: "POST", async: false,
							url: "./r/jd?cmd=com.awspaas.user.apps.onlineoffice_changePWD",
							//data: "code="+code+"&MOBILE="+MOBILE+"&oldPassword="+oldPassword+"&newPassword="+newPassword,
							data: "loginID="+ext1+"&MOBILE="+MOBILE+"&code="+code+"&newPassword="+encodeURIComponent(rsaEncrypt(newPassword)),
							ok: function (res) {
								if (res.data.code=='200'){
									$.simpleAlert(getLanguage("resetPasswordSuccess"));
								} else if (res.data.code=='4000') {
									$.simpleAlert(res.data.msg);
								} else if (res.data.code=='4010'){
									$.simpleAlert(getLanguage("resetPasswordFail"));
								} else if (res.data.code=='4002'){
									$.simpleAlert(getLanguage("userOrPasswoError"));
								} else if (res.data.code=='4003'){
									$.simpleAlert(getLanguage("userCancel2"));
								} else if (res.data.code=='4005'){
									$.simpleAlert(getLanguage("codeError"));
								} else if (res.data.msg) {
									$.simpleAlert(res.data.msg);
								} else {
									$.simpleAlert(getLanguage("error"));
								}
							}
						});
					}
				});

				//发送验证码并保存
				let timer;
				$(".fsy").click(function () {
					let MOBILE=$("#MOBILE_Reset").val();
					if(!(/^1[3456789]\d{9}$/.test(MOBILE))){
						$.simpleAlert(getLanguage("inputValidPhone"));
						return false;
					}

					let da = "MOBILE="+MOBILE+"&code="+ext1Map.SEND_NOTICE;
					console.log("开始发送短信...");
					awsui.ajax.request({
						type: "POST",
						url: "./r/jd?cmd=com.awspaas.user.apps.onlineoffice_mobilecode",
						data: da+"&LOGIN_ID="+ext1Map.LOGIN_ID+"&JSCODE2="+JSCODE2,
						async: false,
						ok: function (res) {
							JSCODE2 = res.data.JSCODE2;
							if (res.data.code=='200'){
								$(".loginbtn").show();
								if(res.data.data=="1"){
									$.simpleAlert(getLanguage("sendCodeSuccess"));
									let time = 60;
									timer = setInterval(function() {
										if (time == 0) {
											clearInterval(timer);
											$(".fsy").attr("disabled", false);
											$(".fsy").text(getLanguage("getCode"));
											$(".fsy").removeClass("notclick");
										} else {
											$(".fsy").addClass("notclick");
											$(".fsy").text(time + "s");
											time--;
										}
									}, 1000);
								} else if(res.data.data=="调用次数已达上限"){
									$.simpleAlert(getLanguage("sengDisable"));
								} else if(res.data.data=="验证有误"){
									$.simpleAlert("请重新尝试", "info", 2000);
								} else {
									$.simpleAlert(getLanguage("sendCodeFail"));
								}
							} else if (res.data.code=='4009') {
								$.simpleAlert("短信验证码获取过快，请60秒后再试",'info',3000);
							} else if(res.data.code=='4001'){
								$(".registerbtn").show();
								$(".pwd").show();
								$.simpleAlert(getLanguage("userOrPasswoError"));
							} else if(res.data.code=='4007'){
								$.simpleAlert(getLanguage("userAlreadyExist"));
							} else if(res.data.code=='4008'){
								$.simpleAlert(getLanguage("userCancel2"));
							} else if(res.data.code=='4003'){
								$.simpleAlert(getLanguage("userCancel"));
							} else if (res.data.code=='4002'){
								$.simpleAlert(getLanguage("userOrPasswoError"));
							} else {
								$.simpleAlert(getLanguage("sendCodeFail"));
							}
						}
					});
				});
			} else {
				$(".ifCode").hide();
			}
		}
	} else if(ACCESS_LOGIN=='1'){
		//第三方认证
		$(".ssodiv").show();
		let param = decodeURIComponent(urlParams.get('param') ?? "");
		if (ext1Map.OPEN_REGISTER=='1' && param){
			awsui.ajax.request({
				type: "POST", async: false,
				url: "./r/jd?cmd=com.awspaas.user.apps.onlineoffice_otherRegist",
				data: "loginId=" + ext1 + "&param=" + encodeURIComponent(param) + "&loginType=" + userBrowser,
				ok: function (res) {
					console.log(res);
					if (res.data.code=='200'){
						if(res.data.url){
							let url = res.data.url.replace("./w?","./r/w?")
							if (ext1Map.LINKCODE=='0') {
								url = decodeURIComponent(url);
							}
							window.location.href = url;
						} else {
							window.location.href = host+"/r/or?oauthName=token&uid="+res.data.USERID+"&lang="+language+"&"+skipurl;
						}
					} else if(res.data.code=='参数有误'){
						$.simpleAlert(getLanguage("extParame"));
					} else if(res.data.code=='4007'){
						$.simpleAlert(getLanguage("userAlreadyExist"));
					} else if(res.data.code=='4006'){
						$.simpleAlert(getLanguage("registFail"));
					} else {
						$.simpleAlert(getLanguage("error"));
					}
				}
			});
		} else {
			//OAUTH|CAS|wechat:服务号|qyweixin:企业微信|dd:钉钉|welink:welink
			let authentication = userBrowser=='pc'? ext1Map.THIRDTYPE:ext1Map.MOBILETYPE;
			if (uagent=="weixin" && authentication.includes('qyweixin')) {
			
				//企业微信
				VSUI.setCookie("LOGIN_ID", ext1, 5*60*1000);
				let corpId_agentId = ext1Map.OAUTH.split(",");
				let backurl = host+"/back_qywx.jsp?corpId="+corpId_agentId[0]+"&agentId="+corpId_agentId[1]+"&lang="+language+"&"+skipurl;
				window.location.href = wxApiHome+"/connect/oauth2/authorize?appid="+corpId_agentId[0]+"&redirect_uri="+encodeURIComponent(backurl)+"&response_type=code&scope=snsapi_base&state=v#wechat_redirect";
				
			} else if (uagent=="weixin" && authentication.includes('wechat')) {
			
				//服务号
				let wxcodeurl = wxApiHome+'/connect/oauth2/authorize?appid='+ext1Map.WECHATAPPID+'&redirect_uri='+encodeURIComponent(host+'/wxSA.jsp?ext1='+ext1+'&ext2='+ext2+'&ext3='+ext3+'&ext4='+ext4+'&ext5='+ext5)+'&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect';
				location.href = wxcodeurl;
				
			} else if (uagent=="dd" && authentication.includes('dd')) {
			
				//钉钉 DD_CORPID,DD_CLIENTID
				VSUI.loadJS('https://g.alicdn.com/dingding/dingtalk-jsapi/3.1.0/dingtalk.open.js', 'dd', async () => {
					let dcode = await VSUI.getDDCodeSync(ext1Map.DD_CORPID, ext1Map.DD_CLIENTID);
					let h = host+"/r/or?oauthName=d&f=" +ext1Map.OAUTH_DEF+"&host=&lang="+language+"&code="+dcode+"&"+skipurl;
					const absoluteH = VSUI.toAbsoluteUrl(h)
					window.history.replaceState(null, document.title, absoluteH);
					window.location.replace(absoluteH);
				});
				
			} else if (uagent=="feishu" && authentication.includes('feishu')) {
			
				//飞书
				let h = host+"/r/or?oauthName=feishu&f="+ext1Map.OAUTH_DEF+"&host=&lang="+language+"&"+skipurl;
				window.location.href = h;
				
			} else if (uagent=="welink" && authentication.includes('welink')) {
			
				//welink
				VSUI.loadJS('https://open-doc.welink.huaweicloud.com/docs/jsapi/2.0.12/hwh5-cloudonline.js', 'welink', () => {
					HWH5.getAuthorizationCode().then(code => {
						let h = host+"/r/or?oauthName=wl&f="+ext1Map.OAUTH_DEF+"&host=&lang="+language+"&code="+code.code+"&"+skipurl;
						window.location.href = h;
					}).catch(error => {
						console.log('获取异常', error);
					});
				});	
				
			} else if (authentication.includes('dd')) {
			
				//钉钉
				let h = host+"/r/or?oauthName=dd&f="+ext1Map.OAUTH_DEF+ "&host=&lang="+language+"&"+skipurl;
				window.location.href = h;
				
			} else if (authentication.includes('feishu')) {
			
				//飞书
				let h = host+"/r/or?oauthName=feishu&f="+ext1Map.OAUTH_DEF+"&host=&lang="+language+"&"+skipurl;
				window.location.href = h;
				
			} else if (authentication.includes('OAUTH')) {
			
				//OAUTH
				let h = host+"/r/or?oauthName=ssologins&f="+ext1Map.OAUTH_DEF+"&lang="+language+"&"+skipurl;
				window.location.href = h;
			
			} else if (authentication.includes('CAS')) {
				let u = host + "/r/w?"+skipurl;
				VSUI.setCookie("ssourl", u, 2*60*60*1000);
				window.location.href = "./index.jsp";
			} else {
				$.simpleAlert("no authentication", 'error');
			}
		}

	} else if(ACCESS_LOGIN=='2'){
		//直接进入页面
		$(".ssodiv").show();
		window.location.href = ext1Map.LOGIN_GO;
	}
})();
</script>