_Screen.cshtml 36 KB

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