提交 523bbbb5 authored 作者: 王鹏飞's avatar 王鹏飞

chore:课程作业简答题增加表单校验

上级 c63d00a8
...@@ -86,11 +86,14 @@ export default { ...@@ -86,11 +86,14 @@ export default {
} }
}, },
chapterWork: { chapterWork: {
immediate: true,
handler(data) { handler(data) {
this.questions = data.questions.map(item => { if (data.questions && data.questions.length) {
return Object.assign({}, item, { file_url: '', descreption: '' }) this.questions = data.questions.map(item => {
}) return Object.assign({}, item, { file_url: '', descreption: '' })
this.loadAjax() })
this.loadAjax()
}
} }
} }
}, },
...@@ -143,6 +146,11 @@ export default { ...@@ -143,6 +146,11 @@ export default {
}, 500) }, 500)
}, },
submitWork() { submitWork() {
const emptyValue = this.questions.find(item => item.descreption === '')
if (emptyValue) {
this.$message.error('请填写内容')
return
}
const loading = this.$loading({ const loading = this.$loading({
lock: true, lock: true,
text: '', text: '',
...@@ -183,3 +191,9 @@ export default { ...@@ -183,3 +191,9 @@ export default {
} }
} }
</script> </script>
<style lang="scss" scoped>
::v-deep .upload {
margin: 10px 0 20px;
}
</style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论