Run.cshtml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  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. abp.signalr.connect(function() {
  176. window.iwbHub.server.registerGroup('@(Model.Play.InvitationCode)').done(function() {
  177. abp.log.debug('@(Model.Play.InvitationCode) Group Registered to the SignalR server!');
  178. });
  179. setTimeout(function() {
  180. $.iwbAjax5({
  181. url: abp.appUrl + "/CampPlay/StartFeedback?no=@(Model.Play.Id)",
  182. success: function(res) {
  183. startFlag = res;
  184. if (startFlag) {
  185. window.GetScenes();
  186. }
  187. }
  188. });
  189. },
  190. 100);
  191. window.ScenePath();
  192. @if(Model.Play.PlayModel== CampPlayModelDefinition.Team)
  193. {
  194. <text>
  195. window.GetChat();
  196. </text>
  197. }
  198. window.GetScore();
  199. });
  200. });
  201. function Scroll2Bottom(that) {
  202. var instance = window.OverlayScrollbars($(that)[0]);
  203. if (!instance) {
  204. OverlayScrollbar($(that), { className: "os-theme-round-dark" });
  205. instance = window.OverlayScrollbars($(that)[0]);
  206. }
  207. if (instance) {
  208. try {
  209. instance.scroll({ y: "100%" });
  210. } catch (e) {
  211. }
  212. }
  213. }
  214. function Scroll2Top(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: "0%" });
  223. } catch (e) {
  224. }
  225. }
  226. }
  227. </script>
  228. <script>
  229. iwbHub.client.getUserExit = function(msg) {
  230. console.log('getUserExit: ', msg);
  231. if (msg) {
  232. try {
  233. var data = JSON.parse(msg);
  234. if (data) {
  235. }
  236. } catch (e) {
  237. console.log('getUserExit: ', e);
  238. }
  239. }
  240. };
  241. iwbHub.client.getReloadPage = function(msg) {
  242. console.log('getReloadPage: ', msg);
  243. if (msg) {
  244. try {
  245. var data = JSON.parse(msg);
  246. if (data.no == '@(Model.PlayUser.Id)') {
  247. window.location.reload();
  248. }
  249. } catch (e) {
  250. console.log('getReloadPage: ', e);
  251. }
  252. }
  253. };
  254. iwbHub.client.getGuide = function(msg) {
  255. console.log('getGuide: ', msg);
  256. if (msg) {
  257. try {
  258. var data = JSON.parse(msg);
  259. if (!data) {
  260. return;
  261. }
  262. } catch (e) {
  263. console.log('getGuide: ', e);
  264. }
  265. }
  266. };
  267. iwbHub.client.getEnvironment = function(msg) {
  268. console.log('getEnvironment: ', msg);
  269. if (msg) {
  270. try {
  271. var data = JSON.parse(msg);
  272. if (!data) {
  273. return;
  274. }
  275. Environment(data);
  276. } catch (e) {
  277. console.log('getEnvironment: ', e);
  278. }
  279. }
  280. };
  281. </script>
  282. <script>
  283. var et, evList = [];
  284. function Environment(data) {
  285. evList.push(data);
  286. ShowEnvironment();
  287. }
  288. @{
  289. var dataCenterUrl = SettingManager.GetSettingValue(IwbSettingNames.WeDataCenterIp).Ew("/");
  290. }
  291. function ShowEnvironment() {
  292. var data = evList[0] ? $.extend({}, evList[0]) : undefined;
  293. console.log(data);
  294. if (!data) {
  295. return;
  296. }
  297. if ($('.environment').length > 0 && $('#ev-' + data.nodePath).length <= 0) {
  298. return;
  299. }
  300. evList.splice(0, 1);
  301. var str1;
  302. var path = data.resourcePath.indexOf('http') > -1
  303. ? data.resourcePath
  304. : '@(dataCenterUrl)' + data.resourcePath;
  305. switch (data.resourceType) {
  306. case @((int) ResourceType.Image):
  307. str1 = '<img src="{0}" style="" />'.format(path);
  308. break;
  309. case @((int) ResourceType.Audio):
  310. str1 =
  311. '<audio id="audio" style="display:none" controls autoplay><source src="{0}" type="audio/mp3">您的浏览器不支持 HTML5 audio 标签。</audio>'
  312. .format(path);
  313. break;
  314. case @((int) ResourceType.Video):
  315. str1 =
  316. '<video id="video" style="" controls autoplay><source src="{0}" type="video/mp4">您的浏览器不支持 HTML5 video 标签。</video>'
  317. .format(path);
  318. break;
  319. default:
  320. str1 = '';
  321. }
  322. clearTimeout(et);
  323. if ($('#ev-' + data.nodePath).length > 0) {
  324. $('#ev-' + data.nodePath).find('.play-box').append('<div style="width:100% ;height:15px"></div>');
  325. $('#ev-' + data.nodePath).find('.play-box').append(str1);
  326. Scroll2Bottom($('#environment-score'));
  327. } else {
  328. var str =
  329. '<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>'
  330. .format(data.nodePath, str1);
  331. $('body').append(str);
  332. OverlayScrollbar($('#environment-score'), { className: "os-theme-thin-light" });
  333. $(".environment").fadeIn(600);
  334. }
  335. et = setTimeout(CloseEnvironment, 1000 * 15);
  336. }
  337. function CloseEnvironment(isAuto) {
  338. isAuto = isAuto == undefined ? true : isAuto;
  339. clearTimeout(et);
  340. $(".environment").fadeOut(300).remove();
  341. if (isAuto) {
  342. ShowEnvironment();
  343. }
  344. }
  345. function PlayAudio(url, type) {
  346. if (!$('#audio-hidden-' + type).length) {
  347. var audio =
  348. '<audio id="audio-hidden-{1}" style="" controls autoplay><source src="{0}" type="audio/mpeg">您的浏览器不支持 HTML5 audio 标签。</audio>'
  349. .format(url, type);
  350. $('#media-box-common').append(audio);
  351. setTimeout(function() {$('#audio-hidden-' + type).remove();},15000);
  352. }
  353. }
  354. </script>
  355. }
  356. }