diff --git a/public/css/edu-purge.css b/public/css/edu-purge.css index 8fe59797..694ef054 100644 --- a/public/css/edu-purge.css +++ b/public/css/edu-purge.css @@ -3947,7 +3947,7 @@ html>body #ajax-indicator { } .head-nav { text-align: center; - height: 70px; + height: 58px; box-sizing: border-box; overflow: hidden; text-overflow: ellipsis; @@ -3959,14 +3959,14 @@ html>body #ajax-indicator { position: absolute; top: 0px; z-index: 3; - height: 70px; + height: 58px; box-sizing: border-box; } .head-nav ul#header-nav li { float: left; - height: 70px; - line-height: 70px; + height: 58px; + line-height: 58px; cursor: pointer; position: relative; font-size: 16px; @@ -3980,9 +3980,6 @@ html>body #ajax-indicator { color: #fff; font-size: 16px; } -.head-right i{ - color: #fff!important; -} .head-nav ul#header-nav li a:hover,.head-nav ul#header-nav li.active a { color: #5091FF; @@ -3992,10 +3989,6 @@ html>body #ajax-indicator { margin-right: 0px } -.head-nav ul#header-nav li.active{ - /* background-color: #3B3B3B; */ -} - .head-nav ul#header-nav li p:hover { color: #cccccc; @@ -6714,13 +6707,10 @@ p{ right: 0px; top:4px; color: #999; -<<<<<<< HEAD -======= } .ant-input, .ant-input .ant-input-suffix{ background-color: #fff!important; } .has-error .ant-input{ background-color: #FEF1F0!important; ->>>>>>> pre_develop } \ No newline at end of file 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/Component/HeadSearch.jsx b/src/forge/Component/HeadSearch.jsx index 10b829a2..0e44a2cd 100644 --- a/src/forge/Component/HeadSearch.jsx +++ b/src/forge/Component/HeadSearch.jsx @@ -32,7 +32,7 @@ export default ({history}) => { /> : - { + { setOpenSearch(true) }} /> } diff --git a/src/forge/Component/NoticeModal/SystemNotice.jsx b/src/forge/Component/NoticeModal/SystemNotice.jsx index 1560c1ff..02922415 100644 --- a/src/forge/Component/NoticeModal/SystemNotice.jsx +++ b/src/forge/Component/NoticeModal/SystemNotice.jsx @@ -3,25 +3,40 @@ import { Modal , Button } from 'antd'; import './Index.scss'; import '../../css/index.scss'; import RenderHtml from '../../../components/render-html'; -import cookie from 'react-cookies'; +// import cookie from 'react-cookies'; +import axios from 'axios'; -function SystemNotice({system_notification,history}){ +function SystemNotice({showNotice,system_notification,history,login,hideSystemNotice}){ const [ visible , setVisible ] = useState(false); useEffect(()=>{ - if(system_notification && !cookie.load('notice_stage')){ + if(system_notification && !system_notification.is_read && showNotice && login){ setVisible(true); } - },[system_notification,history.location]) + },[system_notification]) function sureContinue() { - cookie.remove('notice_stage'); + if(login && ( system_notification && system_notification.id )){ + const url = `/users/${login}/system_notification_histories.json`; + axios.post(url,{ + system_notification_id:system_notification.id + }).then(result=>{ + if(result){ + setVisible(false); + hideSystemNotice(); + } + }).catch(error=>{}) + }else{ + setVisible(false); + hideSystemNotice(); + } + // cookie.remove('notice_stage'); - let inFifteenMinutes = new Date(new Date().getTime() + 24 * 3600 * 1000);//一天 - // let inFifteenMinutes = new Date(new Date().getTime() + 60 * 1000);//一分钟 - cookie.save('notice_stage', true,{ expires: inFifteenMinutes,path:"/" }); + // let inFifteenMinutes = new Date(new Date().getTime() + 24 * 3600 * 1000);//一天 + // // let inFifteenMinutes = new Date(new Date().getTime() + 60 * 1000);//一分钟 + // cookie.save('notice_stage', true,{ expires: inFifteenMinutes,path:"/" }); - setVisible(false); + // setVisible(false); } return ( 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)} +
// {/*
//
//
    diff --git a/src/forge/Head/Header.js b/src/forge/Head/Header.js index 622eef3c..a0a6db11 100644 --- a/src/forge/Head/Header.js +++ b/src/forge/Head/Header.js @@ -279,7 +279,7 @@ class NewHeader extends Component { }; render() { - const { match ,resetUserInfo ,showNotification} = this.props; + const { match ,resetUserInfo ,showNotification,publicNav} = this.props; let current_user = this.props.user; let { AccountProfiletype, @@ -368,7 +368,7 @@ class NewHeader extends Component { let search_url = settings && settings.common && settings.common.search; return ( -
    +
    {isRender === true ? 0)? - + {/* */} + :"" } @@ -448,7 +449,8 @@ class NewHeader extends Component { > {current_user && - + {/* */} + } diff --git a/src/forge/Head/header.scss b/src/forge/Head/header.scss index 1d5ac90f..58e7184d 100644 --- a/src/forge/Head/header.scss +++ b/src/forge/Head/header.scss @@ -315,24 +315,32 @@ line-height: 25px; margin-bottom: 20px!important; } - &.theline{ - display: flex; + } + .theline{ + .imgCon{ + width: 90px; + height: 90px; + padding:5px; + border-radius: 4px; + background-color: #fff; img{ - width: 80px; - height: 80px; + width: 100%; border-radius: 3px; } } } } } - .copyrightDesc{ - font-size: 12px; - font-weight: 400; - color: #BDC2D1; - line-height: 28px; - padding:15px 0px; - text-align: center; - background-color: #1B212C; +} +.copyrightDesc{ + font-size: 12px; + font-weight: 400; + color: #BDC2D1; + line-height: 28px; + padding:15px 0px; + text-align: center; + background-color: #1B212C; + a{ + color: #BDC2D1!important; } } \ No newline at end of file diff --git a/src/forge/Head/img/add.png b/src/forge/Head/img/add.png new file mode 100644 index 00000000..1790185e Binary files /dev/null and b/src/forge/Head/img/add.png differ diff --git a/src/forge/Head/img/ring.png b/src/forge/Head/img/ring.png new file mode 100644 index 00000000..0ca21d34 Binary files /dev/null and b/src/forge/Head/img/ring.png differ diff --git a/src/forge/Index.js b/src/forge/Index.js index 3356687d..dc4bb870 100644 --- a/src/forge/Index.js +++ b/src/forge/Index.js @@ -27,12 +27,6 @@ const ProjectHome = Loadable({ loading: Loading, }); -// 项目详情放在用户和组织下作为二级菜单存在 -// const ProjectDetail = Loadable({ -// loader: () => import("./Main/Detail"), -// loading: Loading, -// }); - class Index extends Component { componentDidUpdate = () => { diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index bfd6105a..8327e232 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -328,7 +328,7 @@ function CoderDepot(props){ function okUpdate(d,w,l){ const url = `/${owner}/${projectsId}.json`; axios.put(url,{ - description:d,website:w,lesson_url:l + description:d,website:w || "",lesson_url:l||"" }).then(result=>{ if(result && result.data && result.data.id){ setDesc(result.data.description); diff --git a/src/forge/Main/img/index/banner.png b/src/forge/Main/img/index/banner.png index 101be0a5..92a1792b 100644 Binary files a/src/forge/Main/img/index/banner.png and b/src/forge/Main/img/index/banner.png differ diff --git a/src/forge/Main/img/index/icon-delete.png b/src/forge/Main/img/index/icon-delete.png new file mode 100644 index 00000000..740af5a2 Binary files /dev/null and b/src/forge/Main/img/index/icon-delete.png differ diff --git a/src/forge/Main/projecthome/Index.jsx b/src/forge/Main/projecthome/Index.jsx index 37e72cd1..9045a274 100644 --- a/src/forge/Main/projecthome/Index.jsx +++ b/src/forge/Main/projecthome/Index.jsx @@ -74,7 +74,7 @@ function Index() {
    开源项目 - 更多 + 更多
    @@ -85,10 +85,10 @@ function Index() { projectsList.map((i,k)=>{ return(
  • - +
    - {i.author && i.author.name}/{i.name} + {i.author && i.author.name}/{i.name} {i.praises_count > 0 ? {i.praises_count} :"" } {i.forked_count > 0 ? {i.forked_count}:""}
    @@ -113,9 +113,12 @@ function Index() { }
    -
    - 查看更多开源项目 -
    + { + projectsList && projectsList.length > 0 && +
    + 查看更多开源项目 +
    + }
  • diff --git a/src/forge/Main/projecthome/Index.scss b/src/forge/Main/projecthome/Index.scss index ef733067..50b7b506 100644 --- a/src/forge/Main/projecthome/Index.scss +++ b/src/forge/Main/projecthome/Index.scss @@ -318,7 +318,6 @@ background: url('../img/index/typebg.png'); background-size: 100% 100%; box-shadow: 0px 0px 4px 5px rgba(0, 0, 0, 0.02); - padding:12px 0px; a{ padding:0px 20px; height: 44px; @@ -386,6 +385,7 @@ font-weight: 600; line-height: 21px; color: #333!important; + max-width: 458px; &:hover{ color: #466AFF!important; } @@ -413,7 +413,7 @@ height: 20px; line-height: 20px; display: flex; - align-items: flex-end; + align-items: center; .category{ position: relative; padding-left: 11px; @@ -439,7 +439,7 @@ height: 10px; border-radius: 50%; border-left: 1px solid #9e9e9e; - bottom: 4px; + bottom: 5px; left: 0px; } } @@ -539,11 +539,11 @@ } .sInfos{ background: #F7F8F9; - padding:5px; + padding:0px 5px; font-size: 13px; font-weight: 400; color: #666666; - line-height: 22px; + line-height: 24px; word-break: break-all; margin-top: 10px; } diff --git a/src/forge/Main/projecthome/SubBanner.jsx b/src/forge/Main/projecthome/SubBanner.jsx index 7e8c1a63..cb868b94 100644 --- a/src/forge/Main/projecthome/SubBanner.jsx +++ b/src/forge/Main/projecthome/SubBanner.jsx @@ -5,7 +5,6 @@ import { getImageUrl } from 'educoder'; import Eye from '../img/index/eye.png'; import Data from '../img/index/data.png'; import Earth from '../img/index/earth.png'; -import Imgs from '../img/tree.png'; import axios from 'axios'; // const list =[ @@ -51,8 +50,8 @@ function SubBanner() { return(
    -

    新一代开源创新服务平台

    -

    Gitlink(确实开源)-CCF官网指定的产学研融合面向软件开源创新的开源社区

    +

    GitLink 确实开源

    +

    新一代开发创新服务平台 让你的创意在这里释放

    { list && list.length > 0 ? diff --git a/src/forge/Main/projecthome/SubList.jsx b/src/forge/Main/projecthome/SubList.jsx index 56510392..94727e8a 100644 --- a/src/forge/Main/projecthome/SubList.jsx +++ b/src/forge/Main/projecthome/SubList.jsx @@ -56,11 +56,11 @@ function SubList() { return(
  • - +
    - {i.name} + {i.name}

    - {i.project && i.project.name} + {i.project && i.project.name}

    @@ -84,7 +84,7 @@ function SubList() {
  • {k+1} - {i.owner && i.owner.name}/{i.name} + {i.owner && i.owner.name}/{i.name} {i.praises} @@ -113,7 +113,7 @@ function SubList() {
  • {k+1} - {i.owner && i.owner.name}/{i.name} + {i.owner && i.owner.name}/{i.name} {i.praises} diff --git a/src/forge/New/Index.js b/src/forge/New/Index.js index e9aa1f95..edc655a4 100644 --- a/src/forge/New/Index.js +++ b/src/forge/New/Index.js @@ -289,7 +289,8 @@ class Index extends Component { let second = first.split('.')[0]; if(!second)return; this.props.form.setFieldsValue({ - repository_name:second + repository_name:second, + name:second }) }else{ this.props.form.setFieldsValue({ diff --git a/src/forge/Team/Setting/TeamSettingCommon.jsx b/src/forge/Team/Setting/TeamSettingCommon.jsx index e4f5cf7a..6e98183f 100644 --- a/src/forge/Team/Setting/TeamSettingCommon.jsx +++ b/src/forge/Team/Setting/TeamSettingCommon.jsx @@ -181,7 +181,7 @@ export default Form.create()( )}

    选择头像:

    - +
    diff --git a/src/home/FifthEdition.jsx b/src/home/FifthEdition.jsx index 6e709b43..09096de2 100644 --- a/src/home/FifthEdition.jsx +++ b/src/home/FifthEdition.jsx @@ -1,4 +1,5 @@ import React , { useEffect } from 'react'; +import Slider from 'react-slick'; import Beijing from './Img/unit/beijing.png'; import SHJT from './Img/unit/SHJT.png'; import DD from './Img/unit/DD.png'; @@ -22,6 +23,9 @@ import LSLM from './Img/unit/LSLM.png'; import TG from './Img/unit/TG.png'; import LC from './Img/unit/LC.png'; import YKD from './Img/unit/YKD.png'; +import Axios from 'axios'; +import { useState } from 'react'; +import { getImageUrl } from 'educoder'; const list = [ {image_url:GFKJ, name:"国防科技大学",src:"https://www.nudt.edu.cn/"}, @@ -45,26 +49,40 @@ const list = [ {image_url:LC, name:"浪潮",src:"https://cloud.inspur.com/"}, {image_url:YKD, name:"ucloud",src:"https://www.ucloud.cn/"} ] -// const settings = { -// dots: false, -// infinite: true, -// slidesToShow: 6, -// slidesToScroll: 1, -// autoplay: true, -// speed: 2000, -// autoplaySpeed: 2000, -// cssEase: "linear", -// rows:2, -// arrows:false -// }; + +const settings = { + dots: false, + infinite: true, + slidesToShow: 1, + slidesToScroll: 1, + vertical: true, + verticalSwiping: true, + autoplay:true, + arrows:false +}; function FifthEdition() { + const [ topics ,setTopics ] = useState(undefined); useEffect(()=>{ - if(list.length>10){ - Init(); - } + // if(list.length>10){ + // Init(); + // } + getUnit(); },[]) + function getUnit(){ + const url =`/topics.json`; + Axios.get(url,{params:{ + topic_type:"cooperator", + limit:20, + group_size:5 + }}).then(result=>{ + if(result){ + setTopics(result.data.topics); + } + }).catch(error=>{}) + } + function Init() { let box = document.getElementById('scrollBox1'); scrollUp(); @@ -94,12 +112,12 @@ function FifthEdition() { return(
    -
    + {/*
      { list && list.map((i,k)=>{ return( -
    • {i.name}/
    • +
    • {i.name}/
    • ) }) } @@ -109,28 +127,34 @@ function FifthEdition() { { list && list.map((i,k)=>{ return( -
    • {i.name}/
    • +
    • {i.name}/
    • ) }) }
    } -
    - {/* - { - list && list.map((i,k)=>{ - return( -
  • {i.name}/
  • - ) - }) - } - {list.length > 10 && list && list.map((i,k)=>{ - return( -
  • {i.name}/
  • - ) - }) - } - */} +
    */} + { + topics && topics.length>0 ? + + { + topics.map((i,k)=>{ + return( +
    + { + i.map((j,k1)=>{ + return( + + ) + }) + } +
    + ) + }) + } +
    + :"" + }
    ) } diff --git a/src/home/Img/2-2-2.png b/src/home/Img/2-2-2.png index 1dde507a..52c2f8b9 100644 Binary files a/src/home/Img/2-2-2.png and b/src/home/Img/2-2-2.png differ diff --git a/src/home/Img/2-2-3.png b/src/home/Img/2-2-3.png index b0a9f6d0..2fb92ba2 100644 Binary files a/src/home/Img/2-2-3.png and b/src/home/Img/2-2-3.png differ diff --git a/src/home/Img/banner1.png b/src/home/Img/banner1.png index a4dbfd8b..b419349f 100644 Binary files a/src/home/Img/banner1.png and b/src/home/Img/banner1.png differ diff --git a/src/home/Img/banner2.png b/src/home/Img/banner2.png index 0e0e1025..35c8be4a 100644 Binary files a/src/home/Img/banner2.png and b/src/home/Img/banner2.png differ diff --git a/src/home/Img/banner3.png b/src/home/Img/banner3.png index e7c5b907..1a2912ba 100644 Binary files a/src/home/Img/banner3.png and b/src/home/Img/banner3.png differ diff --git a/src/home/Img/banner4.png b/src/home/Img/banner4.png index 9293cab6..a5f07759 100644 Binary files a/src/home/Img/banner4.png and b/src/home/Img/banner4.png differ diff --git a/src/home/Img/codeafter.png b/src/home/Img/codeafter.png index 189b000f..fdff2d77 100644 Binary files a/src/home/Img/codeafter.png and b/src/home/Img/codeafter.png differ diff --git a/src/home/Index.jsx b/src/home/Index.jsx index f61ac90c..f1c628d1 100644 --- a/src/home/Index.jsx +++ b/src/home/Index.jsx @@ -1,6 +1,5 @@ import React , { useEffect , useState } from 'react'; import "./Index.scss"; -import HeadNav from './Headnav'; import TopEdition from './TopEdition'; import ThirdEdition from './ThirdEdition'; import { Anchor } from 'antd'; @@ -10,21 +9,37 @@ import F43 from './Img/4-3.png'; import F44 from './Img/4-4.png'; import SecondEdition from './SecondEdition'; import FifthEdition from './FifthEdition'; -import Footnav from './Footnav'; import { TPMIndexHOC } from '../modules/tpm/TPMIndexHOC'; +import Axios from 'axios'; function Index(props) { const [ value , setValue ] = useState(""); const [ flag , setFlag ] = useState(true); - const [ isRender , setIsRender ] = useState(false); - const [ isloginCancel , setIsloginCancel ] = useState(false); + + const [ bannerTab , setBannerTab ] = useState(undefined); const register = props && props.mygetHelmetapi && props.mygetHelmetapi.common && props.mygetHelmetapi.common.register; + const { current_user } = props; useEffect(()=>{ window.addEventListener("scroll",scrollListener); + getTab(); },[]) + function getTab() { + const url = `/topics.json?topic_type=card`; + Axios.get(url,{ + params:{ + limit:3 + } + }).then(result=>{ + if(result){ + setBannerTab(result.data.topics); + } + }).catch(error=>{}) + } + function scrollListener(event) { + let third = document.getElementById("thirdContent").offsetTop; let top = document.documentElement.scrollTop + 60; if(top>= third) @@ -50,29 +65,47 @@ function Index(props) { return(
    -

    Gitlink,新一代开源创新服务平台

    +

    GitLink,新一代开源创新服务平台

    { flag && @@ -90,8 +123,10 @@ function Index(props) {
    -

    加入Gitlink,和社区伙伴们一起踏上开源创新的辉煌旅程!

    - 快速注册 +

    加入GitLink,和社区伙伴们一起踏上开源创新的辉煌旅程!

    +
    + { !(current_user && current_user.login) && 立即注册 } +
    • @@ -118,10 +153,9 @@ function Index(props) {

      开源生态

      -

      Gitlink与各大企业、高校、科研机构开展广泛的技术合作,推动我国开源软件生态的快速构建与发展

      +

      GitLink与各大企业、高校、科研机构开展广泛的技术合作,推动我国开源软件生态的快速构建与发展

      -
    ) } diff --git a/src/home/Index.scss b/src/home/Index.scss index c62c3af9..5fb39ee5 100644 --- a/src/home/Index.scss +++ b/src/home/Index.scss @@ -61,21 +61,12 @@ body{ height:100%; div{ height: 100%; - .regform1{ - background:url('./Img/banner1.png') no-repeat center top; - background-size:cover; - } - .regform2{ - background:url('./Img/banner2.png') no-repeat center top; - background-size:cover; - } - .regform3{ - background:url('./Img/banner3.png') no-repeat center top; - background-size:cover; - } - .regform4{ - background:url('./Img/banner4.png') no-repeat center center; - background-size:cover; + .regform{ + &>div{ + background-size:cover; + background-position: center; + background-repeat: no-repeat; + } } .regPrg{ position: absolute; @@ -590,6 +581,7 @@ body{ font-weight: 500; line-height: 36px; color: #000; + max-width: 350px; span{ color: #637497; font-weight: normal; @@ -675,6 +667,8 @@ body{ padding-top: 50px; padding-bottom: 25px; margin-bottom: 0px; + justify-content: space-between; + min-width: 1200px; li{ padding:0px 67px; color: #fff; @@ -755,8 +749,10 @@ body{ display: flex; align-items: center; margin-top: 48px; + min-height: 365px; .listbox{ margin-left: 54px; + flex: 1; .listTitle{ height: 30px; font-size: 18px; @@ -775,6 +771,9 @@ body{ background-color: #466AFF; } } + .ant-skeleton-title,.ant-skeleton-paragraph > li{ + background-color: rgba(242,242,242 ,0.2); + } } li{ display: flex; @@ -793,6 +792,12 @@ body{ span{ margin-left: 40px; } + .listboxcount{ + min-width: 60px; + text-align: left; + display: flex; + justify-content: space-between; + } } } } @@ -824,11 +829,12 @@ body{ background-color: #466AFF; border-radius: 6px; font-size: 18px; - margin-bottom: 80px; } .forthUl{ display: flex; align-items: flex-end; + min-width: 1200px; + justify-content: space-between; li{ margin:0px 40px; display: flex; @@ -913,6 +919,41 @@ body{ overflow: hidden; margin: 35px 0px 0px; width: 100%; + .unitMainSlider{ + width: 1200px; + margin:0px auto; + .slick-list{ + height: 140px; + width: 100%; + overflow: hidden; + .slickMainline{ + display: flex!important; + padding:10px 2px; + align-items: center; + justify-content: space-between; + a{ + background: #FFFFFF; + box-shadow: 0px 1px 8px 1px rgba(0, 0, 0, 0.06); + border-radius: 4px; + border: 2px solid #FFFFFF; + margin-right: 20px; + padding:20px; + height: 120px; + width: 220px; + display: flex; + align-items: center; + justify-content: center; + img{ + max-width: 100%; + max-height: 100%; + } + &:last-child{ + margin-right: 0px; + } + } + } + } + } } ul.fifthList{ display: flex; @@ -1011,28 +1052,31 @@ body{ line-height: 25px; margin-bottom: 20px!important; } - &.theline{ - display: flex; - .imgCon{ - padding:5px; - background-color: #fff; - border-radius: 3px; - } + } + .theline{ + .imgCon{ + padding:5px; + border-radius: 4px; + background-color: #fff; img{ width: 80px; height: 80px; + border-radius: 3px; } } } } } - .copyrightDesc{ - font-size: 12px; - font-weight: 400; - color: #BDC2D1; - line-height: 28px; - padding:15px 0px; - text-align: center; - background-color: #1B212C; +} +.copyrightDesc{ + font-size: 12px; + font-weight: 400; + color: #BDC2D1; + line-height: 28px; + padding:15px 0px; + text-align: center; + background-color: #1B212C; + a{ + color: #BDC2D1!important; } } \ No newline at end of file diff --git a/src/home/SecondEdition.jsx b/src/home/SecondEdition.jsx index 0d7896d1..5df2b646 100644 --- a/src/home/SecondEdition.jsx +++ b/src/home/SecondEdition.jsx @@ -99,12 +99,14 @@ function SecondEdition({setValue}) { } function checkPosi(ele,clientHeight,scrollTop) { - var a = document.getElementById(ele).offsetTop - scrollTop -(clientHeight/3); - var b = document.getElementById(ele).clientHeight + (clientHeight/4); - if(a>0 || a<-b){ - return false; - }else{ - return true; + if(document.getElementById(ele)){ + var a = document.getElementById(ele).offsetTop - scrollTop -(clientHeight/3); + var b = document.getElementById(ele).clientHeight + (clientHeight/4); + if(a>0 || a<-b){ + return false; + }else{ + return true; + } } } return( @@ -187,7 +189,7 @@ function SecondEdition({setValue}) {

    多维度用户画像

    -

    实时采集和分析平台中的各类开源资源数
    据,
    搭建多维度用户画像评估系统;

    +

    实时采集和分析平台中的各类开源资源数据,搭建多维度用户画像评估系统;

    diff --git a/src/home/ThirdEdition.jsx b/src/home/ThirdEdition.jsx index 395697d1..4cc924af 100644 --- a/src/home/ThirdEdition.jsx +++ b/src/home/ThirdEdition.jsx @@ -1,4 +1,5 @@ import React,{ useState , useEffect , useMemo } from 'react'; +import { Spin , Skeleton } from 'antd'; import T311 from './Img/3-1-1.png'; import T312 from './Img/3-1-2.png'; import T321 from './Img/3-2-1.png'; @@ -13,39 +14,16 @@ import bg33 from './Img/3-3.png'; import bg34 from './Img/3-4.png'; import './Index.scss'; - -const list1 = [ - {name:"CCF开源发展委员会首批执行委员名单发布",src:"https://forum.trustie.net/forums/4666/detail",count:32,time:"2021-09-22"}, - {name:"Gitlink项目协同开发模块使用说明及问题反馈",src:"https://forum.trustie.net/forums/4665/detail",count:4,time:"2021-09-22"}, - {name:"MindSpore框架介绍及赛题说明",src:"https://forum.trustie.net/forums/4664/detail",count:3,time:"2021-09-22"}, - {name:"OpenHarmony系统介绍及赛题说明",src:"https://forum.trustie.net/forums/4663/detail",count:4,time:"2021-09-22"}, - {name:"openGauss系统介绍及赛题说明",src:"https://forum.trustie.net/forums/4662/detail",count:5,time:"2021-09-22"}, -] -const list2 = [ - {name:"Gitlink/Gitlink",src:"https://forgeplus.trustie.net/Gitlink/forgeplus",count:304}, - {name:"泛在操作系统实验室/矽璓工业物联操作系统XiUOS",src:"https://forgeplus.trustie.net/xuos/xiuos",count:50}, - {name:"华为技术有限公司/openGauss-operator",src:"https://forgeplus.trustie.net/Huawei_Technology/openGauss-operator",count:100}, - {name:"开放原子开源基金会/BitXHub",src:"https://forgeplus.trustie.net/openatom_foundation/bitxhub",count:40}, - {name:"华为技术有限公司/openEuler-datenlord",src:"https://forgeplus.trustie.net/Huawei_Technology/openEuler-datenlord",count:98}, -] -const list3 = [ - {name:"Gitlink平台DevOps模块使用说明",src:"https://forum.trustie.net/forums/4682/detail",count:10,time:"2021-09-23"}, - {name:"Gitlink如何将临时分支push到远端对应的新分支?",src:"https://forum.trustie.net/forums/4705/detail",count:8,time:"2021-09-23"}, - {name:"了解什么是 DevOps?",src:"https://forum.trustie.net/forums/4704/detail",count:4,time:"2021-09-23"}, - {name:"EduCoder平台简介",src:"https://forum.trustie.net/forums/4701/detail",count:26,time:"2021-09-23"}, - {name:"Webhooks指南",src:"https://forum.trustie.net/forums/4683/detail",count:3,time:"2021-09-23"}, -] -const list4 = [ - {name:"小学生都能读懂的网络协议之:WebSocket",src:"https://forum.trustie.net/forums/4708/detail",count:4,time:"2021-09-23"}, - {name:"容器神话 Docker 是如何一分为二的",src:"https://forum.trustie.net/forums/4707/detail",count:5,time:"2021-09-23"}, - {name:"一文揭示,DevOps与企业数字化究竟有何联系?",src:"https://forum.trustie.net/forums/4706/detail",count:3,time:"2021-09-23"}, - {name:"GitHub上最流行的10000个Java都使用了哪些库?",src:"https://forum.trustie.net/forums/4703/detail",count:8,time:"2021-09-23"}, - {name:"如何正确下载CentOS各个版本镜像",src:"https://forum.trustie.net/forums/4684/detail",count:2,time:"2021-09-23"}, -] +import Axios from 'axios'; function ThirdEdition() { const [ active , setActive ] = useState(1); + const [ isSpin , setIsSpin ] = useState(true); const [ flag , setFlag ] = useState(true); + const [ list1, setList1 ] = useState([]); + const [ list2, setList2 ] = useState([]); + const [ list3, setList3 ] = useState([]); + const [ list4, setList4 ] = useState([]); const doubleFlag = useMemo(()=>{ return flag; @@ -75,6 +53,41 @@ function ThirdEdition() { } } + useEffect(()=>{ + if(active){ + getList(active); + } + },[active]) + + function getList(a) { + let params = a === 1 ? "activity_forum" : a===2 ? "excellent_project" : a=== 3 ? "pinned_forum" : "experience_forum"; + if(a===1 && (list1 && list1.length>0)){return} + if(a===2 && (list2 && list2.length>0)){return} + if(a===3 && (list3 && list3.length>0)){return} + if(a===4 && (list4 && list4.length>0)){return} + setIsSpin(true); + const url = `/topics.json?topic_type=${params}`; + Axios.get(url,{ + params:{ + limit:5 + } + }).then(result=>{ + if(result){ + let l = result.data.topics; + if(a===1){ + setList1(l); + }else if(a===2){ + setList2(l); + }else if(a===3){ + setList3(l); + }else{ + setList4(l); + } + setIsSpin(false); + } + }).catch(error=>{}) + } + return(

    开发者的家园

    @@ -111,65 +124,95 @@ function ThirdEdition() {
- -
-

- {active === 1 ? "Gitlink分享最新平台资讯、社区活动通知、开源竞赛信息,把握开源生态发展脉搏" - : active===2 ? "Gitlink汇聚精英企业仓库、前沿技术仓库、人气热门仓库,孵化优质开源创新成果" - :active===3 ? "Gitlink集萃社区精选项目介绍、平台使用技巧等优秀文章,助力开源开放协同创新" - :"Gitlink甄选技术研究、心得体会、经验交流等高质量内容,推动社区健康稳定发展"} -

- { - active === 1&& - list1.map((i,k)=>{ - return( -
  • - {i.name} - {i.count} - {i.time} -
  • - ) - }) - } - { - active === 2&& - list2.map((i,k)=>{ - return( -
  • - {i.name} - {i.count} - {/* {i.time} */} -
  • - ) - }) - } - { - active === 3&& - list3.map((i,k)=>{ - return( -
  • - {i.name} - {i.count} - {i.time} -
  • - ) - }) - } - { - active === 4&& - list4.map((i,k)=>{ - return( -
  • - {i.name} - {i.count} - {i.time} -
  • - ) - }) - } + +
    +

    + {active === 1 ? "GitLink分享最新平台资讯、社区活动通知、开源竞赛信息,把握开源生态发展脉搏" + : active===2 ? "GitLink汇聚精英企业仓库、前沿技术仓库、人气热门仓库,孵化优质开源创新成果" + :active===3 ? "GitLink集萃社区精选项目介绍、平台使用技巧等优秀文章,助力开源开放协同创新" + :"GitLink甄选技术研究、心得体会、经验交流等高质量内容,推动社区健康稳定发展"} +

    +
    + { + active === 1 && + + { + list1 && list1.length > 0 ? list1.map((i,k)=>{ + return( +
  • + {i.title} + {i.visits} + {i.time} +
  • + ) + }):"" + } + { + list1 && list1.length === 0 && + } +
    + } + { + active === 2 && + + { + list2 && list2.length > 0? list2.map((i,k)=>{ + return( +
  • + {i.title} + {i.visits} + {/* {i.time} */} +
  • + ) + }):"" + } + { + list2 && list2.length === 0 && + } +
    + } + { + active === 3 && + + { + list3 && list3.length > 0 ? list3.map((i,k)=>{ + return( +
  • + {i.title} + {i.visits} + {i.time} +
  • + ) + }):"" + } + { + list3 && list3.length === 0 && + } +
    + } + { + active === 4 && + + { + list4 && list4.length > 0 ? list4.map((i,k)=>{ + return( +
  • + {i.title} + {i.visits} + {i.time} +
  • + ) + }):"" + } + { + list4 && list4.length === 0 && + } +
    + } +
    +
    -
    ) } diff --git a/src/home/TopEdition.jsx b/src/home/TopEdition.jsx index abf41a57..d24ad15c 100644 --- a/src/home/TopEdition.jsx +++ b/src/home/TopEdition.jsx @@ -1,5 +1,8 @@ -import React from 'react'; +import React , { useEffect , useState } from 'react'; import Slider from 'react-slick'; +import axios from 'axios'; +import { getImageUrl } from 'educoder'; + let setting={ dots:true, infinite: true, @@ -14,16 +17,46 @@ let setting={ prevArrow:, nextArrow: } -function TopEdition({register}) { +function TopEdition({register,current_user}) { + + const [ bannerList , setBannerList ] = useState(undefined); + + useEffect(()=>{ + getBanner(); + },[]) + + function getBanner() { + const url = `/topics.json?topic_type=banner`; + axios.get(url,{ + params:{ + limit:4 + } + }).then(result=>{ + if(result){ + setBannerList(result.data.topics); + } + }).catch(error=>{}) + } return( -
    -
    -
    -
    -
    -

    注册

    -
    + { + bannerList && bannerList.length > 0 ? + bannerList.map((i,k)=>{ + return( +
    +
    + { + k +1 === bannerList.length && (!(current_user && current_user.login)) ? +

    注册

    + :"" + } +
    +
    + ) + }) + : + "" + }
    ) } diff --git a/src/modules/login/EducoderLogin.js b/src/modules/login/EducoderLogin.js index b4485efe..6cf97a6e 100644 --- a/src/modules/login/EducoderLogin.js +++ b/src/modules/login/EducoderLogin.js @@ -97,9 +97,9 @@ class EducoderLogin extends Component {
    { mygetHelmetapi && mygetHelmetapi.login_logo_url ? - this.gohome()} width="80px" src={getImageUrl(mygetHelmetapi.login_logo_url)}/> + this.gohome()} src={getImageUrl(mygetHelmetapi.login_logo_url)}/> : - this.gohome()} src={educodernet} width="80px"/> + this.gohome()} src={educodernet}/> }
    { diff --git a/src/modules/tpm/TPMIndex.css b/src/modules/tpm/TPMIndex.css index 8d513feb..40f3a35f 100644 --- a/src/modules/tpm/TPMIndex.css +++ b/src/modules/tpm/TPMIndex.css @@ -25,14 +25,17 @@ body>.-task-title { .newHeaders{ max-width: unset; width: 100%; - height:70px; + height:58px; min-width: 1200px; z-index: 1000; - box-shadow: 0px 2px 4px 0px rgb(0 0 0 / 50%); position: fixed; - background-image: linear-gradient(to right, #0F141F, #0C2A5B,#101417); + background: #1B2440; color: #fff; } +.newHeaders.publicNav{ + position: absolute; + background: rgba(27, 36, 64,0.2); +} .headerContent{ margin:0px auto; padding:0px 30px; diff --git a/src/modules/tpm/TPMIndexHOC.js b/src/modules/tpm/TPMIndexHOC.js index 2597950f..5d976b7d 100644 --- a/src/modules/tpm/TPMIndexHOC.js +++ b/src/modules/tpm/TPMIndexHOC.js @@ -29,6 +29,7 @@ export function TPMIndexHOC(WrappedComponent) { email:undefined, completeProfile:false, showCP:false, + showNotice:true } } @@ -153,11 +154,11 @@ export function TPMIndexHOC(WrappedComponent) { console.log(this.props.match) if (this.props.match.path === "/") { this.setState({ - publicNav:false + publicNav:true }) }else{ this.setState({ - publicNav:true + publicNav:false }) } let url = `/users/get_user_info.json`; @@ -223,6 +224,11 @@ export function TPMIndexHOC(WrappedComponent) { } }).catch(error=>{}) } + hideSystemNotice=()=>{ + this.setState({ + showNotice:false + }) + } showCompeleteDialog=()=>{ this.setState({ @@ -231,7 +237,7 @@ export function TPMIndexHOC(WrappedComponent) { } render() { - let { isRender , current_user , giteaVisible , email , completeProfile , showCP , publicNav , mygetHelmetapi } = this.state; + let { isRender , current_user , giteaVisible , email , completeProfile , showCP , showNotice , publicNav , mygetHelmetapi } = this.state; const common = { showLoginDialog: this.showLoginDialog, checkIfLogin: this.checkIfLogin, @@ -241,9 +247,11 @@ export function TPMIndexHOC(WrappedComponent) { return (
    : ""} - { publicNav &&
    } +
    - { publicNav &&
    } + {!publicNav &&
    } { current_user && this.initCommonState(user)} @@ -270,7 +278,7 @@ export function TPMIndexHOC(WrappedComponent) { }
    - { publicNav && } +
    ); } diff --git a/src/modules/user/LoginRegisterComponent.js b/src/modules/user/LoginRegisterComponent.js index 8ccc64b1..a6ba6570 100644 --- a/src/modules/user/LoginRegisterComponent.js +++ b/src/modules/user/LoginRegisterComponent.js @@ -1,6 +1,6 @@ -import React, { Component } from 'react'; -import { setmiyah, broadcastChannelPostMessage } from 'educoder'; -import { Tabs, Input, Checkbox, Button, notification, Menu } from 'antd'; +import React, {Component} from 'react'; +import {setmiyah,broadcastChannelPostMessage} from 'educoder'; +import {Tabs, Input, Checkbox, Button, notification,Menu} from 'antd'; import passopen from '../../../src/images/login/passopen.png'; import passoff from '../../../src/images/login/passoff.png'; import axios from 'axios'; @@ -12,7 +12,7 @@ import './common.css' import './commontwo.css' const { TabPane } = Tabs; const loginInputsyl = { - "width": "434px", + "width":"434px", "height": "462px", "-webkit-box-shadow": "3px 10px 21px 0px rgba(76,76,76,0.15)", "box-shadow": "3px 10px 21px 0px rgba(76,76,76,0.15)", @@ -25,48 +25,15 @@ class LoginRegisterComponent extends Component { constructor(props) { super(props) - if (props.loginstatus === true) { - this.state = { - tab: ["0"], - classpass: "text", - // 登录 - passopens: passoff, - seconds: 60, - discodeBtn: false, - clearInterval: false, - autoLogin: true, - classpassbool: false, - // 注册 - readAgreement: false, - getverificationcodes: true, - dragOk: false, - Agreetotheterms: true, - login: "", - password: "", - logins: "", - passwords: "", - codes: "", - Phonenumberisnotco: undefined, - Phonenumberisnotcos: undefined, - Phonenumberisnotcosyzm: undefined, - Phonenumberisnotcosymmm: undefined, - Phonenumberisnotcosytdhk: undefined, - Phonenumberisnotcosyfwtk: undefined, - Phonenumberisnotcodmm: undefined, - Phonenumberisnotcobool: false, - Whethertoverify: false, - pciphone: true, - MyEduCoderModals: false, - registered: undefined, - Phonenumberisnotcodmms: undefined, - weixinlogin: false, - qqlogin: false - } - } - if (props.loginstatus === false) { + + // + // console.log("LoginRegisterComponent"); + // console.log("29"); + // console.log(props.loginstatus); + if(props.loginstatus === true){ // console.log(props.loginstatus); this.state = { - tab: ["1"], + tab:["0"], classpass: "text", // 登录 passopens: passoff, @@ -87,25 +54,64 @@ class LoginRegisterComponent extends Component { codes: "", Phonenumberisnotco: undefined, Phonenumberisnotcos: undefined, - Phonenumberisnotcosyzm: undefined, - Phonenumberisnotcosymmm: undefined, - Phonenumberisnotcosytdhk: undefined, - Phonenumberisnotcosyfwtk: undefined, + Phonenumberisnotcosyzm:undefined, + Phonenumberisnotcosymmm:undefined, + Phonenumberisnotcosytdhk:undefined, + Phonenumberisnotcosyfwtk:undefined, + Phonenumberisnotcodmm:undefined, Phonenumberisnotcobool: false, - Phonenumberisnotcodmm: undefined, - Whethertoverify: false, - pciphone: true, - MyEduCoderModals: false, - registered: undefined, - Phonenumberisnotcodmms: undefined, - weixinlogin: false, - qqlogin: false + Whethertoverify:false, + pciphone:true, + MyEduCoderModals:false, + registered:undefined, + Phonenumberisnotcodmms:undefined, + weixinlogin:false, + qqlogin:false + } + } + if(props.loginstatus === false){ + // console.log(props.loginstatus); + this.state = { + tab:["1"], + classpass: "text", + // 登录 + passopens: passoff, + seconds: 60, + discodeBtn: false, + clearInterval: false, + autoLogin: true, + classpassbool: false, + // 注册 + readAgreement: false, + getverificationcodes: true, + dragOk: false, + Agreetotheterms: true, + login: "", + password: "", + logins: "", + passwords: "", + codes: "", + Phonenumberisnotco: undefined, + Phonenumberisnotcos: undefined, + Phonenumberisnotcosyzm:undefined, + Phonenumberisnotcosymmm:undefined, + Phonenumberisnotcosytdhk:undefined, + Phonenumberisnotcosyfwtk:undefined, + Phonenumberisnotcobool: false, + Phonenumberisnotcodmm:undefined, + Whethertoverify:false, + pciphone:true, + MyEduCoderModals:false, + registered:undefined, + Phonenumberisnotcodmms:undefined, + weixinlogin:false, + qqlogin:false } } } //判断是否是手机端 - IsPC = () => { + IsPC=()=> { var userAgentInfo = navigator.userAgent; var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", @@ -119,11 +125,11 @@ class LoginRegisterComponent extends Component { } return flag; } - // 点击表单后,改变type +// 点击表单后,改变type changeType = () => { - this.setState({ classpass: 'password' }); + this.setState({classpass: 'password'}); } - IsPC = () => { + IsPC=()=>{ var userAgentInfo = navigator.userAgent; var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", @@ -138,29 +144,39 @@ class LoginRegisterComponent extends Component { return flag; } componentDidMount = () => { - let flag = this.IsPC(); //true为PC端,false为手机端 - this.setState({ - isphone: flag - }) - let pcipns = this.IsPC(); + let flag = this.IsPC(); //true为PC端,false为手机端 + this.setState({ + isphone:flag + }) + // console.log("componentDidUpdate"); + // console.log(this.props); + let pcipns=this.IsPC(); if (this.props.match.url === "/login") { + // this.state = { + // tab:["0"], + // + // } this.setState({ - tab: ["0"] + tab:["0"] }) } else if (this.props.match.url === "/register") { + // this.state = { + // tab:["1"], + // + // } this.setState({ - tab: ["1"] + tab:["1"] }) } this.setState({ - pciphone: pcipns, + pciphone:pcipns, }) } - openNotification = (messge, type) => { + openNotification = (messge,type) => { // type 1 成功提示绿色 2提醒颜色黄色 3错误提示红色 notification.open({ message: "提示", @@ -183,6 +199,8 @@ class LoginRegisterComponent extends Component { StudyMakeMoney = () => { // 调用父组件方法 + + // this.props.Setlogins(3); this.setState({ login: "", password: "", @@ -192,7 +210,7 @@ class LoginRegisterComponent extends Component { }); try { this.props.Setshowbool(3); - } catch (e) { + }catch (e) { } } @@ -202,7 +220,7 @@ class LoginRegisterComponent extends Component { // -------------------- LOGIN START //下次自动登入 onAutoLoginChange = (e) => { - this.setState({ autoLogin: e.target.checked }) + this.setState({autoLogin: e.target.checked}) } // -------------------- LOGIN END @@ -231,19 +249,19 @@ class LoginRegisterComponent extends Component { } // -------------------- REGISTER START onReadAgreementChange = (e) => { - this.setState({ readAgreement: e.target.checked }) + this.setState({readAgreement: e.target.checked}) } //是否验证通过 dragOkCallback = () => { this.setState({ - Phonenumberisnotcosytdhk: undefined, + Phonenumberisnotcosytdhk:undefined, }) if (this.state.logins.length === 0) { this.setState({ - Phonenumberisnotcos: "账号不能为空", + Phonenumberisnotcos:"账号不能为空", Phonenumberisnotcobool: true, - dragOk: false, - Whethertoverify: this.state.Whethertoverify === true ? false : true, + dragOk:false, + Whethertoverify:this.state.Whethertoverify===true?false:true, }) @@ -261,14 +279,14 @@ class LoginRegisterComponent extends Component { this.setState({ Phonenumberisnotcos: undefined, Phonenumberisnotcobool: false, - dragOk: true, + dragOk:true, }) } else { this.setState({ Phonenumberisnotcos: undefined, Phonenumberisnotcobool: false, - dragOk: true, + dragOk:true, }); this.Emailphonenumberverification(this.state.logins, 2); return @@ -284,8 +302,8 @@ class LoginRegisterComponent extends Component { this.setState({ Phonenumberisnotcos: stringdata, Phonenumberisnotcobool: true, - dragOk: false, - Whethertoverify: this.state.Whethertoverify === true ? false : true, + dragOk:false, + Whethertoverify:this.state.Whethertoverify===true?false:true, }); @@ -295,14 +313,14 @@ class LoginRegisterComponent extends Component { this.setState({ Phonenumberisnotcos: undefined, Phonenumberisnotcobool: false, - dragOk: true, + dragOk:true, }) this.Emailphonenumberverification(this.state.logins, 2); return } this.setState({ - Phonenumberisnotcosytdhk: undefined, + Phonenumberisnotcosytdhk:undefined, }) this.Emailphonenumberverification(this.state.logins, 2) @@ -321,12 +339,12 @@ class LoginRegisterComponent extends Component { if (this.state.login === undefined || this.state.login == "") { this.setState({ - Phonenumberisnotco: "账号不能为空", + Phonenumberisnotco:"账号不能为空", }) return } else if (this.state.password === undefined || this.state.password == "") { this.setState({ - Phonenumberisnotcodmm: "密码不能为空", + Phonenumberisnotcodmm:"密码不能为空", }) return } @@ -340,38 +358,38 @@ class LoginRegisterComponent extends Component { return } - if (response.data.status === -2) { - if (response.data.message === "该手机号尚未注册" || response.data.message === "该邮箱尚未注册") { + if(response.data.status === -2){ + if(response.data.message==="该手机号尚未注册" || response.data.message==="该邮箱尚未注册"){ this.setState({ - Phonenumberisnotco: response.data.message, + Phonenumberisnotco:response.data.message, }) return; } - else if (response.data.message === "错误的账号或密码") { + else if(response.data.message==="错误的账号或密码"){ this.setState({ - Phonenumberisnotcodmms: response.data.message, + Phonenumberisnotcodmms:response.data.message, }) return; } - else if (response.data.message === "违反平台使用规范,账号已被锁定") { + else if(response.data.message==="违反平台使用规范,账号已被锁定"){ this.setState({ - Phonenumberisnotco: response.data.message, + Phonenumberisnotco:response.data.message, }) return; } else if (response.data.message === "登录密码出错已达上限,账号已被锁定, 请10分钟后重新登录或找回密码") { const messge = ( -
    -

    - 登录密码出错已达上限,账号已被锁定; +

    +

    + 登录密码出错已达上限,账号已被锁定;

    -

    - 请10分钟后重新登录或找回密码 -

    -
    +

    + 请10分钟后重新登录或找回密码 +

    +
    ) this.openNotifications(messge); return; @@ -383,6 +401,11 @@ class LoginRegisterComponent extends Component { } + // if(response.data.profile_completed !== null || response.data.profile_completed === false){ + // this.setMyEduCoderModals(); + // return; + // } + if (response.status === 200) { if (response.data.status === 402) { window.location.href = response.data.url; @@ -392,14 +415,14 @@ class LoginRegisterComponent extends Component { isRender: false }) var weekArray = JSON.parse(window.sessionStorage.getItem('yslgeturls')); - if (weekArray === undefined) { - weekArray = "/"; + if(weekArray===undefined){ + weekArray="/"; } - if (weekArray === null) { - weekArray = "/"; + if(weekArray===null){ + weekArray="/"; } - if (weekArray === "null") { - weekArray = "/"; + if(weekArray==="null"){ + weekArray="/"; } window.location.href = weekArray; } @@ -413,37 +436,74 @@ class LoginRegisterComponent extends Component { } //注册接口 postregistered = () => { - if (this.state.logins === undefined || this.state.logins === "" || this.state.logins.length === 0) { + // if (this.state.logins === undefined || this.state.logins === "") { + // this.openNotification(`请输入登录手机号码或邮箱`,2); + // + // return + // } else if (this.state.dragOk === false) { + // this.openNotification(`请拖动滑块验证`,2); + // return + // } else if (this.state.codes === undefined || this.state.codes == "") { + // this.openNotification(`请输入验证码`,2); + // return + // } else if (this.state.passwords === undefined || this.state.passwords == "") { + // this.openNotification(`请输入密码`,2); + // return + // } else if (this.state.Agreetotheterms === false) { + // this.openNotification(`请同意服务协议条款`,2); + // return; + // } + if (this.state.logins === undefined || this.state.logins === ""||this.state.logins.length===0) { this.setState({ - Phonenumberisnotcos: "账号不能为空", + Phonenumberisnotcos:"账号不能为空", Phonenumberisnotcobool: true, - dragOk: false, - Whethertoverify: this.state.Whethertoverify === true ? false : true, + dragOk:false, + Whethertoverify:this.state.Whethertoverify===true?false:true, }) return } + if(this.state.pciphone===true){ + if (this.state.dragOk === false) { + // this.openNotification(`请拖动滑块完成验证`,2); + this.setState({ + Phonenumberisnotcosytdhk:"请拖动滑块完成验证", + dragOk:false, + Whethertoverify:this.state.Whethertoverify===true?false:true, + }) + return + } + } - if (this.state.passwords === undefined || this.state.passwords == "" || this.state.passwords.length === 0) { + if (this.state.codes === undefined || this.state.codes == ""||this.state.codes.length===0) { + // this.openNotification(`请输入验证码`,2); this.setState({ - Phonenumberisnotcosymmm: "密码不能为空", + Phonenumberisnotcosyzm:"验证码不能为空", }) return - } else if (this.state.passwords !== undefined && this.state.passwords.length > 0 && this.state.passwords.length < 8) { + } else if (this.state.passwords === undefined || this.state.passwords == "" ||this.state.passwords.length===0) { this.setState({ - Phonenumberisnotcosymmm: "密码不能少于8位", + Phonenumberisnotcosymmm:"密码不能为空", }) return - } else if (this.state.passwords !== undefined && this.state.passwords.length > 0 && this.state.passwords.length > 16) { + } else if (this.state.passwords !==undefined &&this.state.passwords.length>0&&this.state.passwords.length<8){ this.setState({ - Phonenumberisnotcosymmm: "密码不能超过16位", + Phonenumberisnotcosymmm:"密码不能少于8位", }) return + } else if (this.state.passwords !==undefined &&this.state.passwords.length>0&&this.state.passwords.length>16){ + this.setState({ + Phonenumberisnotcosymmm:"密码不能超过16位", + }) + return + } else if (this.state.Agreetotheterms === false) { + this.openNotification(`请同意服务协议条款`,2); + return; } let url; - if (this.props.weixinlogin) { - url = '/weapps/register.json'; - } else { + if(this.props.weixinlogin){ + url= '/weapps/register.json'; + }else{ url = "/accounts/register.json"; } @@ -452,9 +512,34 @@ class LoginRegisterComponent extends Component { password: this.state.passwords, code: this.state.codes, }).then((result) => { - if (result && result.data) { - this.openNotification("注册成功!"); - this.props.history.push('/'); + if(result){ + if(result.data.status===-2){ + if(result.data.message==="验证码不正确"){ + this.setState({ + Phonenumberisnotcosyzm:"验证码不正确", + }) + + return; + }else if(result.data.message==="验证码已失效"){ + this.setState({ + Phonenumberisnotcosyzm:"验证码不正确", + }) + + return; + }else { + this.openNotification(result.data.message); + return; + } + }else { + // this.setState({ + // logins: "", + // dragOk: false, + // codes: "", + // passwords: "", + // Agreetotheterms: "", + // }) + this.setMyEduCoderModals(); + } } }).catch((error) => { @@ -475,21 +560,21 @@ class LoginRegisterComponent extends Component { // console.log(result); // this.setState({dragOk: true}) - if (result) { - if (result.data.status === -2) { + if(result){ + if(result.data.status===-2){ if (id === 1) { - if (result.data.message === "该手机号码或邮箱已被注册") { + if(result.data.message==="该手机号码或邮箱已被注册"){ this.setState({ Phonenumberisnotco: undefined, Phonenumberisnotcobool: false, - dragOk: true, + dragOk:true, }) - } else { + }else { this.setState({ Phonenumberisnotco: result.data.message, Phonenumberisnotcobool: true, - dragOk: false, - Whethertoverify: this.state.Whethertoverify === true ? false : true, + dragOk:false, + Whethertoverify:this.state.Whethertoverify===true?false:true, }) @@ -499,26 +584,26 @@ class LoginRegisterComponent extends Component { this.setState({ Phonenumberisnotcos: result.data.message, Phonenumberisnotcobool: true, - dragOk: false, - Whethertoverify: this.state.Whethertoverify === true ? false : true, + dragOk:false, + Whethertoverify:this.state.Whethertoverify===true?false:true, }) return; } - } else { + }else { if (id === 1) { this.setState({ Phonenumberisnotco: undefined, Phonenumberisnotcobool: false, - dragOk: true, + dragOk:true, }) return; } else if (id === 2) { this.setState({ Phonenumberisnotcos: undefined, Phonenumberisnotcobool: false, - dragOk: true, + dragOk:true, }) return; } @@ -531,20 +616,20 @@ class LoginRegisterComponent extends Component { }; //短信验证 SMSverification = () => { - let logins = this.state.logins; + let logins=this.state.logins; var url = `/accounts/get_verification_code.json`; axios.get((url), { params: { login: this.state.logins, type: 1, - smscode: setmiyah(logins) + smscode:setmiyah(logins) } }).then((result) => { //验证有问题{"status":1,"message":"success"} // console.log(result); - if (result.data.status === 1) { + if(result.data.status===1){ this.openNotification("验证码已发送,请注意查收"); - } else if (result.data.status === -2) { + }else if(result.data.status===-2){ this.openNotification(result.data.message); } }).catch((error) => { @@ -557,13 +642,13 @@ class LoginRegisterComponent extends Component { if (this.state.classpassbool === true) { this.setState({ - passopens: passoff, + passopens:passoff , classpass: "text", classpassbool: false, }) } else { this.setState({ - passopens: passopen, + passopens: passopen , classpass: "password", classpassbool: true, }) @@ -575,19 +660,19 @@ class LoginRegisterComponent extends Component { getverificationcode = () => { // console.log(this.state.Phonenumberisnotcobool); // console.log(this.state.dragOk); - if (this.state.logins === undefined || this.state.logins.length === 0) { + if(this.state.logins === undefined || this.state.logins.length===0){ this.openNotification("请输入手机号或邮箱"); return; } //这是判断是否手机正确 - if (this.state.Phonenumberisnotcobool === true) { + if(this.state.Phonenumberisnotcobool === true){ this.openNotification(this.state.Phonenumberisnotcos); this.setState({ - Whethertoverify: this.state.Whethertoverify === true ? false : true, + Whethertoverify:this.state.Whethertoverify===true?false:true, }) return; } - if (this.state.pciphone === true) { + if(this.state.pciphone===true) { if (this.state.dragOk === false) { this.openNotification("请拖动滑块验证"); return; @@ -639,25 +724,25 @@ class LoginRegisterComponent extends Component { loginInputonChange = (e) => { // console.log(e.target.value); var stirngt; - if (e.target.value.length > 0) { - var str = e.target.value.replace(/\s*/g, "") - stirngt = str; - } else { - stirngt = e.target.value; + if(e.target.value.length>0){ + var str= e.target.value.replace(/\s*/g,"") + stirngt=str; + }else{ + stirngt= e.target.value; } if (e.target.value.length === 0) { this.setState({ Phonenumberisnotco: undefined, Phonenumberisnotcobool: false, - Phonenumberisnotcodmms: undefined, + Phonenumberisnotcodmms:undefined, login: stirngt, }) - } else { + }else{ this.setState({ login: stirngt, - Phonenumberisnotco: undefined, - Phonenumberisnotcodmms: undefined, + Phonenumberisnotco:undefined, + Phonenumberisnotcodmms:undefined, }) } @@ -674,17 +759,20 @@ class LoginRegisterComponent extends Component { }) return; } + // var telephone = $("#telephoneAdd.tianjia_phone").val(); var regph = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; + // var email = $("#add_email.tianjia_email").val(); var regemail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; + // [1]手机号开头必须是1 [3,4,5,6,7,8] 第二位是3-8中的一个 [0-9]{9} 后边9位可以是0-9的任意数字。 var stringdata = undefined; if (!regph.test(e.target.value)) { stringdata = "手机号格式不正确"; this.setState({ Phonenumberisnotcos: stringdata, Phonenumberisnotcobool: true, - dragOk: false, - Whethertoverify: this.state.Whethertoverify === true ? false : true, + dragOk:false, + Whethertoverify:this.state.Whethertoverify===true?false:true, }) } else { this.setState({ @@ -705,8 +793,8 @@ class LoginRegisterComponent extends Component { this.setState({ Phonenumberisnotcos: stringdata, Phonenumberisnotcobool: true, - dragOk: false, - Whethertoverify: this.state.Whethertoverify === true ? false : true, + dragOk:false, + Whethertoverify:this.state.Whethertoverify===true?false:true, }) return } else { @@ -722,43 +810,47 @@ class LoginRegisterComponent extends Component { } //获取登入密码 passwordonChange = (e) => { + // console.log(e.target.value); var stirngt; - if (e.target.value.length > 0) { - var str = e.target.value.replace(/\s*/g, "") - stirngt = str; - } else { - stirngt = e.target.value; + if(e.target.value.length>0){ + var str= e.target.value.replace(/\s*/g,"") + stirngt=str; + }else{ + stirngt= e.target.value; } this.setState({ password: stirngt, - Phonenumberisnotcodmm: undefined, - Phonenumberisnotcodmms: undefined, + Phonenumberisnotcodmm:undefined, + Phonenumberisnotcodmms:undefined, }) + // this.setState({ + // password: e.target.value + // }) } //获取注册登入 loginInputonChanges = (e) => { var stirngt; - if (e.target.value.length > 0) { - var str = e.target.value.replace(/\s*/g, "") - stirngt = str; - } else { - stirngt = e.target.value; + if(e.target.value.length>0){ + var str= e.target.value.replace(/\s*/g,"") + stirngt=str; + }else{ + stirngt= e.target.value; } if (e.target.value.length === 0) { this.setState({ Phonenumberisnotcos: undefined, Phonenumberisnotcobool: false, logins: stirngt, - dragOk: false, - Whethertoverify: this.state.Whethertoverify === true ? false : true, + dragOk:false, + Whethertoverify:this.state.Whethertoverify===true?false:true, }) - } else { + }else{ this.setState({ logins: stirngt, Phonenumberisnotcos: undefined, - dragOk: false, - Whethertoverify: this.state.Whethertoverify === true ? false : true, + dragOk:false, + Whethertoverify:this.state.Whethertoverify===true?false:true, }) } @@ -767,81 +859,186 @@ class LoginRegisterComponent extends Component { passwordonChanges = (e) => { // console.log(e.target.value); var stirngt; - if (e.target.value.length > 0) { - var str = e.target.value.replace(/\s*/g, "") - stirngt = str; - } else { - stirngt = e.target.value; + if(e.target.value.length>0){ + var str= e.target.value.replace(/\s*/g,"") + stirngt=str; + }else{ + stirngt= e.target.value; } this.setState({ passwords: stirngt, - Phonenumberisnotcosymmm: undefined, + Phonenumberisnotcosymmm:undefined, }) } //获取code codesonChange = (e) => { this.setState({ codes: e.target.value, - Phonenumberisnotcosyzm: undefined, + Phonenumberisnotcosyzm:undefined, }) } //切换tab - changeTab = (e) => { + changeTab=(e)=>{ this.setState({ - tab: e.key + tab:e.key }) - if (e.key === 0) { + + if(e.key === 0){ this.setState({ - Phonenumberisnotcos: undefined + Phonenumberisnotcos:undefined }) - } else { + }else{ this.setState({ - Phonenumberisnotco: undefined + Phonenumberisnotco:undefined }) + } + + // this.props.history.push(`/classrooms/${this.props.match.params.coursesId}/exercises/${this.props.match.params.Id}/student_exercise_list?tab=`+e.key) + } - setMyEduCoderModals = () => { + loginonkeyup =(e)=>{ + if(e.keyCode==32){ + + return false; + } + }; + setNotcompleteds=()=>{ this.setState({ - MyEduCoderModals: true, - registered: "注册成功" + Notcompleteds:true, + MyEduCoderModals:false, + registered:undefined, + + }) + }; + setMyEduCoderModals=()=>{ + this.setState({ + MyEduCoderModals:true, + registered:"注册成功" }) }; + openweixinlogin=()=>{ + this.setState({ + weixinlogin:true + }) + } + hideweixinlogin=()=>{ + this.setState({ + weixinlogin:false, + qqlogin:false, + tab:["0"] + }) + } + + openqqlogin=()=>{ + this.setState({ + qqlogin:true + }) + //window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2f${window.location.host}%2otherloginqq&response_type=code` + window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2fwww.educoder.net%2fotherloginqq&state=null,${window.location.host}&response_type=code` + // window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2fwww.educoder.net%2fotherloginstart&tp=qq&response_type=code` + } + + openphoneqqlogin=()=>{ + window.open( + `https://xui.ptlogin2.qq.com/cgi-bin/xlogin?appid=716027609&pt_3rd_aid=101508858&daid=383&pt_skey_valid=0&style=35&s_url=http%3A%2F%2Fconnect.qq.com&refer_cgi=authorize&which=&client_id=101508858&response_type=code&scope=get_user_info&redirect_uri=https%3a%2f%2fwww.educoder.net%2fotherloginqq&state=null,${window.location.host}&response_type=code` + ) + } render() { - const {passopens,Agreetotheterms,Phonenumberisnotcos,tab,classpassbool,Phonenumberisnotcosymmm} = this.state + const { + // 登录 + autoLogin, + classpass, + passopens, + seconds, + getverificationcodes, + Agreetotheterms, + Phonenumberisnotco, + Phonenumberisnotcos, + codes, + tab, + dragOk, + Whethertoverify, + classpassbool, + Phonenumberisnotcosytdhk, + Phonenumberisnotcosyzm, + Phonenumberisnotcosymmm, + Phonenumberisnotcodmm, + // 注册 + readAgreement, + pciphone, + Phonenumberisnotcodmms, + weixinlogin + } = this.state + // height: 346px; + if (this.state.seconds === 0) { + // window.location.href='http://www.cnblogs.com/a-cat/'; + } + + return ( -
    - + } + -
    - - 注册 - - -
    - - { - Phonenumberisnotcos && Phonenumberisnotcos !== "" ? -

    - {Phonenumberisnotcos} -

    - :
    +
    + {weixinlogin===false&&this.props.weixinlogin===undefined? + 登录 + 注册 + :""} - } + { + weixinlogin===false&&parseInt(tab[0])==0 && +
    +

    + } { - weixinlogin===false&&parseInt(tab[0])==1 && + weixinlogin===false&&parseInt(tab[0])==1 &&
    - this.Showandhide(key)}> - - }> - { - Phonenumberisnotcosymmm && Phonenumberisnotcosymmm !== "" ? -

    - {Phonenumberisnotcosymmm} + } + ` + } + + this.Showandhide(key)}> + + }> + { + Phonenumberisnotcosymmm && Phonenumberisnotcosymmm !== "" ? +

    + {Phonenumberisnotcosymmm}

    :
    } - {this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?我已阅读并同意 - - 《服务协议条款》 - :""} + + 《服务协议条款》 + :""} @@ -1063,15 +1261,15 @@ class LoginRegisterComponent extends Component { - {weixinlogin===true?:""} - {weixinlogin===true?

    - this.hideweixinlogin()}>返回登录注册 -

    :""} + {weixinlogin===true?:""} + {weixinlogin===true?

    + this.hideweixinlogin()}>返回登录注册 +

    :""}
    @@ -1080,3 +1278,4 @@ class LoginRegisterComponent extends Component { } export default (LoginRegisterComponent); +