sunyadv 5 anni fa
parent
commit
aceef8d288
1 ha cambiato i file con 56 aggiunte e 3 eliminazioni
  1. 56 3
      src/main/resources/templates/index.html

+ 56 - 3
src/main/resources/templates/index.html

@@ -1,10 +1,63 @@
 <!DOCTYPE html>
-<html lang="en">
+<html>
 <head>
     <meta charset="UTF-8">
-    <title>Title</title>
+    <title>测试用页面</title>
+    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
+    <script src="http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>
+    <style>
+        div, a {
+            font-size: 60px;
+        }
+    </style>
 </head>
 <body>
-<h1>这是个首页</h1>
+<div>
+    <a onclick="getMsgByWX()">获取微信数据</a>
+</div>
+<br>
+<div>
+    <a onclick="getMsgByWB()">获取微博数据</a>
+</div>
+<script>
+    function getMsgByWX() {
+    }
+
+    function getMsgByWB() {
+    }
+
+    (function() {
+        if (browser.versions.mobile) {//判断是否是移动设备打开。browser代码在下面
+            var ua = navigator.userAgent.toLowerCase();//获取判断用的对象
+            if (ua.match(/MicroMessenger/i) == "micromessenger") {
+                alert("微信浏览器中打开");
+                var loginInfo = {
+                    "appid": 'wx749c84daac654e1e',
+                    "redirect_uri": 'wx.ttkuaiban.com',
+                    "response_type": 'code',
+                    "scope": "snsapi_base"
+                };
+                window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?"+ loginInfo +"&state=STATE#wechat_redirect";
+            }
+
+            if (ua.match(/WeiBo/i) == "weibo") {
+                alert("在新浪微博客户端打开");
+                $.get("demo_ajax_load.txt", function(result){
+                    $("div").html(result);
+                });
+
+            }
+            // if (ua.match(/QQ/i) == "qq") {
+            //     alert("在QQ空间打开");
+            // }
+            // if (browser.versions.ios) {
+            //     alert("在IOS中打开");
+            // }
+            // if(browser.versions.android){
+            //     alert("在安卓浏览器打开");
+            // }
+        }
+    })()
+</script>
 </body>
 </html>