Commit de5d7abd by 万亚飞

fix bug

parent 81bf0869
......@@ -12,6 +12,7 @@ module.exports = {
vendor: ['react', 'better-scroll', 'react-redux', 'react-lazyload']
},
output: {
publicPath: '/',
filename: '[name].[hash:8].js',
path: resolve(__dirname, '../build')
},
......@@ -109,6 +110,7 @@ module.exports = {
devServer: {
contentBase: '../build',
host: '0.0.0.0',
historyApiFallback: true,
open: true,
port: 5000,
hot: true
......
......@@ -18,6 +18,7 @@ module.exports = {
vendor: ['react']
},
output: {
publicPath: '/',
filename: '[name].[contenthash:8].js',
path: resolve(__dirname, '../dist')
},
......
......@@ -49,11 +49,13 @@ class App extends React.Component {
<div className="container">
<div className="page-content">
<Switch>
<Route path={['/user/job/add', '/user/job/:id']} component={AddMaterial} />
<Route path="/user/job/add" key="add-job" component={AddMaterial} />
<Route path="/user/job/:id" key="edit-job" component={AddMaterial} />
<Route path="/user/job" component={JobList} />
<Route path={['/user/train/add', '/user/train/:id']} component={Train} />
<Route path="/user/train/add" key="add-train" component={Train} />
<Route path="/user/train/:id" key="edit-train" component={Train} />
<Route path="/user/train" component={TrainList} />
<Route path="*" component={JobList} />
<Route component={JobList} />
</Switch>
</div>
</div>
......
......@@ -8,10 +8,10 @@ import { Provider } from 'react-redux';
// import './assets/index.less';
import './static/styles/global.less';
ReactDOM.render(
<HashRouter basename="/new">
<BrowserRouter basename="/new">
<Provider store={store}>
<App />
</Provider>
</HashRouter>,
</BrowserRouter>,
document.querySelector('#root')
);
......@@ -36,8 +36,8 @@ function ListItemView(props) {
return (
<React.Fragment>
<ul className="train-list">
{props.dataArr.map(item => (
<TrainItem iType={props.tabIndex} key={item.id} data={item} delToggle={props.delTrain} />
{props.dataArr.map((item, index) => (
<TrainItem iType={props.tabIndex} key={index} data={item} delToggle={props.delTrain} />
))}
</ul>
<AddView tabIndex={props.tabIndex} />
......@@ -64,6 +64,7 @@ class JobList extends Component {
};
}
componentWillMount() {
document.title = '职业背景';
this.setState({
tabIndex: parseInt(getParameterByName('index', location.href)) || 0
});
......
......@@ -23,6 +23,8 @@ class Train extends Component {
imgUrls: [],
certificateFiles: [],
viewImages: [],
isEdit: false, //是否是编辑
hasChange: false, //是否编辑过
modifyId: null
};
//初始化图片
......@@ -55,8 +57,10 @@ class Train extends Component {
this.setState({
[name]: value
});
this.hansChangeForm();
};
componentDidMount() {
document.title = '受训背景';
app().downRefresh(false);
app().notRefresh(false);
const id = getParam(location.href);
......@@ -98,6 +102,7 @@ class Train extends Component {
this.setState({
[name]: date
});
this.hansChangeForm();
};
refreshFile = res => {
if (res.code >= 0) {
......@@ -109,6 +114,7 @@ class Train extends Component {
this.initImgs(this.state.imgUrls);
}
);
this.hansChangeForm();
} else {
Toast.info('上传图片失败,请重试', 2);
}
......@@ -167,10 +173,14 @@ class Train extends Component {
}
]);
};
hansChangeForm = () => {
this.setState({ hasChange: true });
};
delFile = () => {
this.setState({
certificateFiles: []
});
this.hansChangeForm();
};
render() {
const { startTime, endTime, backgroundArea, certificateFiles, viewImages } = this.state;
......@@ -201,7 +211,7 @@ class Train extends Component {
<UpLoad certificateFiles={certificateFiles} viewImages={viewImages} refresh={this.refreshFile} delFile={this.delFile} />
</div>
<div className="bottom-operate">
<button onClick={this.submitTrain} className="am-button am-button-primary">
<button disabled={this.state.isEdit && !this.state.hasChange} onClick={this.submitTrain} className="am-button am-button-primary">
提交
</button>
</div>
......
......@@ -19,6 +19,7 @@ class TrainList extends Component {
}
};
componentDidMount() {
document.title = '受训背景';
app().downRefresh(true);
app().notRefresh(true);
const userInfo = storage.getSS('urlQuery');
......
......@@ -20,6 +20,7 @@ class AddMaterial extends Component {
certificateFiles: [],
viewImages: [],
isEdit: false, //是否是编辑
hasChange: false, //是否编辑过
isShowRange: false,
modifyId: null,
id: null
......@@ -34,7 +35,7 @@ class AddMaterial extends Component {
if (index > 2 || index === null) {
return Toast.info('路径有误');
}
console.log(modifyId, modifyId !== null);
document.title = MATERIAL_ARR[index];
this.setState({
isEdit: modifyId !== null,
materialType: index,
......@@ -91,6 +92,8 @@ class AddMaterial extends Component {
this.setState({
[name]: value
});
this.hansChangeForm();
};
refreshFile = res => {
if (res.code >= 0) {
......@@ -102,6 +105,7 @@ class AddMaterial extends Component {
this.initImgs(this.state.imgUrls);
}
);
this.hansChangeForm();
} else {
Toast.info('上传图片失败,请重试', 2);
}
......@@ -111,6 +115,7 @@ class AddMaterial extends Component {
this.setState({
certificateFiles: []
});
this.hansChangeForm();
};
validateForm = () => {
if (!this.state.backgroundArea) {
......@@ -118,6 +123,10 @@ class AddMaterial extends Component {
}
return true;
};
hansChangeForm = () => {
this.setState({ hasChange: true });
};
toggleRange = () => {
this.setState({
isShowRange: !this.state.isShowRange
......@@ -188,7 +197,7 @@ class AddMaterial extends Component {
<UpLoad certificateFiles={certificateFiles} viewImages={viewImages} refresh={this.refreshFile} delFile={this.delFile} />
</div>
<div className="bottom-operate">
<button onClick={this.submitJob} className="am-button am-button-primary">
<button disabled={this.state.isEdit && !this.state.hasChange} onClick={this.submitJob} className="am-button am-button-primary">
提交
</button>
</div>
......
......@@ -927,6 +927,12 @@ textarea::placeholder {
height: 45px;
line-height: 45px;
}
.am-button[disabled] {
background-color: #ddd;
&::before {
border: 1px solid #ddd !important;
}
}
.deposit-user .my-list .am-list-item .am-list-line .am-list-content,
.am-list-item .am-list-line .am-list-extra {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment