Change ForumUser

This commit is contained in:
sylor_huang@126.com 2020-10-14 19:19:16 +08:00
parent f7fa5291c6
commit 7b097149eb
12 changed files with 57 additions and 54 deletions

View File

@ -24,10 +24,11 @@ class PreCreate extends Component {
// subId存在就是编辑否则就是新增 // subId存在就是编辑否则就是新增
const { refresh , subId } = this.props; const { refresh , subId } = this.props;
const { plateId } = this.props.match.params; const { plateId } = this.props.match.params;
const url = `/forum_sections/${plateId}${subId ? "/rename":""}.json`; const url = `/forum_sections${subId ? "/rename":""}.json`;
axios.post(url,{ axios.post(url,{
title:values.title, title:values.title,
children_section_id:subId children_section_id:subId,
id: plateId
}).then((result)=>{ }).then((result)=>{
if(result){ if(result){
refresh(); refresh();

View File

@ -96,9 +96,10 @@ class PrePlateManage extends Component {
content: '确认删除二级板块?', content: '确认删除二级板块?',
onOk: () => { onOk: () => {
const { plateId } = this.props.match.params; const { plateId } = this.props.match.params;
const url=`/forum_sections/${plateId}/destroy.json` const url=`/forum_sections/destroy_forum.json`
axios.post(url,{ axios.post(url,{
children_section_id:id children_section_id:id,
id: plateId
}).then(result=>{ }).then(result=>{
if(result){ if(result){
this.props.showNotification(result.data.message); this.props.showNotification(result.data.message);

View File

@ -2,7 +2,7 @@ import React from "react";
import { TPMIndexHOC } from "../modules/tpm/TPMIndexHOC"; import { TPMIndexHOC } from "../modules/tpm/TPMIndexHOC";
import { SnackbarHOC } from "educoder"; import { SnackbarHOC } from "educoder";
import { CNotificationHOC } from "../modules/courses/common/CNotificationHOC"; 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 Loading from "../Loading";
import Loadable from "react-loadable"; import Loadable from "react-loadable";
import UserInfo from "./User/Account"; import UserInfo from "./User/Account";
@ -10,10 +10,10 @@ import { MainContent, MinH400 } from "./css/projects";
import '../forums/css/All.scss'; import '../forums/css/All.scss';
import '../forums/css/Index.css'; import '../forums/css/Index.css';
const Projects = Loadable({ // const Projects = Loadable({
loader: () => import("./User/Projects"), // loader: () => import("./User/Projects"),
loading: Loading, // loading: Loading,
}); // });
const Memos = Loadable({ const Memos = Loadable({
loader: () => import("./Memo/Memos"), loader: () => import("./Memo/Memos"),
@ -36,49 +36,50 @@ function Index(props) {
<UserInfo {...props}></UserInfo> <UserInfo {...props}></UserInfo>
<MainContent> <MainContent>
<MinH400> <MinH400>
<Switch {...props}> <Switch {...props}>
<Route <Route
path="/accounts/:login/blocks" path="/accounts/:login/blocks"
render={() => <Blocks {...props} />} render={() => <Blocks {...props} />}
></Route> ></Route>
<Route <Route
path="/accounts/:login/interesting" path="/accounts/:login/interesting"
render={() => <Sections {...props} />} render={() => <Sections {...props} />}
></Route> ></Route>
<Route <Route
path="/accounts/:login/replies" path="/accounts/:login/replies"
render={() => <Memos {...props} />} render={() => <Memos {...props} />}
></Route> ></Route>
<Route <Route
path="/accounts/:login/memos" path="/accounts/:login/histories"
render={() => <Memos {...props} />} render={() => <Memos {...props} />}
></Route> ></Route>
<Route <Route
path="/accounts/:login/histories" path="/accounts/:login/stars"
render={() => <Memos {...props} />} render={() => <Memos {...props} />}
></Route> ></Route>
<Route {/* <Route
path="/accounts/:login/stars"
render={() => <Memos {...props} />}
></Route>
<Route
path="/accounts/:login/p_projects" path="/accounts/:login/p_projects"
render={() => <Projects {...props} />} render={() => <Projects {...props} />}
></Route> ></Route>
<Route <Route
path="/accounts/:login/l_projects" path="/accounts/:login/l_projects"
render={() => <Projects {...props} />} render={() => <Projects {...props} />}
></Route> ></Route> */}
<Route {/* <Route
path="/accounts/:login" path="/accounts/:login"
render={() => <Projects {...props} />} render={() => <Projects {...props} />}
></Route> ></Route> */}
</Switch> <Route
path="/accounts/:login/memos"
render={() => <Memos {...props} />}
></Route>
<Redirect from="/accounts/:login" to="/accounts/:login/memos"/>
</Switch>
</MinH400> </MinH400>
</MainContent> </MainContent>
</div> </div>
); );
} }
export default CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Index))); export default CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Index)));

View File

@ -31,7 +31,7 @@ function memos(props) {
async function init() { async function init() {
setSpinType(true); setSpinType(true);
let url = `/v1/my_memos/${user_login}/memos.json`; let url = `/my_memos/${user_login}/memos.json`;
axios.get(url, { axios.get(url, {
params: { params: {
...common_select, ...common_select,

View File

@ -13,7 +13,7 @@ function sections(props) {
useEffect(() => { useEffect(() => {
async function init() { async function init() {
setSpinType(true); setSpinType(true);
let url = `/v1/my_memos/${user_login}/my_interested.json`; let url = `/my_memos/${user_login}/my_interested.json`;
axios axios
.get(url, { .get(url, {
params: { params: {

View File

@ -23,7 +23,7 @@ function select_title({section_params, select_memos}) {
useEffect(() => { useEffect(() => {
async function init() { async function init() {
setLoadingType(true); setLoadingType(true);
let url = `/v1/forum_sections/select_sections.json`; let url = `/forum_sections/select_sections.json`;
axios axios
.get(url) .get(url)
.then((result) => { .then((result) => {

View File

@ -12,7 +12,7 @@ function account(props) {
useEffect(() => { useEffect(() => {
async function init(login) { async function init(login) {
setSpin(true); setSpin(true);
let url = `/v1/users/${login}/user_info.json`; let url = `/users/${login}/user_info.json`;
axios axios
.get(url) .get(url)
.then((result) => { .then((result) => {

View File

@ -14,7 +14,7 @@ function block_users(props) {
useEffect(() => { useEffect(() => {
async function init() { async function init() {
setSpinType(true); setSpinType(true);
let url = `/v1/users/${user_login}/block_user_lists.json`; let url = `/users/${user_login}/block_user_lists.json`;
axios axios
.get(url, { .get(url, {
params: { params: {

View File

@ -3,7 +3,7 @@ import { Menu } from "antd";
import "./menu.scss"; import "./menu.scss";
function user_menu({ is_current_user, login, props }) { function user_menu({ is_current_user, login, props }) {
const [defaultMenu, setDefaultMenu] = useState("p_project"); const [defaultMenu, setDefaultMenu] = useState("memos");
const handleClick = (e) => { const handleClick = (e) => {
setDefaultMenu(e.key); setDefaultMenu(e.key);
props.history.push(`/accounts/${login}/${e.key}`); props.history.push(`/accounts/${login}/${e.key}`);
@ -14,7 +14,7 @@ function user_menu({ is_current_user, login, props }) {
if (location_path.length > 3 && current_path) { if (location_path.length > 3 && current_path) {
setDefaultMenu(current_path); setDefaultMenu(current_path);
} else { } else {
setDefaultMenu("p_project"); setDefaultMenu("memos");
} }
}, [props.location]); }, [props.location]);
const show_name = is_current_user ? "我" : "TA"; const show_name = is_current_user ? "我" : "TA";
@ -25,8 +25,8 @@ function user_menu({ is_current_user, login, props }) {
selectedKeys={defaultMenu} selectedKeys={defaultMenu}
mode="horizontal" mode="horizontal"
> >
<Menu.Item key="p_projects">{show_name}管理的</Menu.Item> {/* <Menu.Item key="p_projects">{show_name}</Menu.Item>
<Menu.Item key="l_projects">{show_name}参与的</Menu.Item> <Menu.Item key="l_projects">{show_name}参与的</Menu.Item> */}
<Menu.Item key="memos">{show_name}的帖子</Menu.Item> <Menu.Item key="memos">{show_name}的帖子</Menu.Item>
<Menu.Item key="replies">{show_name}的回帖</Menu.Item> <Menu.Item key="replies">{show_name}的回帖</Menu.Item>
{is_current_user && ( {is_current_user && (

View File

@ -28,7 +28,7 @@ function user_projects(props) {
useEffect(() => { useEffect(() => {
async function init() { async function init() {
setSpinType(true); setSpinType(true);
let url = `/v1/users/${user_login}/user_projects.json`; let url = `/users/${user_login}/user_projects.json`;
axios axios
.get(url, { .get(url, {
params: { page, type, p, order, limit }, params: { page, type, p, order, limit },

View File

@ -33,7 +33,7 @@ function star_user({
const to_star = (star_type) => { const to_star = (star_type) => {
if(current_login){ if(current_login){
setLoadinStatus(true); setLoadinStatus(true);
let url = `/v1/users/${login}/watch_user.json`; let url = `/users/${login}/watch_user.json`;
if (is_blocked_by) { if (is_blocked_by) {
setModalStatus(true) setModalStatus(true)
setLoadinStatus(false); setLoadinStatus(false);
@ -73,7 +73,7 @@ function star_user({
const to_block = (block_type) => { const to_block = (block_type) => {
setModalStatus(false); setModalStatus(false);
setBlockLoadingStatus(true); setBlockLoadingStatus(true);
let url = `/v1/users/${login}/block_user.json`; let url = `/users/${login}/block_user.json`;
axios axios
.post(url, { block: block_type }) .post(url, { block: block_type })
.then((result) => { .then((result) => {

View File

@ -12,7 +12,7 @@ function user_brief({ brief, login, is_current_user }) {
}; };
const edit_brief = () => { const edit_brief = () => {
setLoadingStatus(true); setLoadingStatus(true);
let url = `/v1/users/${login}/edit_brief.json`; let url = `/users/${login}/edit_brief.json`;
axios axios
.post(url, { content: editBrief }) .post(url, { content: editBrief })
.then((result) => { .then((result) => {