Selaa lähdekoodia

积分范围限制

zhangjiangbin 8 vuotta sitten
vanhempi
sitoutus
fcae8aefc2
1 muutettua tiedostoa jossa 12 lisäystä ja 0 poistoa
  1. 12 0
      resources/views/admin/system.blade.php

+ 12 - 0
resources/views/admin/system.blade.php

@@ -999,12 +999,18 @@
         // 设置最小积分
         $("#min_rand_score").change(function () {
             var min_rand_score = $(this).val();
+            var max_rand_score = $("#max_rand_score").val();
 
             if (parseInt(min_rand_score) < 0) {
                 layer.msg('最小积分小于0', {time:1000});
                 return ;
             }
 
+            if (parseInt(min_rand_score) >= parseInt(max_rand_score)) {
+                layer.msg('最小积分必须小于最大积分', {time:1000});
+                return ;
+            }
+
             $.post("{{url('admin/setConfig')}}", {_token:'{{csrf_token()}}', name:'min_rand_score', value:min_rand_score}, function (ret) {
                 layer.msg(ret.message, {time:1000}, function() {
                     if (ret.status == 'fail') {
@@ -1016,6 +1022,7 @@
 
         // 设置最大积分
         $("#max_rand_score").change(function () {
+            var min_rand_score = $("#min_rand_score").val();
             var max_rand_score = $(this).val();
 
             if (parseInt(max_rand_score) > 99999) {
@@ -1023,6 +1030,11 @@
                 return ;
             }
 
+            if (parseInt(min_rand_score) >= parseInt(max_rand_score)) {
+                layer.msg('最大积分必须大于最小积分', {time:1000});
+                return ;
+            }
+
             $.post("{{url('admin/setConfig')}}", {_token:'{{csrf_token()}}', name:'max_rand_score', value:max_rand_score}, function (ret) {
                 layer.msg(ret.message, {time:1000}, function() {
                     if (ret.status == 'fail') {