greatColdActivity.blade.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta
  6. name="viewport"
  7. content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
  8. />
  9. <link rel=icon type=image/png href="data:image/png;base64,iVBORw0KGgo=">
  10. <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  11. <title>大寒藏厚礼-书币超值送</title>
  12. <style>
  13. html,
  14. body {
  15. margin: 0 auto;
  16. padding: 0;
  17. max-width: 450px;
  18. font-size: 100px;
  19. }
  20. html {
  21. background: #eff6ff;
  22. }
  23. .main_box {
  24. font-size: 0;
  25. position: relative;
  26. }
  27. .main_box img {
  28. width: 100%;
  29. }
  30. .time {
  31. font-size: 0.14rem;
  32. font-weight: bold;
  33. text-align: center;
  34. color: #fff;
  35. }
  36. .recharge-item {
  37. font-size: 0;
  38. width: 90%;
  39. margin: 0.3rem auto;
  40. }
  41. .recharge_box_one {
  42. width: 80%;
  43. margin: 0 auto;
  44. position: absolute;
  45. left: 50%;
  46. transform: translateX(-50%);
  47. top: 55%;
  48. }
  49. .list {
  50. display: flex;
  51. justify-content: space-between;
  52. align-items: center;
  53. margin-bottom: .15rem;
  54. }
  55. .list .list-item {
  56. width: 48%;
  57. }
  58. .main_box img,
  59. a {
  60. -webkit-tap-highlight-color: transparent;
  61. }
  62. .d_none {
  63. display: none;
  64. }
  65. </style>
  66. </head>
  67. <body>
  68. <main class="main_box">
  69. <img src="https://cdn-novel.iycdm.com/h5/activity-2019-01-17/bg.jpg" alt="" />
  70. <div class="recharge_box_one">
  71. <div class="list">
  72. <div class="list-item">
  73. <img
  74. src="{{$img[$type][0]}}"
  75. data-active-src="{{$img[$type][0]}}"
  76. data-src="{{$img[$type][1]}}"
  77. data-focus="1"
  78. data-href="{{$url[0]}}"
  79. alt=""
  80. />
  81. </div>
  82. <div class="list-item">
  83. <img
  84. src="{{$img[$type][3]}}"
  85. data-active-src="{{$img[$type][2]}}"
  86. data-src="{{$img[$type][3]}}"
  87. data-focus="0"
  88. data-href="{{$url[1]}}"
  89. alt=""
  90. />
  91. </div>
  92. </div>
  93. @if($code == -1)
  94. <!-- 活动未开始 -->
  95. <a href="javascript:void(0)" class="un_begin">
  96. <img src="https://cdn-novel.iycdm.com/h5/activity-2019-01-17/undone.png" alt="" />
  97. </a>
  98. @elseif($code == 0)
  99. <!-- 活动进行中 -->
  100. <a href="{{$url[0]}}" class="beginning" id="paying">
  101. <img src="https://cdn-novel.iycdm.com/h5/activity-2019-01-17/doing.png" alt="" />
  102. </a>
  103. @elseif($code == -2)
  104. <!-- 活动结束 -->
  105. <a href="javascript:void(0)" class="over">
  106. <img src="https://cdn-novel.iycdm.com/h5/activity-2019-01-17/over.png" alt="" />
  107. </a>
  108. @endif
  109. </div>
  110. </main>
  111. </body>
  112. <script>
  113. var d = document;
  114. var imgs = d.querySelectorAll(".list-item img");
  115. var alink = d.querySelector("#paying");
  116. var key = 0;
  117. for (var i = 0; i < imgs.length; i++) {
  118. (function(index) {
  119. imgs[index].addEventListener(
  120. "click",
  121. function() {
  122. if (key === index) return;
  123. reset();
  124. var active = this.getAttribute("data-active-src");
  125. var un_active = this.getAttribute("data-src");
  126. var is_active = this.getAttribute("data-focus");
  127. var href = this.getAttribute("data-href");
  128. if (is_active === "0") {
  129. // 未勾选
  130. this.setAttribute("data-focus", "1");
  131. this.setAttribute("src", active);
  132. if(alink){
  133. alink.setAttribute('href',href);
  134. }
  135. }
  136. key = index;
  137. },
  138. false
  139. );
  140. })(i);
  141. }
  142. function reset() {
  143. for (var i = 0; i < imgs.length; i++) {
  144. (function(index) {
  145. imgs[index].setAttribute("src", imgs[index].getAttribute("data-src"));
  146. imgs[index].setAttribute("data-focus", "0");
  147. })(i);
  148. }
  149. }
  150. </script>
  151. </html>