From 74deb640a9144e9b50c162670eb7b4a308515d3c Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Wed, 31 Mar 2021 11:15:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Head/Header.js | 17 +++-- src/forge/Main/CoderRootCommit.js | 17 +++-- src/forge/Source/Index.jsx | 111 +++++++++++++++++++++++++++++- src/forge/Source/Index.scss | 65 +++++++++++++++++ src/forge/Source/UploadSource.jsx | 22 ++++++ src/modules/login/LoginDialog.js | 18 ++--- src/modules/tpm/NewHeader.js | 69 +++++-------------- 7 files changed, 241 insertions(+), 78 deletions(-) create mode 100644 src/forge/Source/UploadSource.jsx diff --git a/src/forge/Head/Header.js b/src/forge/Head/Header.js index c01cd625b..64ad93fc8 100644 --- a/src/forge/Head/Header.js +++ b/src/forge/Head/Header.js @@ -104,7 +104,7 @@ class NewHeader extends Component { ) }else{ - return { + return { 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 (
@@ -651,7 +650,7 @@ class NewHeader extends Component { { current_user && (current_user.main_site || current_user.login) && (settings && settings.add && settings.add.length>0)? - + :"" } @@ -659,7 +658,7 @@ class NewHeader extends Component {
{user && user.login && - + @@ -695,10 +694,10 @@ class NewHeader extends Component {
{!user || (user && !user.login) ? - this.educoderlogin()} className="mr5 color-white">登录 + this.educoderlogin()} className="mr5 color-grey-6">登录 { - settings && settings.new_course && settings.new_course.register_url && - 注册 + settings && settings.common && settings.common.register && + 注册 } : diff --git a/src/forge/Main/CoderRootCommit.js b/src/forge/Main/CoderRootCommit.js index f87a85398..bb4f5ba52 100644 --- a/src/forge/Main/CoderRootCommit.js +++ b/src/forge/Main/CoderRootCommit.js @@ -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{ {item.message}

- - {item.image_url?:""} - - + { + item.id ? + + {item.image_url?:""} + + : + + {item.image_url?:""} + + + } +

) diff --git a/src/forge/Source/Index.jsx b/src/forge/Source/Index.jsx index 475bda0c5..3ba406782 100644 --- a/src/forge/Source/Index.jsx +++ b/src/forge/Source/Index.jsx @@ -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=( + + { + sort && sort.map((item,key)=>{ + return( + changeSort(e,key)} value={key} className={key === sortValue ?"color-blue":""}>{item} + ) + }) + } + + ) + + const listmenu=( + + 更新版本 + 设为私有 + 删除资源 + + ) + + function onOk(){ + + } return(
+ setVisible(false)} onOk={onOk}/>
- 资源库 - 上传资源 + 资源库(18) + setVisible(true)}>上传资源
+ + + + {sort[sortValue]} + + +
+
    +
  • + +
    + + DaVinci.fdb + + + + +

    + 上传时间:2021-03-30 + 上传类型:软件版本 + 文件大小:10KB + 下载:111 +

    +

    资源描述资源描述资源描述资源描述资源描述资源描述资源描述

    +
    + 软件版本 +
    +
    +
  • +
+ { + total > limit && +
+ {setPage(p)}} + /> +
+ } +
) } diff --git a/src/forge/Source/Index.scss b/src/forge/Source/Index.scss index 4338c5a9f..20f55c27a 100644 --- a/src/forge/Source/Index.scss +++ b/src/forge/Source/Index.scss @@ -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; + } + } + } + } } \ No newline at end of file diff --git a/src/forge/Source/UploadSource.jsx b/src/forge/Source/UploadSource.jsx new file mode 100644 index 000000000..a8ccfdc3a --- /dev/null +++ b/src/forge/Source/UploadSource.jsx @@ -0,0 +1,22 @@ +import React from 'react'; +import { Modal } from 'antd'; + + +function UploadSource({ visible , onCancel , onOk }){ + return( + +
+
+ ) +} +export default UploadSource; \ No newline at end of file diff --git a/src/modules/login/LoginDialog.js b/src/modules/login/LoginDialog.js index 441975249..aebfba8c7 100644 --- a/src/modules/login/LoginDialog.js +++ b/src/modules/login/LoginDialog.js @@ -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 { - this.getloginurl("https://www.trustie.net/account/lost_password")} - className="mr3 color-grey-9">找回密码 - this.getloginurl("https://www.trustie.net/login?login=false")} className="color-grey-9">注册 + this.getloginurl(`${settings && settings.common && settings.common.lost_password}`)} className="mr3 color-grey-9">找回密码 + + this.getloginurl(`${settings && settings.common && settings.common.register}`)} className="color-grey-9">注册

diff --git a/src/modules/tpm/NewHeader.js b/src/modules/tpm/NewHeader.js index 69398fbb1..6d5b9697a 100644 --- a/src/modules/tpm/NewHeader.js +++ b/src/modules/tpm/NewHeader.js @@ -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( -
{ - setTimeout(() => { - this.setState({ - openSearch:false - }) - }, 300) - }} - > - this.onGlobalSearch(value,url)} - autoFocus={true} - /> -
- ) - }else{ - return { - 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 { }
- {settings && settings.search_url ? this.SearchInput(openSearch,settings.search_url):""} {this.props.user && this.props.user.login && -
- +
+
{ @@ -803,16 +770,16 @@ class NewHeader extends Component {
} - {this.props.user && this.props.user.login && ( settings && settings.notice_url) ? + {this.props.user && this.props.user.login &&
{user && user.login && - - + + } -
:"" +
} {user === undefined ? - this.educoderlogin()} className="mr5 color-white">登录 + this.educoderlogin()} className="mr5 color-grey-6">登录 { - settings && settings.new_course && settings.new_course.register_url && - 注册 + settings && settings.common && settings.common.register && + 注册 } : user.login === "" ? - this.educoderlogin()} className="mr5 color-white">登录 + this.educoderlogin()} className="mr5 color-grey-6">登录 { - settings && settings.new_course && settings.new_course.register_url && - 注册 + settings && settings.common && settings.common.register && + 注册 } :