Commit 3d774a40 by libai

测试

parent b9218d04
Showing with 26 additions and 14 deletions
...@@ -5,7 +5,7 @@ function loginGo(){ ...@@ -5,7 +5,7 @@ function loginGo(){
html+=' <div style="display: none;" class="login-box1">'; html+=' <div style="display: none;" class="login-box1">';
html+=' <div class="login-title">登入</div>'; html+=' <div class="login-title">登入</div>';
html+=' <div class="phone-login-btn"></div>'; html+=' <div class="phone-login-btn"></div>';
html+=' <div class="google-login-btn" data-type="icon" id="buttonDiv"></div>'; html+=' <div class="google-login-btn" id="g_id_onload"data-client_id="534183685500-ag0vai0jh6todldi4rg6lvp0gcsojk0n.apps.googleusercontent.com" data-callback="handleCredentialResponse">></div>';
html+=' <div class="more-login"><img src="https://www.footseen.xyz/yazhaiTest/images/more-login.png" alt=""></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-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 src="https://www.footseen.xyz/yazhaiTest/images/login-icon2.png" alt=""></div>';
...@@ -126,19 +126,31 @@ function loginGo(){ ...@@ -126,19 +126,31 @@ function loginGo(){
html+='</div>'; html+='</div>';
$(".login-content").html(html); $(".login-content").html(html);
function handleCredentialResponse(response) { function handleCredentialResponse(response) {
console.log("Encoded JWT ID token: " + response.credential); // decodeJwtResponse() is a custom function defined by you
} // to decode the credential response.
window.onload = function () { const responsePayload = decodeJwtResponse(response.credential);
google.accounts.id.initialize({
client_id: "534183685500-ag0vai0jh6todldi4rg6lvp0gcsojk0n.apps.googleusercontent.com", console.log("ID: " + responsePayload.sub);
callback: handleCredentialResponse console.log('Full Name: ' + responsePayload.name);
}); console.log('Given Name: ' + responsePayload.given_name);
google.accounts.id.renderButton( console.log('Family Name: ' + responsePayload.family_name);
document.getElementById("buttonDiv"), console.log("Image URL: " + responsePayload.picture);
{ theme: "outline", size: "390px", } // customization attributes console.log("Email: " + responsePayload.email);
); }
google.accounts.id.prompt(); // also display the One Tap dialog // function handleCredentialResponse(response) {
} // console.log("Encoded JWT ID token: " + response.credential);
// }
// window.onload = function () {
// google.accounts.id.initialize({
// client_id: "534183685500-ag0vai0jh6todldi4rg6lvp0gcsojk0n.apps.googleusercontent.com",
// callback: handleCredentialResponse
// });
// google.accounts.id.renderButton(
// document.getElementById("buttonDiv"),
// { theme: "outline", size: "390px", } // customization attributes
// );
// google.accounts.id.prompt(); // also display the One Tap dialog
// }
var html=[]; var html=[];
html+='<div style="display: none;" class=nav-login-btn>登入/註冊</div>'; html+='<div style="display: none;" class=nav-login-btn>登入/註冊</div>';
......
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