Skip to content

Commit

Permalink
1.验证页、案例页功能体验优化 2.删除部分无用注释,格式化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
shinn-lancelot committed Jul 10, 2018
1 parent 781fd0a commit 69fc773
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 26 deletions.
2 changes: 0 additions & 2 deletions WechatOauthProxy/WechatOauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public static function refreshAccessToken($paramsArr = array())
$apiUrl = 'https://api.weixin.qq.com/sns/oauth2/refresh_token?';
$requestUrl = $apiUrl . http_build_query($paramsArr);
return json_decode(WechatOauth::http_request($requestUrl),true);

}

/**
Expand All @@ -54,7 +53,6 @@ public static function checkAccessToken($paramsArr = array())
$apiUrl = 'https://api.weixin.qq.com/sns/auth?';
$requestUrl = $apiUrl . http_build_query($paramsArr);
return json_decode(WechatOauth::http_request($requestUrl),true);

}

/**
Expand Down
9 changes: 6 additions & 3 deletions demo/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ function http_request($url, $data = null)
width: 60%;
}
.qrcode-frame p{
font-size: 3.5vw;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
Expand All @@ -118,6 +119,7 @@ function http_request($url, $data = null)
.info-title {
width: 100%;
color: #36a82e;
font-size: 3.5vw;
font-weight: bold;
overflow: hidden;
text-overflow: ellipsis;
Expand Down Expand Up @@ -163,11 +165,12 @@ function http_request($url, $data = null)
redirect_uri = "<?php echo $redirect_uri ?>",
code = "<?php echo $code ?>",
access_token = "<?php echo $access_token ?>",
openid = "<?php echo $openid ?>";
openid = "<?php echo $openid ?>",
proxy_domain = "wxoauth.hillpy.com";

var codeUrl = "http://wxoauth.hillpy.com/index.php?app_id=" + appid + "&scope=" + scope + "&proxy_scope=" + proxy_scope + "&redirect_uri=" + redirect_uri;
var codeUrl = "http://" + proxy_domain + "/index.php?app_id=" + appid + "&scope=" + scope + "&proxy_scope=" + proxy_scope + "&redirect_uri=" + redirect_uri;
proxy_scope = "<?php $proxy_scope = 'access_token'; echo $proxy_scope ?>";
var accessTokenUrl = "http://wxoauth.hillpy.com/index.php?app_id=" + appid + "&scope=" + scope + "&proxy_scope=" + proxy_scope + "&app_secret=" + appsecret + "&redirect_uri=" + redirect_uri;
var accessTokenUrl = "http://" + proxy_domain + "/index.php?app_id=" + appid + "&scope=" + scope + "&proxy_scope=" + proxy_scope + "&app_secret=" + appsecret + "&redirect_uri=" + redirect_uri;

var codeBtn = document.getElementsByClassName('code-btn')[0],
accessTokenBtn = document.getElementsByClassName('accesstoken-btn')[0];
Expand Down
38 changes: 17 additions & 21 deletions verify.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
justify-content: center;
width: 100%;
height: 10vw;
/*max-height: calc(640px * 0.1);*/
margin: 3vw auto 0;
padding: 0 10vw;
box-sizing: border-box;
Expand Down Expand Up @@ -47,7 +46,6 @@
align-items: center;
justify-content: center;
width: 100%;
/*height: 10vw;*/
height: calc(640px * 0.1);
margin: calc(640px * 0.03) auto 0;
padding: 0 calc(640px * 0.1);
Expand Down Expand Up @@ -98,15 +96,6 @@
-webkit-transform: translate(-50%, -50%);
}

/*.logo {*/
/*margin: 0 auto;*/
/*width: 30vw;*/
/*height: 30vw;*/
/*max-width: calc(640px * 0.3);*/
/*max-height: calc(640px * 0.3);*/
/*background: url("./asset/image/oauth_proxy.png") no-repeat center / contain;*/
/*}*/

#form {
margin: 0 2vw;
}
Expand All @@ -123,11 +112,15 @@
/*}*/

#submit_btn,#copy {
user-select: none;
color: #fff;
background: #36a82e;
cursor: pointer;
border-radius: 3px;
-moz-user-select: none;
-o-user-select:none;
-webkit-user-select:none;
-ms-user-select:none;
user-select: none;
}
/*#submit_btn:hover {*/
/*opacity: 0.8;*/
Expand Down Expand Up @@ -226,12 +219,23 @@
responseObj = JSON.parse(xhr.response);
alert(responseObj.message);
submitState = 1;
clearFunc();
} else {
console.log(xhr.readyState);
}
}
}

var clearFunc = function (e) {
txtObj.value = '';
var txtClass = submitBtnObj.getAttribute('class');
if (txtClass == 'field') {
submitBtnObj.setAttribute('class', 'field disable');
}
clearIconObj.style.display = 'none';
submitBtnObj.removeEventListener('click', submitFunc);
}

txtObj.addEventListener('input', function (e) {
submitBtnObj.removeEventListener('click', submitFunc);
txt = txtObj.value;
Expand Down Expand Up @@ -265,15 +269,7 @@
}
});

clearIconObj.addEventListener('click', function (e) {
txtObj.value = '';
var txtClass = submitBtnObj.getAttribute('class');
if (txtClass == 'field') {
submitBtnObj.setAttribute('class', 'field disable');
}
this.style.display = 'none';
submitBtnObj.removeEventListener('click', submitFunc);
});
clearIconObj.addEventListener('click', clearFunc);

formObj.addEventListener('keydown', function (e) {
txt = txtObj.value;
Expand Down

0 comments on commit 69fc773

Please sign in to comment.