_Screen.cshtml 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833
  1. @using IwbZero.ToolCommon.StringModel
  2. @using WeEngine.Enum
  3. @using WeApp.Configuration
  4. @using WeApp.Helpers
  5. @model WeApp.Models.Common.ScreenModel
  6. @{
  7. string groupNo = Model.GroupNo, campNo = Model.CampNo;
  8. bool show = Model.WithScript;
  9. int type = Model.Type;
  10. var dataCenterUrl = IwbSettingNames.GetWeDataCenterIp(SettingManager).Ew("/");
  11. }
  12. @if (show)
  13. {
  14. <link href="~/Content/Css/Exercise/public.min.css" rel="stylesheet" />
  15. }
  16. <div class="box" style="width: 45%; height: 100%;" id="scene_@(groupNo)" data-isRefresh="true">
  17. <div class="box-title">
  18. <span>情景区</span>
  19. </div>
  20. <div class="box-body" style="height: calc(100% - 370px)"><div class="body-content"></div></div>
  21. <div class="media-box" style="height:300px;">
  22. <div class="body-content">
  23. <span>播放区</span>
  24. </div>
  25. </div>
  26. </div>
  27. <div class="box" style="width: 38%; height: 100%" data-id="@(groupNo)" id="log_@(groupNo)">
  28. <div class="box-title" style="position: relative">
  29. <span>决策指挥中心</span>
  30. <a id="warning-btn" href="javascript:void(0)" onclick="ShowWaring()" class="btn-danger btn" style="position: absolute; top: 6px; left: 30px; margin-bottom: 0; z-index: 2; padding: 8px 20px;display:none">查看告警</a>
  31. </div>
  32. <div class="box-body" style=""><div class="body-content"></div></div>
  33. </div>
  34. <div class="box" style="width: 17%; height: 100%; float: left;">
  35. <div class="box" style="width: 100%; height: 70%" id="role_@(groupNo)">
  36. <div class="box-title">
  37. <span>指挥部</span>
  38. <a href="javascript:void(0)" onclick="ShowGroupRole('@(groupNo)')" class="btn-info btn" style="right: 30px;">角色方案</a>
  39. </div>
  40. <div class="box-body" style=""><div class="body-content" style=""></div></div>
  41. </div>
  42. <div class="box" style="width: 100%; height: 30%; border-top: 0" id="score_@(groupNo)">
  43. <div class="box-title" style="border-top: 3px solid #eee;">
  44. <span>评估信息</span>
  45. </div>
  46. <div class="box-body" style="">
  47. <div class="body-content">
  48. @*<div class="score-box">
  49. <span class="name">系统评分</span><span style="padding: 0 5px;">:</span><span class="score">800</span><span style="padding-left: 5px;">分</span>
  50. </div>*@
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. @if (show)
  56. {
  57. using (Html.BeginScripts())
  58. {
  59. <script>
  60. var overlayScrollbar;
  61. $(function() {
  62. abp.signalr.connect(['@(campNo)']);
  63. });
  64. function Scroll2Bottom(that) {
  65. var instance = window.OverlayScrollbars($(that)[0]);
  66. instance.scroll({ y: "100%" });
  67. }
  68. function ShowGroupRole(no) {
  69. $.iwbAjax4({
  70. url: abp.appUrl + 'Query/GetGroupRolePlans?no=' + no,
  71. success: function(res) {
  72. if (res && res.plans && res.plans.length > 0) {
  73. var str = '';
  74. res.plans.forEach(function(v) {
  75. str += FormatterRolePlan(v);
  76. });
  77. if (str) {
  78. $(document).iwbModal('create',
  79. {
  80. modal: 'modal-role-plan',
  81. modaltitle: '角色预案详情',
  82. modalBody: str,
  83. save: function() {
  84. $('#modal-role-plan').modal('hide');
  85. }
  86. });
  87. }
  88. } else {
  89. abp.message.warn("还未创建指挥部!");
  90. }
  91. }
  92. });
  93. }
  94. function FormatterRolePlan(data) {
  95. var str = '';
  96. if (data) {
  97. str += '<div class="plan-box box">';
  98. str += '<div class="plan-name">{0}</div>'.format(data.name);
  99. str += '<div class="plan-role">';
  100. if (data.roleName) {
  101. data.roleName.forEach(function(v) {
  102. str += '<div class="role-box"><div class="name">{0}</div><div class="image"><img src="../../Content/Image/Stu/zhb/user.png" /></div></div>'
  103. .format(v);
  104. });
  105. }
  106. str += '</div>';
  107. str += '</div>';
  108. }
  109. return str;
  110. }
  111. </script>
  112. <script id="scene-s">
  113. var _loadCount = 0, _loadTimeout;
  114. function PreLoad(no) {
  115. _loadCount++;
  116. console.log("加载数据中... " + _loadCount);
  117. if (!$('.load-box').length) {
  118. $('body').append(`<div class="load-box"> <span class="loading">正在加载演练数据</span></div>`);
  119. }
  120. if (_loadCount > 3) {
  121. $('.load-box').fadeOut();
  122. return;
  123. }
  124. $.iwbAjax5({
  125. url: abp.appUrl + "Query/LoadCampPre?no=" + no + "&type=0",
  126. timeout: 1000 * 60 * 5,
  127. success: () => {
  128. clearTimeout(_loadTimeout);
  129. $('.load-box').fadeOut().remove();
  130. $.iwbAjax5({
  131. url: abp.appUrl + "Query/LoadCampPre?no=" + no + "&type=1",
  132. timeout: 1000 * 60 * 5,
  133. complete: () => {
  134. console.log("加载中... " + _loadCount);
  135. }
  136. });
  137. }
  138. , complete: () => {
  139. console.log("加载中... " + _loadCount);
  140. }
  141. });
  142. clearTimeout(_loadTimeout);
  143. _loadTimeout = setTimeout(PreLoad, 1000 * 60 * 2);
  144. }
  145. function GetScenes(no) {
  146. $.iwbAjax5({
  147. url: abp.appUrl + 'Query/GetGroupScenes?no=' + no,
  148. success: function (res) {
  149. if (res) {
  150. FormatterScenes(res, no);
  151. } else {
  152. setTimeout(function () {
  153. if (!$(`#scene_${no} .box-body .body-content .scene-box`).length) {
  154. GetScenes(no);
  155. }
  156. }, 5000);
  157. }
  158. }
  159. });
  160. }
  161. function FormatterScenes(data, no) {
  162. var str = "";
  163. if (data && data.length > 0) {
  164. data.forEach(function (v) {
  165. str += FormatterSceneInfo(v, no, false);
  166. });
  167. }
  168. if (str) {
  169. $('#scene_' + no + ' .box-body .body-content').html(str);
  170. Scroll2Bottom($('#scene_' + no + ' .box-body'));
  171. }
  172. }
  173. function GetSceneInfo(groupNo, sceneNo) {
  174. $.iwbAjax5({
  175. url: abp.appUrl + 'Query/GetGroupSceneInfo?no=' + groupNo + '&scenePath=' + sceneNo,
  176. success: function (res) {
  177. if (res) {
  178. var str = FormatterSceneInfo(res, groupNo, true);
  179. if (str) {
  180. DisabledScene2(groupNo);
  181. var $box = $('#scene_' + groupNo + ' .box-body .body-content');
  182. $box.append(str);
  183. AutoPlay($box);
  184. var t = $('#scene_' + groupNo).data('t');
  185. //clearTimeout(t);
  186. //t =
  187. //setTimeout(function () {
  188. // $("#scene_" + groupNo + ' .box-body .body-content').find(".flash-scene").removeClass("flash-scene");
  189. //}, 1000 * 20);
  190. $('#scene_' + groupNo).data('t', t);
  191. Scroll2Bottom($('#scene_' + groupNo + ' .box-body'));
  192. }
  193. } else {
  194. setTimeout(function () { GetSceneInfo(groupNo, sceneNo); }, 5000);
  195. }
  196. }
  197. });
  198. }
  199. function FormatterSceneInfo(data, groupNo, isNew) {
  200. var str = "";
  201. if (data) {
  202. if ($(`#scene_${groupNo} .box-body .scene-box[data-path="${data.path}"]`).length > 0) {
  203. return "";
  204. }
  205. var c = "handled", str3 = '', descShow = '', attachStr = '';
  206. if (isNew) {
  207. c = "flash-scene new-scene new-scene2";
  208. //str2 = '<span class="label label-danger no-scene">未处理</span>';
  209. str3 =
  210. '<div class="tool open" onclick="ToggleDesc(this)"><i class="iconfont icon-minus"></i></div>';
  211. descShow = 'block';
  212. } else {
  213. //str2 = '<span class="label label-info">已处理</span>';
  214. str3 =
  215. '<div class="tool close" onclick="ToggleDesc(this)"><i class="iconfont icon-plus"></i></div>';
  216. descShow = 'none';
  217. }
  218. if (data.attaches && data.attaches.length > 0) {
  219. var template = '<span class="attach attach-{0} attach1" data-attach-type="{0}" data-path="{1}" onclick="EventAttach(this)"><i class="iconfont {2}" title="{3}"></i></span>';
  220. for (var i = 0; i < data.attaches.length; i++) {
  221. var item = data.attaches[i];
  222. if (item.fileType) {
  223. if (item.fileType === "image") {
  224. attachStr += template.format(item.fileType, item.filePath, 'icon-picture', '图片');
  225. } else if (item.fileType === "video") {
  226. attachStr += template.format(item.fileType, item.filePath, 'icon-training', '视频');
  227. }
  228. }
  229. }
  230. }
  231. str +=
  232. '<div class="scene-box {3}" data-id="{0}" data-path="{5}"><div class="title"><span class="text">{1}</span><div class="attach-box">{4}</div>{6}</div><div class="desc" style="display:{7};">{2}</div></div>'
  233. .format(data.id, data.name, data.description, c, attachStr, data.path, str3, descShow);
  234. }
  235. return str;
  236. }
  237. function ToggleGuide(that) {
  238. var $that = $(that);
  239. if ($that.hasClass('open')) {
  240. $that.removeClass('open');
  241. $that.closest('.scene-box').find('.guide-box').fadeOut(400);
  242. } else {
  243. $that.addClass('open');
  244. $that.closest('.scene-box').find('.guide-box').fadeIn(600);
  245. var $tool = $that.closest('.scene-box').find('.tool');
  246. if (!$tool.hasClass('open')) {
  247. $tool.addClass('open').html('<i class="iconfont icon-minus"></i>');
  248. $tool.closest('.scene-box').find('.desc').fadeIn(600);
  249. }
  250. }
  251. Scroll2Bottom($that.closest('.box-body'));
  252. }
  253. function ToggleDesc(that) {
  254. var $that = $(that);
  255. if ($that.hasClass('open')) {
  256. $that.removeClass('open').html('<i class="iconfont icon-plus"></i>');
  257. $that.closest('.scene-box').find('.desc').fadeOut(400);
  258. } else {
  259. $that.addClass('open').html('<i class="iconfont icon-minus"></i>');
  260. $that.closest('.scene-box').find('.desc').fadeIn(600);
  261. }
  262. Scroll2Bottom($that.closest('.box-body'));
  263. }
  264. function DisabledScene1(groupNo) {
  265. var $that = $('#scene_' + groupNo).find('.scene-box.new-scene2');
  266. $that.attr('onclick', '');
  267. $that.removeClass('new-scene2').addClass("old-scene").addClass("handled");
  268. }
  269. function DisabledScene2(groupNo) {
  270. var $that = $('#scene_' + groupNo).find('.scene-box.old-scene');
  271. $that.removeClass('old-scene');
  272. $that.find('.tool.open').trigger('click');
  273. //if ($that.hasClass('old-scene')) {
  274. // $that.attr('onclick', '');
  275. // $that.removeClass('old-scene');
  276. // $that.find('.tool.open').trigger('click');
  277. // //$that.find('.no-scene').text('已处理').removeClass('label-danger').removeClass('no-scene')
  278. // // .addClass('label-info');
  279. //}
  280. //$('#scene-info-box .active').removeClass('active');
  281. //$('#current-scene-box #scene-path').val('');
  282. //$('#current-scene-box .scene-name').text('无');
  283. }
  284. var imageTemplate = '<img src="{0}" style="" />',
  285. videoTemplate = '<video id="video" style="" controls autoplay><source src="{0}" type="video/mp4">您的浏览器不支持 HTML5 video 标签。</video>',
  286. audioTemplate = '<audio id="audio" style="" controls autoplay><source src="{0}" type="audio/mp3">您的浏览器不支持 HTML5 audio 标签。</audio>';
  287. var at;
  288. function EventAttach(that, event) {
  289. var type = $(that).data('attach-type');
  290. var path = $(that).data('path');
  291. if (type) {
  292. var str = type === "image" ? imageTemplate.format(path) : type === "video" ? videoTemplate.format(path) : type === "audio" ? audioTemplate.format(path) : '';
  293. $(that).closest(".box").find(".media-box .body-content").html(str);
  294. $(that).closest(".box").find(".current-scene").removeClass("current-scene");
  295. $(that).closest(".scene-box").addClass("current-scene");
  296. event = event || function () { InitMedia($(that)) };
  297. var video = document.getElementById("video");
  298. if (video) {
  299. video.loop = false;
  300. video.addEventListener('ended', function () { setTimeout(function () { event.call(that); }, 1000 * 3) }, false);
  301. } else {
  302. clearTimeout(at);
  303. at = setTimeout(function () { event.call(that); }, 1000 * 10);
  304. }
  305. }
  306. }
  307. function AutoPlay($box, $that, isForce) {
  308. if (!isForce && $box.data("auto-play")) {
  309. return;
  310. }
  311. $box.data("auto-play", true);
  312. $that = $that === undefined ? $box.find('.new-scene').eq(0).removeClass('new-scene') : $that;
  313. var $attach = $that.find('.attach');
  314. if ($attach.length <= 0) {
  315. var $next = $box.find('.new-scene').eq(0).removeClass('new-scene');
  316. if ($next.length > 0) {
  317. AutoPlay($box, $next, true);
  318. } else {
  319. $box.data("auto-play", false);
  320. InitMedia($box.find('.current-scene'));
  321. }
  322. } else {
  323. if (!$that) { return; }
  324. $attach = $that.find('.attach').first();
  325. EventAttach($attach, function () { AutoPlay($box, $that, true); });
  326. $attach.removeClass('attach');
  327. }
  328. }
  329. function InitMedia(that) {
  330. var $that = (that).closest(".box");
  331. $that.find(".current-scene").removeClass("current-scene");
  332. $that.find(".media-box .body-content").html('<span>播放区</span>');
  333. }
  334. var questionTimer;
  335. function ShowPhoneQuestion(data) {
  336. var delay = 30;
  337. if ($('#scene_' + data.no).find('.question').length) {
  338. clearTimeout(questionTimer);
  339. questionTimer = setTimeout(function () { HidePhoneQuestion(data.no); }, 1000 * delay);
  340. return;
  341. }
  342. var str = '<div class="question" title="点击关闭" onclick="$(this).remove()"><button type="button" style=" --w:150px;"><i class="fa fa-phone-volume" style="font-size: 90px;"></i></button></div>';
  343. $('#scene_' + data.no).append(str);
  344. $('#scene_' + data.no).find('.question').fadeIn();
  345. questionTimer = setTimeout(function () { HidePhoneQuestion(data.no); }, 1000 * delay);
  346. }
  347. function HidePhoneQuestion(no) {
  348. $('#scene_' + no).find('.question').fadeOut(500, function () { $('#scene_' + no).find('.question').remove(); });
  349. }
  350. </script>
  351. <script id="log-s">
  352. function GetLogs(no) {
  353. $.iwbAjax5({
  354. url: abp.appUrl + 'Query/GetGroupLogs?no=' + no,
  355. success: function(res) {
  356. if (res) {
  357. FormatterLog(res, no);
  358. }
  359. }
  360. });
  361. }
  362. function FormatterLog(data, no) {
  363. var str = "";
  364. if (data && data.length > 0) {
  365. data.forEach(function(v) {
  366. str += FormatLog(v);
  367. });
  368. }
  369. if (str) {
  370. $('#log_' + no + ' .box-body .body-content').html(str);
  371. }
  372. }
  373. var reviewsType1 = "YanHua2", reviewsType2 = "ZhaDan";
  374. function FormatLog(data) {
  375. var c = '',e='';
  376. if (data.logState == '@(LogStateDefinition.Submit)' || data.logState == '@(LogStateDefinition.Send)'|| data.logState == '@(LogStateDefinition.HasMatch)'|| data.logState == '@(LogStateDefinition.HasSendMatch)') {
  377. c = "send";
  378. @if (type == 2)
  379. {
  380. <text>
  381. c += " specialist";
  382. var str1 = ``, str2 = ``;
  383. if (data.extendInfo1) {
  384. var reviews = JSON.parse(data.extendInfo1);
  385. reviews.forEach(v => {
  386. if (v.v > 0) {
  387. switch (v.n) {
  388. case reviewsType1:
  389. str1 = `(<span>${v.v}</span>)`;
  390. break;
  391. case reviewsType2:
  392. str1 = `(<span>${v.v}</span>)`;
  393. break;
  394. }
  395. }
  396. });
  397. }
  398. e = `<span class="reviews-box">
  399. <i class="far fa-thumbs-up" data-type="${reviewsType1}" title="赞" onclick="SendLogReviews(this)">${str1}</i>
  400. <i class="far fa-thumbs-down" data-type="${reviewsType2}" title="踩" onclick="SendLogReviews(this)">${str2}</i>
  401. </span>`;
  402. </text>
  403. }
  404. }
  405. var str =
  406. `<div class="log-box ${c} log_${data.id}" id="log-box_${data.id}" data-id="${data.id}" ><span class="role">#${data.role}</span><span class="word">${data.word}</span>${e}</div>`;
  407. return str;
  408. }
  409. @if (type == 2)
  410. {
  411. <text>
  412. function SendLogReviews(_this) {
  413. var $this = $(_this), type = $this.data('type'), id = $this.closest('.log-box').data('id');
  414. $.iwbAjax4({
  415. url: abp.appUrl + "eval/SendLogReviews",
  416. data: { id: id, reviewsType: type },
  417. success: function (res) {
  418. $this.removeClass('far').addClass("fas");
  419. $this.html(`(<span>${res}</span>)`);
  420. }
  421. });
  422. }
  423. </text>
  424. }
  425. </script>
  426. <script id="role-s">
  427. function GetRoles(no) {
  428. $.iwbAjax5({
  429. url: abp.appUrl + 'Query/GetGroupRoleInfos?no=' + no,
  430. success: function (res) {
  431. if (res) {
  432. FormatterRole(res, no);
  433. }
  434. }
  435. });
  436. }
  437. function FormatterRole(data, no) {
  438. var str = "";
  439. if (data && data.length > 0) {
  440. data.forEach(function (v) {
  441. str +=
  442. '<div class="role-box"><div class="name">{0}</div><div class="image"><img src="../../Content/Image/Stu/zhb/user.png" /></div></div>'
  443. .format(v);
  444. });
  445. }
  446. if (str) {
  447. $('#role_' + no + ' .box-body .body-content').html(str);
  448. }
  449. }
  450. </script>
  451. <script id="score-s">
  452. function GetScore(no) {
  453. $.iwbAjax5({
  454. url: abp.appUrl + 'Query/GetGroupScoreInfo?no=' + no,
  455. success: function (res) {
  456. if (res) {
  457. res.systemScore = undefined;
  458. FormatterScore(res, no);
  459. }
  460. }
  461. });
  462. }
  463. // ' '
  464. function FormatterScore(data, no) {
  465. var str = "",
  466. template =
  467. '<div class="score-box {2}"><span class="name">{0}</span><span class="score">{1}<span>分</span></span></div>';
  468. if (data.systemScore) {
  469. str += template.format("系统评分", data.systemScore, "system-score");
  470. }
  471. var tags = data.behaviorTagScoreInfo ? JSON.parse(data.behaviorTagScoreInfo) : data.tagScores;
  472. if (tags && tags.length > 0) {
  473. tags.forEach(function (v) {
  474. var score = v.correctionScore ? v.correctionScore : v.systemScore;
  475. if (score > 0) {
  476. str += template.format(v.tagNo, score, "tag-score");
  477. }
  478. });
  479. }
  480. if (str) {
  481. $('#score_' + no + ' .box-body .body-content').prepend(str);
  482. }
  483. }
  484. </script>
  485. <script id="hub-s">
  486. iwbHub.client.getReloadAll = function(msg) {
  487. console.log('getReloadAll: ', msg);
  488. if (msg) {
  489. try {
  490. var data = JSON.parse(msg);
  491. if (data) {
  492. if (data.no == '@(groupNo)' || data.no == '@(campNo)') {
  493. window.location.reload();
  494. }
  495. }
  496. } catch (e) {
  497. console.log('getReloadAll: ', e);
  498. }
  499. }
  500. };
  501. iwbHub.client.getOperationLog = function(msg) {
  502. console.log('getOperationLog: ', msg);
  503. if (msg) {
  504. try {
  505. var data = JSON.parse(msg);
  506. if (@(type) == 2 || data.no=='@(groupNo)') {
  507. var str = FormatLog(data);
  508. $('#log_' + data.no + ' .box-body .body-content').prepend(str);
  509. }
  510. } catch (e) {
  511. console.log('getOperationLog: ', e);
  512. }
  513. }
  514. };
  515. iwbHub.client.getOperationLogSubmit = function(msg) {
  516. console.log('getOperationLogSubmit: ', msg);
  517. if (msg) {
  518. try {
  519. var data = JSON.parse(msg);
  520. @if (type == 2)
  521. {
  522. <text>
  523. $('#log_' + data.no + ' .box-body .body-content').find('.log_' + data.logId).addClass('send').append(`<span class="reviews-box">
  524. <i class="far fa-thumbs-up" data-type="${reviewsType1}" title="赞" onclick="SendLogReviews(this)"></i>
  525. <i class="far fa-thumbs-down" data-type="${reviewsType2}" title="踩" onclick="SendLogReviews(this)"></i>
  526. </span>`);
  527. </text>
  528. }
  529. else
  530. {
  531. <text>
  532. if (data.no=='@(groupNo)') {
  533. $('#log_' + data.no + ' .box-body .body-content').find('.log_' + data.logId).addClass('send');
  534. }
  535. </text>
  536. }
  537. } catch (e) {
  538. console.log('getOperationLogSubmit: ', e);
  539. }
  540. }
  541. };
  542. iwbHub.client.getNewScene = function(msg) {
  543. console.log('getNewScene: ', msg);
  544. if (msg) {
  545. try {
  546. var data = typeof msg == 'string' ? JSON.parse(msg) : msg;
  547. if (data) {
  548. if (@(type) == 2 || data.no == '@(groupNo)') {
  549. if ($('#scene_' + data.no).find('.scene-box[data-path="' + data.path + '"]').length <= 0) {
  550. GetSceneInfo(data.no, data.sceneNo);
  551. }
  552. }
  553. }
  554. } catch (e) {
  555. console.log('getNewScene: ', e);
  556. }
  557. }
  558. };
  559. iwbHub.client.getRoundScore = function(msg) {
  560. console.log('getRoundScore: ', msg);
  561. if (msg) {
  562. try {
  563. var data = JSON.parse(msg);
  564. if (@(type) == 2 || data.no=='@(groupNo)') {
  565. data.systemScore = undefined;
  566. FormatterScore(data, data.no);
  567. };
  568. } catch (e) {
  569. console.log('getRoundScore: ', e);
  570. }
  571. }
  572. };
  573. iwbHub.client.getSendScore = function(msg) {
  574. console.log('getSendScore: ', msg);
  575. if (msg) {
  576. try {
  577. var data = JSON.parse(msg);
  578. if (@(type) == 2 || data.no=='@(groupNo)') {
  579. FormatterScore(data, data.no);
  580. };
  581. } catch (e) {
  582. console.log('getSendScore: ', e);
  583. }
  584. }
  585. };
  586. iwbHub.client.getDisabledScene = function(msg) {
  587. console.log('getDisabledScene: ', msg);
  588. if (msg) {
  589. try {
  590. //var data = JSON.parse(msg);
  591. if (@(type) == 2 || msg == '@(groupNo)') {
  592. DisabledScene1(msg);
  593. }
  594. } catch (e) {
  595. console.log('getDisabledScene: ', e);
  596. }
  597. }
  598. }
  599. iwbHub.client.getMatchSuccess = function(msg) {
  600. console.log('getMatchSuccess: ', msg);
  601. if (msg) {
  602. try {
  603. var data = JSON.parse(msg);
  604. if (!data) {
  605. return;
  606. }
  607. var url = "", style = "";
  608. if (data.scoreType == @((int) BehaviorScoreType.Normal)) {
  609. style = "text-success";
  610. url = "/Content/Media/S4.mp3";
  611. } else if (data.scoreType == @((int) BehaviorScoreType.Negative)) {
  612. style = "text-danger";
  613. url = "/Content/Media/E2.mp3";
  614. } else if (data.scoreType == @((int) BehaviorScoreType.ImportantNegative)) {
  615. style = "text-danger text-bold";
  616. url = "/Content/Media/E6.mp3";
  617. }
  618. //ChangeLog(data.word, style);
  619. PlayAudio(url, data.scoreType);
  620. } catch (e) {
  621. console.log('getMatchSuccess: ', e);
  622. }
  623. }
  624. };
  625. iwbHub.client.getPhoneQuestion = function(msg) {
  626. console.log('getPhoneQuestion: ', msg);
  627. if (msg) {
  628. try {
  629. var data = JSON.parse(msg);
  630. if (!data) {
  631. return;
  632. }
  633. if (@(type) == 1 && data.no=='@(groupNo)') {
  634. ShowPhoneQuestion(data);
  635. };
  636. } catch (e) {
  637. console.log('getPhoneQuestion: ', e);
  638. }
  639. }
  640. };
  641. iwbHub.client.getPhoneQuestionSubmit = function(msg) {
  642. console.log('getPhoneQuestionSubmit: ', msg);
  643. if (msg) {
  644. try {
  645. var data = JSON.parse(msg);
  646. if (!data) {
  647. return;
  648. }
  649. if (@(type) == 1 && data.no=='@(groupNo)') {
  650. clearTimeout(questionTimer);
  651. HidePhoneQuestion(data.no);
  652. };
  653. } catch (e) {
  654. console.log('getPhoneQuestionSubmit: ', e);
  655. }
  656. }
  657. };
  658. </script>
  659. <script>
  660. var et, evList = [];
  661. function Environment(data) {
  662. evList.push(data);
  663. ShowEnvironment();
  664. }
  665. function ShowEnvironment() {
  666. var data = evList[0] ? $.extend({}, evList[0]) : undefined;
  667. console.log(data);
  668. if (!data) {
  669. return;
  670. }
  671. if ($('.environment').length > 0 && $('#ev-' + data.nodePath).length <= 0) {
  672. return;
  673. }
  674. evList.splice(0, 1);
  675. var str = '', str1 = '';
  676. var path = data.resourcePath.indexOf('http') > -1
  677. ? data.resourcePath
  678. : '@(dataCenterUrl)' + data.resourcePath;
  679. switch (data.resourceType) {
  680. case @((int) ResourceType.Image):
  681. str1 = '<img src="{0}" style="" />'.format(path);
  682. break;
  683. case @((int) ResourceType.Audio):
  684. str1 =
  685. '<audio id="audio" style="display:none" controls autoplay><source src="{0}" type="audio/mp3">您的浏览器不支持 HTML5 audio 标签。</audio>'
  686. .format(path);
  687. break;
  688. case @((int) ResourceType.Video):
  689. str1 =
  690. '<video id="video" style="" controls autoplay><source src="{0}" type="video/mp4">您的浏览器不支持 HTML5 video 标签。</video>'
  691. .format(path);
  692. break;
  693. default:
  694. str1 = '';
  695. }
  696. clearTimeout(et);
  697. if ($('#ev-' + data.nodePath).length > 0) {
  698. $('#ev-' + data.nodePath).find('.play-box').append('<div style="width:100% ;height:15px"></div>');
  699. $('#ev-' + data.nodePath).find('.play-box').append(str1);
  700. Scroll2Bottom($('#environment-score'));
  701. } else {
  702. str =
  703. '<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>'
  704. .format(data.nodePath, str1);
  705. $('body').append(str);
  706. OverlayScrollbar($('#environment-score'), { className: "os-theme-thin-light" });
  707. $(".environment").fadeIn(600);
  708. }
  709. et = setTimeout(CloseEnvironment, 1000 * 15);
  710. }
  711. function CloseEnvironment(isAuto) {
  712. isAuto = isAuto == undefined ? true : isAuto;
  713. clearTimeout(et);
  714. $(".environment").fadeOut(300).remove();
  715. if (isAuto) {
  716. ShowEnvironment();
  717. }
  718. }
  719. function PlayAudio(url, type) {
  720. if (!$('#audio-hidden-' + type).length) {
  721. var audio =
  722. '<div id="audio-hidden-{1}" style="display:none"><audio style="" controls autoplay><source src="{0}" type="audio/mpeg">您的浏览器不支持 HTML5 audio 标签。</audio></div>'
  723. .format(url, type);
  724. $('body').append(audio);
  725. setTimeout(function() {$('#audio-hidden-' + type).remove();},20000);
  726. }
  727. }
  728. function ChangeLog(word, style) {
  729. var arr = word.split('|');
  730. var $log = $('#log-box_' + arr[0] + ' .word');
  731. if ($log.length) {
  732. var text = $log.html(), text2 = text;
  733. if (arr[2]) {
  734. var arr2 = arr[2].split(',');
  735. arr2.forEach(function(v) {
  736. var reg = new RegExp(v, "g");
  737. var str = '<span class="{1} ml-1 mr-1">{0}</span>'.format(v, style);
  738. if (text2.indexOf(str) < 0) {
  739. text2 = text2.replace(reg, str);
  740. }
  741. });
  742. $log.html(text2);
  743. if (text != text2) {
  744. $.iwbAjax5({
  745. url: abp.appUrl + 'Eval/UpdateLog',
  746. data: { id: arr[0], Text: text2 }
  747. });
  748. }
  749. }
  750. }
  751. }
  752. </script>
  753. }
  754. }
  755. @using (Html.BeginScripts())
  756. {
  757. <script>
  758. $(function () {
  759. abp.signalr.connect(['@(groupNo)'],function () {
  760. if (@(type) == 1){
  761. setTimeout(function() {
  762. $.iwbAjax5({
  763. url: abp.appUrl + "/Eval/StartFeedback?no=@(groupNo)",
  764. success: function(res) {
  765. if (res) {
  766. window.GetScenes('@(groupNo)');
  767. }
  768. }
  769. });
  770. },500);
  771. }
  772. })
  773. OverlayScrollbar($('.box-body'));
  774. GetLogs('@(groupNo)');
  775. GetRoles('@(groupNo)');
  776. GetScore('@(groupNo)');
  777. PreLoad('@(groupNo)');
  778. if (@(type)!= 1) {
  779. GetScenes('@(groupNo)');
  780. }
  781. });
  782. </script>
  783. }