_CmdRole.cshtml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. @using WeApp.Helpers
  2. @model WeApp.Views.Exercise.ScreenModel
  3. @{
  4. string id = "cmd-role";
  5. string id2 = $"{id}_{Model.GroupNo}";
  6. //var roleArr = Model.Play.PlayRoleNames.Split(',');
  7. }
  8. @Html.Partial("_Run/_AreaBox", $"指挥部#{id2}")
  9. <style>
  10. .cmd-role-box {
  11. display: flex;
  12. flex-wrap: wrap;
  13. }
  14. .role-box {
  15. font-size: 14px;
  16. --h: 40px;
  17. display: block;
  18. height: var(--h);
  19. border-radius: var(--h) 1rem 1rem var(--h);
  20. background: #fff;
  21. margin: 5px 10px;
  22. cursor: pointer;
  23. }
  24. .cmd-role-box .role-box .role-image {
  25. display: block;
  26. float: left;
  27. width: var(--h);
  28. height: var(--h);
  29. border-radius: var(--h);
  30. border: 3px solid #fff;
  31. }
  32. .cmd-role-box .role-box .role-name {
  33. float: left;
  34. width: auto;
  35. min-width: 130px;
  36. line-height: var(--h);
  37. padding: 0 20px 0 15px;
  38. /*color: #8c91a8;*/
  39. color: var(--mc);
  40. font-weight: bold;
  41. text-align: center;
  42. }
  43. </style>
  44. @if (Model.WithScript)
  45. {
  46. using (Html.BeginScripts())
  47. {
  48. <script id="role-script">
  49. function GetRoles(no) {
  50. $.iwbAjax5({
  51. url: abp.appUrl + 'Query/GetGroupRoleInfos?no=' + no,
  52. success: function (res) {
  53. if (res) {
  54. FormatterRole(res, no);
  55. }
  56. }
  57. });
  58. }
  59. function FormatterRole(data, no) {
  60. var str = "";
  61. if (data && data.length > 0) {
  62. data.forEach(function (v) {
  63. str +=
  64. `<div class="role-box"><img class="role-image" src="/Content/Image/user.png" /><div class="role-name">${v}</div></div>`;
  65. });
  66. }
  67. if (str) {
  68. $(`#@(id)_${no} .box-body`).html(`<div class="cmd-role-box">${str}</div>`);
  69. }
  70. }
  71. </script>
  72. }
  73. }
  74. @using (Html.BeginScripts())
  75. {
  76. <script id="role-script">
  77. $(function () {
  78. OverlayScrollbar($(`#@(id2) .box-body`).closest('.scroll-box'), { className: "os-theme-round-dark" });
  79. });
  80. </script>
  81. }