作者 Cool
1 个管道 的构建 通过 耗费 1 秒

h5分享图片及下载app调试

... ... @@ -13,11 +13,55 @@ class Index extends Frontend
protected $noNeedRight = '*';
protected $layout = '';
public function _initialize()
{
parent::_initialize(); // TODO: Change the autogenerated stub
$href = '';
$browser = 0;
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') == true) {
$browser = 1;
} else if (strpos($_SERVER['HTTP_USER_AGENT'], 'AlipayClient') == true) {
$browser = 2;
} else {
if (stristr($_SERVER['HTTP_USER_AGENT'], 'Android')) {
//echo '你的手机是:Android系统';
$href = request()->domain() . '/package/android_debug.apk';
} else if (stristr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
//echo '你的手机是:ISO系统';
$browser = 3;
}
}
$this->view->assign('href', $href);
$this->view->assign('browser', $browser);
}
public function index()
{
return $this->view->fetch();
}
public function download()
{
$href = '';
$browser = 0;
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') == true) {
$browser = 1;
} else if (strpos($_SERVER['HTTP_USER_AGENT'], 'AlipayClient') == true) {
$browser = 2;
}
if (stristr($_SERVER['HTTP_USER_AGENT'], 'Android')) {
//echo '你的手机是:Android系统';
// $ver = Db::name('version')->order('id', 'DESC')->find();
$href = request()->domain() . '/package/android_debug.apk';
} else if (stristr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
//echo '你的手机是:ISO系统';
$browser = 3;
}
$this->assign('url', $href);
$this->assign('browser', $browser);
return $this->view->fetch();
}
//会有到期提醒 添加信息记录
public function mess()
{
... ...
... ... @@ -69,6 +69,11 @@
width: 100%;
min-height: 100%;
}
.browser_open img {
width: 100%;
height: 100%;
font-size: 0;
}
</style>
</head>
... ... @@ -83,9 +88,6 @@
{if condition="$data.type eq 2"}
<!--图片-->
<!--<div class="swiper-container">-->
<!--<div class="swiper-wrapper">-->
<!--<div class="swiper-slide">-->
... ... @@ -112,9 +114,6 @@
{$data.content}
</div>
{/if}
<div class="end-btn" onclick="appTapOpen()">APP内打开</div>
<div class="appPop">
<div class="appPop-main">
... ... @@ -125,17 +124,11 @@
<div class="appPop-main-top-text-des">{$data.introduce}</div>
</div>
</div>
<div class="appPop-main-btn" onclick="appTapColse()">
<div class="appPop-main-btn" onclick="download()">
下载APP
</div>
</div>
</div>
{if condition = "$data.switch eq 1"}
{else /}
... ... @@ -145,7 +138,6 @@
<img src="/assets/cai/image/jiantou_img@2x.png" alt="">
</div>
</div>
<div class="tips_bottom">
<div class="tips_txt">请选择浏览器</div>
<div class="tips_icon">
... ... @@ -155,10 +147,9 @@
</div>
</div>
{/if}
<div class="browser_open" style="display:none;">
<img src="__CDN__/assets/cai/image/browser.png"/>
</div>
</body>
<script src="/assets/cai/js/base.js"></script>
<script src="/assets/cai/js/app.js"></script>
... ... @@ -169,6 +160,16 @@
autoplay: 5000,//可选选项,自动滑动
})
}
var browser = "{$browser}";
function download() {
if(browser == 0) {
$('.browser_open').show();
} else if(browser == 3) {
alert('ios暂不支持');
} else {
window.location.href = "{$href}";
}
}
</script>
</html>
\ No newline at end of file
... ...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{$title|default=""}</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width"/>
<script src="__CDN__/assets/cai/js/base.js"></script>
<style>
html, body {
width: 100%;
height: 100%;
background:#333333;
margin:0;
}
.browser_open img {
width: 100%;
height: 100%;
font-size: 0;
}
</style>
</head>
<body>
<div class="browser_open" style="{if condition = '$browser neq 0 && $browser neq 3'}display:block;{else/}display:none;{/if}">
<img src="__CDN__/assets/cai/image/browser.png"/>
</div>
<script src="__CDN__/assets/cai/js/jquery.js"></script>
<script>
var browser = "{$browser}";
if (browser == 0) {
window.location.href = "{$url}";
} else if (browser == 3) {
alert('ios暂不支持下载');
}
</script>
</body>
</html>
\ No newline at end of file
... ...
... ... @@ -7,6 +7,13 @@
<title>Document</title>
<link rel="stylesheet" href="/assets/cai/css/common.css">
<link rel="stylesheet" href="/assets/cai/css/file.css">
<style>
.browser_open img {
width: 100%;
height: 100%;
font-size: 0;
}
</style>
</head>
<body>
... ... @@ -38,8 +45,6 @@
</div>
{/foreach}
{/if}
<!--笔记-->
{if condition="$data.note eq ''"}
{else /}
... ... @@ -59,8 +64,6 @@
</div>
{/foreach}
{/if}
<!--图片-->
{if condition="$data.pic eq ''"}
{else /}
... ... @@ -81,15 +84,12 @@
</div>
{/foreach}
{/if}
<!--视频-->
{if condition="$data.video eq ''"}
{else /}
{foreach $data.video as $vo}
<div class="file-item pic-item">
<div class="time">{$vo.times}</div>
<div class="file-item-bottom">
{foreach $vo.info as $val}
<a href="{:url('index/detail',array('file_id'=>$val.id))}">
... ... @@ -100,11 +100,9 @@
</a>
{/foreach}
</div>
</div>
{/foreach}
{/if}
</div>
<div class="end-btn" onclick="appTapOpen()">APP内打开</div>
... ... @@ -117,15 +115,27 @@
<div class="appPop-main-top-text-des">{$data.introduce}</div>
</div>
</div>
<div class="appPop-main-btn" onclick="appTapColse()">
<div class="appPop-main-btn" onclick="download()">
下载APP
</div>
</div>
</div>
<div class="browser_open" style="display:none;">
<img src="__CDN__/assets/cai/image/browser.png"/>
</div>
</body>
<script src="/assets/cai/js/base.js"></script>
<script src="/assets/cai/js/app.js"></script>
<script>
var browser = "{$browser}";
function download() {
if(browser == 0) {
$('.browser_open').show();
} else if(browser == 3) {
alert('ios暂不支持');
} else {
window.location.href = "{$href}";
}
}
</script>
</html>
\ No newline at end of file
... ...
... ... @@ -5,6 +5,7 @@
<title>Swiper demo</title>
<!-- Link Swiper's CSS -->
<link rel="stylesheet" href="/assets/cai/css/swiper.min.css">
<link rel="stylesheet" href="/assets/cai/css/common.css">
<!-- Demo styles -->
<style>
... ... @@ -35,8 +36,28 @@
<!-- <div class="swiper-slide red-slide"><p class="ani">内容</p></div>-->
<!-- <div class="swiper-slide orange-slide"><p class="ani">内容</p></div>-->
</div>
</div>
<div class="end-btn" onclick="appTapOpen()">APP内打开</div>
<div class="appPop">
<div class="appPop-main">
<div class="appPop-main-top">
<img src="/assets/cai/image/logo_icon@2x.png" alt="" class="appPop-main-top-pic">
<div class="appPop-main-top-text">
<div class="appPop-main-top-text-title">彩云盘</div>
<div class="appPop-main-top-text-des">{$data.introduce}</div>
</div>
</div>
<div class="appPop-main-btn" onclick="download()">
下载APP
</div>
</div>
</div>
<div class="browser_open" style="display:none;">
<img src="__CDN__/assets/cai/image/browser.png"/>
</div>
<script src="/assets/cai/js/base.js"></script>
<script src="/assets/cai/js/app.js"></script>
<!-- Swiper JS -->
<script src="/assets/cai/js/swiper.min.js"></script>
<!-- Initialize Swiper -->
... ... @@ -45,7 +66,16 @@
on:{
}
});
var browser = "{$browser}";
function download() {
if(browser == 0) {
$('.browser_open').show();
} else if(browser == 3) {
alert('ios暂不支持');
} else {
window.location.href = "{$href}";
}
}
</script>
</body>
</html>
... ...
此 diff 太大无法显示。