xiaoyu 2 yıl önce
ebeveyn
işleme
0ae560054e

+ 0 - 2
src/views/CorrectPage/CorrectPage.vue

@@ -9,7 +9,6 @@
       <!-- 写作题目 及 作文内容 -->
       <div class="my-correct-header">
         <StudentWritingRequirements /> 
-        <!-- TODO:怎么这么难写!!! -->
         <StudentEssay :studentId = "studentId" :assignmentId="assignmentId"/> 
       </div>
       
@@ -21,7 +20,6 @@
         </div>
         
         <!-- 教师评分、修改意见及评价 -->
-        <!--新修改:评分小组件放入Remark组件中了  -->
         <div class="my-correct-item">
             
             <Remark :studentId = "studentId" :assignmentId="assignmentId"/>              

+ 25 - 9
src/views/Home/component/Remark/Remark.vue

@@ -7,25 +7,31 @@
         class="score-input"  
         :min="1"  
         :max="100"  
-        placeholder="请输入1~100的分数"  
-        v-model="correction.score"  
+        placeholder="暂无分数"
+        title="请输入0~100间的数字"  
+        v-model="correction.score" 
+        :disabled="isStudent" 
       />  
     </div>  
   
-    <div class="textarea">  
-      <textarea v-model="correction.remark" placeholder="请输入评语"></textarea>  
+    <div class="textarea" >  
+      <textarea v-model="correction.remark" placeholder="暂无评语" :readonly="isStudent"></textarea>  
     </div>  
   
-    <el-button color="#597D3B" @click="handleCorrect">提交批改</el-button>  
+    <el-button color="#597D3B" @click="handleCorrect" :disabled="isStudent">提交批改</el-button>  
   </div>  
 </template>  
   
 <script lang="ts">  
-import { defineComponent, ref, onMounted } from 'vue';  
+import { defineComponent, ref, onMounted, computed } from 'vue';  
 import useApis from "@/apis";  
 import { ElMessage } from "element-plus";  
 import router from '@/router';  
 import "./index.scss"
+import {useStore} from "@/store";
+
+const store = useStore()
+
 
 export default defineComponent({  
   props: {  
@@ -39,6 +45,9 @@ export default defineComponent({
     }  
   },  
   setup(props) {
+
+    const isStudent = computed(() => store.user.role === 'STUDENT');  
+
     //定义一个correction接收后端传过来的批改信息(如果有) 
     const correction = ref({  
       score: 0,  
@@ -68,8 +77,12 @@ export default defineComponent({
       fetchCorrection();  
     });  
   
-    const handleCorrect = async () => {  
-      const apis = useApis();  
+    const handleCorrect = async () => { 
+      if (isStudent.value) {  
+        ElMessage.error("学生不能提交批改");  
+        return;  
+      }else{
+        const apis = useApis();  
       try {  
         await apis.engagementCorrect(props.studentId, props.assignmentId, correction.value)  
           .then(res => {  
@@ -83,11 +96,14 @@ export default defineComponent({
       } catch (err) {  
         console.log(err)
       }  
+      }   
+      
     };  
   
     return {  
       correction,  
-      handleCorrect  
+      handleCorrect,
+      isStudent  
     };  
   }  
 });  

+ 4 - 2
src/views/Home/component/Remark/index.scss

@@ -14,8 +14,10 @@
 } 
 .score-input {  
   /* 设置边框样式 */  
-  border: 2px solid #597D3B; /* 蓝色边框 */  
+  border: 2px solid #597D3B;  
   border-radius: 5px; /* 边框圆角 */  
+  width: 15%;
+  
 
   /* 设置背景色和字体样式 */  
   background-color: #f8f9fa; /* 浅灰色背景 */  
@@ -38,5 +40,5 @@ textarea {
   padding: 10px; // 内边距   
   border: 1px solid #ccc; // 边框  
   border-radius: 4px; // 边框圆角  
-  // 其他样式...  
+  font-size: 18px;  
 }   

+ 2 - 4
src/views/Home/component/StudentEssay/StudentEssay.vue

@@ -16,14 +16,13 @@
       </div>
 
         <!-- 最后使用的在线预览是Office Web Viewer(微软) -->
+         <!-- TODO:如果height不用绝对值而是百分比,则无法调整,一直是半边的 -->
     <div class="iframe-wrapper">  
         <iframe
             :src="officeUrl"
             frameborder="0"
             width="100%"
-            height="560px"
-            
-
+            height="560px" 
         >
         </iframe>
     </div>
@@ -113,4 +112,3 @@ const props = defineProps<{
 } 
 </style>
 
-<!-- 注意:确保在父组件或全局范围内注册了 VueOfficeDocx 组件 -->

+ 13 - 0
src/views/HomeworkPage/index.vue

@@ -42,6 +42,14 @@
           </el-button>
         </template>
       </el-table-column>
+      <el-table-column label="查看">
+        <template #default="scope">
+          <el-button @click="viewCorrection(scope.row.assignmentId,store.user.id)" style="margin-right: 0; margin-left: 0;padding-left: 10px; padding-right: 10px" color="#597D3B">
+            <el-icon style="margin-right: 3px"><ZoomIn/></el-icon>
+            批改结果
+          </el-button>
+        </template>
+      </el-table-column>
     </el-table>
 
     <el-pagination
@@ -100,6 +108,11 @@
     pages: 1,
     total: null,
   })
+  //  查看教师批改结果 跳转至批改页面
+  const viewCorrection = (assignmentId:number,studentId:number) => {
+    router.push(`/home/assignment/${assignmentId}/correct?studentId=${studentId}`)
+
+  }
 
   const handleShowDetail = (assignmentId:number) => {
     router.push(`/home/homeworkDetail/${assignmentId}`)