_Screen.cshtml 38 KB

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