Explorar o código

fix: Zhurui 修改Coder页面风格

Leonezhurui %!s(int64=3) %!d(string=hai) anos
pai
achega
d900204058

+ 3 - 1
src/utils/color.js

@@ -3,6 +3,7 @@ const evalColor = "#f5b86e";
 const developerColor = "#3a85bb";
 const successColor = "#67C23A";
 const errorColor = "#F56C6C";
+const warningColor = "#E6A23B";
 const primaryColor = "#409EFF";
 
 const colorUtil = {
@@ -14,8 +15,9 @@ const colorUtil = {
   ElEMENT_COLOR:{
     successColor,
     errorColor,
+    warningColor,
     primaryColor,
   }
 };
 
-export default colorUtil;
+export default colorUtil;

+ 7 - 5
src/views/CourseDetailPage/tabs/TaskTab.vue

@@ -123,18 +123,20 @@
           >
             <template #title>
               <span>{{ problem.name }}</span>
-              <el-tag class="problem-type">{{ problem.type }}</el-tag>
+              <el-tag
+                  class="problem-type"
+                  size="small" round style="margin-left: 15px"
+              >{{ problem.type }}</el-tag>
             </template>
             <b>题目描述:</b>
-            <span class="problem-description">{{ problem.description }}</span>
-            <div class="remove-button">
+            <span class="problem-description" style="line-height: 30px">{{ problem.description }}</span>
+            <div class="remove-button" style="float: right;margin-right: 20px">
               <el-button
                   type="danger"
                   size="mini"
                   @click="$store.commit('removeProblem', problem)"
               >移除该题
-              </el-button
-              >
+              </el-button>
             </div>
           </el-collapse-item>
         </el-collapse>

+ 23 - 10
src/views/ExamPage/ExamDetail.vue

@@ -4,11 +4,16 @@
       <template #header>
         <page-header>
           <template #actions>
-            <!--            <el-button @clicxk="fetchExamDetail" :loading="loading.refresh">-->
-            <!--              <el-icon><RefreshRight /></el-icon>-->
-            <!--            </el-button>-->
+            <el-button
+                @click="fetchExamDetail"
+                :loading="loading.refresh"
+                v-if="isStudentGroup && exam.joined"
+            >
+              <el-icon><RefreshRight /></el-icon>
+            </el-button>
             <el-button
               v-if="isStudentGroup && !exam.joined"
+              type="primary"
               @click="dialog.join = true"
             >
               参加考试
@@ -137,8 +142,11 @@
       </el-descriptions>
 
       <!--      题目列表-->
-      <el-card class="son-card"
-               style="background: none; box-shadow:none;border: none; margin-top: 15px;margin-bottom: 30px">
+      <el-card
+          v-if="exam.joined || isTeacherGroup"
+          class="son-card"
+          style="background: none; box-shadow:none;border: none; margin-top: 15px;margin-bottom: 30px"
+      >
         <template #header>
           <span style="color:black;font-size: 24px;font-family: 'Inter',sans-serif">题目列表</span>
         </template>
@@ -157,6 +165,7 @@
             </template>
             <div style="margin-left: 40px">{{ problem.description }}</div>
             <div style="margin-left: 30px;margin-top: 10px">
+<!--              原来逻辑:只有老师和管理员可以查看题目预览-->
               <a
                 v-if="isTeacherGroup || isAdmin"
                 style="color: #409EFF;cursor: pointer;"
@@ -169,12 +178,16 @@
       </el-card>
 
       <!--      提交记录-->
-      <el-card class="son-card" style="background: none; box-shadow:none;border: none;margin-bottom: 30px">
+      <el-card
+          v-if="exam.joined || isTeacherGroup"
+          class="son-card"
+          style="background: none; box-shadow:none;border: none;margin-bottom: 30px"
+      >
         <template #header>
           <span style="color:black;font-size: 24px;font-family: 'Inter',sans-serif">提交记录</span>
         </template>
 
-        <el-table v-if="exam.joined" :data="result.commits" style="background: none; box-shadow:none;border: none">
+        <el-table v-if="exam.joined || isTeacherGroup" :data="result.commits" style="background: none; box-shadow:none;border: none">
           <el-table-column prop="id" label="#" width="200"/>
           <el-table-column label="提交时间">
             <template #default="scope">
@@ -364,9 +377,9 @@
     </el-dialog>
     <el-dialog title="确认参加这场考试吗?" v-model="dialog.join">
       <el-descriptions>
-        <el-descriptions-item label="考试名称">{{ exam.name }}</el-descriptions-item>
-        <el-descriptions-item label="创建者">{{ exam.creator ? exam.creator.username : "" }}</el-descriptions-item>
-        <el-descriptions-item label="起止时间" :span="2">
+        <el-descriptions-item label="考试名称:">{{ exam.name }}</el-descriptions-item>
+        <el-descriptions-item label="创建者:">{{ exam.creator ? exam.creator.username : "" }}</el-descriptions-item>
+        <el-descriptions-item label="起止时间:" :span="2">
           {{ formatTimestamp(exam.startAt) }} 至 {{ formatTimestamp(exam.endAt) }}
         </el-descriptions-item>
       </el-descriptions>

+ 11 - 3
src/views/ExamPage/ResultPage/CommitPage/CommitDetail.vue

@@ -1,9 +1,12 @@
 <template>
   <div class="commit-container">
-    <el-card>
+    <el-card style="background: none; box-shadow:none;border: none">
       <template #header>
         <page-header>
-          提交详情
+          <el-button @click="getBack" style="border: none;background: none;">
+            <el-icon :size="22"><Back /></el-icon>
+          </el-button>
+          <span style="font-size: 36px;font-family: 'Inter',sans-serif">提交详情</span>
         </page-header>
       </template>
       <CommitBoard :commit-id="commitId"></CommitBoard>
@@ -32,7 +35,9 @@ export default {
 
   },
   methods: {
-
+    getBack() {
+      this.$router.go(-1);
+    }
   }
 };
 </script>
@@ -43,4 +48,7 @@ export default {
   min-height: calc(100vh - 100px);
 }
 
+:deep .el-card__header {
+  border-bottom: 1px solid black;
+}
 </style>

+ 70 - 38
src/views/ExamPage/ResultPage/CommitPage/RecordPage/RecordDetail.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="record-container">
-    <el-card>
+    <el-card style="background: none; box-shadow:none;border: none;">
       <template #header>
         <page-header>
           <template #actions>
@@ -14,49 +14,63 @@
               查看质量分析
             </el-button>
             <el-button
-                v-if="
-            isTeacherGroup ||
-              isAdmin ||
-              isConsoleOutputShownForStu ||
-              isAssistantGroup
-          "
+                v-if="isTeacherGroup || isAdmin ||
+              isConsoleOutputShownForStu ||isAssistantGroup"
+                type="primary"
                 @click="dialog = true"
             >
               查看控制台输出
             </el-button>
           </template>
-          <el-button @click="getBack">
-            <el-icon><Back /></el-icon>
+          <el-button @click="getBack" style="border: none;background: none;">
+            <el-icon :size="22"><Back /></el-icon>
           </el-button>
-          运行详情
+          <span style="font-size: 36px;font-family: 'Inter',sans-serif">运行详情</span>
         </page-header>
       </template>
-      <paper style="padding: 20px">
-        <el-descriptions>
-          <el-descriptions-item label="状态:">
-            <el-tag :type="statusTagType"> {{ statusTagContent }} </el-tag>
-          </el-descriptions-item>
-          <el-descriptions-item label="错误用例数:">
-            {{ record.failures ? record.failures.length : 0 }}
-          </el-descriptions-item>
-          <el-descriptions-item label="分数:">
-            {{ record.score }}
-          </el-descriptions-item>
-        </el-descriptions>
-      </paper>
-      <div class="top-divide fill-card">
-        <el-table :data="record.failures" class="failure-table">
-          <el-table-column
-              v-if="isTeacherGroup || isAdmin || isAssistantGroup"
-              type="expand"
-          >
-            <template #default="scope">
-              <pre><code>{{ scope.row.trace }}</code></pre>
-            </template>
-          </el-table-column>
-          <el-table-column label="错误用例" prop="name" />
-        </el-table>
-      </div>
+
+      <el-descriptions class="result-description">
+        <el-descriptions-item
+            label-class-name="label-bold"
+            label="状态:">
+          <el-tag :type="statusTagType" round> {{ statusTagContent }} </el-tag>
+        </el-descriptions-item>
+        <el-descriptions-item
+            label-class-name="label-bold"
+            label="错误用例数:">
+          {{ record.failures ? record.failures.length : 0 }}
+        </el-descriptions-item>
+        <el-descriptions-item
+            label-class-name="label-bold"
+            label="分数:">
+          {{ record.score }}
+        </el-descriptions-item>
+      </el-descriptions>
+
+
+      <el-card
+          class="son-card"
+          style="background: none; box-shadow:none;border: none;">
+        <template #header>
+          <page-header>
+            <span style="font-size: 24px;font-family: 'Inter',sans-serif">错误用例</span>
+          </page-header>
+        </template>
+        <div class="top-divide fill-card">
+          <el-table :data="record.failures" class="failure-table">
+            <el-table-column
+                v-if="isTeacherGroup || isAdmin || isAssistantGroup"
+                type="expand"
+            >
+              <template #default="scope">
+                <pre><code>{{ scope.row.trace }}</code></pre>
+              </template>
+            </el-table-column>
+            <el-table-column label="错误用例" prop="name" />
+          </el-table>
+        </div>
+      </el-card>
+
 
     </el-card>
 
@@ -76,11 +90,10 @@
 import PageHeader from "@/components/PageHeader";
 import {mapGetters} from "vuex";
 import {ElMessage} from "element-plus";
-import Paper from "@/views/ProblemPage/components/Paper";
 import {buildStatusToTagContent, buildStatusToTagType} from "@/utils/coder-utils";
 export default {
   name: "RecordDetail",
-  components: {Paper, PageHeader},
+  components: {PageHeader},
   props: {
 
   },
@@ -158,4 +171,23 @@ pre code {
   margin: 40px 10vw 80px 10vw;
   min-height: calc(100vh - 100px);
 }
+
+:deep .el-card__header {
+  border-bottom: 1px solid black;
+}
+
+:deep .result-description .el-descriptions__body{
+  font-size: 16px;
+  background-color: #F8F9FB; //样式穿透,覆盖原本的样式
+}
+
+:deep .label-bold {
+  font-weight: 500;
+  font-size: 16px;
+}
+
+:deep .son-card .el-card__header {
+  border-bottom: none;
+  padding-bottom: 0;
+}
 </style>

+ 88 - 43
src/views/ExamPage/ResultPage/CommitPage/components/CommitBoard.vue

@@ -1,54 +1,72 @@
 <template>
-  <paper>
-    <el-descriptions>
-      <el-descriptions-item label="编号:">{{ commit.id }}</el-descriptions-item>
-      <el-descriptions-item label="提交时间:">{{ formatTimestamp(commit.createdAt) }}</el-descriptions-item>
-      <el-descriptions-item label="分数:">{{ commit.score }}</el-descriptions-item>
-      <el-descriptions-item label="Git Commit ID:" :span="2">{{ commit.hash }}</el-descriptions-item>
-    </el-descriptions>
-  </paper>
-<!--  <el-divider></el-divider>-->
-  <el-table :data="commit.records">
-    <el-table-column label="题目">
-      <template #default="scope">
-        <span>{{ scope.row.problem.name }}</span>
-      </template>
-    </el-table-column>
-    <el-table-column label="状态" width="280">
-      <template #default="scope">
-        <el-tag :type="buildStatusToTagType(scope.row.status)">
+  <el-descriptions class="commit-description">
+    <el-descriptions-item
+        label-class-name="label-bold"
+        label="编号:">{{ commit.id }}</el-descriptions-item>
+    <el-descriptions-item
+        :width="600"
+        label-class-name="label-bold"
+        label="提交时间:">{{ formatTimestamp(commit.createdAt) }}</el-descriptions-item>
+    <el-descriptions-item
+        :width="200"
+        label-class-name="label-bold"
+        label="分数:">{{ commit.score }}</el-descriptions-item>
+    <el-descriptions-item
+        label-class-name="label-bold"
+        label="Git Commit ID:" :span="2">{{ commit.hash }}</el-descriptions-item>
+  </el-descriptions>
+
+  <el-card
+      class="son-card"
+      style="background: none; box-shadow:none;border: none;">
+    <template #header>
+      <page-header>
+        <span style="font-size: 24px;font-family: 'Inter',sans-serif">提交列表</span>
+      </page-header>
+    </template>
+    <el-table :data="commit.records">
+      <el-table-column label="题目">
+        <template #default="scope">
+          <span>{{ scope.row.problem.name }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="状态" width="380">
+        <template #default="scope">
+        <span
+            :style="{color: buildStatusToColor(buildStatusToTagType(scope.row.status))}">
           {{ buildStatusToTagContent(scope.row.status) }}
-        </el-tag>
-      </template>
-    </el-table-column>
-    <el-table-column prop="score" label="分数" width="180" />
-    <el-table-column label="操作" width="260">
-      <template #default="scope">
-        <el-button
-            type="primary"
-            size="mini"
-            @click="$router.push(`${$route.path}/record/${scope.row.id}`)"
-        >详情</el-button>
-        <el-button
-            v-if="stopRecordButton(scope.row.status)"
-            type="danger"
-            size="mini"
-            @click="dialog.stop = scope.$index"
-        >
-          停止
-        </el-button>
-      </template>
-    </el-table-column>
-  </el-table>
+        </span>
+        </template>
+      </el-table-column>
+      <el-table-column prop="score" label="分数" width="220" />
+      <el-table-column label="操作" width="160">
+        <template #default="scope">
+          <el-button
+              type="text"
+              @click="$router.push(`${$route.path}/record/${scope.row.id}`)"
+          >详情</el-button>
+          <el-button
+              v-if="stopRecordButton(scope.row.status)"
+              type="danger"
+              size="mini"
+              @click="dialog.stop = scope.$index"
+          >
+            停止
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+  </el-card>
+
 </template>
 
 <script>
-import Paper from "@/views/ProblemPage/components/Paper";
 import {formatTimestamp, buildStatusToTagType, buildStatusToTagContent} from "@/utils/coder-utils";
+import PageHeader from "@/views/ProblemPage/components/PageHeader";
 
 export default {
   name: "CommitBoard",
-  components: {Paper},
+  components: {PageHeader},
   props: {
     commitId: {
       type: Number,
@@ -81,6 +99,20 @@ export default {
     formatTimestamp,
     buildStatusToTagType,
     buildStatusToTagContent,
+    buildStatusToColor(status) {
+      switch(status) {
+        case "success":
+          return this.$color.ElEMENT_COLOR.successColor;
+        case "warning":
+          return this.$color.ElEMENT_COLOR.warningColor;
+        case "danger":
+          return this.$color.ElEMENT_COLOR.errorColor;
+        case "info":
+          return this.$color.ElEMENT_COLOR.primaryColor;
+        case "":
+          return "black";
+      }
+    },
     stopRecordButton(status) {
       if (this.commit.createdAt !== undefined) {
         return (
@@ -96,6 +128,19 @@ export default {
 };
 </script>
 
-<style scoped>
+<style lang="scss" scoped>
+:deep .el-descriptions__body{
+  font-size: 16px;
+  background-color: #F8F9FB; //样式穿透,覆盖原本的样式
+}
+
+:deep .label-bold {
+  font-weight: 500;
+  font-size: 16px;
+}
 
+:deep .el-card__header {
+  border-bottom: none !important;
+  padding-bottom: 0 !important;
+}
 </style>

+ 101 - 74
src/views/ProblemPage/ProblemDetail.vue

@@ -1,6 +1,6 @@
 <template>
   <div id="problem-detail-body">
-    <el-card>
+    <el-card style="background: none; box-shadow:none;border: none">
       <template #header>
         <page-header>
           <template #actions>
@@ -28,81 +28,89 @@
               删除题目
             </el-button>
           </template>
-          <el-button @click="getBack">
-            <el-icon><Back /></el-icon>
+          <el-button @click="getBack" style="border: none;background: none;">
+            <el-icon :size="22"><Back /></el-icon>
           </el-button>
-          {{ problem.name }}
+          <span style="font-size: 36px;font-family: 'Inter',sans-serif;margin-left: 15px">{{ problem.name }}</span>
         </page-header>
       </template>
 
-      <paper shadow="sm" style="margin-bottom: 20px">
-        <el-descriptions>
-          <el-descriptions-item
-              label="题目名称:"
-              label-class-name="label-bold"
-          >
-            {{ problem.name }}
-          </el-descriptions-item>
-          <el-descriptions-item
-              label="题目类型:"
-              label-class-name="label-bold"
-          >
-            {{ typeTagContent }}
-          </el-descriptions-item>
-          <el-descriptions-item
-              label="上传者:"
-              label-class-name="label-bold"
-          >
-            {{ problem.creator ? problem.creator.username : "系统" }}
-          </el-descriptions-item>
-          <el-descriptions-item
-              label="上传时间:"
-              label-class-name="label-bold"
-          >
-            {{ formatTimestamp(problem.createdAt) }}
-          </el-descriptions-item>
-          <el-descriptions-item
-              :span="3"
-              label="题目描述:"
-              label-class-name="label-bold"
-          >
-            {{ problem.description }}
-          </el-descriptions-item>
-        </el-descriptions>
-      </paper>
+      <el-descriptions class="problem-description">
+        <el-descriptions-item
+            label="题目名称:"
+            label-class-name="label-bold"
+        >
+          {{ problem.name }}
+        </el-descriptions-item>
+        <el-descriptions-item
+            label="题目类型:"
+            label-class-name="label-bold"
+        >
+          {{ typeTagContent }}
+        </el-descriptions-item>
+        <el-descriptions-item
+            label="上传者:"
+            label-class-name="label-bold"
+        >
+          {{ problem.creator ? problem.creator.username : "系统" }}
+        </el-descriptions-item>
+        <el-descriptions-item
+            label="上传时间:"
+            label-class-name="label-bold"
+        >
+          {{ formatTimestamp(problem.createdAt) }}
+        </el-descriptions-item>
+        <el-descriptions-item
+            :span="3"
+            label="题目描述:"
+            label-class-name="label-bold"
+        >
+          {{ problem.description }}
+        </el-descriptions-item>
+      </el-descriptions>
+
+      <el-card
+          class="son-card"
+          style="background: none; box-shadow:none;border: none;margin-top: 15px;margin-bottom: 30px">
+        <template #header>
+          <span style="color:black;font-size: 24px;font-family: 'Inter',sans-serif">文件列表</span>
+        </template>
+
+        <div class="fill-card top-divide">
+          <el-table :data="files">
+            <el-table-column label="文件名称">
+              <template #default="scope">
+                <span>{{ scope.row.path }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="类型" width="200">
+              <template #default="scope">
+                <span>{{ scope.row.type }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="操作" width="220">
+              <template #default="scope">
+                <el-button
+                    size="small"
+                    type="text"
+                    @click="onGetDetail(scope.row.path)"
+                >
+                  查看详情
+                </el-button>
+                <el-button
+                    size="small"
+                    type="text"
+                    @click="onDialogUpdate(scope.row.path)"
+                >
+                  更新文件
+                </el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+
+      </el-card>
 
-      <div class="fill-card top-divide">
-        <el-table :data="files">
-          <el-table-column label="文件列表">
-            <template #default="scope">
-              <span>{{ scope.row.path }}</span>
-            </template>
-          </el-table-column>
-          <el-table-column label="类型" width="120">
-            <template #default="scope">
-              <span>{{ scope.row.type }}</span>
-            </template>
-          </el-table-column>
-          <el-table-column label="操作" width="220">
-            <template #default="scope">
-              <el-button
-                size="small"
-                type="text"
-                @click="onGetDetail(scope.row.path)"
-              >
-                查看详情
-              </el-button>
-              <el-button
-                size="small"
-                type="text"
-                @click="onDialogUpdate(scope.row.path)"
-              >
-                更新文件
-              </el-button>
-            </template>
-          </el-table-column>
-        </el-table>
-      </div>
     </el-card>
 
     <el-dialog v-model="dialog.delete" title="确认删除题目">
@@ -168,7 +176,6 @@
 
 <script>
 import PageHeader from "./components/PageHeader.vue";
-import Paper from "./components/Paper.vue";
 import {mapGetters} from "vuex";
 import {errorMessage, formatTimestamp, problemTypeToTagContent} from "@/utils/coder-utils";
 import {ElMessage} from "element-plus";
@@ -177,7 +184,6 @@ export default {
   name: "ProblemDetail",
   layout: "dashboard",
   components: {
-    Paper,
     PageHeader,
   },
   data() {
@@ -364,7 +370,7 @@ export default {
 };
 </script>
 
-<style lang="scss">
+<style lang="scss" scoped>
 #problem-detail-body {
   margin: 40px 10vw 80px 10vw;
   min-height: calc(100vh - 100px);
@@ -373,4 +379,25 @@ export default {
   font-weight: bold;
   font-size: 15px;
 }
+
+::v-deep .el-card__header {
+  border-bottom: 1px solid black;
+  padding-top: 0;
+  padding-bottom: 0;
+}
+
+::v-deep .son-card .el-card__header {
+  border-bottom: none;
+  padding-bottom: 0;
+}
+
+::v-deep .label-bold {
+  font-weight: 500;
+  font-size: 16px;
+}
+
+::v-deep .problem-description .el-descriptions__body{
+  font-size: 16px;
+  background-color: #F8F9FB; //样式穿透,覆盖原本的样式
+}
 </style>