events_scratch.html 8.0 KB

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