123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- <html>
- <head>
- <title>jolijoli</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">
- <!-- <link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/2.4.1/weui.min.css">
- </link> -->
- <link rel="icon" href="./image/icon_logo.png" type="image/x-icon">
- <script src="./jquery.js"></script>
- <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
- <style>
- html,body,p {
- margin: 0;
- padding: 0;
- }
- img {
- width: 100%;
- }
- .fixed {
- position: fixed;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 98px;
- background-color: #fff;
- }
- .model {
- position: fixed;
- left: 0;
- top: 0;
- width: 100%;
- height: 100%;
- background-color: rgba(0, 0, 0, 0.4);
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .model img{
- width: 70%;
- }
- </style>
- </head>
- <body>
- <div class="box">
- </div>
- <div style="height: 98px;"></div>
- <div class="fixed">
- <div class="btm-btn-wx" style="display: block;">
- <!-- <wx-open-launch-weapp id="launch-btn" username="gh_38d7446511dd" path="pages/home/home.html">
- <template>
- <style>
- img {
- width: 100%;
- }
- .img {
- width: 100%;
- }
- </style>
- <div style="padding: 20px;">
- <img class="img btn-img" src="https://test-m.ijolijoli.com/image/image_07.png" alt="">
- <img class="img btn-img" src="" alt="">
- </div>
- </template>
- </wx-open-launch-weapp> -->
- </div>
- <div class="btm-btn" style="display: none;">
- <div style="padding: 20px;">
- <img class="img btn-img" src="./image/image_07.png" alt="">
- </div>
- </div>
- </div>
- <div class="model" style="display: none;">
- <img class="wx-code" src="./image/wx_code.jpg" alt="">
- </div>
-
- <script type="text/javascript">
- $(document).ready(function () {
- let host = window.location.host;
- let api_url,data_url;
- if(host == "m.ijolijoli.com") {
- api_url = 'https://api.ijolijoli.com'
- data_url = "https://m.ijolijoli.com"
- } else if(host == "test-m.ijolijoli.com") {
- api_url = 'https://test-api.ijolijoli.com'
- data_url = "https://test-m.ijolijoli.com"
- } else {
- api_url = 'https://test-api.ijolijoli.com'
- data_url = "https://test-m.ijolijoli.com"
- }
- console.log(host)
- function dff() {
- $.ajax({
- url: `${api_url}/api/show`,
- type: 'GET',
- data:{
- url: data_url + '/'
- },
- success: function (res) {
- console.log('33333')
- let str = `<wx-open-launch-weapp id="launch-btn" username="gh_38d7446511dd" path="pages/home/home.html">
- <template>
- <style>
- img {
- width: 100%;
- }
- .img {
- width: 100%;
- }
- </style>
- <div style="padding: 20px;">
- <img class="img btn-img" src="${res.data.btn_image_url}" alt="">
- </div>
- </template>
- </wx-open-launch-weapp>`
- $('.btm-btn-wx').html(str)
- $('.box').html(res.data.content)
- $('.btn-img').attr('src',res.data.btn_image_url);
- $('.wx-code').attr('src',res.data.wxmini_image_url)
- wx.config({
- debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
- appId: res.data.jssdk.appId, // 必填,公众号的唯一标识
- timestamp: res.data.jssdk.timestamp, // 必填,生成签名的时间戳
- nonceStr: res.data.jssdk.nonceStr, // 必填,生成签名的随机串
- signature: res.data.jssdk.signature,// 必填,签名
- jsApiList: ['chooseImage', 'previewImage'], // 必填,需要使用的JS接口列表
- openTagList: ['wx-open-launch-weapp'] // 可选,需要使用的开放标签列表
- });
- // wx.config(res.data)
- }
- });
- }
- dff();
- var ua = window.navigator.userAgent.toLowerCase();// 不加window部分Android机会显示不了提示图,即判断不了是否是微信
- if (ua.match(/MicroMessenger/i) == 'micromessenger') {
- $('.btm-btn').hide()
- $('.btm-btn-wx').show()
- wx.ready(function () {
- console.log('config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中')
- var btn = document.getElementById('launch-btn');
- btn.addEventListener('launch', function (e) {
- console.log('success');
- // alert('success')
- });
- btn.addEventListener('error', function (e) {
- console.log('fail', e.detail);
- alert('fail', e.detail)
- // alert('fail', e.detail)
- });
- });
- } else {
- $('.btm-btn').show()
- $('.btm-btn-wx').hide()
- }
- $('.btm-btn').on('click',function() {
- $('.model').show()
- })
- $('.model').on('click',function() {
- $('.model').hide()
- })
- })
-
-
-
- </script>
- </body>
|