123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- @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/ExerciseV2/stu-cmd.min.css" rel="stylesheet" />
- }
- @Html.Partial("Layout/V2/_Bg", false)
- <div class="box public no-select" style="">
- <div class="box-title">决策指令下达</div>
- <div class="box-body ">
- <div class="box-header">
- <span class="title">@(groupName)指挥部 —— 组员</span>
- </div>
- <div class="body">
- <div class="form">
- <div class="role-box">
- <div class="body-card select-box">
- <select class="form-control " id="role-select" name="role" style="width: 100%" autocomplete="off" placeholder="请选择角色" onchange="$(this).val()=='self'?$('.input-box').show():$('.input-box').hide()"></select>
- </div>
- <div class="body-card input-box ">
- <input class="form-control " id="role-input" name="self-role" style="width: 100%" autocomplete="off" placeholder="请输入自定义角色" />
- </div>
- </div>
- <div class="body-card cmd-box">
- <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="提示信息"></select>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div style="position: absolute; left: 0; bottom: 0; color: #ddd; opacity: 0.5;">@(groupName)</div>
- </div>
- @section scripts
- {
- <script>
- $(function () {
- resizeHeight_Stu();
- window.addEventListener('resize', resizeHeight_Stu);
- $.iwbAjax4({
- url: abp.appUrl + 'Query/GetGroupRoleSelectStr?no=@(id)',
- success: function (res) {
- var str = "<option value='self'>自定义角色</option>"
- if (res) {
- res += str
- $('#role-select').html(res).select2({ minimumResultsForSearch: -1 });
- } else {
- $('#role-select').html(str).select2({ minimumResultsForSearch: -1 });
- }
- }
- });
- $.iwbAjax4({
- url: abp.appUrl + 'Query/GetStuHelpContentSelectStrByCamp?no=@(campNo)',
- success: function(res) {
- if (res) {
- //$('.help-box').show();
- $('select[name="help"]').html(`<option value="">请选择提示信息</option>` + res).select2({ minimumResultsForSearch: -1 });
- } 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('.cmd-box').find('.txt');
- var text = $txt.val() + " " + $(this).find('option:selected').text()
- if (text.length<500) {
- $txt.val(text);
- } else {
- abp.message.warn('指令输入不超过500字符。');
- }
- $(this).val('');
- }
- });
- });
- function resizeHeight_Stu() {
- var fs = 38;
- var h = $("#bg_header").height();
- var newFs = fs * h / 126;
- $(".box .box-title").height(h)
- .css("fontSize", newFs + "px");
- resizeHeight((h, wh) => {
- var height = 215;
- $(".txt").height(wh - h - height)
- })
- }
- function RoleHandle(that) {
- var $that = $(that).closest('.form'),
- role = $that.find('.form-control[name="role"]').val(),
- word = $that.find('textarea').val();
- if (!role) {
- abp.message.warn('请选择角色后再提交!');
- return;
- }
- if (role == 'self') {
- role = $that.find('.form-control[name="self-role"]').val()
- if (!role) {
- abp.message.warn('请填写角色后再提交!');
- return;
- }
- }
- if (!word) {
- abp.message.warn('请输入指令后再提交!');
- return;
- }
- if ( word.length >= 500) {
- abp.message.warn('指令输入不超过500字符。');
- return;
- }
- $.iwbAjax4({
- url: abp.appUrl + 'Eval/SaveOperationScene',
- data: { groupNo: '@(id)', behaviorRole: role, behaviorWord: word},
- success: function() {
- $that.find('textarea').val('').focus();
- }
- });
- }
- </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>
- }
|