Skip to content

Commit

Permalink
feat: 评委评价界面UI优化
Browse files Browse the repository at this point in the history
  • Loading branch information
love98ooo committed Mar 22, 2024
1 parent 13badbd commit 90d2b9d
Show file tree
Hide file tree
Showing 6 changed files with 200 additions and 141 deletions.
2 changes: 1 addition & 1 deletion src/api/judge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
24 changes: 12 additions & 12 deletions src/pages/account/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<Record<string, InfoItem>>({
Expand Down
16 changes: 8 additions & 8 deletions src/pages/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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
}
Expand Down
72 changes: 32 additions & 40 deletions src/pages/reviewApprover/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 提交失败',
Expand All @@ -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(() => {
// 请求数据,并把列表中的成员是否为队长布尔型换为字符串
Expand Down Expand Up @@ -313,7 +305,7 @@ const ReviewApprover: React.FC = (props) => {
/>
</div>
<div className="inputBox">
<span>评价: </span>
<span>评语: </span>
<TextArea
className="inputbox"
rows={4}
Expand All @@ -329,7 +321,7 @@ const ReviewApprover: React.FC = (props) => {
<Input placeholder="请输入0-100之间的数字" id="score" />
</Form.Item>
<Form.Item label="评价">
<Form.Item label="评语">
<TextArea rows={3} placeholder="请输入" id="warning" />
</Form.Item>
</Form> */}
Expand Down
15 changes: 12 additions & 3 deletions src/pages/reviewList/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,19 @@
margin-right: 1.5vh;
}
}
.manage-content-statistic {
display: flex;
flex-direction: column;
justify-content: space-around;
margin: 15px 0;
height: 150px;
}
.manage-content-table-body {
margin-left: 1.1vw;
margin-right: 0.93vw;
padding: 1.8vh 3.6vw 0 3.6vw;
margin-left: 0;
padding: 0;
border-style: solid;
border-color: rgb(206, 206, 206);
border-radius: 0.5px;
text-align: center;
background-color: #fff;
}
Expand Down
Loading

0 comments on commit 90d2b9d

Please sign in to comment.