forked from Gitlink/forgeplus-react
Merge pull request '更新' (#484) from durian/forgeplus-react:gitlink_server into gitlink_server
This commit is contained in:
commit
004829eee3
10
src/App.js
10
src/App.js
|
@ -290,7 +290,7 @@ class App extends Component {
|
|||
};
|
||||
|
||||
render() {
|
||||
const { pathType, pathName } = this.state;
|
||||
const { pathType, pathName, mygetHelmetapi } = this.state;
|
||||
return (
|
||||
<Provider store={store}>
|
||||
<ConfigProvider locale={zhCN}>
|
||||
|
@ -348,7 +348,7 @@ class App extends Component {
|
|||
<Route path="/nopage" component={Shixunnopage} />
|
||||
|
||||
{/* 查询 */}
|
||||
<Route path="/search" component={Search} />
|
||||
<Route path="/search" component={Search} mygetHelmetapi={mygetHelmetapi}/>
|
||||
|
||||
<Route exact path="/explore/all"
|
||||
render={
|
||||
|
@ -368,19 +368,19 @@ class App extends Component {
|
|||
{/* 登录 */}
|
||||
<Route
|
||||
path="/login"
|
||||
render={(props) =><LoginRegisterPage {...this.props} {...props}/>}
|
||||
render={(props) =><LoginRegisterPage {...this.props} {...props} mygetHelmetapi={mygetHelmetapi}/>}
|
||||
></Route>
|
||||
|
||||
{/* 注册 */}
|
||||
<Route
|
||||
path="/register"
|
||||
render={(props) =><LoginRegisterPage {...this.props} {...props}/>}
|
||||
render={(props) =><LoginRegisterPage {...this.props} {...props} mygetHelmetapi={mygetHelmetapi}/>}
|
||||
></Route>
|
||||
|
||||
{/* 忘记密码 */}
|
||||
<Route
|
||||
path="/resetPassword"
|
||||
render={(props) =><LoginRegisterPage {...this.props} {...props}/>}
|
||||
render={(props) =><LoginRegisterPage {...this.props} {...props} mygetHelmetapi={mygetHelmetapi}/>}
|
||||
></Route>
|
||||
|
||||
{/* 关于我们 */}
|
||||
|
|
|
@ -184,7 +184,7 @@ export default Form.create()(({ form, history, showNotification, projectDetail,
|
|||
return (
|
||||
<div className="wiki-main">
|
||||
<div className="wiki-head">
|
||||
<span className="head-title"><span className="back-wiki" onClick={goBack}>Wiki</span> <Icon type="right" /> 编辑页面</span>
|
||||
<span className="head-title"><span className="back-wiki" onClick={goBack}>Wiki</span> <Icon type="right" /> {wikiName ? '编辑' : '新增'}页面</span>
|
||||
</div>
|
||||
|
||||
<div >
|
||||
|
|
|
@ -83,8 +83,15 @@ class Infos extends Component {
|
|||
if(pathname === `/${username}`){
|
||||
this.setState({route_type:undefined});
|
||||
if(load){
|
||||
// 切换不同tab以及第一次渲染
|
||||
this.setState({
|
||||
menuKey:load.show_super_description ? "6" :"0"
|
||||
menuKey: load.show_super_description ? "6" : typeof(load) === 'object' ? '0' : load
|
||||
})
|
||||
}else{
|
||||
// 从我关注的/关注我的返回
|
||||
const {user} = this.state;
|
||||
user && this.setState({
|
||||
menuKey: user.show_super_description ? "6" : "0"
|
||||
})
|
||||
}
|
||||
}else if(pathname === `/${username}/statistics`){
|
||||
|
@ -119,7 +126,8 @@ class Infos extends Component {
|
|||
const { pathname } = this.props.location;
|
||||
const prevPath = prevProps.location.pathname;
|
||||
if(prevPath && pathname && prevPath !== pathname){
|
||||
this.renderPath(pathname);
|
||||
const {menuKey} = this.state;
|
||||
this.renderPath(pathname, menuKey);
|
||||
}
|
||||
this.props.history.listen(()=>{
|
||||
if (document.body.scrollTop || document.documentElement.scrollTop > 0) {
|
||||
|
|
|
@ -1,6 +1,23 @@
|
|||
import React, { Component } from "react";
|
||||
import CommonLists from "./common_lists"
|
||||
class FanUsers extends Component {
|
||||
componentDidMount=()=>{
|
||||
this.updateDocumentTitle();
|
||||
}
|
||||
|
||||
componentDidUpdate(){
|
||||
this.updateDocumentTitle();
|
||||
}
|
||||
|
||||
// 更新网页标题
|
||||
updateDocumentTitle(){
|
||||
const {user, current_user} = this.props;
|
||||
if(user && current_user){
|
||||
const {username, login} = user;
|
||||
const title_type =login === current_user.login ? "我" : "TA";
|
||||
document.title = `关注${title_type}的-${username}`
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const {user, current_user , match, fetchUser} = this.props
|
||||
|
|
|
@ -1,8 +1,26 @@
|
|||
import React, { Component } from "react";
|
||||
import CommonLists from "./common_lists"
|
||||
class WatcherUsers extends Component {
|
||||
componentDidMount=()=>{
|
||||
this.updateDocumentTitle();
|
||||
}
|
||||
|
||||
componentDidUpdate(){
|
||||
this.updateDocumentTitle();
|
||||
}
|
||||
|
||||
// 更新网页标题
|
||||
updateDocumentTitle(){
|
||||
const {user, current_user} = this.props;
|
||||
if(user && current_user){
|
||||
const {username, login} = user;
|
||||
const title_type =login === current_user.login ? "我" : "TA";
|
||||
document.title = `${title_type}的关注-${username}`
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const {user, current_user , match, fetchUser } = this.props;
|
||||
const {user, current_user , match, fetchUser} = this.props;
|
||||
return (
|
||||
user && user.login &&
|
||||
<CommonLists
|
||||
|
|
|
@ -13,7 +13,7 @@ import './LoginRegisterPage.scss';
|
|||
function Login(props){
|
||||
const [message,setMessage] = useState();
|
||||
const [setting, setSetting] = useState(undefined);
|
||||
const {form, location} = props;
|
||||
const {form, location, mygetHelmetapi} = props;
|
||||
const {getFieldDecorator } = form;
|
||||
const {search} = location;
|
||||
|
||||
|
@ -24,6 +24,14 @@ function Login(props){
|
|||
setSetting(JSON.parse(localStorage.getItem("chromesetting")));
|
||||
},[])
|
||||
|
||||
// 配置网页标题
|
||||
useEffect(()=>{
|
||||
if(mygetHelmetapi){
|
||||
const {name} = mygetHelmetapi;
|
||||
document.title = name;
|
||||
}
|
||||
}, [mygetHelmetapi])
|
||||
|
||||
// 登录表单提交
|
||||
function handleSubmit(){
|
||||
setMessage(undefined);
|
||||
|
|
|
@ -10,6 +10,7 @@ import img2 from './img/img2.png';
|
|||
import '../loginRegister/LoginRegisterPage.scss';
|
||||
|
||||
function LoginRegisterPage(props){
|
||||
const {mygetHelmetapi} = props;
|
||||
return(
|
||||
<div className="loginRegister">
|
||||
<div className="login_register_left">
|
||||
|
@ -18,7 +19,7 @@ function LoginRegisterPage(props){
|
|||
<img src={banner} className="banner"></img>
|
||||
</div>
|
||||
<div className="login_register_right">
|
||||
{props.location.pathname === "/login" ? <Login {...props}/> : props.location.pathname === "/register" ? <Register/> : <ResetPassword/>}
|
||||
{props.location.pathname === "/login" ? <Login {...props}/> : props.location.pathname === "/register" ? <Register mygetHelmetapi={mygetHelmetapi}/> : <ResetPassword mygetHelmetapi={mygetHelmetapi}/>}
|
||||
<img src={img1} className="img1"></img>
|
||||
<img src={img2} className="img2"></img>
|
||||
</div>
|
||||
|
|
|
@ -6,7 +6,7 @@ import { setmiyah } from 'educoder';
|
|||
import './LoginRegisterPage.scss';
|
||||
|
||||
function Register(props){
|
||||
const {form} = props;
|
||||
const {form, mygetHelmetapi} = props;
|
||||
const {getFieldDecorator, setFieldsValue } = form;
|
||||
//用户输入的符合规则的邮箱(用于获取验证码)
|
||||
const [emailStr, setEmailStr] = useState(undefined);
|
||||
|
@ -27,6 +27,14 @@ function Register(props){
|
|||
//页面加载完自动聚焦到第一个输入框
|
||||
// const inputEl = useRef(null);
|
||||
|
||||
// 配置网页标题
|
||||
useEffect(()=>{
|
||||
if(mygetHelmetapi){
|
||||
const {name} = mygetHelmetapi;
|
||||
document.title = name;
|
||||
}
|
||||
}, [mygetHelmetapi])
|
||||
|
||||
//注册表单提交
|
||||
function handleSubmit(){
|
||||
form.validateFields((err, values) => {
|
||||
|
|
|
@ -6,7 +6,7 @@ import { setmiyah } from 'educoder';
|
|||
import './LoginRegisterPage.scss';
|
||||
|
||||
function ResetPassword(props) {
|
||||
const {form } = props;
|
||||
const {form, mygetHelmetapi } = props;
|
||||
const {getFieldDecorator } = form;
|
||||
const [emailStr, setEmailStr] = useState(undefined);
|
||||
const [secondsStr, setSecondsStr] = useState(60);
|
||||
|
@ -21,6 +21,14 @@ function ResetPassword(props) {
|
|||
//页面加载完自动聚焦到第一个输入框
|
||||
const inputEl = useRef(null);
|
||||
|
||||
// 配置网页标题
|
||||
useEffect(()=>{
|
||||
if(mygetHelmetapi){
|
||||
const {name} = mygetHelmetapi;
|
||||
document.title = name;
|
||||
}
|
||||
}, [mygetHelmetapi])
|
||||
|
||||
//重置密码表单提交
|
||||
function handleSubmit() {
|
||||
form.validateFieldsAndScroll((err, values) => {
|
||||
|
|
|
@ -10,7 +10,7 @@ import './index.scss';
|
|||
const { Search } = Input;
|
||||
const { TabPane } = Tabs;
|
||||
|
||||
const GlobalSearch = ({ location, showNotification, history }) => {
|
||||
const GlobalSearch = ({ location, showNotification, history, mygetHelmetapi }) => {
|
||||
|
||||
const size = 10;
|
||||
let defaultValue = decodeURI(location.search.split("=")[1] || "");
|
||||
|
@ -34,6 +34,13 @@ const GlobalSearch = ({ location, showNotification, history }) => {
|
|||
const [ref, setRef] = useState(undefined);
|
||||
const [focus, setFocus] = useState(0);
|
||||
|
||||
// 配置网页标题
|
||||
useEffect(()=>{
|
||||
if(mygetHelmetapi){
|
||||
const {name} = mygetHelmetapi;
|
||||
document.title = name;
|
||||
}
|
||||
}, [mygetHelmetapi])
|
||||
|
||||
useEffect(() => {
|
||||
searchDataList();
|
||||
|
|
Loading…
Reference in New Issue