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