From 015296e0658b940035ca45147be5006ad438cdd9 Mon Sep 17 00:00:00 2001 From: caishi Date: Fri, 29 Oct 2021 09:39:59 +0800 Subject: [PATCH 1/7] =?UTF-8?q?merge=20gitlink=E9=A6=96=E9=A1=B5=E3=80=81?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=A6=96=E9=A1=B5=EF=BC=8Cupdate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.js | 826 +++++++++++++------------- src/forge/Head/Footer.jsx | 4 +- src/forge/Index.js | 6 - src/forge/Main/projecthome/Index.scss | 4 +- 4 files changed, 418 insertions(+), 422 deletions(-) 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 ( - - - - this.Modifyloginvalue()}> - - {/* */} - - {/* wiki预览 */} - { - return () - } - } /> + render() { + const { mygetHelmetapi, pathType} = this.state; + let personal = mygetHelmetapi && mygetHelmetapi.personal; + return ( + + + + this.Modifyloginvalue()}> + + {/* */} + + {/* wiki预览 */} + { + return () + } + } /> - {/* 项目PR */} - () - } - > + {/* 项目PR */} + () + } + > - {/*项目*/} - { - return () - } - }> - - { - return () - } - }> - + {/*项目*/} + { + return () + } + }> + + { + return () + } + }> + - { - return () - } - } - /> - {/*403*/} - + { + return () + } + } + /> + {/*403*/} + - + - {/*404*/} - + {/*404*/} + - {/* 查询 */} - + {/* 查询 */} + - ( - - ) - } - /> - ( - - ) - } - /> + ( + + ) + } + /> + ( + + ) + } + /> + + {/* 组织 */} + { + return () + } + }> + + + {/*新建项目等*/} + { + return () + } + }> + + + {/* 判断为用户/组织,并进入对应页面 */} + { + pathType === 'User' ? + { + return () + } + } + /> : pathType === 'Organization' ? { + return () + } + }> + : pathType === '404' ? : + "" + } + ( + + ) + } + /> + + {/* 个人主页 */} + { + return () + } + }> - {/* 组织 */} - { - return () - } - }> - - - {/*新建项目等*/} - { - return () - } - }> - - - {/* 判断为用户/组织,并进入对应页面 */} - { - pathType === 'User' ? - { - return () - } - } - /> : pathType === 'Organization' ? { - return () - } - }> - : pathType === '404' ? : - "" - } - ( - - ) - } - /> - - {/* 个人主页 */} - { - return () - } - }> - - - - - {/* */} - - - - ); - } + + + {/* */} + + + + ); + } } // moment国际化,设置为中文 moment.defineLocale('zh-cn', { - months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort: '周日_周一_周二_周三_周四_周五_周六'.split('_'), - weekdaysMin: '日_一_二_三_四_五_六'.split('_'), - longDateFormat: { - LT: 'Ah点mm分', - LTS: 'Ah点m分s秒', - L: 'YYYY-MM-DD', - LL: 'YYYY年MMMD日', - LLL: 'YYYY年MMMD日Ah点mm分', - LLLL: 'YYYY年MMMD日ddddAh点mm分', - l: 'YYYY-MM-DD', - ll: 'YYYY年MMMD日', - lll: 'YYYY年MMMD日Ah点mm分', - llll: 'YYYY年MMMD日ddddAh点mm分' - }, - meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '凌晨' || meridiem === '早上' || - meridiem === '上午') { - return hour; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } else { - // '中午' - return hour >= 11 ? hour : hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return '凌晨'; - } else if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar: { - sameDay: function () { - return this.minutes() === 0 ? '[今天]Ah[点整]' : '[今天]LT'; - }, - nextDay: function () { - return this.minutes() === 0 ? '[明天]Ah[点整]' : '[明天]LT'; - }, - lastDay: function () { - return this.minutes() === 0 ? '[昨天]Ah[点整]' : '[昨天]LT'; - }, - nextWeek: function () { - var startOfWeek, prefix; - startOfWeek = moment().startOf('week'); - prefix = this.unix() - startOfWeek.unix() >= 7 * 24 * 3600 ? '[下]' : '[本]'; - return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm'; - }, - lastWeek: function () { - var startOfWeek, prefix; - startOfWeek = moment().startOf('week'); - prefix = this.unix() < startOfWeek.unix() ? '[上]' : '[本]'; - return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm'; - }, - sameElse: 'LL' - }, - ordinalParse: /\d{1,2}(日|月|周)/, - ordinal: function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '日'; - case 'M': - return number + '月'; - case 'w': - case 'W': - return number + '周'; - default: - return number; - } - }, - relativeTime: { - future: '%s内', - past: '%s前', - s: '几秒', - m: '1分钟', - mm: '%d分钟', - h: '1小时', - hh: '%d小时', - d: '1天', - dd: '%d天', - M: '1个月', - MM: '%d个月', - y: '1年', - yy: '%d年' - }, - week: { - // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效 - 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. - } + months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), + monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), + weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), + weekdaysShort: '周日_周一_周二_周三_周四_周五_周六'.split('_'), + weekdaysMin: '日_一_二_三_四_五_六'.split('_'), + longDateFormat: { + LT: 'Ah点mm分', + LTS: 'Ah点m分s秒', + L: 'YYYY-MM-DD', + LL: 'YYYY年MMMD日', + LLL: 'YYYY年MMMD日Ah点mm分', + LLLL: 'YYYY年MMMD日ddddAh点mm分', + l: 'YYYY-MM-DD', + ll: 'YYYY年MMMD日', + lll: 'YYYY年MMMD日Ah点mm分', + llll: 'YYYY年MMMD日ddddAh点mm分' + }, + meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === '凌晨' || meridiem === '早上' || + meridiem === '上午') { + return hour; + } else if (meridiem === '下午' || meridiem === '晚上') { + return hour + 12; + } else { + // '中午' + return hour >= 11 ? hour : hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + var hm = hour * 100 + minute; + if (hm < 600) { + return '凌晨'; + } else if (hm < 900) { + return '早上'; + } else if (hm < 1130) { + return '上午'; + } else if (hm < 1230) { + return '中午'; + } else if (hm < 1800) { + return '下午'; + } else { + return '晚上'; + } + }, + calendar: { + sameDay: function () { + return this.minutes() === 0 ? '[今天]Ah[点整]' : '[今天]LT'; + }, + nextDay: function () { + return this.minutes() === 0 ? '[明天]Ah[点整]' : '[明天]LT'; + }, + lastDay: function () { + return this.minutes() === 0 ? '[昨天]Ah[点整]' : '[昨天]LT'; + }, + nextWeek: function () { + var startOfWeek, prefix; + startOfWeek = moment().startOf('week'); + prefix = this.unix() - startOfWeek.unix() >= 7 * 24 * 3600 ? '[下]' : '[本]'; + return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm'; + }, + lastWeek: function () { + var startOfWeek, prefix; + startOfWeek = moment().startOf('week'); + prefix = this.unix() < startOfWeek.unix() ? '[上]' : '[本]'; + return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm'; + }, + sameElse: 'LL' + }, + ordinalParse: /\d{1,2}(日|月|周)/, + ordinal: function (number, period) { + switch (period) { + case 'd': + case 'D': + case 'DDD': + return number + '日'; + case 'M': + return number + '月'; + case 'w': + case 'W': + return number + '周'; + default: + return number; + } + }, + relativeTime: { + future: '%s内', + past: '%s前', + s: '几秒', + m: '1分钟', + mm: '%d分钟', + h: '1小时', + hh: '%d小时', + d: '1天', + dd: '%d天', + M: '1个月', + MM: '%d个月', + y: '1年', + yy: '%d年' + }, + week: { + // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效 + 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. + } }); export default SnackbarHOC()(App); + diff --git a/src/forge/Head/Footer.jsx b/src/forge/Head/Footer.jsx index f1d0c470..d9946716 100644 --- a/src/forge/Head/Footer.jsx +++ b/src/forge/Head/Footer.jsx @@ -18,7 +18,9 @@ function Footer(){ } return( - value && showhtml(value) +
+ {value && showhtml(value)} +
// {/*
//
//