From 90d2b9df05f73327371423ee9b77f94717736a66 Mon Sep 17 00:00:00 2001 From: Love98 Date: Fri, 22 Mar 2024 17:13:08 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E8=AF=84=E5=A7=94=E8=AF=84?= =?UTF-8?q?=E4=BB=B7=E7=95=8C=E9=9D=A2UI=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/judge.ts | 2 +- src/pages/account/index.tsx | 24 ++-- src/pages/home/index.tsx | 16 +-- src/pages/reviewApprover/index.tsx | 72 +++++----- src/pages/reviewList/index.scss | 15 +- src/pages/reviewList/index.tsx | 212 ++++++++++++++++++----------- 6 files changed, 200 insertions(+), 141 deletions(-) diff --git a/src/api/judge.ts b/src/api/judge.ts index 2d30d82..8fbfbe3 100644 --- a/src/api/judge.ts +++ b/src/api/judge.ts @@ -150,7 +150,7 @@ export const getJudgeWorkTotal = (workId: number) => { * 提交作品评分信息 * @param workId 作品 id * @param score 评的分 0 ~ 100 - * @param opinion 评价 + * @param opinion 评语 * @return axios 对象 */ export const uploadWorkScoreInfo = (workId: number, score: number, opinion: string) => { diff --git a/src/pages/account/index.tsx b/src/pages/account/index.tsx index a1712cc..32e9da2 100644 --- a/src/pages/account/index.tsx +++ b/src/pages/account/index.tsx @@ -155,18 +155,18 @@ function Main() { title: '姓名', content: `${userProfile[0].name}`, }, - grade: { - title: '年级', - content: `20${userProfile[0].code.charAt(1)}${userProfile[0].code.charAt(2)}级` - // }, - // faculty: { - // title: '学院', - // content: `${userProfile[0].college}`, - // }, - // major: { - // title: '专业', - // content: `${userProfile[0].major}`, - }, + // grade: { + // title: '年级', + // content: `20${userProfile[0].code.charAt(1)}${userProfile[0].code.charAt(2)}级` + // }, + // faculty: { + // title: '学院', + // content: `${userProfile[0].college}`, + // }, + // major: { + // title: '专业', + // content: `${userProfile[0].major}`, + // }, } // const [accountInfo, setAccountInfo] = useState>({ diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx index ff7fe79..ce800f3 100644 --- a/src/pages/home/index.tsx +++ b/src/pages/home/index.tsx @@ -80,14 +80,6 @@ const Home = () => { } }) switch (res.data.data.role) { - case 3: - setUserState('admin') - localStorage.setItem('userState', 'admin') - break - case 2: - setUserState('approver') - localStorage.setItem('userState', 'approver') - break case 0: setUserState('user') localStorage.setItem('userState', 'user') @@ -96,6 +88,14 @@ const Home = () => { setUserState('judge') localStorage.setItem('userState', 'judge') break + case 2: + setUserState('approver') + localStorage.setItem('userState', 'approver') + break + case 3: + setUserState('admin') + localStorage.setItem('userState', 'admin') + break default: break } diff --git a/src/pages/reviewApprover/index.tsx b/src/pages/reviewApprover/index.tsx index 82d65d0..6bb618e 100644 --- a/src/pages/reviewApprover/index.tsx +++ b/src/pages/reviewApprover/index.tsx @@ -99,44 +99,7 @@ const ReviewApprover: React.FC = (props) => { } // 处理提交事件 const handleSubmit = () => { - if (score! >= 0 && score! <= 100) { - if (opinion !== null) { - uploadWorkScoreInfo(Number(id), score!, opinion!).then(() => { - notification.info({ - message: '✅ 提交成功', - description: '自动返回列表', - top: 20, - placement: 'top', - }) - setTimeout(() => { - window.history.back() - }, 100) - - // navigate('/review/detail/' + (current + 1)) - // if (current === total) { - // setTimeout(() => { - // notification.info({ - // message: '😸️ 审批完成', - // description: '这是最后一个', - // top: 20, - // placement: 'top', - // }) - // }, 300) - // } else if (current > total) { - // navigate('/review/detail/' + total) - // } - }) - } else { - setTimeout(() => { - notification.info({ - message: 'x 提交失败', - description: '评价不能为空', - top: 20, - placement: 'top', - }) - }, 300) - } - } else { + if (score === null || score === undefined || score <= 0 || score <= 100) { setTimeout(() => { notification.info({ message: 'x 提交失败', @@ -145,7 +108,36 @@ const ReviewApprover: React.FC = (props) => { placement: 'top', }) }, 100) + return + } + if (opinion === null || opinion === undefined) { + setOpinion("") } + uploadWorkScoreInfo(Number(id), score, String(opinion)).then(() => { + notification.info({ + message: '✅ 提交成功', + description: '自动返回列表', + top: 20, + placement: 'top', + }) + setTimeout(() => { + window.history.back() + }, 100) + + // navigate('/review/detail/' + (current + 1)) + // if (current === total) { + // setTimeout(() => { + // notification.info({ + // message: '😸️ 审批完成', + // description: '这是最后一个', + // top: 20, + // placement: 'top', + // }) + // }, 300) + // } else if (current > total) { + // navigate('/review/detail/' + total) + // } + }) } useEffect(() => { // 请求数据,并把列表中的成员是否为队长布尔型换为字符串 @@ -313,7 +305,7 @@ const ReviewApprover: React.FC = (props) => { />
- 评价: + 评语: