jump.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <html>
  2. <head>
  3. <title>打开小程序</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
  6. <script>
  7. function ajax(options) {
  8. return new Promise((resolve, reject) => {
  9. if (!options.url) {
  10. alert("确认你的url");
  11. return;
  12. }
  13. let method = options.method || 'GET';
  14. let async = options.async || true;
  15. let xhr = new XMLHttpRequest();
  16. if (method === 'GET') {
  17. // url后面添加随机数防止请求缓存
  18. xhr.open(method, options.url + "?" + Math.random(), async);
  19. xhr.send(null);
  20. } else if (method === 'POST') {
  21. xhr.open(method, options.url, async);
  22. xhr.setRequestHeader('Content-type', 'application/json;charset=utf-8');
  23. xhr.send(JSON.stringify(options.data));
  24. }
  25. xhr.onreadystatechange = () => {
  26. if (xhr.responseText) {
  27. resolve(xhr.responseText);
  28. }
  29. };
  30. xhr.onerror = (e) => {
  31. reject(e);
  32. }
  33. }).catch(e => {
  34. });
  35. }
  36. function openWeapp() {
  37. ajax({
  38. method: 'POST',
  39. async: false,
  40. url: 'https://test-mp-adm.quanshu123.com/test-api/api/v1/mp/wx/urlschema/generate',
  41. data: {
  42. path: '/pages/index/index',
  43. query: 'id=3847838'
  44. }
  45. })
  46. // onclick="openWeapp()
  47. }
  48. </script>
  49. <style>
  50. .skip-wrap {
  51. height: 100vh;
  52. width: 100%;
  53. position: relative;
  54. }
  55. .skip-theme {
  56. display: flex;
  57. align-items: center;
  58. flex-direction: column;
  59. padding: 200px 0 0;
  60. }
  61. .skip-theme-iamge {
  62. width: 60px;
  63. height: 60px;
  64. line-height: 60px;
  65. text-align: center;
  66. color: #fff;
  67. background-color: #e96737;
  68. border-radius: 50%;
  69. margin-bottom: 10px;
  70. }
  71. .skip-theme-txt {
  72. color: rgb(194, 184, 184);
  73. text-align: center;
  74. }
  75. .skip-btn {
  76. position: absolute;
  77. bottom: 50px;
  78. width: 100%;
  79. display: flex;
  80. align-items: center;
  81. justify-content: center;
  82. }
  83. .skip-btn p {
  84. height: 30px;
  85. width: 200px;
  86. background-color: rgb(7, 192, 88);
  87. border-radius: 8px;
  88. line-height: 30px;
  89. color: #fff;
  90. text-align: center;
  91. }
  92. </style>
  93. </head>
  94. <body>
  95. <div class="skip-wrap">
  96. <div class="skip-theme">
  97. <div class="skip-theme-iamge">logo</div>
  98. <div class="skip-theme-txt">小程序</div>
  99. </div>
  100. <div class="skip-btn">
  101. <p onclick="openWeapp()">打开微信小程序</p>
  102. </div>
  103. </div>
  104. </body>
  105. </html>