Skip to content

Commit

Permalink
migrate to PKU-OSLAB-oj
Browse files Browse the repository at this point in the history
  • Loading branch information
jesHrz committed Oct 19, 2024
1 parent 6539c6e commit 29f2b87
Show file tree
Hide file tree
Showing 24 changed files with 306 additions and 276 deletions.
13 changes: 8 additions & 5 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/sduoj.ico" />
<link rel="icon" href="%PUBLIC_URL%/pku.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<!-- HRZ:修改标题 -->
<meta
name="description"
content="SDUOJ - Shandong University Online Judge System"
content="PKU-OSLAB OJ - Peking University OSLAB Online Judge System"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo.png" />
<!-- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo.png" />-->
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
Expand All @@ -24,10 +25,12 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>SDUOJ</title>
<!-- HRZ:修改标题 -->
<title>PKU-OSLAB OJ</title>
</head>
<body>
<noscript>You need to enable JavaScript to run SDUOJ.</noscript>
<!-- HRZ:修改标题 -->
<noscript>You need to enable JavaScript to run PKU-OSLAB OJ.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
Expand Down
Binary file added public/pku.ico
Binary file not shown.
8 changes: 3 additions & 5 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,20 @@ import {BrowserRouter as Router, Route} from "react-router-dom";
import Loading from "./Utils/Loading";
import {routerLayout} from "./Config/router/router";
import SubmissionModal from "./Component/submission/Processing/ModalProcessing";
import RequirePassChange from "./Component/common/RequirePassChange";
// import RequirePassChange from "./Component/common/RequirePassChange";


const App = (props: any) => {


return (
// antd 全局化配置 国际化参数
<ConfigProvider locale={props.local}>
{/*顶级路由*/}
<Router>
{/*提交详情窗体*/}
<SubmissionModal/>
{/* HRZ: 关闭弱密码修改提示 */}
{/*密码修改提示*/}
<RequirePassChange/>
{/*<RequirePassChange/>*/}
<Suspense fallback={<Loading/>}>
{
routerLayout.map((r) => {
Expand All @@ -39,7 +38,6 @@ const App = (props: any) => {
</Router>
</ConfigProvider>
);

}

const mapStateToProps = (state: any) => {
Expand Down
3 changes: 2 additions & 1 deletion src/Assert/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,5 +325,6 @@
"DownloadFirstRejectCase": "Download First Reject Case",
"PublicTestCaseInfo": "Public test case info",
"new email": "New Email",
"ShowAllInformation": "Show All Information"
"ShowAllInformation": "Show All Information",
"OJInfo": "Introduction to Computation (B) Online Judge"
}
3 changes: 2 additions & 1 deletion src/Assert/lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -326,5 +326,6 @@
"DownloadFirstRejectCase": "下载首个错误测试点",
"PublicTestCaseInfo": "公共测试点信息",
"new email": "新邮箱",
"ShowAllInformation": "显示全部信息"
"ShowAllInformation": "显示全部信息",
"OJInfo": "北京大学计算概论(B)实验平台"
}
16 changes: 8 additions & 8 deletions src/Component/layout/CHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {withRouter} from "react-router";
import {userLogoutTodo} from "../../Redux/Action/user";
import UserAvatar from "../user/Avatar";
import judgeAuth from "../../Utils/judgeAhtu";
import {routerC_M} from "../../Config/router/routerC";
import {homeURL, routerC_M} from "../../Config/router/routerC";
import {UrlPrefix} from "../../Config/constValue";

const {Header} = Layout;
Expand Down Expand Up @@ -51,10 +51,11 @@ class CHeader extends Component<any, any> {
return (
<Header className="site-layout-sub-header-background"
style={{position: 'fixed', zIndex: 1, width: '100%', display: "flex", justifyContent: "space-between"}}>
<div className="logo" style={{flex: "125px 0 0", marginTop: "-5px", marginLeft: "-10px"}} key={"logo"}>
<img src={logo} style={{width: "125px", height: '30px'}}
alt={"SDUOJ-logo"}/>
</div>
{/* HRZ: 删除导航栏上的LOGO */}
{/*<div className="logo" style={{flex: "125px 0 0", marginTop: "-5px", marginLeft: "-10px"}} key={"logo"}>*/}
{/* <img src={logo} style={{width: "125px", height: '30px'}}*/}
{/* alt={"SDUOJ-logo"}/>*/}
{/*</div>*/}
<div style={{minWidth: 0, flex: "auto"}}>
<Menu
mode="horizontal"
Expand All @@ -69,7 +70,6 @@ class CHeader extends Component<any, any> {
<Link to={r.path}>{this.props.t(r.title_i18n)}</Link>
</Menu.Item>
)

})
}
</Menu>
Expand Down Expand Up @@ -117,7 +117,7 @@ class CHeader extends Component<any, any> {
onClick={()=>{
this.props.userLogout()
setTimeout(()=>{
this.props.history.push(UrlPrefix + "/home")
this.props.history.push(homeURL(routerC_M))
}, 200)
message.info("已退出登录")
}}
Expand All @@ -144,7 +144,7 @@ class CHeader extends Component<any, any> {
<Space>
<Button type={"text"} onClick={()=>{
this.props.history.push(UrlPrefix + "/login?to=" + this.props.location.pathname)
}}>登录 / 注册</Button>
}}>登录</Button>
</Space>
</>
)
Expand Down
3 changes: 2 additions & 1 deletion src/Component/layout/CLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ import {routerC} from "../../Config/router/routerC";
import {ContestState} from "../../Redux/Action/contest";
import {UrlPrefix} from "../../Config/constValue";
import LoginCheck from "../common/LoginCheck";
import {homeURL, routerC_M} from "../../Config/router/routerC";

const {Content} = Layout;

class MLayout extends Component<any, any> {

componentDidMount() {
if (this.props.location.pathname === UrlPrefix || this.props.location.pathname === UrlPrefix + '/') {
this.props.history.push(UrlPrefix + "/home");
this.props.history.push(homeURL(routerC_M));
}
}

Expand Down
9 changes: 5 additions & 4 deletions src/Component/layout/EHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ const EHeader = (props: any) => {
// const dispatch = useDispatch()
return (
<Header className="site-layout-sub-header-background" style={{minWidth: 550}}>
<div className="logo" style={{float: "left", marginTop: "-5px", marginLeft: "-10px"}} key={"logo"}>
<img src={logo} style={{width: "125px", height: '30px'}}
alt={"SDUOJ-logo"}/>
</div>
{/*HRZ:删除导航栏上的logo*/}
{/*<div className="logo" style={{float: "left", marginTop: "-5px", marginLeft: "-10px"}} key={"logo"}>*/}
{/* <img src={logo} style={{width: "125px", height: '30px'}}*/}
{/* alt={"SDUOJ-logo"}/>*/}
{/*</div>*/}
<div style={{float: "right"}} key={"operator"}>
{props.location.pathname.match(/\/exam\/running\//) !== null && (
<ExamOver key={"ExamOver"}/>
Expand Down
8 changes: 4 additions & 4 deletions src/Component/layout/MHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class MHeader extends Component<any, any> {
>
<div style={{float: "right"}}>
<div style={{position: "relative", right: "200px"}}>
<Button type={"text"} onClick={()=>{
this.props.history.replace("/manage")
window.location.reload()
}}>返回老版</Button>
{/*<Button type={"text"} onClick={()=>{*/}
{/* this.props.history.replace("/manage")*/}
{/* window.location.reload()*/}
{/*}}>返回老版</Button>*/}
<ChangeLang/>
{
(this.props.isLogin && (
Expand Down
9 changes: 5 additions & 4 deletions src/Component/layout/MLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ class MLayout extends Component<any, any> {
<LoginCheck jump={true}/>
<Layout style={{height: "max-content", minHeight: "100%"}}>
<Sider theme="dark" style={{position: 'fixed', zIndex: 50, height: '100vh', overflow: "auto"}}>
<div className="logo">
<img src={logo} style={{width: "125px", height: '30px'}}
alt={"SDUOJ-logo"}/>
</div>
{/* HRZ: 删除导航栏上的logo */}
{/*<div className="logo">*/}
{/* <img src={logo} style={{width: "125px", height: '30px'}}*/}
{/* alt={"SDUOJ-logo"}/>*/}
{/*</div>*/}
<MMenu id={1} roles={["superadmin"]}/>
</Sider>
<Layout style={{minWidth: 1200, marginLeft: 200}}>
Expand Down
3 changes: 2 additions & 1 deletion src/Component/user/Form/Binding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {withTranslation} from "react-i18next";
import {withRouter} from "react-router";
import {useDispatch} from "react-redux";
import {UrlPrefix} from "../../../Config/constValue";
import {homeURL, routerC_M} from "../../../Config/router/routerC";

const Binding = (props: any) => {
const [form] = useForm()
Expand All @@ -30,7 +31,7 @@ const Binding = (props: any) => {
return CApi.thirdPartyBinding(values).then((res: any) => {
dispatch({type: "userLogin"})
dispatch({type: "setUserInfo", data: res})
props.history.push(UrlPrefix + "/home")
props.history.push(homeURL(routerC_M))
message.success('绑定成功');
return true;
})
Expand Down
10 changes: 6 additions & 4 deletions src/Component/user/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type LoginType = 'SDUCAS' | 'account' | "email";
const Login = (props: any) => {

const formRef = useRef<ProFormInstance>()
const [loginType, setLoginType] = useState<LoginType>("SDUCAS")
const [loginType, setLoginType] = useState<LoginType>("account") // HRZ: 默认使用用户名密码登录,禁用邮箱认证和SDUCAS
const {t} = props
const dispatch = useDispatch()
const afterLogin = (data: loginInfo) => {
Expand Down Expand Up @@ -47,7 +47,7 @@ const Login = (props: any) => {
formRef={formRef}
logo={Logo}
title={t("用户登录")}
subTitle={t("山东大学在线评测系统")}
subTitle={""/*HRZ:删除登录框上的提示符*/}
actions={
<></>
}
Expand All @@ -66,8 +66,10 @@ const Login = (props: any) => {
>
<Tabs activeKey={loginType} onChange={(activeKey) => setLoginType(activeKey as LoginType)}>
<Tabs.TabPane key={'account'} tab={t('账号密码')}/>
<Tabs.TabPane key={'email'} tab={t('邮箱验证码')}/>
<Tabs.TabPane key={'SDUCAS'} tab={t('统一身份认证')}/>
{/*HRZ:禁用邮箱登录*/}
{/*<Tabs.TabPane key={'email'} tab={t('邮箱验证码')}/>*/}
{/*HRZ:禁用SDUCAS登录*/}
{/*<Tabs.TabPane key={'SDUCAS'} tab={t('统一身份认证')}/>*/}
</Tabs>
{loginType === 'account' && (
<>
Expand Down
2 changes: 1 addition & 1 deletion src/Config/constValue.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// 表格中的默认页数
export const defaultPageSize = 20
export const UrlPrefix = "/v2"
export const UrlPrefix = "" // "/v2"
export const MaxCodeLength = 1024 * 50

export const PREDEFINED_CHECKERS = [
Expand Down
35 changes: 18 additions & 17 deletions src/Config/router/router.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {lazy} from "react";
import {UrlPrefix} from "../constValue";


//HRZ:要禁用某些模块,可以先从这里把相应的路由给删掉,routerC.tsx, routerE.tsx, routerM.tsx也有相应的路由
//不需要的全删掉
export interface IBaseRouter {
id: number
path: string
Expand All @@ -18,22 +19,22 @@ export interface IRouter extends IBaseRouter {

// 名称,是否为独立页面
const routerCLayoutData: any = [
["home", false],
// ["home", false],
["problem", false],
["contest", false],
["problemSet", false],
["problemSetPublic", false],
// ["contest", false],
// ["problemSet", false],
// ["problemSetPublic", false],
["submission", false],
["group", false],
// ["group", false],
// 用户信息页面
["user", true],
// 账户相关的单独页面
["login", true],
["thirdPartyLogin", true],
// ["thirdPartyLogin", true],
["resetpass", true],
["test", false],
["hws", false],
["studentMutualEvaluation", true]
// ["test", false],
// ["hws", false],
// ["studentMutualEvaluation", true]
]
let routerCLayout: IBaseRouter[] = []
let num = 100;
Expand All @@ -56,15 +57,15 @@ export const routerLayout: IBaseRouter[] = [
exact: false,
component: lazy(() => import('../../Component/layout/MLayout'))
},
{
id: 1,
path: UrlPrefix + "/exam",
exact: false,
component: lazy(() => import('../../Component/layout/ELayout'))
},
// {
// id: 1,
// path: UrlPrefix + "/exam",
// exact: false,
// component: lazy(() => import('../../Component/layout/ELayout'))
// },
{
id: 4,
path: UrlPrefix,
path: UrlPrefix + '/',
exact: true,
component: lazy(() => import('../../Component/layout/CLayout'))
},
Expand Down
Loading

0 comments on commit 29f2b87

Please sign in to comment.