PlayList - 复制.cshtml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. 
  2. @{
  3. Layout = "~/Views/Shared/Layout/_Layout.Play.cshtml";
  4. ViewBag.PageId = "start";
  5. ViewBag.Title = "创建演练";
  6. }
  7. <style>
  8. .header {
  9. width: 100%;
  10. font-size: 24px;
  11. font-weight: 600;
  12. padding: 8px 20px;
  13. color: #008b8b;
  14. border-bottom: 3px solid #008b8b;
  15. margin-bottom: 10px;
  16. }
  17. .no-data {
  18. display: flex;
  19. color: #ff4500;
  20. font-size: 26px;
  21. font-weight: 600;
  22. width: 100%;
  23. height: 150px;
  24. justify-content: center;
  25. align-items: center;
  26. }
  27. .tool-box {
  28. padding: 0 0 5px;
  29. display: flex;
  30. width: 100%;
  31. }
  32. .tool-box span {
  33. text-align: center;
  34. width: 50%;
  35. padding: 5px;
  36. cursor: pointer;
  37. background: #000000;
  38. background: rgba(0,0,0,0.3);
  39. border: 1px solid #ddd;
  40. }
  41. .tool-box span:hover {
  42. background: #000000;
  43. background: rgba(0,0,0,0.4);
  44. }
  45. </style>
  46. <div style="padding: 15px 30px;">
  47. <div class="row">
  48. <div class="header">可用培训营</div>
  49. </div>
  50. <div class="row" id="use-camp">
  51. </div>
  52. <div class="row">
  53. <div class="header">等待加入的演练</div>
  54. </div>
  55. <div class="row" id="join-camp">
  56. </div>
  57. </div>
  58. @section scripts
  59. {
  60. <script>
  61. $(function () {
  62. GetCanUseCamp();
  63. GetCanJoinCamp();
  64. });
  65. function GetCanUseCamp() {
  66. $.iwbAjax4({
  67. url: abp.appUrl + 'Query/QueryCanUseCamp',
  68. success: function (res) {
  69. CanUseCampFormatter(res);
  70. }
  71. });
  72. }
  73. function GetCanJoinCamp() {
  74. $.iwbAjax4({
  75. url: abp.appUrl + 'Query/QueryCanJoinCamp',
  76. success: function (res) {
  77. CanJoinCampFormatter(res);
  78. }
  79. });
  80. }
  81. function CanUseCampFormatter(data) {
  82. var str = '';
  83. if (data && data.length) {
  84. data.forEach(function (v) {
  85. str += CampFormatter(v, 1);
  86. });
  87. }
  88. if (str) {
  89. $('#use-camp').html(str);
  90. } else {
  91. $('#use-camp').html('<div class="no-data">暂无可用培训营</div>');
  92. }
  93. }
  94. function CanJoinCampFormatter(data) {
  95. var str = '';
  96. if (data && data.length) {
  97. data.forEach(function (v) {
  98. str += CampFormatter(v, 2);
  99. });
  100. }
  101. if (str) {
  102. $('#join-camp').html(str);
  103. } else {
  104. $('#join-camp').html('<div class="no-data">暂无可用培训营</div>');
  105. }
  106. }
  107. function CampFormatter(data, type) {
  108. var str = '';
  109. if (data) {
  110. var style = "danger", icon = "fas fa-lock", per = 100, title = type == 1 ? "创建演练" : "加入演练";
  111. if (type == 1) {
  112. style = "info";
  113. icon = "far fa-star";
  114. } else {
  115. if (data.isPublic) {
  116. style = "success";
  117. icon = "fas fa-unlock";
  118. }
  119. }
  120. str += '<div class="col-md-3">';
  121. str += '<div class="info-box bg-{0}" style="flex-direction: column;padding:0px">'.format(style);
  122. str += '<div class="ribbon-wrapper"><div class="ribbon bg-success">{0}分钟</div></div>'.format(
  123. data.maxTrainingMinute);
  124. str += '<div style="display: flex;flex-direction: row;padding:5px 0 0;">';
  125. str += '<span class="info-box-icon"><i class="{0}"></i></span>'.format(icon);
  126. str += '<div class="info-box-content">';
  127. str += data.name?'<span class="info-box-text">演练名称:{0}</span>'.format(data.name):'';
  128. str += '<span class="info-box-text">培训营:{0}</span>'.format(data.campName);
  129. //if (type != 1) {
  130. // var min = 0;
  131. // str += '<span class="info-box-number">已演练 {0} 分钟</span>'.format(min);
  132. //}
  133. str += '<div class="progress"><div class="progress-bar" style="width: {0}%"></div></div>'.format(per);
  134. str += '<span class="progress-description">{0}</span>'.format(data.packageName);
  135. str += '</div>';
  136. str += '</div>';
  137. str += '<div class="tool-box" ><span onclick="Detail(\'{1}\',{2})">查看详情</span><span onclick="CreatePlay(\'{1}\',{2})">{0}</span></div>'.format(title, data.id, type);
  138. str += '</div>';
  139. str += '</div>';
  140. }
  141. return str;
  142. }
  143. </script>
  144. <script>
  145. function Detail(id, type) {
  146. if (type == 1) {
  147. window.open("/play/detail/" + id, "_blank");
  148. } else {
  149. window.open("/play/detailByPlay/" + id, "_blank");
  150. }
  151. }
  152. function CreatePlay(id, type) {
  153. if (type == 1) {
  154. window.open("/play/create/" + id, "_blank");
  155. } else {
  156. window.open("/play/ready/" + id, "_blank");
  157. }
  158. }
  159. </script>
  160. }