Run.cshtml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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. }
  14. <style>
  15. .main-area {
  16. width: 100vw;
  17. height: 100vh;
  18. background: #f2f6fe;
  19. display: flex;
  20. --mc: #3168f5;
  21. justify-content: center;
  22. align-items: center;
  23. }
  24. .show-title {
  25. font-size: 35px;
  26. color: var(--mc);
  27. margin-top: -10%;
  28. letter-spacing: 5px;
  29. font-weight: bold;
  30. }
  31. </style>
  32. @if (Model.Play.PlayState == CampPlayStateDefinition.New)
  33. {
  34. <style>
  35. </style>
  36. <div class="main-area"> <div class="show-title">演练未开始</div></div>
  37. }
  38. else if (Model.Play.PlayState != CampPlayStateDefinition.Run)
  39. {
  40. <style>
  41. .report a {
  42. font-size: 30px;
  43. letter-spacing: 5px;
  44. padding: 35px 20px 3px;
  45. border-bottom: 2px solid var(--mc);
  46. color: var(--mc);
  47. }
  48. .report a:hover {
  49. padding-bottom: 1px;
  50. border-bottom: 5px solid var(--mc);
  51. }
  52. </style>
  53. <div class="main-area flex-column">
  54. <div class="show-title">演练结束</div>
  55. <div class="report">
  56. <a href="@Url.Action("Report","Play")/@(Model.Play.Id)">点击查看演练报告</a>
  57. </div>
  58. </div>
  59. }
  60. else
  61. {
  62. <style>
  63. .main-area {
  64. --padding: 5px;
  65. --mw: calc(100vw - var(--padding)*2);
  66. --mh: calc(100vh - var(--padding)*2);
  67. padding: var(--padding);
  68. }
  69. .area-h {
  70. width: 100%;
  71. height: 100%;
  72. display: flex;
  73. flex-direction: row;
  74. }
  75. .area-v {
  76. width: 100%;
  77. height: 100%;
  78. display: flex;
  79. flex-direction: column;
  80. }
  81. .area {
  82. padding: 8px;
  83. width: 100%;
  84. height: 100%;
  85. /*border: 1px solid red;*/
  86. }
  87. .card-vber {
  88. --borderRadius: 0.75rem;
  89. margin: 0;
  90. width: 100% !important;
  91. height: 100% !important;
  92. background: transparent;
  93. border-radius: var(--borderRadius);
  94. }
  95. .card-vber.maximized-card {
  96. --p: 10px;
  97. border-radius: var(--borderRadius);
  98. left: var(--p);
  99. right: var(--p);
  100. top: var(--p);
  101. bottom: var(--p);
  102. width: calc(100% - var(--p)*2) !important;
  103. height: calc(100% - var(--p)*2) !important;
  104. }
  105. .card-vber > .card-header {
  106. background: #fff;
  107. padding: 1rem;
  108. border-radius: var(--borderRadius) var(--borderRadius) 0 0;
  109. }
  110. .card-vber.maximized-card > .card-header {
  111. border-radius: var(--borderRadius) var(--borderRadius) 0 0 !important;
  112. }
  113. .card-vber > .card-header:before {
  114. content: "";
  115. position: absolute;
  116. left: -1px;
  117. top: calc(50% - 15px);
  118. width: 5px;
  119. height: 30px;
  120. background: #235ef4;
  121. border-radius: 0 5px 5px 0;
  122. }
  123. .card-vber > .card-header .card-title {
  124. color: #14161d;
  125. font-weight: bold;
  126. position: relative;
  127. }
  128. .card-vber > .card-body {
  129. background: #fbfdff;
  130. background-image: radial-gradient(#f2f3fe,#f5f3fe,#f8f6fe,#faf6fe,#fff);
  131. padding: 10px 1px;
  132. border-radius: 0 0 var(--borderRadius) var(--borderRadius);
  133. }
  134. .card-vber > .card-body .scroll-box {
  135. width: 100%;
  136. height: 100%;
  137. padding: 0 10px;
  138. }
  139. .card-vber > .card-body .scroll-box .box-body {
  140. width: 100%;
  141. height: 100%;
  142. }
  143. </style>
  144. <div class="main-area">
  145. <div class="area-v" style="width: calc(var(--mw) * 0.78);">
  146. <div class="area-h" style="height: calc(var(--mh) * 0.40)">
  147. <div class="area" style="width: 50%">@Html.Partial("_Run/_SceneInfo", Model)</div>
  148. <div class="area" style="width: 50%">@Html.Partial("_Run/_ScenePlay")</div>
  149. </div>
  150. <div class="area-h" style="height: calc(var(--mh) * 0.35)">
  151. <div class="area" style="width: 50%">@Html.Partial("_Run/_CmdLog", Model)</div>
  152. <div class="area" style="width: 50%">@Html.Partial("_Run/_CmdSend")</div>
  153. </div>
  154. <div class="area-h" style="height: calc(var(--mh) * 0.25)">
  155. <div class="area">@Html.Partial("_Run/_CmdRole")</div>
  156. </div>
  157. </div>
  158. <div class="area-v" style="width: calc(var(--mw) * 0.22);">
  159. <div class="area-h" style="height: calc(var(--mh) * 0.3)">
  160. <div class="area">@Html.Partial("_Run/_RunBaseInfo")</div>
  161. </div>
  162. <div class="area-h" style="height: calc(var(--mh) * 0.45)">
  163. <div class="area">@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/_ScoreEval")</div>
  167. </div>
  168. </div>
  169. </div>
  170. <div id="media-box-common" style="display: none"></div>
  171. @section scripts {
  172. <script>
  173. var startFlag = true;
  174. $(function () {
  175. window.PreLoad();
  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.Play.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 = SettingManager.GetSettingValue(IwbSettingNames.WeDataCenterIp).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. }