Student.cshtml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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/stu-leader.min.css" rel="stylesheet" />
  12. <style>
  13. </style>
  14. }
  15. <div class="body">
  16. <div class="title-box box">
  17. <div class="left-box">
  18. <div class="line"></div>
  19. <div class="title">@(groupName)指挥部 —— 组员</div>
  20. </div>
  21. </div>
  22. <div class="handle-box box">
  23. <div class="form-box">
  24. <div class="role">
  25. <select class="form-control" id="role-select" name="role" style="width: 100%" autocomplete="off" placeholder="请选择角色"></select>
  26. </div>
  27. <textarea class="form-control txt" rows="6" name="message" placeholder="请输入指令内容"></textarea>
  28. <button type="button" class="btn btn-submit" onclick="RoleHandle(this)">提交</button>
  29. </div>
  30. <div class="form-box">
  31. <div class="role">
  32. <input class="form-control" id="role-name" name="role" style="width: 100%" autocomplete="off" placeholder="请填写自定义角色" />
  33. </div>
  34. <textarea class="form-control txt" rows="6" name="message" placeholder="请输入指令内容"></textarea>
  35. <button type="button" class="btn btn-submit" onclick="RoleHandle(this)">提交</button>
  36. </div>
  37. </div>
  38. </div>
  39. @section scripts
  40. {
  41. <script>
  42. $(function() {
  43. $.iwbAjax4({
  44. url: abp.appUrl + 'Query/GetGroupRoleSelectStr?no=@(id)',
  45. success: function(res) {
  46. if (res) {
  47. $('#role-select').html(res).select2();
  48. }
  49. }
  50. });
  51. $('.txt').keydown(function (e) {
  52. var theEvent = window.event || e;
  53. var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
  54. if (code == 13) {
  55. RoleHandle(this);
  56. }
  57. });
  58. });
  59. function RoleHandle(that) {
  60. var $that = $(that).closest('.form-box'),
  61. role = $that.find('.form-control[name="role"]').val(),
  62. word = $that.find('textarea').val();
  63. if (!role) {
  64. abp.message.warn('请选择(或填写)角色后再提交!');
  65. return;
  66. }
  67. if (!word) {
  68. abp.message.warn('请输入指令后再提交!');
  69. return;
  70. }
  71. $.iwbAjax4({
  72. url: abp.appUrl + 'Eval/SaveOperationScene',
  73. data: { groupNo: '@(id)', behaviorRole: role, behaviorWord: word},
  74. success: function() {
  75. $that.find('textarea').val('').focus();
  76. }
  77. });
  78. @*window.iwbHub.server.sendOperationLog('@(id)',role,text).done(function() {
  79. abp.log.debug('OperationLog[' + id + ']:', role, word);
  80. });*@
  81. }
  82. </script>
  83. <script id="hub">
  84. abp.signalr.connect(['@(id)','@(campNo)']);
  85. iwbHub.client.getReloadAll = function (msg) {
  86. console.log('getReloadAll: ', msg);
  87. if (msg) {
  88. try {
  89. var data = JSON.parse(msg);
  90. if (data) {
  91. if (data.no == '@(id)'|| data.no == '@(campNo)') {
  92. window.location.reload();
  93. }
  94. }
  95. } catch (e) {
  96. console.log('getReloadAll: ', e);
  97. }
  98. }
  99. };
  100. iwbHub.client.getReloadStu = function (msg) {
  101. console.log('getReloadStu: ', msg);
  102. if (msg) {
  103. try {
  104. var data = JSON.parse(msg);
  105. if (data) {
  106. if (data.no == '@(id)'|| data.no == '@(campNo)') {
  107. window.location.reload();
  108. }
  109. }
  110. } catch (e) {
  111. console.log('getReloadStu: ', e);
  112. }
  113. }
  114. };
  115. </script>
  116. }