From 6950c1a8209b83f9feb6519848c085fc6bbf1c53 Mon Sep 17 00:00:00 2001 From: "sylor_huang@126.com" Date: Thu, 15 Oct 2020 11:27:25 +0800 Subject: [PATCH] Change Forum Url --- src/App.js | 38 +++++++++++-------------- src/AppConfig.js | 4 +-- src/forums/Component/AuthorCard.jsx | 4 +-- src/forums/Component/BestItem.jsx | 2 +- src/forums/Component/Prise.jsx | 6 ++-- src/forums/ForumsDetail.jsx | 2 ++ src/forums/Index.jsx | 10 ++++++- src/forums/New.jsx | 6 ++-- src/forums/new_comments/comment_list.js | 8 ++++-- src/forums/new_comments/comments.js | 6 +++- src/modules/tpm/NewHeader.js | 9 +++--- 11 files changed, 56 insertions(+), 39 deletions(-) diff --git a/src/App.js b/src/App.js index 4d953e6b..a68866ac 100644 --- a/src/App.js +++ b/src/App.js @@ -79,15 +79,15 @@ const http500 = Loadable({ loader: () => import('./modules/500/http500'), loading: Loading, }) -const InfosIndex = Loadable({ - loader: () => import('./forge/users/Index'), - loading: Loading, -}) +// const InfosIndex = Loadable({ +// loader: () => import('./forge/users/Index'), +// loading: Loading, +// }) // 组织 -const OrganizeIndex = Loadable({ - loader: () => import('./forge/Team/Index'), - loading: Loading, -}) +// const OrganizeIndex = Loadable({ +// loader: () => import('./forge/Team/Index'), +// loading: Loading, +// }) class App extends Component { constructor(props) { @@ -235,14 +235,14 @@ class App extends Component { {/*项目*/} - { return () } }> - + */} ( @@ -264,41 +264,35 @@ class App extends Component { )} > {/*项目*/} - { return () } }> - + */} {/*403*/} - { return () } }> - + */} {/*404*/} {/* 个人主页 */} - { - return () - } - }> ( - + ) } /> - + {/* */} diff --git a/src/AppConfig.js b/src/AppConfig.js index 69d3cc31..8e921d9f 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -58,8 +58,8 @@ export function initAxiosInterceptors(props) { initOnlineOfflineListener() // TODO 避免重复的请求 https://github.com/axios/axios#cancellation var - // proxy = "http://localhost:3000" - proxy = "https://testforgeplus.trustie.net" + proxy = "http://localhost:3000" + // proxy = "https://testforgeplus.trustie.net" const requestMap = {}; window.setfalseInRequestMap = function (keyName) { diff --git a/src/forums/Component/AuthorCard.jsx b/src/forums/Component/AuthorCard.jsx index bd151fe3..f98449ce 100644 --- a/src/forums/Component/AuthorCard.jsx +++ b/src/forums/Component/AuthorCard.jsx @@ -19,7 +19,7 @@ export default (({user})=>{

{user && user.description ? user.description : "这家伙太懒了,还未填写个人描述!"}

- {user && !user.is_current_user && ( + {/* {user && !user.is_current_user && ( { set_fans_count={fans_count} show_block={false} > - )} + )} */} {user && user.memos_count} diff --git a/src/forums/Component/BestItem.jsx b/src/forums/Component/BestItem.jsx index 74e6c8e0..d52f561a 100644 --- a/src/forums/Component/BestItem.jsx +++ b/src/forums/Component/BestItem.jsx @@ -17,7 +17,7 @@ export default (({ memos , selectKey })=>{ { list && list.length>0 ? list.map((item,key)=>{ return( -
  • {item.subject}
  • +
  • {item && item.subject}
  • ) }): diff --git a/src/forums/Component/Prise.jsx b/src/forums/Component/Prise.jsx index d005228e..78fd455b 100644 --- a/src/forums/Component/Prise.jsx +++ b/src/forums/Component/Prise.jsx @@ -1,7 +1,7 @@ import React, { useState, useEffect } from "react"; import axios from "axios"; import { message } from "antd"; -export default ({ isPrised, num, memo_id, container_type, current_login }) => { +export default ({ isPrised, num, memo_id, container_type, current_login, props }) => { const [flag, setFlag] = useState(undefined); const [number, setNumber] = useState(undefined); @@ -27,7 +27,9 @@ export default ({ isPrised, num, memo_id, container_type, current_login }) => { message.error(error); }); } else { - window.open("/login", "_blank"); + props.showLoginDialog(); + return; + // window.open("/login", "_blank"); } } return ( diff --git a/src/forums/ForumsDetail.jsx b/src/forums/ForumsDetail.jsx index f29f3d14..0f394a13 100644 --- a/src/forums/ForumsDetail.jsx +++ b/src/forums/ForumsDetail.jsx @@ -193,6 +193,7 @@ function memo_show(props) { memo_id={memo.id} container_type="Memo" current_login={memoUser && memoUser.current_login} + props={props} />
    @@ -202,6 +203,7 @@ function memo_show(props) { target_type="memos" current_user_image={memoUser && memoUser.current_image_url} current_login={memoUser && memoUser.current_login} + props={props} /> { diff --git a/src/forums/Index.jsx b/src/forums/Index.jsx index fd087b0b..8807b5ba 100644 --- a/src/forums/Index.jsx +++ b/src/forums/Index.jsx @@ -2,7 +2,7 @@ import React, { Component } from "react"; import { TPMIndexHOC } from "../modules/tpm/TPMIndexHOC"; import { SnackbarHOC } from "educoder"; import { CNotificationHOC } from "../modules/courses/common/CNotificationHOC"; -import { Route, Switch } from "react-router-dom"; +import { Route, Switch, Redirect } from "react-router-dom"; import Loading from "../Loading"; import Loadable from "react-loadable"; import "./css/Index.css"; @@ -50,6 +50,14 @@ class Index extends Component { render={(props) => } > }> + + {/* ( + + )} + > */} ); diff --git a/src/forums/New.jsx b/src/forums/New.jsx index 329b5df4..57aabdba 100644 --- a/src/forums/New.jsx +++ b/src/forums/New.jsx @@ -147,7 +147,7 @@ function New(props, ref) { // 上传的图片 function UploadFunc(e) { attachments && attachments.length>0 && attachments.map((item,key)=>{ - return e.push(item.id) + return e.push(item && item.id) }); setAttachments(e); } @@ -168,7 +168,7 @@ function New(props, ref) { setSpining(true); let params = { forum_id: values.forum_id, - attachment_id: ImgInfo && ImgInfo.attachment_id, + attachment_id: ImgInfo && ImgInfo.id, children_forum_id: values.children_forum_id, attachments, memo: { @@ -201,6 +201,8 @@ function New(props, ref) { }else{ // 新建提交 const url = `/memos.json`; + console.log("params", params) + axios.post(url, params).then((result) => { if (result && result.data) { notification.open({ diff --git a/src/forums/new_comments/comment_list.js b/src/forums/new_comments/comment_list.js index 7eace911..2831b27a 100644 --- a/src/forums/new_comments/comment_list.js +++ b/src/forums/new_comments/comment_list.js @@ -13,6 +13,7 @@ function comment_list({ is_children, target_type, commet_destroy, + props }) { const [is_reply, setIsReply] = useState(false); const [is_delete, setIsDelete] = useState(false); @@ -38,7 +39,8 @@ function comment_list({ if (current_login) { setIsReply(reply_boolean); } else { - window.open("/login", "_blank"); + props.showLoginDialog(); + return; } }; @@ -59,7 +61,9 @@ function comment_list({ message.error(error); }); } else { - window.open("/login", "_blank"); + props.showLoginDialog(); + return; + // window.open("/login", "_blank"); } }; diff --git a/src/forums/new_comments/comments.js b/src/forums/new_comments/comments.js index d47ef551..e28728bf 100644 --- a/src/forums/new_comments/comments.js +++ b/src/forums/new_comments/comments.js @@ -15,6 +15,7 @@ function comments({ target_type, current_user_image, current_login, + props }) { const [currentImage, setCurrentImage] = useState(null); const [replies, setReplies] = useState([]); @@ -63,8 +64,10 @@ function comments({ if(current_login){ setIsClick(reply_boolean); }else{ - window.open("/login", "_blank") + props.showLoginDialog(); + return; } + }; const create_new_reply = (reply) => { @@ -121,6 +124,7 @@ function comments({ is_children={false} target_type={target_type} commet_destroy={success_delete_reply} + props={props} > )} diff --git a/src/modules/tpm/NewHeader.js b/src/modules/tpm/NewHeader.js index e064d4a7..8afb611d 100644 --- a/src/modules/tpm/NewHeader.js +++ b/src/modules/tpm/NewHeader.js @@ -768,8 +768,9 @@ class NewHeader extends Component { { coursestypes === true && this.props.user && this.props.user.main_site === false ? "" :
      -
    • 新建镜像项目
    • -
    • 新建托管项目
    • +
    • 发布帖子
    • + {/*
    • 新建镜像项目
    • +
    • 新建托管项目
    • */}
    } @@ -839,7 +840,7 @@ class NewHeader extends Component {
    • {this.props.current_user.username}
    • - 个人中心 + 个人中心
    • { mygetHelmetapi2 && mygetHelmetapi2.new_course && mygetHelmetapi2.new_course.my_courses && @@ -847,7 +848,7 @@ class NewHeader extends Component { } { mygetHelmetapi2 && mygetHelmetapi2.new_course && mygetHelmetapi2.new_course.my_organ && -
    • 我的组织
    • +
    • 我的组织
    • }
    • this.educoderloginysl()}>退出