diff --git a/work/src/views/DoHomeworkView.vue b/work/src/views/DoHomeworkView.vue
index 712894e..904b8fd 100644
--- a/work/src/views/DoHomeworkView.vue
+++ b/work/src/views/DoHomeworkView.vue
@@ -14,9 +14,7 @@
@@ -30,9 +28,7 @@
@@ -44,31 +40,15 @@
{{ questionIndex + 1 }}. {{ question.description }}
-
+
-
- handleCreated(editor, questionIndex)"
-
- />
+
+ handleCreated(editor, questionIndex)" />
@@ -81,7 +61,7 @@
- 您已提交{{sub}}次,每个作业可以提交3次
+ 您已提交{{ sub }}次,每个作业可以提交3次
@@ -97,12 +77,13 @@ import { ElMessage } from "element-plus";
import '@wangeditor/editor/dist/css/style.css' // 引入 css
import { onBeforeUnmount } from 'vue'
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
-import {useRoute, useRouter} from "vue-router";
+import { useRoute, useRouter } from "vue-router";
const router = useRouter();
const route = useRoute();
let groupId = route.params.id;
let sub = route.params.sub;
+
// 编辑器实例,必须用 shallowRef
const editorRefs = ref([]);
@@ -145,7 +126,7 @@ const toolbarConfig = {
const editorConfig = {
placeholder: '请输入内容...',
toolbarKeys: toolbarConfig.toolbarKeys
- }
+}
// 组件销毁时,也及时销毁编辑器
onBeforeUnmount(() => {
@@ -163,7 +144,6 @@ const handleCreated = (editor, questionIndex) => {
const questionList = ref([]);
function getQuestionList() {
- console.log("ljghasjkhdjksahjkhsajkhjkasd",groupId);
homeworkApi.getHomeworkQuestion(groupId).then(resp => {
if (resp.code == 200) {
questionList.value = resp.data;
@@ -194,6 +174,23 @@ questionList.value.forEach(() => {
function submit() {
homework.value = [];
for (let i = 0; i < questionList.value.length; i++) {
+ //如果有题目未作答,弹出提示
+ if (questionList.value[i].type == 1 || questionList.value[i].type == 2) {
+ if (selectedAnswers.value[i].length == 0) {
+ ElMessage.error("您有题目未作答");
+ return;
+ }
+ } else if (questionList.value[i].type == 3) {
+ //标题不能为空
+ if (editorTitles.value[i] == '') {
+ ElMessage.error("标题不能为空");
+ return;
+ }
+ if (editorTitles.value[i] == '') {
+ ElMessage.error("您有题目未作答");
+ return;
+ }
+ }
if (questionList.value[i].type == 1 || questionList.value[i].type == 2) {
homework.value.push({
"id": questionList.value[i].id,
@@ -212,7 +209,7 @@ function submit() {
}
let groupId = route.params.id;
let sub = route.params.sub;
- if (sub <=2){
+ if (sub <= 2) {
homeworkApi.submitHomework(homework.value, groupId).then(resp => {
if (resp.code == 200) {
ElMessage.success("提交成功");
@@ -222,7 +219,7 @@ function submit() {
ElMessage.error("未知错误,请联系管理员");
}
});
- }else {
+ } else {
ElMessage.error("提交失败您,已提交3次,每个作业可以提交3次");
}
}
@@ -267,12 +264,15 @@ function submit() {
}
.content::-webkit-scrollbar-track {
- background: #f1f1f1; /* 滚动条轨道的背景色 */
+ background: #f1f1f1;
+ /* 滚动条轨道的背景色 */
}
.content::-webkit-scrollbar-thumb {
- background: #d9d9d9; /* 滚动条滑块的颜色 */
- border-radius: 6px; /* 滑块的圆角 */
+ background: #d9d9d9;
+ /* 滚动条滑块的颜色 */
+ border-radius: 6px;
+ /* 滑块的圆角 */
}
.title {
@@ -309,25 +309,30 @@ function submit() {
height: 1rem;
/* 透明度 */
opacity: 0.8;
- cursor: pointer; /* 鼠标悬停时变成手的形状 */
+ cursor: pointer;
+ /* 鼠标悬停时变成手的形状 */
}
-.selected input[type="radio"]{
+
+.selected input[type="radio"] {
margin-right: 1%;
width: 1.2rem;
height: 1rem;
/* 透明度 */
opacity: 0.8;
- cursor: pointer; /* 鼠标悬停时变成手的形状 */
+ cursor: pointer;
+ /* 鼠标悬停时变成手的形状 */
}
/* 单选按钮选中时的样式 */
.selected input[type="radio"]:checked {
- accent-color: blue; /* 设置选中时的颜色为蓝色 */
+ accent-color: blue;
+ /* 设置选中时的颜色为蓝色 */
}
/* 多选按钮选中时的样式 */
.selected input[type="checkbox"]:checked {
- accent-color: blue; /* 设置选中时的颜色为蓝色 */
+ accent-color: blue;
+ /* 设置选中时的颜色为蓝色 */
}
.selected label {
diff --git a/work/src/views/WorksShowView.vue b/work/src/views/WorksShowView.vue
index 7919230..3d59138 100644
--- a/work/src/views/WorksShowView.vue
+++ b/work/src/views/WorksShowView.vue
@@ -98,6 +98,7 @@ body {
width: 50%;
/* 如果需要,也可以设置宽度 */
padding-top: 4%;
+
}
@@ -183,7 +184,7 @@ body {
height: 30%;
/* 设置高度,根据需要调整 */
width: 50%;
- /* 如果需要,也可以设置宽度 */
+ /* 如果内容超过两行,省略号显示 */
}
.work-content {