diff --git a/src/App.js b/src/App.js
index 50808276..61d0e761 100644
--- a/src/App.js
+++ b/src/App.js
@@ -3,9 +3,9 @@ import './App.css';
import { ConfigProvider } from 'antd'
import zhCN from 'antd/lib/locale-provider/zh_CN';
import {
- // BrowserRouter as Router,
- Route,
- Switch
+ // BrowserRouter as Router,
+ Route,
+ Switch
} from 'react-router-dom';
import axios from 'axios';
import LoginDialog from './modules/login/LoginDialog';
@@ -26,18 +26,18 @@ import configureStore from './redux/stores/configureStore';
const store = configureStore();
window.marked = marked;
const theme = createMuiTheme({
- palette: {
- primary: {
- main: '#4CACFF',
- contrastText: 'rgba(255, 255, 255, 0.87)'
- },
- secondary: { main: '#4CACFF' }, // #11cb5f This is just green.A700 as hex.
- },
+ palette: {
+ primary: {
+ main: '#4CACFF',
+ contrastText: 'rgba(255, 255, 255, 0.87)'
+ },
+ secondary: { main: '#4CACFF' }, // #11cb5f This is just green.A700 as hex.
+ },
});
//forge项目
const Projects = Loadable({
- loader: () => import('./forge/Index'),
- loading: Loading,
+ loader: () => import('./forge/Index'),
+ loading: Loading,
})
// forge项目详情
const ProjectDetail = Loadable({
@@ -46,55 +46,55 @@ const ProjectDetail = Loadable({
});
//forge安全设置
const Security = Loadable({
- loader: () => import('./forge/SecuritySetting/Index'),
- loading: Loading,
+ loader: () => import('./forge/SecuritySetting/Index'),
+ loading: Loading,
})
//forge项目-devOps详情
const OpsDetail = Loadable({
- loader: () => import('./forge/DevOps/opsDetail'),
- loading: Loading,
+ loader: () => import('./forge/DevOps/opsDetail'),
+ loading: Loading,
})
//403页面
const Shixunauthority = Loadable({
- loader: () => import('./modules/403/Shixunauthority'),
- loading: Loading,
+ loader: () => import('./modules/403/Shixunauthority'),
+ loading: Loading,
})
//404页面
const Shixunnopage = Loadable({
- loader: () => import('./modules/404/Shixunnopage'),
- loading: Loading,
+ loader: () => import('./modules/404/Shixunnopage'),
+ loading: Loading,
})
//500页面
const http500 = Loadable({
- loader: () => import('./modules/500/http500'),
- loading: Loading,
+ loader: () => import('./modules/500/http500'),
+ loading: Loading,
})
const InfosIndex = Loadable({
- loader: () => import('./forge/users/Index'),
- loading: Loading,
+ loader: () => import('./forge/users/Index'),
+ loading: Loading,
})
// 组织
const OrganizeIndex = Loadable({
- loader: () => import('./forge/Team/Index'),
- loading: Loading,
+ loader: () => import('./forge/Team/Index'),
+ loading: Loading,
})
const EducoderLogin = Loadable({
- loader: () => import('./modules/login/EducoderLogin'),
- loading: Loading,
+ loader: () => import('./modules/login/EducoderLogin'),
+ loading: Loading,
})
const Search = Loadable({
- loader: () => import('./modules/search/'),
- loading: Loading,
+ loader: () => import('./modules/search/'),
+ loading: Loading,
})
const WikiPreview = Loadable({
- loader: () => import('./forge/Wiki/Preview'),
- loading: Loading,
+ loader: () => import('./forge/Wiki/Preview'),
+ loading: Loading,
})
const ProjectIndex = Loadable({
- loader: () => import("./forge/Index"),
- loading: Loading,
+ loader: () => import("./forge/Index"),
+ loading: Loading,
});
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"];
class App extends Component {
- constructor(props) {
- super(props);
- this.state = {
- Addcoursestype: false,
- Addcoursestypes: false,
- mydisplay: false,
- occupation: 0,
- mygetHelmetapi: null,
- pathType: null,
- pathName: null,
- }
- }
+ constructor(props) {
+ super(props);
+ this.state = {
+ Addcoursestype: false,
+ Addcoursestypes: false,
+ mydisplay: false,
+ occupation: 0,
+ mygetHelmetapi: null,
+ pathType: null,
+ pathName: null,
+ }
+ }
- UNSAFE_componentWillMount() {
- initAxiosInterceptors(this.props);
- let pathname = window.location.pathname ? window.location.pathname.split('/')[1] : '';
- pathname && this.getPathnameType(pathname);
+ UNSAFE_componentWillMount() {
+ initAxiosInterceptors(this.props);
+ let pathname = window.location.pathname ? window.location.pathname.split('/')[1] : '';
+ pathname && this.getPathnameType(pathname);
- // 添加路由监听,决定组织还是个人
- this.unlisten = this.props.history.listen((location) => {
- let newPathname = location.pathname.split('/')[1];
- if (this.state.pathName !== newPathname) {
- // this.setState({ pathType: '' });
- newPathname && this.getPathnameType(newPathname);
- }
- });
- }
+ // 添加路由监听,决定组织还是个人
+ this.unlisten = this.props.history.listen((location) => {
+ let newPathname = location.pathname.split('/')[1];
+ if (this.state.pathName !== newPathname) {
+ // this.setState({ pathType: '' });
+ newPathname && this.getPathnameType(newPathname);
+ }
+ });
+ }
- shouldComponentUpdate(nextProps, nextState) {
- // (!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) {
- return false;
- } else {
- return true;
- }
- }
+ shouldComponentUpdate(nextProps, nextState) {
+ // (!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) {
+ return false;
+ } else {
+ return true;
+ }
+ }
- getPathnameType = (pathname) => {
- if (!keyWord.includes(pathname)) {
- let url = `/owners/${pathname}.json`;
- axios.get(url).then((response) => {
- if (response && response.status === 200) {
- this.setState({
- pathType: response.data.type || '404',
- pathName: pathname,
- })
- }
- });
- }else{
- this.setState({
- pathType: pathname,
- pathName: pathname,
- });
- }
- }
+ getPathnameType = (pathname) => {
+ if (!keyWord.includes(pathname)) {
+ let url = `/owners/${pathname}.json`;
+ axios.get(url).then((response) => {
+ if (response && response.status === 200) {
+ this.setState({
+ pathType: response.data.type || '404',
+ pathName: pathname,
+ })
+ }
+ });
+ }else{
+ this.setState({
+ pathType: pathname,
+ pathName: pathname,
+ });
+ }
+ }
- HideAddcoursestypess = (i) => {
- this.setState({
- Addcoursestype: false,
- Addcoursestypes: false,
- mydisplay: true,
- occupation: i,
- })
- };
- hideAddcoursestypes = () => {
- this.setState({
- Addcoursestypes: false
- })
- };
+ HideAddcoursestypess = (i) => {
+ this.setState({
+ Addcoursestype: false,
+ Addcoursestypes: false,
+ mydisplay: true,
+ occupation: i,
+ })
+ };
+ hideAddcoursestypes = () => {
+ this.setState({
+ Addcoursestypes: false
+ })
+ };
- componentDidMount() {
- document.title = "loading...";
+ componentDidMount() {
+ document.title = "loading...";
- this.getAppdata();
+ this.getAppdata();
- window.addEventListener('error', (event) => {
- const msg = `${event.type}: ${event.message}`;
- });
+ window.addEventListener('error', (event) => {
+ const msg = `${event.type}: ${event.message}`;
+ });
- }
+ }
- componentWillUnmount() {
- this.unlisten && this.unlisten(); // 执行解绑
- }
+ componentWillUnmount() {
+ this.unlisten && this.unlisten(); // 执行解绑
+ }
- //修改登录方法
- Modifyloginvalue = () => {
- this.setState({
- isRender: false,
- })
- };
+ //修改登录方法
+ Modifyloginvalue = () => {
+ this.setState({
+ isRender: false,
+ })
+ };
- //获取数据为空的时候
- gettablogourlnull = () => {
- this.setState({
- mygetHelmetapi: undefined
- });
- document.title = "Forge";
- var link = document.createElement('link'),
- oldLink = document.getElementById('dynamic-favicon');
- link.id = 'dynamic-favicon';
- link.rel = 'shortcut icon';
- link.href = "/react/build/./favicon.ico";
- if (oldLink) {
- document.head.removeChild(oldLink);
- }
- document.head.appendChild(link);
- };
+ //获取数据为空的时候
+ gettablogourlnull = () => {
+ this.setState({
+ mygetHelmetapi: undefined
+ });
+ document.title = "Forge";
+ var link = document.createElement('link'),
+ oldLink = document.getElementById('dynamic-favicon');
+ link.id = 'dynamic-favicon';
+ link.rel = 'shortcut icon';
+ link.href = "/react/build/./favicon.ico";
+ if (oldLink) {
+ document.head.removeChild(oldLink);
+ }
+ document.head.appendChild(link);
+ };
- //获取数据的时候
- gettablogourldata = (response) => {
- document.title = response.data.setting.name;
- var link = document.createElement('link'),
- oldLink = document.getElementById('dynamic-favicon');
- link.id = 'dynamic-favicon';
- link.rel = 'shortcut icon';
- link.href = '/' + response.data.setting.tab_logo_url;
- if (oldLink) {
- document.head.removeChild(oldLink);
- }
- document.head.appendChild(link);
- }
- //获取当前定制信息
- getAppdata = () => {
- let url = "/setting.json";
- axios.get(url).then((response) => {
- if (response) {
- if (response.data) {
- this.setState({
- mygetHelmetapi: response.data.setting
- });
- //存储配置到游览器
- localStorage.setItem('chromesetting', JSON.stringify(response.data.setting));
- localStorage.setItem('chromesettingresponse', JSON.stringify(response));
- try {
- if (response.data.setting.tab_logo_url) {
- this.gettablogourldata(response);
- } else {
- this.gettablogourlnull();
- }
- } catch (e) {
- this.gettablogourlnull();
- }
- } else {
- this.gettablogourlnull();
- }
- } else {
- this.gettablogourlnull();
- }
- }).catch((error) => {
- this.gettablogourlnull();
- });
- };
+ //获取数据的时候
+ gettablogourldata = (response) => {
+ document.title = response.data.setting.name;
+ var link = document.createElement('link'),
+ oldLink = document.getElementById('dynamic-favicon');
+ link.id = 'dynamic-favicon';
+ link.rel = 'shortcut icon';
+ link.href = '/' + response.data.setting.tab_logo_url;
+ if (oldLink) {
+ document.head.removeChild(oldLink);
+ }
+ document.head.appendChild(link);
+ }
+ //获取当前定制信息
+ getAppdata = () => {
+ let url = "/setting.json";
+ axios.get(url).then((response) => {
+ if (response) {
+ if (response.data) {
+ this.setState({
+ mygetHelmetapi: response.data.setting
+ });
+ //存储配置到游览器
+ localStorage.setItem('chromesetting', JSON.stringify(response.data.setting));
+ localStorage.setItem('chromesettingresponse', JSON.stringify(response));
+ try {
+ if (response.data.setting.tab_logo_url) {
+ this.gettablogourldata(response);
+ } else {
+ this.gettablogourlnull();
+ }
+ } catch (e) {
+ this.gettablogourlnull();
+ }
+ } else {
+ this.gettablogourlnull();
+ }
+ } else {
+ this.gettablogourlnull();
+ }
+ }).catch((error) => {
+ this.gettablogourlnull();
+ });
+ };
- render() {
- const { mygetHelmetapi, pathType} = this.state;
- let personal = mygetHelmetapi && mygetHelmetapi.personal;
- return (
-