H5 页面微信外打开小程序

H5 页面微信外打开小程序

<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>    
window.onerror = e => {    
console.error(e)    
// alert('发生错误' + e)    
}    
</script>    
<style>    
</style>    
<!-- weui 样式 -->    
<link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/2.4.1/weui.min.css"></link>    
<!-- 调试用的移动端 console -->    
<script src="https://cdn.jsdelivr.net/npm/eruda"></script>    
<script>    
if (location.search.indexOf('wxdebug=1') > -1) {    
eruda.init()    
}    
</script>    
<!-- 公众号 JSSDK -->    
<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>    
<!-- 云开发 Web SDK -->    
<script src="https://res.wx.qq.com/open/js/cloudbase/1.1.0/cloud.js"></script>    
<script>    
// json    
// head_img_url, nickname, url_scheme, user_name, path, query    
var test = 'http://wx.qlogo.cn/mmhead/Q3auHgzwzM6b8le24j6sQQ6YVaudy40QJ50ibF9SthJ6IPRFzbZib1Iw/132'    
if (test === ('')) {    
// not from qqmail, use mock    
var mockUrlScheme = 'weixin://dl/business/?t=jg2JJYEcMll'    
try {    
var m = location.href.match(/wxaurl\.cn\/(\w+)/)    
if (m && m[1]) {    
mockUrlScheme = `weixin://dl/business/?t=${m[1]}`    
}    
} catch (e) {}    
window.data = {    
// head_img_url: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3816472114,4050958057&fm=26&gp=0.jpg',    
head_img_url: 'https://2eo55h24wdu6nyeph4frss2b76-wpengine.netdna-ssl.com/wp-content/uploads/2018/07/mini-program-600x600.png',    
nickname: '小程序示例',    
url_scheme: mockUrlScheme,    
user_name: 'gh_d43f693ca31f',    
path: 'page/component/index',    
query: 'x=1',    
}    
} else {    
window.data = {    
head_img_url: 'http://wx.qlogo.cn/mmhead/Q3auHgzwzM6b8le24j6sQQ6YVaudy40QJ50ibF9SthJ6IPRFzbZib1Iw/132',    
nickname: '平安银行',    
url_scheme: 'weixin://dl/business/?t=w2jMtSAPFel',    
user_name: 'gh_b2f85d42711c',    
path: 'pages/webview/webview',    
query: 'redirect_uri=https%3A%2F%2Fwww.pingan.com%2F1wt6',    
}    
}    
</script>    
<script src="cloudbase_res/js/universal_links_4.js"></script>    
</head>    
<body>    
<div id="app"></div>    
</body>    
</html>