Skip to content

Commit

Permalink
Merge pull request #106 from NJUPT-SAST/lay-dev
Browse files Browse the repository at this point in the history
fix:活动项目列表的面包屑Bug
  • Loading branch information
MaxtuneLee authored Apr 3, 2024
2 parents 7eb9882 + a51fc14 commit df5b4fd
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 41 deletions.
Binary file added src/assets/avatar-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/avatar-title.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/avatar.jpg
Binary file not shown.
17 changes: 13 additions & 4 deletions src/components/TopBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ import { RollbackOutlined } from '@ant-design/icons'
import { Breadcrumb, Button } from 'antd'
import React, { Fragment } from 'react'
import { useLocation, Link } from 'react-router-dom'

import './index.scss'

/**
* 顶部面包屑与返回上一页的小栏
*/
function TopBar(props?: { activity?: string }) {
// let processedExtraBreadcrumbItems = [<Fragment key="emptyElement"></Fragment>]
const role = localStorage.getItem('userState')
const reviewValue = role === 'judge' ? '比赛审核' : '比赛评审'
const handleGoBack = () => {
window.history.back()
}
Expand All @@ -18,8 +21,8 @@ function TopBar(props?: { activity?: string }) {
'/manage': '比赛管理',
'/create': '创建比赛',
'/account': '我的帐号',
'/review': '比赛评审',
'/list': '比赛',
'/review': reviewValue,
'/list': '项目列表',
'/detail': '比赛列表',
'/register': '比赛报名',
'/register-detail': '报名参加详情',
Expand All @@ -32,7 +35,6 @@ function TopBar(props?: { activity?: string }) {
const pathSnippets = location.pathname.split('/').filter((i) => i)
const extraBreadcrumbItems = pathSnippets.map((item, index) => {
const url = `/${pathSnippets.slice(0, index + 1).join('/')}`
// console.log(url)
if (!isNaN(Number(pathSnippets[index])) && props?.activity !== undefined) {
return (
<Breadcrumb.Item key="current-activity" className="breadCrumbItem">
Expand All @@ -47,6 +49,13 @@ function TopBar(props?: { activity?: string }) {
)
}
})

//筛选出面包屑内容为空的Item (无activity)
const filterBreadcrumbItems =
extraBreadcrumbItems.filter(item =>
item.props.children.props.children !== undefined)


// if (props?.activity !== null) {
// processedExtraBreadcrumbItems = extraBreadcrumbItems.slice(0, 1)
// // console.log(extraBreadcrumbItems.slice(0,1))
Expand All @@ -70,7 +79,7 @@ function TopBar(props?: { activity?: string }) {
<Breadcrumb.Item key="home" className="breadCrumbItem">
<Link to="/">主页</Link>
</Breadcrumb.Item>,
].concat(extraBreadcrumbItems)
].concat(filterBreadcrumbItems)
// .concat(moreExtraBreadcrumbItems())
return (
<div className="topBar">
Expand Down
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import 'antd/dist/antd.min.css'
import App from './App'
import reportWebVitals from './reportWebVitals'
import { BrowserTracing } from '@sentry/tracing'
import { LoadingOutlined } from '@ant-design/icons'
import { Spin } from 'antd'
// import { LoadingOutlined } from '@ant-design/icons'
// import { Spin } from 'antd'

Sentry.setContext('用户信息', {
姓名: '' + localStorage.getItem('approval-system-name'),
Expand Down
2 changes: 1 addition & 1 deletion src/pages/activityDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function ActivityDetail() {
return '报名'
}
case 'judge':
return '审批'
return '审核'
case 'approver':
return '评审'
default:
Expand Down
10 changes: 5 additions & 5 deletions src/pages/create/Components/reviewerSet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ const ReviewSet: React.FC<reviewSetPropsType> = (props) => {
return (
<div className="activity-create-reviewer-setting">
<div className="activity-create-reviewer-setting-code">
<span id="activity-create-reviewer-setting-code">审批者学号</span>
<span id="activity-create-reviewer-setting-code">审核者学号</span>
<Input
className="first"
placeholder="审批者学号"
placeholder="审核者学号"
value={value.value}
onChange={(e) => {
setValue(index, e.target.value)
Expand All @@ -46,12 +46,12 @@ const ReviewSet: React.FC<reviewSetPropsType> = (props) => {
/>
</div>
<div className="activity-create-reviewer-setting-faculty">
<span id="activity-create-reviewer-setting-faculty">审批学院代号</span>
<span id="activity-create-reviewer-setting-faculty">审核学院代号</span>
{value.key === -1 ? (
<Select
className="last"
showSearch
placeholder="负责的审批的学院"
placeholder="负责的审核的学院"
onSelect={(value: number) => setKey(index, value)}
filterOption={(input, option) =>
(option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
Expand All @@ -70,7 +70,7 @@ const ReviewSet: React.FC<reviewSetPropsType> = (props) => {
className="last"
value={value.key}
showSearch
placeholder="负责的审批的学院"
placeholder="负责的审核的学院"
onSelect={(value: number) => setKey(index, value)}
filterOption={(input, option) =>
(option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
Expand Down
6 changes: 3 additions & 3 deletions src/pages/create/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -712,10 +712,10 @@ function Create() {
<div className="activity-create-reviewer-setting-default">
{competitionInfo.is_review === 1 ? (
<div className="activity-create-reviewer-setting-default-code">
<span id="activity-create-reviewer-setting-default-code">默认审批者</span>
<span id="activity-create-reviewer-setting-default-code">默认审核者</span>
<Input
className="first"
placeholder="审批者学号"
placeholder="审核者学号"
value={reviewSettings ? reviewSettings[0].value : ''}
onChange={(e) => {
setReviewSettings((pre) => {
Expand All @@ -729,7 +729,7 @@ function Create() {
</div>
) : (
<>
<div style={{ width: '330px' }}>如需添加审批者请点击左方按钮</div>
<div style={{ width: '330px' }}>如需添加审核者请点击左方按钮</div>
</>
)}
<div className="activity-create-reviewer-setting-default-change-number">
Expand Down
6 changes: 3 additions & 3 deletions src/pages/edit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -560,10 +560,10 @@ const Edit: React.FC<any> = () => {
<div className="activity-create-reviewer-setting-default">
{competitionInfo.is_review === 1 ? (
<div className="activity-create-reviewer-setting-default-code">
<span id="activity-create-reviewer-setting-default-code">默认审批者</span>
<span id="activity-create-reviewer-setting-default-code">默认审核者</span>
<Input
className="first"
placeholder="审批者学号"
placeholder="审核者学号"
value={reviewSettings ? reviewSettings[0].value : ''}
onChange={(e) => {
setReviewSettings((pre) => {
Expand All @@ -577,7 +577,7 @@ const Edit: React.FC<any> = () => {
</div>
) : (
<>
<div style={{ width: '330px' }}>如需添加审批者请点击左方按钮</div>
<div style={{ width: '330px' }}>如需添加审核者请点击左方按钮</div>
</>
)}
<div className="activity-create-reviewer-setting-default-change-number">
Expand Down
4 changes: 2 additions & 2 deletions src/pages/home/components/userProfile.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import avatar from "../../../assets/avatar.jpg"
import avatar from "../../../assets/avatar-logo.png"

type userProfileType = {
code: string //学号
Expand All @@ -10,7 +10,7 @@ const UserProfile: React.FC<userProfileType> = (props) => {
const { code, name, logout } = props
return (
<div className="user-profile">
<img src={avatar} alt='avatar' style={{ height: "70px", width: "70px", margin: "50px 20px 30px", borderRadius: "35px" }}></img>
<img src={avatar} alt='avatar' style={{ height: "70px", width: "80px", margin: "50px 10px 15px", borderRadius: "35px" }}></img>
<div className="user-profile-code">
<span>{code}</span>
{name}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import './index.scss'
import { login } from '../../api/public'
import { getUserProfile } from '../../api/user'
import LogoSvg from "../../assets/Logo.svg"
import avatar from "../../assets/avatar.jpg"
import avatar from "../../assets/avatar-title.png"
import Footer from './components/SASTlogo'

const { Header, Content, Sider } = Layout
Expand Down Expand Up @@ -169,7 +169,7 @@ const Home = () => {
<BellOutlined></BellOutlined>
</div> */}
<div className="user-wrap">
<img src={avatar} alt='avatar' style={{ height: "30px", width: "30px", borderRadius: "15px" }}></img>
<img src={avatar} alt='avatar' style={{ height: "40px", width: "160px", borderRadius: "30px" }}></img>
<div className="username">{userProfile.name}</div>
</div>
<div className="control-item" onClick={logout}>
Expand Down
14 changes: 7 additions & 7 deletions src/pages/manage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const Manage: React.FC = () => {
<div className="manage-header">
{/* <h1 id="manage-header-title">活动管理</h1> */}
<Button type="primary" onClick={() => Navigate('./create')}>
创建活动
创建比赛
</Button>
</div>
<div className="manage-body-no-repeat">
Expand All @@ -182,14 +182,14 @@ const Manage: React.FC = () => {
<span style={{ width: '6.8%' }}>开始日期</span>
<span style={{ width: '6.8%' }}>结束日期</span>
<span style={{ width: '13.2%' }}>比赛简介</span>
<span style={{ width: '9.3%' }}>审批人员</span>
<span style={{ width: '5%' }}>活动状态</span>
<span style={{ width: '9.3%' }}>审核人员</span>
<span style={{ width: '5%' }}>比赛状态</span>
<span style={{ width: '6.1%' }}>已报名队伍</span>
<span style={{ width: '7.5%' }}>已提交材料数</span>
<span style={{ width: '8.2%', margin: '0 70px 0 0' }}>审批完毕数</span>
<span style={{ width: '8.2%', margin: '0 70px 0 0' }}>审核完毕数</span>
<span style={{ width: '5.9%' }}>导出Excel</span>
<span style={{ width: '6.4%' }}>发布公告</span>
<span style={{ width: '6.4%' }}>管理活动</span>
<span style={{ width: '6.4%' }}>管理比赛</span>
</div>
<div className="manage-body-items">
{isLoading ? (
Expand All @@ -198,8 +198,8 @@ const Manage: React.FC = () => {
<Result
style={{ margin: '0 auto' }}
status="404"
title="没有活动数据"
subTitle="现在好像没有活动,快去创建活动吧!"
title="没有比赛数据"
subTitle="现在好像没有比萨,快去创建比赛吧!"
/>
) : (
pageState.records.map((value, index) => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/notice/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ function Notice() {
<Radio value={-1}>公开</Radio>
<Radio value={0}>选手</Radio>
<Radio value={1}>评委</Radio>
<Radio value={2}>审批人</Radio>
<Radio value={2}>审核人</Radio>
</Radio.Group>
</div>
<div className="activity-notice-operation">
Expand Down
12 changes: 6 additions & 6 deletions src/pages/review/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const JudgeReview: React.FC<IJudgeReview> = (props) => {
},
{
key: '3',
title: '待审批数',
title: '待审核数',
render(value, record, index) {
return (
<td className={list[index].totalNum - list[index].completedNum === 0 ? 'tdnum nopoint' : 'tdnum redPoint'}>
Expand All @@ -151,17 +151,17 @@ const JudgeReview: React.FC<IJudgeReview> = (props) => {
},
{
key: '4',
title: '已审批数',
title: '已审核数',
dataIndex: 'completedNum',
},
{
key: '5',
title: '审批开始日期',
title: '审核开始日期',
dataIndex: 'startDate',
},
{
key: '6',
title: '审批截止日期',
title: '审核截止日期',
dataIndex: 'endDate',
},
{
Expand All @@ -172,7 +172,7 @@ const JudgeReview: React.FC<IJudgeReview> = (props) => {
<Space size="middle">
<Link to={`/review/list/${record.id}/${current}`}>
<Button className="count" type="primary">
审批
审核
</Button>
</Link>
</Space>
Expand All @@ -191,7 +191,7 @@ const JudgeReview: React.FC<IJudgeReview> = (props) => {
<div className="manage-content">
<div className="manage-content-table">
<div>
<h1 className="manage-content-table-title">活动审批</h1>
<h1 className="manage-content-table-title">活动审核</h1>
<div className="manage-content-table-body">
<Table<DataListType>
columns={columns}
Expand Down
6 changes: 3 additions & 3 deletions src/pages/reviewJudge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ const ReviewJudge: React.FC = (props) => {
// document.querySelector('.navigation').addEventListener('scroll', handleScroll)
return (
<div className="reviewJudge-main">
<TopBar activity="审批" />
<TopBar activity="审核" />
<div className="manage-content-body">
<div className="manage-content-header">
<h1 className="manage-content-title">审批</h1>
<h1 className="manage-content-title">审核</h1>
<div className="submit">
<Button type="primary" onClick={handleSubmit}>
提交
Expand Down Expand Up @@ -259,7 +259,7 @@ const ReviewJudge: React.FC = (props) => {
setIsPass(e.target.value === 'pass' ? true : false)
}}
>
<span style={{ marginRight: '10px', marginLeft: '60px' }}>审批结果: </span>
<span style={{ marginRight: '10px', marginLeft: '60px' }}>审核结果: </span>
<Radio value="pass">通过</Radio>
<Radio value="nopass">未通过</Radio>
</Radio.Group>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/reviewList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function ReviewList() {
)
return (
<div className="manage">
<TopBar activity="活动项目列表" />
<TopBar />
{table}
</div>
)
Expand Down Expand Up @@ -245,7 +245,7 @@ const ProgramList: React.FC<IProgramList> = (props: any) => {
<div className="manage-content">
<div className="manage-content-table">
<div className="manage-content-header">
<h1 className="manage-content-title">活动项目列表</h1>
<h1 className="manage-content-title">比赛项目列表</h1>
</div>
<div className="manage-content-statistic">
<Statistic title="评审数量" value={isApproveCount} suffix={"/ " + list.length} />
Expand Down

0 comments on commit df5b4fd

Please sign in to comment.