海鲜阿嫂

center.html 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. .template_img{
  20. width: 100%;
  21. }
  22. .evm_img {
  23. width: 100%;
  24. position: absolute;
  25. width: 1.15rem;
  26. top: 3.03rem;
  27. left: 0;
  28. right: 0;
  29. margin: auto;
  30. }
  31. .hand{
  32. position: absolute;
  33. top: 3.6rem;
  34. left: 2.3rem;
  35. width: 0.9rem;
  36. animation:mymove 0.6s infinite alternate ease-in-out;
  37. -webkit-animation:mymove 0.6s infinite alternate ease-in-out; /*Safari and Chrome*/
  38. }
  39. @keyframes mymove
  40. {
  41. 0%{
  42. transform: scale(1); /*开始为原始大小*/
  43. }
  44. 25%{
  45. transform: scale(0.9); /*放大1.1倍*/
  46. }
  47. 50%{
  48. transform: scale(1);
  49. }
  50. 75%{
  51. transform: scale(0.9);
  52. }
  53. }
  54. @-webkit-keyframes mymove /*Safari and Chrome*/
  55. {
  56. 0%{
  57. transform: scale(1); /*开始为原始大小*/
  58. }
  59. 25%{
  60. transform: scale(0.9); /*放大1.1倍*/
  61. }
  62. 50%{
  63. transform: scale(1);
  64. }
  65. 75%{
  66. transform: scale(0.9);
  67. }
  68. }
  69. </style>
  70. <body>
  71. <div id="template">
  72. <img class="template_img" src=""/>
  73. <img class="evm_img" src="" />
  74. <img class="hand" src="https://seafood-h5.oss-cn-beijing.aliyuncs.com/img/hand.png"/>
  75. </div>
  76. <div class="alert-info" style="display: none;">
  77. <!-- tip提示,3s后消失 -->
  78. <p>请在浏览器中打开</p>
  79. </div>
  80. <!-- loading -->
  81. <div class="loading">
  82. <img src="../common/loading.gif" />
  83. </div>
  84. </body>
  85. </html>
  86. <script>
  87. var qs = parseQueryString(window.location.href);
  88. var qrode_data = '';//接口传过来的数据
  89. $().ready(function () {
  90. getQrcode();
  91. var timeOutEvent = null;
  92. $("body").on({
  93. touchstart: function (e) {
  94. timeOutEvent = setTimeout(function () {
  95. //此处为长按事件
  96. addLongLog()
  97. }, 700);
  98. },
  99. touchmove: function () {
  100. clearTimeout(timeOutEvent);
  101. },
  102. touchend: function (e) {
  103. clearTimeout(timeOutEvent);
  104. return false;
  105. }
  106. });
  107. })
  108. function getQrcode() {
  109. if(!qs.id){
  110. showMsg('模版未找到!')
  111. return false;
  112. }
  113. $(".loading").show()
  114. $.ajax({
  115. url: '/api/template/qrcode',
  116. methods: 'get',
  117. data: {
  118. t_id: qs.id
  119. },
  120. success: function (res) {
  121. $(".loading").hide()
  122. if (res && res.errno == 0) {
  123. qrode_data = res.rst;
  124. $(".template_img").attr('src', res.rst.back_img)
  125. $(".evm_img").attr('src', res.rst.qrcode);
  126. }else{
  127. showMsg(res.err)
  128. }
  129. },
  130. error: function (err) {
  131. $(".loading").hide()
  132. showMsg('服务器错误')
  133. }
  134. })
  135. }
  136. function addLongLog() {
  137. //长按
  138. $.ajax({
  139. url: '/api/template/addLongLog',
  140. methods: 'get',
  141. data: {
  142. t_id: qs.id,
  143. ip: qrode_data.ip,
  144. saler_id: qrode_data.saler_id
  145. },
  146. success: function (res) {
  147. if (res && res.errno == 0) {
  148. console.log('长按统计成功')
  149. }
  150. },
  151. error: function (err) {
  152. }
  153. })
  154. }
  155. // 展示错误提示信息
  156. function showMsg(msg) {
  157. var msgBox = document.getElementsByClassName('alert-info')[0];
  158. msgBox.getElementsByTagName("p")[0].innerHTML = msg;
  159. msgBox.style.display = "block";
  160. setTimeout(function () {
  161. msgBox.style.display = "none";
  162. }, 2000);
  163. }
  164. //获取地址栏参数
  165. function parseQueryString(url) {
  166. var urlObj = {};
  167. var reg = /([^?=&]+)=([^?=&]+)/g;
  168. url.replace(reg, function ($0, $1, $2) {
  169. urlObj[$1] = decodeURIComponent($2);
  170. })
  171. return urlObj;
  172. }
  173. </script>