fork仓库没刷新、删除仓库不用刷新要提示、专区新闻资讯路由undefined

This commit is contained in:
caishi 2024-09-13 15:21:54 +08:00
parent b9eed26948
commit c8c35d3e23
7 changed files with 25 additions and 13 deletions

View File

@ -170,7 +170,6 @@ const keyWord = ["explore", "settings", "setting", "mulan", "wiki", "issues", "s
class App extends Component {
constructor(props) {
super(props);
console.log("base:",props.projectBase && props.projectBase.author && props.projectBase.author.type);
this.state = {
Addcoursestype: false,
Addcoursestypes: false,
@ -219,7 +218,6 @@ class App extends Component {
let url = `/owners/${pathname}.json`;
axios.get(url).then((response) => {
if (response && response.status === 200) {
console.log("data:",response.data.type);
this.setState({
pathType: response.data.type || '404',
pathName: pathname,
@ -337,7 +335,6 @@ class App extends Component {
render() {
const { pathType, pathName, mygetHelmetapi } = this.state;
console.log("pathType",pathType);
return (
<ConfigProvider locale={zhCN}>
<MuiThemeProvider theme={theme}>

View File

@ -75,7 +75,7 @@ function Index(props){
key:3,
width:"10%",
render:(value,item)=>{
return <Link to={`/${value.login}`}><img src={getImageUrl(`/${value.image_url}`)} alt="" style={{borderRadius:"50%"}} width="32px" height="32px" /></Link>
return <Link to={`/${value.login}`}><img src={`${value.image_url}`} alt="" style={{borderRadius:"50%"}} width="32px" height="32px" /></Link>
}
},
{

View File

@ -85,7 +85,7 @@ function Main(props){
setMainList(rows);
// cateID
// if (temp !== tempEnum.zone) {
selectCate(cateId)
selectCate(cateId || (rows[0] && rows[0].id))
// }
setIsSpin(false);
}

View File

@ -25,7 +25,6 @@ function NewsList(props){
const [ menuSpin , setMenuSpin ] = useState(true);
const { id, temp } = props;
useEffect(()=>{
if(id && cateId ){
setMenuSpin(true);

View File

@ -6,7 +6,7 @@ function beforeFetch(actionUrl){
axios.defaults.withCredentials = true;
}
const config = {
// headers:{Authorization:"Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjo0NCwidXNlcl9rZXkiOiI3NWY3MmJmYmE2NGU4N2U3NWVjNWMwZDk2OThkMDFiN2EyODE0YjYwIiwidXNlcm5hbWUiOiJpbm5vdiJ9.IviAyZQjPFc4rT3ejAKfJYx3_QgS78RCKHx1XS-A4uI_mrc7_l6wK76HVIoPCEvP0Qimzyc6dpeVW4cE2fILZw"},
headers:{Authorization:"Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjo0NCwidXNlcl9rZXkiOiI3NWY3MmJmYmE2NGU4N2U3NWVjNWMwZDk2OThkMDFiN2EyODE0YjYwIiwidXNlcm5hbWUiOiJpbm5vdiJ9.IviAyZQjPFc4rT3ejAKfJYx3_QgS78RCKHx1XS-A4uI_mrc7_l6wK76HVIoPCEvP0Qimzyc6dpeVW4cE2fILZw"},
baseURL: actionUrl,
timeout: 1800000, // 请求超时时间
}

View File

@ -227,6 +227,24 @@ class Detail extends Component {
}
}
componentDidUpdate = async (prevState) => {
let prevParam = prevState.match.params;
let propsParam = this.props.match.params;
if (prevState && this.props && (prevParam.projectsId !== propsParam.projectsId || prevParam.owner !== propsParam.owner)) {
const { projectsId, owner } = this.props.match.params;
const data = await getProjectFunc(owner, projectsId);
if (data.data) {
this.getProject(data.data)
}
}
this.props.history.listen((history) => {
// 非issue链接地址清除cookie states具体保存和操作在order.js页面
this.clearIssueCookies(history);
})
}
clearIssueCookies = (history) => {
const { pathname } = history;
const { projectsId, owner } = this.props.match.params;
@ -237,9 +255,7 @@ class Detail extends Component {
}
}
async componentWillMount() {
const { projectsId, owner } = this.props.match.params;
console.log(this.props);
if (!this.props.projectBase) {
const data = await getProjectFunc(owner, projectsId);
if (data && data.data) {
@ -517,12 +533,13 @@ class Detail extends Component {
const url = `/${owner}/${projectsId}/forks.json`;
axios.post(url).then(result => {
if (result && result.data.status === 0) {
if (result.data.message === "fork失败你已拥有了这个项目") {
this.props.history.push(`/${current_user && current_user.login}/${projectsId}`);
this.props.showNotification(result.data.message);
if (result.data.message && result.data.message.indexOf("fork失败")>-1) {
// this.props.history.push(`/${current_user && current_user.login}/${projectsId}`);
return;
}
this.props.history.push(`/${current_user && current_user.login}/${result.data.identifier}`);
this.props.showNotification(result.data.message);
this.props.showNpsModal("indexProject", 3);
}
this.setState({

View File

@ -21,7 +21,6 @@ const Infos = Loadable({
class DetailTop extends Component {
constructor(props) {
super(props);
console.log("userinfos:",props);
this.state = {}
}
render() {