home_tranfer_120
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Notes:跳转小程序
|
||||
* Created on: 2022/1/19 11:19
|
||||
* Created by: dengbw
|
||||
*/
|
||||
class Jumpmp extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:
|
||||
* https://liche-dev.xiaoyu.com/h5/jumpmp
|
||||
* https://www.liche.cn/h5/jumpmp
|
||||
* Created on: 2022/1/19 11:19
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
if ($params['app_id' == 1]) {
|
||||
$title = '狸车';
|
||||
} else {
|
||||
$title = '狸车宝';
|
||||
}
|
||||
$data = ['title' => $title];
|
||||
$this->load->view('/h5/jumpmp/index', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>打开<?= $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 src="https://qs.haodian.cn/web/javascript/qrcode.min.js"></script>
|
||||
</head>
|
||||
<style>
|
||||
.fn-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.box-center-middle {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
transform: translate(-50%, -50%);
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
#qrcode {
|
||||
width: 200px;
|
||||
margin: 0 auto;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div id="isPc" class="box-center-middle fn-hidden">
|
||||
<div id="qrcode"></div>
|
||||
<div>请在手机打开网页链接</div>
|
||||
</div>
|
||||
<div id="isWeixin" class="box-center-middle fn-hidden">请点击右上角・・・用浏览器打开</div>
|
||||
<div id="isMobile" class="box-center-middle fn-hidden">正在打开 “<?= $title ?>”...</div>
|
||||
<script>
|
||||
let ua = navigator.userAgent.toLowerCase()
|
||||
// 企业微信
|
||||
let isWXWork = ua.match(/wxwork/i) == 'wxwork'
|
||||
// 微信浏览器
|
||||
let isWeixin = !isWXWork && ua.match(/MicroMessenger/i) == 'micromessenger'
|
||||
let isMobile = false
|
||||
let isDesktop = false
|
||||
if (navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|IEMobile)/i)) {
|
||||
isMobile = true
|
||||
} else {
|
||||
isDesktop = true
|
||||
}
|
||||
if (isDesktop) {
|
||||
// 在 pc 上则给提示引导到手机端打开
|
||||
let isPcCon = document.getElementById('isPc')
|
||||
isPcCon.style.display = "block";
|
||||
// 生成当前页面二维码
|
||||
new QRCode('qrcode', {
|
||||
text: document.URL,
|
||||
width: 200,
|
||||
height: 200,
|
||||
colorDark: '#000000',
|
||||
colorLight: '#ffffff',
|
||||
correctLevel: QRCode.CorrectLevel.H
|
||||
});
|
||||
} else if (isWeixin) {
|
||||
//如果微信浏览器上则给提示引导到原生浏览器打开
|
||||
let isWeixinCon = document.getElementById('isWeixin')
|
||||
isWeixinCon.style.display = "block";
|
||||
} else {
|
||||
let isMobileCon = document.getElementById('isMobile')
|
||||
isMobileCon.remove('hidden')
|
||||
isMobileCon.style.display = "block";
|
||||
let query = window.location.search.substring(1);
|
||||
setTimeout(() => {
|
||||
location.href = 'weixin://dl/business/?' + query
|
||||
}, 10);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user