猎豆优选小程序

warrant.html 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta content="yes" name="apple-mobile-web-app-capable">
  6. <meta name="viewport"
  7. content="width=device-width, initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0,user-scalable=0" />
  8. <link rel="stylesheet" type="text/css" href="./public/public_css.css" />
  9. <script type="text/javascript" src="./public/public.js"></script>
  10. <script type="text/javascript" src="./public/jquery-2.1.0.js"></script>
  11. <title>淘宝授权</title>
  12. <style>
  13. .container {
  14. width: 300px;
  15. height: 100px;
  16. position: absolute;
  17. top: 0;
  18. left: 0;
  19. bottom: 0;
  20. right: 0;
  21. margin: auto;
  22. display: none;
  23. }
  24. .hint {
  25. font-size: 13px;
  26. line-height: 30rpx;
  27. color: #666;
  28. text-align: center;
  29. }
  30. .button {
  31. display: block;
  32. width: 260px;
  33. line-height: 40px;
  34. border-radius: 40px;
  35. font-size: 16px;
  36. background-color: #eeeeee;
  37. color: #FFFFFF;
  38. background: linear-gradient(45deg, rgb(244, 117, 42), rgb(239, 15, 42));
  39. margin: auto;
  40. margin-top: 30px;
  41. }
  42. .errnoHint {
  43. width: 100%;
  44. height: 100px;
  45. font-size: 13px;
  46. line-height: 30rpx;
  47. color: #666;
  48. text-align: center;
  49. position: fixed;
  50. top: 0;
  51. bottom: 0;
  52. margin: auto;
  53. display: none;
  54. }
  55. </style>
  56. </head>
  57. <body>
  58. <div class="container">
  59. <div class="hint">您已完成淘宝授权,点击下方按钮进入小程序</div>
  60. <button class="button">进入小程序</button>
  61. </div>
  62. <div class="errnoHint">
  63. <!-- 淘宝授权失败原因 -->
  64. </div>
  65. </body>
  66. <script>
  67. const params = getQueryUrl();
  68. $().ready(function () {
  69. console.log(params, 'params')
  70. if (params.h5 == 'applet') { // 根据地址栏判断是h5(小程序使用)进来的,区分之前猎豆app使用此页面
  71. uploadData()
  72. }
  73. })
  74. //上传取到的数据
  75. async function uploadData () {
  76. $.ajax({
  77. type: "post",
  78. url: "https://ld.726p.com/api/v2/relationAuth/tbkUserToAuth",
  79. dataType: 'json',
  80. headers: {
  81. token: params.token,
  82. },
  83. data: params,
  84. success: function (res) {
  85. if (res.rst.flag == 1) {
  86. $('.container').show()
  87. } else {
  88. $('.errnoHint').show()
  89. $('.errnoHint').html(res.rst.msg)
  90. }
  91. }
  92. });
  93. }
  94. // 获取地址栏信息
  95. function getQueryUrl () {
  96. let url = window.location.href;
  97. let result = {};
  98. if (url.indexOf('?') > -1) {
  99. let str = url.split('?')[1];
  100. let temp = str.split('&');
  101. for (let i = 0; i < temp.length; i++) {
  102. let temp2 = temp[i].split('=');
  103. result[temp2[0]] = temp2[1]
  104. }
  105. }
  106. return result
  107. }
  108. </script>
  109. </html>