-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
83 lines (73 loc) · 3.09 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!--
Copyright (c) [2021] [赵全 of copyright holder]
[smsJumpToMicroAPP] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
-->
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Cache" content="no-cache">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="https://res.wx.qq.com/a/wx_fed/assets/res/NTI4MWU5.ico">
<title>确认打开微信小程序</title>
</head>
<body>
<div id="jumpToMicroAPP">
<!-- js生成按钮 -->
</div>
<div>
<a href="https://gitee.com/zhaoquan/sms-jump-to-microapp">Gitee</a>
<a href="https://github.com/zhaoquan/smsjumptomicroapp">GitHub</a>
</div>
</body>
<script>
// 用js实现在加载完成一个页面后自动执行一个方法
window.onload = async function () {
//微信小程序 Url Scheme 可以到mp.weixin.qq.com 小程序后台右上角,工具下生成,另外也可以通过接口生成
let scheme = "weixin://dl/business/?t=8ixV32RuXKf" // 需要打开的app scheme 地址
// 尝试打开 scheme
window.location.href = scheme;
// 2秒后显示按钮
let downloadTimer = setTimeout(function () {
let html = `<button class="btn" id="openBtn" onclick="openWithApp()">点击打开微信小程序</button>`
document.getElementById('jumpToMicroAPP').innerHTML = html;
}, 2000);
}
</script>
<script>
// 参考链接:https://blog.csdn.net/weixin_42895400/article/details/87799262
function openWithApp(id) {
//微信小程序 Url Scheme 可以到mp.weixin.qq.com 小程序后台右上角,工具下生成,另外也可以通过接口生成
let scheme = "weixin://dl/business/?t=8ixV32RuXKf" // 需要打开的app scheme 地址
// 尝试打开 scheme
window.location.href = scheme;
}
</script>
<style type="text/css">
.btn {
display: inline-block;
position: fixed;
padding: 15px 32px;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
background-color: #27ae60;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
border: none;
color: white;
font-size: 18px;
font-weight: 600;
text-align: center;
text-decoration: none;
}
</style>
</html>