forked from Gitlink/forgeplus-react
修改bug
This commit is contained in:
parent
2b176df99a
commit
eaba41ced0
|
@ -100,9 +100,10 @@ class EditableTable extends React.Component {
|
|||
{
|
||||
title: '用户id',
|
||||
dataIndex: 'user_id',
|
||||
with:80,
|
||||
},
|
||||
{
|
||||
title: '单位',
|
||||
title: '赛区',
|
||||
dataIndex: 'data',
|
||||
render: ((text, record,i) => {
|
||||
return this.props.plainOptions.length ? <Checkbox.Group options={this.props.plainOptions} value={text} onChange={(v)=>{this.changeData(v,i)}}/> : ''
|
||||
|
@ -123,15 +124,6 @@ class EditableTable extends React.Component {
|
|||
}
|
||||
|
||||
UNSAFE_componentWillReceiveProps(newProps) {
|
||||
if (newProps.plainOptions !== this.props.plainOptions && !this.state.dataSource.length) {
|
||||
this.setState({
|
||||
dataSource: [{
|
||||
key: 0,
|
||||
name: '',
|
||||
data: newProps.plainOptions
|
||||
}]
|
||||
})
|
||||
}
|
||||
if (newProps.admin_data !== this.props.admin_data ) {
|
||||
let newKey=[]
|
||||
for (const item of newProps.admin_data){
|
||||
|
|
|
@ -56,9 +56,14 @@ export default Form.create()(({ form, match, history, current_user, showNotifica
|
|||
}, 800);
|
||||
setTimeout(() => {
|
||||
setAbout_us(details.about_us);
|
||||
document.querySelector('#title').focus();
|
||||
}, 1400);
|
||||
zonesArr(details.zones, details.zones_local);
|
||||
setAdmin_data(details.admin_data ? JSON.parse(details.admin_data) : []);
|
||||
if (details.is_local) {
|
||||
zonesArr(details.zones_local);
|
||||
} else {
|
||||
zonesArr(details.zones);
|
||||
}
|
||||
setAdmin_data(details.admin_data || []);
|
||||
}
|
||||
setLoading(false);
|
||||
}).catch((error) => {
|
||||
|
@ -128,7 +133,7 @@ export default Form.create()(({ form, match, history, current_user, showNotifica
|
|||
validateFields((error, values) => {
|
||||
if (!error) {
|
||||
setLoading(true);
|
||||
values.admin_data = JSON.stringify(tableRef.current.state.dataSource);
|
||||
values.admin_data = tableRef.current.state.dataSource;
|
||||
if (id) {
|
||||
const url = `/competition_infos/${id}.json`
|
||||
axios.put(url, values).then(res => {
|
||||
|
@ -154,16 +159,19 @@ export default Form.create()(({ form, match, history, current_user, showNotifica
|
|||
setLoading(false);
|
||||
}
|
||||
|
||||
function zonesArr(zones, zones_local) {
|
||||
function zonesArr(zones) {
|
||||
const dataSet = new Set();
|
||||
zones && zones.split(',').map(item => { item && dataSet.add(item) });
|
||||
zones_local && zones_local.split(',').map(item => { item && dataSet.add(item) });
|
||||
setPlainOptions(dataSet.toJSON());
|
||||
}
|
||||
|
||||
function zonesChange() {
|
||||
let data = getFieldsValue(['zones', 'zones_local']);
|
||||
zonesArr(data.zones, data.zones_local)
|
||||
let data = getFieldsValue(['zones', 'zones_local', 'is_local']);
|
||||
if (data.is_local) {
|
||||
zonesArr(data.zones_local)
|
||||
} else {
|
||||
zonesArr(data.zones)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -173,7 +181,7 @@ export default Form.create()(({ form, match, history, current_user, showNotifica
|
|||
{helper('赛事名称',
|
||||
'title',
|
||||
[{ required: true, message: "请正确输入赛事名称" }],
|
||||
<Input placeholder="请输入参赛单位" onBlur={() => { verify("title") }} />
|
||||
<Input placeholder="请输入参赛单位" onBlur={() => { verify("title") }}/>
|
||||
)}
|
||||
|
||||
{helper('赛事唯一标识',
|
||||
|
@ -275,7 +283,7 @@ export default Form.create()(({ form, match, history, current_user, showNotifica
|
|||
|
||||
|
||||
<Form.Item label={'是否内网环境'} >
|
||||
{getFieldDecorator('is_local', { valuePropName: "checked" })(<Checkbox />)}
|
||||
{getFieldDecorator('is_local', { valuePropName: "checked" })(<Checkbox onBlur={zonesChange}/>)}
|
||||
</Form.Item>
|
||||
|
||||
{helper('赛区(内网)',
|
||||
|
@ -296,7 +304,6 @@ export default Form.create()(({ form, match, history, current_user, showNotifica
|
|||
<EditTable plainOptions={plainOptions} admin_data={admin_data} ref={tableRef} showNotification={showNotification} />
|
||||
{getFieldDecorator("admin_data", {
|
||||
rules: [],
|
||||
validateFirst: true,
|
||||
})(<Input style={{ display: "none" }} />)}
|
||||
</Form.Item>
|
||||
|
||||
|
@ -310,7 +317,6 @@ export default Form.create()(({ form, match, history, current_user, showNotifica
|
|||
/>
|
||||
{getFieldDecorator("content", {
|
||||
rules: [{ required: true, message: "请输入大赛介绍" }],
|
||||
validateFirst: true,
|
||||
})(<Input style={{ display: "none" }} />)}
|
||||
</Form.Item>
|
||||
|
||||
|
@ -324,7 +330,6 @@ export default Form.create()(({ form, match, history, current_user, showNotifica
|
|||
/>
|
||||
{getFieldDecorator("guide", {
|
||||
rules: [{ required: true, message: "请输入赛事指南" }],
|
||||
validateFirst: true,
|
||||
})(<Input style={{ display: "none" }} />)}
|
||||
</Form.Item>
|
||||
|
||||
|
@ -338,7 +343,6 @@ export default Form.create()(({ form, match, history, current_user, showNotifica
|
|||
/>
|
||||
{getFieldDecorator("about_us", {
|
||||
rules: [{ required: true, message: "请输入联系我们" }],
|
||||
validateFirst: true,
|
||||
})(<Input style={{ display: "none" }} />)}
|
||||
</Form.Item>
|
||||
<div className="mt20">
|
||||
|
|
|
@ -23,7 +23,7 @@ export default Form.create()((props) => {
|
|||
|
||||
useEffect(()=>{
|
||||
setDescription(qzDetail && type === "introduce" ? (qzDetail && qzDetail.content) : type === "fingerpost" ? (qzDetail && qzDetail.guide) : (qzDetail && qzDetail.about_us));
|
||||
setFieldsValue({video_url: qzDetail && qzDetail.video_url});
|
||||
// setFieldsValue({video_url: qzDetail && qzDetail.video_url});
|
||||
}, [qzDetail])
|
||||
|
||||
function submit(){
|
||||
|
@ -39,7 +39,7 @@ export default Form.create()((props) => {
|
|||
// 用户输入正确
|
||||
const info = new Object();
|
||||
info[type === "introduce" ? "content" : type === "fingerpost" ? "guide" : "about_us"] = description;
|
||||
type === "introduce" && (info["video_url"] = values.video_url);
|
||||
// type === "introduce" && (info["video_url"] = values.video_url);
|
||||
const params = {
|
||||
'competition_info': info,
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ export default Form.create()((props) => {
|
|||
<span className="font-16 _18">编辑</span>
|
||||
</div>
|
||||
<Form className="qz2022_notice_edit" size="small">
|
||||
{type === "introduce" && <Form.Item label="视频地址">
|
||||
{/* {type === "introduce" && <Form.Item label="视频地址">
|
||||
{getFieldDecorator("video_url", {
|
||||
rules: [
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ export default Form.create()((props) => {
|
|||
},
|
||||
]
|
||||
})(<Input placeholder="标题" size="large" maxLength={200}/>)}
|
||||
</Form.Item>}
|
||||
</Form.Item>} */}
|
||||
<div className="qzContent">
|
||||
<p className="title mb10"><span>*</span>内容:</p>
|
||||
<p className={`errorMessage mb10 ${errorMessage && 'not'}`}>{errorMessage}</p>
|
||||
|
|
Loading…
Reference in New Issue