events_scratch.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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.operationt_tips}>
  58. <div class="ac_title_com_line"><span><{$scratchData.events.operationt_tips}></span></div>
  59. <{/if}>
  60. <!--公用活动规则样式-->
  61. <div class="activity_des">
  62. <{$scratchData.events.events_rules}>
  63. </div>
  64. <div class="clear"></div>
  65. </div>
  66. <!--公用提示背景遮罩层-->
  67. <div class="a_cover"></div>
  68. <!--虚拟中奖提示 begin-->
  69. <div class="coupon_tips_box v_tips_box" id="code_tips_box" style="display:none">
  70. <p class="coupon_code"><img src=""></p>
  71. <p class="tips_txt_show"></p>
  72. <p class="go_tips_txt"></p>
  73. <p class="go_tips_btn">
  74. <a href="<{$giftsUrl}>">查看奖品</a>
  75. </p>
  76. </div>
  77. <!--虚拟中奖提示 end-->
  78. <!--实物中奖提示 begin-->
  79. <div class="coupon_tips_box v_tips_box" id="object_tips_box" style="display:none">
  80. <p class="coupon_code"><img src=""></p>
  81. <p class="object_name"></p>
  82. <p class="go_tips_btn">
  83. <a class="share" href="">领取奖品</a>
  84. </p>
  85. </div>
  86. <!--实物中奖提示 end-->
  87. <div class="vote_tips_box" id="tips_box" style="display:none;">
  88. <p class="tips_msg" >提示信息</p>
  89. <div class="tips_close_btn" id="tips_close_btn"><span></span></div>
  90. </div>
  91. <script type="text/javascript" src="<{$web_cfg.cdn}>/public/static/js/jquery.eraser.js"></script>
  92. <script type="text/javascript">
  93. $(document).ready(function () {
  94. init();
  95. function init(event) {
  96. scratch();
  97. $("#redux").eraser({
  98. size: 20,//定义笔头大小
  99. completeRatio: .3,//当画布被擦除30%时触发事件
  100. completeFunction: showResult
  101. });
  102. }
  103. $('#reset').click(function () {
  104. scratch();
  105. $("#redux").eraser('reset');
  106. $(".v_tips_box, vote_tips_box").fadeOut();
  107. });
  108. //刮奖结果提示
  109. function showResult(){
  110. var winData = $('#winData').data();
  111. console.log(winData);
  112. if (winData.type == 1) {
  113. $.get('<{$web_cfg.domain}>/?c=EventsScratch&a=UserRestrictions'
  114. , {events_id: <{$scratchData.events.id}> ,lottery_data_id:winData.lottery_data_id}
  115. , function(data){
  116. if(data.ok){
  117. objectAward(winData);
  118. }else{
  119. showFail(data.msg);
  120. }
  121. }, 'json'
  122. );
  123. }
  124. if (winData.type == 2) {
  125. $.get('<{$web_cfg.domain}>/?c=EventsScratch&a=UserRestrictions'
  126. , {events_id: <{$scratchData.events.id}> ,lottery_data_id:winData.lottery_data_id}
  127. , function(data){
  128. if(data.ok){
  129. virtualAward(winData);
  130. }else{
  131. showFail(data.msg);
  132. }
  133. }, 'json'
  134. );
  135. }
  136. if (winData.errcode == 'NO_PERMISSION') {
  137. showFail('本活动需登录后才可以参与', true);
  138. }
  139. if (winData.errcode == 'INVALID_ID') {
  140. showFail('无效id');
  141. }
  142. if ($.isEmptyObject(winData)) {
  143. $.get('<{$web_cfg.domain}>/?c=EventsScratch&a=CKEventRestrictions'
  144. , {events_id: <{$scratchData.events.id}>}
  145. , function(data){
  146. if(data.ok){
  147. $('.v_reset_btn').show();
  148. }else{
  149. $('.v_reset_btn').hide();
  150. }
  151. }, 'json'
  152. );
  153. // 判断是否显示再挂一次按钮
  154. showFail('未中奖,谢谢参与!');
  155. }
  156. }
  157. $(".tips_close_btn").on('click', function(){
  158. $(".vote_tips_box, .a_cover").hide();
  159. });
  160. function scratch() {
  161. $.get('<{$web_cfg.domain}>/?c=EventsScratch&a=scratch'
  162. , {events_id: <{$scratchData.events.id}>}
  163. , function (data) {
  164. /*
  165. $('#inner_box_x, #inner_img_x').hide();
  166. $('#inner_box, #redux').show();
  167. */
  168. if (data.ok) {
  169. var ncop = '';
  170. if (!$.isEmptyObject(data.msg)) {
  171. ncop = '<p><img src="'+data.msg.img_url+'"></p>';
  172. ncop += '<p>'+data.msg.prize_name+'</p>';
  173. } else {
  174. ncop = '<p><img id="v_lose_icon" src="<{$web_cfg.cdn}>/public/static/img/v_lose_bg.jpg"></p>';
  175. }
  176. $('.v_win_tips').html(ncop);
  177. } else {
  178. switch (data.msg.errcode) {
  179. case 'INVALID_ID':
  180. showFail('无效id');
  181. break;
  182. case 'NO_PERMISSION':
  183. showFail('本活动需登录后才可以参与', true);
  184. break;
  185. default:
  186. showFail('未知错误');
  187. break;
  188. }
  189. }
  190. $('#winData').data(data.msg);
  191. }
  192. , 'json'
  193. );
  194. }
  195. //提示虚拟奖品
  196. function virtualAward(data) {
  197. var $msgBox = $('#code_tips_box');
  198. $('.tips_txt_show', $msgBox).html('您已获得'+data.prize_name+'<br>'+data.virtual_data);
  199. $('.coupon_code img', $msgBox).attr('src', data.img_url);
  200. $msgBox.show();
  201. $('.a_cover').show();
  202. }
  203. //提示实物奖品
  204. function objectAward(data) {
  205. var $msgBox = $('#object_tips_box');
  206. $('.object_name', $msgBox).html('您已获得<br>'+data.prize_name);
  207. $('.coupon_code img', $msgBox).attr('src', data.img_url);
  208. $('.share', $msgBox).attr('href', '<{$web_cfg.domain}>/?c=Express&lottery_data_id='+data.lottery_data_id);
  209. $msgBox.show();
  210. $('.a_cover').show();
  211. }
  212. //消息提示
  213. function showFail(msg, isPer) {
  214. var $msgBox = $('#tips_box');
  215. if (isPer) $('.go_tips_btn').show();
  216. $('.tips_msg', $msgBox).html(msg);
  217. $('#tips_box, .a_cover').fadeIn().delay(2000).fadeOut();
  218. }
  219. $('.vogue_add_btn').on('click', function() {
  220. $('#add_tips').show();
  221. });
  222. $('.add_join_btn').on('click', function () {
  223. $('#add_tips').hide();
  224. });
  225. //判断当前页图片加载完成loading消失
  226. $(".vpro_list_show dl dt img").each(function(){
  227. $(this).load(function(){
  228. $(this).parent().css("background","none");
  229. })
  230. });
  231. });
  232. </script>
  233. <span id="winData"></span>
  234. <{include file="bottom.html"}>