123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <html>
- <head>
- <title>打开小程序</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
- <script>
- function ajax(options) {
- return new Promise((resolve, reject) => {
- if (!options.url) {
- alert("确认你的url");
- return;
- }
- let method = options.method || 'GET';
- let async = options.async || true;
- let xhr = new XMLHttpRequest();
- if (method === 'GET') {
- // url后面添加随机数防止请求缓存
- xhr.open(method, options.url + "?" + Math.random(), async);
- xhr.send(null);
- } else if (method === 'POST') {
- xhr.open(method, options.url, async);
- xhr.setRequestHeader('Content-type', 'application/json;charset=utf-8');
- xhr.send(JSON.stringify(options.data));
- }
- xhr.onreadystatechange = () => {
- if (xhr.responseText) {
- resolve(xhr.responseText);
- }
- };
- xhr.onerror = (e) => {
- reject(e);
- }
- }).catch(e => {
- });
- }
- function openWeapp() {
- ajax({
- method: 'POST',
- async: false,
- url: 'https://test-mp-adm.quanshu123.com/test-api/api/v1/mp/wx/urlschema/generate',
- data: {
- path: '/pages/index/index',
- query: 'id=3847838'
- }
- })
- // onclick="openWeapp()
- }
- </script>
- <style>
- .skip-wrap {
- height: 100vh;
- width: 100%;
- position: relative;
- }
- .skip-theme {
- display: flex;
- align-items: center;
- flex-direction: column;
- padding: 200px 0 0;
- }
- .skip-theme-iamge {
- width: 60px;
- height: 60px;
- line-height: 60px;
- text-align: center;
- color: #fff;
- background-color: #e96737;
- border-radius: 50%;
- margin-bottom: 10px;
- }
- .skip-theme-txt {
- color: rgb(194, 184, 184);
- text-align: center;
- }
- .skip-btn {
- position: absolute;
- bottom: 50px;
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .skip-btn p {
- height: 30px;
- width: 200px;
- background-color: rgb(7, 192, 88);
- border-radius: 8px;
- line-height: 30px;
- color: #fff;
- text-align: center;
- }
- </style>
- </head>
- <body>
- <div class="skip-wrap">
- <div class="skip-theme">
- <div class="skip-theme-iamge">logo</div>
- <div class="skip-theme-txt">小程序</div>
- </div>
- <div class="skip-btn">
- <p onclick="openWeapp()">打开微信小程序</p>
- </div>
- </div>
- </body>
- </html>
|