This commit is contained in:
caishi 2023-08-15 10:40:07 +08:00
parent bd929069d8
commit 8421a8526f
20 changed files with 87 additions and 45 deletions

View File

@ -203,7 +203,7 @@ class App extends Component {
};
componentDidMount() {
document.title = "loading...";
document.title = "项目托管";
this.getAppdata();
@ -229,7 +229,7 @@ class App extends Component {
this.setState({
mygetHelmetapi: undefined
});
document.title = "Forge";
// document.title = "Forge";
var link = document.createElement('link'),
oldLink = document.getElementById('dynamic-favicon');
link.id = 'dynamic-favicon';
@ -243,7 +243,7 @@ class App extends Component {
//获取数据的时候
gettablogourldata = (response) => {
document.title = response.data.setting.name;
// document.title = response.data.setting.name;
var link = document.createElement('link'),
oldLink = document.getElementById('dynamic-favicon');
link.id = 'dynamic-favicon';

View File

@ -32,7 +32,7 @@ export function initAxiosInterceptors(props) {
// 判断网络是否连接
initOnlineOfflineListener();
var proxy = "https://code.educoder.net";
var proxy = "https://testforgeplus.educoder.net";
//响应前的设置
axios.interceptors.request.use(
config => {

View File

@ -457,7 +457,7 @@ class TPIContextProvider extends Component {
testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0),
})
window.document.title = resData.shixun.name
// window.document.title = resData.shixun.name
window.__myshixun = resData.myshixun; // tpi_html_show需要用到
}

View File

@ -19,13 +19,17 @@ function Index(props){
const { isManager , isDeveloper , current_user } = props;
const {projectDetail} = props;
useEffect(()=>{
if(projectDetail){
const { author, name} = projectDetail;
document.title = `主页-${author.name}/${name}`;
}
},[projectDetail])
useEffect(()=>{
if(owner && projectsId){
const {projectDetail} = props;
if(projectDetail){
const { author, name} = projectDetail;
document.title = `主页-${author.name}/${name}`;
}
Init();
}
},[owner,projectsId])

View File

@ -53,11 +53,6 @@ class Activity extends Component{
}
}
componentDidMount=()=>{
const {projectDetail} = this.props;
if(projectDetail){
const { author, name} = projectDetail;
document.title = `动态-${author.name}/${name}`;
}
const { time,type,status,page } = this.state;
this.setState({
isSpin:true
@ -65,6 +60,19 @@ class Activity extends Component{
this.getInfo(time,type,status,page);
}
componentDidUpdate(){
this.updateDocumentTitle();
}
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
if(projectDetail){
const { author, name} = projectDetail;
document.title = `动态-${author.name}/${name}`;
}
}
getInfo =(time,type,status,page)=>{
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/activity.json`;

View File

@ -27,17 +27,12 @@ function Dispose(props){
const current_user = props.current_user;
let projectsId = props.match.params.projectsId;
let owner = props.match.params.owner;
useEffect(()=>{
const {projectDetail} = props;
if(projectDetail){
const { author, name} = projectDetail;
document.title = `引擎-${author.name}/${name}`;
}
},[])
//
useEffect(()=>{
if(projectDetail){
setPermission(props.projectDetail.permission);
const { author, name} = projectDetail;
document.title = `引擎-${author.name}/${name}`;
}
},[projectDetail])

View File

@ -33,13 +33,13 @@ const Params = Loadable({
export default ((props)=>{
const {projectDetail} = props;
useEffect(()=>{
const {projectDetail} = props;
if(projectDetail){
const { author, name} = projectDetail;
document.title = `引擎-${author.name}/${name}`;
}
},[])
},[projectDetail])
return(
<WhiteBack className="opsPanel">

View File

@ -72,7 +72,7 @@ function CoderDepot(props){
const { author, name} = projectDetail;
document.title = `${author.name}/${name}`;
}
},[])
},[projectDetail])
useEffect(()=>{
if(bannerList && bannerList.length>0){

View File

@ -369,6 +369,7 @@ class Detail extends Component {
getDetail = () => {
const { projectsId, owner } = this.props.match.params;
const { project } =this.state;
const url = `/${owner}/${projectsId}/detail.json`;
axios.get(url).then((result) => {
if (result && result.data) {

View File

@ -16,14 +16,14 @@ function Contribute(props){
const owner = props.match.params.owner;
const projectsId = props.match.params.projectsId;
const LIMIT = 20;
const {projectDetail} = props;
useEffect(()=>{
const {projectDetail} = props;
if(projectDetail){
const { author, name} = projectDetail;
document.title = `贡献者-${author.name}/${name}`;
}
},[])
},[projectDetail])
useEffect(()=>{
if(owner && projectsId){

View File

@ -103,14 +103,19 @@ class CreateMerge extends Component {
this.getMergeInfo(branchParams,true);
this.checkBranch(branchParams);
};
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
if(projectDetail){
const { author, name} = projectDetail;
document.title = `新建合并请求-${author.name}/${name}`;
}
};
}
componentDidUpdate = (preProps) => {
this.updateDocumentTitle();
// url变化触发时切换源分支、切换目标仓库、切换目标分支回退
const oldPathname = preProps.location.pathname;
const newPathname = this.props.location.pathname;

View File

@ -67,12 +67,18 @@ class merge extends Component {
this.getSelectList();
this.getIssueList();
};
componentDidUpdate=()=>{
this.updateDocumentTitle();
}
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
if(projectDetail){
const { author, name} = projectDetail;
document.title = `合并请求-${author.name}/${name}`;
document.title = `新建合并请求-${author.name}/${name}`;
}
};
}
getSelectList = () => {
const { projectsId,owner } = this.props.match.params;

View File

@ -61,6 +61,13 @@ class Index extends Component {
this.getOwner();
//判断是否为删除新建项目失败后返回,并执行对应逻辑
this.isDeleteProjectBack();
const { projectsType } = this.props.match.params;
if(projectsType === "mirror"){
document.title = '导入项目'
}else{
document.title = '新建项目'
}
}
componentDidUpdate=(prevPros)=>{
if(prevPros && this.props && !this.props.checkIfLogin()){

View File

@ -29,10 +29,16 @@ class Milepost extends Component {
componentDidMount = () => {
this.getList(1, this.state.status, 'desc');
}
componentDidUpdate = () => {
this.updateDocumentTitle();
}
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
if(projectDetail){
const { author, name} = projectDetail;
document.title = `里程碑-${author.name}/${name}`;
document.title = `新建合并请求-${author.name}/${name}`;
}
}

View File

@ -75,15 +75,20 @@ class order extends Component {
};
}
componentDidMount = () => {
componentDidUpdate(){
this.updateDocumentTitle();
}
// 更新网页标题
updateDocumentTitle(){
const {projectDetail} = this.props;
if(projectDetail){
const { author, name} = projectDetail;
document.title = `疑修-${author.name}/${name}`;
}
}
componentDidMount = () => {
const datas = cookie.load('states');
let states = datas === "undefined" ? undefined : datas;
if(states){

View File

@ -26,12 +26,15 @@ function Quality(props){
"INFO":"建议缺陷",
"MAJOR":"一般缺陷",
}
const {projectDetail} = props;
useEffect(()=>{
const {projectDetail} = props;
if(projectDetail){
const { author, name} = projectDetail;
document.title = `质量分析-${author.name}/${name}`;
}
},[projectDetail])
useEffect(()=>{
getTask()
return () => {
clearInterval(timer)

View File

@ -48,7 +48,6 @@ class Index extends Component {
componentDidMount = () => {
this.getList();
const {projectDetail} = this.props;
if(projectDetail){
const { author, name} = projectDetail;

View File

@ -25,14 +25,16 @@ function Index(props){
const [ visible , setVisible ] = useState(false);
const repo_id = props.projectDetail && props.projectDetail.repo_id;
const owner = props.match.params.owner;
const {projectDetail} = props;
useEffect(()=>{
if(projectDetail){
const { author, name} = projectDetail;
document.title = `资源-${author.name}/${name}`;
}
},[projectDetail])
useEffect(()=>{
if(owner && repo_id){
const {projectDetail} = props;
if(projectDetail){
const { author, name} = projectDetail;
document.title = `资源-${author.name}/${name}`;
}
getData();
}
},[repo_id,owner,search,sortValue,page])

View File

@ -108,6 +108,7 @@ class Infos extends Component {
componentDidMount = () => {
this.fetchUser();
document.title = "个人中心";
};
componentDidUpdate=(prevProps)=>{

View File

@ -79,7 +79,7 @@ export function TPMIndexHOC(WrappedComponent) {
this.setState({
mygetHelmetapi: undefined
});
document.title = "Forge";
// document.title = "Forge";
var link = document.createElement('link'),
oldLink = document.getElementById('dynamic-favicon');
link.id = 'dynamic-favicon';
@ -93,7 +93,7 @@ export function TPMIndexHOC(WrappedComponent) {
//获取数据的时候
gettablogourldata = (response) => {
document.title = response.data.setting.name;
// document.title = response.data.setting.name;
var link = document.createElement('link'),
oldLink = document.getElementById('dynamic-favicon');
link.id = 'dynamic-favicon';