Просмотр исходного кода

v0.2.1 feat.批改提交异常解决

xiaoyu 2 лет назад
Родитель
Сommit
5e6d9ef7ce

+ 0 - 74
src/views/CorrectPage/component/RatingComponent.vue

@@ -1,74 +0,0 @@
-<!--
-  Description: 批改页面教师评论组件
-  Author: XiaoYu
-  Created Date: 重写于2024-8-2
--->
-
-
-<template>  
-  <div class="rating-component">
-    <div class="rating-lable">评分:</div>  
-    <input  
-      type="number"  
-      v-model.number="localScore"  
-      :min="1"  
-      :max="100"  
-      @input="validateScore"  
-      placeholder="请输入1~100的分数"  
-    />  
-  </div>  
-</template>  
-  
-<script>  
-export default {  
-  name: 'RatingComponent',  
-  props: {  
-    value: {  
-      type: Number,  
-      default: 0,  
-    },  
-  },  
-  data() {  
-    return {  
-      localScore: this.value, // 使用本地数据来维护当前分数  
-    };  
-  },  
-  watch: {  
-    // 监听本地分数的变化,并通知父组件  
-    localScore(newValue) {  
-      this.$emit('input', newValue);  
-    },  
-    // 监听父组件通过 v-model 传递的值的变化  
-    value(newValue) {  
-      if (newValue !== this.localScore) {  
-        this.localScore = newValue;  
-      }  
-    },  
-  },  
-  
-};  
-</script>  
-  
-
-<style scoped>  
-.rating-component {  
-  display: flex; /* 应用Flexbox布局 */  
-  align-items: center; /* 垂直居中子元素 */   
-  padding: 10px;  
-  border: 1px solid #ccc;  
-  border-radius: 5px;  
-}  
-  
-.rating-label {  
-  margin-right: 10px; /* 右侧间距,以便输入框不会紧贴着文字 */  
-}  
-  
-.rating-component input {  
-  /* 输入框的样式 */  
-  width: 300px;
-  padding: 8px;  
-  margin-right: 100px; /* 右侧间距,以便按钮不会紧贴着输入框 */  
-}  
-  
- 
-</style>

+ 48 - 21
src/views/Home/component/Remark/Remark.vue

@@ -3,13 +3,26 @@
   Author: XiaoYu
   Created Date: 2024-7-18
 -->
-
+<!-- 
+Attention: 创建作业和批改作业的老师须是同一位
+英语作文第一次作业的老师信息:
+"officialNumber": "2401016",
+"password": "309aabad-a151-42c3-b726-530fc426c5e2"
+-->
 <template>  
   <div>  
     <!-- 评分小组件 -->
      <div class="rating-component">
-      <rating-component v-model="correction.score" />  
+      <span>评分:&nbsp;&nbsp;</span>
+      <input
+        type="number"
+        class="score-input"  
+        :min="1"  
+        :max="100"  
+        placeholder="请输入1~100的分数"  
+        v-model="correction.score"/>
      </div>  
+     
     
     <div class="textarea">
       <!-- 评论输入框 -->  
@@ -23,11 +36,8 @@
   
 <script lang="ts">  
 import "./index.scss"
-import RatingComponent from '@/views/CorrectPage/component/RatingComponent.vue'; // 假设评分小组件是本地的Vue文件  
-import { useRoute } from 'vue-router'  
 import useApis from "@/apis";
-import { useStore } from "@/store";
-import { ElMessage } from "element-plus";
+import {  ElMessage } from "element-plus";
 import router from '@/router';
 
 export default { 
@@ -54,27 +64,44 @@ export default {
   }, 
   
   methods: {  
-    async handleCorrect() {  
+    async handleCorrect() {
       const apis = useApis();
-      try {
-        const response = await apis.engagementCorrect(this.studentId, this.assignmentId, this.correction);
-        console.log(response);
-        ElMessage.success(response.data.data);
-        router.push(`/home/myCorrect/assignment/${this.assignmentId}`);
-      } catch (err) {
-        console.error('提交失败', err);
-        ElMessage.error('提交失败');
-      }
+      console.log(this.correction)
+      await apis.engagementCorrect(this.studentId, this.assignmentId, this.correction)
+            .then(res =>{
+              if(res.data.code === 200 ){
+                ElMessage.success("批改成功");
+                router.push(`/home/myCorrect/assignment/${this.assignmentId}`);
+              }else{
+                ElMessage.error("批改异常"+res.data.msg)
+                console.log(res)
+              }
+
+            }).catch(err=>{
+              console.log(err)
+            })
     }
   },  
   
-  // 如果你使用的是单文件组件,不要忘了在components选项中注册评分小组件  
-  components: {  
-    RatingComponent
-  }
 }  
 </script>  
   
 <style scoped>
-/* 添加你的样式 */
+.score-input {  
+    /* 设置边框样式 */  
+    border: 2px solid #597D3B; /* 蓝色边框 */  
+    border-radius: 5px; /* 边框圆角 */  
+  
+    /* 设置背景色和字体样式 */  
+    background-color: #f8f9fa; /* 浅灰色背景 */  
+    color: #212529; /* 深色字体 */  
+    font-size: 16px; /* 字体大小 */  
+    padding: 8px 12px; /* 内边距 */  
+  
+    /* 设置焦点时的样式 */  
+    &:focus {  
+        border-color: #597D3B; /* 聚焦时边框颜色变深 */  
+        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); /* 聚焦时添加阴影效果 */  
+    }
+}  
 </style>