forked from Gitlink/forgeplus-react
wiki新增页面时、保存按钮增加开关
This commit is contained in:
parent
e9bf164be4
commit
08ad756b6b
|
|
@ -23,6 +23,7 @@ export default Form.create()(({ form, history, showNotification, projectDetail,
|
|||
|
||||
const [content, setContent] = useState(undefined);
|
||||
const [modal, setModal] = useState(false);
|
||||
const [operateFlag, setOperateFlag ] = useState(false);
|
||||
const [modalType, setModalType] = useState();
|
||||
|
||||
useEffect(()=>{
|
||||
|
|
@ -86,6 +87,8 @@ export default Form.create()(({ form, history, showNotification, projectDetail,
|
|||
|
||||
// 保存wiki文件,包括新增和修改
|
||||
function saveFile() {
|
||||
if(operateFlag) return;
|
||||
setOperateFlag(true);
|
||||
validateFields((err, values) => {
|
||||
if (!err) {
|
||||
let regEn = /[\[\]`\/:*?''<>|%-+_]/g;
|
||||
|
|
@ -101,7 +104,10 @@ export default Form.create()(({ form, history, showNotification, projectDetail,
|
|||
pagename: wikiName,
|
||||
...values,
|
||||
commit_message: '',
|
||||
}).then(res => dealRes(res));
|
||||
}).then(res => {
|
||||
dealRes(res);
|
||||
setOperateFlag(false);
|
||||
});
|
||||
} else {
|
||||
if (Array.isArray(fileArrInit)) {
|
||||
for (const item of fileArrInit) {
|
||||
|
|
@ -118,7 +124,10 @@ export default Form.create()(({ form, history, showNotification, projectDetail,
|
|||
pagename: values.name,
|
||||
...values,
|
||||
commit_message: '',
|
||||
}).then(res => dealRes(res));
|
||||
}).then(res =>{
|
||||
dealRes(res);
|
||||
setOperateFlag(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue