medalInfo.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>我的勋章</title>
  5. <!--#include virtual="/h5v2/htm2/head.htm" -->
  6. <style type="text/css">
  7. body {
  8. background-image: url(img/medalPopup.jpg);
  9. }
  10. .btn_focus_btn {
  11. border: 3px solid #fff;
  12. border-radius: 20px;
  13. box-shadow: 0px 0px 10px #3794e2;
  14. }
  15. </style>
  16. </head>
  17. <body>
  18. <div id="medalDiv"></div>
  19. <div id="buttonDiv"></div>
  20. <!--#include virtual="/h5v2/htm2/foot.htm" -->
  21. <!--#include virtual="activity_cfg.htm" -->
  22. <script type="text/javascript">
  23. var linkImage = CONFIG.SPACER; //透明图片
  24. var buttons = []; //按钮数组
  25. var prize; //奖品信息
  26. var phoneFlag = 0; //0表示未中奖,1表示中奖留了号码,2表示中奖没留号码
  27. var prizeImg = ''; //奖品图片
  28. var prizeCount = 0;
  29. var dataJson = [];
  30. var act_id = ACTIVITY_CFG.ACT_ID,
  31. act_code = ACTIVITY_CFG.ACT_CODE; //活动id及code
  32. var dudu_is_vip = PageH5.cookie.get('activity_is_vip');
  33. var uid = PageH5.cookie.get('activity_userid');
  34. function init() {
  35. var html = '';
  36. html += '<div style="position:absolute;left:421px;top:644px;"><img id="btn0" src="./img/btn_back.png"/></div>';
  37. html += '<div style="position:absolute;left:711px;top:644px;"><img id="btn1" src="./img/btn_getPrize.png"/></div>';
  38. G('buttonDiv').innerHTML = html;
  39. var _html = "";
  40. _html += '<div style="position:absolute;left:410px;top:210px;"><img id="title_0" src="./img/title_0_no.png"/></div>';
  41. _html += '<div style="position:absolute;left:660px;top:210px;"><img id="title_1" src="./img/title_1_no.png"/></div>';
  42. _html += '<div style="position:absolute;left:290px;top:390px;"><img id="title_2" src="./img/title_2_no.png"/></div>';
  43. _html += '<div style="position:absolute;left:535px;top:390px;"><img id="title_3" src="./img/title_3_no.png"/></div>';
  44. _html += '<div style="position:absolute;left:780px;top:390px;"><img id="title_4" src="./img/title_4_no.png"/></div>';
  45. G('medalDiv').innerHTML = _html;
  46. for (var i = 0; i < 2; i++) {
  47. var obj = {
  48. id: 'btn' + i,
  49. action: goAction,
  50. index: i,
  51. left: 'btn' + (i - 1),
  52. right: 'btn' + (i + 1),
  53. up: '',
  54. down: '',
  55. focusClass: 'btn',
  56. };
  57. buttons.push(obj);
  58. }
  59. PageH5.btn.init('btn1', buttons, '', true);
  60. }
  61. function goAction(button) {
  62. if (button.index == 1) {
  63. if (phoneFlag == 1) {
  64. ajax({
  65. url: webUrl + "index.php?m=Home&c=Activityv2&a=prize",
  66. data: {
  67. uid: uid,
  68. act_code: act_id,
  69. is_vip: dudu_is_vip,
  70. run: 'complate',
  71. },
  72. success: function(res) {
  73. if (res.code == 0) {
  74. if (res.data.yes.prize_status == "none") { //没中奖
  75. } else if (res.data.yes.prize_status == "real") { //中实物
  76. location.href = './prize.html?from=medalInfo';
  77. } else if (res.data.yes.prize_status == "vitual") { //虚拟
  78. location.href = './noPrize.html?from=medalInfo';
  79. }
  80. } else {
  81. PageH5.tip(res.msg);
  82. // back()
  83. }
  84. },
  85. error: function() {
  86. // back()
  87. }
  88. })
  89. } else {
  90. PageH5.tip('您还集齐5个勋章,继续加油噢!');
  91. }
  92. } else if (button.index == 0) {
  93. back();
  94. }
  95. }
  96. function back() {
  97. location.href = './index.html?f=medal';
  98. }
  99. function getUserCollects(fn) {
  100. ajax({
  101. url: webUrl + "index.php?c=Home&c=Activityv2&a=getUserCollects",
  102. data: {
  103. uid: uid,
  104. act_code: act_id,
  105. is_vip: dudu_is_vip
  106. },
  107. success: function(res) {
  108. if (res.code == 0) {
  109. for (var i = 0; i < res.data.collect.length; i++) {
  110. if (res.data.collect[i].num > 0)
  111. G('title_' + (res.data.collect[i].collect_id * 1 - 1)).src = './img/title_' + (res.data.collect[i].collect_id * 1 - 1) + '.png'
  112. }
  113. if (res.data.complate.length > 0) {
  114. phoneFlag = 1;
  115. } else {
  116. phoneFlag = 2;
  117. }
  118. }
  119. fn && fn(res);
  120. }
  121. })
  122. }
  123. window.onload = function() {
  124. init();
  125. getUserCollects()
  126. }
  127. </script>
  128. </body>
  129. </html>