个人主页-修改简介

This commit is contained in:
caishi 2022-12-30 13:53:36 +08:00
parent acb87c7e09
commit b1d13f4014
4 changed files with 11 additions and 24 deletions

View File

@ -2,7 +2,6 @@ import axios from 'axios';
import { requestProxy } from "./indexEduplus2RequestProxy";
import { broadcastChannelOnmessage, isDev, queryString } from 'educoder';
import { notification } from 'antd';
import cookie from 'react-cookies';
import './index.css';
@ -17,7 +16,7 @@ function locationurl(list) {
}
}
// TODO 开发期多个身份切换
let debugType = "";
let debugType = ""
if (isDev) {
const _search = window.location.search;
let parsed = {};
@ -26,7 +25,7 @@ if (isDev) {
}
debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' :
window.location.search.indexOf('debug=s') !== -1 ? 'student' :
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || ''
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin'
}
window._debugType = debugType;
export function initAxiosInterceptors(props) {
@ -70,7 +69,7 @@ export function initAxiosInterceptors(props) {
if (response.data.status === -1) {
if (window.location.pathname.startsWith('/tasks/')) {
props.showSnackbar(response.data.message || '服务器异常,请联系管理员。')
} else if(window.location.pathname.startsWith('/login') || window.location.pathname.startsWith('/register') || window.location.pathname.startsWith('/resetPassword') || window.location.pathname.indexOf("/bindlogin/")>-1) {
} else if(window.location.pathname.startsWith('/login') || window.location.pathname.startsWith('/register') || window.location.pathname.startsWith('/resetPassword')) {
return response;
} else {
notification.open({

View File

@ -142,8 +142,6 @@ class Infos extends Component {
});
const { current_user } = this.props;
const { username } = this.props.match.params;
const { pathname } = this.props.location;
const { notice } = this.state;
let url = `/users/${username || (current_user && current_user.login)}.json`;
axios.get(url).then((result) => {
@ -461,7 +459,7 @@ class Infos extends Component {
<Route
path="/:username"
render={(props) => {
return <GeneralView {...this.props} {...this.state} menuKey={menuKey} show_super_description={user && user.show_super_description}/>;
return <GeneralView {...this.props} {...this.state} menuKey={menuKey} show_super_description={user && user.show_super_description} generalFetchUser={this.fetchUser}/>;
}}
></Route>
{/* <Route

View File

@ -7,19 +7,18 @@ import { Divider } from 'antd';
import axios from 'axios';
function Personal(props){
const { user ,current_user , resetUserInfo } = props;
const { user ,current_user , generalFetchUser } = props;
const [ edit , setEdit ] = useState(false);
const [ showedit , setShowEdit ] = useState(false);
const [ description ,setDescription ] = useState("");
const [ copyDescription ,setCopyDescription ] = useState("");
useEffect(()=>{
if(current_user && current_user.super_description){
setDescription(current_user.super_description);
setCopyDescription(current_user.super_description);
if(user && user.super_description){
setDescription(user.super_description);
setCopyDescription(user.super_description);
setShowEdit(true);
}
},[current_user && current_user.super_description])
},[user && user.super_description])
function onContentChange(value){
setDescription(value);
@ -52,7 +51,7 @@ function Personal(props){
setCopyDescription(description);
setEdit(false);
setShowEdit(description ?true :false);
resetUserInfo && resetUserInfo();
generalFetchUser && generalFetchUser();
}
})
}

View File

@ -1,9 +1,6 @@
import React, { Component } from 'react';
import { SnackbarHOC } from 'educoder';
import {BrowserRouter as Router,Route,Switch,Link} from 'react-router-dom';
import {Tooltip,Menu,Pagination,Spin, Dropdown,Checkbox} from 'antd';
import {Menu,Pagination,Spin, Dropdown,Checkbox} from 'antd';
import axios from 'axios';
import {getImageUrl,WordsBtn} from 'educoder';
import moment from 'moment';
import Modals from '../../modals/Modals';
import SendTopics from '../../modals/SendTopics'
@ -313,12 +310,6 @@ class InfosTopics extends Component{
let user_type=this.props.current_user&&this.props.current_user.user_identity;
let targetuserid=this.props.data&&this.props.data.id;
// console.log(is_current)
// console.log(current_user)
// console.log(current_user.is_teacher)
// console.log(current_user.admin)
const menu = (
<Menu>
<Menu.Item onClick={()=>this.updatedlist("updated_at")}>