Run.cshtml 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306
  1. @using Abp.Configuration
  2. @using Abp.Timing
  3. @using IwbZero.ToolCommon.StringModel
  4. @using WeEngine.Enum
  5. @using WeOnlineApp.Configuration
  6. @using WeOnlineApp.Models.Play
  7. @using WeOnlineApp.TrainingCamp.Dto
  8. @using WeOnlineApp.TrainingCampPlay.Dto
  9. @{
  10. Layout = "~/Views/Shared/Layout/_Layout.None.cshtml";
  11. ViewBag.Title = "演练中";
  12. CampPlayModel campPlay = ViewBag.CampPlay;
  13. CampPlayDto play = campPlay.Play;
  14. var dataCenterUrl = SettingManager.GetSettingValue(IwbSettingNames.WeDataCenterIp).Ew("/");
  15. string[] roleArr = new string[0];
  16. }
  17. <link href="~/Content/Css/runplay.min.css" rel="stylesheet" />
  18. <link href="~/Content/Css/path.min.css" rel="stylesheet" />
  19. <style>
  20. @*@if (playUser.PlayerType==CampPlayerTypeDefinition.Creator||play.PlayModel != CampPlayModelDefinition.Team) {
  21. <text>
  22. .box .log-cmd-box {
  23. --sh: 180px;
  24. }
  25. </text>
  26. }*@
  27. body {
  28. /*background-image: linear-gradient(45deg,#004f61,#005f61);*/
  29. background: #004f61;
  30. }
  31. .box .box-header {
  32. background: #004f61;
  33. }
  34. .role-change-box {
  35. background: #004f61;
  36. }
  37. .score-info-box .score-box {
  38. color: #eee;
  39. background: #049e9a;
  40. }
  41. .cmd-box .msg-box textarea {
  42. background: #003561;
  43. }
  44. .cmd-box .msg-box textarea:focus, .cmd-box .msg-box textarea:active {
  45. background: #004261;
  46. }
  47. .show-title {
  48. margin: 250px auto 0;
  49. font-size: 80px;
  50. width: auto;
  51. font-weight: 600;
  52. text-align: center;
  53. letter-spacing: 50px;
  54. padding-left: 50px;
  55. }
  56. .report {
  57. margin: 30px auto 0;
  58. font-size: 40px;
  59. width: auto;
  60. font-weight: 600;
  61. text-align: center;
  62. letter-spacing: 20px;
  63. padding-left: 20px;
  64. }
  65. .report a {
  66. padding: 20px 20px 10px 40px;
  67. color: inherit;
  68. border-bottom: 5px solid;
  69. }
  70. .report a:hover {
  71. color: #fff;
  72. }
  73. .scale-out {
  74. cursor: pointer;
  75. -webkit-animation: scaleout 1.3s infinite ease-in-out;
  76. animation: scaleout 1.3s infinite ease-in-out;
  77. }
  78. .media-box .body-content {
  79. display: flex;
  80. justify-content: center;
  81. }
  82. #video {
  83. width: 100%;
  84. }
  85. </style>
  86. @if (play.PlayState == CampPlayStateDefinition.New)
  87. {
  88. <div class="show-title">演练未开始</div>
  89. }
  90. else if (play.PlayState != CampPlayStateDefinition.Run)
  91. {
  92. <div class="show-title">演练已结束</div>
  93. <div class="report">
  94. <a href="@Url.Action("Report","Play")/@(play.Id)">演练报告</a>
  95. </div>
  96. }
  97. else
  98. {
  99. CampPlayUserDto playUser = campPlay.PlayUser;
  100. CampDto camp = campPlay.Camp;
  101. string roles = "";
  102. roleArr = play.PlayRoleNames.Split(',');
  103. foreach (var role in roleArr)
  104. {
  105. roles += "<span class=\" role label label-info\" onclick=\"ChangeRole('" + role + "')\">" + role + "</span>";
  106. }
  107. <div class="main-box">
  108. <div class="main-box-header">
  109. <div class="user-name"><i class="iconfont icon-user-circle"></i>&nbsp;&nbsp;@(playUser.PlayerName)</div>
  110. <ul class="menu">
  111. <li>
  112. <a href="@Url.Action("Index","Play")"><i class="iconfont icon-home"></i>&nbsp;&nbsp;返回主页</a>
  113. </li>
  114. <li>
  115. <a href="javascript:void(0)" onclick="Exit()"><i class="iconfont icon-backspace"></i>&nbsp;&nbsp;退出演练</a>
  116. </li>
  117. <li>
  118. <a href="javascript:void(0)" onclick="LoginOut()"><i class="iconfont icon-poweroff"></i>&nbsp;&nbsp;注销账号</a>
  119. </li>
  120. </ul>
  121. </div>
  122. <div class="main-box-content">
  123. <div class="box" style="width: 35%">
  124. <div class="box-header">情景播放区</div>
  125. <div class="box-content scene-info-box">
  126. <div class="box small" style="height: calc(100% - var(--sh))">
  127. <div class="box-header" style="margin-left: -40px;">情景区</div>
  128. <div class="box-content scroll">
  129. <div id="scene-info-box">
  130. </div>
  131. </div>
  132. </div>
  133. <div class="box small" style="height:var(--sh);margin-top: calc(var(--mh)*2)">
  134. <div class="box-header" style="margin-left: -40px;">播放区</div>
  135. <div class="box-content">
  136. <div class="media-box scroll">
  137. <div class="body-content">
  138. </div>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. <div class="box" style="width: 35%">
  145. <div class="box-header">指挥决策区</div>
  146. <div class="box-content log-cmd-box">
  147. <div class="box small" style="height: calc(100% - var(--sh))">
  148. <div class="box-header" style="margin-left: -70px;">决策指挥中心</div>
  149. <div id="current-scene-box" style="">
  150. <span class="name">当前情景:</span>
  151. <input type="hidden" id="scene-path" value="" />
  152. <span class="scene-name">无</span>
  153. </div>
  154. <div class="box-content scroll">
  155. <div id="log-info-box">
  156. </div>
  157. </div>
  158. </div>
  159. <div class="box small" style="height:var(--sh);margin-top: calc(var(--mh)*2)">
  160. <div class="box-header" style="margin-left: -40px;">指令输入</div>
  161. <div class="box-content cmd-box">
  162. <div class="tool-box">
  163. <div class="role-change-box">
  164. @Html.Raw(roles)
  165. </div>
  166. <span id="self-role" class="btn btn-iwb btn-sm role" style="margin-left: 15px;" title="点击切换角色" onclick="ChangeRole('@(playUser.Role)', 1)">@(playUser.Role)</span>
  167. @if (play.PlayModel == CampPlayModelDefinition.Team)
  168. {
  169. <span id="chat-modal-btn" class="btn btn-success btn-sm" style="float: right; width: 100px; margin-right: 15px;" onclick="ChatModal()"><i class="fas fa-comments"></i>&nbsp;&nbsp;讨论区</span>
  170. <div class="card direct-chat direct-chat-primary" style="position: absolute; width: calc(100% - 25px); top: -400px; z-index: 1000; color: #111; background: #f5f5ec; display: none">
  171. <div class="card-header">
  172. <h3 class="card-title" style="font-weight: 600"><i class="fas fa-comments"></i>&nbsp;&nbsp;讨论区</h3>
  173. <div class="card-tools">
  174. <button type="button" class="btn btn-tool" data-card-widget="remove" onclick="chatFlag = true">
  175. <i class="fas fa-times"></i>
  176. </button>
  177. </div>
  178. </div>
  179. <div class="card-body scroll" style="height: 250px;">
  180. <div class="direct-chat-messages" id="chat-box" style="height: 100%; overflow: unset;">
  181. </div>
  182. </div>
  183. <div class="card-footer">
  184. <div class="input-group">
  185. <input type="text" id="message" name="message" placeholder="请输入..." class="form-control">
  186. <span class="input-group-append">
  187. <button type="button" onclick="SendChat()" class="btn btn-primary">发送</button>
  188. </span>
  189. </div>
  190. </div>
  191. </div>
  192. }
  193. @if (playUser.PlayerType == CampPlayerTypeDefinition.Creator || play.PlayModel != CampPlayModelDefinition.Team)
  194. {
  195. <span class="btn btn-danger btn-sm" style="float: right; margin-right: 25px; transform: scale(0.9);" onclick="NextNode()"><i class="iconfont icon-paper-plane"></i>&nbsp;&nbsp;下一阶段情景</span>
  196. }
  197. </div>
  198. <div class="msg-box">
  199. <textarea id="cmd-text" class="form-control" rows="3" placeholder="请输入指令"></textarea>
  200. <span class="btn btn-iwb btn-sm" onclick="Submit(@(playUser.PlayerType))"><i class="iconfont icon-display-arrow-right"></i>&nbsp;&nbsp;提交指令</span>
  201. </div>
  202. @*@if (playUser.PlayerType == CampPlayerTypeDefinition.Creator || play.PlayModel != CampPlayModelDefinition.Team)
  203. {
  204. <div class="tool-footer">
  205. <span class="btn btn-danger btn-sm" onclick="NextNode()">下一阶段情景</span>
  206. $1$<span class="btn btn-danger btn-sm" onclick="NextRound()">下一轮次情景</span>#1#
  207. </div>
  208. }*@
  209. </div>
  210. </div>
  211. </div>
  212. </div>
  213. <div class="box" style="width: 30%">
  214. <div class="box-header">演练基本信息区</div>
  215. <div class="box-content base-box">
  216. <div class="box small base-info-box" style="height:var(--sh)">
  217. <div class="box-header" style="margin-left: -40px;">基本信息</div>
  218. <div class="box-content scroll">
  219. <dl>
  220. <dt>演练名称:</dt>
  221. <dd>@(play.Name)</dd>
  222. </dl>
  223. <dl>
  224. <dt>演练时长:</dt>
  225. <dd>@(camp.MaxTrainingMinute) 分钟</dd>
  226. </dl>
  227. <dl>
  228. <dt>演练角色:</dt>
  229. <dd>
  230. @(Html.Raw(roles))
  231. <p class="role-help">点击角色可以切换发布指令的角色</p>
  232. </dd>
  233. </dl>
  234. <dl>
  235. <dt>演练目标:</dt>
  236. <dd>@(camp.Purposes) </dd>
  237. </dl>
  238. </div>
  239. <div id="count-down"></div>
  240. </div>
  241. <div class="box small score-info-box" style="height: 150px;margin-top: calc(var(--mh)*2)">
  242. <div class="box-header" style="margin-left: -40px;">评估信息</div>
  243. <div class="box-content scroll">
  244. <div id="score-info-box" style="height: 100%;"></div>
  245. </div>
  246. </div>
  247. <div class="box small scene-path-box" style="height: calc(100% - var(--sh) - 150px - var(--mh)*2);margin-top: calc(var(--mh)*2)">
  248. <div class="box-header" style="margin-left: -40px;">推演路径</div>
  249. <div class="box-content scroll">
  250. <div id="scene-path-box" style="height: 100%;"></div>
  251. </div>
  252. </div>
  253. </div>
  254. </div>
  255. </div>
  256. </div>
  257. <div id="media-box-hide" style="display: none"></div>
  258. @section scripts
  259. {
  260. <script src="~/Content/Js/scene-path.js"></script>
  261. <script src="~/Content/Libs/countdown/countdown.js">
  262. </script>
  263. <script>
  264. var chatFlag = true, startFlag = true;
  265. $(function() {
  266. OverlayScrollbar($('#scene-info-box').closest('.scroll'), { className: "os-theme-thin-light" });
  267. abp.signalr.connect(function() {
  268. window.iwbHub.server.registerGroup('@(play.InvitationCode)').done(function() {
  269. abp.log.debug('@(play.InvitationCode) Group Registered to the SignalR server!');
  270. });
  271. setTimeout(function() {
  272. $.iwbAjax5({
  273. url: abp.appUrl + "/CampPlay/StartFeedback?no=@(play.Id)",
  274. success: function(res) {
  275. startFlag = res;
  276. if (startFlag) {
  277. GetScenes();
  278. }
  279. }
  280. });
  281. },
  282. 100);
  283. //GetScenes();
  284. //GetLogs()//情景加载成功后再加载日志;
  285. ScenePath();
  286. GetChat();
  287. GetScore();
  288. //setTimeout(function () {
  289. //}, 1000 * 3);
  290. });
  291. $('#message').on('keypress',
  292. function(event) {
  293. if (event.keyCode == "13") {
  294. SendChat();
  295. return false;
  296. }
  297. return true;
  298. });
  299. $('#cmd-text').on('keypress',
  300. function(event) {
  301. if (event.keyCode == "13") {
  302. Submit(@(playUser.PlayerType));
  303. return false;
  304. }
  305. return true;
  306. });
  307. OverlayScrollbar($('#log-info-box').closest('.scroll'), { className: "os-theme-thin-light" });
  308. OverlayScrollbar($('.base-info-box .scroll'), { className: "os-theme-thin-light" });
  309. OverlayScrollbar($('#score-info-box').closest('.scroll'), { className: "os-theme-thin-light" });
  310. @{
  311. var date = (play.StartDate ?? Clock.Now).AddMinutes((double) camp.MaxTrainingMinute).ToString("yyyy-MM-dd HH:mm:ss");
  312. }
  313. var countdown = new Countdown({
  314. selector: '#count-down',
  315. dateEnd: new Date('@(date)'),
  316. msgPattern: '{hours}:{minutes}:{seconds}',
  317. msgBefore: "演练未开始",
  318. msgAfter: "演练结束"
  319. });
  320. console.log(countdown);
  321. });
  322. function Scroll2Bottom(that) {
  323. var instance = window.OverlayScrollbars($(that)[0]);
  324. if (instance) {
  325. try {
  326. instance.scroll({ y: "100%" });
  327. } catch (e) {
  328. }
  329. }
  330. }
  331. function ChatModal() {
  332. chatFlag = false;
  333. $('#chat-box').closest('.card').show();
  334. $('#chat-modal-btn').removeClass('flash');
  335. OverlayScrollbar($('#chat-box').closest('.scroll'), { className: "os-theme-thin-dark" });
  336. Scroll2Bottom($('#chat-box').closest('.scroll'));
  337. $('#message').focus();
  338. }
  339. function Exit() {
  340. MsgConfirm("退出后无法再加入演练,您确定退出演练吗?",
  341. "退出演练",
  342. function() {
  343. @if (playUser.PlayerType == CampPlayerTypeDefinition.Creator)
  344. {
  345. <text>
  346. MsgConfirm("您是房主,退出后演练就会结束,确定退出吗?",
  347. "再次确认",
  348. function() {
  349. $.iwbAjax({
  350. url: abp.appUrl + '/CampPlay/ExitPlay?no=@(play.Id)',
  351. success: function() {
  352. window.location.href = "@Url.Action("Start", "Play")";
  353. }
  354. });
  355. });
  356. </text>
  357. }
  358. else
  359. {
  360. <text>
  361. $.iwbAjax({
  362. url: abp.appUrl + '/CampPlay/ExitPlay?no=@(play.Id)',
  363. success: function() {
  364. window.location.href = "@Url.Action("Start", "Play")";
  365. }
  366. });
  367. </text>
  368. }
  369. });
  370. }
  371. function LoginOut() {
  372. MsgConfirm("您确定注销账号吗?",
  373. "注销账号",
  374. function() {
  375. @if (playUser.PlayerType == CampPlayerTypeDefinition.Creator)
  376. {
  377. <text>
  378. MsgConfirm("您是房主,注销后演练进程无法继续,注销退出吗?",
  379. "再次确认",
  380. function() {
  381. window.location.href = "/Account/LogOut";
  382. });
  383. </text>
  384. }
  385. else
  386. {
  387. <text>
  388. window.location.href = "/Account/LogOut";
  389. </text>
  390. }
  391. });
  392. }
  393. </script>
  394. <script id="scene-script">
  395. function GetScenes() {
  396. $.iwbAjax5({
  397. url: abp.appUrl + 'Query/GetPlayScenes?no=@(play.Id)',
  398. success: function(res) {
  399. if (res) {
  400. FormatterScenes(res);
  401. GetLogs();
  402. }
  403. }
  404. });
  405. }
  406. var roundPath = "P_R", round = 1, round2 = 1;
  407. function FormatterScenes(data) {
  408. var str = "";
  409. if (data && data.length > 0) {
  410. data.forEach(function(v) {
  411. str += FormatterSceneInfo(v, !v.hasEnd);
  412. });
  413. }
  414. if (str) {
  415. $('#scene-info-box').find(".new-scene").removeClass('new-scene');
  416. $('#scene-info-box').html(str);
  417. var t = $('#scene-info-box').data('t');
  418. clearTimeout(t);
  419. t = setTimeout(function() {
  420. $('#scene-info-box').find(".flash-scene").removeClass("flash-scene");
  421. },
  422. 1000 * 3);
  423. $('#scene-info-box').data('t', t);
  424. Scroll2Bottom($('#scene-info-box').closest('.scroll'));
  425. if (!$('#current-scene-box #scene-path').val()) {
  426. SelectScene();
  427. }
  428. }
  429. }
  430. function GetSceneInfo(sceneNo) {
  431. $.iwbAjax4({
  432. url: abp.appUrl + 'Query/GetPlaySceneInfo?no=@(play.Id)&scenePath=' + sceneNo,
  433. success: function(res) {
  434. if (res) {
  435. DisabledScene2();
  436. var str = FormatterSceneInfo(res, true);
  437. if (str) {
  438. $('#scene-info-box').append(str);
  439. var t = $('#scene-info-box').data('t');
  440. clearTimeout(t);
  441. t = setTimeout(function() {
  442. $('#scene-info-box').find(".flash-scene").removeClass("flash-scene");
  443. },
  444. 1000 * 3);
  445. $('#scene-info-box').data('t', t);
  446. AutoPlay($('#scene-info-box'));
  447. Scroll2Bottom($('#scene-info-box').closest('.scroll'));
  448. if (!$('#current-scene-box #scene-path').val()) {
  449. SelectScene();
  450. }
  451. }
  452. if (!startFlag) {
  453. startFlag = true;
  454. GetLogs();
  455. }
  456. } else {
  457. setTimeout(function() { GetSceneInfo(sceneNo); }, 5000);
  458. }
  459. }
  460. });
  461. }
  462. function FormatterSceneInfo(data, isNew) {
  463. var str = "";
  464. if (data) {
  465. if ($('.scene-box[data-path="' + data.path + '"]').length > 0) {
  466. return str;
  467. }
  468. if (data.path.toUpperCase().indexOf(roundPath + "" + round) == 0 && round2 == round) {
  469. str += '<div class="round-box">第&nbsp;{0}&nbsp;轮</div>'.format(round);
  470. round++;
  471. round2++;
  472. }
  473. var c = isNew ? "flash-scene new-scene new-scene2" : "", attachStr = '';
  474. if (data.attaches && data.attaches.length > 0) {
  475. var template =
  476. '<span class="badge badge-{3} attach attach-{0}" data-attach-type="{0}" data-path="{1}" style="margin-left:10px;cursor: pointer;padding:6px 10px" onclick="EventAttach(this)">{2}</span>';
  477. for (var i = 0; i < data.attaches.length; i++) {
  478. var item = data.attaches[i];
  479. if (item.fileType) {
  480. if (item.fileType === "image") {
  481. attachStr += template.format(item.fileType, item.filePath, '图片', 'success');
  482. } else if (item.fileType === "video") {
  483. attachStr += template.format(item.fileType, item.filePath, '视频', 'danger');
  484. }
  485. }
  486. }
  487. }
  488. var str1 = '';
  489. @if (playUser.PlayerType == CampPlayerTypeDefinition.Creator || play.PlayModel != CampPlayModelDefinition.Team)
  490. {
  491. <text>
  492. str1 = data.hasEnd ? '' : 'title="点击处理此情景" onclick="SelectScene(this)"';
  493. </text>
  494. }
  495. var str2 = '', str3 = '', descShow = '';
  496. if (data.hasEnd) {
  497. str2 = '<span class="label label-info">已处理</span>';
  498. str3 =
  499. '<div class="tool close" onclick="ToggleDesc(this)"><i class="iconfont icon-plus"></i></div>';
  500. descShow = 'none';
  501. } else {
  502. str2 = '<span class="label label-danger no-scene">未处理</span>';
  503. str3 =
  504. '<div class="tool open" onclick="ToggleDesc(this)"><i class="iconfont icon-minus"></i></div>';
  505. descShow = 'block';
  506. }
  507. var guideIcon = '', guideStr = '';
  508. if (data.guideInfos && data.guideInfos.length) {
  509. guideIcon =
  510. '<i class="iconfont icon-question-circle" style="padding-left:10px;color:red;" title="查看引导信息" onclick="ToggleGuide(this)"></i>';
  511. guideStr += '<div class="guide-box" style="display:none"><div class="guide-title">提示:</div>';
  512. var i = 0;
  513. data.guideInfos.forEach(function(v) {
  514. i++;
  515. guideStr += '<div class="guide-info">{0}、{1}</div>'.format(i, v.description);
  516. });
  517. guideStr += '</div>';
  518. }
  519. str += '<div class="scene-box {2}" data-id="{0}" data-name="{1}" data-path="{3}" {4}>'.format(
  520. data.id,
  521. data.name,
  522. c,
  523. data.path,
  524. str1);
  525. str += '<div class="title">';
  526. str += str2;
  527. str += '<span class="name">{0} {1}</span>'.format(data.name, guideIcon);
  528. str += '<div class="attach-box">{0}</div>'.format(attachStr);
  529. str += str3;
  530. str += '</div>';
  531. str += '<div class="desc" style="display:{0};">{1} {2}</div>'.format(descShow,
  532. data.description,
  533. guideStr);;
  534. str += '</div>';
  535. }
  536. return str;
  537. }
  538. function ToggleGuide(that) {
  539. var $that = $(that);
  540. if ($that.hasClass('open')) {
  541. $that.removeClass('open');
  542. $that.closest('.scene-box').find('.guide-box').fadeOut(400);
  543. } else {
  544. $that.addClass('open');
  545. $that.closest('.scene-box').find('.guide-box').fadeIn(600);
  546. var $tool = $that.closest('.scene-box').find('.tool');
  547. if (!$tool.hasClass('open')) {
  548. $tool.addClass('open').html('<i class="iconfont icon-minus"></i>');
  549. $tool.closest('.scene-box').find('.desc').fadeIn(600);
  550. }
  551. }
  552. Scroll2Bottom($('#scene-info-box').closest('.scroll'));
  553. }
  554. function ToggleDesc(that) {
  555. var $that = $(that);
  556. if ($that.hasClass('open')) {
  557. $that.removeClass('open').html('<i class="iconfont icon-plus"></i>');
  558. $that.closest('.scene-box').find('.desc').fadeOut(400);
  559. } else {
  560. $that.addClass('open').html('<i class="iconfont icon-minus"></i>');
  561. $that.closest('.scene-box').find('.desc').fadeIn(600);
  562. }
  563. Scroll2Bottom($('#scene-info-box').closest('.scroll'));
  564. }
  565. function DisabledScene1() {
  566. var $that = $('.no-scene').closest('.scene-box');
  567. if ($that.hasClass('new-scene2')) {
  568. $that.attr('onclick', '');
  569. $that.removeClass('new-scene2').addClass("old-scene");
  570. }
  571. }
  572. function DisabledScene2() {
  573. var $that = $('.no-scene').closest('.scene-box');
  574. if ($that.hasClass('old-scene')) {
  575. $that.attr('onclick', '');
  576. $that.removeClass('old-scene');
  577. $that.find('.tool.open').trigger('click');
  578. $that.find('.no-scene').text('已处理').removeClass('label-danger').removeClass('no-scene')
  579. .addClass('label-info');
  580. }
  581. $('#scene-info-box .active').removeClass('active');
  582. $('#current-scene-box #scene-path').val('');
  583. $('#current-scene-box .scene-name').text('无');
  584. }
  585. var imageTemplate = '<img src="{0}" style="width: 100%;height: 100%;" />',
  586. videoTemplate =
  587. '<video id="video" style="" controls autoplay><source src="{0}" type="video/mp4">您的浏览器不支持 HTML5 video 标签。</video>',
  588. audioTemplate =
  589. '<audio id="video" style="" controls autoplay><source src="{0}" type="audio/mp3">您的浏览器不支持 HTML5 audio 标签。</audio>';
  590. var at;
  591. function EventAttach(that, event) {
  592. var type = $(that).data('attach-type');
  593. var path = $(that).data('path');
  594. if (type) {
  595. var str = type === "image"
  596. ? imageTemplate.format(path)
  597. : type === "video"
  598. ? videoTemplate.format(path)
  599. : type === "audio"
  600. ? audioTemplate.format(path)
  601. : '';
  602. $(that).closest(".main-box-content").find(".media-box .body-content").html(str);
  603. $(that).closest(".box").find(".current-scene").removeClass("current-scene");
  604. $(that).closest(".scene-box").addClass("current-scene");
  605. event = event || function() { InitMedia($(that)) };
  606. var video = document.getElementById("video");
  607. if (video) {
  608. video.loop = false;
  609. video.addEventListener('ended',
  610. function() { setTimeout(function() { event.call(that); }, 1000 * 3) },
  611. false);
  612. } else {
  613. clearTimeout(at);
  614. at = setTimeout(function() { event.call(that); }, 1000 * 10);
  615. }
  616. }
  617. }
  618. function AutoPlay($box, $that, isForce) {
  619. if (!isForce && $box.data("auto-play")) {
  620. return;
  621. }
  622. $box.data("auto-play", true);
  623. $that = $that === undefined ? $box.find('.new-scene').eq(0).removeClass('new-scene') : $that;
  624. var $attach = $that.find('.attach');
  625. if ($attach.length <= 0) {
  626. var $next = $box.find('.new-scene').eq(0).removeClass('new-scene');
  627. if ($next.length > 0) {
  628. AutoPlay($box, $next, true);
  629. } else {
  630. $box.data("auto-play", false);
  631. InitMedia($box.find('.current-scene'));
  632. }
  633. } else {
  634. if (!$that) {
  635. return;
  636. }
  637. $attach = $that.find('.attach').first();
  638. EventAttach($attach, function() { AutoPlay($box, $that, true); });
  639. $attach.removeClass('attach');
  640. }
  641. }
  642. function InitMedia(that) {
  643. var $that = (that).closest(".box");
  644. $that.find(".current-scene").removeClass("current-scene");
  645. $that.find(".media-box .body-content").html('');
  646. }
  647. function SelectScene(that) {
  648. var $that = that ? $(that) : $('#scene-info-box .new-scene2').eq(0);
  649. $('#scene-info-box .active').removeClass('active');
  650. $that.addClass('active');
  651. var name = $that.data('name'), path = $that.data('path');
  652. $('#current-scene-box #scene-path').val(path);
  653. $('#current-scene-box .scene-name').text(name);
  654. window.iwbHub.server.sendCurrentScenePath('@play.InvitationCode', path, name);
  655. console.log(name, path);
  656. }
  657. </script>
  658. <script id="log-script">
  659. function GetLogs() {
  660. $.iwbAjax5({
  661. url: abp.appUrl + 'Query/GetPlayLogs?no=@(play.Id)',
  662. success: function(res) {
  663. if (res) {
  664. FormatterLog(res);
  665. }
  666. }
  667. });
  668. }
  669. function FormatterLog(data) {
  670. var str = "";
  671. if (data && data.length > 0) {
  672. data.forEach(function(v) {
  673. str += FormatLog(v);
  674. });
  675. }
  676. if (str) {
  677. $('#log-info-box').html(str);
  678. }
  679. }
  680. function FormatLog(data) {
  681. var str = '';
  682. if (data) {
  683. var c;
  684. var sceneName = GetSceneNameByPath(data.scenePath);
  685. if (data.logState == '@(LogStateDefinition.New)') {
  686. @{
  687. var disabled = playUser.PlayerType == CampPlayerTypeDefinition.Creator ? "" : "disabled";
  688. }
  689. c =
  690. '<button type="button" id="log_{0}" class="btn btn-sm btn-iwb log-state log-wait" onclick="SubmitCmd({0})" @(disabled)>等待下达</button>'
  691. .format(data.id);
  692. } else if (data.logState == '@(LogStateDefinition.Submit)' ||
  693. data.logState == '@(LogStateDefinition.Send)' ||
  694. data.logState == '@(LogStateDefinition.HasMatch)') {
  695. c =
  696. '<button type="button" id="log_{0}" class="btn btn-sm btn-success log-state" disabled>已下达</button>'
  697. .format(data.id);
  698. } else {
  699. c =
  700. '<button type="button" id="log_{0}" class="btn btn-sm btn-danger log-state" disabled>未下达</button>'
  701. .format(data.id);
  702. }
  703. var imagePath = data.imagePath ? data.imagePath : '/Content/Image/user.png';
  704. str += '<div class="log-comment" id="log__{0}">'.format(data.id);;
  705. str += '<img src="{0}" alt="{1}">'.format(imagePath, data.role + "(" + data.name + ")");
  706. str += '<div class="comment-text">';
  707. str +=
  708. '<span class="name">{0}{1}<small style="font-style:italic;padding-left: 10px;">{2}</small></span>'
  709. .format(data.role + "(" + data.name + ")",
  710. c,
  711. sceneName);
  712. str += '<span class="log-text">{0}</span>'.format(data.word);
  713. str += '</div>';
  714. str += '</div>';
  715. }
  716. return str;
  717. }
  718. function GetSceneNameByPath(path) {
  719. var sceneName = '', $sceneBox = $('.scene-box[data-path="' + path + '"]');
  720. if ($sceneBox.length > 0) {
  721. sceneName = $sceneBox.data("name");
  722. }
  723. return sceneName;
  724. }
  725. function DisabledLog() {
  726. $('.log-wait').prop('disabled', true).text('未下达').removeClass('log-wait');
  727. }
  728. </script>
  729. <script id="cmd-script">
  730. function Submit(type) {
  731. var text = $('#cmd-text').val().trim(),
  732. role = $('#self-role').text(),
  733. path = $('#current-scene-box #scene-path').val();
  734. if (!text) {
  735. abp.message.warn("指令不能为空!");
  736. return;
  737. }
  738. var url = abp.appUrl + "/CampPlay/WriteCmdLog";
  739. if (type == @(CampPlayerTypeDefinition.Creator)) {
  740. if (!path) {
  741. abp.message.warn("请选择一个情景!");
  742. return;
  743. }
  744. if (@(roleArr.Length) > 0 && role == "@(playUser.Role)") {
  745. abp.message.warn("请选择一个角色!");
  746. return;
  747. }
  748. url = abp.appUrl + "/CampPlay/WriteSubmitCmdLog";
  749. }
  750. $.iwbAjax4({
  751. url: url,
  752. data: { GroupNo: '@(play.Id)', BehaviorWord: text, BehaviorRole: role, scenePath: path },
  753. success: function() {
  754. $('#cmd-text').val('').focus();
  755. }
  756. });
  757. }
  758. function SubmitCmd(id) {
  759. var path = $('#current-scene-box #scene-path').val();
  760. if (path) {
  761. $.iwbAjax4({
  762. url: abp.appUrl + "/CampPlay/SubmitCmd?id=" + id + "&scenePath=" + path,
  763. success: function() {
  764. }
  765. });
  766. } else {
  767. abp.message.warn("请选择一个情景!");
  768. }
  769. }
  770. function NextNode() {
  771. MsgConfirm("确认本阶段情景已处理完,进入下一阶段的情景吗?",
  772. "下一阶段情景",
  773. function() {
  774. $.iwbAjax4({
  775. url: abp.appUrl + "/CampPlay/NextFlowNode",
  776. data: { Id: '@(play.Id)' },
  777. success: function() {
  778. abp.ui.setBusy($('body'));
  779. setTimeout(function() {
  780. abp.ui.clearBusy($('body'));
  781. },
  782. 10000);
  783. }
  784. });
  785. });
  786. }
  787. function NextRound() {
  788. MsgConfirm("确认本阶段情景已处理完,进入下一阶段的情景吗?",
  789. "下一阶段情景",
  790. function() {
  791. $.iwbAjax1({
  792. url: abp.appUrl + "/CampPlay/NextRound",
  793. data: { Id: '@(play.Id)' },
  794. success: function() {
  795. }
  796. });
  797. });
  798. }
  799. function ChangeRole(role, type) {
  800. if (type) {
  801. $('.role-change-box').fadeIn(600);
  802. //$('#self-role').html(role).removeClass('btn-danger').addClass('btn-iwb');
  803. } else {
  804. $('#self-role').html(role).removeClass('btn-iwb').addClass('btn-danger');
  805. $('.role-change-box').fadeOut(300);
  806. }
  807. }
  808. </script>
  809. <script id="path-script">
  810. function ScenePath() {
  811. $.iwbAjax5({
  812. url: abp.appUrl + 'Query/GetPlayRunningInfo?no=@(play.Id)',
  813. success: function(res) {
  814. var str = FormatterSingleScenePath(res);
  815. $('#scene-path-box').html(str);
  816. OverlayScrollbar($('#scene-path-box').closest('.scroll'), { className: "os-theme-thin-light" });
  817. Scroll2Bottom($('#scene-path-box').closest('.scroll'));
  818. }
  819. });
  820. }
  821. </script>
  822. <script id="chat-script">
  823. function SendChat() {
  824. var text = $('#message').val();
  825. if (!text) {
  826. return;
  827. }
  828. $.iwbAjax4({
  829. url: abp.appUrl + "/CampPlay/Chat",
  830. data: { Id: '@(play.Id)', Msg: text },
  831. success: function() {
  832. $('#message').val('').focus();
  833. }
  834. });
  835. }
  836. function GetChat() {
  837. $.iwbAjax5({
  838. url: abp.appUrl + 'Query/GetPlayChats?no=@(play.Id)',
  839. success: function(res) {
  840. if (res) {
  841. FormatterChat(res);
  842. }
  843. }
  844. });
  845. }
  846. function FormatterChat(data) {
  847. var str = "";
  848. if (data && data.length > 0) {
  849. data.forEach(function(v) {
  850. str += FormatChat(v);
  851. });
  852. }
  853. if (str) {
  854. $('#chat-box').html(str);
  855. Scroll2Bottom($('#chat-box').closest('.scroll'));
  856. }
  857. }
  858. function FormatChat(data) {
  859. var str = '';
  860. if (data) {
  861. var imagePath = data.imagePath ? data.imagePath : '/Content/Image/user.png';
  862. var isSelf = '', left = 'left', right = 'right';
  863. if (data.userName === '@(AbpSession.UserName)') {
  864. isSelf = "right";
  865. left = 'right';
  866. right = 'left';
  867. }
  868. str += '<div class="direct-chat-msg {0}">'.format(isSelf);
  869. str += '<div class="direct-chat-infos clearfix">';
  870. str += '<span class="direct-chat-name float-{0}">{1}</span>'
  871. .format(left, data.name); //+"("+data.userName+")");
  872. str += '<span class="direct-chat-timestamp float-{0}">{1}</span>'.format(right,
  873. new Date(data.logDate).format('hh:mm:ss'));
  874. str += '</div>';
  875. str += '<img class="direct-chat-img" src="{0}" alt="{1}">'.format(imagePath, data.name);;
  876. str += '<div class="direct-chat-text">{0}</div>'.format(data.word);
  877. str += '</div>';
  878. }
  879. return str;
  880. }
  881. </script>
  882. <script id="score-script">
  883. function GetScore() {
  884. $.iwbAjax5({
  885. url: abp.appUrl + 'Query/GetPlayScoreInfo?no=@(play.Id)',
  886. success: function(res) {
  887. if (res) {
  888. FormatterScore(res);
  889. }
  890. }
  891. });
  892. }
  893. function FormatterScore(data) {
  894. var str = "",
  895. template =
  896. '<div class="score-box {2}"><span class="name">{0}</span><span style="padding:0 5px;">:</span><span class="score">{1}</span><span style="padding-left: 5px;">分</span></div>';
  897. if (data.systemScore) {
  898. str += template.format("第 {0} 轮 系统评分".format(data.roundIndex), data.systemScore, "system-score");
  899. }
  900. var tags = data.behaviorTagScoreInfo ? JSON.parse(data.behaviorTagScoreInfo) : data.tagScores;
  901. if (tags && tags.length > 0) {
  902. tags.forEach(function(v) {
  903. var score = v.correctionScore ? v.correctionScore : v.systemScore;
  904. str += template.format(v.tagNo, score, "tag-score");
  905. });
  906. }
  907. if (str) {
  908. $('#score-info-box').html(str);
  909. }
  910. }
  911. </script>
  912. <script id="hub-s">
  913. iwbHub.client.getChat = function(msg) {
  914. console.log('getChat: ', msg);
  915. if (msg) {
  916. try {
  917. var data = JSON.parse(msg);
  918. if (data.no == '@(play.Id)') {
  919. var str = FormatChat(data);
  920. if (str) {
  921. $('#chat-box').append(str);
  922. Scroll2Bottom($('#chat-box').closest('.scroll'));
  923. if (chatFlag) {
  924. $('#chat-modal-btn').addClass('flash');
  925. }
  926. }
  927. }
  928. } catch (e) {
  929. console.log('getChat: ', e);
  930. }
  931. }
  932. };
  933. iwbHub.client.getCmdLog = function(msg) {
  934. console.log('getCmdLog: ', msg);
  935. if (msg) {
  936. try {
  937. var data = JSON.parse(msg);
  938. if (data.no == '@(play.Id)') {
  939. var str = FormatLog(data);
  940. if (str) {
  941. $('#log-info-box').prepend(str);
  942. }
  943. }
  944. } catch (e) {
  945. console.log('getCmdLog: ', e);
  946. }
  947. }
  948. };
  949. iwbHub.client.getCmdLogSubmit = function(msg) {
  950. console.log('getCmdLogSubmit: ', msg);
  951. if (msg) {
  952. try {
  953. var data = JSON.parse(msg);
  954. if (data.no == '@(play.Id)') {
  955. $('#log-info-box').find('#log_' + data.logId).html('已下达').removeClass('btn-iwb')
  956. .removeClass('log-wait').addClass('btn-success').prop('disabled', true)
  957. .closest('.name')
  958. .find('small').html(GetSceneNameByPath(data.scenePath));
  959. }
  960. } catch (e) {
  961. console.log('getCmdLogSubmit: ', e);
  962. }
  963. }
  964. };
  965. iwbHub.client.getNewScene = function(msg) {
  966. console.log('getNewScene: ', msg);
  967. abp.ui.clearBusy($('body'));
  968. if (msg) {
  969. try {
  970. var data = typeof msg == 'string' ? JSON.parse(msg) : msg;
  971. if (data) {
  972. if (data.no == '@(play.Id)') {
  973. //$('#scene-info-box').find(".new-scene").each(function() {
  974. // $(this).removeClass('new-scene');
  975. //});
  976. if ($('#scene-info-box').find('.scene-box[data-path="' + data.path + '"]').length <=
  977. 0) {
  978. GetSceneInfo(data.sceneNo);
  979. Scroll2Bottom($('#scene-info-box').closest('.scroll'));
  980. }
  981. }
  982. }
  983. } catch (e) {
  984. console.log('getNewScene: ', e);
  985. }
  986. }
  987. };
  988. iwbHub.client.getRoundScore = function(msg) {
  989. console.log('getRoundScore: ', msg);
  990. if (msg) {
  991. try {
  992. var data = JSON.parse(msg);
  993. if (data.no == '@(play.Id)') {
  994. FormatterScore(data);
  995. };
  996. } catch (e) {
  997. console.log('getRoundScore: ', e);
  998. }
  999. }
  1000. };
  1001. iwbHub.client.getRunningChange = function(msg) {
  1002. console.log('getRunningChange: ', msg);
  1003. if (msg) {
  1004. try {
  1005. var data = JSON.parse(msg);
  1006. if (data) {
  1007. ScenePath();
  1008. }
  1009. } catch (e) {
  1010. console.log('getRunningChange: ', e);
  1011. }
  1012. }
  1013. };
  1014. iwbHub.client.getDisabledLog = function(msg) {
  1015. console.log('getDisabledLog: ', msg);
  1016. if (msg) {
  1017. try {
  1018. var data = JSON.parse(msg);
  1019. if (data.no == '@play.Id') {
  1020. $('#log-info-box').prepend('<div class="log-comment split-line"></div>');
  1021. DisabledLog();
  1022. DisabledScene1();
  1023. }
  1024. } catch (e) {
  1025. console.log('getDisabledLog: ', e);
  1026. }
  1027. }
  1028. }
  1029. iwbHub.client.getUserExit = function(msg) {
  1030. console.log('getUserExit: ', msg);
  1031. if (msg) {
  1032. try {
  1033. var data = JSON.parse(msg);
  1034. if (data) {
  1035. }
  1036. } catch (e) {
  1037. console.log('getUserExit: ', e);
  1038. }
  1039. }
  1040. };
  1041. @if (playUser.PlayerType != CampPlayerTypeDefinition.Creator)
  1042. {
  1043. <text>
  1044. iwbHub.client.getCurrentScenePath = function(msg) {
  1045. console.log('getCurrentScenePath: ', msg);
  1046. if (msg) {
  1047. try {
  1048. var data = JSON.parse(msg);
  1049. if (data) {
  1050. $('#current-scene-box #scene-path').val(data.path);
  1051. $('#current-scene-box .scene-name').text(data.name);
  1052. }
  1053. } catch (e) {
  1054. console.log('getCurrentScenePath: ', e);
  1055. }
  1056. }
  1057. }
  1058. </text>
  1059. }
  1060. iwbHub.client.getReloadPage = function(msg) {
  1061. console.log('getReloadPage: ', msg);
  1062. if (msg) {
  1063. try {
  1064. var data = JSON.parse(msg);
  1065. if (data.no == '@(play.Id)') {
  1066. window.location.reload();
  1067. }
  1068. } catch (e) {
  1069. console.log('getReloadPage: ', e);
  1070. }
  1071. }
  1072. };
  1073. iwbHub.client.getGuide = function(msg) {
  1074. console.log('getGuide: ', msg);
  1075. if (msg) {
  1076. try {
  1077. var data = JSON.parse(msg);
  1078. if (!data) {
  1079. return;
  1080. }
  1081. } catch (e) {
  1082. console.log('getGuide: ', e);
  1083. }
  1084. }
  1085. };
  1086. iwbHub.client.getEnvironment = function(msg) {
  1087. console.log('getEnvironment: ', msg);
  1088. if (msg) {
  1089. try {
  1090. var data = JSON.parse(msg);
  1091. if (!data) {
  1092. return;
  1093. }
  1094. Environment(data);
  1095. } catch (e) {
  1096. console.log('getEnvironment: ', e);
  1097. }
  1098. }
  1099. };
  1100. iwbHub.client.getMatchSuccess = function(msg) {
  1101. console.log('getMatchSuccess: ', msg);
  1102. if (msg) {
  1103. try {
  1104. var data = JSON.parse(msg);
  1105. if (!data) {
  1106. return;
  1107. }
  1108. var url = "", style = "";
  1109. if (data.scoreType == @((int) BehaviorScoreType.Normal)) {
  1110. style = "text-success";
  1111. url = "/Content/Media/S4.mp3";
  1112. } else if (data.scoreType == @((int) BehaviorScoreType.Negative)) {
  1113. style = "text-danger";
  1114. url = "/Content/Media/E2.mp3";
  1115. } else if (data.scoreType == @((int) BehaviorScoreType.ImportantNegative)) {
  1116. style = "text-danger text-bold";
  1117. url = "/Content/Media/E6.mp3";
  1118. }
  1119. ChangeLog(data.word, style);
  1120. PlayAudio(url, data.scoreType);
  1121. } catch (e) {
  1122. console.log('getMatchSuccess: ', e);
  1123. }
  1124. }
  1125. };
  1126. </script>
  1127. <script>
  1128. //function Guide(data) {
  1129. //}
  1130. var et, evList = [];
  1131. function Environment(data) {
  1132. evList.push(data);
  1133. ShowEnvironment();
  1134. }
  1135. function ShowEnvironment() {
  1136. var data = evList[0] ? $.extend({}, evList[0]) : undefined;
  1137. console.log(data);
  1138. if (!data) {
  1139. return;
  1140. }
  1141. if ($('.environment').length > 0 && $('#ev-' + data.nodePath).length <= 0) {
  1142. return;
  1143. }
  1144. evList.splice(0, 1);
  1145. var str = '', str1 = '';
  1146. var path = data.resourcePath.indexOf('http') > -1
  1147. ? data.resourcePath
  1148. : '@(dataCenterUrl)' + data.resourcePath;
  1149. switch (data.resourceType) {
  1150. case @((int) ResourceType.Image):
  1151. str1 = '<img src="{0}" style="" />'.format(path);
  1152. break;
  1153. case @((int) ResourceType.Audio):
  1154. str1 =
  1155. '<audio id="audio" style="display:none" controls autoplay><source src="{0}" type="audio/mp3">您的浏览器不支持 HTML5 audio 标签。</audio>'
  1156. .format(path);
  1157. break;
  1158. case @((int) ResourceType.Video):
  1159. str1 =
  1160. '<video id="video" style="" controls autoplay><source src="{0}" type="video/mp4">您的浏览器不支持 HTML5 video 标签。</video>'
  1161. .format(path);
  1162. break;
  1163. default:
  1164. str1 = '';
  1165. }
  1166. clearTimeout(et);
  1167. if ($('#ev-' + data.nodePath).length > 0) {
  1168. $('#ev-' + data.nodePath).find('.play-box').append('<div style="width:100% ;height:15px"></div>');
  1169. $('#ev-' + data.nodePath).find('.play-box').append(str1);
  1170. Scroll2Bottom($('#environment-score'));
  1171. } else {
  1172. str =
  1173. '<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>'
  1174. .format(data.nodePath, str1);
  1175. $('body').append(str);
  1176. OverlayScrollbar($('#environment-score'), { className: "os-theme-thin-light" });
  1177. $(".environment").fadeIn(600);
  1178. }
  1179. et = setTimeout(CloseEnvironment, 1000 * 15);
  1180. }
  1181. function CloseEnvironment(isAuto) {
  1182. isAuto = isAuto == undefined ? true : isAuto;
  1183. clearTimeout(et);
  1184. $(".environment").fadeOut(300).remove();
  1185. if (isAuto) {
  1186. ShowEnvironment();
  1187. }
  1188. }
  1189. function PlayAudio(url, type) {
  1190. if (!$('#audio-hidden-' + type).length) {
  1191. var audio =
  1192. '<audio id="audio-hidden-{1}" style="" controls autoplay><source src="{0}" type="audio/mpeg">您的浏览器不支持 HTML5 audio 标签。</audio>'
  1193. .format(url, type);
  1194. $('#media-box-hide').append(audio);
  1195. setTimeout(function() {$('#audio-hidden-' + type).remove();},15000);
  1196. }
  1197. }
  1198. function ChangeLog(word, style) {
  1199. var arr = word.split('|');
  1200. var $log = $('#log__' + arr[0] + ' .log-text');
  1201. if ($log.length) {
  1202. var text = $log.html(), text2 = text;
  1203. if (arr[2]) {
  1204. var arr2 = arr[2].split(',');
  1205. arr2.forEach(function(v) {
  1206. var reg = new RegExp(v, "g");
  1207. var str = '<span class="{1} ml-1 mr-1">{0}</span>'.format(v, style);
  1208. if (text2.indexOf(str) < 0) {
  1209. text2 = text2.replace(reg, str);
  1210. }
  1211. });
  1212. $log.html(text2);
  1213. if (text != text2) {
  1214. $.iwbAjax5({
  1215. url: abp.appUrl + 'CampPlay/UpdateLog',
  1216. data: { id: arr[0], Text: text2 }
  1217. });
  1218. }
  1219. }
  1220. }
  1221. }
  1222. </script>
  1223. }
  1224. @section modal
  1225. {
  1226. }
  1227. }