forked from Gitlink/forgeplus-react
Merge branch 'gitlink_server' into new_final
This commit is contained in:
commit
efcfe64da7
|
|
@ -4,6 +4,7 @@ import '@wangeditor/editor/dist/css/style.css';
|
|||
import cookie from 'react-cookies';
|
||||
import { message, Spin } from 'antd';
|
||||
import axios from 'axios';
|
||||
import './index.scss';
|
||||
|
||||
// 富文本编辑器
|
||||
function MyEditor(props) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
.w-e-modal{
|
||||
input, button, select, optgroup, textarea{
|
||||
line-height: 1.9;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
|
|||
import { Form , Input , Row , Col, Button } from 'antd';
|
||||
import '../index.scss';
|
||||
import { postCreateZone } from '../api';
|
||||
import cookie from 'react-cookies';
|
||||
import axios from 'axios';
|
||||
const { TextArea } = Input;
|
||||
|
||||
const phonereg = /^([1][3456789])\d{9}$/
|
||||
|
|
@ -45,6 +45,17 @@ function Apply(props){
|
|||
callback();
|
||||
}
|
||||
|
||||
function checkId(rule,value,callback){
|
||||
value ? axios.post(`/accounts/check_keywords`, {
|
||||
text:value
|
||||
}).then(response => {
|
||||
if(response && response.data.data===false){
|
||||
callback("与系统标识重复,请更改标识");
|
||||
}
|
||||
callback();
|
||||
}):callback();
|
||||
}
|
||||
|
||||
|
||||
return(
|
||||
<div className="applyBox">
|
||||
|
|
@ -94,7 +105,10 @@ function Apply(props){
|
|||
rules:[
|
||||
{ required: true,message:"请输入专区域名标识" },
|
||||
{ pattern: /^[a-zA-Z][a-zA-Z0-9_-]{0,18}[a-zA-Z]$/, message: "长度2-20,只能包含数字、字母、下划线、中划线,必须以字母开头结尾"},
|
||||
]
|
||||
{ validator:checkId }
|
||||
],
|
||||
validateTrigger:"onBlur",
|
||||
validateFirst: true,
|
||||
})(
|
||||
<Input placeholder="请输入专区域名标识" maxLength={20} style={{height:"36px"}}/>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import { addNewsByDirId, getDirListById, getNewsDetailByAu, updateDoc } from '..
|
|||
import { httpUrl } from '../fetch';
|
||||
|
||||
function NewsCreate(props){
|
||||
const {history, id} = props;
|
||||
const {history, id, role, current_user} = props;
|
||||
const temp = props.temp;
|
||||
const { getFieldDecorator, validateFields , setFieldsValue, setFields } = props.form;
|
||||
const { deptId, id: newsId } = props.match.params;
|
||||
|
|
@ -27,6 +27,12 @@ function NewsCreate(props){
|
|||
wrapperCol: { span: 14 },
|
||||
};
|
||||
|
||||
useEffect(()=>{
|
||||
if((role && role.role === "None") || (current_user && !current_user.login)){
|
||||
history.push(`/zone/${deptId}`);
|
||||
}
|
||||
}, [role])
|
||||
|
||||
useEffect(()=>{
|
||||
id && getDircList();
|
||||
},[id])
|
||||
|
|
|
|||
|
|
@ -67,7 +67,12 @@ function SelfList(props){
|
|||
pageSize:limit,
|
||||
pageNum:page
|
||||
}).then(result=>{
|
||||
setList(result.data.rows);
|
||||
let rows = result.data && result.data.rows;
|
||||
if(rows && rows.length>0){
|
||||
setList(rows);
|
||||
}else{
|
||||
setList([]);
|
||||
}
|
||||
setTotal(result.data.total);
|
||||
setIsSpin(false);
|
||||
})
|
||||
|
|
@ -79,7 +84,12 @@ function SelfList(props){
|
|||
pageSize:limit,
|
||||
pageNum:page
|
||||
}).then(result=>{
|
||||
setList(result.data.rows);
|
||||
let rows = result.data && result.data.rows;
|
||||
if(rows && rows.length>0){
|
||||
setList(rows);
|
||||
}else{
|
||||
setList([]);
|
||||
}
|
||||
setTotal(result.data.total);
|
||||
setIsSpin(false);
|
||||
})
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { Link } from 'react-router-dom';
|
|||
import { getTypeByFileId, getSourceZoneList, addResource, getSourceDetailByAu, updateMyResource } from '../api';
|
||||
|
||||
function SourceCreate(props){
|
||||
const {history, id} = props;
|
||||
const {history, id, role, current_user} = props;
|
||||
const { getFieldDecorator, validateFields , setFieldsValue, setFields } = props.form;
|
||||
const { deptId, sourceid} = props.match.params;
|
||||
const pathname = props.location.pathname;
|
||||
|
|
@ -20,6 +20,12 @@ function SourceCreate(props){
|
|||
wrapperCol: { span: 14 },
|
||||
};
|
||||
|
||||
useEffect(()=>{
|
||||
if((role && role.role === "None") || (current_user && !current_user.login)){
|
||||
history.push(`/zone/${deptId}`);
|
||||
}
|
||||
}, [role])
|
||||
|
||||
useEffect(()=>{
|
||||
id && getZoneList();
|
||||
},[id])
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ function beforeFetch(actionUrl){
|
|||
}
|
||||
|
||||
const service = axios.create({
|
||||
headers:{Authorization:"fb55fcaae60bb0c341078dade4b37c965e285394"},
|
||||
baseURL: actionUrl,
|
||||
timeout: 1800000, // 请求超时时间
|
||||
});
|
||||
|
|
|
|||
|
|
@ -165,13 +165,13 @@ function Index(props){
|
|||
<Route
|
||||
path="/zone/:deptId/news/add"
|
||||
render={(p) => (
|
||||
<NewsCreate {...props} {...p} id={id} temp={ temp } data={data}/>
|
||||
<NewsCreate {...props} {...p} id={id} temp={ temp } data={data} role={role}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/zone/:deptId/news/:id/edit"
|
||||
render={(p) => (
|
||||
<NewsCreate {...props} {...p} id={id} temp={ temp } data={data}/>
|
||||
<NewsCreate {...props} {...p} id={id} temp={ temp } data={data} role={role}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
|
|
@ -195,13 +195,13 @@ function Index(props){
|
|||
<Route
|
||||
path="/zone/:deptId/source/add"
|
||||
render={(p) => (
|
||||
<SourceCreate {...props} {...p} id={id} temp={ temp } data={data}/>
|
||||
<SourceCreate {...props} {...p} id={id} temp={ temp } data={data} role={role}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/zone/:deptId/source/:sourceid/edit"
|
||||
render={(p) => (
|
||||
<SourceCreate {...props} {...p} id={id} temp={ temp }/>
|
||||
<SourceCreate {...props} {...p} id={id} temp={ temp } role={role}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
|
|
|
|||
Loading…
Reference in New Issue