|
|
@@ -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
|
|
|
};
|
|
|
}
|
|
|
});
|