diff --git a/src/managements/competition/editTable/index.jsx b/src/managements/competition/editTable/index.jsx index 499ab840..620260be 100644 --- a/src/managements/competition/editTable/index.jsx +++ b/src/managements/competition/editTable/index.jsx @@ -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 ? {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){ diff --git a/src/managements/competition/setting/index.jsx b/src/managements/competition/setting/index.jsx index 4d608160..00b24959 100644 --- a/src/managements/competition/setting/index.jsx +++ b/src/managements/competition/setting/index.jsx @@ -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: "请正确输入赛事名称" }], - { verify("title") }} /> + { verify("title") }}/> )} {helper('赛事唯一标识', @@ -275,7 +283,7 @@ export default Form.create()(({ form, match, history, current_user, showNotifica - {getFieldDecorator('is_local', { valuePropName: "checked" })()} + {getFieldDecorator('is_local', { valuePropName: "checked" })()} {helper('赛区(内网)', @@ -296,7 +304,6 @@ export default Form.create()(({ form, match, history, current_user, showNotifica {getFieldDecorator("admin_data", { rules: [], - validateFirst: true, })()} @@ -310,7 +317,6 @@ export default Form.create()(({ form, match, history, current_user, showNotifica /> {getFieldDecorator("content", { rules: [{ required: true, message: "请输入大赛介绍" }], - validateFirst: true, })()} @@ -324,7 +330,6 @@ export default Form.create()(({ form, match, history, current_user, showNotifica /> {getFieldDecorator("guide", { rules: [{ required: true, message: "请输入赛事指南" }], - validateFirst: true, })()} @@ -338,7 +343,6 @@ export default Form.create()(({ form, match, history, current_user, showNotifica /> {getFieldDecorator("about_us", { rules: [{ required: true, message: "请输入联系我们" }], - validateFirst: true, })()}
diff --git a/src/military/qz2022/components/manageEdit.jsx b/src/military/qz2022/components/manageEdit.jsx index fb7441e7..35d6242a 100644 --- a/src/military/qz2022/components/manageEdit.jsx +++ b/src/military/qz2022/components/manageEdit.jsx @@ -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) => { 编辑
- {type === "introduce" && + {/* {type === "introduce" && {getFieldDecorator("video_url", { rules: [ { @@ -74,7 +74,7 @@ export default Form.create()((props) => { }, ] })()} - } + } */}

*内容:

{errorMessage}