diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js
index 743b3685c..f335f1705 100644
--- a/public/react/config/webpack.config.dev.js
+++ b/public/react/config/webpack.config.dev.js
@@ -32,7 +32,7 @@ module.exports = {
// See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s
// devtool: "cheap-module-eval-source-map",
// 开启调试
- // devtool: "source-map", // 开启调试
+ devtool: "source-map", // 开启调试
// These are the "entry points" to our application.
// This means they will be the "root" imports that are included in JS bundle.
// The first two entry points enable "hot" CSS and auto-refreshes for JS.
diff --git a/public/react/src/modules/courses/coursesPublic/ModulationModal.js b/public/react/src/modules/courses/coursesPublic/ModulationModal.js
index af3ae01f3..8c3fcaa37 100644
--- a/public/react/src/modules/courses/coursesPublic/ModulationModal.js
+++ b/public/react/src/modules/courses/coursesPublic/ModulationModal.js
@@ -1,5 +1,5 @@
import React,{ Component } from "react";
-import {Modal, Checkbox, Upload, Button, Icon, message, Input, Form} from "antd";
+import {Modal, Checkbox, Upload, Button, Icon, message, Input, Form, InputNumber} from "antd";
import { WordNumberTextarea } from 'educoder';
import './Newshixunmodel.css'
@@ -17,6 +17,7 @@ class ModulationModal extends Component{
Saves=()=>{
+ console.log("Saves=()");
let {textareaval,Inputsval}=this.state;
// if(textareaval===""||textareaval===undefined){
// this.setState({
@@ -44,6 +45,7 @@ class ModulationModal extends Component{
Inputsvaltype: false,
Inputsvaltest: "",
})
+ console.log(Inputsval);
this.props.Saves(textareaval,Inputsval)
}
@@ -55,31 +57,45 @@ class ModulationModal extends Component{
}
setInputs=(e)=>{
- debugger
- var value=parseInt(e.target.value)
+ console.log("setInputs");
+ let value = undefined;
+ try {
+ value = parseFloat(e);
+ } catch (e) {
+ this.setState({
+ borredszf: "ml10 color-grey-9 bor-reds ",
+ Inputsval: 0,
+ Inputsvaltype: true,
+ Inputsvaltest: "请输入分数",
+ })
+ return;
+ }
- if(isNaN(value)){
- value = 0;
+ if (value === undefined || value === null || value === "") {
this.setState({
- Inputsval: value,
+ borredszf: "ml10 color-grey-9 bor-reds ",
+ Inputsval: 0,
Inputsvaltype: true,
Inputsvaltest: "请输入分数",
})
- }else{
- if(value<0||value>100){
- value = 0;
- this.setState({
- Inputsval: value,
- Inputsvaltype: true,
- Inputsvaltest: "请输入0-100的分数",
- })
-
- }
- }
- this.setState({
+ return
+ }
+ var re = /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字 //判断正整数 /^[1-9]+[0-9]*]*$/
+ var nubmer = value;
+ if (!re.test(nubmer)) {
+ this.setState({
+ borredszf: "ml10 color-grey-9 bor-reds ",
+ Inputsval: value,
+ Inputsvaltype: true,
+ Inputsvaltest: "请输入0-100的分数",
+ })
+ return;
+ }
+ console.log(value);
+ this.setState({
Inputsval: value,
Inputsvaltype: false,
- })
+ })
}
render(){
let {textareaval, Inputsval, textareavaltype, Inputsvaltype, Inputsvaltest} = this.state;
@@ -123,16 +139,26 @@ class ModulationModal extends Component{
lineHeight: " 40px",
color: " #f5222d",
}}>*成绩:
-
+
+