Commit 8d881068 by libai

测试

parent fc17fa8e
Showing with 52 additions and 1 deletions
......@@ -8,7 +8,7 @@ function loginGo(){
html+=' <div class="google-login-btn" id="buttonDiv"></div>';
html+=' <div class="more-login"><img src="https://www.footseen.xyz/yazhaiTest/images/more-login.png" alt=""></div>';
html+=' <div class="more-login-box">';
html+=' <div class="more-login-icon"><img src="https://www.footseen.xyz/yazhaiTest/images/login-icon2.png" alt=""></div>';
html+=' <div class="more-login-icon"><img id="twitter_btn" src="https://www.footseen.xyz/yazhaiTest/images/login-icon2.png" alt=""></div>';
html+=' <div class="more-login-icon"><img src="https://www.footseen.xyz/yazhaiTest/images/login-icon3.png" alt=""></div>';
html+=' <div class="more-login-icon"><img src="https://www.footseen.xyz/yazhaiTest/images/login-icon4.png" alt=""></div>';
html+=' </div>';
......@@ -979,3 +979,52 @@ function loginLayer(){
}
})
}
$('#twitter_btn').on('click', function () {
login_twitter('twitter');
})
//twitter
window.twttr = (function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
if (d.getElementById(id)) return t;
js = d.createElement(s);
js.id = id;
js.src = "https://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
t._e = [];
t.ready = function (f) {
t._e.push(f);
};
return t;
}(document, "script", "twitter-wjs"));
var log = console.log;
hello.init(
{ 'twitter': 'cEGECNgXN3ZN00r3Zb82vwh55' }, //App_key
{
oauth_proxy: 'https://auth-server.herokuapp.com/proxy',
redirect_uri: 'https://www.footseen.xyz/yazhaiTest/pc.html'
});
function login_twitter(network) { //登录方法,并将twitter 作为参数传入
// Twitter instance
var twitter = hello(network);
// Login
twitter.login().then(function (r) {
// Get Profile
return twitter.api('me')
}, log).then(function (p) {
var r2 = JSON.parse(localStorage.getItem('hello'));
console.dir(p);
console.log(r2.twitter)
//已获取用户信息,在此处理
// window.location.href = "footseenlogin://" + encodeURIComponent("www.firefly.live?secret=" + r2.twitter.oauth_token_secret + "&token=" + r2.twitter.oauth_token + "&name=" + p.name + "&profileImageUrl=" + p.thumbnail + "&id=" + r2.twitter.user_id);
// if (p) {
// }
}, log);
}
\ No newline at end of file
......@@ -18,6 +18,7 @@
<link rel="stylesheet" href="css/neck.css">
<link rel="stylesheet" href="css/login.css?v=20220620">
<script src="https://accounts.google.com/gsi/client" async defer></script>
<script src="https://adodson.com/hello.js/dist/hello.all.js"></script>
</head>
<body style="background: #F4F5F8">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment