commit
All checks were successful
Deploy to Server / deploy (push) Successful in 27s

This commit is contained in:
jeremygan2021
2026-03-11 22:47:35 +08:00
parent 5a87105ec9
commit dbd752b833
7 changed files with 259 additions and 124 deletions

View File

@@ -80,8 +80,26 @@ class ScoreSerializer(serializers.ModelSerializer):
class CommentSerializer(serializers.ModelSerializer): class CommentSerializer(serializers.ModelSerializer):
judge_name = serializers.CharField(source='judge.user.nickname', read_only=True) judge_name = serializers.CharField(source='judge.user.nickname', read_only=True)
score = serializers.SerializerMethodField()
class Meta: class Meta:
model = Comment model = Comment
fields = ['id', 'project', 'judge', 'content', 'judge_name', 'created_at'] fields = ['id', 'project', 'judge', 'content', 'judge_name', 'created_at', 'score']
read_only_fields = ['judge'] read_only_fields = ['judge']
def get_score(self, obj):
scores = Score.objects.filter(project=obj.project, judge=obj.judge)
if not scores.exists():
return None
current_judge_total_score = 0
current_judge_total_weight = 0
for score in scores:
current_judge_total_score += score.score * score.dimension.weight
current_judge_total_weight += score.dimension.weight
if current_judge_total_weight > 0:
judge_score = current_judge_total_score / current_judge_total_weight
return round(judge_score, 1)
return None

View File

@@ -162,7 +162,16 @@ const ProjectDetail = () => {
<List.Item style={{ background: '#141414', padding: 16, borderRadius: 8, marginBottom: 12, border: '1px solid #303030' }}> <List.Item style={{ background: '#141414', padding: 16, borderRadius: 8, marginBottom: 12, border: '1px solid #303030' }}>
<List.Item.Meta <List.Item.Meta
avatar={<Avatar icon={<UserOutlined />} style={{ backgroundColor: '#00b96b' }} />} avatar={<Avatar icon={<UserOutlined />} style={{ backgroundColor: '#00b96b' }} />}
title={<span style={{ color: '#fff' }}>{item.judge_name || '评委'}</span>} title={
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
<span style={{ color: '#fff' }}>{item.judge_name || '评委'}</span>
{item.score && (
<Tag color="orange" style={{ margin: 0, fontWeight: 'bold', border: 'none' }}>
{item.score}
</Tag>
)}
</div>
}
description={ description={
<div> <div>
<div style={{ color: '#ccc', marginTop: 8 }}>{item.content}</div> <div style={{ color: '#ccc', marginTop: 8 }}>{item.content}</div>

View File

@@ -55,7 +55,7 @@
.language { .language {
color: #9cdcfe; color: #9cdcfe;
font-size: 12px; font-size: 14px;
font-weight: 600; font-weight: 600;
text-transform: uppercase; text-transform: uppercase;
} }
@@ -75,7 +75,7 @@
.copy-text { .copy-text {
color: #ccc; color: #ccc;
font-size: 12px; font-size: 14px;
margin-left: 4px; margin-left: 4px;
} }
} }
@@ -90,7 +90,7 @@
.code-text { .code-text {
color: #d4d4d4; color: #d4d4d4;
font-family: 'Courier New', Courier, monospace; font-family: 'Courier New', Courier, monospace;
font-size: 14px; font-size: 16px;
line-height: 1.5; line-height: 1.5;
white-space: pre; white-space: pre;
display: block; display: block;

View File

@@ -22,7 +22,7 @@ const MarkdownReader: React.FC<Props> = ({ content, themeColor = '#00b96b' }) =>
renderer.table = (header, body) => { renderer.table = (header, body) => {
return `<div style="overflow-x: auto; width: 100%; -webkit-overflow-scrolling: touch;"> return `<div style="overflow-x: auto; width: 100%; -webkit-overflow-scrolling: touch;">
<table style="width: 100%; min-width: 600px; border-collapse: collapse; margin: 16px 0; font-size: 14px;"> <table style="width: 100%; min-width: 600px; border-collapse: collapse; margin: 16px 0; font-size: 16px;">
<thead>${header}</thead> <thead>${header}</thead>
<tbody>${body}</tbody> <tbody>${body}</tbody>
</table> </table>

View File

@@ -10,9 +10,9 @@
} }
.content { .content {
padding: 24px; padding: 30px;
background: #111; background: #111;
border-radius: 16px 16px 0 0; border-radius: 20px 20px 0 0;
margin-top: -24px; margin-top: -24px;
position: relative; position: relative;
z-index: 10; z-index: 10;
@@ -21,22 +21,22 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: flex-start; align-items: flex-start;
margin-bottom: 24px; margin-bottom: 30px;
.title { .title {
font-size: 24px; font-size: 32px;
font-weight: bold; font-weight: bold;
color: #fff; color: #fff;
line-height: 1.4; line-height: 1.4;
} }
.status { .status {
font-size: 14px; font-size: 16px;
padding: 4px 8px; padding: 6px 10px;
border-radius: 4px; border-radius: 6px;
background: #333; background: #333;
color: #ccc; color: #ccc;
margin-left: 12px; margin-left: 16px;
white-space: nowrap; white-space: nowrap;
&.registration { background: #07c160; color: #fff; } &.registration { background: #07c160; color: #fff; }
@@ -48,15 +48,15 @@
.tabs { .tabs {
display: flex; display: flex;
margin-bottom: 24px; margin-bottom: 30px;
border-bottom: 1px solid #333; border-bottom: 1px solid #333;
.tab-item { .tab-item {
flex: 1; flex: 1;
text-align: center; text-align: center;
padding: 12px 0; padding: 16px 0;
color: #999; color: #999;
font-size: 16px; font-size: 18px;
position: relative; position: relative;
&.active { &.active {
@@ -69,8 +69,8 @@
bottom: -1px; bottom: -1px;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
width: 24px; width: 30px;
height: 3px; height: 4px;
background: #00b96b; background: #00b96b;
border-radius: 2px; border-radius: 2px;
} }
@@ -81,28 +81,28 @@
.project-list { .project-list {
.project-card { .project-card {
background: #1f1f1f; background: #1f1f1f;
border-radius: 12px; border-radius: 16px;
overflow: hidden; overflow: hidden;
margin-bottom: 16px; margin-bottom: 20px;
display: flex; display: flex;
.cover { .cover {
width: 120px; width: 140px;
height: 90px; height: 105px;
background: #333; background: #333;
flex-shrink: 0; flex-shrink: 0;
} }
.info { .info {
flex: 1; flex: 1;
padding: 12px; padding: 16px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
overflow: hidden; overflow: hidden;
.title { .title {
font-size: 16px; font-size: 20px;
color: #fff; color: #fff;
font-weight: 500; font-weight: 500;
display: -webkit-box; display: -webkit-box;
@@ -119,14 +119,14 @@
.user { .user {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 12px; font-size: 14px;
color: #999; color: #999;
.avatar { .avatar {
width: 20px; width: 24px;
height: 20px; height: 24px;
border-radius: 50%; border-radius: 50%;
margin-right: 6px; margin-right: 8px;
background: #333; background: #333;
} }
} }
@@ -134,7 +134,7 @@
.score { .score {
color: #faad14; color: #faad14;
font-weight: bold; font-weight: bold;
font-size: 14px; font-size: 16px;
} }
} }
} }
@@ -142,7 +142,8 @@
.empty { .empty {
text-align: center; text-align: center;
color: #666; color: #666;
padding: 40px 0; padding: 50px 0;
font-size: 16px;
} }
} }
@@ -150,13 +151,13 @@
.rank-item { .rank-item {
display: flex; display: flex;
align-items: center; align-items: center;
padding: 16px 0; padding: 20px 0;
border-bottom: 1px solid #222; border-bottom: 1px solid #222;
.rank-num { .rank-num {
width: 40px; width: 50px;
text-align: center; text-align: center;
font-size: 18px; font-size: 22px;
font-weight: bold; font-weight: bold;
color: #666; color: #666;
@@ -172,10 +173,10 @@
overflow: hidden; overflow: hidden;
.avatar { .avatar {
width: 40px; width: 48px;
height: 40px; height: 48px;
border-radius: 50%; border-radius: 50%;
margin-right: 12px; margin-right: 16px;
background: #333; background: #333;
flex-shrink: 0; flex-shrink: 0;
} }
@@ -186,8 +187,8 @@
.nickname { .nickname {
color: #fff; color: #fff;
font-size: 16px; font-size: 18px;
margin-bottom: 4px; margin-bottom: 6px;
display: block; display: block;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
@@ -196,7 +197,7 @@
.project-title { .project-title {
color: #666; color: #666;
font-size: 12px; font-size: 14px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
@@ -205,34 +206,35 @@
} }
.score { .score {
font-size: 18px; font-size: 22px;
font-weight: bold; font-weight: bold;
color: #00b96b; color: #00b96b;
margin-left: 12px; margin-left: 16px;
} }
} }
.empty { .empty {
text-align: center; text-align: center;
color: #666; color: #666;
padding: 40px 0; padding: 50px 0;
font-size: 16px;
} }
} }
.section { .section {
margin-bottom: 32px; margin-bottom: 40px;
.section-title { .section-title {
font-size: 18px; font-size: 24px;
font-weight: bold; font-weight: bold;
color: #fff; color: #fff;
margin-bottom: 12px; margin-bottom: 20px;
display: block; display: block;
border-left: 4px solid #00b96b; border-left: 5px solid #00b96b;
padding-left: 12px; padding-left: 16px;
} }
/* Markdown styling borrowed from Forum */ /* Markdown styling borrowed from Forum */
font-size: 16px; font-size: 18px;
line-height: 1.8; line-height: 1.8;
color: #e0e0e0; color: #e0e0e0;
letter-spacing: 0.3px; letter-spacing: 0.3px;
@@ -240,38 +242,38 @@
image { image {
max-width: 100%; max-width: 100%;
border-radius: 12px; border-radius: 12px;
margin: 16px 0; margin: 20px 0;
box-shadow: 0 4px 12px rgba(0,0,0,0.3); box-shadow: 0 4px 12px rgba(0,0,0,0.3);
} }
h1, h2, h3, h4, h5, h6 { margin-top: 24px; margin-bottom: 16px; color: #fff; font-weight: 700; line-height: 1.4; } h1, h2, h3, h4, h5, h6 { margin-top: 30px; margin-bottom: 20px; color: #fff; font-weight: 700; line-height: 1.4; }
h1 { font-size: 24px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 12px; } h1 { font-size: 32px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 16px; }
h2 { font-size: 20px; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 8px; } h2 { font-size: 28px; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 12px; }
h3 { font-size: 18px; } h3 { font-size: 24px; }
h4 { font-size: 17px; } h4 { font-size: 20px; }
h5 { font-size: 16px; color: #ddd; } h5 { font-size: 18px; color: #ddd; }
p { margin-bottom: 16px; } p { margin-bottom: 20px; }
strong { font-weight: 800; color: #fff; } strong { font-weight: 800; color: #fff; }
em { font-style: italic; color: #aaa; } em { font-style: italic; color: #aaa; }
del { text-decoration: line-through; color: #666; } del { text-decoration: line-through; color: #666; }
ul, ol { margin-bottom: 16px; padding-left: 20px; } ul, ol { margin-bottom: 20px; padding-left: 24px; }
li { margin-bottom: 6px; list-style-position: outside; } li { margin-bottom: 8px; list-style-position: outside; }
ul li { list-style-type: disc; } ul li { list-style-type: disc; }
ol li { list-style-type: decimal; } ol li { list-style-type: decimal; }
li input[type="checkbox"] { margin-right: 8px; } li input[type="checkbox"] { margin-right: 12px; }
blockquote { blockquote {
border-left: 4px solid #00b96b; border-left: 5px solid #00b96b;
background: rgba(255, 255, 255, 0.05); background: rgba(255, 255, 255, 0.05);
padding: 12px 16px; padding: 16px 20px;
margin: 16px 0; margin: 20px 0;
border-radius: 4px; border-radius: 6px;
color: #bbb; color: #bbb;
font-size: 15px; font-size: 16px;
font-style: italic; font-style: italic;
p { margin-bottom: 0; } p { margin-bottom: 0; }
@@ -283,20 +285,20 @@
height: 1px; height: 1px;
background: rgba(255,255,255,0.1); background: rgba(255,255,255,0.1);
border: none; border: none;
margin: 24px 0; margin: 30px 0;
} }
table { table {
width: 100%; width: 100%;
border-collapse: collapse; border-collapse: collapse;
margin: 16px 0; margin: 20px 0;
font-size: 14px; font-size: 16px;
overflow-x: auto; overflow-x: auto;
display: block; display: block;
th, td { th, td {
border: 1px solid rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.1);
padding: 10px; padding: 12px;
text-align: left; text-align: left;
} }
@@ -313,20 +315,20 @@
code { code {
background: rgba(255,255,255,0.1); background: rgba(255,255,255,0.1);
padding: 2px 6px; padding: 4px 8px;
border-radius: 4px; border-radius: 6px;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
color: #ff7875; color: #ff7875;
font-size: 14px; font-size: 16px;
margin: 0 4px; margin: 0 6px;
} }
pre { pre {
background: #161616; background: #161616;
padding: 16px; padding: 20px;
border-radius: 12px; border-radius: 16px;
overflow-x: auto; overflow-x: auto;
margin: 16px 0; margin: 20px 0;
border: 1px solid #333; border: 1px solid #333;
box-shadow: inset 0 0 20px rgba(0,0,0,0.5); box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
@@ -334,7 +336,7 @@
background: transparent; background: transparent;
color: #a6e22e; color: #a6e22e;
padding: 0; padding: 0;
font-size: 13px; font-size: 14px;
margin: 0; margin: 0;
white-space: pre; white-space: pre;
} }
@@ -348,16 +350,16 @@
left: 0; left: 0;
right: 0; right: 0;
background: #1f1f1f; background: #1f1f1f;
padding: 16px 24px; padding: 20px 30px;
border-top: 1px solid #333; border-top: 1px solid #333;
z-index: 100; z-index: 100;
.btn { .btn {
width: 100%; width: 100%;
height: 48px; height: 56px;
line-height: 48px; line-height: 56px;
border-radius: 24px; border-radius: 28px;
font-size: 18px; font-size: 20px;
font-weight: bold; font-weight: bold;
color: #fff; color: #fff;
background: #00b96b; background: #00b96b;

View File

@@ -1,98 +1,201 @@
.project-detail { .project-detail {
background-color: #000; background-color: #000;
min-height: 100vh; min-height: 100vh;
padding-bottom: 40px; padding-bottom: 60px;
box-sizing: border-box; box-sizing: border-box;
.cover { .cover {
width: 100%; width: 100%;
height: 240px; height: 260px;
display: block; display: block;
} }
.content { .content {
padding: 24px; padding: 30px;
background: #111; background: #111;
border-radius: 16px 16px 0 0; border-radius: 24px 24px 0 0;
margin-top: -24px; margin-top: -30px;
position: relative; position: relative;
z-index: 10; z-index: 10;
min-height: 60vh; min-height: 60vh;
.header { .header {
margin-bottom: 32px; margin-bottom: 40px;
.title { .title {
font-size: 24px; font-size: 36px;
font-weight: bold; font-weight: bold;
color: #fff; color: #fff;
margin-bottom: 16px; margin-bottom: 24px;
line-height: 1.4; line-height: 1.4;
display: block; display: block;
} }
.author { .author {
display: flex; display: flex;
align-items: center; align-items: center;
background: rgba(255, 255, 255, 0.05); background: rgba(255, 255, 255, 0.08);
padding: 8px 12px; padding: 12px 20px;
border-radius: 20px; border-radius: 30px;
display: inline-flex; display: inline-flex;
.avatar { .avatar {
width: 24px; width: 36px;
height: 24px; height: 36px;
border-radius: 50%; border-radius: 50%;
margin-right: 8px; margin-right: 12px;
background: #333; background: #333;
} }
.name { .name {
font-size: 14px; font-size: 18px;
color: #ccc; color: #ddd;
} }
} }
} }
.section { .section {
margin-bottom: 32px; margin-bottom: 50px;
.section-title { .section-title {
font-size: 18px; font-size: 28px;
font-weight: bold; font-weight: bold;
color: #fff; color: #fff;
margin-bottom: 16px; margin-bottom: 24px;
display: block; display: block;
border-left: 4px solid #00b96b; border-left: 6px solid #00b96b;
padding-left: 12px; padding-left: 18px;
} }
.text-content { .text-content {
font-size: 15px; font-size: 20px;
color: #ccc; color: #ccc;
line-height: 1.8; line-height: 1.8;
background: #1f1f1f; background: #1f1f1f;
padding: 16px; padding: 24px;
border-radius: 12px; border-radius: 20px;
/* Markdown Styles */
h1, h2, h3, h4, h5, h6 { margin-top: 40px; margin-bottom: 24px; color: #fff; font-weight: 700; line-height: 1.4; }
h1 { font-size: 34px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 16px; }
h2 { font-size: 30px; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 12px; }
h3 { font-size: 26px; }
h4 { font-size: 24px; }
h5 { font-size: 22px; color: #ddd; }
p { margin-bottom: 24px; }
strong { font-weight: 800; color: #fff; }
em { font-style: italic; color: #aaa; }
del { text-decoration: line-through; color: #666; }
ul, ol { margin-bottom: 24px; padding-left: 28px; }
li { margin-bottom: 10px; list-style-position: outside; }
ul li { list-style-type: disc; }
ol li { list-style-type: decimal; }
li input[type="checkbox"] { margin-right: 12px; transform: scale(1.2); }
blockquote {
border-left: 6px solid #00b96b;
background: rgba(255, 255, 255, 0.05);
padding: 20px 24px;
margin: 24px 0;
border-radius: 8px;
color: #bbb;
font-size: 18px;
font-style: italic;
p { margin-bottom: 0; }
}
a { color: #00b96b; text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.2s; }
hr {
height: 1px;
background: rgba(255,255,255,0.1);
border: none;
margin: 30px 0;
}
table {
width: 100%;
border-collapse: collapse;
margin: 24px 0;
font-size: 18px;
overflow-x: auto;
display: block;
th, td {
border: 1px solid rgba(255,255,255,0.1);
padding: 14px;
text-align: left;
}
th {
background: rgba(255,255,255,0.05);
font-weight: 700;
color: #fff;
}
tr:nth-child(even) {
background: rgba(255,255,255,0.02);
}
}
code {
background: rgba(255,255,255,0.1);
padding: 4px 8px;
border-radius: 6px;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
color: #ff7875;
font-size: 18px;
margin: 0 6px;
}
pre {
background: #161616;
padding: 24px;
border-radius: 16px;
overflow-x: auto;
margin: 24px 0;
border: 1px solid #333;
box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
code {
background: transparent;
color: #a6e22e;
padding: 0;
font-size: 16px;
margin: 0;
white-space: pre;
}
}
image {
max-width: 100%;
border-radius: 16px;
margin: 24px 0;
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
} }
.empty { .empty {
font-size: 14px; font-size: 18px;
color: #666; color: #666;
text-align: center; text-align: center;
display: block; display: block;
padding: 20px 0; padding: 40px 0;
background: #1f1f1f; background: #1f1f1f;
border-radius: 12px; border-radius: 16px;
} }
.file-list { .file-list {
background: #1f1f1f; background: #1f1f1f;
border-radius: 12px; border-radius: 20px;
overflow: hidden; overflow: hidden;
.file-item { .file-item {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 16px; padding: 24px;
border-bottom: 1px solid #333; border-bottom: 1px solid #333;
&:last-child { &:last-child {
@@ -100,20 +203,20 @@
} }
.file-name { .file-name {
font-size: 14px; font-size: 18px;
color: #ddd; color: #ddd;
flex: 1; flex: 1;
margin-right: 16px; margin-right: 20px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.file-action { .file-action {
font-size: 12px; font-size: 16px;
color: #00b96b; color: #00b96b;
padding: 4px 12px; padding: 8px 20px;
border: 1px solid #00b96b; border: 1px solid #00b96b;
border-radius: 14px; border-radius: 20px;
} }
} }
} }
@@ -121,9 +224,9 @@
.comment-list { .comment-list {
.comment-item { .comment-item {
background: #1f1f1f; background: #1f1f1f;
border-radius: 12px; border-radius: 20px;
padding: 16px; padding: 24px;
margin-bottom: 16px; margin-bottom: 24px;
&:last-child { &:last-child {
margin-bottom: 0; margin-bottom: 0;
@@ -132,20 +235,20 @@
.comment-header { .comment-header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-bottom: 8px; margin-bottom: 16px;
.judge-name { .judge-name {
font-size: 14px; font-size: 18px;
font-weight: bold; font-weight: bold;
color: #00b96b; color: #00b96b;
} }
.comment-time { .comment-time {
font-size: 12px; font-size: 16px;
color: #666; color: #666;
} }
} }
.comment-content { .comment-content {
font-size: 14px; font-size: 20px;
color: #ccc; color: #ccc;
line-height: 1.6; line-height: 1.6;
display: block; display: block;

View File

@@ -141,7 +141,10 @@ export default function ProjectDetail() {
{comments.map((c) => ( {comments.map((c) => (
<View key={c.id} className='comment-item'> <View key={c.id} className='comment-item'>
<View className='comment-header'> <View className='comment-header'>
<Text className='judge-name'>{c.judge_name || '评委'}</Text> <View className='judge-info'>
<Text className='judge-name'>{c.judge_name || '评委'}</Text>
{c.score && <Text className='judge-score'>{c.score}</Text>}
</View>
<Text className='comment-time'>{c.created_at?.substring(0, 16)}</Text> <Text className='comment-time'>{c.created_at?.substring(0, 16)}</Text>
</View> </View>
<Text className='comment-content'>{c.content}</Text> <Text className='comment-content'>{c.content}</Text>