events_scratch.html 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <{include file="header.html"}>
  2. <{include file="nav.html"}>
  3. <!--公用标题居中显示-->
  4. <{include file="common_header.html"}>
  5. <{include file="events_top.html"}>
  6. <div class="wrapper clear">
  7. <div class="ac_title_com_app"><{$scratchData.events.events_name}></div>
  8. <!--公用活动说明样式-->
  9. <div class="ac_content">
  10. <{$scratchData.events.events_tips}>
  11. </div>
  12. <{if $eventsStatus != 'STATUS_HAS_RESTRTICTIONS'}>
  13. <{if $scratchData.events.events_hd_tips}>
  14. <div class="ac_title_com_line"><span><{$scratchData.events.events_hd_tips}></span></div>
  15. <{/if}>
  16. <{*挂奖区域*}>
  17. <div class="canvas_box">
  18. <span class="can_container">
  19. <!--中奖-->
  20. <{if !$eventsStatus}>
  21. <div id="inner_box" class="v_win_tips v_inner_box center" ></div>
  22. <img id="redux" src="<{$web_cfg.cdn}>/public/static/img/v_cover_bg.jpg" />
  23. <{else}>
  24. <div class="v_inner_box center" ></div>
  25. <img src="<{$web_cfg.cdn}>/public/static/img/v_cover_bg.jpg" />
  26. <{/if}>
  27. </span>
  28. </div>
  29. <{/if}>
  30. <{if !$eventsStatus}>
  31. <div class="v_reset_btn" style="display: none;"><a href="<{$web_cfg.url}>" >再刮一次</a></div>
  32. <{elseif $eventsStatus == 'STATUS_HAS_RESTRTICTIONS'}>
  33. <div class="v_end_com_box">
  34. <div class="v_end_txt_com center">已经到达参与上限</div>
  35. <div class="center"><a href="<{$listUrl}>" class="v_com_btn">参与更多特权活动</a></div>
  36. </div>
  37. <{else}>
  38. <div class="v_end_com_box">
  39. <div class="v_end_txt_com center">活动已结束!</div>
  40. <div class="center"><a href="<{$listUrl}>" class="v_com_btn">参与更多特权活动</a></div>
  41. </div>
  42. <div class="a_cover_alpha"></div>
  43. <{/if}>
  44. <div class="clear"></div>
  45. <div class="ac_title_com_line"><span>奖品设置</span></div>
  46. <div class="vpro_list_show">
  47. <{assign var=count value=$scratchData.prize|@count }>
  48. <{foreach from=$scratchData.prize item=prize name=prize}>
  49. <dl <{if $smarty.foreach.prize.iteration == $count}>style="border-bottom:0px;"<{/if}>>
  50. <dt><img src="<{$prize.img_url}>"></dt>
  51. <dd>
  52. <p><{$prize.prize_name}></p>
  53. </dd>
  54. </dl>
  55. <{/foreach}>
  56. <div class="clear"></div>
  57. </div>
  58. <{if $scratchData.events.share_button == 2}>
  59. <{include file="share_button.html"}>
  60. <{/if}>
  61. <{if $scratchData.events.operationt_tips}>
  62. <div class="ac_title_com_line"><span><{$scratchData.events.operationt_tips}></span></div>
  63. <{/if}>
  64. <!--公用活动规则样式-->
  65. <div class="activity_des">
  66. <{$scratchData.events.events_rules}>
  67. </div>
  68. <div class="clear"></div>
  69. </div>
  70. <!--公用提示背景遮罩层-->
  71. <div class="a_cover"></div>
  72. <!--虚拟中奖提示 begin-->
  73. <div class="coupon_tips_box v_tips_box" id="code_tips_box" style="display:none">
  74. <p class="coupon_code"><img src=""></p>
  75. <p class="tips_txt_show"></p>
  76. <p class="go_tips_txt"></p>
  77. <p class="go_tips_btn">
  78. <a href="<{$giftsUrl}>">查看奖品</a>
  79. </p>
  80. </div>
  81. <!--虚拟中奖提示 end-->
  82. <!--实物中奖提示 begin-->
  83. <div class="coupon_tips_box v_tips_box" id="object_tips_box" style="display:none">
  84. <p class="coupon_code"><img src=""></p>
  85. <p class="object_name"></p>
  86. <p class="go_tips_btn">
  87. <a class="share" href="">领取奖品</a>
  88. </p>
  89. </div>
  90. <!--实物中奖提示 end-->
  91. <div class="vote_tips_box" id="tips_box" style="display:none;">
  92. <p class="tips_msg" >提示信息</p>
  93. <div class="tips_close_btn" id="tips_close_btn"><span></span></div>
  94. </div>
  95. <script type="text/javascript" src="<{$web_cfg.cdn}>/public/static/js/jquery.eraser.js"></script>
  96. <script type="text/javascript">
  97. $(document).ready(function () {
  98. init();
  99. function init(event) {
  100. scratch();
  101. $("#redux").eraser({
  102. size: 20,//定义笔头大小
  103. completeRatio: .3,//当画布被擦除30%时触发事件
  104. completeFunction: showResult
  105. });
  106. }
  107. $('#reset').click(function () {
  108. scratch();
  109. $("#redux").eraser('reset');
  110. $(".v_tips_box, vote_tips_box").fadeOut();
  111. });
  112. //刮奖结果提示
  113. function showResult(){
  114. var winData = $('#winData').data();
  115. console.log(winData);
  116. if (winData.type == 1) {
  117. $.get('<{$web_cfg.domain}>/?c=EventsScratch&a=UserRestrictions'
  118. , {events_id: <{$scratchData.events.id}> ,lottery_data_id:winData.lottery_data_id}
  119. , function(data){
  120. if(data.ok){
  121. objectAward(winData);
  122. }else{
  123. showFail(data.msg);
  124. }
  125. }, 'json'
  126. );
  127. }
  128. if (winData.type == 2) {
  129. $.get('<{$web_cfg.domain}>/?c=EventsScratch&a=UserRestrictions'
  130. , {events_id: <{$scratchData.events.id}> ,lottery_data_id:winData.lottery_data_id}
  131. , function(data){
  132. if(data.ok){
  133. virtualAward(winData);
  134. }else{
  135. showFail(data.msg);
  136. }
  137. }, 'json'
  138. );
  139. }
  140. if (winData.errcode == 'NO_PERMISSION') {
  141. showFail('本活动需登录后才可以参与', true);
  142. }
  143. if (winData.errcode == 'INVALID_ID') {
  144. showFail('无效id');
  145. }
  146. if ($.isEmptyObject(winData)) {
  147. $.get('<{$web_cfg.domain}>/?c=EventsScratch&a=CKEventRestrictions'
  148. , {events_id: <{$scratchData.events.id}>}
  149. , function(data){
  150. if(data.ok){
  151. $('.v_reset_btn').show();
  152. }else{
  153. $('.v_reset_btn').hide();
  154. }
  155. }, 'json'
  156. );
  157. // 判断是否显示再挂一次按钮
  158. showFail('未中奖,谢谢参与!');
  159. }
  160. }
  161. $(".tips_close_btn").on('click', function(){
  162. $(".vote_tips_box, .a_cover").hide();
  163. });
  164. function scratch() {
  165. $.get('<{$web_cfg.domain}>/?c=EventsScratch&a=scratch'
  166. , {events_id: <{$scratchData.events.id}>}
  167. , function (data) {
  168. /*
  169. $('#inner_box_x, #inner_img_x').hide();
  170. $('#inner_box, #redux').show();
  171. */
  172. if (data.ok) {
  173. var ncop = '';
  174. if (!$.isEmptyObject(data.msg)) {
  175. ncop = '<p><img src="'+data.msg.img_url+'"></p>';
  176. ncop += '<p>'+data.msg.prize_name+'</p>';
  177. } else {
  178. ncop = '<p><img id="v_lose_icon" src="<{$web_cfg.cdn}>/public/static/img/v_lose_bg.jpg"></p>';
  179. }
  180. $('.v_win_tips').html(ncop);
  181. } else {
  182. switch (data.msg.errcode) {
  183. case 'INVALID_ID':
  184. showFail('无效id');
  185. break;
  186. case 'NO_PERMISSION':
  187. showFail('本活动需登录后才可以参与', true);
  188. break;
  189. default:
  190. showFail('未知错误');
  191. break;
  192. }
  193. }
  194. $('#winData').data(data.msg);
  195. }
  196. , 'json'
  197. );
  198. }
  199. //提示虚拟奖品
  200. function virtualAward(data) {
  201. var $msgBox = $('#code_tips_box');
  202. $('.tips_txt_show', $msgBox).html('您已获得'+data.prize_name+'<br>'+data.virtual_data);
  203. $('.coupon_code img', $msgBox).attr('src', data.img_url);
  204. $msgBox.show();
  205. $('.a_cover').show();
  206. }
  207. //提示实物奖品
  208. function objectAward(data) {
  209. var $msgBox = $('#object_tips_box');
  210. $('.object_name', $msgBox).html('您已获得<br>'+data.prize_name);
  211. $('.coupon_code img', $msgBox).attr('src', data.img_url);
  212. $('.share', $msgBox).attr('href', '<{$web_cfg.domain}>/?c=Express&lottery_data_id='+data.lottery_data_id);
  213. $msgBox.show();
  214. $('.a_cover').show();
  215. }
  216. //消息提示
  217. function showFail(msg, isPer) {
  218. var $msgBox = $('#tips_box');
  219. if (isPer) $('.go_tips_btn').show();
  220. $('.tips_msg', $msgBox).html(msg);
  221. $('#tips_box, .a_cover').fadeIn().delay(2000).fadeOut();
  222. }
  223. $('.vogue_add_btn').on('click', function() {
  224. $('#add_tips').show();
  225. });
  226. $('.add_join_btn').on('click', function () {
  227. $('#add_tips').hide();
  228. });
  229. //判断当前页图片加载完成loading消失
  230. $(".vpro_list_show dl dt img").each(function(){
  231. $(this).load(function(){
  232. $(this).parent().css("background","none");
  233. })
  234. });
  235. });
  236. </script>
  237. <span id="winData"></span>
  238. <{include file="bottom.html"}>