Display.cshtml 14 KB

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