merge gitlink首页、项目首页,update
This commit is contained in:
parent
a93b8a08c9
commit
015296e065
826
src/App.js
826
src/App.js
|
@ -3,9 +3,9 @@ import './App.css';
|
||||||
import { ConfigProvider } from 'antd'
|
import { ConfigProvider } from 'antd'
|
||||||
import zhCN from 'antd/lib/locale-provider/zh_CN';
|
import zhCN from 'antd/lib/locale-provider/zh_CN';
|
||||||
import {
|
import {
|
||||||
// BrowserRouter as Router,
|
// BrowserRouter as Router,
|
||||||
Route,
|
Route,
|
||||||
Switch
|
Switch
|
||||||
} from 'react-router-dom';
|
} from 'react-router-dom';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import LoginDialog from './modules/login/LoginDialog';
|
import LoginDialog from './modules/login/LoginDialog';
|
||||||
|
@ -26,18 +26,18 @@ import configureStore from './redux/stores/configureStore';
|
||||||
const store = configureStore();
|
const store = configureStore();
|
||||||
window.marked = marked;
|
window.marked = marked;
|
||||||
const theme = createMuiTheme({
|
const theme = createMuiTheme({
|
||||||
palette: {
|
palette: {
|
||||||
primary: {
|
primary: {
|
||||||
main: '#4CACFF',
|
main: '#4CACFF',
|
||||||
contrastText: 'rgba(255, 255, 255, 0.87)'
|
contrastText: 'rgba(255, 255, 255, 0.87)'
|
||||||
},
|
},
|
||||||
secondary: { main: '#4CACFF' }, // #11cb5f This is just green.A700 as hex.
|
secondary: { main: '#4CACFF' }, // #11cb5f This is just green.A700 as hex.
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
//forge项目
|
//forge项目
|
||||||
const Projects = Loadable({
|
const Projects = Loadable({
|
||||||
loader: () => import('./forge/Index'),
|
loader: () => import('./forge/Index'),
|
||||||
loading: Loading,
|
loading: Loading,
|
||||||
})
|
})
|
||||||
// forge项目详情
|
// forge项目详情
|
||||||
const ProjectDetail = Loadable({
|
const ProjectDetail = Loadable({
|
||||||
|
@ -46,55 +46,55 @@ const ProjectDetail = Loadable({
|
||||||
});
|
});
|
||||||
//forge安全设置
|
//forge安全设置
|
||||||
const Security = Loadable({
|
const Security = Loadable({
|
||||||
loader: () => import('./forge/SecuritySetting/Index'),
|
loader: () => import('./forge/SecuritySetting/Index'),
|
||||||
loading: Loading,
|
loading: Loading,
|
||||||
})
|
})
|
||||||
//forge项目-devOps详情
|
//forge项目-devOps详情
|
||||||
const OpsDetail = Loadable({
|
const OpsDetail = Loadable({
|
||||||
loader: () => import('./forge/DevOps/opsDetail'),
|
loader: () => import('./forge/DevOps/opsDetail'),
|
||||||
loading: Loading,
|
loading: Loading,
|
||||||
})
|
})
|
||||||
//403页面
|
//403页面
|
||||||
const Shixunauthority = Loadable({
|
const Shixunauthority = Loadable({
|
||||||
loader: () => import('./modules/403/Shixunauthority'),
|
loader: () => import('./modules/403/Shixunauthority'),
|
||||||
loading: Loading,
|
loading: Loading,
|
||||||
})
|
})
|
||||||
//404页面
|
//404页面
|
||||||
const Shixunnopage = Loadable({
|
const Shixunnopage = Loadable({
|
||||||
loader: () => import('./modules/404/Shixunnopage'),
|
loader: () => import('./modules/404/Shixunnopage'),
|
||||||
loading: Loading,
|
loading: Loading,
|
||||||
})
|
})
|
||||||
|
|
||||||
//500页面
|
//500页面
|
||||||
const http500 = Loadable({
|
const http500 = Loadable({
|
||||||
loader: () => import('./modules/500/http500'),
|
loader: () => import('./modules/500/http500'),
|
||||||
loading: Loading,
|
loading: Loading,
|
||||||
})
|
})
|
||||||
const InfosIndex = Loadable({
|
const InfosIndex = Loadable({
|
||||||
loader: () => import('./forge/users/Index'),
|
loader: () => import('./forge/users/Index'),
|
||||||
loading: Loading,
|
loading: Loading,
|
||||||
})
|
})
|
||||||
// 组织
|
// 组织
|
||||||
const OrganizeIndex = Loadable({
|
const OrganizeIndex = Loadable({
|
||||||
loader: () => import('./forge/Team/Index'),
|
loader: () => import('./forge/Team/Index'),
|
||||||
loading: Loading,
|
loading: Loading,
|
||||||
})
|
})
|
||||||
const EducoderLogin = Loadable({
|
const EducoderLogin = Loadable({
|
||||||
loader: () => import('./modules/login/EducoderLogin'),
|
loader: () => import('./modules/login/EducoderLogin'),
|
||||||
loading: Loading,
|
loading: Loading,
|
||||||
})
|
})
|
||||||
const Search = Loadable({
|
const Search = Loadable({
|
||||||
loader: () => import('./modules/search/'),
|
loader: () => import('./modules/search/'),
|
||||||
loading: Loading,
|
loading: Loading,
|
||||||
})
|
})
|
||||||
const WikiPreview = Loadable({
|
const WikiPreview = Loadable({
|
||||||
loader: () => import('./forge/Wiki/Preview'),
|
loader: () => import('./forge/Wiki/Preview'),
|
||||||
loading: Loading,
|
loading: Loading,
|
||||||
})
|
})
|
||||||
|
|
||||||
const ProjectIndex = Loadable({
|
const ProjectIndex = Loadable({
|
||||||
loader: () => import("./forge/Index"),
|
loader: () => import("./forge/Index"),
|
||||||
loading: Loading,
|
loading: Loading,
|
||||||
});
|
});
|
||||||
|
|
||||||
const Home = Loadable({
|
const Home = Loadable({
|
||||||
|
@ -110,411 +110,411 @@ const Home = Loadable({
|
||||||
const keyWord = ["explore", "settings", "setting", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email", "export", "nopage", "404", "403", "500", "501", "search", "organize"];
|
const keyWord = ["explore", "settings", "setting", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email", "export", "nopage", "404", "403", "500", "501", "search", "organize"];
|
||||||
|
|
||||||
class App extends Component {
|
class App extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
Addcoursestype: false,
|
Addcoursestype: false,
|
||||||
Addcoursestypes: false,
|
Addcoursestypes: false,
|
||||||
mydisplay: false,
|
mydisplay: false,
|
||||||
occupation: 0,
|
occupation: 0,
|
||||||
mygetHelmetapi: null,
|
mygetHelmetapi: null,
|
||||||
pathType: null,
|
pathType: null,
|
||||||
pathName: null,
|
pathName: null,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UNSAFE_componentWillMount() {
|
UNSAFE_componentWillMount() {
|
||||||
initAxiosInterceptors(this.props);
|
initAxiosInterceptors(this.props);
|
||||||
let pathname = window.location.pathname ? window.location.pathname.split('/')[1] : '';
|
let pathname = window.location.pathname ? window.location.pathname.split('/')[1] : '';
|
||||||
pathname && this.getPathnameType(pathname);
|
pathname && this.getPathnameType(pathname);
|
||||||
|
|
||||||
// 添加路由监听,决定组织还是个人
|
// 添加路由监听,决定组织还是个人
|
||||||
this.unlisten = this.props.history.listen((location) => {
|
this.unlisten = this.props.history.listen((location) => {
|
||||||
let newPathname = location.pathname.split('/')[1];
|
let newPathname = location.pathname.split('/')[1];
|
||||||
if (this.state.pathName !== newPathname) {
|
if (this.state.pathName !== newPathname) {
|
||||||
// this.setState({ pathType: '' });
|
// this.setState({ pathType: '' });
|
||||||
newPathname && this.getPathnameType(newPathname);
|
newPathname && this.getPathnameType(newPathname);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps, nextState) {
|
shouldComponentUpdate(nextProps, nextState) {
|
||||||
// (!keyWord.includes(this.props.location.pathname.split('/')[1])) &&
|
// (!keyWord.includes(this.props.location.pathname.split('/')[1])) &&
|
||||||
if (nextProps.location.pathname.split('/')[1] !== this.props.location.pathname.split('/')[1] && nextState.pathType === this.state.pathType) {
|
if (nextProps.location.pathname.split('/')[1] !== this.props.location.pathname.split('/')[1] && nextState.pathType === this.state.pathType) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getPathnameType = (pathname) => {
|
getPathnameType = (pathname) => {
|
||||||
if (!keyWord.includes(pathname)) {
|
if (!keyWord.includes(pathname)) {
|
||||||
let url = `/owners/${pathname}.json`;
|
let url = `/owners/${pathname}.json`;
|
||||||
axios.get(url).then((response) => {
|
axios.get(url).then((response) => {
|
||||||
if (response && response.status === 200) {
|
if (response && response.status === 200) {
|
||||||
this.setState({
|
this.setState({
|
||||||
pathType: response.data.type || '404',
|
pathType: response.data.type || '404',
|
||||||
pathName: pathname,
|
pathName: pathname,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
this.setState({
|
this.setState({
|
||||||
pathType: pathname,
|
pathType: pathname,
|
||||||
pathName: pathname,
|
pathName: pathname,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HideAddcoursestypess = (i) => {
|
HideAddcoursestypess = (i) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
Addcoursestype: false,
|
Addcoursestype: false,
|
||||||
Addcoursestypes: false,
|
Addcoursestypes: false,
|
||||||
mydisplay: true,
|
mydisplay: true,
|
||||||
occupation: i,
|
occupation: i,
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
hideAddcoursestypes = () => {
|
hideAddcoursestypes = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
Addcoursestypes: false
|
Addcoursestypes: false
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
document.title = "loading...";
|
document.title = "loading...";
|
||||||
|
|
||||||
this.getAppdata();
|
this.getAppdata();
|
||||||
|
|
||||||
window.addEventListener('error', (event) => {
|
window.addEventListener('error', (event) => {
|
||||||
const msg = `${event.type}: ${event.message}`;
|
const msg = `${event.type}: ${event.message}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this.unlisten && this.unlisten(); // 执行解绑
|
this.unlisten && this.unlisten(); // 执行解绑
|
||||||
}
|
}
|
||||||
|
|
||||||
//修改登录方法
|
//修改登录方法
|
||||||
Modifyloginvalue = () => {
|
Modifyloginvalue = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isRender: false,
|
isRender: false,
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
//获取数据为空的时候
|
//获取数据为空的时候
|
||||||
gettablogourlnull = () => {
|
gettablogourlnull = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
mygetHelmetapi: undefined
|
mygetHelmetapi: undefined
|
||||||
});
|
});
|
||||||
document.title = "Forge";
|
document.title = "Forge";
|
||||||
var link = document.createElement('link'),
|
var link = document.createElement('link'),
|
||||||
oldLink = document.getElementById('dynamic-favicon');
|
oldLink = document.getElementById('dynamic-favicon');
|
||||||
link.id = 'dynamic-favicon';
|
link.id = 'dynamic-favicon';
|
||||||
link.rel = 'shortcut icon';
|
link.rel = 'shortcut icon';
|
||||||
link.href = "/react/build/./favicon.ico";
|
link.href = "/react/build/./favicon.ico";
|
||||||
if (oldLink) {
|
if (oldLink) {
|
||||||
document.head.removeChild(oldLink);
|
document.head.removeChild(oldLink);
|
||||||
}
|
}
|
||||||
document.head.appendChild(link);
|
document.head.appendChild(link);
|
||||||
};
|
};
|
||||||
|
|
||||||
//获取数据的时候
|
//获取数据的时候
|
||||||
gettablogourldata = (response) => {
|
gettablogourldata = (response) => {
|
||||||
document.title = response.data.setting.name;
|
document.title = response.data.setting.name;
|
||||||
var link = document.createElement('link'),
|
var link = document.createElement('link'),
|
||||||
oldLink = document.getElementById('dynamic-favicon');
|
oldLink = document.getElementById('dynamic-favicon');
|
||||||
link.id = 'dynamic-favicon';
|
link.id = 'dynamic-favicon';
|
||||||
link.rel = 'shortcut icon';
|
link.rel = 'shortcut icon';
|
||||||
link.href = '/' + response.data.setting.tab_logo_url;
|
link.href = '/' + response.data.setting.tab_logo_url;
|
||||||
if (oldLink) {
|
if (oldLink) {
|
||||||
document.head.removeChild(oldLink);
|
document.head.removeChild(oldLink);
|
||||||
}
|
}
|
||||||
document.head.appendChild(link);
|
document.head.appendChild(link);
|
||||||
}
|
}
|
||||||
//获取当前定制信息
|
//获取当前定制信息
|
||||||
getAppdata = () => {
|
getAppdata = () => {
|
||||||
let url = "/setting.json";
|
let url = "/setting.json";
|
||||||
axios.get(url).then((response) => {
|
axios.get(url).then((response) => {
|
||||||
if (response) {
|
if (response) {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
this.setState({
|
this.setState({
|
||||||
mygetHelmetapi: response.data.setting
|
mygetHelmetapi: response.data.setting
|
||||||
});
|
});
|
||||||
//存储配置到游览器
|
//存储配置到游览器
|
||||||
localStorage.setItem('chromesetting', JSON.stringify(response.data.setting));
|
localStorage.setItem('chromesetting', JSON.stringify(response.data.setting));
|
||||||
localStorage.setItem('chromesettingresponse', JSON.stringify(response));
|
localStorage.setItem('chromesettingresponse', JSON.stringify(response));
|
||||||
try {
|
try {
|
||||||
if (response.data.setting.tab_logo_url) {
|
if (response.data.setting.tab_logo_url) {
|
||||||
this.gettablogourldata(response);
|
this.gettablogourldata(response);
|
||||||
} else {
|
} else {
|
||||||
this.gettablogourlnull();
|
this.gettablogourlnull();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.gettablogourlnull();
|
this.gettablogourlnull();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.gettablogourlnull();
|
this.gettablogourlnull();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.gettablogourlnull();
|
this.gettablogourlnull();
|
||||||
}
|
}
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
this.gettablogourlnull();
|
this.gettablogourlnull();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { mygetHelmetapi, pathType} = this.state;
|
const { mygetHelmetapi, pathType} = this.state;
|
||||||
let personal = mygetHelmetapi && mygetHelmetapi.personal;
|
let personal = mygetHelmetapi && mygetHelmetapi.personal;
|
||||||
return (
|
return (
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<ConfigProvider locale={zhCN}>
|
<ConfigProvider locale={zhCN}>
|
||||||
<MuiThemeProvider theme={theme}>
|
<MuiThemeProvider theme={theme}>
|
||||||
<LoginDialog {...this.props} {...this.state} Modifyloginvalue={() => this.Modifyloginvalue()}></LoginDialog>
|
<LoginDialog {...this.props} {...this.state} Modifyloginvalue={() => this.Modifyloginvalue()}></LoginDialog>
|
||||||
<SiderBar />
|
<SiderBar />
|
||||||
{/* <Router> */}
|
{/* <Router> */}
|
||||||
<Switch>
|
<Switch>
|
||||||
{/* wiki预览 */}
|
{/* wiki预览 */}
|
||||||
<Route path="/:owner/:projectsId/wiki/preview/:projectName/:projectId" render={
|
<Route path="/:owner/:projectsId/wiki/preview/:projectName/:projectId" render={
|
||||||
(props) => {
|
(props) => {
|
||||||
return (<WikiPreview {...this.props} {...props} {...this.state} />)
|
return (<WikiPreview {...this.props} {...props} {...this.state} />)
|
||||||
}
|
}
|
||||||
} />
|
} />
|
||||||
|
|
||||||
{/* 项目PR */}
|
{/* 项目PR */}
|
||||||
<Route path="/:owner/:projectsId/compare"
|
<Route path="/:owner/:projectsId/compare"
|
||||||
render={
|
render={
|
||||||
(props) => (<ProjectDetail {...this.props} {...props} {...this.state} />)
|
(props) => (<ProjectDetail {...this.props} {...props} {...this.state} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
|
|
||||||
{/*项目*/}
|
{/*项目*/}
|
||||||
<Route
|
<Route
|
||||||
path={"/:owner/:projectId/devops/:opsId/detail"}
|
path={"/:owner/:projectId/devops/:opsId/detail"}
|
||||||
render={
|
render={
|
||||||
(props) => {
|
(props) => {
|
||||||
return (<OpsDetail {...this.props} {...props} {...this.state} />)
|
return (<OpsDetail {...this.props} {...props} {...this.state} />)
|
||||||
}
|
}
|
||||||
}>
|
}>
|
||||||
</Route>
|
</Route>
|
||||||
<Route
|
<Route
|
||||||
path={"/settings"}
|
path={"/settings"}
|
||||||
render={
|
render={
|
||||||
(props) => {
|
(props) => {
|
||||||
return (<Security {...this.props} {...props} {...this.state} />)
|
return (<Security {...this.props} {...props} {...this.state} />)
|
||||||
}
|
}
|
||||||
}>
|
}>
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path="/register"
|
path="/register"
|
||||||
render={
|
render={
|
||||||
(props) => {
|
(props) => {
|
||||||
return (<EducoderLogin {...this.props} {...props} {...this.state} />)
|
return (<EducoderLogin {...this.props} {...props} {...this.state} />)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
{/*403*/}
|
{/*403*/}
|
||||||
<Route path="/403" component={Shixunauthority} />
|
<Route path="/403" component={Shixunauthority} />
|
||||||
|
|
||||||
<Route path="/500" component={http500} />
|
<Route path="/500" component={http500} />
|
||||||
|
|
||||||
{/*404*/}
|
{/*404*/}
|
||||||
<Route path="/nopage" component={Shixunnopage} />
|
<Route path="/nopage" component={Shixunnopage} />
|
||||||
|
|
||||||
{/* 查询 */}
|
{/* 查询 */}
|
||||||
<Route path="/search" component={Search} />
|
<Route path="/search" component={Search} />
|
||||||
|
|
||||||
<Route exact path="/explore/all"
|
<Route exact path="/explore/all"
|
||||||
render={
|
render={
|
||||||
(props) => (
|
(props) => (
|
||||||
<ProjectIndex {...this.props} {...props} />
|
<ProjectIndex {...this.props} {...props} />
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route exact path="/explore"
|
<Route exact path="/explore"
|
||||||
render={
|
render={
|
||||||
(props) => (
|
(props) => (
|
||||||
<ProjectIndex {...this.props} {...props} />
|
<ProjectIndex {...this.props} {...props} />
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{/* 组织 */}
|
||||||
|
<Route path={"/organize"}
|
||||||
|
render={
|
||||||
|
(props) => {
|
||||||
|
return (<OrganizeIndex {...props} {...this.props} {...this.state} />)
|
||||||
|
}
|
||||||
|
}>
|
||||||
|
</Route>
|
||||||
|
|
||||||
|
{/*新建项目等*/}
|
||||||
|
<Route
|
||||||
|
path={"/projects"}
|
||||||
|
render={
|
||||||
|
(props) => {
|
||||||
|
return (<Projects {...this.props} {...props} {...this.state} />)
|
||||||
|
}
|
||||||
|
}>
|
||||||
|
</Route>
|
||||||
|
|
||||||
|
{/* 判断为用户/组织,并进入对应页面 */}
|
||||||
|
{
|
||||||
|
pathType === 'User' ?
|
||||||
|
<Route exact path="/:username"
|
||||||
|
render={
|
||||||
|
(props) => {
|
||||||
|
return (<InfosIndex {...this.props} {...this.state} />)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/> : pathType === 'Organization' ? <Route path={"/:OIdentifier"}
|
||||||
|
render={
|
||||||
|
(props) => {
|
||||||
|
return (<OrganizeIndex {...props} {...this.props} {...this.state} />)
|
||||||
|
}
|
||||||
|
}>
|
||||||
|
</Route> : pathType === '404' ? <Route component={Shixunnopage} />:
|
||||||
|
""
|
||||||
|
}
|
||||||
|
<Route exact path="/"
|
||||||
|
render={
|
||||||
|
(props) => (
|
||||||
|
<Home {...props} {...this.props} {...this.state}/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* 个人主页 */}
|
||||||
|
<Route path="/:username"
|
||||||
|
render={
|
||||||
|
(props) => {
|
||||||
|
return (<InfosIndex {...this.props} {...this.state} />)
|
||||||
|
}
|
||||||
|
}></Route>
|
||||||
|
|
||||||
|
|
||||||
{/* 组织 */}
|
<Route component={Shixunnopage} />
|
||||||
<Route path={"/organize"}
|
</Switch>
|
||||||
render={
|
{/* </Router> */}
|
||||||
(props) => {
|
</MuiThemeProvider>
|
||||||
return (<OrganizeIndex {...props} {...this.props} {...this.state} />)
|
</ConfigProvider>
|
||||||
}
|
</Provider>
|
||||||
}>
|
);
|
||||||
</Route>
|
}
|
||||||
|
|
||||||
{/*新建项目等*/}
|
|
||||||
<Route
|
|
||||||
path={"/projects"}
|
|
||||||
render={
|
|
||||||
(props) => {
|
|
||||||
return (<Projects {...this.props} {...props} {...this.state} />)
|
|
||||||
}
|
|
||||||
}>
|
|
||||||
</Route>
|
|
||||||
|
|
||||||
{/* 判断为用户/组织,并进入对应页面 */}
|
|
||||||
{
|
|
||||||
pathType === 'User' ?
|
|
||||||
<Route exact path="/:username"
|
|
||||||
render={
|
|
||||||
(props) => {
|
|
||||||
return (<InfosIndex {...this.props} {...this.state} />)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/> : pathType === 'Organization' ? <Route path={"/:OIdentifier"}
|
|
||||||
render={
|
|
||||||
(props) => {
|
|
||||||
return (<OrganizeIndex {...props} {...this.props} {...this.state} />)
|
|
||||||
}
|
|
||||||
}>
|
|
||||||
</Route> : pathType === '404' ? <Route component={Shixunnopage} />:
|
|
||||||
""
|
|
||||||
}
|
|
||||||
<Route exact path="/"
|
|
||||||
render={
|
|
||||||
(props) => (
|
|
||||||
<Home {...props} {...this.props} {...this.state}/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{/* 个人主页 */}
|
|
||||||
<Route path="/:username"
|
|
||||||
render={
|
|
||||||
(props) => {
|
|
||||||
return (<InfosIndex {...this.props} {...this.state} />)
|
|
||||||
}
|
|
||||||
}></Route>
|
|
||||||
|
|
||||||
|
|
||||||
<Route component={Shixunnopage} />
|
|
||||||
</Switch>
|
|
||||||
{/* </Router> */}
|
|
||||||
</MuiThemeProvider>
|
|
||||||
</ConfigProvider>
|
|
||||||
</Provider>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// moment国际化,设置为中文
|
// moment国际化,设置为中文
|
||||||
moment.defineLocale('zh-cn', {
|
moment.defineLocale('zh-cn', {
|
||||||
months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
|
months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
|
||||||
monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
|
monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
|
||||||
weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
|
weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
|
||||||
weekdaysShort: '周日_周一_周二_周三_周四_周五_周六'.split('_'),
|
weekdaysShort: '周日_周一_周二_周三_周四_周五_周六'.split('_'),
|
||||||
weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
|
weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
|
||||||
longDateFormat: {
|
longDateFormat: {
|
||||||
LT: 'Ah点mm分',
|
LT: 'Ah点mm分',
|
||||||
LTS: 'Ah点m分s秒',
|
LTS: 'Ah点m分s秒',
|
||||||
L: 'YYYY-MM-DD',
|
L: 'YYYY-MM-DD',
|
||||||
LL: 'YYYY年MMMD日',
|
LL: 'YYYY年MMMD日',
|
||||||
LLL: 'YYYY年MMMD日Ah点mm分',
|
LLL: 'YYYY年MMMD日Ah点mm分',
|
||||||
LLLL: 'YYYY年MMMD日ddddAh点mm分',
|
LLLL: 'YYYY年MMMD日ddddAh点mm分',
|
||||||
l: 'YYYY-MM-DD',
|
l: 'YYYY-MM-DD',
|
||||||
ll: 'YYYY年MMMD日',
|
ll: 'YYYY年MMMD日',
|
||||||
lll: 'YYYY年MMMD日Ah点mm分',
|
lll: 'YYYY年MMMD日Ah点mm分',
|
||||||
llll: 'YYYY年MMMD日ddddAh点mm分'
|
llll: 'YYYY年MMMD日ddddAh点mm分'
|
||||||
},
|
},
|
||||||
meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
|
meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
|
||||||
meridiemHour: function (hour, meridiem) {
|
meridiemHour: function (hour, meridiem) {
|
||||||
if (hour === 12) {
|
if (hour === 12) {
|
||||||
hour = 0;
|
hour = 0;
|
||||||
}
|
}
|
||||||
if (meridiem === '凌晨' || meridiem === '早上' ||
|
if (meridiem === '凌晨' || meridiem === '早上' ||
|
||||||
meridiem === '上午') {
|
meridiem === '上午') {
|
||||||
return hour;
|
return hour;
|
||||||
} else if (meridiem === '下午' || meridiem === '晚上') {
|
} else if (meridiem === '下午' || meridiem === '晚上') {
|
||||||
return hour + 12;
|
return hour + 12;
|
||||||
} else {
|
} else {
|
||||||
// '中午'
|
// '中午'
|
||||||
return hour >= 11 ? hour : hour + 12;
|
return hour >= 11 ? hour : hour + 12;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
meridiem: function (hour, minute, isLower) {
|
meridiem: function (hour, minute, isLower) {
|
||||||
var hm = hour * 100 + minute;
|
var hm = hour * 100 + minute;
|
||||||
if (hm < 600) {
|
if (hm < 600) {
|
||||||
return '凌晨';
|
return '凌晨';
|
||||||
} else if (hm < 900) {
|
} else if (hm < 900) {
|
||||||
return '早上';
|
return '早上';
|
||||||
} else if (hm < 1130) {
|
} else if (hm < 1130) {
|
||||||
return '上午';
|
return '上午';
|
||||||
} else if (hm < 1230) {
|
} else if (hm < 1230) {
|
||||||
return '中午';
|
return '中午';
|
||||||
} else if (hm < 1800) {
|
} else if (hm < 1800) {
|
||||||
return '下午';
|
return '下午';
|
||||||
} else {
|
} else {
|
||||||
return '晚上';
|
return '晚上';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
calendar: {
|
calendar: {
|
||||||
sameDay: function () {
|
sameDay: function () {
|
||||||
return this.minutes() === 0 ? '[今天]Ah[点整]' : '[今天]LT';
|
return this.minutes() === 0 ? '[今天]Ah[点整]' : '[今天]LT';
|
||||||
},
|
},
|
||||||
nextDay: function () {
|
nextDay: function () {
|
||||||
return this.minutes() === 0 ? '[明天]Ah[点整]' : '[明天]LT';
|
return this.minutes() === 0 ? '[明天]Ah[点整]' : '[明天]LT';
|
||||||
},
|
},
|
||||||
lastDay: function () {
|
lastDay: function () {
|
||||||
return this.minutes() === 0 ? '[昨天]Ah[点整]' : '[昨天]LT';
|
return this.minutes() === 0 ? '[昨天]Ah[点整]' : '[昨天]LT';
|
||||||
},
|
},
|
||||||
nextWeek: function () {
|
nextWeek: function () {
|
||||||
var startOfWeek, prefix;
|
var startOfWeek, prefix;
|
||||||
startOfWeek = moment().startOf('week');
|
startOfWeek = moment().startOf('week');
|
||||||
prefix = this.unix() - startOfWeek.unix() >= 7 * 24 * 3600 ? '[下]' : '[本]';
|
prefix = this.unix() - startOfWeek.unix() >= 7 * 24 * 3600 ? '[下]' : '[本]';
|
||||||
return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
|
return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
|
||||||
},
|
},
|
||||||
lastWeek: function () {
|
lastWeek: function () {
|
||||||
var startOfWeek, prefix;
|
var startOfWeek, prefix;
|
||||||
startOfWeek = moment().startOf('week');
|
startOfWeek = moment().startOf('week');
|
||||||
prefix = this.unix() < startOfWeek.unix() ? '[上]' : '[本]';
|
prefix = this.unix() < startOfWeek.unix() ? '[上]' : '[本]';
|
||||||
return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
|
return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
|
||||||
},
|
},
|
||||||
sameElse: 'LL'
|
sameElse: 'LL'
|
||||||
},
|
},
|
||||||
ordinalParse: /\d{1,2}(日|月|周)/,
|
ordinalParse: /\d{1,2}(日|月|周)/,
|
||||||
ordinal: function (number, period) {
|
ordinal: function (number, period) {
|
||||||
switch (period) {
|
switch (period) {
|
||||||
case 'd':
|
case 'd':
|
||||||
case 'D':
|
case 'D':
|
||||||
case 'DDD':
|
case 'DDD':
|
||||||
return number + '日';
|
return number + '日';
|
||||||
case 'M':
|
case 'M':
|
||||||
return number + '月';
|
return number + '月';
|
||||||
case 'w':
|
case 'w':
|
||||||
case 'W':
|
case 'W':
|
||||||
return number + '周';
|
return number + '周';
|
||||||
default:
|
default:
|
||||||
return number;
|
return number;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
relativeTime: {
|
relativeTime: {
|
||||||
future: '%s内',
|
future: '%s内',
|
||||||
past: '%s前',
|
past: '%s前',
|
||||||
s: '几秒',
|
s: '几秒',
|
||||||
m: '1分钟',
|
m: '1分钟',
|
||||||
mm: '%d分钟',
|
mm: '%d分钟',
|
||||||
h: '1小时',
|
h: '1小时',
|
||||||
hh: '%d小时',
|
hh: '%d小时',
|
||||||
d: '1天',
|
d: '1天',
|
||||||
dd: '%d天',
|
dd: '%d天',
|
||||||
M: '1个月',
|
M: '1个月',
|
||||||
MM: '%d个月',
|
MM: '%d个月',
|
||||||
y: '1年',
|
y: '1年',
|
||||||
yy: '%d年'
|
yy: '%d年'
|
||||||
},
|
},
|
||||||
week: {
|
week: {
|
||||||
// GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
|
// GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
|
||||||
dow: 1, // Monday is the first day of the week.
|
dow: 1, // Monday is the first day of the week.
|
||||||
doy: 4 // The week that contains Jan 4th is the first week of the year.
|
doy: 4 // The week that contains Jan 4th is the first week of the year.
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
export default SnackbarHOC()(App);
|
export default SnackbarHOC()(App);
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,9 @@ function Footer(){
|
||||||
}
|
}
|
||||||
|
|
||||||
return(
|
return(
|
||||||
value && showhtml(value)
|
<div>
|
||||||
|
{value && showhtml(value)}
|
||||||
|
</div>
|
||||||
// {/* <div className="footEdition">
|
// {/* <div className="footEdition">
|
||||||
// <div className="footContent">
|
// <div className="footContent">
|
||||||
// <ul className="center">
|
// <ul className="center">
|
||||||
|
|
|
@ -27,12 +27,6 @@ const ProjectHome = Loadable({
|
||||||
loading: Loading,
|
loading: Loading,
|
||||||
});
|
});
|
||||||
|
|
||||||
// 项目详情放在用户和组织下作为二级菜单存在
|
|
||||||
// const ProjectDetail = Loadable({
|
|
||||||
// loader: () => import("./Main/Detail"),
|
|
||||||
// loading: Loading,
|
|
||||||
// });
|
|
||||||
|
|
||||||
class Index extends Component {
|
class Index extends Component {
|
||||||
|
|
||||||
componentDidUpdate = () => {
|
componentDidUpdate = () => {
|
||||||
|
|
|
@ -539,11 +539,11 @@
|
||||||
}
|
}
|
||||||
.sInfos{
|
.sInfos{
|
||||||
background: #F7F8F9;
|
background: #F7F8F9;
|
||||||
padding:5px;
|
padding:0px 5px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #666666;
|
color: #666666;
|
||||||
line-height: 22px;
|
line-height: 24px;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue