Enter2.cshtml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. @using WeApp.TrainingCampGroup.Dto
  2. @{
  3. Layout = "~/Views/Shared/Layout/_Layout.Stu.cshtml";
  4. CampGroupDto group = ViewBag.Group;
  5. bool isLeader = ViewBag.IsLeader;
  6. string id = group.Id,
  7. campNo = group.CampNo,
  8. disabled1 = isLeader ? "" : "disabled",
  9. disabled2 = isLeader ? "disabled" : "";
  10. var name = isLeader ? "指挥长" : "学员";
  11. ViewBag.Title = name + "屏(" + group.Name + ")";
  12. }
  13. @section css{
  14. <style>
  15. body {
  16. /*background-image: url('../../Content/Image/Stu/bg-lg-1.png');*/
  17. background-image: linear-gradient(45deg,#005f61,#007f61);
  18. }
  19. .btn-box {
  20. margin: 10% auto 0;
  21. width: 40%;
  22. padding: 10px;
  23. }
  24. </style>
  25. }
  26. <div class="btn-box" style="">
  27. <button id="" @(disabled1) class="btn btn-dl btn-block" type="button" onclick="Go(true)" style="font-size: 30px; font-weight: 600; padding: 15px 30px;">指挥长</button>
  28. <button id="" @(disabled2) class="btn btn-dl btn-block " type="button" onclick="Go(false)" style="font-size: 30px; font-weight: 600; padding: 15px 30px; margin-top: 40px">组员</button>
  29. </div>
  30. @section scripts
  31. {
  32. <script>
  33. abp.signalr.connect(['@(id)','@(campNo)']);
  34. var state = 0;
  35. function Go(isLeader) {
  36. if (state) {
  37. window.location.href = isLeader ? "/Exercise/HeadquarterLeader" : "/Exercise/HeadquarterStu";
  38. } else {
  39. abp.message.warn("演练还未开始,请稍后再试!");
  40. }
  41. }
  42. </script>
  43. <script id="hub">
  44. abp.signalr.connect(['@(id)','@(campNo)']);
  45. iwbHub.client.getReloadAll = function (msg) {
  46. console.log('getReloadAll: ', msg);
  47. if (msg) {
  48. try {
  49. var data = JSON.parse(msg);
  50. if (data) {
  51. if (data.no == '@(id)'|| data.no == '@(campNo)') {
  52. window.location.reload();
  53. }
  54. }
  55. } catch (e) {
  56. console.log('getReloadAll: ', e);
  57. }
  58. }
  59. };
  60. @if (isLeader)
  61. {
  62. <text>
  63. iwbHub.client.getReloadLeader = function (msg) {
  64. console.log('getReloadLeader: ', msg);
  65. if (msg) {
  66. try {
  67. var data = JSON.parse(msg);
  68. if (data) {
  69. if (data.no == '@(id)'|| data.no == '@(campNo)') {
  70. window.location.reload();
  71. }
  72. }
  73. } catch (e) {
  74. console.log('getReloadLeader: ', e);
  75. }
  76. }
  77. };
  78. </text>
  79. }
  80. else
  81. {
  82. <text>
  83. iwbHub.client.getReloadStu = function (msg) {
  84. console.log('getReloadStu: ', msg);
  85. if (msg) {
  86. try {
  87. var data = JSON.parse(msg);
  88. if (data) {
  89. if (data.no == '@(id)'|| data.no == '@(campNo)') {
  90. window.location.reload();
  91. }
  92. }
  93. } catch (e) {
  94. console.log('getReloadStu: ', e);
  95. }
  96. }
  97. };
  98. </text>
  99. }
  100. </script>
  101. }