Index.cshtml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. @model NEducation.Models.CheckMiniGameModel
  2. @{
  3. ViewBag.Title = "MiniGame";
  4. Layout = "~/Views/Shared/_LayoutMiniGame.cshtml";
  5. }
  6. <div class="main minigame">
  7. <div class="minigame-container fixed top-0 left-0 right-0 z-50 w-full overflow-x-hidden overflow-y-auto md:inset-0 h-screen max-h-full z-[99999] backdrop-filter-1">
  8. <div class="fixed z-[1] w-full blend-mode bottom-[0%] left-[0%]">
  9. <img src="~/Content/assets/mini_game/assets/images/bg_icon_2.png" class="" />
  10. </div>
  11. <div class="fixed z-[1] blend-mode bottom-[0%] right-[0px] flex flex-col">
  12. <img src="~/Content/assets/mini_game/assets/images/bg_icon_3.png" class="" />
  13. </div>
  14. <div class="fixed z-[1] blend-mode top-[-20%] left-[-30%]">
  15. <img src="~/Content/assets/mini_game/assets/images/bg_icon_4.png" class="" />
  16. </div>
  17. <div class="minigame_content">
  18. <div class="text-c-1 text-s-36 justify-center top-50">
  19. MINI GAME
  20. </div>
  21. <div class="pb-[10px]">
  22. <div class="text-c-2 w-full justify-center font-z-10 top-30 bottom-30 text-s-15">
  23. Let me know your answers!
  24. </div>
  25. </div>
  26. <div class="w-full min-h-[200px] flex relative mb-[10px]" id="div_clock" style="display: @(ViewBag.ShowClock ? "block" : "none")">
  27. <div class="absolute right-[-10px] top-[10px] w-[100%] h-full card-monthly">
  28. <div class="px-[30px]">
  29. <div class="flex justify-between items-center">
  30. <div class="relative">
  31. <img src="~/Content/assets/mini_game/assets/images/Clender.png" class="h-[101px]" />
  32. <div class="absolute left-[50%] top-[50%] translate-x-[-50%] translate-y-[-50%]">
  33. <div id="days" class="text-calender text-c-1" style="font-size: 50px;">
  34. 0
  35. </div>
  36. </div>
  37. <div class="text-c-1 justify-center">
  38. Days
  39. </div>
  40. </div>
  41. <div class="relative">
  42. <img src="~/Content/assets/mini_game/assets/images/Clock.png" class="h-[101px]" />
  43. <div class="absolute left-[50%] top-[50%] translate-x-[-50%] translate-y-[-50%]">
  44. <div id="hours" class="text-calender text-c-1" style="font-size: 50px;">
  45. 0
  46. </div>
  47. </div>
  48. <div class="text-c-1 justify-center">
  49. hours
  50. </div>
  51. </div>
  52. <div class="relative mt-[5px]">
  53. <img src="~/Content/assets/mini_game/assets/images/Clock.png" class="h-[101px]" />
  54. <div class="absolute left-[50%] top-[50%] translate-x-[-50%] translate-y-[-50%]">
  55. <div id="minutes" class="text-calender text-c-1" style="font-size: 50px;">
  56. 0
  57. </div>
  58. </div>
  59. <div class="text-c-1 justify-center">
  60. minutes
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. <div class="flex justify-center items-center gap-[20px] top-50" id="div_play" style="display: @(ViewBag.ShowPlayButton ? "flex" : "none")">
  68. <a href="javascript:void(0);" id="playNowButton" style="z-index: 10;">
  69. <div class="btn-c-2">
  70. <div>
  71. <img src="~/Content/assets/mini_game/assets/images/cup_icon.png" />
  72. </div>
  73. <div class="text-c-1 font-z-18">
  74. Play Now
  75. </div>
  76. </div>
  77. </a>
  78. </div>
  79. <div class="relative content-history">
  80. <div class="w-full justify-center gap-[1rem] items-center mb-[2px] pt-[10px] relative z-[999]">
  81. <a onclick="redirectToRank()">
  82. <div class="btn-option active_predict">
  83. Ranking
  84. </div>
  85. </a>
  86. <a onclick="ruleClick()">
  87. <div class="btn-option">
  88. How to play
  89. </div>
  90. </a>
  91. </div>
  92. </div>
  93. <div id="minigame-ranking-data-box" class="">
  94. <div class="ranking-box" id="winner-infomation">
  95. <div class="h-full w-full flex justify-center items-center box">
  96. <div class="max-w-[350px] w-full min-h-[20px] rounded-[20px] relative p-[10px] box-item">
  97. <div class="pt-[35px]">
  98. <div class="ranking-box-header">
  99. <div class="flex justify-center items-center pb-1">
  100. <div class="text-c-1">List of special prize winners</div>
  101. </div>
  102. <div class="flex justify-center items-center">
  103. <div class="text-c-1" style="font-size: 20px;">20 $</div>
  104. </div>
  105. </div>
  106. <div class="ranking-data" id="ranking_data"></div>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. <div id="minigame-rule-data-box" class="hide" style="border-radius: 0px 24px 24px 24px;">
  113. <div class="rule-box">
  114. <p>1. The mini-game starts at 10:00 AM every Sunday.</p>
  115. <p>2. You have 15 seconds to think and give your answer.</p>
  116. <p>3. Each person can only participate in the minigame once per day. If there is a system error during the minigame, the participant cannot play again, and it will be counted as one play. <br /> 4. Participants must be subscribers of the service.</p>
  117. <p>5. The minigame consists of 20 questions.</p>
  118. <p>6. Each question must be answered within 15 seconds.</p>
  119. <p>7. If a participant answers incorrectly, the game will immediately end, and they will not be able to play again.</p>
  120. <p>8. Prizes:</p>
  121. <p>- There is only one prize for the participant who correctly answers all 20 questions the fastest.</p>
  122. <p>- The prize is 20$, added to Emoney</p>
  123. <p>- If multiple participants answer correctly at the same time, the prize money will be evenly divided among them.</p>
  124. <p>- Results will be sent to the participants via SMS at 09:00 AM on the following Monday.</p>
  125. </div>
  126. </div>
  127. <!-- Popup container -->
  128. <div id="popup-container" class="popup-container hidden">
  129. <div class="popup-content">
  130. <!-- Close button -->
  131. <button id="close-popup" class="close-popup-button">✕</button>
  132. <h2>Oops...!</h2>
  133. <p>You haven't registered MEDU service yet. Please try to register and come back to play the mini-game. Thank you.</p>
  134. <div class="flex justify-center items-center gap-[20px] top-50">
  135. <a href="/Home" style="z-index:10">
  136. <div class="btn-c-2">
  137. <div class="text-c-1 font-z-18 button-box">
  138. Home
  139. </div>
  140. </div>
  141. </a>
  142. </div>
  143. </div>
  144. </div>
  145. </div>
  146. </div>
  147. </div>
  148. <script>
  149. $(document).ready(function () {
  150. redirectToRank();
  151. });
  152. var sysdateString = '@ViewBag.Sysdate';
  153. var startDateString = '@ViewBag.StartDate';
  154. var endDateString = '@ViewBag.EndDate';
  155. var isSubscribed = '@ViewBag.IsSubscribed';
  156. var sysdate = new Date(sysdateString);
  157. var startDate = new Date(startDateString);
  158. var endDate = new Date(endDateString);
  159. var countDownDate;
  160. function showPopup() {
  161. document.getElementById('popup-container').classList.remove('hidden');
  162. }
  163. document.getElementById('close-popup').onclick = function() {
  164. document.getElementById('popup-container').classList.add('hidden');
  165. };
  166. document.getElementById("playNowButton").onclick = function() {
  167. if (isSubscribed != "1") {
  168. showPopup();
  169. } else {
  170. window.location.href = '@Url.Action("StartPlay", "MiniGame")';
  171. }
  172. };
  173. if (sysdate < startDate) {
  174. countDownDate = startDate.getTime();
  175. $("#div_clock").show();
  176. $("#div_play").hide();
  177. } else if (sysdate >= startDate && sysdate <= endDate) {
  178. countDownDate = endDate.getTime();
  179. $("#div_clock").show();
  180. $("#div_play").hide();
  181. } else {
  182. $("#div_clock").hide();
  183. $("#div_play").show();
  184. }
  185. if (countDownDate) {
  186. $("#div_clock").show();
  187. var x = setInterval(function () {
  188. var now = new Date().getTime();
  189. var distance = countDownDate - now;
  190. var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  191. var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  192. var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  193. var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  194. document.getElementById("days").innerHTML = days;
  195. document.getElementById("hours").innerHTML = hours;
  196. document.getElementById("minutes").innerHTML = minutes;
  197. if (distance < 0) {
  198. clearInterval(x);
  199. document.getElementById("days").innerHTML = '0';
  200. document.getElementById("hours").innerHTML = '0';
  201. document.getElementById("minutes").innerHTML = '0';
  202. }
  203. }, 1000);
  204. } else {
  205. $("#div_clock").hide();
  206. }
  207. function redirectToRank() {
  208. document.getElementById('minigame-ranking-data-box').style.display = 'block';
  209. document.getElementById('minigame-rule-data-box').style.display = 'none';
  210. }
  211. function ruleClick() {
  212. document.getElementById('minigame-ranking-data-box').style.display = 'none';
  213. document.getElementById('minigame-rule-data-box').style.display = 'block';
  214. }
  215. </script>