_RunBaseInfo.cshtml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. @using Abp.Timing
  2. @using WeOnlineApp.Configuration
  3. @using WeOnlineApp.Helpers
  4. @model WeOnlineApp.Models.Play.CampPlayModel
  5. @{
  6. string id = "run-info";
  7. }
  8. <style>
  9. .base-info {
  10. padding: 0 15px 10px;
  11. display: flex;
  12. flex-direction: column;
  13. color: var(--mc);
  14. }
  15. .base-info .menu {
  16. font-size: 15px;
  17. --h: 25px;
  18. line-height: var(--h);
  19. list-style: none;
  20. display: flex;
  21. justify-content: center;
  22. padding: 0;
  23. margin: 0;
  24. }
  25. .base-info .menu a {
  26. color: #8c91a8;
  27. padding: 0 6px 0 5px;
  28. margin: 0 5px;
  29. line-height: var(--h);
  30. }
  31. .base-info .menu a:hover {
  32. color: var(--mc);
  33. padding-bottom: 1px;
  34. border-bottom: 2px solid var(--mc);
  35. }
  36. .base-info .count-down-box {
  37. display: flex;
  38. justify-content: center;
  39. align-items: center;
  40. font-size: 30px;
  41. font-weight: bold;
  42. margin: 8px 0;
  43. color: #ff7c63;
  44. }
  45. .base-info dl {
  46. display: inline-flex;
  47. margin-bottom: 3px;
  48. line-height: 22px;
  49. }
  50. .base-info dl dt {
  51. font-size: 15px;
  52. margin: 0;
  53. white-space: nowrap;
  54. }
  55. .base-info dl dd {
  56. font-size: 13px;
  57. padding-left: 10px;
  58. margin: 0;
  59. }
  60. </style>
  61. @Html.Partial("_Run/_AreaBox", $"演练信息#{id}")
  62. <div style="display: none" id="@id-pre">
  63. <div class="base-info">
  64. @if (Model.PlayUser != null)
  65. {
  66. <ul class="menu">
  67. <li>
  68. <a href="@Url.Action("Index", "Play")"><i class="fa fa-home"></i>&nbsp;&nbsp;返回主页</a>
  69. </li>
  70. <li>
  71. <a href="javascript:void(0)" onclick="Exit()"><i class="fas fa-backspace"></i>&nbsp;&nbsp;退出演练</a>
  72. </li>
  73. <li>
  74. <a href="javascript:void(0)" onclick="LoginOut()"><i class="fas fa-sign-out-alt"></i>&nbsp;&nbsp;注销账号</a>
  75. </li>
  76. </ul>
  77. }
  78. <div class="count-down-box">
  79. <div id="count-down"></div>
  80. </div>
  81. <dl><dt>演练名称:</dt><dd>@Model.Play.Name</dd></dl>
  82. <dl><dt>演练时长:</dt><dd>@Model.Camp.MaxTrainingMinute 分钟</dd></dl>
  83. <dl><dt>演练目标:</dt><dd>@Model.Camp.Purposes </dd></dl>
  84. </div>
  85. </div>
  86. @using (Html.BeginScripts())
  87. {
  88. <script src="~/Content/Libs/countdown/countdown.js"></script>
  89. <script id="run-info-script">
  90. var $runInfoBody = $('#@id .box-body');
  91. $runInfoBody.html($('#@id-pre').html());
  92. $('#@id-pre').remove();
  93. @{
  94. var date = (Model.Play.StartDate ?? Clock.Now).AddMinutes((double) Model.Camp.MaxTrainingMinute).ToString("yyyy-MM-dd HH:mm:ss");
  95. }
  96. var countdown = new Countdown({
  97. selector: '#count-down',
  98. dateEnd: new Date('@(date)'),
  99. msgPattern: '{hours}:{minutes}:{seconds}',
  100. msgBefore: "演练未开始",
  101. msgAfter: "演练结束"
  102. });
  103. $(function() {
  104. OverlayScrollbar($runInfoBody.closest('.scroll-box'), { className: "os-theme-round-dark" });
  105. });
  106. function Exit() {
  107. MsgConfirm("退出后无法再加入演练,您确定退出演练吗?",
  108. "退出演练",
  109. function () {
  110. @if (Model.PlayUser != null)
  111. {
  112. if (Model.PlayUser.PlayerType == CampPlayerTypeDefinition.Creator)
  113. {
  114. <text>
  115. MsgConfirm("您是房主,退出后演练就会结束,确定退出吗?",
  116. "再次确认",
  117. function() {
  118. $.iwbAjax({
  119. url: abp.appUrl + '/CampPlay/ExitPlay?no=@(Model.Play.Id)',
  120. success: function() {
  121. window.location.href = "@Url.Action("Start", "Play")";
  122. }
  123. });
  124. });
  125. </text>
  126. }
  127. else
  128. {
  129. <text>
  130. $.iwbAjax({
  131. url: abp.appUrl + '/CampPlay/ExitPlay?no=@(Model.Play.Id)',
  132. success: function() {
  133. window.location.href = "@Url.Action("Start", "Play")";
  134. }
  135. });
  136. </text>
  137. }
  138. }
  139. });
  140. }
  141. function LoginOut() {
  142. MsgConfirm("您确定注销账号吗?",
  143. "注销账号",
  144. function () {
  145. @if (Model.PlayUser != null)
  146. {
  147. if (Model.PlayUser.PlayerType == CampPlayerTypeDefinition.Creator)
  148. {
  149. <text>
  150. MsgConfirm("您是房主,注销后演练进程无法继续,注销退出吗?",
  151. "再次确认",
  152. function() {
  153. window.location.href = "/Account/LogOut";
  154. });
  155. </text>
  156. }
  157. else
  158. {
  159. <text>
  160. window.location.href = "/Account/LogOut";
  161. </text>
  162. }
  163. }
  164. });
  165. }
  166. </script>
  167. }