海鲜阿嫂

custom.html 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta content="yes" name="apple-mobile-web-app-capable">
  6. <meta name="viewport"
  7. content="width=device-width, initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0,user-scalable=0" />
  8. <title>海鲜阿嫂</title>
  9. <link rel="stylesheet" type="text/css" href="../common/reset.css" />
  10. <script type="text/javascript" src="../common/jquery-2.1.0.js"></script>
  11. <script type="text/javascript">
  12. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth / 375) + "px";
  13. window.onresize = function () {
  14. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth / 375) + "px";
  15. }
  16. </script>
  17. </head>
  18. <style>
  19. body{
  20. padding: 0.15rem;
  21. padding-bottom: 0.5rem;
  22. }
  23. .title{
  24. font-size: 0.28rem;
  25. line-height: 0.33rem;
  26. white-space: normal;
  27. }
  28. .content p{
  29. font-size: 0.15rem;
  30. color: #595959;
  31. line-height: 2em;
  32. margin-top: 0.3rem;
  33. }
  34. img{
  35. width: 100%;
  36. margin-top: 0.1rem;
  37. }
  38. .bottom{
  39. position: fixed;
  40. width: 100%;
  41. height: 0.5rem;
  42. line-height: 0.5rem;
  43. background: #3cb035;
  44. bottom: 0;
  45. left: 0;
  46. z-index: 1;
  47. border-top: 1px solid #eee;
  48. box-shadow: -0.05rem -0.05rem 0.1rem #eee;
  49. text-align: center;
  50. color: #fff;
  51. }
  52. .elasticFrame_div{
  53. position: fixed;
  54. top: 0;
  55. left: 0;
  56. width: 100%;
  57. height: 100vh;
  58. background: rgba(0,0,0,0.5);
  59. z-index: 2;
  60. display: none;
  61. }
  62. .elasticFrame_div .elasticFrame{
  63. background: #fff;
  64. width: 80%;
  65. height: 2rem;
  66. border-radius: 0.1rem;
  67. position: absolute;
  68. top: 0;
  69. bottom: 0;
  70. left: 0;
  71. right: 0;
  72. margin: auto;
  73. padding: 0.1rem ;
  74. }
  75. .elasticFrame_div .elasticFrame h4{
  76. font-size: 0.16rem;
  77. text-align: center;
  78. line-height: 0.3rem;
  79. margin-top: 0.1rem;
  80. }
  81. .elasticFrame_div .elasticFrame .evm_div{
  82. text-align: center;
  83. }
  84. .elasticFrame_div .elasticFrame .evm_div img{
  85. height: 1.28rem;
  86. width: 1.28rem;
  87. display: inline-block;
  88. }
  89. .elasticFrame_div .elasticFrame .evm_div #evm{
  90. width: 1.1rem;
  91. height: 1.1rem;
  92. }
  93. .elasticFrame_div .elasticFrame .close{
  94. width: 0.2rem;
  95. height: 0.2rem;
  96. position: absolute;
  97. right: 0.15rem;
  98. top: 0.05rem;
  99. }
  100. .evm_top_banner{
  101. background: rgb(241, 252, 253);
  102. width: 100%;
  103. height: 1rem;
  104. text-align: center;
  105. position: relative;
  106. border-radius: 0.1rem;
  107. margin-top: 0.1rem;
  108. color: rgb(227, 108, 9);
  109. font-size: 0.16rem;
  110. font-weight: bold;
  111. line-height: 0.26rem;
  112. padding-top: 0.2rem;
  113. box-sizing: border-box;
  114. }
  115. .evm_top_banner .shoes{
  116. width: 30px;
  117. position: absolute;
  118. left: 0;
  119. right: 0;
  120. bottom: -0.1rem;
  121. margin: auto;
  122. }
  123. .arrow{
  124. max-width: 100%;
  125. color: rgb(217, 33, 66);
  126. text-align: center;
  127. padding: 0.2rem 0 0 0;
  128. }
  129. .content_evm{
  130. text-align: center;
  131. }
  132. .content_evm img{
  133. width: 1.64rem;
  134. display:inline-block ;
  135. }
  136. .content_evm .evm{
  137. width: 1.4rem;
  138. }
  139. </style>
  140. <body>
  141. <div id="template">
  142. <h3 class="title"></h3>
  143. <ul class="content"></ul>
  144. </div>
  145. <!-- 底部 -->
  146. <div class="bottom" onclick="openElasticFrame()">
  147. 点击添加微信,享受海鲜尝鲜优惠!
  148. </div>
  149. <!-- 二维码弹框 -->
  150. <div class="elasticFrame_div">
  151. <div class="elasticFrame">
  152. <img class="close" src="https://seafood-h5.oss-cn-beijing.aliyuncs.com/img/close.jpg" onclick="clearElasticFrame()"/>
  153. <h4>长按识别二维码加微信</h4>
  154. <div class="evm_div">
  155. <img src="" class="LongPress" id="evm"/>
  156. <img class="LongPress" src="https://seafood-h5.oss-cn-beijing.aliyuncs.com/img/fingerprint.png"/>
  157. </div>
  158. </div>
  159. </div>
  160. <div class="alert-info" style="display: none;">
  161. <!-- tip提示,3s后消失 -->
  162. <p>请在浏览器中打开</p>
  163. </div>
  164. <!-- loading -->
  165. <div class="loading">
  166. <img src="../common/loading.gif" />
  167. </div>
  168. </body>
  169. </html>
  170. <script>
  171. var qs = parseQueryString(window.location.href);
  172. var qrode_data = '';//接口传过来的数据
  173. $().ready(function () {
  174. getQrcode();
  175. var timeOutEvent = null;
  176. $("img").on({
  177. touchstart: function (e) {
  178. timeOutEvent = setTimeout(function () {
  179. //此处为长按事件
  180. addLongLog()
  181. }, 700);
  182. },
  183. touchmove: function () {
  184. clearTimeout(timeOutEvent);
  185. },
  186. touchend: function (e) {
  187. clearTimeout(timeOutEvent);
  188. return false;
  189. }
  190. });
  191. })
  192. function getQrcode() {
  193. if(!qs.id){
  194. showMsg('模版未找到!')
  195. return false;
  196. }
  197. $(".loading").show()
  198. $.ajax({
  199. url: '/api/template/qrcode',
  200. methods: 'get',
  201. data: {
  202. t_id: qs.id
  203. },
  204. success: function (res) {
  205. $(".loading").hide()
  206. if (res && res.errno == 0) {
  207. qrode_data = res.rst;
  208. $(".title").html(res.rst.title)
  209. document.title = res.rst.title
  210. $("#evm").attr('src',res.rst.qrcode)
  211. var html = '', img_html='';
  212. res.rst.new_context.forEach((item,index) => {
  213. img_html = '';
  214. item.img.forEach((it)=>{
  215. img_html += '<img src="'+it+'"/>'
  216. })
  217. html += '<li><p>'+item.text+'</p>'+img_html+'<div class="evm_top_banner">更多海鲜资讯<br/>详见海鲜阿嫂朋友圈<img src="https://seafood-h5.oss-cn-beijing.aliyuncs.com/img/shoes.png" class="shoes"/></div><div class="arrow">▼</div></li><div class="content_evm"><img class="evm LongPress" src="'+res.rst.qrcode+'"/><img class="LongPress" src="https://seafood-h5.oss-cn-beijing.aliyuncs.com/img/fingerprint.png"/></div>';
  218. });
  219. $('.content').html(html)
  220. }else{
  221. showMsg(res.err)
  222. }
  223. },
  224. error: function (err) {
  225. $(".loading").hide()
  226. showMsg('服务器错误')
  227. }
  228. })
  229. }
  230. function openElasticFrame(){
  231. $('.elasticFrame_div').show()
  232. return false;
  233. }
  234. function clearElasticFrame(){
  235. $('.elasticFrame_div').hide()
  236. return false;
  237. }
  238. function addLongLog() {
  239. //长按
  240. $.ajax({
  241. url: '/api/template/addLongLog',
  242. methods: 'get',
  243. data: {
  244. t_id: qs.id,
  245. ip: qrode_data.ip,
  246. saler_id: qrode_data.saler_id
  247. },
  248. success: function (res) {
  249. if (res && res.errno == 0) {
  250. console.log('长按统计成功')
  251. }
  252. },
  253. error: function (err) {
  254. }
  255. })
  256. }
  257. // 展示错误提示信息
  258. function showMsg(msg) {
  259. var msgBox = document.getElementsByClassName('alert-info')[0];
  260. msgBox.getElementsByTagName("p")[0].innerHTML = msg;
  261. msgBox.style.display = "block";
  262. setTimeout(function () {
  263. msgBox.style.display = "none";
  264. }, 2000);
  265. }
  266. //获取地址栏参数
  267. function parseQueryString(url) {
  268. var urlObj = {};
  269. var reg = /([^?=&]+)=([^?=&]+)/g;
  270. url.replace(reg, function ($0, $1, $2) {
  271. urlObj[$1] = decodeURIComponent($2);
  272. })
  273. return urlObj;
  274. }
  275. </script>