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

h5分享图片及下载app调试

@@ -13,11 +13,55 @@ class Index extends Frontend @@ -13,11 +13,55 @@ class Index extends Frontend
13 protected $noNeedRight = '*'; 13 protected $noNeedRight = '*';
14 protected $layout = ''; 14 protected $layout = '';
15 15
  16 + public function _initialize()
  17 + {
  18 + parent::_initialize(); // TODO: Change the autogenerated stub
  19 + $href = '';
  20 + $browser = 0;
  21 + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') == true) {
  22 + $browser = 1;
  23 + } else if (strpos($_SERVER['HTTP_USER_AGENT'], 'AlipayClient') == true) {
  24 + $browser = 2;
  25 + } else {
  26 + if (stristr($_SERVER['HTTP_USER_AGENT'], 'Android')) {
  27 + //echo '你的手机是:Android系统';
  28 + $href = request()->domain() . '/package/android_debug.apk';
  29 + } else if (stristr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
  30 + //echo '你的手机是:ISO系统';
  31 + $browser = 3;
  32 + }
  33 + }
  34 + $this->view->assign('href', $href);
  35 + $this->view->assign('browser', $browser);
  36 + }
  37 +
16 public function index() 38 public function index()
17 { 39 {
18 return $this->view->fetch(); 40 return $this->view->fetch();
19 } 41 }
20 42
  43 + public function download()
  44 + {
  45 + $href = '';
  46 + $browser = 0;
  47 + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') == true) {
  48 + $browser = 1;
  49 + } else if (strpos($_SERVER['HTTP_USER_AGENT'], 'AlipayClient') == true) {
  50 + $browser = 2;
  51 + }
  52 + if (stristr($_SERVER['HTTP_USER_AGENT'], 'Android')) {
  53 + //echo '你的手机是:Android系统';
  54 +// $ver = Db::name('version')->order('id', 'DESC')->find();
  55 + $href = request()->domain() . '/package/android_debug.apk';
  56 + } else if (stristr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
  57 + //echo '你的手机是:ISO系统';
  58 + $browser = 3;
  59 + }
  60 + $this->assign('url', $href);
  61 + $this->assign('browser', $browser);
  62 + return $this->view->fetch();
  63 + }
  64 +
21 //会有到期提醒 添加信息记录 65 //会有到期提醒 添加信息记录
22 public function mess() 66 public function mess()
23 { 67 {
@@ -69,6 +69,11 @@ @@ -69,6 +69,11 @@
69 width: 100%; 69 width: 100%;
70 min-height: 100%; 70 min-height: 100%;
71 } 71 }
  72 + .browser_open img {
  73 + width: 100%;
  74 + height: 100%;
  75 + font-size: 0;
  76 + }
72 77
73 </style> 78 </style>
74 </head> 79 </head>
@@ -83,9 +88,6 @@ @@ -83,9 +88,6 @@
83 88
84 {if condition="$data.type eq 2"} 89 {if condition="$data.type eq 2"}
85 <!--图片--> 90 <!--图片-->
86 -  
87 -  
88 -  
89 <!--<div class="swiper-container">--> 91 <!--<div class="swiper-container">-->
90 <!--<div class="swiper-wrapper">--> 92 <!--<div class="swiper-wrapper">-->
91 <!--<div class="swiper-slide">--> 93 <!--<div class="swiper-slide">-->
@@ -112,9 +114,6 @@ @@ -112,9 +114,6 @@
112 {$data.content} 114 {$data.content}
113 </div> 115 </div>
114 {/if} 116 {/if}
115 -  
116 -  
117 -  
118 <div class="end-btn" onclick="appTapOpen()">APP内打开</div> 117 <div class="end-btn" onclick="appTapOpen()">APP内打开</div>
119 <div class="appPop"> 118 <div class="appPop">
120 <div class="appPop-main"> 119 <div class="appPop-main">
@@ -125,17 +124,11 @@ @@ -125,17 +124,11 @@
125 <div class="appPop-main-top-text-des">{$data.introduce}</div> 124 <div class="appPop-main-top-text-des">{$data.introduce}</div>
126 </div> 125 </div>
127 </div> 126 </div>
128 -  
129 - <div class="appPop-main-btn" onclick="appTapColse()"> 127 + <div class="appPop-main-btn" onclick="download()">
130 下载APP 128 下载APP
131 </div> 129 </div>
132 -  
133 </div> 130 </div>
134 -  
135 </div> 131 </div>
136 -  
137 -  
138 -  
139 {if condition = "$data.switch eq 1"} 132 {if condition = "$data.switch eq 1"}
140 133
141 {else /} 134 {else /}
@@ -145,7 +138,6 @@ @@ -145,7 +138,6 @@
145 <img src="/assets/cai/image/jiantou_img@2x.png" alt=""> 138 <img src="/assets/cai/image/jiantou_img@2x.png" alt="">
146 </div> 139 </div>
147 </div> 140 </div>
148 -  
149 <div class="tips_bottom"> 141 <div class="tips_bottom">
150 <div class="tips_txt">请选择浏览器</div> 142 <div class="tips_txt">请选择浏览器</div>
151 <div class="tips_icon"> 143 <div class="tips_icon">
@@ -155,10 +147,9 @@ @@ -155,10 +147,9 @@
155 </div> 147 </div>
156 </div> 148 </div>
157 {/if} 149 {/if}
158 -  
159 -  
160 -  
161 - 150 +<div class="browser_open" style="display:none;">
  151 + <img src="__CDN__/assets/cai/image/browser.png"/>
  152 +</div>
162 </body> 153 </body>
163 <script src="/assets/cai/js/base.js"></script> 154 <script src="/assets/cai/js/base.js"></script>
164 <script src="/assets/cai/js/app.js"></script> 155 <script src="/assets/cai/js/app.js"></script>
@@ -169,6 +160,16 @@ @@ -169,6 +160,16 @@
169 autoplay: 5000,//可选选项,自动滑动 160 autoplay: 5000,//可选选项,自动滑动
170 }) 161 })
171 } 162 }
  163 + var browser = "{$browser}";
  164 + function download() {
  165 + if(browser == 0) {
  166 + $('.browser_open').show();
  167 + } else if(browser == 3) {
  168 + alert('ios暂不支持');
  169 + } else {
  170 + window.location.href = "{$href}";
  171 + }
  172 + }
172 173
173 </script> 174 </script>
174 </html> 175 </html>
  1 +<!DOCTYPE html>
  2 +<html lang="en">
  3 +<head>
  4 + <meta charset="UTF-8">
  5 + <title>{$title|default=""}</title>
  6 + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7 + <meta name="viewport"
  8 + content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width"/>
  9 + <script src="__CDN__/assets/cai/js/base.js"></script>
  10 + <style>
  11 + html, body {
  12 + width: 100%;
  13 + height: 100%;
  14 + background:#333333;
  15 + margin:0;
  16 + }
  17 + .browser_open img {
  18 + width: 100%;
  19 + height: 100%;
  20 + font-size: 0;
  21 + }
  22 + </style>
  23 +</head>
  24 +<body>
  25 +<div class="browser_open" style="{if condition = '$browser neq 0 && $browser neq 3'}display:block;{else/}display:none;{/if}">
  26 + <img src="__CDN__/assets/cai/image/browser.png"/>
  27 +</div>
  28 +<script src="__CDN__/assets/cai/js/jquery.js"></script>
  29 +<script>
  30 + var browser = "{$browser}";
  31 + if (browser == 0) {
  32 + window.location.href = "{$url}";
  33 + } else if (browser == 3) {
  34 + alert('ios暂不支持下载');
  35 + }
  36 +</script>
  37 +</body>
  38 +</html>
@@ -7,6 +7,13 @@ @@ -7,6 +7,13 @@
7 <title>Document</title> 7 <title>Document</title>
8 <link rel="stylesheet" href="/assets/cai/css/common.css"> 8 <link rel="stylesheet" href="/assets/cai/css/common.css">
9 <link rel="stylesheet" href="/assets/cai/css/file.css"> 9 <link rel="stylesheet" href="/assets/cai/css/file.css">
  10 + <style>
  11 + .browser_open img {
  12 + width: 100%;
  13 + height: 100%;
  14 + font-size: 0;
  15 + }
  16 + </style>
10 </head> 17 </head>
11 18
12 <body> 19 <body>
@@ -38,8 +45,6 @@ @@ -38,8 +45,6 @@
38 </div> 45 </div>
39 {/foreach} 46 {/foreach}
40 {/if} 47 {/if}
41 -  
42 -  
43 <!--笔记--> 48 <!--笔记-->
44 {if condition="$data.note eq ''"} 49 {if condition="$data.note eq ''"}
45 {else /} 50 {else /}
@@ -59,8 +64,6 @@ @@ -59,8 +64,6 @@
59 </div> 64 </div>
60 {/foreach} 65 {/foreach}
61 {/if} 66 {/if}
62 -  
63 -  
64 <!--图片--> 67 <!--图片-->
65 {if condition="$data.pic eq ''"} 68 {if condition="$data.pic eq ''"}
66 {else /} 69 {else /}
@@ -81,15 +84,12 @@ @@ -81,15 +84,12 @@
81 </div> 84 </div>
82 {/foreach} 85 {/foreach}
83 {/if} 86 {/if}
84 -  
85 -  
86 <!--视频--> 87 <!--视频-->
87 {if condition="$data.video eq ''"} 88 {if condition="$data.video eq ''"}
88 {else /} 89 {else /}
89 {foreach $data.video as $vo} 90 {foreach $data.video as $vo}
90 <div class="file-item pic-item"> 91 <div class="file-item pic-item">
91 <div class="time">{$vo.times}</div> 92 <div class="time">{$vo.times}</div>
92 -  
93 <div class="file-item-bottom"> 93 <div class="file-item-bottom">
94 {foreach $vo.info as $val} 94 {foreach $vo.info as $val}
95 <a href="{:url('index/detail',array('file_id'=>$val.id))}"> 95 <a href="{:url('index/detail',array('file_id'=>$val.id))}">
@@ -100,11 +100,9 @@ @@ -100,11 +100,9 @@
100 </a> 100 </a>
101 {/foreach} 101 {/foreach}
102 </div> 102 </div>
103 -  
104 </div> 103 </div>
105 {/foreach} 104 {/foreach}
106 {/if} 105 {/if}
107 -  
108 </div> 106 </div>
109 <div class="end-btn" onclick="appTapOpen()">APP内打开</div> 107 <div class="end-btn" onclick="appTapOpen()">APP内打开</div>
110 108
@@ -117,15 +115,27 @@ @@ -117,15 +115,27 @@
117 <div class="appPop-main-top-text-des">{$data.introduce}</div> 115 <div class="appPop-main-top-text-des">{$data.introduce}</div>
118 </div> 116 </div>
119 </div> 117 </div>
120 -  
121 - <div class="appPop-main-btn" onclick="appTapColse()"> 118 + <div class="appPop-main-btn" onclick="download()">
122 下载APP 119 下载APP
123 </div> 120 </div>
124 -  
125 </div> 121 </div>
126 - 122 +</div>
  123 +<div class="browser_open" style="display:none;">
  124 + <img src="__CDN__/assets/cai/image/browser.png"/>
127 </div> 125 </div>
128 </body> 126 </body>
129 <script src="/assets/cai/js/base.js"></script> 127 <script src="/assets/cai/js/base.js"></script>
130 <script src="/assets/cai/js/app.js"></script> 128 <script src="/assets/cai/js/app.js"></script>
  129 +<script>
  130 + var browser = "{$browser}";
  131 + function download() {
  132 + if(browser == 0) {
  133 + $('.browser_open').show();
  134 + } else if(browser == 3) {
  135 + alert('ios暂不支持');
  136 + } else {
  137 + window.location.href = "{$href}";
  138 + }
  139 + }
  140 +</script>
131 </html> 141 </html>
@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 <title>Swiper demo</title> 5 <title>Swiper demo</title>
6 <!-- Link Swiper's CSS --> 6 <!-- Link Swiper's CSS -->
7 <link rel="stylesheet" href="/assets/cai/css/swiper.min.css"> 7 <link rel="stylesheet" href="/assets/cai/css/swiper.min.css">
  8 + <link rel="stylesheet" href="/assets/cai/css/common.css">
8 9
9 <!-- Demo styles --> 10 <!-- Demo styles -->
10 <style> 11 <style>
@@ -35,8 +36,28 @@ @@ -35,8 +36,28 @@
35 <!-- <div class="swiper-slide red-slide"><p class="ani">内容</p></div>--> 36 <!-- <div class="swiper-slide red-slide"><p class="ani">内容</p></div>-->
36 <!-- <div class="swiper-slide orange-slide"><p class="ani">内容</p></div>--> 37 <!-- <div class="swiper-slide orange-slide"><p class="ani">内容</p></div>-->
37 </div> 38 </div>
  39 +</div>
  40 +<div class="end-btn" onclick="appTapOpen()">APP内打开</div>
38 41
  42 +<div class="appPop">
  43 + <div class="appPop-main">
  44 + <div class="appPop-main-top">
  45 + <img src="/assets/cai/image/logo_icon@2x.png" alt="" class="appPop-main-top-pic">
  46 + <div class="appPop-main-top-text">
  47 + <div class="appPop-main-top-text-title">彩云盘</div>
  48 + <div class="appPop-main-top-text-des">{$data.introduce}</div>
  49 + </div>
  50 + </div>
  51 + <div class="appPop-main-btn" onclick="download()">
  52 + 下载APP
  53 + </div>
  54 + </div>
  55 +</div>
  56 +<div class="browser_open" style="display:none;">
  57 + <img src="__CDN__/assets/cai/image/browser.png"/>
39 </div> 58 </div>
  59 +<script src="/assets/cai/js/base.js"></script>
  60 +<script src="/assets/cai/js/app.js"></script>
40 <!-- Swiper JS --> 61 <!-- Swiper JS -->
41 <script src="/assets/cai/js/swiper.min.js"></script> 62 <script src="/assets/cai/js/swiper.min.js"></script>
42 <!-- Initialize Swiper --> 63 <!-- Initialize Swiper -->
@@ -45,7 +66,16 @@ @@ -45,7 +66,16 @@
45 on:{ 66 on:{
46 } 67 }
47 }); 68 });
48 - 69 + var browser = "{$browser}";
  70 + function download() {
  71 + if(browser == 0) {
  72 + $('.browser_open').show();
  73 + } else if(browser == 3) {
  74 + alert('ios暂不支持');
  75 + } else {
  76 + window.location.href = "{$href}";
  77 + }
  78 + }
49 </script> 79 </script>
50 </body> 80 </body>
51 </html> 81 </html>
此 diff 太大无法显示。