_RunBaseInfo.cshtml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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. @if (Model.Play.PlayState == CampPlayStateDefinition.End || Model.Play.PlayState == CampPlayStateDefinition.OverTime)
  80. {
  81. <div>演练结束</div>
  82. }
  83. else
  84. {
  85. <div id="count-down"></div>
  86. }
  87. </div>
  88. <dl><dt>演练名称:</dt><dd>@Model.Play.Name</dd></dl>
  89. <dl><dt>演练时长:</dt><dd>@Model.Camp.MaxTrainingMinute 分钟</dd></dl>
  90. <dl><dt>演练目标:</dt><dd>@Model.Camp.Purposes </dd></dl>
  91. </div>
  92. </div>
  93. @using (Html.BeginScripts())
  94. {
  95. <script src="~/Content/Libs/countdown/countdown.js"></script>
  96. <script id="run-info-script">
  97. var $runInfoBody = $('#@id .box-body');
  98. $runInfoBody.html($('#@id-pre').html());
  99. $('#@id-pre').remove();
  100. @if (Model.Play.PlayState != CampPlayStateDefinition.End&& Model.Play.PlayState != CampPlayStateDefinition.OverTime)
  101. {
  102. var date = (Model.Play.StartDate ?? Clock.Now).AddMinutes((double)Model.Camp.MaxTrainingMinute).ToString("yyyy-MM-dd HH:mm:ss");
  103. <text>
  104. var countdown = new Countdown({
  105. selector: '#count-down',
  106. dateEnd: new Date('@(date)'),
  107. msgPattern: '{hours}:{minutes}:{seconds}',
  108. msgBefore: "演练未开始",
  109. msgAfter: "演练已超时"
  110. });
  111. </text>
  112. }
  113. $(function() {
  114. OverlayScrollbar($runInfoBody.closest('.scroll-box'), { className: "os-theme-round-dark" });
  115. });
  116. function Exit() {
  117. MsgConfirm("退出后无法再加入演练,您确定退出演练吗?",
  118. "退出演练",
  119. function () {
  120. @if (Model.PlayUser != null)
  121. {
  122. if (Model.PlayUser.PlayerType == CampPlayerTypeDefinition.Creator)
  123. {
  124. <text>
  125. MsgConfirm("您是房主,退出后演练就会结束,确定退出吗?",
  126. "再次确认",
  127. function() {
  128. $.iwbAjax({
  129. url: abp.appUrl + '/CampPlay/ExitPlay?no=@(Model.Play.Id)',
  130. success: function() {
  131. window.location.href = "@Url.Action("Start", "Play")";
  132. }
  133. });
  134. });
  135. </text>
  136. }
  137. else
  138. {
  139. <text>
  140. $.iwbAjax({
  141. url: abp.appUrl + '/CampPlay/ExitPlay?no=@(Model.Play.Id)',
  142. success: function() {
  143. window.location.href = "@Url.Action("Start", "Play")";
  144. }
  145. });
  146. </text>
  147. }
  148. }
  149. });
  150. }
  151. function LoginOut() {
  152. MsgConfirm("您确定注销账号吗?",
  153. "注销账号",
  154. function () {
  155. @if (Model.PlayUser != null)
  156. {
  157. if (Model.PlayUser.PlayerType == CampPlayerTypeDefinition.Creator)
  158. {
  159. <text>
  160. MsgConfirm("您是房主,注销后演练进程无法继续,注销退出吗?",
  161. "再次确认",
  162. function() {
  163. window.location.href = "/Account/LogOut";
  164. });
  165. </text>
  166. }
  167. else
  168. {
  169. <text>
  170. window.location.href = "/Account/LogOut";
  171. </text>
  172. }
  173. }
  174. });
  175. }
  176. </script>
  177. }