diff --git a/dinglogin/dingding - 副本.js b/dinglogin/dingding - 副本.js new file mode 100644 index 00000000..4ccce825 --- /dev/null +++ b/dinglogin/dingding - 副本.js @@ -0,0 +1,41 @@ +$(function(){ + var url = encodeURIComponent("https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=dingoaeyo28cm9bj2cxoxs&response_type=code&scope=snsapi_login&state=STATE&redirect_uri=http://www.mycht.cn/info.php/apps/dingding/index/auth_login"); + var obj = DDLogin({ + id:"login_container",//这里需要你在自己的页面定义一个HTML标签并设置id,例如
或 + goto: url, + style: "", + href: "", + width : "300px", + height: "300px" + }); + + var hanndleMessage = function (event) { + var loginTmpCode = event.data; //拿到loginTmpCode后就可以在这里构造跳转链接进行跳转了 + var origin = event.origin; + login_url = 'https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=dingoaeyo28cm9bj2cxoxs&response_type=code&scope=snsapi_login&state=STATE&redirect_uri=http://www.mycht.cn/info.php/apps/dingding/index/auth_login&loginTmpCode='+loginTmpCode; + window.location.href = login_url; + }; + if (typeof window.addEventListener != 'undefined') { + window.addEventListener('message', hanndleMessage, false); + } else if (typeof window.attachEvent != 'undefined') { + window.attachEvent('onmessage', hanndleMessage); + } + + $('.login_type').click(function(){ + if($(this).html() == '账号登录'){ + $('.pc_login').removeClass('hide'); + $('#login_container').addClass('hide'); + $('.ding_login').addClass('hide'); + $(this).addClass('login_type_active'); + $(this).prev().removeClass('login_type_active'); + } + if($(this).html() == '钉钉扫码登录'){ + $('.ding_login').removeClass('hide'); + $('#login_container').removeClass('hide'); + $('.pc_login').addClass('hide'); + $(this).addClass('login_type_active'); + $(this).next().removeClass('login_type_active'); + } + }); + +}); diff --git a/dinglogin/dingding.css b/dinglogin/dingding.css new file mode 100644 index 00000000..506093d9 --- /dev/null +++ b/dinglogin/dingding.css @@ -0,0 +1,29 @@ +.ding_login{ + width:365px; + height:400px; + margin:0 auto; +} +.login_header{ + width: 100%; + height: 64px; + font-size: 18px; + color: #898d90; + overflow: hidden; + border-bottom: 1px solid #e8e8e8; +} +.login_type{ + width: 50%; + line-height: 60px; + text-align: center; + border-bottom: 4px solid transparent; + float: left; + cursor: pointer; +} +.login_type_active{ + color: #38adff; + border-bottom: 4px solid #38adff; + cursor: default; +} +.hide{ + display: none; +} \ No newline at end of file diff --git a/dinglogin/dingding.js b/dinglogin/dingding.js new file mode 100644 index 00000000..4ccce825 --- /dev/null +++ b/dinglogin/dingding.js @@ -0,0 +1,41 @@ +$(function(){ + var url = encodeURIComponent("https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=dingoaeyo28cm9bj2cxoxs&response_type=code&scope=snsapi_login&state=STATE&redirect_uri=http://www.mycht.cn/info.php/apps/dingding/index/auth_login"); + var obj = DDLogin({ + id:"login_container",//这里需要你在自己的页面定义一个HTML标签并设置id,例如或 + goto: url, + style: "", + href: "", + width : "300px", + height: "300px" + }); + + var hanndleMessage = function (event) { + var loginTmpCode = event.data; //拿到loginTmpCode后就可以在这里构造跳转链接进行跳转了 + var origin = event.origin; + login_url = 'https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=dingoaeyo28cm9bj2cxoxs&response_type=code&scope=snsapi_login&state=STATE&redirect_uri=http://www.mycht.cn/info.php/apps/dingding/index/auth_login&loginTmpCode='+loginTmpCode; + window.location.href = login_url; + }; + if (typeof window.addEventListener != 'undefined') { + window.addEventListener('message', hanndleMessage, false); + } else if (typeof window.attachEvent != 'undefined') { + window.attachEvent('onmessage', hanndleMessage); + } + + $('.login_type').click(function(){ + if($(this).html() == '账号登录'){ + $('.pc_login').removeClass('hide'); + $('#login_container').addClass('hide'); + $('.ding_login').addClass('hide'); + $(this).addClass('login_type_active'); + $(this).prev().removeClass('login_type_active'); + } + if($(this).html() == '钉钉扫码登录'){ + $('.ding_login').removeClass('hide'); + $('#login_container').removeClass('hide'); + $('.pc_login').addClass('hide'); + $(this).addClass('login_type_active'); + $(this).next().removeClass('login_type_active'); + } + }); + +}); diff --git a/dinglogin/dingdingtest.css b/dinglogin/dingdingtest.css new file mode 100644 index 00000000..506093d9 --- /dev/null +++ b/dinglogin/dingdingtest.css @@ -0,0 +1,29 @@ +.ding_login{ + width:365px; + height:400px; + margin:0 auto; +} +.login_header{ + width: 100%; + height: 64px; + font-size: 18px; + color: #898d90; + overflow: hidden; + border-bottom: 1px solid #e8e8e8; +} +.login_type{ + width: 50%; + line-height: 60px; + text-align: center; + border-bottom: 4px solid transparent; + float: left; + cursor: pointer; +} +.login_type_active{ + color: #38adff; + border-bottom: 4px solid #38adff; + cursor: default; +} +.hide{ + display: none; +} \ No newline at end of file diff --git a/dinglogin/dingmail.js b/dinglogin/dingmail.js new file mode 100644 index 00000000..a7d1dc76 --- /dev/null +++ b/dinglogin/dingmail.js @@ -0,0 +1,43 @@ +$(function(){ + var url = encodeURIComponent("https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=dingoagxeeheunc0p95eu8&response_type=code&scope=snsapi_login&state=STATE&redirect_uri=http://www.mycht.cn/webht.php/apps/dingmail/index/auth_login"); + + var obj = DDLogin({ + id:"login_container",//这里需要你在自己的页面定义一个HTML标签并设置id,例如或 + goto: url, + style: "", + href: "", + width : "300px", + height: "300px" + }); + + var hanndleMessage = function (event) { + var loginTmpCode = event.data; //拿到loginTmpCode后就可以在这里构造跳转链接进行跳转了 + var origin = event.origin; + login_url = 'https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=dingoagxeeheunc0p95eu8&response_type=code&scope=snsapi_login&state=STATE&redirect_uri=http://www.mycht.cn/webht.php/apps/dingmail/index/auth_login&loginTmpCode='+loginTmpCode; + window.location.href = login_url; + }; + if (typeof window.addEventListener != 'undefined') { + window.addEventListener('message', hanndleMessage, false); + } else if (typeof window.attachEvent != 'undefined') { + window.attachEvent('onmessage', hanndleMessage); + } + + $('.login_type').click(function(){ + console.log($(this).html()); + if($(this).html() == '钉钉帐号密码登录'){ + $('.pc_login').removeClass('hide'); + $('#login_container').addClass('hide'); + $('.ding_login').addClass('hide'); + $(this).addClass('login_type_active'); + $(this).prev().removeClass('login_type_active'); + } + if($(this).html() == '钉钉扫码登录'){ + $('.ding_login').removeClass('hide'); + $('#login_container').removeClass('hide'); + $('.pc_login').addClass('hide'); + $(this).addClass('login_type_active'); + $(this).next().removeClass('login_type_active'); + } + }); + +}); diff --git a/dinglogin/dingmailtest.js b/dinglogin/dingmailtest.js new file mode 100644 index 00000000..f52fb95f --- /dev/null +++ b/dinglogin/dingmailtest.js @@ -0,0 +1,42 @@ +$(function(){ + var url = encodeURIComponent("https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=dingoar4ini4akuc7mifny&response_type=code&scope=snsapi_login&state=STATE&redirect_uri=http://share.chtcdn.com/webht.php/apps/dingmailtest/index/auth_login"); + + var obj = DDLogin({ + id:"login_container",//这里需要你在自己的页面定义一个HTML标签并设置id,例如或 + goto: url, + style: "", + href: "", + width : "300px", + height: "300px" + }); + + var hanndleMessage = function (event) { + var loginTmpCode = event.data; //拿到loginTmpCode后就可以在这里构造跳转链接进行跳转了 + var origin = event.origin; + login_url = 'https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=dingoar4ini4akuc7mifny&response_type=code&scope=snsapi_login&state=STATE&redirect_uri=http://share.chtcdn.com/webht.php/apps/dingmailtest/index/auth_login&loginTmpCode='+loginTmpCode; + window.location.href = login_url; + }; + if (typeof window.addEventListener != 'undefined') { + window.addEventListener('message', hanndleMessage, false); + } else if (typeof window.attachEvent != 'undefined') { + window.attachEvent('onmessage', hanndleMessage); + } + + $('.login_type').click(function(){ + if($(this).html() == '账号登录'){ + $('.pc_login').removeClass('hide'); + $('#login_container').addClass('hide'); + $('.ding_login').addClass('hide'); + $(this).addClass('login_type_active'); + $(this).prev().removeClass('login_type_active'); + } + if($(this).html() == '钉钉扫码登录'){ + $('.ding_login').removeClass('hide'); + $('#login_container').removeClass('hide'); + $('.pc_login').addClass('hide'); + $(this).addClass('login_type_active'); + $(this).next().removeClass('login_type_active'); + } + }); + +});