Run.cshtml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. @using Abp.Configuration
  2. @using IwbZero.ToolCommon.StringModel
  3. @using WeApp.Configuration
  4. @using WeEngine.Enum
  5. @using WeOnlineApp.Configuration
  6. @model WeOnlineApp.Models.Play.CampPlayModel
  7. @{
  8. Layout = "~/Views/Shared/Layout/_Layout.None.cshtml";
  9. ViewBag.Title = "演练中";
  10. //CampPlayDto play = Model.Play;
  11. //CampPlayUserDto playUser = Model.PlayUser;
  12. //CampDto camp = Model.Camp;
  13. //string[] roleArr = new string[0];
  14. }
  15. <style>
  16. .main-area {
  17. width: 100vw;
  18. height: 100vh;
  19. background: #f2f6fe;
  20. display: flex;
  21. --mc: #3168f5;
  22. justify-content: center;
  23. align-items: center;
  24. }
  25. .show-title {
  26. font-size: 35px;
  27. color: var(--mc);
  28. margin-top: -10%;
  29. letter-spacing: 5px;
  30. font-weight: bold;
  31. }
  32. </style>
  33. @if (Model.Play.PlayState == CampPlayStateDefinition.New)
  34. {
  35. <style>
  36. </style>
  37. <div class="main-area"> <div class="show-title">演练未开始</div></div>
  38. }
  39. else if (Model.Play.PlayState != CampPlayStateDefinition.Run)
  40. {
  41. <style>
  42. .report a {
  43. font-size: 30px;
  44. letter-spacing: 5px;
  45. padding: 35px 20px 3px;
  46. border-bottom: 2px solid var(--mc);
  47. color: var(--mc);
  48. }
  49. .report a:hover {
  50. padding-bottom: 1px;
  51. border-bottom: 5px solid var(--mc);
  52. }
  53. </style>
  54. <div class="main-area flex-column">
  55. <div class="show-title">演练结束</div>
  56. <div class="report">
  57. <a href="@Url.Action("Report","Play")/@(Model.Play.Id)">点击查看演练报告</a>
  58. </div>
  59. </div>
  60. }
  61. else
  62. {
  63. <style>
  64. .main-area {
  65. --padding: 5px;
  66. --mw: calc(100vw - var(--padding)*2);
  67. --mh: calc(100vh - var(--padding)*2);
  68. padding: var(--padding);
  69. }
  70. .area-h {
  71. width: 100%;
  72. height: 100%;
  73. display: flex;
  74. flex-direction: row;
  75. }
  76. .area-v {
  77. width: 100%;
  78. height: 100%;
  79. display: flex;
  80. flex-direction: column;
  81. }
  82. .area {
  83. padding: 8px;
  84. width: 100%;
  85. height: 100%;
  86. /*border: 1px solid red;*/
  87. }
  88. .card-vber {
  89. --borderRadius: 0.75rem;
  90. margin: 0;
  91. width: 100% !important;
  92. height: 100% !important;
  93. background: transparent;
  94. border-radius: var(--borderRadius);
  95. }
  96. .card-vber.maximized-card {
  97. --p: 10px;
  98. border-radius: var(--borderRadius);
  99. left: var(--p);
  100. right: var(--p);
  101. top: var(--p);
  102. bottom: var(--p);
  103. width: calc(100% - var(--p)*2) !important;
  104. height: calc(100% - var(--p)*2) !important;
  105. }
  106. .card-vber > .card-header {
  107. background: #fff;
  108. padding: 1rem;
  109. border-radius: var(--borderRadius) var(--borderRadius) 0 0;
  110. }
  111. .card-vber.maximized-card > .card-header {
  112. border-radius: var(--borderRadius) var(--borderRadius) 0 0 !important;
  113. }
  114. .card-vber > .card-header:before {
  115. content: "";
  116. position: absolute;
  117. left: -1px;
  118. top: calc(50% - 15px);
  119. width: 5px;
  120. height: 30px;
  121. background: #235ef4;
  122. border-radius: 0 5px 5px 0;
  123. }
  124. .card-vber > .card-header .card-title {
  125. color: #14161d;
  126. font-weight: bold;
  127. position: relative;
  128. }
  129. .card-vber > .card-body {
  130. background: #fbfdff;
  131. background-image: radial-gradient(#f2f3fe,#f5f3fe,#f8f6fe,#faf6fe,#fff);
  132. padding: 10px 1px;
  133. border-radius: 0 0 var(--borderRadius) var(--borderRadius);
  134. }
  135. .card-vber > .card-body .scroll-box {
  136. width: 100%;
  137. height: 100%;
  138. padding: 0 10px;
  139. }
  140. .card-vber > .card-body .scroll-box .box-body {
  141. width: 100%;
  142. height: 100%;
  143. }
  144. </style>
  145. <div class="main-area">
  146. <div class="area-v" style="width: calc(var(--mw) * 0.78);">
  147. <div class="area-h" style="height: calc(var(--mh) * 0.40)">
  148. <div class="area" style="width: 50%">@Html.Partial("_Run/_SceneInfo", Model)</div>
  149. <div class="area" style="width: 50%">@Html.Partial("_Run/_ScenePlay")</div>
  150. </div>
  151. <div class="area-h" style="height: calc(var(--mh) * 0.35)">
  152. <div class="area" style="width: 50%">@Html.Partial("_Run/_CmdLog", Model)</div>
  153. <div class="area" style="width: 50%">@Html.Partial("_Run/_CmdSend")</div>
  154. </div>
  155. <div class="area-h" style="height: calc(var(--mh) * 0.25)">
  156. <div class="area">@Html.Partial("_Run/_CmdRole")</div>
  157. </div>
  158. </div>
  159. <div class="area-v" style="width: calc(var(--mw) * 0.22);">
  160. <div class="area-h" style="height: calc(var(--mh) * 0.3)">
  161. <div class="area">@Html.Partial("_Run/_RunBaseInfo")</div>
  162. </div>
  163. <div class="area-h" style="height: calc(var(--mh) * 0.45)">
  164. <div class="area">@Html.Partial("_Run/_ScenePath")</div>
  165. </div>
  166. <div class="area-h" style="height: calc(var(--mh) * 0.25)">
  167. <div class="area">@Html.Partial("_Run/_ScoreEval")</div>
  168. </div>
  169. </div>
  170. </div>
  171. <div id="media-box-common" style="display: none"></div>
  172. @section scripts {
  173. <script>
  174. var startFlag = true;
  175. $(function() {
  176. abp.signalr.connect(function() {
  177. window.iwbHub.server.registerGroup('@(Model.Play.InvitationCode)').done(function() {
  178. abp.log.debug('@(Model.Play.InvitationCode) Group Registered to the SignalR server!');
  179. });
  180. setTimeout(function() {
  181. $.iwbAjax5({
  182. url: abp.appUrl + "/CampPlay/StartFeedback?no=@(Model.Play.Id)",
  183. success: function(res) {
  184. startFlag = res;
  185. if (startFlag) {
  186. window.GetScenes();
  187. }
  188. }
  189. });
  190. },
  191. 100);
  192. window.ScenePath();
  193. @if(Model.Play.PlayModel== CampPlayModelDefinition.Team)
  194. {
  195. <text>
  196. window.GetChat();
  197. </text>
  198. }
  199. window.GetScore();
  200. });
  201. });
  202. function Scroll2Bottom(that) {
  203. var instance = window.OverlayScrollbars($(that)[0]);
  204. if (!instance) {
  205. OverlayScrollbar($(that), { className: "os-theme-round-dark" });
  206. instance = window.OverlayScrollbars($(that)[0]);
  207. }
  208. if (instance) {
  209. try {
  210. instance.scroll({ y: "100%" });
  211. } catch (e) {
  212. }
  213. }
  214. }
  215. function Scroll2Top(that) {
  216. var instance = window.OverlayScrollbars($(that)[0]);
  217. if (!instance) {
  218. OverlayScrollbar($(that), { className: "os-theme-round-dark" });
  219. instance = window.OverlayScrollbars($(that)[0]);
  220. }
  221. if (instance) {
  222. try {
  223. instance.scroll({ y: "0%" });
  224. } catch (e) {
  225. }
  226. }
  227. }
  228. </script>
  229. <script>
  230. iwbHub.client.getUserExit = function(msg) {
  231. console.log('getUserExit: ', msg);
  232. if (msg) {
  233. try {
  234. var data = JSON.parse(msg);
  235. if (data) {
  236. }
  237. } catch (e) {
  238. console.log('getUserExit: ', e);
  239. }
  240. }
  241. };
  242. iwbHub.client.getReloadPage = function(msg) {
  243. console.log('getReloadPage: ', msg);
  244. if (msg) {
  245. try {
  246. var data = JSON.parse(msg);
  247. if (data.no == '@(Model.PlayUser.Id)') {
  248. window.location.reload();
  249. }
  250. } catch (e) {
  251. console.log('getReloadPage: ', e);
  252. }
  253. }
  254. };
  255. iwbHub.client.getGuide = function(msg) {
  256. console.log('getGuide: ', msg);
  257. if (msg) {
  258. try {
  259. var data = JSON.parse(msg);
  260. if (!data) {
  261. return;
  262. }
  263. } catch (e) {
  264. console.log('getGuide: ', e);
  265. }
  266. }
  267. };
  268. iwbHub.client.getEnvironment = function(msg) {
  269. console.log('getEnvironment: ', msg);
  270. if (msg) {
  271. try {
  272. var data = JSON.parse(msg);
  273. if (!data) {
  274. return;
  275. }
  276. Environment(data);
  277. } catch (e) {
  278. console.log('getEnvironment: ', e);
  279. }
  280. }
  281. };
  282. </script>
  283. <script>
  284. var et, evList = [];
  285. function Environment(data) {
  286. evList.push(data);
  287. ShowEnvironment();
  288. }
  289. @{
  290. var dataCenterUrl = IwbSettingNames.GetWeDataCenterIp(SettingManager).Ew("/");
  291. }
  292. function ShowEnvironment() {
  293. var data = evList[0] ? $.extend({}, evList[0]) : undefined;
  294. console.log(data);
  295. if (!data) {
  296. return;
  297. }
  298. if ($('.environment').length > 0 && $('#ev-' + data.nodePath).length <= 0) {
  299. return;
  300. }
  301. evList.splice(0, 1);
  302. var str1;
  303. var path = data.resourcePath.indexOf('http') > -1
  304. ? data.resourcePath
  305. : '@(dataCenterUrl)' + data.resourcePath;
  306. switch (data.resourceType) {
  307. case @((int) ResourceType.Image):
  308. str1 = '<img src="{0}" style="" />'.format(path);
  309. break;
  310. case @((int) ResourceType.Audio):
  311. str1 =
  312. '<audio id="audio" style="display:none" controls autoplay><source src="{0}" type="audio/mp3">您的浏览器不支持 HTML5 audio 标签。</audio>'
  313. .format(path);
  314. break;
  315. case @((int) ResourceType.Video):
  316. str1 =
  317. '<video id="video" style="" controls autoplay><source src="{0}" type="video/mp4">您的浏览器不支持 HTML5 video 标签。</video>'
  318. .format(path);
  319. break;
  320. default:
  321. str1 = '';
  322. }
  323. clearTimeout(et);
  324. if ($('#ev-' + data.nodePath).length > 0) {
  325. $('#ev-' + data.nodePath).find('.play-box').append('<div style="width:100% ;height:15px"></div>');
  326. $('#ev-' + data.nodePath).find('.play-box').append(str1);
  327. Scroll2Bottom($('#environment-score'));
  328. } else {
  329. var str =
  330. '<div class="environment" id="ev-{0}" style="display:none;"><div class="close" onclick="CloseEnvironment(false)">关闭</div><div id="environment-score"><div class="play-box">{1}</div></div></div>'
  331. .format(data.nodePath, str1);
  332. $('body').append(str);
  333. OverlayScrollbar($('#environment-score'), { className: "os-theme-thin-light" });
  334. $(".environment").fadeIn(600);
  335. }
  336. et = setTimeout(CloseEnvironment, 1000 * 15);
  337. }
  338. function CloseEnvironment(isAuto) {
  339. isAuto = isAuto == undefined ? true : isAuto;
  340. clearTimeout(et);
  341. $(".environment").fadeOut(300).remove();
  342. if (isAuto) {
  343. ShowEnvironment();
  344. }
  345. }
  346. function PlayAudio(url, type) {
  347. if (!$('#audio-hidden-' + type).length) {
  348. var audio =
  349. '<audio id="audio-hidden-{1}" style="" controls autoplay><source src="{0}" type="audio/mpeg">您的浏览器不支持 HTML5 audio 标签。</audio>'
  350. .format(url, type);
  351. $('#media-box-common').append(audio);
  352. setTimeout(function() {$('#audio-hidden-' + type).remove();},15000);
  353. }
  354. }
  355. </script>
  356. }
  357. }