52 lines
1.8 KiB
HTML
52 lines
1.8 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>admin</title>
|
|
</head>
|
|
<body>
|
|
<div id="app">
|
|
<p>code: {{code}}</p>
|
|
<hr>
|
|
<p>access_token: {{usertoken.access_token}}</p>
|
|
<p>openid: {{usertoken.openid}}</p>
|
|
<hr>
|
|
<img :src='user.headimgurl'>
|
|
<p>nickname: {{user.nickname}}</p>
|
|
</div>
|
|
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
|
|
<script src="https://cdn.bootcss.com/vue/2.6.11/vue.min.js"></script>
|
|
<script src="js/site.js"></script>
|
|
<script>
|
|
new Vue({
|
|
el: '#app',
|
|
data: {
|
|
code:'',
|
|
user: {},
|
|
usertoken:{},
|
|
},
|
|
methods: {
|
|
|
|
},
|
|
created: function() {
|
|
var that=this;
|
|
this.code = GetQueryString('code');
|
|
this.usertoken = getUserToken(this.code);
|
|
if (this.usertoken == null || this.usertoken.access_token == ""){
|
|
window.location.href="https://open.weixin.qq.com/connect/qrconnect?appid=wx8466bd57e3f3e42e&redirect_uri=https%3A%2F%2Fwww.xintijiao.com%2Fwechat%2Fmain.html&response_type=code&scope=snsapi_login&state=98766554#wechat_redirect";
|
|
}
|
|
$.ajax({
|
|
url:url + '/open/userinfo?token='+this.usertoken.access_token+'&openid='+this.usertoken.openid,
|
|
type:"GET",
|
|
success:function(data,ok){
|
|
if (ok=='success'){
|
|
that.user=data;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
})
|
|
</script>
|
|
</body>
|
|
</html> |