123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- @using WeApp.TrainingCampGroup.Dto
- @{
- Layout = "~/Views/Shared/Layout/_Layout.Stu.cshtml";
- CampGroupDto group = ViewBag.Group;
- ViewBag.Title = "学员屏(" + group.Name + ")";
- string id = group.Id,
- groupName = group.Name,
- campNo = group.CampNo;
- }
- @section css{
- <link href="~/Content/Css/Exercise/stu-leader.min.css" rel="stylesheet" />
- <style>
- </style>
- }
- <div class="body">
- <div class="title-box box">
- <div class="left-box">
- <div class="line"></div>
- <div class="title">@(groupName)指挥部 —— 组员</div>
- </div>
- </div>
- <div class="handle-box box">
- <div class="form-box">
- <div class="role">
- <select class="form-control" id="role-select" name="role" style="width: 100%" autocomplete="off" placeholder="请选择角色"></select>
- </div>
- <textarea class="form-control txt" rows="6" name="message" placeholder="请输入指令内容"></textarea>
- <button type="button" class="btn btn-submit" onclick="RoleHandle(this)">提交</button>
- <div class="help-box">
- <select class="form-control" name="help" style="width: 100%" autocomplete="off" data-placeholder="提示信息">
- <option value="">请选择提示信息</option>
- </select>
- </div>
- </div>
- <div class="form-box">
- <div class="role">
- <input class="form-control" id="role-name" name="role" style="width: 100%" autocomplete="off" placeholder="请填写自定义角色" />
- </div>
- <textarea class="form-control txt" rows="6" name="message" placeholder="请输入指令内容"></textarea>
- <button type="button" class="btn btn-submit" onclick="RoleHandle(this)">提交</button>
- <div class="help-box">
- <select class="form-control" name="help" style="width: 100%" autocomplete="off" data-placeholder="提示信息">
- <option value="">请选择提示信息</option>
- </select>
- </div>
- </div>
- </div>
- </div>
- @section scripts
- {
- <script>
- $(function() {
- $.iwbAjax4({
- url: abp.appUrl + 'Query/GetGroupRoleSelectStr?no=@(id)',
- success: function(res) {
- if (res) {
- $('#role-select').html(res).select2();
- }
- }
- });
- $.iwbAjax4({
- url: abp.appUrl + 'Query/GetStuHelpContentSelectStrByCamp?no=@(campNo)',
- success: function(res) {
- if (res) {
- $('select[name="help"]').html(`<option value="">请选择提示信息</option>`+res).select2();
- } else {
- $('.help-box').hide();
- }
- }
- });
- $('.txt').keydown(function (e) {
- var theEvent = window.event || e;
- var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
- if (code == 13) {
- RoleHandle(this);
- }
- });
- $('select[name="help"]').on('change',
- function () {
- if ($(this).val()) {
- var $txt = $(this).closest('.form-box').find('.txt');
- $txt.val($txt.val() + " " + $(this).find('option:selected').text());
- $(this).val('');
- }
- });
- });
- function RoleHandle(that) {
- var $that = $(that).closest('.form-box'),
- role = $that.find('.form-control[name="role"]').val(),
- word = $that.find('textarea').val();
- if (!role) {
- abp.message.warn('请选择(或填写)角色后再提交!');
- return;
- }
- if (!word) {
- abp.message.warn('请输入指令后再提交!');
- return;
- }
- $.iwbAjax4({
- url: abp.appUrl + 'Eval/SaveOperationScene',
- data: { groupNo: '@(id)', behaviorRole: role, behaviorWord: word},
- success: function() {
- $that.find('textarea').val('').focus();
- }
- });
- @*window.iwbHub.server.sendOperationLog('@(id)',role,text).done(function() {
- abp.log.debug('OperationLog[' + id + ']:', role, word);
- });*@
- }
- </script>
- <script id="hub">
- abp.signalr.connect(['@(id)','@(campNo)']);
- iwbHub.client.getReloadAll = function (msg) {
- console.log('getReloadAll: ', msg);
- if (msg) {
- try {
- var data = JSON.parse(msg);
- if (data) {
- if (data.no == '@(id)'|| data.no == '@(campNo)') {
- window.location.reload();
- }
- }
- } catch (e) {
- console.log('getReloadAll: ', e);
- }
- }
- };
- iwbHub.client.getReloadStu = function (msg) {
- console.log('getReloadStu: ', msg);
- if (msg) {
- try {
- var data = JSON.parse(msg);
- if (data) {
- if (data.no == '@(id)'|| data.no == '@(campNo)') {
- window.location.reload();
- }
- }
- } catch (e) {
- console.log('getReloadStu: ', e);
- }
- }
- };
- </script>
- }
|