_Screen.cshtml 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859
  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 = '', 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 = ``;
  407. if (data.extendInfo1) {
  408. var reviews = JSON.parse(data.extendInfo1);
  409. reviews.forEach(v => {
  410. if (v.v > 0) {
  411. switch (v.n) {
  412. case reviewsType1:
  413. str1 = `(<span>${v.v}</span>)`;
  414. break;
  415. case reviewsType2:
  416. str1 = `(<span>${v.v}</span>)`;
  417. break;
  418. }
  419. }
  420. });
  421. }
  422. e = `<span class="reviews-box">
  423. <i class="far fa-thumbs-up" data-type="${reviewsType1}" title="赞" onclick="SendLogReviews(this)">${str1}</i>
  424. <i class="far fa-thumbs-down" data-type="${reviewsType2}" title="踩" onclick="SendLogReviews(this)">${str2}</i>
  425. </span>`;
  426. </text>
  427. }
  428. }
  429. var str =
  430. `<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>`;
  431. return str;
  432. }
  433. @if (type == 2)
  434. {
  435. <text>
  436. function SendLogReviews(_this) {
  437. var $this = $(_this), type = $this.data('type'), id = $this.closest('.log-box').data('id');
  438. $.iwbAjax4({
  439. url: abp.appUrl + "eval/SendLogReviews",
  440. data: { id: id, reviewsType: type },
  441. success: function (res) {
  442. $this.removeClass('far').addClass("fas");
  443. $this.html(`(<span>${res}</span>)`);
  444. }
  445. });
  446. }
  447. </text>
  448. }
  449. </script>
  450. <script id="role-s">
  451. function GetRoles(no) {
  452. $.iwbAjax5({
  453. url: abp.appUrl + 'Query/GetGroupRoleInfos?no=' + no,
  454. success: function (res) {
  455. if (res) {
  456. FormatterRole(res, no);
  457. }
  458. }
  459. });
  460. }
  461. function FormatterRole(data, no) {
  462. var str = "";
  463. if (data && data.length > 0) {
  464. data.forEach(function (v) {
  465. str += '<div class="role">{0}</div>'.format(v);
  466. });
  467. if (data.length % 2 == 1) {
  468. str += '<div class="role" style="visibility: hidden;"></div>'
  469. }
  470. }
  471. if (str) {
  472. $('#role_' + no + ' .box-body .body-content').html(`<div class="role-box">${str}</div>`);
  473. }
  474. }
  475. </script>
  476. <script id="score-s">
  477. function GetScore(no) {
  478. $.iwbAjax5({
  479. url: abp.appUrl + 'Query/GetGroupScoreInfo?no=' + no,
  480. success: function (res) {
  481. if (res) {
  482. res.systemScore = undefined;
  483. FormatterScore(res, no);
  484. }
  485. }
  486. });
  487. }
  488. // ' '
  489. function FormatterScore(data, no) {
  490. var str = "",
  491. template =
  492. '<div class="score-box {2}"><span class="name">{0}</span><span class="score">{1}<span>分</span></span></div>';
  493. if (data.systemScore) {
  494. str += template.format("系统评分", data.systemScore, "system-score");
  495. }
  496. var tags = data.behaviorTagScoreInfo ? JSON.parse(data.behaviorTagScoreInfo) : data.tagScores;
  497. if (tags && tags.length > 0) {
  498. tags.forEach(function (v) {
  499. var score = v.correctionScore ? v.correctionScore : v.systemScore;
  500. if (score > 0) {
  501. str += template.format(v.tagNo, score, "tag-score");
  502. }
  503. });
  504. }
  505. if (str) {
  506. $('#score_' + no + ' .box-body .body-content').prepend(str);
  507. }
  508. }
  509. </script>
  510. <script id="hub-s">
  511. iwbHub.client.getReloadAll = function(msg) {
  512. console.log('getReloadAll: ', msg);
  513. if (msg) {
  514. try {
  515. var data = JSON.parse(msg);
  516. if (data) {
  517. if (data.no == '@(groupNo)' || data.no == '@(campNo)') {
  518. window.location.reload();
  519. }
  520. }
  521. } catch (e) {
  522. console.log('getReloadAll: ', e);
  523. }
  524. }
  525. };
  526. iwbHub.client.getOperationLog = function(msg) {
  527. console.log('getOperationLog: ', msg);
  528. if (msg) {
  529. try {
  530. var data = JSON.parse(msg);
  531. if (@(type) == 2 || data.no=='@(groupNo)') {
  532. var str = FormatLog(data);
  533. $('#log_' + data.no + ' .box-body .body-content').prepend(str);
  534. }
  535. } catch (e) {
  536. console.log('getOperationLog: ', e);
  537. }
  538. }
  539. };
  540. iwbHub.client.getOperationLogSubmit = function(msg) {
  541. console.log('getOperationLogSubmit: ', msg);
  542. if (msg) {
  543. try {
  544. var data = JSON.parse(msg);
  545. @if (type == 2)
  546. {
  547. <text>
  548. $('#log_' + data.no + ' .box-body .body-content').find('.log_' + data.logId).addClass('send').append(`<span class="reviews-box">
  549. <i class="far fa-thumbs-up" data-type="${reviewsType1}" title="赞" onclick="SendLogReviews(this)"></i>
  550. <i class="far fa-thumbs-down" data-type="${reviewsType2}" title="踩" onclick="SendLogReviews(this)"></i>
  551. </span>`);
  552. </text>
  553. }
  554. else
  555. {
  556. <text>
  557. if (data.no=='@(groupNo)') {
  558. $('#log_' + data.no + ' .box-body .body-content').find('.log_' + data.logId).addClass('send');
  559. }
  560. </text>
  561. }
  562. } catch (e) {
  563. console.log('getOperationLogSubmit: ', e);
  564. }
  565. }
  566. };
  567. iwbHub.client.getNewScene = function(msg) {
  568. console.log('getNewScene: ', msg);
  569. if (msg) {
  570. try {
  571. var data = typeof msg == 'string' ? JSON.parse(msg) : msg;
  572. if (data) {
  573. if (@(type) == 2 || data.no == '@(groupNo)') {
  574. if ($('#scene_' + data.no).find('.scene-box[data-path="' + data.path + '"]').length <= 0) {
  575. GetSceneInfo(data.no, data.sceneNo);
  576. }
  577. }
  578. }
  579. } catch (e) {
  580. console.log('getNewScene: ', e);
  581. }
  582. }
  583. };
  584. iwbHub.client.getRoundScore = function(msg) {
  585. console.log('getRoundScore: ', msg);
  586. if (msg) {
  587. try {
  588. var data = JSON.parse(msg);
  589. if (@(type) == 2 || data.no=='@(groupNo)') {
  590. data.systemScore = undefined;
  591. FormatterScore(data, data.no);
  592. };
  593. } catch (e) {
  594. console.log('getRoundScore: ', e);
  595. }
  596. }
  597. };
  598. iwbHub.client.getSendScore = function(msg) {
  599. console.log('getSendScore: ', msg);
  600. if (msg) {
  601. try {
  602. var data = JSON.parse(msg);
  603. if (@(type) == 2 || data.no=='@(groupNo)') {
  604. FormatterScore(data, data.no);
  605. };
  606. } catch (e) {
  607. console.log('getSendScore: ', e);
  608. }
  609. }
  610. };
  611. iwbHub.client.getDisabledScene = function(msg) {
  612. console.log('getDisabledScene: ', msg);
  613. if (msg) {
  614. try {
  615. //var data = JSON.parse(msg);
  616. if (@(type) == 2 || msg == '@(groupNo)') {
  617. DisabledScene1(msg);
  618. }
  619. } catch (e) {
  620. console.log('getDisabledScene: ', e);
  621. }
  622. }
  623. }
  624. iwbHub.client.getMatchSuccess = function(msg) {
  625. console.log('getMatchSuccess: ', msg);
  626. if (msg) {
  627. try {
  628. var data = JSON.parse(msg);
  629. if (!data) {
  630. return;
  631. }
  632. var url = "", style = "";
  633. if (data.scoreType == @((int) BehaviorScoreType.Normal)) {
  634. style = "text-success";
  635. url = "/Content/Media/S4.mp3";
  636. } else if (data.scoreType == @((int) BehaviorScoreType.Negative)) {
  637. style = "text-danger";
  638. url = "/Content/Media/E2.mp3";
  639. } else if (data.scoreType == @((int) BehaviorScoreType.ImportantNegative)) {
  640. style = "text-danger text-bold";
  641. url = "/Content/Media/E6.mp3";
  642. }
  643. //ChangeLog(data.word, style);
  644. PlayAudio(url, data.scoreType);
  645. } catch (e) {
  646. console.log('getMatchSuccess: ', e);
  647. }
  648. }
  649. };
  650. iwbHub.client.getPhoneQuestion = function(msg) {
  651. console.log('getPhoneQuestion: ', msg);
  652. if (msg) {
  653. try {
  654. var data = JSON.parse(msg);
  655. if (!data) {
  656. return;
  657. }
  658. if (@(type) == 1 && data.no=='@(groupNo)') {
  659. ShowPhoneQuestion(data);
  660. };
  661. } catch (e) {
  662. console.log('getPhoneQuestion: ', e);
  663. }
  664. }
  665. };
  666. iwbHub.client.getPhoneQuestionSubmit = function(msg) {
  667. console.log('getPhoneQuestionSubmit: ', msg);
  668. if (msg) {
  669. try {
  670. var data = JSON.parse(msg);
  671. if (!data) {
  672. return;
  673. }
  674. if (@(type) == 1 && data.no=='@(groupNo)') {
  675. clearTimeout(questionTimer);
  676. HidePhoneQuestion(data.no);
  677. };
  678. } catch (e) {
  679. console.log('getPhoneQuestionSubmit: ', e);
  680. }
  681. }
  682. };
  683. </script>
  684. <script>
  685. var et, evList = [];
  686. function Environment(data) {
  687. evList.push(data);
  688. ShowEnvironment();
  689. }
  690. function ShowEnvironment() {
  691. var data = evList[0] ? $.extend({}, evList[0]) : undefined;
  692. console.log(data);
  693. if (!data) {
  694. return;
  695. }
  696. if ($('.environment').length > 0 && $('#ev-' + data.nodePath).length <= 0) {
  697. return;
  698. }
  699. evList.splice(0, 1);
  700. var str = '', str1 = '';
  701. var path = data.resourcePath.indexOf('http') > -1
  702. ? data.resourcePath
  703. : '@(dataCenterUrl)' + data.resourcePath;
  704. switch (data.resourceType) {
  705. case @((int) ResourceType.Image):
  706. str1 = '<img src="{0}" style="" />'.format(path);
  707. break;
  708. case @((int) ResourceType.Audio):
  709. str1 =
  710. '<audio id="audio" style="display:none" controls autoplay><source src="{0}" type="audio/mp3">您的浏览器不支持 HTML5 audio 标签。</audio>'
  711. .format(path);
  712. break;
  713. case @((int) ResourceType.Video):
  714. str1 =
  715. '<video id="video" style="" controls autoplay><source src="{0}" type="video/mp4">您的浏览器不支持 HTML5 video 标签。</video>'
  716. .format(path);
  717. break;
  718. default:
  719. str1 = '';
  720. }
  721. clearTimeout(et);
  722. if ($('#ev-' + data.nodePath).length > 0) {
  723. $('#ev-' + data.nodePath).find('.play-box').append('<div style="width:100% ;height:15px"></div>');
  724. $('#ev-' + data.nodePath).find('.play-box').append(str1);
  725. Scroll2Bottom($('#environment-score'));
  726. } else {
  727. str =
  728. '<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>'
  729. .format(data.nodePath, str1);
  730. $('body').append(str);
  731. OverlayScrollbar($('#environment-score'), { className: "os-theme-thin-light" });
  732. $(".environment").fadeIn(600);
  733. }
  734. et = setTimeout(CloseEnvironment, 1000 * 15);
  735. }
  736. function CloseEnvironment(isAuto) {
  737. isAuto = isAuto == undefined ? true : isAuto;
  738. clearTimeout(et);
  739. $(".environment").fadeOut(300).remove();
  740. if (isAuto) {
  741. ShowEnvironment();
  742. }
  743. }
  744. function PlayAudio(url, type) {
  745. if (!$('#audio-hidden-' + type).length) {
  746. var audio =
  747. '<div id="audio-hidden-{1}" style="display:none"><audio style="" controls autoplay><source src="{0}" type="audio/mpeg">您的浏览器不支持 HTML5 audio 标签。</audio></div>'
  748. .format(url, type);
  749. $('body').append(audio);
  750. setTimeout(function() {$('#audio-hidden-' + type).remove();},20000);
  751. }
  752. }
  753. function ChangeLog(word, style) {
  754. var arr = word.split('|');
  755. var $log = $('#log-box_' + arr[0] + ' .word');
  756. if ($log.length) {
  757. var text = $log.html(), text2 = text;
  758. if (arr[2]) {
  759. var arr2 = arr[2].split(',');
  760. arr2.forEach(function(v) {
  761. var reg = new RegExp(v, "g");
  762. var str = '<span class="{1} ml-1 mr-1">{0}</span>'.format(v, style);
  763. if (text2.indexOf(str) < 0) {
  764. text2 = text2.replace(reg, str);
  765. }
  766. });
  767. $log.html(text2);
  768. if (text != text2) {
  769. $.iwbAjax5({
  770. url: abp.appUrl + 'Eval/UpdateLog',
  771. data: { id: arr[0], Text: text2 }
  772. });
  773. }
  774. }
  775. }
  776. }
  777. </script>
  778. }
  779. }
  780. @using (Html.BeginScripts())
  781. {
  782. <script>
  783. $(function () {
  784. abp.signalr.connect(['@(groupNo)'],function () {
  785. if (@(type) == 1){
  786. setTimeout(function() {
  787. $.iwbAjax5({
  788. url: abp.appUrl + "/Eval/StartFeedback?no=@(groupNo)",
  789. success: function(res) {
  790. if (res) {
  791. window.GetScenes('@(groupNo)');
  792. }
  793. }
  794. });
  795. },500);
  796. }
  797. })
  798. OverlayScrollbar($('.box-body'));
  799. GetLogs('@(groupNo)');
  800. GetRoles('@(groupNo)');
  801. GetScore('@(groupNo)');
  802. PreLoad('@(groupNo)');
  803. if (@(type)!= 1) {
  804. GetScenes('@(groupNo)');
  805. }
  806. });
  807. </script>
  808. }