forked from Gitlink/forgeplus-react
This commit is contained in:
parent
534da2115a
commit
74deb640a9
|
@ -104,7 +104,7 @@ class NewHeader extends Component {
|
|||
</div>
|
||||
)
|
||||
}else{
|
||||
return <i className="iconfont icon-sousuo font-18 color-white ml30" onClick={() => {
|
||||
return <i className="iconfont icon-sousuo font-18 color-grey-6 ml30" onClick={() => {
|
||||
this.setState({openSearch:true})
|
||||
}} />
|
||||
}
|
||||
|
@ -482,8 +482,8 @@ class NewHeader extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { match } = this.props;
|
||||
const current_user = this.props.user;
|
||||
const { match} = this.props;
|
||||
let current_user = this.props.user;
|
||||
let { Addcoursestypes,
|
||||
tojoinitemtype,
|
||||
tojoinclasstitle,
|
||||
|
@ -579,7 +579,6 @@ class NewHeader extends Component {
|
|||
|
||||
let search_url = settings && settings.common && settings.common.length> 0 && settings.common.filter(item=>item.name==="搜索");
|
||||
let notice_url = settings && settings.common && settings.common.length> 0 && settings.common.filter(item=>item.name==="通知");
|
||||
|
||||
return (
|
||||
<div className="newHeaders" id="nHeader">
|
||||
<div className="headerContent">
|
||||
|
@ -651,7 +650,7 @@ class NewHeader extends Component {
|
|||
{
|
||||
current_user && (current_user.main_site || current_user.login) && (settings && settings.add && settings.add.length>0)?
|
||||
<Dropdown overlay={this.addMenu(settings && settings.add)} placement="bottomRight">
|
||||
<i className="iconfont icon-tianjiafangda color-white ml30"></i>
|
||||
<i className="iconfont icon-tianjiafangda color-grey-6 ml30"></i>
|
||||
</Dropdown>:""
|
||||
}
|
||||
|
||||
|
@ -659,7 +658,7 @@ class NewHeader extends Component {
|
|||
<div className="ml30 edu-menu-panel">
|
||||
{user && user.login &&
|
||||
<a href={`${notice_url[0].url}`} style={{ position: 'relative' }}>
|
||||
<i className="iconfont icon-xiaoxilingdang color-white"></i>
|
||||
<i className="iconfont icon-xiaoxilingdang color-grey-6"></i>
|
||||
<span className="newslight" style={{ display: this.props.Headertop === undefined ? "none" : this.props.Headertop.new_message === true ? "block" : "none" }}>
|
||||
</span>
|
||||
</a>
|
||||
|
@ -695,10 +694,10 @@ class NewHeader extends Component {
|
|||
</div>
|
||||
{!user || (user && !user.login) ?
|
||||
<span className="font-15 ml30">
|
||||
<a onClick={() => this.educoderlogin()} className="mr5 color-white">登录</a>
|
||||
<a onClick={() => this.educoderlogin()} className="mr5 color-grey-6">登录</a>
|
||||
{
|
||||
settings && settings.new_course && settings.new_course.register_url &&
|
||||
<span><em className="vertical-line"></em><a className="ml5 color-white" href={`${settings.new_course.register_url}`} target="_blank">注册</a></span>
|
||||
settings && settings.common && settings.common.register &&
|
||||
<span><em className="vertical-line"></em><a className="ml5 color-grey-6" href={`${settings.common.register}`} target="_blank">注册</a></span>
|
||||
}
|
||||
</span>
|
||||
:
|
||||
|
|
|
@ -74,6 +74,7 @@ class CoderRootCommit extends Component{
|
|||
array.push({
|
||||
name:item.author && item.author.name,
|
||||
login: item.author && item.author.login,
|
||||
id: item.author && item.author.id,
|
||||
image_url:item.author && item.author.image_url,
|
||||
sha:item.sha,
|
||||
time_from_now:item.time_from_now,
|
||||
|
@ -136,10 +137,18 @@ class CoderRootCommit extends Component{
|
|||
<Link to={`/projects/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`} className="flex1 ml20 font-16 color-grey-3">{item.message}</Link>
|
||||
</p>
|
||||
<p className="f-wrap-alignCenter mt15">
|
||||
<Link to={`/users/${item.login}`} className="show-user-link">
|
||||
{item.image_url?<img src={getImageUrl(`images/${item.image_url}`)} alt="" width="28px" height="28px" className="mr15 radius"/>:""}
|
||||
<label className="font-14 color-grey-6" style={{verticalAlign:'middle'}}>{item.name ?`${item.name}:`:""}提交于 {item.time_from_now}</label>
|
||||
</Link>
|
||||
{
|
||||
item.id ?
|
||||
<Link to={`/users/${item.login}`} className="show-user-link">
|
||||
{item.image_url?<img src={getImageUrl(`images/${item.image_url}`)} alt="" width="28px" height="28px" className="mr15 radius"/>:""}
|
||||
<label className="font-14 color-grey-6" style={{verticalAlign:'middle'}}>{item.name ?`${item.name}:`:""}提交于 {item.time_from_now}</label>
|
||||
</Link>:
|
||||
<span className="show-user-link">
|
||||
{item.image_url?<img src={getImageUrl(`images/${item.image_url}`)} alt="" width="28px" height="28px" className="mr15 radius"/>:""}
|
||||
<label className="font-14 color-grey-6" style={{verticalAlign:'middle'}}>{item.name ?`${item.name}:`:""}提交于 {item.time_from_now}</label>
|
||||
</span>
|
||||
}
|
||||
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -1,16 +1,121 @@
|
|||
import React from 'react';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import './Index.scss';
|
||||
import { Blueback , FlexAJ } from '../Component/layout';
|
||||
import { Dropdown, Input , Menu , Pagination } from 'antd';
|
||||
import { Link } from 'react-router-dom';
|
||||
import UploadSource from './UploadSource';
|
||||
|
||||
const { Search } = Input;
|
||||
const sort = [
|
||||
"按上传时间排序",
|
||||
"按下载次数排序",
|
||||
"按引用排序"
|
||||
]
|
||||
const limit = 15;
|
||||
function Index(props){
|
||||
const [ sortValue , setSortValue ] = useState(0);
|
||||
const [ page , setPage ] = useState(1);
|
||||
const [ total , setTotal ] = useState(0);
|
||||
const [ search , setSearch ] = useState(undefined);
|
||||
|
||||
const [ visible , setVisible ] = useState(false);
|
||||
|
||||
useEffect(()=>{
|
||||
|
||||
},[search,sort,page])
|
||||
|
||||
// 搜索
|
||||
function onSearch(value){
|
||||
setSearch(value);
|
||||
}
|
||||
|
||||
// 切换排序方式
|
||||
function changeSort(e,index){
|
||||
setSortValue(index);
|
||||
}
|
||||
|
||||
|
||||
const menu=(
|
||||
<Menu>
|
||||
{
|
||||
sort && sort.map((item,key)=>{
|
||||
return(
|
||||
<Menu.Item onClick={(e)=>changeSort(e,key)} value={key} className={key === sortValue ?"color-blue":""}>{item}</Menu.Item>
|
||||
)
|
||||
})
|
||||
}
|
||||
</Menu>
|
||||
)
|
||||
|
||||
const listmenu=(
|
||||
<Menu>
|
||||
<Menu.Item>更新版本</Menu.Item>
|
||||
<Menu.Item>设为私有</Menu.Item>
|
||||
<Menu.Item>删除资源</Menu.Item>
|
||||
</Menu>
|
||||
)
|
||||
|
||||
function onOk(){
|
||||
|
||||
}
|
||||
return(
|
||||
<div className="sourcePanel">
|
||||
<UploadSource visible={visible} onCancel={()=>setVisible(false)} onOk={onOk}/>
|
||||
<div className="headtitle">
|
||||
<FlexAJ>
|
||||
<span className="font-18">资源库</span>
|
||||
<Blueback>上传资源</Blueback>
|
||||
<span className="font-18">资源库(18)</span>
|
||||
<Blueback onClick={()=>setVisible(true)}>上传资源</Blueback>
|
||||
</FlexAJ>
|
||||
</div>
|
||||
<FlexAJ className="subHeadtitle">
|
||||
<Search
|
||||
placeholder="在项目内搜索资源"
|
||||
onSearch={onSearch}
|
||||
allowClear
|
||||
enterButton="搜索"
|
||||
width="220px"
|
||||
/>
|
||||
<Dropdown overlay={menu} placement="bottomRight">
|
||||
<span className="color-grey-9">{sort[sortValue]}<i className="iconfont icon-sanjiaoxing-down font-16 color-grey-9 ml3"></i></span>
|
||||
</Dropdown>
|
||||
</FlexAJ>
|
||||
<div className="bodycontent">
|
||||
<ul className="bodycontentul">
|
||||
<li>
|
||||
<Link to= {`/users/`} className="infoImg"><img src={`https://testforgeplus.trustie.net/images/avatars/User/b`} alt="" /></Link>
|
||||
<div style={{flex:'1',width:"0"}}>
|
||||
<FlexAJ>
|
||||
<a href={``} className="infoname">DaVinci.fdb</a>
|
||||
<Dropdown overlay={listmenu} placement={'bottomRight'}>
|
||||
<i className="iconfont icon-gengduo1 color-grey-6"></i>
|
||||
</Dropdown>
|
||||
</FlexAJ>
|
||||
<p className="infos">
|
||||
<span>上传时间:<span>2021-03-30</span></span>
|
||||
<span>上传类型:<span>软件版本</span></span>
|
||||
<span>文件大小:<span>10KB</span></span>
|
||||
<span>下载:<span>111</span></span>
|
||||
</p>
|
||||
<p className="infodesc task-hide-2">资源描述资源描述资源描述资源描述资源描述资源描述资源描述</p>
|
||||
<div className="infotag">
|
||||
<span>软件版本<i className="iconfont icon-guanbi font-12 ml2"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
{
|
||||
total > limit &&
|
||||
<div className="pt20 pb20 edu-txt-center">
|
||||
<Pagination
|
||||
simple
|
||||
current={page}
|
||||
pageSize={limit}
|
||||
total={total}
|
||||
onChange={(p)=>{setPage(p)}}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -8,4 +8,69 @@
|
|||
padding:15px 20px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
.subHeadtitle{
|
||||
padding:15px 20px;
|
||||
border-bottom: 1px solid #eee;
|
||||
.ant-input-group-wrapper{
|
||||
width:320px;
|
||||
.ant-btn.ant-input-search-button{
|
||||
margin: 0px;
|
||||
margin-top: -1px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.bodycontent{
|
||||
padding:0px 20px;
|
||||
& > ul.bodycontentul > li{
|
||||
display: flex;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding:20px 0px;
|
||||
align-items: flex-start;
|
||||
&:last-child{
|
||||
border-bottom: none;
|
||||
}
|
||||
.infoImg{
|
||||
img{
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
margin-right: 15px;
|
||||
}
|
||||
.infoname{
|
||||
font-size: 16px;
|
||||
}
|
||||
.infos{
|
||||
& > span{
|
||||
margin-right: 20px;
|
||||
color: #999;
|
||||
& >span{
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
}
|
||||
.infodesc{
|
||||
color: #666;
|
||||
line-height: 20px;
|
||||
margin:5px 0px!important;
|
||||
}
|
||||
.infotag{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
span{
|
||||
display: block;
|
||||
padding:0px 4px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
font-size: 12px;
|
||||
margin-right: 10px;
|
||||
border: 1px solid #f8df8c;
|
||||
background: #fffce6;
|
||||
color: #0d90c3;
|
||||
border-radius: 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
import React from 'react';
|
||||
import { Modal } from 'antd';
|
||||
|
||||
|
||||
function UploadSource({ visible , onCancel , onOk }){
|
||||
return(
|
||||
<Modal
|
||||
title={"上传资源"}
|
||||
closable={false}
|
||||
visible={visible}
|
||||
onCancel={onCancel}
|
||||
onOk={onOk}
|
||||
cancelText="取消"
|
||||
okText="确定"
|
||||
width="600px"
|
||||
centered
|
||||
>
|
||||
<div></div>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
export default UploadSource;
|
|
@ -1,13 +1,7 @@
|
|||
import React, { Component } from 'react';
|
||||
import { Redirect } from 'react-router';
|
||||
|
||||
import Dialog, {
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
DialogContentText,
|
||||
DialogTitle,
|
||||
} from 'material-ui/Dialog';
|
||||
import { notification, Modal } from 'antd';
|
||||
import Dialog from 'material-ui/Dialog';
|
||||
import { notification } from 'antd';
|
||||
|
||||
import axios from 'axios';
|
||||
|
||||
|
@ -329,6 +323,7 @@ class LoginDialog extends Component {
|
|||
return flag;
|
||||
}
|
||||
componentDidMount() {
|
||||
|
||||
let flag = this.IsPC(); //true为PC端,false为手机端
|
||||
this.setState({
|
||||
isphone: flag
|
||||
|
@ -478,6 +473,7 @@ class LoginDialog extends Component {
|
|||
let { qqlogin, login, isGoing, isGoingValue, disabled, bottonclass, Phonenumberisnotco,
|
||||
dialogBox, isRender, weixinlogin } = this.state;
|
||||
|
||||
let { settings } = this.props;
|
||||
if (isRender === undefined) {
|
||||
isRender = false
|
||||
}
|
||||
|
@ -580,9 +576,9 @@ class LoginDialog extends Component {
|
|||
<label htmlFor="p_autolog" style={{ top: '0px' }}>下次自动登录</label>
|
||||
</span>
|
||||
<span className="fr">
|
||||
<a onClick={(url) => this.getloginurl("https://www.trustie.net/account/lost_password")}
|
||||
className="mr3 color-grey-9">找回密码</a><em className="vertical-line"></em>
|
||||
<a onClick={(url) => this.getloginurl("https://www.trustie.net/login?login=false")} className="color-grey-9">注册</a>
|
||||
<a onClick={(url) => this.getloginurl(`${settings && settings.common && settings.common.lost_password}`)} className="mr3 color-grey-9">找回密码</a>
|
||||
<em className="vertical-line"></em>
|
||||
<a onClick={(url) => this.getloginurl(`${settings && settings.common && settings.common.register}`)} className="color-grey-9">注册</a>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import React, { Component } from 'react';
|
||||
import { Link } from "react-router-dom";
|
||||
import AccountProfile from "../user/AccountProfile";
|
||||
import { getImageUrl } from 'educoder'
|
||||
import axios from 'axios';
|
||||
|
@ -6,10 +7,10 @@ import { Modal, Input, message, notification } from 'antd';
|
|||
|
||||
import LoginDialog from '../login/LoginDialog';
|
||||
import GotoQQgroup from '../../modal/GotoQQgroup'
|
||||
// import 'antd/lib/modal/style/index.css';
|
||||
// import 'antd/lib/checkbox/style/index.css';
|
||||
// import 'antd/lib/radio/style/index.css';
|
||||
// import 'antd/lib/input/style/index.css';
|
||||
import 'antd/lib/modal/style/index.css';
|
||||
import 'antd/lib/checkbox/style/index.css';
|
||||
import 'antd/lib/radio/style/index.css';
|
||||
import 'antd/lib/input/style/index.css';
|
||||
import './TPMIndex.css';
|
||||
import logo from './images/logo.png';
|
||||
|
||||
|
@ -49,7 +50,6 @@ class NewHeader extends Component {
|
|||
settings: null,
|
||||
goshowqqgtounp: false,
|
||||
visiblemyss: false,
|
||||
openSearch:false
|
||||
}
|
||||
}
|
||||
componentDidMount() {
|
||||
|
@ -84,36 +84,6 @@ class NewHeader extends Component {
|
|||
} catch (e) {}
|
||||
}
|
||||
|
||||
SearchInput = (open,url)=>{
|
||||
if(open){
|
||||
return(
|
||||
<div
|
||||
onBlur={() => {
|
||||
setTimeout(() => {
|
||||
this.setState({
|
||||
openSearch:false
|
||||
})
|
||||
}, 300)
|
||||
}}
|
||||
>
|
||||
<Search placeholder="实践课程/教学课堂/实践项目/交流问答"
|
||||
className={`search-input mr20`}
|
||||
onSearch={(value)=>this.onGlobalSearch(value,url)}
|
||||
autoFocus={true}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}else{
|
||||
return <i className="iconfont icon-sousuo font-18 color-white ml30" onClick={() => {
|
||||
this.setState({openSearch:true})
|
||||
}} />
|
||||
}
|
||||
}
|
||||
|
||||
onGlobalSearch=(value,url)=>{
|
||||
this.props.history.push(`${url}/search?value=` + value);
|
||||
}
|
||||
|
||||
openNotification = (messge) => {
|
||||
notification.open({
|
||||
message: "提示",
|
||||
|
@ -122,8 +92,6 @@ class NewHeader extends Component {
|
|||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
componentWillReceiveProps(newProps, oldProps) {
|
||||
this.setState({
|
||||
user: newProps.user
|
||||
|
@ -131,6 +99,7 @@ class NewHeader extends Component {
|
|||
if (newProps.Headertop !== undefined) {
|
||||
old_url = newProps.Headertop.old_url
|
||||
}
|
||||
|
||||
}
|
||||
getCookie = (key) => {
|
||||
var arr, reg = RegExp('(^| )' + key + '=([^;]+)(;|$)');
|
||||
|
@ -638,7 +607,6 @@ class NewHeader extends Component {
|
|||
headtypess,
|
||||
settings,
|
||||
goshowqqgtounp,
|
||||
openSearch
|
||||
} = this.state;
|
||||
/*用户名称 用户头像url*/
|
||||
let activeIndex = false;
|
||||
|
@ -782,10 +750,9 @@ class NewHeader extends Component {
|
|||
}
|
||||
</div>
|
||||
<div className="head-right">
|
||||
{settings && settings.search_url ? this.SearchInput(openSearch,settings.search_url):""}
|
||||
{this.props.user && this.props.user.login &&
|
||||
<div className="edu-menu-panel ml30">
|
||||
<i className="iconfont icon-tianjiafangda color-white"></i>
|
||||
<div className="edu-menu-panel">
|
||||
<i className="iconfont icon-tianjiafangda color-grey-6"></i>
|
||||
<div className="edu-menu-list" style={{ top: '48px' }}>
|
||||
<div className="overPart"></div>
|
||||
{
|
||||
|
@ -803,16 +770,16 @@ class NewHeader extends Component {
|
|||
</div>
|
||||
</div>
|
||||
}
|
||||
{this.props.user && this.props.user.login && ( settings && settings.notice_url) ?
|
||||
{this.props.user && this.props.user.login &&
|
||||
<div className="ml30 edu-menu-panel">
|
||||
{user && user.login &&
|
||||
<a href={`${settings && settings.notice_url}`} style={{ position: 'relative' }}>
|
||||
<i className="iconfont icon-xiaoxilingdang color-white"></i>
|
||||
<a href={`${settings && settings.new_course && settings.new_course.tiding_url}`} style={{ position: 'relative' }} target="_blank">
|
||||
<i className="iconfont icon-xiaoxilingdang color-grey-6"></i>
|
||||
<span className="newslight" style={{ display: this.props.Headertop === undefined ? "none" : this.props.Headertop.new_message === true ? "block" : "none" }}>
|
||||
</span>
|
||||
</a>
|
||||
}
|
||||
</div>:""
|
||||
</div>
|
||||
}
|
||||
<Modal
|
||||
keyboard={false}
|
||||
|
@ -843,18 +810,18 @@ class NewHeader extends Component {
|
|||
</div>
|
||||
{user === undefined ?
|
||||
<span className="font-15">
|
||||
<a onClick={() => this.educoderlogin()} className="mr5 color-white">登录</a>
|
||||
<a onClick={() => this.educoderlogin()} className="mr5 color-grey-6">登录</a>
|
||||
{
|
||||
settings && settings.new_course && settings.new_course.register_url &&
|
||||
<span><em className="vertical-line"></em><a className="ml5 color-white" href={`${settings.new_course.register_url}`} target="_blank">注册</a></span>
|
||||
settings && settings.common && settings.common.register &&
|
||||
<span><em className="vertical-line"></em><a className="ml5 color-grey-6 3333" href={`${settings.common.register}`} target="_blank">注册</a></span>
|
||||
}
|
||||
</span>
|
||||
: user.login === "" ?
|
||||
<span className="font-15">
|
||||
<a onClick={() => this.educoderlogin()} className="mr5 color-white">登录</a>
|
||||
<a onClick={() => this.educoderlogin()} className="mr5 color-grey-6">登录</a>
|
||||
{
|
||||
settings && settings.new_course && settings.new_course.register_url &&
|
||||
<span><em className="vertical-line"></em><a className="color-white ml5" href={`${settings.new_course.register_url}`} target="_blank">注册</a></span>
|
||||
settings && settings.common && settings.common.register &&
|
||||
<span><em className="vertical-line"></em><a className="color-grey-6 ml5 111" href={`${settings.common.register}`} target="_blank">注册</a></span>
|
||||
}
|
||||
</span>
|
||||
:
|
||||
|
|
Loading…
Reference in New Issue