海鲜阿嫂

template.html 5.1KB

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