Specialist.cshtml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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: 0;
  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. display: flex;
  55. height: 100%;
  56. width: auto;
  57. text-indent: 0;
  58. background: none;
  59. border-radius: 0;
  60. margin: 0;
  61. padding: 0;
  62. border: none;
  63. font-size: 60%;
  64. margin: 0 25px
  65. }
  66. .carousel-indicators li.active {
  67. font-size: 100%;
  68. display: flex;
  69. margin: 0;
  70. padding: 0;
  71. border: none;
  72. }
  73. .carousel-inner {
  74. width: 100%;
  75. }
  76. .carousel, .carousel-inner, .carousel-item {
  77. position: unset;
  78. padding: 0 10px;
  79. }
  80. .select2-container {
  81. color: #36536D;
  82. }
  83. .select2-container .select2-selection--single {
  84. height: 38px;
  85. }
  86. .select2-container--default .select2-selection--single .select2-selection__arrow {
  87. top: 6px;
  88. }
  89. </style>
  90. @Html.Partial("Layout/V2/_Bg", false)
  91. <div class="main-box box">
  92. <div class="btn-box">
  93. <span onclick="Carousel(this)" class="vb-btn active" style="margin-right: 15px;">停止轮播</span>
  94. <span onclick="ScenePath()" class="vb-btn" style="margin-right: 15px;">情景路径</span>
  95. <span onclick="Reviews()" class="vb-btn" style="margin-right: 15px;">我要点评</span>
  96. </div>
  97. @if (groups != null)
  98. {
  99. <div id="Carousel" class="carousel slide" data-ride="carousel" data-pause="false" data-interval="30000" style="width: 100%; height: 100%;">
  100. <div id="bg_title">
  101. <ol class="carousel-indicators">
  102. @{
  103. int i = 0;
  104. string active;
  105. foreach (var group in groups)
  106. {
  107. active = i == 0 ? "active" : "";
  108. <li data-target="#Carousel" data-slide-to="@(i)" class="@(active)" data-id="@(group.Id)">@(group.Name)</li>
  109. i++;
  110. }
  111. }
  112. </ol>
  113. </div>
  114. <div class="carousel-inner">
  115. @{
  116. i = 0;
  117. foreach (var g in groups)
  118. {
  119. active = i == 0 ? "active" : "";
  120. <div class="carousel-item @(active)" style="height: 100%; width: 100%;" data-id="@(g.Id)">
  121. @{
  122. var model = new ScreenModel(2, g.Id, id, i == 0);
  123. <div style="display: flex; width: 100%; height: 100%;">
  124. @Html.Partial("_Screen", model)
  125. </div>
  126. }
  127. </div>
  128. i++;
  129. }
  130. }
  131. </div>
  132. </div>
  133. }
  134. </div>
  135. @section scripts
  136. {
  137. <script src="~/Content/Js/scene-path.js"></script>
  138. <script>
  139. $(function () {
  140. resizeHeight_Screen();
  141. window.addEventListener('resize', resizeHeight_Screen);
  142. @if (groups != null && groups.Any())
  143. {
  144. <text>
  145. $("#Carousel").on("slide.bs.carousel",
  146. function(e) {
  147. //console.log(e)
  148. var no = $(e.relatedTarget).data('id');
  149. //console.log(no);
  150. //window.Scroll2Bottom($('#scene_' + no + ' .box-body'));
  151. $(".media-box .body-content").each(function() {
  152. $(this).html('<span>播放区</span>');
  153. });
  154. $('#scene_' + no + ' .box-body .body-content').find('.flash-scene')
  155. .removeClass('flash-scene');
  156. $('#scene_' + no + ' .box-body .body-content').find('.current-scene')
  157. .removeClass('current-scene');
  158. });
  159. </text>
  160. }
  161. });
  162. function resizeHeight_Screen() {
  163. resizeHeight((h, wh) => {
  164. $(".main-box .carousel-inner").height(wh - h - 30).css("marginTop", "-20px");
  165. })
  166. }
  167. function Carousel(that) {
  168. var $that = $(that);
  169. if ($that.hasClass("active")) {
  170. console.log('pause');
  171. $("#Carousel").carousel('pause');
  172. $that.removeClass("active").text('开始轮播');
  173. } else {
  174. console.log('cycle');
  175. $("#Carousel").carousel('cycle');
  176. $("#Carousel").carousel('next');
  177. $that.addClass("active").text('停止轮播');
  178. }
  179. }
  180. function ScenePath() {
  181. $.iwbAjax4({
  182. url: abp.appUrl + 'Query/GetCampRunningInfos?no=@(id)',
  183. success: function(res) {
  184. if (res) {
  185. var str = FormatterScenePath(res);
  186. if (str) {
  187. str = '<div class="modal-body" style="height:800px;padding:0;">{0}</div>'.format(str);
  188. $(document).iwbModal('create',
  189. {
  190. modal: 'modal-scene-path',
  191. modaltitle: '情景路径详情',
  192. 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>',
  193. width: 1000,
  194. modalBody: str,
  195. topHeight:10,
  196. save: function() {
  197. $('#modal-scene-path').modal('hide');
  198. }
  199. });
  200. } else {
  201. abp.message.warn("未查询到情景信息!");
  202. }
  203. } else {
  204. abp.message.warn("未查询到情景信息!");
  205. }
  206. }
  207. });
  208. }
  209. function Reviews() {
  210. 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>';
  211. $(document).iwbModal('create',
  212. {
  213. modal: 'modal-reviews',
  214. modaltitle: '专家点评',
  215. modalSize: 'modal-lg',
  216. modalBody: str,
  217. data: null,
  218. shownAfter: function () {
  219. var $modal = $("#modal-reviews");
  220. $modal.css('display', 'block');
  221. var topHeight = $(window).height() - $modal.find('.modal-dialog').height() - 150;
  222. if (topHeight < 50) {
  223. topHeight = 50;
  224. }
  225. $modal.find('.modal-dialog').animate({ 'marginTop': topHeight / 2 + "px" });
  226. },
  227. save: function () {
  228. var no = $("#modal-reviews #group").val();
  229. if (!no) {
  230. abp.message.warn("请选择一个培训营分组!");
  231. return;
  232. }
  233. var txt = $("#modal-reviews #txt").val();
  234. if (!txt) {
  235. abp.message.warn("请输入内容!");
  236. return;
  237. }
  238. $.iwbAjax1({
  239. url: abp.appUrl + "Eval/ZhuanJiaLog",
  240. data: { no: no, msg: txt },
  241. success: function () {
  242. $("#txt").val("");
  243. }
  244. });
  245. //$('#modal-reviews').modal('hide');
  246. }
  247. });
  248. }
  249. iwbHub.client.getReloadAll = function (msg) {
  250. console.log('getReloadAll: ', msg);
  251. if (msg) {
  252. try {
  253. var data = JSON.parse(msg);
  254. if (data) {
  255. if (data.no == '@(id)') {
  256. window.location.reload();
  257. }
  258. }
  259. } catch (e) {
  260. console.log('getReloadAll: ', e);
  261. }
  262. }
  263. };
  264. iwbHub.client.getReloadSpec = function(msg) {
  265. console.log('getReloadSpec: ', msg);
  266. if (msg) {
  267. try {
  268. var data = JSON.parse(msg);
  269. if (data) {
  270. //if (data.no == '@(id)'||@(groupNos).indexOf(data.no)>=0) {
  271. if (data.no == '@(id)') {
  272. window.location.reload();
  273. }
  274. }
  275. } catch (e) {
  276. console.log('getReloadSpec: ', e);
  277. }
  278. }
  279. };
  280. iwbHub.client.getGroupRole = function(msg) {
  281. console.log('getGroupRole: ', msg);
  282. if (msg) {
  283. try {
  284. var data = JSON.parse(msg);
  285. if (data) {
  286. if (@(Html.Raw(groupNos)).indexOf(data.no) >= 0) {
  287. window.GetRoles(data.no);
  288. }
  289. }
  290. } catch (e) {
  291. console.log('getGroupRole: ', e);
  292. }
  293. }
  294. };
  295. </script>
  296. }