forgeplus-react/src/forge/SecuritySetting/Index.jsx

121 lines
4.5 KiB
React
Raw Normal View History

2021-07-22 17:44:12 +08:00
import React from "react";
import { Route, Switch } from "react-router-dom";
import { withRouter } from "react-router";
import { SnackbarHOC } from "educoder";
import { CNotificationHOC } from "../../modules/courses/common/CNotificationHOC";
import { TPMIndexHOC } from "../../modules/tpm/TPMIndexHOC";
import Loadable from "react-loadable";
import Loading from "../../Loading";
import { Box , Gap , LongWidth } from '../Component/layout';
import { getImageUrl } from 'educoder';
import { Link } from 'react-router-dom';
import './Index.scss';
2021-09-07 09:33:46 +08:00
const MyNoticeIndex = Loadable({
loader: () => import("./notice/myNotice/Index"),
loading: Loading,
});
const NoticeManager = Loadable({
loader: () => import("./notice/manager/Index"),
loading: Loading,
});
2021-07-22 17:44:12 +08:00
const SSHNew = Loadable({
loader: () => import("./sub/New"),
loading: Loading,
});
2021-09-01 11:24:37 +08:00
const Profile = Loadable({
loader: () => import("../users/Material/Index"),
loading: Loading,
});
2021-07-22 17:44:12 +08:00
const SSHIndex = Loadable({
loader: () => import("./sub/SSH"),
loading: Loading,
});
2021-09-09 09:34:51 +08:00
const PrivateLetter = Loadable({
loader: () => import("./notice/privateLetter/Index"),
loading: Loading,
});
2021-07-22 17:44:12 +08:00
function Index(props){
2021-10-13 13:37:51 +08:00
const { current_user,mygetHelmetapi } = props;
2021-07-22 17:44:12 +08:00
const { pathname } = props.location;
2021-10-13 13:37:51 +08:00
const notice_url = mygetHelmetapi && mygetHelmetapi.common && mygetHelmetapi.common.notice;
2021-07-22 17:44:12 +08:00
return(
<div className="newMain clearfix whiteBack">
<div className="boies">
<Box>
<div className="shortW">
<div className="userDetail">
<img src={getImageUrl(`/${current_user && current_user.image_url}`)} alt=""/>
<span>{current_user && current_user.username}</span>
</div>
2021-09-09 14:25:04 +08:00
<ul className="securityUl ul-border-buttom">
2021-09-01 11:24:37 +08:00
<li>个人信息</li>
2021-09-10 18:23:28 +08:00
<li className={pathname.indexOf("/settings/profile")>-1 ?"active":""}><Link to={`/settings/profile`}><i className="iconfont icon-gerenziliao mr5 font-14"></i><span className="text-shodow-bold">基本资料</span></Link></li>
2021-09-01 11:24:37 +08:00
</ul>
2021-10-13 13:37:51 +08:00
{notice_url && <ul className="securityUl ul-border-buttom">
2021-09-09 14:25:04 +08:00
<li>消息通知</li>
2021-09-27 11:32:05 +08:00
<li className={(pathname.indexOf("/settings/notice")>-1 && pathname.indexOf("/settings/notice/config") == -1) || pathname.indexOf("/settings/notice/privateLetter")>-1 ?"active":""}><Link to={"/settings/notice"}><i className="iconfont icon-wodetongzhi"></i><span className="text-shodow-bold">我的通知</span></Link></li>
2021-10-18 16:54:16 +08:00
<li className={pathname.indexOf("/settings/notice/config")>-1 ?"active":""}><Link to={'/settings/notice/config'}><i className="iconfont icon-tongzhiguanli"></i><span className="text-shodow-bold">通知管理</span></Link></li>
2021-10-13 13:37:51 +08:00
</ul>}
2021-09-03 11:26:23 +08:00
<ul className="securityUl">
<li>安全设置</li>
2021-09-10 18:23:28 +08:00
<li className={pathname.indexOf("/settings/SSH")>-1 ?"active":""}><Link to={`/settings/SSH`}><i className="iconfont icon-xuanzhongssh_icon mr5 font-14"></i><span className="text-shodow-bold">SSH密钥</span></Link></li>
2021-09-03 11:26:23 +08:00
</ul>
2021-07-22 17:44:12 +08:00
</div>
<LongWidth>
<Gap>
<Switch>
2021-09-07 09:33:46 +08:00
<Route
2021-10-18 16:54:16 +08:00
path="/settings/notice/config"
2021-09-07 09:33:46 +08:00
render={(p) => (
2021-10-18 16:54:16 +08:00
<NoticeManager {...props} {...p}/>
2021-09-07 09:33:46 +08:00
)}
></Route>
<Route
2021-10-18 16:54:16 +08:00
path="/settings/notice/privateLetter"
render={(p)=>(
<PrivateLetter{...props} {...p}/>
)}
></Route>
<Route
path="/settings/notice"
2021-09-07 09:33:46 +08:00
render={(p) => (
2021-10-18 16:54:16 +08:00
<MyNoticeIndex {...props} {...p}/>
2021-09-07 09:33:46 +08:00
)}
></Route>
2021-07-22 17:44:12 +08:00
<Route
path="/settings/SSH/new"
render={(p) => (
<SSHNew {...props} {...p}/>
)}
></Route>
2021-09-01 11:24:37 +08:00
<Route
path="/settings/profile"
render={(p) => (
<Profile {...props} {...p}/>
)}
></Route>
2021-07-22 17:44:12 +08:00
<Route
path="/settings/SSH"
render={(p) => (
<SSHIndex {...props} {...p}/>
)}
></Route>
</Switch>
</Gap>
</LongWidth>
</Box>
</div>
</div>
)
}
export default withRouter((CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Index))))
);