123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- <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>
- <!-- weui 样式 -->
- <link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/2.4.1/weui.min.css">
- </link>
- <!-- 调试用的移动端 console -->
- <script src="../groupon/js/jquery-1.7.2.min.js"></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>
- function docReady(fn) {
- if (document.readyState === 'complete' || document.readyState === 'interactive') {
- fn()
- } else {
- document.addEventListener('DOMContentLoaded', fn);
- }
- }
- docReady(async function () {
- var ua = navigator.userAgent.toLowerCase()
- var isWXWork = ua.match(/wxwork/i) == 'wxwork'
- 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)) {
- isMobile = true
- } else {
- isDesktop = true
- }
- if (isWeixin) {
- console.info('微信浏览器')
- document.getElementById('opentips').classList.add('tips')
-
- var containerEl = document.getElementById('wechat-web-container')
- containerEl.classList.remove('hidden')
- containerEl.classList.add('full', 'wechat-web-container')
- var launchBtn = document.getElementById('launch-btn');
- var coupon = getQueryString('coupon');
- launchBtn.setAttribute("path", "/pages/ucenter/couponList/couponList?type=1&coupon=" + coupon);
- launchBtn.addEventListener('ready', function (e) {
- console.log('开放标签 ready')
- //alert('开放标签 ready')
- })
- launchBtn.addEventListener('launch', function (e) {
- console.log('开放标签 success')
- //alert('开放标签 success')
- })
- launchBtn.addEventListener('error', function (e) {
- console.log('开放标签 fail', e.detail)
- //alert(e.detail)
- })
- wx.config({
- //debug: true, // 调试时可开启
- appId: 'wxf0a77f9993d8b60d', // <!-- replace -->
- timestamp: 0, // 必填,填任意数字即可
- nonceStr: 'nonceStr', // 必填,填任意非空字符串即可
- signature: 'signature', // 必填,填任意非空字符串即可
- jsApiList: ['chooseImage', 'previewImage'], // 必填,随意一个接口即可
- openTagList: ['wx-open-launch-weapp'], // 填入打开小程序的开放标签名
- })
- } else if (isDesktop) {
- // 在 pc 上则给提示引导到手机端打开
- var containerEl = document.getElementById('desktop-web-container')
- containerEl.classList.remove('hidden')
- containerEl.classList.add('full', 'desktop-web-container');
- } else {
- console.info('手机浏览器')
- var containerEl = document.getElementById('public-web-container')
- containerEl.classList.remove('hidden')
- containerEl.classList.add('full', 'public-web-container')
- var c = new cloud.Cloud({
- // 必填,表示是未登录模式
- identityless: true,
- // 资源方 AppID
- resourceAppid: 'wxf0a77f9993d8b60d', // <!-- replace -->
- // 资源方环境 ID
- resourceEnv: 'zhaijieshi-3guecm78383ca692', // <!-- replace -->
- })
- await c.init()
- window.c = c
- var buttonEl = document.getElementById('public-web-jump-button')
- var buttonLoadingEl = document.getElementById('public-web-jump-button-loading')
-
- try {
- // await openWeapp(() => {
- // buttonEl.classList.remove('weui-btn_loading')
- // buttonLoadingEl.classList.add('hidden')
- // })
- } catch (e) {
- buttonEl.classList.remove('weui-btn_loading')
- buttonLoadingEl.classList.add('hidden')
- throw e
- }
- }
- })
- //手机浏览器
- async function openWeapp(onBeforeJump) {
- var coupon = getQueryString('coupon');
- if (coupon == null || coupon == '' || coupon == 'null' || coupon.length < 8) {
- document.getElementById('errId').classList.remove('hidden');
- return;
- }
- document.getElementById('errId').classList.add('hidden');
- var c = window.c
- const res = await c.callFunction({
- name: 'public',
- data: {
- action: 'douyinCoupon',
- path: '/pages/ucenter/couponList/couponList',
- // query: 'type=1&coupon=' + coupon //不能进行encodeURIComponent编码,
- query: 'scene=pkSn,' + coupon + ';type,0'
- },
- })
- console.warn(res)
- if (onBeforeJump) {
- onBeforeJump()
- }
- location.href = res.result.openlink
- }
- async function openWeappQW(onBeforeJump) {
- var cp = getQueryString('cp');
- if (cp == null) cp = "qrcode"
- var mobile = getQueryString('mobile');//客户手机号 用来生成活码备注
- if (mobile == null) mobile = "mobile";
- var c = window.c
- const res = await c.callFunction({
- name: 'public',
- data: {
- action: 'getOpenWxJoin',
- path: '/pages/ucenter/wx/join',
- query: 'cp=' + cp + '&mobile=' + mobile //不能进行encodeURIComponent编码,
- },
- })
- console.warn(res)
- if (onBeforeJump) {
- onBeforeJump()
- }
- location.href = res.result.openlink
- }
- //获取url参数
- function getQueryString(name) {
- var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
- var r = window.location.search.substr(1).match(reg);
- if (r != null) {
- return unescape(r[2]);
- }
- return null;
- }
- </script>
- <style>
- .tips {
- height: 100%;
- width: 100%;
- background-repeat: no-repeat;
- background-image: url(./img/tips.png);
- background-size: 100%;
- position: absolute;
- top: 0;
- }
- .tips-none{
- position: absolute;
- }
- .hidden {
- display: none;
- }
- .full {
- margin-top: 30%;
- }
- .public-web-container {
- display: flex;
- flex-direction: column;
- align-items: center;
- margin-bottom: 30px;
- }
- .wechat-web-container {
- /* display: flex;
- flex-direction: column;
- align-items: center; */
- height: 80px;
- }
- .wechat-web-container wx-open-launch-weapp {
- display: flex;
- flex-direction: column;
- align-items: center;
- margin: 0px auto;
- height: 60px;
- }
- .desktop-web-container {
- display: flex;
- flex-direction: column;
- align-items: center;
- position: absolute;
- bottom: 20px;
- left: 0;
- right: 0;
- bottom: 0;
- margin: auto;
- }
- .top {
- height: -160px;
- background-color: white;
- text-align: center;
- width: 100%;
- }
- .btn {
- width: 90%;
- height: 50px;
- text-align: center;
- font-size: 17px;
- padding: 8px 24px;
- border-radius: 40px;
- border: 1px solid #c2c5c7;
- background-color: #c2c5c7;
- color: white;
- position: absolute;
- margin: auto;
- left: 0;
- right: 0;
- }
- </style>
- </head>
- <body style="background-color: white;background-image: url('./img/shrs.jpg');background-size:100%;">
- <!-- <div style="margin-top:30%;text-align: center;">
- <img src="../douyin/img/logo.png" style="width: 120px;" />
- </div> -->
- <div class="page full">
- <!--------------------------- 手机浏览器----------------------------------------------------------->
- <div id="errId" class="hidden" style="font-size: 11px;color: red;text-align: center;">无效团购券号</div>
- <div id="public-web-container" class="hidden">
- <a id="public-web-jump-button" href="javascript:void(0)" style="background-color: #01B9FF;color: white;height:50px;border-radius: 40px;border: 2px solid white;line-height: 30px;
- width: 80%;font-weight: 600;margin-top:95%" class="weui-btn weui-btn_primary weui-btn_loading"
- onclick="openWeapp()">
- 点击预约服务
- </a>
- <span style="color: #01B9FF;margin-top: 20px;" onclick="openWeappQW()">1V1专属管家</span>
- <!-- <div style="padding:0 10px;height: 58px;font-size: 11px;color: #939393;line-height: 19px;display: flex;">
- <input type="checkbox" style="margin-top: 4px;margin-right: 5px;"></input>
- <div>预约即代表您已阅读并接受<span style="font-weight: 600;">《券码核销说明》</span>和
- <span style="font-weight: 600;">《服务范围覆盖 说明》</span>与
- <span style="font-weight: 600;">《服务日期更改规则》</span>
- </div>
- </div> -->
- </div>
- <!--------------------------- 微信浏览器----------------------------------------------------------->
- <div id="wechat-web-container" class="hidden">
- <wx-open-launch-weapp id="launch-btn" username="gh_e9b9499458d9" path="/pages/ucenter/couponList/couponList">
- <template>
- <style>
- .btn {
- width: 80%;
- height: 50px;
- text-align: center;
- font-size: 17px;
- display: block;
- margin: 0 auto;
- padding: 8px 24px;
- border-radius: 40px;
- border: 2px solid white;
- background-color: #29BBEA;
- color: white;
- font-weight: 600;
- }
- </style>
- <button class="btn">一键唤起小程序</button>
- </template>
- </wx-open-launch-weapp>
- <!-- <div style="padding:0 10px;height: 58px;font-size: 11px;color: #939393;line-height: 19px;display: flex;">
- <input type="checkbox" style="margin-top: 4px;margin-right: 5px;height: 20px;width: 20px;"></input>
- <div>预约即代表您已阅读并接受<span style="font-weight: 600;">《券码核销说明》</span>和
- <span style="font-weight: 600;">《服务范围覆盖 说明》</span>与
- <span style="font-weight: 600;">《服务日期更改规则》</span>
- </div>
- </div> -->
- </div>
- <!-- pc端打开提醒 -->
- <div id="desktop-web-container" class="hidden">
- <p class="" style="margin-top: 30px;">请在手机打开网页链接</p>
- </div>
- </div>
- <div class="tips-none" id="opentips" >
- </div>
- </body>
- </html>
|