Specialist.cshtml 11 KB

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