_BaseInfo.cshtml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. @using WeApp.Helpers
  2. @model WeApp.TrainingCamp.Dto.CampDto
  3. @{
  4. string id = "base-info";
  5. }
  6. @Html.Partial("__/_AreaBox", $"演练信息#{id}")
  7. <div style="display: none" id="@id-pre">
  8. <div class="base-info">
  9. @*<h4>演练基本信息</h4>*@
  10. <dl><dt>名称:</dt><dd>@Model.Name</dd></dl>
  11. <dl><dt>目标:</dt><dd>@Model.Description </dd></dl>
  12. <dl><dt>演练阶段:</dt><dd id="step"></dd></dl>
  13. <dl class="d-flex align-items-center" id="step-progress">
  14. <dt class="progress " style="width: 85%; border-radius: 10px; background: #041f3c;">
  15. <span class="progress-bar bg-success progress-bar-striped" style="width: 0%; border-radius: 10px;"></span>
  16. </dt>
  17. <dd>
  18. <span>0</span>%
  19. </dd>
  20. </dl>
  21. </div>
  22. </div>
  23. @using (Html.BeginScripts())
  24. {
  25. <script id="base-info-script">
  26. var $baseInfoBody = $('#@id .box-body');
  27. $baseInfoBody.html($('#@id-pre').html());
  28. $(function() {
  29. GetStepInfo('@(Model.Id)');
  30. OverlayScrollbar($baseInfoBody.closest('.scroll-box'));
  31. });
  32. function GetStepInfo(no) {
  33. $.iwbAjax4({
  34. url: abp.appUrl + 'Query/GetCampStep?no=' + no,
  35. success: function(res) {
  36. StepFormatter(res);
  37. }
  38. });
  39. }
  40. function StepFormatter(data) {
  41. if (data) {
  42. $("#step").html(data.name);
  43. $('#step-progress .progress-bar').animate({ "width": `${data.progress}%` });
  44. $('#step-progress dd span').html(data.progress);
  45. }
  46. }
  47. iwbHub.client.getUpdateStep = function(msg) {
  48. console.log('getUpdateStep: ', msg);
  49. if (msg) {
  50. try {
  51. var data = typeof msg == 'string' ? JSON.parse(msg) : msg;
  52. if (data) {
  53. StepFormatter(data);
  54. }
  55. } catch (e) {
  56. console.log('getUpdateStep: ', e);
  57. }
  58. }
  59. };
  60. </script>
  61. }