Bladeren bron

在线评估bug

liting2017 6 jaren geleden
bovenliggende
commit
d27cc77719
2 gewijzigde bestanden met toevoegingen van 19 en 7 verwijderingen
  1. 16 5
      js/component/account/evaluate/steps.jsx
  2. 3 2
      js/component/account/evaluate/steps/step1.jsx

+ 16 - 5
js/component/account/evaluate/steps.jsx

@@ -55,10 +55,12 @@ const EvaluateSteps = React.createClass({
 			loading: true,
 			steps: null,
 			value: 0,
-			step: 0
+			step: 0,
+			dottList:[]
 		};
 	},
 	next(values) {
+		console.log(values)
 		if (this.state.current == 7) {
 			this.state.value = values;
 			return;
@@ -70,6 +72,9 @@ const EvaluateSteps = React.createClass({
 		if (this.state.current === 0 && this.props.title) {
 			this.props.title(values.name);
 		}
+		if(!this.state.current){
+			this.loadData(this.props.id)
+		}
 		this.setState({
 			current: current,
 			steps: this.state.steps
@@ -80,6 +85,7 @@ const EvaluateSteps = React.createClass({
 		this.setState({ current });
 	},
 	loadData(id) {
+		this.state.dottList=[];
 		this.state.step=0;
 		$.ajax({
 			url: globalConfig.context + '/api/user/evaluate/info/' + id
@@ -117,7 +123,7 @@ const EvaluateSteps = React.createClass({
 	componentWillReceiveProps(nextProps) {
 		if (!this.props.visible && nextProps.visible) {
 			if (nextProps.id) {
-        		this.loadData(nextProps.id);
+				this.loadData(nextProps.id);
 			}
 		}
 	},
@@ -126,9 +132,14 @@ const EvaluateSteps = React.createClass({
 			<span
 				style={{ cursor: 'pointer' }}
 				onClick={() => {
+					let dottList=this.state.dottList;
+					if(index>0){
+						dottList.push(index)
+					}
 					if (index == this.state.step || !!this.state.steps[index]) {
 						this.setState({
-							current: index
+							current: index,
+							dottList:dottList
 						});
 					}
 				}}
@@ -140,7 +151,7 @@ const EvaluateSteps = React.createClass({
 	render() {
 		this.state.StepContent = steps[this.state.current].content;
 		let loadContent = !!this.state.steps;
-		console.log(this.state.step)
+		let dottList =this.state.dottList;
 		return (
 			<Spin spinning={this.state.loading}>
 				<div style={{ marginTop: 10 }}>
@@ -154,7 +165,7 @@ const EvaluateSteps = React.createClass({
 								prev={this.prev}
 								id={this.props.id}
 								visible={this.props.visible}
-								data={(this.state.step)?this.state.steps[this.state.current]:{}}
+								data={this.state.step||dottList.length?this.state.steps[this.state.current]:{}}
 								record={this.state.steps}
 								value={this.state.value}
 							/>

+ 3 - 2
js/component/account/evaluate/steps/step1.jsx

@@ -35,6 +35,7 @@ const EvaluateStep1 = Form.create({})(React.createClass({
         this.setState({
           initialData:nextProps.data
         })
+        this.loadData()
       }
 	},
   loadData() {
@@ -191,8 +192,8 @@ const EvaluateStep1 = Form.create({})(React.createClass({
   },
   render() {
     const { getFieldDecorator } = this.props.form;
-    let { subIndustry, industry, district, loading, initialData } = this.state;
-    console.log(this.state.initialData)
+    let { subIndustry, industry, district, loading} = this.state;
+    let initialData=this.state.initialData||{};
     return (
       <Spin spinning={loading}>
         <Form className="steps-form">