网页标题修改-个人主页/组织/项目点赞关注fork列表

This commit is contained in:
谢思 2022-12-07 18:32:52 +08:00
parent 311c3d072c
commit ec47699ef8
17 changed files with 164 additions and 6 deletions

View File

@ -27,6 +27,14 @@ function Index(props){
const [ flag , setFlag ] = useState(true);
const { current_user } = props;
useEffect(()=>{
if(user){
//
const {username, login} = user;
document.title = `${menu === "undo" ? '接收仓库' : '成员申请'}-${username}/${login}`;
}
},[user, menu])
useEffect(()=>{
if((username && current_user && (current_user.login !== username))){
props.history.push(`/${username}`);

View File

@ -25,7 +25,7 @@ export default ((props) => {
const [ members , setMembers ] = useState(undefined);
const [ group , setGroup ] = useState(undefined);
const { OIdentifier, groupId } = props.match.params;
const { current_user } = props;
const { current_user, organizeDetail } = props;
useEffect(()=>{
if(groupId){
@ -42,6 +42,13 @@ export default ((props) => {
}).catch(error=>{})
}
useEffect(()=>{
if(group && organizeDetail){
const {nickname} = organizeDetail;
document.title = `${group.nickname}-${nickname}`
}
}, [organizeDetail, group])
useEffect(()=>{
if(nav === "0"){
getMember(OIdentifier, groupId,page);

View File

@ -1,7 +1,19 @@
import React from 'react';
import React, { useEffect } from 'react';
import GroupFrom from './GroupForm'
import axios from 'axios';
function GropNew(props){
const OIdentifier = props.match.params.OIdentifier;
//
useEffect(()=>{
OIdentifier && axios.get(`/organizations/${OIdentifier}.json`).then(result=>{
if(result && result.data){
const {nickname} = result.data;
document.title = `新建团队-${nickname}`
}
}).catch(error=>{})
},[OIdentifier])
return(
<div className="teamDetail">
<GroupFrom {...props}></GroupFrom>

View File

@ -23,6 +23,14 @@ function List(props){
const OIdentifier = props.match.params.OIdentifier;
const organizeDetail = props.organizeDetail;
useEffect(()=>{
if(organizeDetail){
//
const {nickname} = organizeDetail;
document.title = `${nickname}`
}
},[organizeDetail])
useEffect(()=>{
if(OIdentifier){
setIsSpin(true);

View File

@ -27,6 +27,14 @@ const Hooks = Loadable({
export default (( props )=>{
const pathname = props.location.pathname;
const OIdentifier = props.match.params.OIdentifier;
const {organizeDetail} = props;
useEffect(()=>{
if(organizeDetail){
const {nickname} = organizeDetail;
document.title = `组织设置-${nickname}`
}
}, [organizeDetail])
function returnActive (pathname){
let a = 0;

View File

@ -114,7 +114,7 @@ function Detail(props){
<Route
path="/:OIdentifier/teams/:groupId"
render={(p) => {
return <GroupDetails {...props} {...p} group={detail}/>
return <GroupDetails {...props} {...p} organizeDetail={detail}/>
}}
></Route>
{/* 组织成员 */}

View File

@ -44,6 +44,13 @@ export default ((props)=>{
}
}).catch(error=>{})
}
useEffect(()=>{
if(detail){
const {nickname, organization} = detail;
document.title = `团队设置-${nickname}-${organization.nickname}`
}
}, [detail])
return(
<div className="teamDetail" style={{paddingTop:"0px"}}>
<div>

View File

@ -1,9 +1,18 @@
import React from 'react';
import React, {useEffect} from 'react';
import { Banner } from '../Component/layout';
import GroupItems from './TeamGroupItems';
const limit = 14;
function TeamGroup({organizeDetail,history,current_user}){
useEffect(()=>{
if(organizeDetail){
//
const {nickname} = organizeDetail;
document.title = `组织团队-${nickname}`
}
},[organizeDetail])
return(
<div style={{background:"#fff",marginBottom:"30px",border:'1px solid #eee'}}>
<Banner>组织团队</Banner>

View File

@ -20,6 +20,14 @@ function TeamMember({organizeDetail,current_user,history,match}){
}
},[organizeDetail,page]);
useEffect(()=>{
if(organizeDetail){
//
const {nickname} = organizeDetail;
document.title = `组织成员-${nickname}`
}
},[organizeDetail])
function getData(){
setIsSpin(true);
const url = `/organizations/${organizeDetail.id}/organization_users.json`;

View File

@ -19,8 +19,21 @@ class ForkUsers extends Component {
componentDidMount = () => {
this.getUsersList();
this.updateTitle();
};
componentDidUpdate=()=>{
this.updateTitle();
}
updateTitle=()=>{
const {projectDetail} = this.props;
if(projectDetail){
const {author, name} = projectDetail;
document.title = `Fork用户-${author.name}/${name}`
}
}
getUsersList = (page, limit) => {
this.setState({
isSpin: true,

View File

@ -1,7 +1,21 @@
import React, { Component } from "react";
import CommonUsers from "./common_users"
class PraiseUsers extends Component {
componentDidMount=()=>{
this.updateTitle();
}
componentDidUpdate=()=>{
this.updateTitle();
}
updateTitle=()=>{
const {projectDetail} = this.props;
if(projectDetail){
const {author, name} = projectDetail;
document.title = `点赞用户-${author.name}/${name}`
}
}
render() {
const { owner , projectsId } = this.props.match.params;
return (

View File

@ -1,6 +1,21 @@
import React, { Component } from "react";
import CommonUsers from "./common_users"
class WatchUsers extends Component {
componentDidMount=()=>{
this.updateTitle();
}
componentDidUpdate=()=>{
this.updateTitle();
}
updateTitle=()=>{
const {projectDetail} = this.props;
if(projectDetail){
const {author, name} = projectDetail;
document.title = `关注用户-${author.name}/${name}`
}
}
render() {
const { owner , projectsId } = this.props.match.params;
return (

View File

@ -32,7 +32,18 @@ function Index(props) {
const username = props.match.params.username;
const current_user = props.current_user;
const user = props.user;
const {menuKey, user} = props;
useEffect(()=>{
if(user){
const {username, login} = user;
if(menuKey === '0'){
document.title = `${username}(${login})`
}else{
document.title = `个人简介-${username}/${login}`
}
}
},[menuKey])
useEffect(()=>{
if(user){
@ -97,7 +108,7 @@ function Index(props) {
}).catch(error=>{})
}
return(
props && props.menuKey === "0" ?
menuKey && menuKey === "0" ?
<div>
<div>
<ConcentrateProject

View File

@ -25,10 +25,12 @@ class InfosUser extends Component {
}
componentDidMount = () => {
this.updateTitle();
this.get_projects();
};
componentDidUpdate = (prevProps) => {
this.updateTitle();
const { username } = this.props.match.params;
const prevUser = prevProps.match.params.username;
if (prevProps.project_type !== this.props.project_type || (prevUser && username && prevUser !== username)) {
@ -36,6 +38,15 @@ class InfosUser extends Component {
}
};
// 更改网页标题
updateTitle=()=>{
const {user} = this.props;
if(user){
const {username, login} = user;
document.title = `参与项目-${username}/${login}`
}
}
get_projects = (isPublic) => {
const { username } = this.props.match.params;
const { project_type } = this.props;

View File

@ -30,11 +30,19 @@ function Index(props) {
const [ cData, setCData ] = useState(undefined);
const [ cloudData, setCloudData ] = useState(undefined);
const {user} = props;
const disabledDate = current => {
return current && current > moment().endOf('day');
};
useEffect(()=>{
if(user){
const {username, login} = user;
document.title = `数据统计-${username}/${login}`
}
}, [])
//
useEffect(()=>{
getRoleSta();

View File

@ -17,6 +17,16 @@ function Team(props){
const [ search ,setSearch ] = useState(undefined);
const { checkIfLogin , showLoginDialog , current_user } = props;
const { username } = props.match.params;
const {user} = props;
useEffect(()=>{
if(user){
//
const {username, login} = user;
document.title = `参与组织-${username}/${login}`;
}
},[user])
useEffect(()=>{
if(username){
getList(search);

View File

@ -7,6 +7,15 @@ import CIList from './CIList';
function DevOpsCI(props){
const [ selectKey , setSelectKey ] = useState("dispose");
const {user} = props;
useEffect(()=>{
if(user){
//
const {username, login} = user;
document.title = `DevOps引擎-${username}/${login}`;
}
},[user])
function changeKeys(e){
setSelectKey(e.key);