Specialist.cshtml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. @using WeApp.TrainingCamp.Dto
  2. @using WeApp.TrainingCampGroup.Dto
  3. @using WeApp.Views.ExerciseV2
  4. @{
  5. Layout = "~/Views/Shared/Layout/_Layout.Spec.cshtml";
  6. CampDto camp = ViewBag.Camp;
  7. ViewBag.Title = "专家屏(" + camp.Name + ")";
  8. List<CampGroupDto> groups = ViewBag.Groups;
  9. string id = camp.Id;
  10. string groupSelects = "<option value=\"\">请选择培训营分组...</option>";
  11. string groupNos = "['" + id + "'";
  12. if (groups != null && groups.Any())
  13. {
  14. foreach (var g in groups)
  15. {
  16. groupSelects += "<option value=\"" + g.Id + "\">" + g.Name + "</option>";
  17. groupNos += ",'" + g.Id + "'";
  18. }
  19. }
  20. groupNos += "]";
  21. }
  22. <style>
  23. body {
  24. height: 100vh;
  25. }
  26. .main-box {
  27. margin: 0 !important;
  28. }
  29. .btn-box {
  30. position: absolute;
  31. top: 15px;
  32. left: 50px;
  33. }
  34. .btn-box .vb-btn {
  35. padding: 8px 20px;
  36. font-size: 16px;
  37. }
  38. .carousel {
  39. display: flex;
  40. flex-direction: column;
  41. }
  42. .carousel-indicators {
  43. margin: 0;
  44. z-index: 10;
  45. position: relative;
  46. top: auto;
  47. bottom: auto;
  48. left: auto;
  49. right: auto;
  50. align-items: flex-end;
  51. }
  52. .carousel-indicators li {
  53. color: #fff;
  54. height: 100%;
  55. width: auto;
  56. text-indent: 0;
  57. background: none;
  58. border-radius: 0;
  59. margin: 0;
  60. padding: 0;
  61. border: none;
  62. position: relative;
  63. display: none;
  64. cursor: default;
  65. }
  66. .carousel-indicators li.active {
  67. display: flex;
  68. font-size: 100%;
  69. display: flex;
  70. margin: 0;
  71. padding: 0;
  72. border: none;
  73. }
  74. .carousel-indicators li img {
  75. cursor: pointer;
  76. position: absolute;
  77. width: 40px;
  78. right: -50px;
  79. top: 50%;
  80. transform: translateY(-50%);
  81. }
  82. .groups {
  83. position: absolute;
  84. left: 50%;
  85. transform: translateX(-50%);
  86. top: 100%;
  87. width: 300px;
  88. padding: 5px 0;
  89. display: none;
  90. flex-direction: column;
  91. background: #fff;
  92. border: 1px solid rgba(255, 255, 255, 0.2);
  93. border-radius: 8px;
  94. z-index: 10;
  95. }
  96. .groups .group {
  97. font-size: 16px;
  98. padding: 10px;
  99. color: #36536D;
  100. font-weight: 400;
  101. cursor: pointer;
  102. }
  103. .groups .group.active {
  104. background: rgba(9, 75, 136, 0.1);
  105. }
  106. .groups .group:hover {
  107. font-weight: 600;
  108. }
  109. .carousel-inner {
  110. width: 100%;
  111. }
  112. .carousel, .carousel-inner, .carousel-item {
  113. position: unset;
  114. padding: 0 10px;
  115. }
  116. </style>
  117. @Html.Partial("Layout/V2/_Bg", false)
  118. <div class="main-box box">
  119. <div class="btn-box">
  120. <span onclick="Carousel(this)" class="vb-btn active" style="margin-right: 15px;">停止轮播</span>
  121. <span onclick="ScenePath()" class="vb-btn" style="margin-right: 15px;">情景路径</span>
  122. <span onclick="Reviews()" class="vb-btn" style="margin-right: 15px;">我要点评</span>
  123. </div>
  124. @if (groups != null)
  125. {
  126. <div id="Carousel" class="carousel slide" data-ride="carousel" data-pause="false" data-interval="30000" style="width: 100%; height: 100%;">
  127. <div id="bg_title">
  128. <ol class="carousel-indicators">
  129. @{
  130. int i = 0;
  131. string active;
  132. foreach (var group in groups)
  133. {
  134. active = i == 0 ? "active" : "";
  135. <li data-target="#Carousel" data-slide-to="@(i)" class="@(active)" data-id="@(group.Id)">
  136. @(group.Name)
  137. <img src="/Content/Image/ExerciseV2/toggle.svg" alt="" onclick="$('.groups .group').removeClass('active'); $('.groups').css('display','flex').find('#ci_group_@(group.Id)').addClass('active')"/>
  138. </li>
  139. i++;
  140. }
  141. }
  142. <div class="groups">
  143. @{
  144. i = 0;
  145. foreach (var group in groups)
  146. {
  147. active = i == 0 ? "active" : "";
  148. <div id="ci_group_@(group.Id)" data-target="#Carousel" data-slide-to="@(i)" class="group @(active)" data-id="@(group.Id)" onclick="$('.groups').css('display', 'none')">
  149. @(group.Name)
  150. </div>
  151. i++;
  152. }
  153. }
  154. </div>
  155. </ol>
  156. </div>
  157. <div class="carousel-inner">
  158. @{
  159. i = 0;
  160. foreach (var g in groups)
  161. {
  162. active = i == 0 ? "active" : "";
  163. <div class="carousel-item @(active)" style="height: 100%; width: 100%;" data-id="@(g.Id)">
  164. @{
  165. var model = new ScreenModel(2, g.Id, id, i == 0);
  166. <div style="display: flex; width: 100%; height: 100%;">
  167. @Html.Partial("_Screen", model)
  168. </div>
  169. }
  170. </div>
  171. i++;
  172. }
  173. }
  174. </div>
  175. </div>
  176. }
  177. </div>
  178. @section scripts
  179. {
  180. <script src="~/Content/Js/scene-path.js"></script>
  181. <script>
  182. $(function () {
  183. resizeHeight_Screen();
  184. window.addEventListener('resize', resizeHeight_Screen);
  185. @if (groups != null && groups.Any())
  186. {
  187. <text>
  188. $("#Carousel").on("slide.bs.carousel",
  189. function(e) {
  190. //console.log(e)
  191. var no = $(e.relatedTarget).data('id');
  192. console.log(no, $("#ci_group_" + no));
  193. //window.Scroll2Bottom($('#scene_' + no + ' .box-body'));
  194. $(".media-box .body-content").each(function() {
  195. $(this).html('<span>播放区</span>');
  196. });
  197. $('#scene_' + no + ' .box-body .body-content').find('.flash-scene')
  198. .removeClass('flash-scene');
  199. $('#scene_' + no + ' .box-body .body-content').find('.current-scene')
  200. .removeClass('current-scene');
  201. });
  202. </text>
  203. }
  204. });
  205. function resizeHeight_Screen() {
  206. resizeHeight((h, wh) => {
  207. $(".main-box .carousel-inner").height(wh - h - 30).css("marginTop", "-20px");
  208. })
  209. }
  210. function Carousel(that) {
  211. var $that = $(that);
  212. if ($that.hasClass("active")) {
  213. console.log('pause');
  214. $("#Carousel").carousel('pause');
  215. $that.removeClass("active").text('开始轮播');
  216. } else {
  217. console.log('cycle');
  218. $("#Carousel").carousel('cycle');
  219. $("#Carousel").carousel('next');
  220. $that.addClass("active").text('停止轮播');
  221. }
  222. }
  223. function ScenePath() {
  224. $.iwbAjax4({
  225. url: abp.appUrl + 'Query/GetCampRunningInfos?no=@(id)',
  226. success: function(res) {
  227. if (res) {
  228. var str = FormatterScenePath(res);
  229. if (str) {
  230. str = '<div class="modal-body" style="height:800px;padding:0;">{0}</div>'.format(str);
  231. $(document).iwbModal('create',
  232. {
  233. modal: 'modal-scene-path',
  234. modaltitle: '情景路径详情',
  235. modalFooter: '<div class="modal-footer" style="text-align: center;"><button type="button" class="btn btn-sm btn-outline-iwb waves-effect" data-dismiss="modal" style="min-width:100px;">取消</button></div>',
  236. width: 1000,
  237. modalBody: str,
  238. topHeight:10,
  239. save: function() {
  240. $('#modal-scene-path').modal('hide');
  241. }
  242. });
  243. } else {
  244. abp.message.warn("未查询到情景信息!");
  245. }
  246. } else {
  247. abp.message.warn("未查询到情景信息!");
  248. }
  249. }
  250. });
  251. }
  252. function Reviews() {
  253. var str = '<div class="modal-body" style="padding:20;"><div class="form-group"><select id="group" class="form-control" style="width: 100%">@Html.Raw(groupSelects)</select></div><div class="form-group"><textarea id="txt" class="form-control" style="width: 100%; height: 150px;border: 1px solid #aaa;" placeholder="请输入点评内容..."></textarea></div></div>';
  254. $(document).iwbModal('create',
  255. {
  256. modal: 'modal-reviews',
  257. modaltitle: '专家点评',
  258. modalSize: 'modal-lg',
  259. modalBody: str,
  260. data: null,
  261. shownAfter: function () {
  262. var $modal = $("#modal-reviews");
  263. $modal.css('display', 'block');
  264. var topHeight = $(window).height() - $modal.find('.modal-dialog').height() - 150;
  265. if (topHeight < 50) {
  266. topHeight = 50;
  267. }
  268. $modal.find('.modal-dialog').animate({ 'marginTop': topHeight / 2 + "px" });
  269. },
  270. save: function () {
  271. var no = $("#modal-reviews #group").val();
  272. if (!no) {
  273. abp.message.warn("请选择一个培训营分组!");
  274. return;
  275. }
  276. var txt = $("#modal-reviews #txt").val();
  277. if (!txt) {
  278. abp.message.warn("请输入内容!");
  279. return;
  280. }
  281. $.iwbAjax1({
  282. url: abp.appUrl + "Eval/ZhuanJiaLog",
  283. data: { no: no, msg: txt },
  284. success: function () {
  285. $("#txt").val("");
  286. }
  287. });
  288. //$('#modal-reviews').modal('hide');
  289. }
  290. });
  291. }
  292. iwbHub.client.getReloadAll = function (msg) {
  293. console.log('getReloadAll: ', msg);
  294. if (msg) {
  295. try {
  296. var data = JSON.parse(msg);
  297. if (data) {
  298. if (data.no == '@(id)') {
  299. window.location.reload();
  300. }
  301. }
  302. } catch (e) {
  303. console.log('getReloadAll: ', e);
  304. }
  305. }
  306. };
  307. iwbHub.client.getReloadSpec = function(msg) {
  308. console.log('getReloadSpec: ', msg);
  309. if (msg) {
  310. try {
  311. var data = JSON.parse(msg);
  312. if (data) {
  313. //if (data.no == '@(id)'||@(groupNos).indexOf(data.no)>=0) {
  314. if (data.no == '@(id)') {
  315. window.location.reload();
  316. }
  317. }
  318. } catch (e) {
  319. console.log('getReloadSpec: ', e);
  320. }
  321. }
  322. };
  323. iwbHub.client.getGroupRole = function(msg) {
  324. console.log('getGroupRole: ', msg);
  325. if (msg) {
  326. try {
  327. var data = JSON.parse(msg);
  328. if (data) {
  329. if (@(Html.Raw(groupNos)).indexOf(data.no) >= 0) {
  330. window.GetRoles(data.no);
  331. }
  332. }
  333. } catch (e) {
  334. console.log('getGroupRole: ', e);
  335. }
  336. }
  337. };
  338. </script>
  339. }