|
@ -81,7 +81,7 @@ |
|
|
</div> |
|
|
</div> |
|
|
<!-- 提交次数 --> |
|
|
<!-- 提交次数 --> |
|
|
<div class="submit-times"> |
|
|
<div class="submit-times"> |
|
|
<span>您已提交0次,每个作业可以提交3次</span> |
|
|
|
|
|
|
|
|
<span>您已提交{{sub}}次,每个作业可以提交{{2-sub}}次</span> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
@ -97,7 +97,12 @@ import { ElMessage } from "element-plus"; |
|
|
import '@wangeditor/editor/dist/css/style.css' // 引入 css |
|
|
import '@wangeditor/editor/dist/css/style.css' // 引入 css |
|
|
import { onBeforeUnmount } from 'vue' |
|
|
import { onBeforeUnmount } from 'vue' |
|
|
import { Editor, Toolbar } from '@wangeditor/editor-for-vue' |
|
|
import { Editor, Toolbar } from '@wangeditor/editor-for-vue' |
|
|
|
|
|
import {useRoute, useRouter} from "vue-router"; |
|
|
|
|
|
|
|
|
|
|
|
const router = useRouter(); |
|
|
|
|
|
const route = useRoute(); |
|
|
|
|
|
let groupId = route.params.id; |
|
|
|
|
|
let sub = route.params.sub; |
|
|
// 编辑器实例,必须用 shallowRef |
|
|
// 编辑器实例,必须用 shallowRef |
|
|
const editorRefs = ref([]); |
|
|
const editorRefs = ref([]); |
|
|
|
|
|
|
|
@ -157,8 +162,9 @@ const handleCreated = (editor, questionIndex) => { |
|
|
|
|
|
|
|
|
const questionList = ref([]); |
|
|
const questionList = ref([]); |
|
|
|
|
|
|
|
|
function getQuestionList(id) { |
|
|
|
|
|
homeworkApi.getHomeworkQuestion(id).then(resp => { |
|
|
|
|
|
|
|
|
function getQuestionList() { |
|
|
|
|
|
console.log("ljghasjkhdjksahjkhsajkhjkasd",groupId); |
|
|
|
|
|
homeworkApi.getHomeworkQuestion(groupId).then(resp => { |
|
|
if (resp.code == 200) { |
|
|
if (resp.code == 200) { |
|
|
questionList.value = resp.data; |
|
|
questionList.value = resp.data; |
|
|
for (let i = 0; i < questionList.value.length; i++) { |
|
|
for (let i = 0; i < questionList.value.length; i++) { |
|
@ -174,7 +180,7 @@ function getQuestionList(id) { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
getQuestionList(1377); |
|
|
|
|
|
|
|
|
getQuestionList(); |
|
|
|
|
|
|
|
|
// 提交作业 |
|
|
// 提交作业 |
|
|
const homework = ref([]); |
|
|
const homework = ref([]); |
|
@ -185,8 +191,7 @@ questionList.value.forEach(() => { |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// 上一个页面传递的参数 groupId |
|
|
// 上一个页面传递的参数 groupId |
|
|
const groupId = 1379; |
|
|
|
|
|
function submit(groupId) { |
|
|
|
|
|
|
|
|
function submit() { |
|
|
homework.value = []; |
|
|
homework.value = []; |
|
|
for (let i = 0; i < questionList.value.length; i++) { |
|
|
for (let i = 0; i < questionList.value.length; i++) { |
|
|
if (questionList.value[i].type == 1 || questionList.value[i].type == 2) { |
|
|
if (questionList.value[i].type == 1 || questionList.value[i].type == 2) { |
|
@ -205,9 +210,12 @@ function submit(groupId) { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
homeworkApi.submitHomework(homework.value, 1379).then(resp => { |
|
|
|
|
|
|
|
|
let groupId = route.params.id; |
|
|
|
|
|
homeworkApi.submitHomework(homework.value, groupId).then(resp => { |
|
|
if (resp.code == 200) { |
|
|
if (resp.code == 200) { |
|
|
ElMessage.success("提交成功"); |
|
|
ElMessage.success("提交成功"); |
|
|
|
|
|
homework.value = []; |
|
|
|
|
|
router.push("/show"); |
|
|
} else { |
|
|
} else { |
|
|
ElMessage.error("未知错误,请联系管理员"); |
|
|
ElMessage.error("未知错误,请联系管理员"); |
|
|
} |
|
|
} |
|
|