_Screen.cshtml 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847
  1. @using Abp.Configuration
  2. @using IwbZero.ToolCommon.StringModel
  3. @using WeEngine.Enum
  4. @using WeApp.Configuration
  5. @using WeApp.Helpers
  6. @model WeApp.Views.ExerciseV2.ScreenModel
  7. @{
  8. string groupNo = Model.GroupNo, campNo = Model.CampNo;
  9. bool show = Model.WithScript;
  10. int type = Model.Type;
  11. var dataCenterUrl = SettingManager.GetSettingValue(IwbSettingNames.WeDataCenterIp).Ew("/");
  12. }
  13. @if (show)
  14. {
  15. <link href="~/Content/Css/ExerciseV2/screen.min.css" rel="stylesheet" />
  16. <style>
  17. .os-theme-thin-dark > .os-scrollbar > .os-scrollbar-track {
  18. background: transparent;
  19. display: none;
  20. }
  21. </style>
  22. }
  23. <div class="box" style="width: 35%; height: 100%;" id="scene_@(groupNo)" data-isRefresh="true">
  24. <div class="box">
  25. <div class="box-header">
  26. <span class="title">情景区</span>
  27. </div>
  28. <div class="scene-box-body">
  29. <div class="box-body" style="height: calc(100% - 320px)">
  30. <div class="body-content" style="height: 100%"></div>
  31. </div>
  32. <div class="media-box" style="height: 300px;">
  33. <div class="body-content">
  34. <span>播放区</span>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. <div class="box" style="width: 50%; height: 100%" data-id="@(groupNo)" id="log_@(groupNo)">
  41. <div class="box">
  42. <div class="box-header">
  43. <span class="title">决策指挥中心</span>
  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 = '';
  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. str +=
  245. '<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>'
  246. .format(data.id, data.name, data.description, c, attachStr, data.path, str3, descShow);
  247. }
  248. return str;
  249. }
  250. function ToggleGuide(that) {
  251. var $that = $(that);
  252. if ($that.hasClass('open')) {
  253. $that.removeClass('open');
  254. $that.closest('.scene-box').find('.guide-box').fadeOut(400);
  255. } else {
  256. $that.addClass('open');
  257. $that.closest('.scene-box').find('.guide-box').fadeIn(600);
  258. var $tool = $that.closest('.scene-box').find('.tool');
  259. if (!$tool.hasClass('open')) {
  260. $tool.addClass('open').html('<i class="iconfont icon-minus"></i>');
  261. $tool.closest('.scene-box').find('.desc').fadeIn(600);
  262. }
  263. }
  264. Scroll2Bottom($that.closest('.box-body'));
  265. }
  266. function ToggleDesc(that) {
  267. var $that = $(that);
  268. if ($that.hasClass('open')) {
  269. $that.removeClass('open').html('<i class="iconfont icon-plus"></i>');
  270. $that.closest('.scene-box').find('.desc').fadeOut(400);
  271. } else {
  272. $that.addClass('open').html('<i class="iconfont icon-minus"></i>');
  273. $that.closest('.scene-box').find('.desc').fadeIn(600);
  274. }
  275. Scroll2Bottom($that.closest('.box-body'));
  276. }
  277. function DisabledScene1(groupNo) {
  278. var $that = $('#scene_' + groupNo).find('.scene-box.new-scene2');
  279. $that.attr('onclick', '');
  280. $that.removeClass('new-scene2').addClass("old-scene").addClass("handled");
  281. }
  282. function DisabledScene2(groupNo) {
  283. var $that = $('#scene_' + groupNo).find('.scene-box.old-scene');
  284. $that.removeClass('old-scene');
  285. $that.find('.tool.open').trigger('click');
  286. //if ($that.hasClass('old-scene')) {
  287. // $that.attr('onclick', '');
  288. // $that.removeClass('old-scene');
  289. // $that.find('.tool.open').trigger('click');
  290. // //$that.find('.no-scene').text('已处理').removeClass('label-danger').removeClass('no-scene')
  291. // // .addClass('label-info');
  292. //}
  293. //$('#scene-info-box .active').removeClass('active');
  294. //$('#current-scene-box #scene-path').val('');
  295. //$('#current-scene-box .scene-name').text('无');
  296. }
  297. var imageTemplate = '<img src="{0}" style="" />',
  298. videoTemplate = '<video id="video" style="" controls autoplay><source src="{0}" type="video/mp4">您的浏览器不支持 HTML5 video 标签。</video>',
  299. audioTemplate = '<audio id="audio" style="" controls autoplay><source src="{0}" type="audio/mp3">您的浏览器不支持 HTML5 audio 标签。</audio>';
  300. var at;
  301. function EventAttach(that, event) {
  302. var type = $(that).data('attach-type');
  303. var path = $(that).data('path');
  304. if (type) {
  305. var str = type === "image" ? imageTemplate.format(path) : type === "video" ? videoTemplate.format(path) : type === "audio" ? audioTemplate.format(path) : '';
  306. $(that).closest(".box").find(".media-box .body-content").html(str);
  307. $(that).closest(".box").find(".current-scene").removeClass("current-scene");
  308. $(that).closest(".scene-box").addClass("current-scene");
  309. event = event || function () { InitMedia($(that)) };
  310. var video = document.getElementById("video");
  311. if (video) {
  312. video.loop = false;
  313. video.addEventListener('ended', function () { setTimeout(function () { event.call(that); }, 1000 * 3) }, false);
  314. } else {
  315. clearTimeout(at);
  316. at = setTimeout(function () { event.call(that); }, 1000 * 10);
  317. }
  318. }
  319. }
  320. function AutoPlay($box, $that, isForce) {
  321. if (!isForce && $box.data("auto-play")) {
  322. return;
  323. }
  324. $box.data("auto-play", true);
  325. $that = $that === undefined ? $box.find('.new-scene').eq(0).removeClass('new-scene') : $that;
  326. var $attach = $that.find('.attach');
  327. if ($attach.length <= 0) {
  328. var $next = $box.find('.new-scene').eq(0).removeClass('new-scene');
  329. if ($next.length > 0) {
  330. AutoPlay($box, $next, true);
  331. } else {
  332. $box.data("auto-play", false);
  333. InitMedia($box.find('.current-scene'));
  334. }
  335. } else {
  336. if (!$that) { return; }
  337. $attach = $that.find('.attach').first();
  338. EventAttach($attach, function () { AutoPlay($box, $that, true); });
  339. $attach.removeClass('attach');
  340. }
  341. }
  342. function InitMedia(that) {
  343. var $that = (that).closest(".box");
  344. $that.find(".current-scene").removeClass("current-scene");
  345. $that.find(".media-box .body-content").html('<span>播放区</span>');
  346. }
  347. var questionTimer;
  348. function ShowPhoneQuestion(data) {
  349. var delay = 30;
  350. if ($('#scene_' + data.no).find('.question').length) {
  351. clearTimeout(questionTimer);
  352. questionTimer = setTimeout(function () { HidePhoneQuestion(data.no); }, 1000 * delay);
  353. return;
  354. }
  355. 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>';
  356. $('#scene_' + data.no).append(str);
  357. $('#scene_' + data.no).find('.question').fadeIn();
  358. questionTimer = setTimeout(function () { HidePhoneQuestion(data.no); }, 1000 * delay);
  359. }
  360. function HidePhoneQuestion(no) {
  361. $('#scene_' + no).find('.question').fadeOut(500, function () { $('#scene_' + no).find('.question').remove(); });
  362. }
  363. </script>
  364. <script id="log-s">
  365. function GetLogs(no) {
  366. $.iwbAjax5({
  367. url: abp.appUrl + 'Query/GetGroupLogs?no=' + no,
  368. success: function(res) {
  369. if (res) {
  370. FormatterLog(res, no);
  371. }
  372. }
  373. });
  374. }
  375. function FormatterLog(data, no) {
  376. var str = "";
  377. if (data && data.length > 0) {
  378. data.forEach(function(v) {
  379. str += FormatLog(v);
  380. });
  381. }
  382. if (str) {
  383. $('#log_' + no + ' .box-body .body-content').html(str);
  384. }
  385. }
  386. var reviewsType1 = "YanHua2", reviewsType2 = "ZhaDan";
  387. function FormatLog(data) {
  388. var c = '',e='';
  389. if (data.logState == '@(LogStateDefinition.Submit)' || data.logState == '@(LogStateDefinition.Send)'|| data.logState == '@(LogStateDefinition.HasMatch)'|| data.logState == '@(LogStateDefinition.HasSendMatch)') {
  390. c = "send";
  391. @if (type == 2)
  392. {
  393. <text>
  394. c += " specialist";
  395. var str1 = ``, str2 = ``;
  396. if (data.extendInfo1) {
  397. var reviews = JSON.parse(data.extendInfo1);
  398. reviews.forEach(v => {
  399. if (v.v > 0) {
  400. switch (v.n) {
  401. case reviewsType1:
  402. str1 = `(<span>${v.v}</span>)`;
  403. break;
  404. case reviewsType2:
  405. str1 = `(<span>${v.v}</span>)`;
  406. break;
  407. }
  408. }
  409. });
  410. }
  411. e = `<span class="reviews-box">
  412. <i class="far fa-thumbs-up" data-type="${reviewsType1}" title="赞" onclick="SendLogReviews(this)">${str1}</i>
  413. <i class="far fa-thumbs-down" data-type="${reviewsType2}" title="踩" onclick="SendLogReviews(this)">${str2}</i>
  414. </span>`;
  415. </text>
  416. }
  417. }
  418. var str =
  419. `<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>`;
  420. return str;
  421. }
  422. @if (type == 2)
  423. {
  424. <text>
  425. function SendLogReviews(_this) {
  426. var $this = $(_this), type = $this.data('type'), id = $this.closest('.log-box').data('id');
  427. $.iwbAjax4({
  428. url: abp.appUrl + "eval/SendLogReviews",
  429. data: { id: id, reviewsType: type },
  430. success: function (res) {
  431. $this.removeClass('far').addClass("fas");
  432. $this.html(`(<span>${res}</span>)`);
  433. }
  434. });
  435. }
  436. </text>
  437. }
  438. </script>
  439. <script id="role-s">
  440. function GetRoles(no) {
  441. $.iwbAjax5({
  442. url: abp.appUrl + 'Query/GetGroupRoleInfos?no=' + no,
  443. success: function (res) {
  444. if (res) {
  445. FormatterRole(res, no);
  446. }
  447. }
  448. });
  449. }
  450. function FormatterRole(data, no) {
  451. var str = "";
  452. if (data && data.length > 0) {
  453. data.forEach(function (v) {
  454. str += '<div class="role">{0}</div>'.format(v);
  455. });
  456. if (data.length % 2 == 1) {
  457. str += '<div class="role" style="visibility: hidden;"></div>'
  458. }
  459. }
  460. if (str) {
  461. $('#role_' + no + ' .box-body .body-content').html(`<div class="role-box">${str}</div>`);
  462. }
  463. }
  464. </script>
  465. <script id="score-s">
  466. function GetScore(no) {
  467. $.iwbAjax5({
  468. url: abp.appUrl + 'Query/GetGroupScoreInfo?no=' + no,
  469. success: function (res) {
  470. if (res) {
  471. res.systemScore = undefined;
  472. FormatterScore(res, no);
  473. }
  474. }
  475. });
  476. }
  477. // ' '
  478. function FormatterScore(data, no) {
  479. var str = "",
  480. template =
  481. '<div class="score-box {2}"><span class="name">{0}</span><span class="score">{1}<span>分</span></span></div>';
  482. if (data.systemScore) {
  483. str += template.format("系统评分", data.systemScore, "system-score");
  484. }
  485. var tags = data.behaviorTagScoreInfo ? JSON.parse(data.behaviorTagScoreInfo) : data.tagScores;
  486. if (tags && tags.length > 0) {
  487. tags.forEach(function (v) {
  488. var score = v.correctionScore ? v.correctionScore : v.systemScore;
  489. if (score > 0) {
  490. str += template.format(v.tagNo, score, "tag-score");
  491. }
  492. });
  493. }
  494. if (str) {
  495. $('#score_' + no + ' .box-body .body-content').prepend(str);
  496. }
  497. }
  498. </script>
  499. <script id="hub-s">
  500. iwbHub.client.getReloadAll = function(msg) {
  501. console.log('getReloadAll: ', msg);
  502. if (msg) {
  503. try {
  504. var data = JSON.parse(msg);
  505. if (data) {
  506. if (data.no == '@(groupNo)' || data.no == '@(campNo)') {
  507. window.location.reload();
  508. }
  509. }
  510. } catch (e) {
  511. console.log('getReloadAll: ', e);
  512. }
  513. }
  514. };
  515. iwbHub.client.getOperationLog = function(msg) {
  516. console.log('getOperationLog: ', msg);
  517. if (msg) {
  518. try {
  519. var data = JSON.parse(msg);
  520. if (@(type) == 2 || data.no=='@(groupNo)') {
  521. var str = FormatLog(data);
  522. $('#log_' + data.no + ' .box-body .body-content').prepend(str);
  523. }
  524. } catch (e) {
  525. console.log('getOperationLog: ', e);
  526. }
  527. }
  528. };
  529. iwbHub.client.getOperationLogSubmit = function(msg) {
  530. console.log('getOperationLogSubmit: ', msg);
  531. if (msg) {
  532. try {
  533. var data = JSON.parse(msg);
  534. @if (type == 2)
  535. {
  536. <text>
  537. $('#log_' + data.no + ' .box-body .body-content').find('.log_' + data.logId).addClass('send').append(`<span class="reviews-box">
  538. <i class="far fa-thumbs-up" data-type="${reviewsType1}" title="赞" onclick="SendLogReviews(this)"></i>
  539. <i class="far fa-thumbs-down" data-type="${reviewsType2}" title="踩" onclick="SendLogReviews(this)"></i>
  540. </span>`);
  541. </text>
  542. }
  543. else
  544. {
  545. <text>
  546. if (data.no=='@(groupNo)') {
  547. $('#log_' + data.no + ' .box-body .body-content').find('.log_' + data.logId).addClass('send');
  548. }
  549. </text>
  550. }
  551. } catch (e) {
  552. console.log('getOperationLogSubmit: ', e);
  553. }
  554. }
  555. };
  556. iwbHub.client.getNewScene = function(msg) {
  557. console.log('getNewScene: ', msg);
  558. if (msg) {
  559. try {
  560. var data = typeof msg == 'string' ? JSON.parse(msg) : msg;
  561. if (data) {
  562. if (@(type) == 2 || data.no == '@(groupNo)') {
  563. if ($('#scene_' + data.no).find('.scene-box[data-path="' + data.path + '"]').length <= 0) {
  564. GetSceneInfo(data.no, data.sceneNo);
  565. }
  566. }
  567. }
  568. } catch (e) {
  569. console.log('getNewScene: ', e);
  570. }
  571. }
  572. };
  573. iwbHub.client.getRoundScore = function(msg) {
  574. console.log('getRoundScore: ', msg);
  575. if (msg) {
  576. try {
  577. var data = JSON.parse(msg);
  578. if (@(type) == 2 || data.no=='@(groupNo)') {
  579. data.systemScore = undefined;
  580. FormatterScore(data, data.no);
  581. };
  582. } catch (e) {
  583. console.log('getRoundScore: ', e);
  584. }
  585. }
  586. };
  587. iwbHub.client.getSendScore = function(msg) {
  588. console.log('getSendScore: ', msg);
  589. if (msg) {
  590. try {
  591. var data = JSON.parse(msg);
  592. if (@(type) == 2 || data.no=='@(groupNo)') {
  593. FormatterScore(data, data.no);
  594. };
  595. } catch (e) {
  596. console.log('getSendScore: ', e);
  597. }
  598. }
  599. };
  600. iwbHub.client.getDisabledScene = function(msg) {
  601. console.log('getDisabledScene: ', msg);
  602. if (msg) {
  603. try {
  604. //var data = JSON.parse(msg);
  605. if (@(type) == 2 || msg == '@(groupNo)') {
  606. DisabledScene1(msg);
  607. }
  608. } catch (e) {
  609. console.log('getDisabledScene: ', e);
  610. }
  611. }
  612. }
  613. iwbHub.client.getMatchSuccess = function(msg) {
  614. console.log('getMatchSuccess: ', msg);
  615. if (msg) {
  616. try {
  617. var data = JSON.parse(msg);
  618. if (!data) {
  619. return;
  620. }
  621. var url = "", style = "";
  622. if (data.scoreType == @((int) BehaviorScoreType.Normal)) {
  623. style = "text-success";
  624. url = "/Content/Media/S4.mp3";
  625. } else if (data.scoreType == @((int) BehaviorScoreType.Negative)) {
  626. style = "text-danger";
  627. url = "/Content/Media/E2.mp3";
  628. } else if (data.scoreType == @((int) BehaviorScoreType.ImportantNegative)) {
  629. style = "text-danger text-bold";
  630. url = "/Content/Media/E6.mp3";
  631. }
  632. //ChangeLog(data.word, style);
  633. PlayAudio(url, data.scoreType);
  634. } catch (e) {
  635. console.log('getMatchSuccess: ', e);
  636. }
  637. }
  638. };
  639. iwbHub.client.getPhoneQuestion = function(msg) {
  640. console.log('getPhoneQuestion: ', msg);
  641. if (msg) {
  642. try {
  643. var data = JSON.parse(msg);
  644. if (!data) {
  645. return;
  646. }
  647. if (@(type) == 1 && data.no=='@(groupNo)') {
  648. ShowPhoneQuestion(data);
  649. };
  650. } catch (e) {
  651. console.log('getPhoneQuestion: ', e);
  652. }
  653. }
  654. };
  655. iwbHub.client.getPhoneQuestionSubmit = function(msg) {
  656. console.log('getPhoneQuestionSubmit: ', msg);
  657. if (msg) {
  658. try {
  659. var data = JSON.parse(msg);
  660. if (!data) {
  661. return;
  662. }
  663. if (@(type) == 1 && data.no=='@(groupNo)') {
  664. clearTimeout(questionTimer);
  665. HidePhoneQuestion(data.no);
  666. };
  667. } catch (e) {
  668. console.log('getPhoneQuestionSubmit: ', e);
  669. }
  670. }
  671. };
  672. </script>
  673. <script>
  674. var et, evList = [];
  675. function Environment(data) {
  676. evList.push(data);
  677. ShowEnvironment();
  678. }
  679. function ShowEnvironment() {
  680. var data = evList[0] ? $.extend({}, evList[0]) : undefined;
  681. console.log(data);
  682. if (!data) {
  683. return;
  684. }
  685. if ($('.environment').length > 0 && $('#ev-' + data.nodePath).length <= 0) {
  686. return;
  687. }
  688. evList.splice(0, 1);
  689. var str = '', str1 = '';
  690. var path = data.resourcePath.indexOf('http') > -1
  691. ? data.resourcePath
  692. : '@(dataCenterUrl)' + data.resourcePath;
  693. switch (data.resourceType) {
  694. case @((int) ResourceType.Image):
  695. str1 = '<img src="{0}" style="" />'.format(path);
  696. break;
  697. case @((int) ResourceType.Audio):
  698. str1 =
  699. '<audio id="audio" style="display:none" controls autoplay><source src="{0}" type="audio/mp3">您的浏览器不支持 HTML5 audio 标签。</audio>'
  700. .format(path);
  701. break;
  702. case @((int) ResourceType.Video):
  703. str1 =
  704. '<video id="video" style="" controls autoplay><source src="{0}" type="video/mp4">您的浏览器不支持 HTML5 video 标签。</video>'
  705. .format(path);
  706. break;
  707. default:
  708. str1 = '';
  709. }
  710. clearTimeout(et);
  711. if ($('#ev-' + data.nodePath).length > 0) {
  712. $('#ev-' + data.nodePath).find('.play-box').append('<div style="width:100% ;height:15px"></div>');
  713. $('#ev-' + data.nodePath).find('.play-box').append(str1);
  714. Scroll2Bottom($('#environment-score'));
  715. } else {
  716. str =
  717. '<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>'
  718. .format(data.nodePath, str1);
  719. $('body').append(str);
  720. OverlayScrollbar($('#environment-score'), { className: "os-theme-thin-light" });
  721. $(".environment").fadeIn(600);
  722. }
  723. et = setTimeout(CloseEnvironment, 1000 * 15);
  724. }
  725. function CloseEnvironment(isAuto) {
  726. isAuto = isAuto == undefined ? true : isAuto;
  727. clearTimeout(et);
  728. $(".environment").fadeOut(300).remove();
  729. if (isAuto) {
  730. ShowEnvironment();
  731. }
  732. }
  733. function PlayAudio(url, type) {
  734. if (!$('#audio-hidden-' + type).length) {
  735. var audio =
  736. '<div id="audio-hidden-{1}" style="display:none"><audio style="" controls autoplay><source src="{0}" type="audio/mpeg">您的浏览器不支持 HTML5 audio 标签。</audio></div>'
  737. .format(url, type);
  738. $('body').append(audio);
  739. setTimeout(function() {$('#audio-hidden-' + type).remove();},20000);
  740. }
  741. }
  742. function ChangeLog(word, style) {
  743. var arr = word.split('|');
  744. var $log = $('#log-box_' + arr[0] + ' .word');
  745. if ($log.length) {
  746. var text = $log.html(), text2 = text;
  747. if (arr[2]) {
  748. var arr2 = arr[2].split(',');
  749. arr2.forEach(function(v) {
  750. var reg = new RegExp(v, "g");
  751. var str = '<span class="{1} ml-1 mr-1">{0}</span>'.format(v, style);
  752. if (text2.indexOf(str) < 0) {
  753. text2 = text2.replace(reg, str);
  754. }
  755. });
  756. $log.html(text2);
  757. if (text != text2) {
  758. $.iwbAjax5({
  759. url: abp.appUrl + 'Eval/UpdateLog',
  760. data: { id: arr[0], Text: text2 }
  761. });
  762. }
  763. }
  764. }
  765. }
  766. </script>
  767. }
  768. }
  769. @using (Html.BeginScripts())
  770. {
  771. <script>
  772. $(function () {
  773. abp.signalr.connect(['@(groupNo)'],function () {
  774. if (@(type) == 1){
  775. setTimeout(function() {
  776. $.iwbAjax5({
  777. url: abp.appUrl + "/Eval/StartFeedback?no=@(groupNo)",
  778. success: function(res) {
  779. if (res) {
  780. window.GetScenes('@(groupNo)');
  781. }
  782. }
  783. });
  784. },500);
  785. }
  786. })
  787. OverlayScrollbar($('.box-body'));
  788. GetLogs('@(groupNo)');
  789. GetRoles('@(groupNo)');
  790. GetScore('@(groupNo)');
  791. PreLoad('@(groupNo)');
  792. if (@(type)!= 1) {
  793. GetScenes('@(groupNo)');
  794. }
  795. });
  796. </script>
  797. }