Merge branch 'feature_explore' of https://code.gitlink.org.cn/durian/forgeplus-react into pre_dev_military

This commit is contained in:
何童崇 2022-10-28 14:10:44 +08:00
commit c01c1f0d98
16 changed files with 289 additions and 100 deletions

2
package-lock.json generated
View File

@ -4126,7 +4126,7 @@
},
"cross-port-killer": {
"version": "1.4.0",
"resolved": "http://173.15.15.82:8081/repository/npm-all/cross-port-killer/-/cross-port-killer-1.4.0.tgz",
"resolved": "https://registry.npmjs.org/cross-port-killer/-/cross-port-killer-1.4.0.tgz",
"integrity": "sha512-ujqfftKsSeorFMVI6JP25xMBixHEaDWVK+NarRZAGnJjR5AhebRQU+g+k/Lj8OHwM6f+wrrs8u5kkCdI7RLtxQ=="
},
"cross-spawn": {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 993 B

View File

@ -41,7 +41,7 @@ class Index extends Component {
return (
<div className="newMain clearfix">
{window.location.href.indexOf('osredm.jk') < 0&&<Handbook/>}
{/* {window.location.href.indexOf('osredm.jk') < 0&&<Handbook/>} */}
<Switch {...this.props}>
<Route
path="/projects/:projectsType/new/:OIdentifier"

View File

@ -15,7 +15,18 @@ import CheckProfile from '../Component/ProfileModal/Profile';
import Slider from 'react-slick';
import left from './img/left.png';
import right from './img/right.png';
import { getImageUrl } from '../../managements/common/utils';
import explore1 from '../Images/explore1.png';
import explore2 from '../Images/explore2.png';
import explore3 from '../Images/explore3.png';
import explore4 from '../Images/explore4.png';
import explore5 from '../Images/explore5.png';
import explore6 from '../Images/explore6.png';
import explore7 from '../Images/explore7.png';
import explore8 from '../Images/explore8.png';
import explore9 from '../Images/explore9.png';
import explore10 from '../Images/explore10.png';
import { getImageUrl } from 'educoder';
import { Link } from 'react-router-dom';
const Search = Input.Search;
@ -38,7 +49,12 @@ class Index extends Component {
languageList:undefined,
languageId:undefined,
CategoryList:undefined,
bannerList: undefined
bannerList: undefined,
// 今日、本周热门项目
hotProjectTime: 1,
hotProjectList: undefined,
// 热门开发者
authorList: undefined
}
}
@ -52,6 +68,35 @@ class Index extends Component {
this.getLanguage();
this.getBannerList();
// this.getRecommandOri();
this.getList(1);
this.getAuthorList();
}
// 获取热门开发者
getAuthorList = ()=>{
axios.get(`/user_rank.json`,{
params:{
time: 30
}
}).then(result=>{
if(result && result.data){
this.setState({authorList: result.data.users.slice(0,10)})
}
}).catch(error=>{})
}
// 获取热门项目
getList = (time) => {
const url = `/project_rank.json`;
axios.get(url,{
params:{
time
}
}).then(result=>{
if(result && result.data){
this.setState({hotProjectList: result.data.projects})
}
}).catch(error=>{})
}
// 获取banner图列表
@ -152,7 +197,7 @@ class Index extends Component {
<li key={key} className={ parseInt(active_type) === item.id ? 'active' : ''} onClick={() => this.changeType(`${item.id}`, list)}>
<p>
<span className="font-16">{item.name}</span>
<span className="color-blue">{item.projects_count}</span>
{/* <span className="color-blue">{item.projects_count}</span> */}
</p>
</li>
)
@ -195,7 +240,7 @@ class Index extends Component {
<li key={key} className={parseInt(active_id) === item.id ? 'active' : ''} onClick={() => this.changeCategory(`${item.id}`, list)}>
<p>
<span className="font-16">{item.name}</span>
<span className="color-blue">{item.projects_count}</span>
{/* <span className="color-blue">{item.projects_count}</span> */}
</p>
</li>
)
@ -295,7 +340,7 @@ class Index extends Component {
render() {
const { current_user, mygetHelmetapi} = this.props;
const { projectsList ,isSpin, total, search, limit, page, typeList, categoryList ,bannerList } = this.state;
const { projectsList ,isSpin, total, search, limit, page, typeList, categoryList ,bannerList, hotProjectTime, hotProjectList, authorList } = this.state;
let settings={
dots:true,
@ -308,12 +353,13 @@ class Index extends Component {
pauseOnFocus:true,
autoplay:true,
arrows:true,
prevArrow:<button type='button' class='changeImgBut'><img src={left} width="70px" alt=""/></button>,
nextArrow:<button type='button' class='changeImgBut'><img src={right} width="70px" alt=""/></button>
prevArrow:<button type='button' className='changeImgBut'><img src={left} width="70px" alt=""/></button>,
nextArrow:<button type='button' className='changeImgBut'><img src={right} width="70px" alt=""/></button>
}
return (
<div>
<div style={{backgroundColor: '#f5f7fa'}}>
{/* banner图 */}
{bannerList ? bannerList.length === 1 ? bannerList[0].url ? <a href={bannerList[0].url} target={'_blank'}><img alt={bannerList[0].title} src={bannerList[0].image ? `${ mygetHelmetapi && mygetHelmetapi.current_main_site_url }${bannerList[0].image}` : banner} width='100%' height='100%' className='imgBox'/></a> :
<img alt={bannerList[0].title} src={bannerList[0].image ? `${ mygetHelmetapi && mygetHelmetapi.current_main_site_url }${bannerList[0].image}` : banner} width='100%' height='100%' className='imgBox'/> :
<Slider {...settings} className="projectBannerBox">
@ -327,57 +373,38 @@ class Index extends Component {
})}
</Slider>: <img src={banner} width="100%" alt=""/>}
{bannerList && bannerList.length === 0 && <img src={banner} width="100%" alt=""/>}
<div className="ProjectListIndex">
{/* 项目列表 */}
<div className="ProjectListIndex exploreBox">
<Affix className="affix-list-left" offsetTop={90}>
<div className="affix-list-content">
<ul className="list-l-Menu">
<li
className="MenuTitle"
onClick={() => {
this.getType();
this.changeType(undefined, this.state.typeList);
}}
>
<span>
<i className="iconfont icon-bianchengyuyan color-grey-9 font-15 mr5"></i>
语言
</span>
<li className="MenuTitle">
<img src={explore1} alt="" width={18} className='mr5'/>语言
</li>
<div className="list-affix">{typeList}</div>
</ul>
<ul className="list-l-Menu">
<li
className="MenuTitle"
onClick={() => {
this.getCategory();
this.changeCategory(undefined, this.state.categoryList);
}}
>
<span>
<i className="iconfont icon-xiangmuleibie color-grey-9 font-15 mr5"></i>
项目类别
</span>
<li className="MenuTitle">
<img src={explore2} alt="" width={18} className='mr5'/>项目类别
</li>
<div className="list-affix">{categoryList}</div>
</ul>
</div>
</Affix>
<div
className="list-right boxShandow radius-2"
style={{ padding: 0 }}
>
<div className="list-right boxShandow radius-2" style={{ padding: 0 }}>
<Spin spinning={isSpin}>
<div className="list-r-operation">
<div>
<Search
placeholder="输入项目名称关键字进行搜索"
enterButton="搜索"
enterButton={<img src={explore9} alt="" width={20}/>}
size="large"
onSearch={this.searchFun}
className="list-r-Search"
className="list-r-Search searchBox"
value={search}
onChange={this.changeSearchValue}
allowClear
/>
</div>
<div>
@ -389,10 +416,8 @@ class Index extends Component {
placement="bottom"
className="mr50"
>
<a className="ant-dropdown-link">
<span className="color-blue font-16">
<img src={img_new} alt="" width="13px" /> 新建
</span>
<a className="ant-dropdown-link font-15 actionBtnBox">
<i className='iconfont icon-jiashang1 mr5'></i>
</a>
</Popover>
)}
@ -402,10 +427,8 @@ class Index extends Component {
trigger={["click"]}
placement="bottom"
>
<a className="ant-dropdown-link">
<span className="color-blue font-16">
排序 <img src={img_array} alt="" width="10px" />
</span>
<a className="ant-dropdown-link font-15 actionBtnBox top">
排序 <i className='iconfont icon-sanjiaoxing-down ml5'></i>
</a>
</Popover>
</div>
@ -419,6 +442,61 @@ class Index extends Component {
{this.pagination(total, limit, page)}
</Spin>
</div>
<div style={{width: '320px'}} className='ml20'>
{/* 帮助手册 */}
{window.location.href.indexOf('osredm.jk') < 0 &&<div className='helpText font-28'>
<a href="https://help.osredm.com/#/git" target='_blank'>
<img src={explore10} alt="" className="helpImg1"/>
</a>
</div>}
{/* 热门项目(今日/本周) */}
<div className='hotProjects mt20'>
<div className='hotProjectsTitle font-17'>
<div className={`oneItemTil ${hotProjectTime === 1 ? 'activeHot' : ''}`} onClick={()=>{this.setState({hotProjectTime: 1}); this.getList(1)}}>
<img src={explore3} alt="" className="helpImg2 mr10" width={18}/>
<span>今日热门</span>
</div>
<div className={`oneItemTil ${hotProjectTime === 7 ? 'activeHot' : ''}`} onClick={()=>{this.setState({hotProjectTime: 7}); this.getList(7)}}>
<img src={explore4} alt="" className="helpImg2 mr10" width={18}/>
<span>本周热门</span>
</div>
</div>
{hotProjectList && hotProjectList.length > 0 && hotProjectList.map((i, index)=>{
return <div className='hotProjectItem' key={index}>
<div className="mInfos">
<Link target="_blank" to={`/${i.owner && i.owner.login}/${i.identifier}`} className="name task-hide font-16">{i.owner && i.owner.name}/{i.name}</Link>
<span className='font-14'>
<i className="iconfont icon-dianzan11 font-16 mr4"></i>{i.praises}
</span>
</div>
<div className="sInfos task-hide-2 font-14 mt10">
{i.description ? i.description : "暂无项目简介"}
</div>
</div>
})}
</div>
{/* 热门开发者 */}
<div className='hotProjects mt20'>
<div className='hotProjectsTitle font-17 pl30'>
<img src={explore5} alt="" className="helpImg2 mr10" width={18}/>开源贡献者TOP10
</div>
<div className='hotAuthor til font-15'>
<div className='hotAuthor1'>排名</div>
<div className='hotAuthor2'>贡献者</div>
<div className='hotAuthor3'>总积分</div>
</div>
{authorList && authorList.length > 0 && authorList.map((i, index) =>{
return <div className={`hotAuthor font-15 ${index%2 === 0 ? 'otherColor' : ''}`} key={index}>
<div className='hotAuthor1'>{index<3 ? <img src={index === 0 ? explore6 : index === 1 ? explore7 : explore8} alt='' width={23}/> : index+1}</div>
<Link target="_blank" to={`/${i.login}`} className='hotAuthor2 task-hide'>
<img src={getImageUrl(`/${i.avatar_url}`)} alt="" width={24} className='mr5'/>
<span style={{lineHeight: '3'}}>{i.name}</span>
</Link>
<div className='hotAuthor3 ml20'>{i.score}</div>
</div>
})}
</div>
</div>
</div>
</div>
);

View File

@ -73,11 +73,11 @@ class IndexItem extends Component {
{
item.platform === "educoder" ?
<a href="javascript:void(0)" style={{ cursor: "default" }} className="show-user-link">
<img className="p-r-photo" alt="" src={item.author && item.author.image_url} ></img>
<img className="p-r-photo explore" alt="" src={item.author && item.author.image_url} ></img>
</a>
:
<Link to={`/${item.author && item.author.login}`} className="show-user-link">
<img className="p-r-photo" alt="" src={getImageUrl(`/${item.author && item.author.image_url}`)} ></img>
<img className="p-r-photo explore" alt="" src={getImageUrl(`/${item.author && item.author.image_url}`)} ></img>
</Link>
}
<div className="p-r-Infos">
@ -101,7 +101,7 @@ class IndexItem extends Component {
</Tooltip>:""
}
</AlignCenter> */}
<a onClick={() => this.projectHref(`/${item.author.login}/${item.identifier}`, item.user_apply_signatures, item.id, item.is_secret, item.author.login, item.is_member)} className="hide-1 color-grey-3 font-18 task-hide fwt-500 " style={{ whiteSpace: "wrap", width: 400 }}>
<a onClick={() => this.projectHref(`/${item.author.login}/${item.identifier}`, item.user_apply_signatures, item.id, item.is_secret, item.author.login, item.is_member)} className="hide-1 font-16 task-hide" style={{ whiteSpace: "wrap", display: 'flex', flex: 1, color:'#232a39'}}>
{item.author.name}/{item.name}
{
item.forked_from_project_id ?
@ -123,19 +123,18 @@ class IndexItem extends Component {
</a>
<span className="p-r-tags">
<span className="pariseTag">
<img src={img_parise} alt="" className="pariseImg" /> {item.praises_count}
<i className='iconfont icon-morendianzan_icon font-14 mr3'></i> {item.praises_count}
</span>
<span>
<i className="iconfont icon-fork mr3 font-16" style={{ color: "#1B8FFF" }} />fork {item.forked_count}
<i className="iconfont icon-fork mr3 font-16"/>fork {item.forked_count}
</span>
</span>
</div>
<p className="break_word task-hide-2 mt10" style={{ maxHeight: "44px", lineHeight: "22px" }}>{item.description}</p>
<p className="break_word task-hide-2 mt10" style={{ maxHeight: "44px", lineHeight: "22px", color: '#525561'}}>{item.description}</p>
<div className="p-r-about">
<span className="p-r-detail">
{item.last_update_time ? <span><label>更新于</label>{item.time_ago}</span> : ""}
{item.language && item.language.id ? <span className="color-grey-3">{item.language.name}</span> : ""}
<span className="p-r-detail font-13">
{item.last_update_time ? <span><i className='iconfont icon-shijianicon font-13 mr3'/>更新于{item.time_ago}</span> : ""}
{item.language && item.language.id ? <span>{item.language.name}</span> : ""}
</span>
</div>
</div>

View File

@ -11,6 +11,110 @@
display: flex;
align-items: flex-start;
flex-wrap:wrap;
&.exploreBox{
flex-wrap: nowrap;
.actionBtnBox{
color: #2a3ee9;
display: inline-flex;
align-items: center;
&.top{
position: relative;
top: -2px;
}
}
.searchBox .ant-input{
padding-left: 16px;
height: 36px;
border: 1px solid #ffffff;
background-color: #f8fbff !important;
}
.searchBox .ant-input-search-button{
height: 36px !important;
padding: 0 20px;
}
.helpText{
height:100px;
background-image:linear-gradient(131.52deg,#2a3ee9 0%,#428cff 46.02%,#6479ff 100%);
border:2px solid #ffffff;
.helpImg1{
width: 96%;
margin: 1.5% 2.1%;
}
}
.helpImg2{
vertical-align: text-bottom;
}
.hotProjects{
background-image:linear-gradient(180deg,#f4f5f8 0%,#fbfcfd 100%);
border:2px solid #ffffff;
}
.hotProjectsTitle{
color: #000000;
height:50px;
line-height: 50px;
background-color:rgba(243, 250, 255, 0.74);
box-shadow:0px 2px 3px rgba(212, 217, 255, 0.57);
}
.oneItemTil{
display: inline-block;
width: 158px;
text-align: center;
cursor: pointer;
}
.activeHot{
color:#2a3ee9;
border-bottom: 1px solid #2a3ee9;
}
.hotProjectItem{
padding-bottom: 16px;
margin: 20px 20px 16px;
border-bottom: 1px dashed #cccfd6;
.mInfos{
display: flex;
align-items: center;
height: 20px;
color: #656977;
.name{
flex:1;
color:#232a39;
}
}
.sInfos{
background: #F7F8F9;
font-weight: 400;
color:#525561;
line-height: 24px;
word-break: break-all;
}
}
.hotProjectItem:last-child{
border-bottom: none;
}
.hotAuthor{
height: 50px;
display: flex;
align-items: center;
&.til{
color:#989fab;
}
&.otherColor{
background-color:rgba(238, 243, 251, 0.76);
}
&:not(.til):hover{
background-color:rgba(225, 225, 225, 0.28);
}
}
.hotAuthor1{
width: 90px;
text-align: center;
}
.hotAuthor2{
flex: 1;
}
.hotAuthor3{
width: 75px;
}
}
}
.list-left{
width: 26%;
@ -19,13 +123,10 @@
margin-bottom: 20px;
}
.affix-list-left{
width: 26%;
width:200px;
box-sizing: border-box;
margin-bottom: 20px;
}
.affix-list-content{
padding-right:20px;
}
.list-left > div{
border:1px solid #eee;
}
@ -61,8 +162,7 @@
justify-content: space-between;
flex-wrap: wrap;
align-items: center;
padding:25px 30px;
border-bottom: 1px solid #E0E0E0;
padding: 15px 23px 0;
}
.list-r-Search{
width: 400px;
@ -100,12 +200,13 @@
}
.p-r-Item{
display: flex;
border-bottom:1px solid rgba(238,238,238,1);
padding:22px 0px;
justify-content: flex-start;
padding-top: 22px;
}
.boxShandow{
box-shadow:0px 2px 20px 10px rgba(0,0,0,0.03);
flex: 1;
background-image:linear-gradient(180deg,#f3f5f8 0%,#ffffff 100%);
box-shadow:8px 6px 18px rgba(171, 202, 255, 0.24) inset;
}
.p-r-photo{
width: 60px;
@ -113,10 +214,17 @@
border-radius: 50%;
margin-right: 22px;
margin-top: 8px;
&.explore{
width: 32px;
height: 32px;
margin-right: 10px;
}
}
.p-r-Infos{
flex: 1;
width: 0;
padding-bottom: 19px;
border-bottom: 1px dashed #cccfd6;
}
.p-r-name{
display: flex;
@ -166,16 +274,16 @@
margin-left: 15px;
padding:0px 10px;
border-radius:15px;
background: #EBF4FE;
color: #333;
height: 24px;
line-height: 24px;
background: #e3ebff;
color:#656977;
height: 28px;
line-height: 28px;
display: block;
font-size: 12px;
font-size: 14px;
display: flex;
}
.p-r-tags > span.pariseTag{
background: #FFF3DC;
background: rgba(223, 115, 20, 0.08);
}
.p-r-tags.large > span >label{
padding:0px 12px;
@ -207,10 +315,7 @@
}
.p-r-detail > span{
margin-right: 22px;
color: #888;
}
.p-r-detail > span > label{
color: #999;
color:#9b9eaa;
}
.p-r-about{
@ -218,7 +323,7 @@
justify-content: space-between;
flex-wrap: nowrap;
margin-top: 8px;
color: #666;
color:#9b9eaa;
}
.spincontent{
height:400px;

View File

@ -63,6 +63,7 @@ ul,ol,dl{
display: inline-block;
}
.ProjectListIndex{
background-color:#f5f7fa;
.ant-affix{
z-index: 1;
}
@ -228,26 +229,34 @@ form{
}
}
.list-l-Menu{
margin-bottom: 12px!important;
border-radius:2px;
background-color: #fff;
box-shadow: 0px 0px 2px rgba(0,0,0,0.2);
margin-bottom: 35px!important;
background-image:linear-gradient(180deg,#f4f5f8 0%,#fbfcfd 100%);
border:2px solid #ffffff;
.list-affix{
min-height: 20px;
max-height: 308px;
max-height: 285px;
overflow-y: auto;
&::-webkit-scrollbar-thumb{
background-color:#e6edf9;
box-shadow: none
}
&::-webkit-scrollbar-track{
display: none;
}
&::-webkit-scrollbar{
background: none;
}
}
li{
font-size: 1rem;
padding:0px 0px 0px 20px;
box-sizing: border-box;
color: #333;
color:#4c5b76;
position: relative;
p{
height: 62px;
line-height: 62px;
height: 48px;
line-height: 48px;
width: 100%;
border-bottom: 1px solid #eee;
display: flex;
justify-content: space-between;
cursor: pointer;
@ -256,39 +265,38 @@ form{
a{
width:100%;
}
& span:last-child{
color: #999;
}
}
&:last-child > p{
border-bottom: none;
}
&:not(.MenuTitle):hover{
background-color: #fafafa;
&:not(.MenuTitle):not(.active):hover{
background-color: rgba(225, 225, 225, 0.3);
}
}
li.active{
background-color: #fafafa;
background-color: rgba(70, 106, 255, 0.09);
color:#2a3ee9;
}
li.active::before{
position: absolute;
left: 0px;
top: 15px;
top: 10px;
width: 6px;
content: '';
height: 33px;
height: 29px;
background: #4154f1;
}
.MenuTitle{
font-size: 16px;
font-size: 17px;
background-size: 100% 100%;
color: #333!important;
height: 62px;
line-height: 62px;
border-bottom: 1px solid #E0E0E0;
color:#000000;
height: 71px;
line-height: 48px;
font-weight: 400;
padding-left: 20px;
display: flex;
align-items: center;
span{
display: block;
width: 50%;
@ -297,7 +305,6 @@ form{
}
span:hover{
color: #4154f1;
.iconfont{
color: #4154f1 !important;
}