Просмотр исходного кода

Add 指令输入超过500字符提示

YueYunyun 1 год назад
Родитель
Сommit
35f8250b55
1 измененных файлов с 17 добавлено и 3 удалено
  1. 17 3
      SourceCode/WeApp.Web/Views/ExerciseV2/Student.cshtml

+ 17 - 3
SourceCode/WeApp.Web/Views/ExerciseV2/Student.cshtml

@@ -48,10 +48,13 @@
             window.addEventListener('resize', resizeHeight_Stu);
             $.iwbAjax4({
                 url: abp.appUrl + 'Query/GetGroupRoleSelectStr?no=@(id)',
-                success: function(res) {
+                success: function (res) {
+                    var str = "<option value='self'>自定义角色</option>"
                     if (res) {
-                        res+="<option value='self'>自定义角色</option>"
+                        res += str
                         $('#role-select').html(res).select2();
+                    } else {
+                        $('#role-select').html(str).select2();
                     }
                 }
             });
@@ -78,7 +81,12 @@
                 function () {
                     if ($(this).val()) {
                         var $txt = $(this).closest('.cmd-box').find('.txt');
-                        $txt.val($txt.val() + " " + $(this).find('option:selected').text());
+                        var text = $txt.val() + " " + $(this).find('option:selected').text()
+                        if (text.length<500) {
+                            $txt.val(text);
+                        } else {
+                            abp.message.warn('指令输入不超过500字符。');
+                        }
                         $(this).val('');
                     }
                 });
@@ -116,6 +124,12 @@
                 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},