index.html 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>学前能力测试</title>
  8. <link rel="stylesheet" href="./css/index.css">
  9. <script src="./utils/size.js"></script>
  10. </head>
  11. <body>
  12. <div class="container">
  13. <img class="bg" src="./image/index/indexbg.jpg" alt="">
  14. <a href="./view/question.html" class="btn"></a>
  15. </div>
  16. <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
  17. <script>
  18. //获取用户信息
  19. var jionData = {
  20. "code": GetQueryString('code')
  21. };
  22. if(jionData.code){
  23. $.ajax({
  24. url: "https://activity.lingjiao.cn/activity/wx/ucenter/wxlogin",
  25. type: 'GEt',
  26. contentType:'application/json;charset=utf-8',
  27. data: jionData,
  28. success: function (userData) {
  29. //alert(JSON.stringify(userData.data))
  30. $('.btn').show();
  31. localStorage.setItem('userData', JSON.stringify(userData.data));
  32. },
  33. error: function (e) {
  34. //alert(JSON.stringify(e))
  35. //alert('已失效,请重新打开')
  36. }
  37. });
  38. } else {
  39. window.location = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx75a6f8d1b4a850d7&redirect_uri=https%3A%2F%2Factivity.lingjiao.cn%2Fanswer%2Findex.html&response_type=code&scope=snsapi_userinfo&state=12345#wechat_redirect';
  40. }
  41. </script>
  42. </body>
  43. </html>