正在显示
1 个修改的文件
包含
13 行增加
和
0 行删除
| @@ -62,6 +62,19 @@ $("#rate").click(function () { | @@ -62,6 +62,19 @@ $("#rate").click(function () { | ||
| 62 | $(document).on("input",".my_score",function(){ | 62 | $(document).on("input",".my_score",function(){ |
| 63 | var maxScore = $(this).attr('data-max_score'); | 63 | var maxScore = $(this).attr('data-max_score'); |
| 64 | var currentScore = $(this).val(); | 64 | var currentScore = $(this).val(); |
| 65 | + //修复第一个字符是小数点 的情况. | ||
| 66 | + if (currentScore !== '' && currentScore.substr(0, 1) === '.') { | ||
| 67 | + currentScore = ""; | ||
| 68 | + } | ||
| 69 | + if(currentScore == '') { | ||
| 70 | + layer.msg("请输入数字", {icon: 1}); | ||
| 71 | + $(this).val(''); | ||
| 72 | + } | ||
| 73 | + if(isNaN(currentScore)){ | ||
| 74 | + layer.msg("请输入数字", {icon: 1}); | ||
| 75 | + $(this).val(''); | ||
| 76 | + } | ||
| 77 | + | ||
| 65 | if(parseFloat(maxScore) < parseFloat(currentScore)) { | 78 | if(parseFloat(maxScore) < parseFloat(currentScore)) { |
| 66 | layer.msg("打分区间在0-"+ maxScore+"分之间", {icon: 2}); | 79 | layer.msg("打分区间在0-"+ maxScore+"分之间", {icon: 2}); |
| 67 | $(this).val(maxScore); | 80 | $(this).val(maxScore); |
-
请 注册 或 登录 后发表评论