Student - 复制.cshtml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. @using WeApp.TrainingCampGroup.Dto
  2. @{
  3. Layout = "~/Views/Shared/Layout/_Layout.Stu.cshtml";
  4. CampGroupDto group = ViewBag.Group;
  5. ViewBag.Title = "学员屏(" + group.Name + ")";
  6. string id = group.Id,
  7. groupName = group.Name,
  8. campNo = group.CampNo;
  9. }
  10. @section css{
  11. <link href="~/Content/Css/Exercise/student.min.css" rel="stylesheet" />
  12. <style>
  13. .select2-container .select2-selection--single {
  14. height: 38px;
  15. }
  16. .select2-container--default .select2-selection--single .select2-selection__arrow {
  17. top: 6px;
  18. }
  19. </style>
  20. }
  21. <div class="stu-box">
  22. <div class="box-h">
  23. <div class="title">
  24. <h3 class="">@(groupName)指挥部 —— 组员</h3>
  25. </div>
  26. </div>
  27. <div class="box-b">
  28. <div class="handle-box">
  29. <div class="handle-role">
  30. <select class="form-control" id="role-select" name="role" style="width: 100%" autocomplete="off" placeholder="请选择角色"></select>
  31. </div>
  32. <div class="handle-content">
  33. <textarea class="form-control" rows="6" name="message" placeholder="请输入指令内容"></textarea>
  34. </div>
  35. <div class="handle-button">
  36. <button type="button" class="btn btn-dl btn-block" onclick="RoleHandle(this)">提交</button>
  37. </div>
  38. </div>
  39. <div class="handle-box">
  40. <div class="handle-role">
  41. <input class="form-control" id="role-name" name="role" style="width: 100%" autocomplete="off" placeholder="请填写自定义角色" />
  42. </div>
  43. <div class="handle-content">
  44. <textarea class="form-control" rows="6" name="message" placeholder="请输入指令内容"></textarea>
  45. </div>
  46. <div class="handle-button">
  47. <button type="button" class="btn btn-dl btn-block" onclick="RoleHandle(this)">提交</button>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. @section scripts
  53. {
  54. <script>
  55. $(function() {
  56. $.iwbAjax4({
  57. url: abp.appUrl + 'Query/GetGroupRoleSelectStr?no=@(id)',
  58. success: function(res) {
  59. if (res) {
  60. $('#role-select').html(res).select2();
  61. }
  62. }
  63. });
  64. });
  65. function RoleHandle(that) {
  66. var $that = $(that).closest('.handle-box'),
  67. role = $that.find('.form-control[name="role"]').val(),
  68. word = $that.find('textarea').val();
  69. if (!role) {
  70. abp.message.warn('请选择(或填写)角色后再提交!');
  71. return;
  72. }
  73. if (!word) {
  74. abp.message.warn('请输入指令后再提交!');
  75. return;
  76. }
  77. $.iwbAjax4({
  78. url: abp.appUrl + 'Eval/SaveOperationScene',
  79. data: { groupNo: '@(id)', behaviorRole: role, behaviorWord: word},
  80. success: function() {
  81. $that.find('textarea').val('').focus();
  82. }
  83. });
  84. @*window.iwbHub.server.sendOperationLog('@(id)',role,text).done(function() {
  85. abp.log.debug('OperationLog[' + id + ']:', role, word);
  86. });*@
  87. }
  88. </script>
  89. <script id="hub">
  90. abp.signalr.connect(['@(id)','@(campNo)']);
  91. iwbHub.client.getReloadAll = function (msg) {
  92. console.log('getReloadAll: ', msg);
  93. if (msg) {
  94. try {
  95. var data = JSON.parse(msg);
  96. if (data) {
  97. if (data.no == '@(id)'|| data.no == '@(campNo)') {
  98. window.location.reload();
  99. }
  100. }
  101. } catch (e) {
  102. console.log('getReloadAll: ', e);
  103. }
  104. }
  105. };
  106. iwbHub.client.getReloadStu = function (msg) {
  107. console.log('getReloadStu: ', msg);
  108. if (msg) {
  109. try {
  110. var data = JSON.parse(msg);
  111. if (data) {
  112. if (data.no == '@(id)'|| data.no == '@(campNo)') {
  113. window.location.reload();
  114. }
  115. }
  116. } catch (e) {
  117. console.log('getReloadStu: ', e);
  118. }
  119. }
  120. };
  121. </script>
  122. }