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存在就是编辑否则就是新增
const { refresh , subId } = this.props;
const { plateId } = this.props.match.params;
const url = `/forum_sections/${plateId}${subId ? "/rename":""}.json`;
const url = `/forum_sections${subId ? "/rename":""}.json`;
axios.post(url,{
title:values.title,
children_section_id:subId
children_section_id:subId,
id: plateId
}).then((result)=>{
if(result){
refresh();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@ import { Menu } from "antd";
import "./menu.scss";
function user_menu({ is_current_user, login, props }) {
const [defaultMenu, setDefaultMenu] = useState("p_project");
const [defaultMenu, setDefaultMenu] = useState("memos");
const handleClick = (e) => {
setDefaultMenu(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) {
setDefaultMenu(current_path);
} else {
setDefaultMenu("p_project");
setDefaultMenu("memos");
}
}, [props.location]);
const show_name = is_current_user ? "我" : "TA";
@ -25,8 +25,8 @@ function user_menu({ is_current_user, login, props }) {
selectedKeys={defaultMenu}
mode="horizontal"
>
<Menu.Item key="p_projects">{show_name}管理的</Menu.Item>
<Menu.Item key="l_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="memos">{show_name}的帖子</Menu.Item>
<Menu.Item key="replies">{show_name}的回帖</Menu.Item>
{is_current_user && (

View File

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

View File

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

View File

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