|
@@ -20,9 +20,6 @@
|
|
|
<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 src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
|
|
-
|
|
|
<script>
|
|
|
function docReady(fn) {
|
|
|
if (document.readyState === 'complete' || document.readyState === 'interactive') {
|
|
@@ -38,8 +35,7 @@
|
|
|
var isWeixin = !isWXWork && ua.match(/micromessenger/i) == 'micromessenger'
|
|
|
var isMobile = false
|
|
|
var isDesktop = false
|
|
|
- if (navigator.userAgent.match(
|
|
|
- /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|IEMobile)/i)) {
|
|
|
+ if (navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|IEMobile)/i)) {
|
|
|
isMobile = true
|
|
|
} else {
|
|
|
isDesktop = true
|
|
@@ -63,11 +59,11 @@
|
|
|
|
|
|
wx.config({
|
|
|
// debug: true, // 调试时可开启
|
|
|
- appId: 'wx8533800e393dbd6b', // <!-- replace -->
|
|
|
+ appId: '小程序 AppID', // <!-- replace -->
|
|
|
timestamp: 0, // 必填,填任意数字即可
|
|
|
nonceStr: 'nonceStr', // 必填,填任意非空字符串即可
|
|
|
signature: 'signature', // 必填,填任意非空字符串即可
|
|
|
- jsApiList: ['chooseImage'], // 必填,随意一个接口即可
|
|
|
+ jsApiList: ['chooseImage'], // 必填,随意一个接口即可
|
|
|
openTagList: ['wx-open-launch-weapp'], // 填入打开小程序的开放标签名
|
|
|
})
|
|
|
} else if (isDesktop) {
|
|
@@ -79,16 +75,16 @@
|
|
|
var containerEl = document.getElementById('public-web-container')
|
|
|
containerEl.classList.remove('hidden')
|
|
|
containerEl.classList.add('full', 'public-web-container')
|
|
|
- /*var c = new cloud.Cloud({
|
|
|
+ /* var c = new cloud.Cloud({
|
|
|
// 必填,表示是未登录模式
|
|
|
identityless: true,
|
|
|
- // 资源方 AppID - 小程序 AppID
|
|
|
- resourceAppid: 'wx8533800e393dbd6b', // <!-- replace -->
|
|
|
- // 资源方环境 ID - 云开发环境 ID
|
|
|
- resourceEnv: 'mangpiao-prod-0gc3lhscbc41fb6e', // <!-- replace -->
|
|
|
- })
|
|
|
- await c.init()
|
|
|
- window.c = c*/
|
|
|
+ // 资源方 AppID
|
|
|
+ resourceAppid: '小程序 AppID', // <!-- replace -->
|
|
|
+ // 资源方环境 ID
|
|
|
+ resourceEnv: '云开发环境 ID', // <!-- replace -->
|
|
|
+ }) */
|
|
|
+ // await c.init()
|
|
|
+ // window.c = c
|
|
|
|
|
|
var buttonEl = document.getElementById('public-web-jump-button')
|
|
|
var buttonLoadingEl = document.getElementById('public-web-jump-button-loading')
|
|
@@ -105,7 +101,6 @@
|
|
|
}
|
|
|
})
|
|
|
|
|
|
-
|
|
|
function ajax(options) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
if (!options.url) {
|
|
@@ -137,9 +132,6 @@
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
function openWeapp() {
|
|
|
ajax({
|
|
|
method: 'POST',
|
|
@@ -216,34 +208,32 @@
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
- <div className="page full">
|
|
|
- <div id="public-web-container" className="hidden">
|
|
|
- <p className="">正在打开 “盲票小程序”...</p> <!-- replace -->
|
|
|
- <a id="public-web-jump-button" href="javascript:" className="weui-btn weui-btn_primary weui-btn_loading"
|
|
|
- onClick="openWeapp()">
|
|
|
- <span id="public-web-jump-button-loading" className="weui-primary-loading weui-primary-loading_transparent"><i
|
|
|
- className="weui-primary-loading__dot"></i></span>
|
|
|
+ <div class="page full">
|
|
|
+ <div id="public-web-container" class="hidden">
|
|
|
+ <p class="">正在打开 “盲票小程序”...</p> <!-- replace -->
|
|
|
+ <a id="public-web-jump-button" href="javascript:" class="weui-btn weui-btn_primary weui-btn_loading"
|
|
|
+ onclick="openWeapp()">
|
|
|
+ <span id="public-web-jump-button-loading" class="weui-primary-loading weui-primary-loading_transparent"><i
|
|
|
+ class="weui-primary-loading__dot"></i></span>
|
|
|
打开小程序
|
|
|
</a>
|
|
|
</div>
|
|
|
- <div id="wechat-web-container" className="hidden">
|
|
|
- <p className="">点击以下按钮打开 “盲票小程序”</p> <!-- replace -->
|
|
|
+ <div id="wechat-web-container" class="hidden">
|
|
|
+ <p class="">点击以下按钮打开 “盲票小程序”</p> <!-- replace -->
|
|
|
<!-- 跳转小程序的开放标签。文档 https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_Open_Tag.html -->
|
|
|
<wx-open-launch-weapp id="launch-btn" username="gh_cf2872611f66" path="pages/index/index?id=123456"
|
|
|
env-version="trial">
|
|
|
<!-- replace -->
|
|
|
<template>
|
|
|
<button
|
|
|
- style="width: 200px; height: 45px; text-align: center; font-size: 17px; display: block; margin: 0 auto; padding: 8px 24px; border: none; border-radius: 4px; background-color: #07c160; color:#fff;">
|
|
|
- 打开小程序
|
|
|
- </button>
|
|
|
+ style="width: 200px; height: 45px; text-align: center; font-size: 17px; display: block; margin: 0 auto; padding: 8px 24px; border: none; border-radius: 4px; background-color: #07c160; color:#fff;">打开小程序</button>
|
|
|
</template>
|
|
|
</wx-open-launch-weapp>
|
|
|
</div>
|
|
|
- <div id="desktop-web-container" className="hidden">
|
|
|
- <p className="">请在手机打开网页链接</p>
|
|
|
+ <div id="desktop-web-container" class="hidden">
|
|
|
+ <p class="">请在手机打开网页链接</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
</body>
|
|
|
|
|
|
-</html>
|
|
|
+</html>
|