提交 59f43674 authored 作者: 王鹏飞's avatar 王鹏飞

chore:课程作业考试提交按钮增加loading状态

上级 5c2b0467
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
</template> </template>
<div class="exam-buttons"> <div class="exam-buttons">
<el-tooltip effect="dark" content="提交之后就不能修改了哦" placement="right"> <el-tooltip effect="dark" content="提交之后就不能修改了哦" placement="right">
<el-button type="primary" @click="onSubmit">{{submitText}}</el-button> <el-button type="primary" :loading="submitLoading" @click="onSubmit">{{submitText}}</el-button>
</el-tooltip> </el-tooltip>
</div> </div>
</el-form> </el-form>
...@@ -78,7 +78,8 @@ export default { ...@@ -78,7 +78,8 @@ export default {
messageInstance: null, messageInstance: null,
exam: {}, exam: {},
isStartExam: false, // 是否开始考试 isStartExam: false, // 是否开始考试
autoSubmitTimer: null // 自动提交定时器 autoSubmitTimer: null, // 自动提交定时器
submitLoading: false
} }
}, },
watch: { watch: {
...@@ -265,6 +266,7 @@ export default { ...@@ -265,6 +266,7 @@ export default {
}, },
// 请求提交接口 // 请求提交接口
handleSubmitRequest(params) { handleSubmitRequest(params) {
this.submitLoading = true
params.paper_type = 0 params.paper_type = 0
api api
.submitCourseExam(this.sid, this.cid, this.pid, params) .submitCourseExam(this.sid, this.cid, this.pid, params)
...@@ -284,6 +286,9 @@ export default { ...@@ -284,6 +286,9 @@ export default {
.catch(error => { .catch(error => {
this.$message.error(error.message) this.$message.error(error.message)
}) })
.finally(() => {
this.submitLoading = false
})
} }
}, },
beforeMount() { beforeMount() {
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
></exam-item> ></exam-item>
<div class="exam-buttons"> <div class="exam-buttons">
<el-tooltip effect="dark" content="提交之后就不能修改了哦" placement="right"> <el-tooltip effect="dark" content="提交之后就不能修改了哦" placement="right">
<el-button type="primary" @click="onSubmit">{{submitText}}</el-button> <el-button type="primary" :loading="submitLoading" @click="onSubmit">{{submitText}}</el-button>
</el-tooltip> </el-tooltip>
</div> </div>
</el-form> </el-form>
...@@ -52,7 +52,8 @@ export default { ...@@ -52,7 +52,8 @@ export default {
detail: null, detail: null,
questions: [], // 问题列表 questions: [], // 问题列表
startTime: new Date().getTime(), // 进入时间 startTime: new Date().getTime(), // 进入时间
messageInstance: null messageInstance: null,
submitLoading: false
} }
}, },
watch: { watch: {
...@@ -247,6 +248,7 @@ export default { ...@@ -247,6 +248,7 @@ export default {
}, },
// 请求提交接口 // 请求提交接口
handleSubmitRequest(params) { handleSubmitRequest(params) {
this.submitLoading = true
api api
.sbumitChapterHomework(params) .sbumitChapterHomework(params)
.then(response => { .then(response => {
...@@ -259,6 +261,9 @@ export default { ...@@ -259,6 +261,9 @@ export default {
.catch(error => { .catch(error => {
this.$message.error(error.message) this.$message.error(error.message)
}) })
.finally(() => {
this.submitLoading = false
})
} }
}, },
beforeMount() { beforeMount() {
......
...@@ -69,8 +69,9 @@ ...@@ -69,8 +69,9 @@
<el-tooltip content="在获老师批改之前,可以多次提交,将以最后一次提交为准" placement="right"> <el-tooltip content="在获老师批改之前,可以多次提交,将以最后一次提交为准" placement="right">
<el-button <el-button
type="primary" type="primary"
@click="onSubmit"
:disabled="disabled || !isWorkTime" :disabled="disabled || !isWorkTime"
:loading="submitLoading"
@click="onSubmit"
>{{ submitText }}</el-button> >{{ submitText }}</el-button>
</el-tooltip> </el-tooltip>
</div> </div>
...@@ -115,7 +116,8 @@ export default { ...@@ -115,7 +116,8 @@ export default {
startTime: new Date().getTime(), // 进入时间 startTime: new Date().getTime(), // 进入时间
messageInstance: null, messageInstance: null,
deadline: '', // 截止时间 deadline: '', // 截止时间
disabled: false disabled: false,
submitLoading: false
} }
}, },
watch: { watch: {
...@@ -295,6 +297,7 @@ export default { ...@@ -295,6 +297,7 @@ export default {
}, },
// 请求提交接口 // 请求提交接口
handleSubmitRequest(params) { handleSubmitRequest(params) {
this.submitLoading = true
api api
.sbumitChapterHomework(params) .sbumitChapterHomework(params)
.then(response => { .then(response => {
...@@ -308,6 +311,9 @@ export default { ...@@ -308,6 +311,9 @@ export default {
.catch(error => { .catch(error => {
this.$message.error(error.message) this.$message.error(error.message)
}) })
.finally(() => {
this.submitLoading = false
})
}, },
// 重新编辑 // 重新编辑
onReEdit() { onReEdit() {
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
</template> </template>
<div class="exam-buttons"> <div class="exam-buttons">
<el-tooltip effect="dark" content="提交之后就不能修改了哦" placement="right"> <el-tooltip effect="dark" content="提交之后就不能修改了哦" placement="right">
<el-button type="primary" @click="onSubmit">{{submitText}}</el-button> <el-button type="primary" :loading="submitLoading" @click="onSubmit">{{submitText}}</el-button>
</el-tooltip> </el-tooltip>
</div> </div>
</el-form> </el-form>
...@@ -83,7 +83,8 @@ export default { ...@@ -83,7 +83,8 @@ export default {
exam: {}, exam: {},
isStartExam: false, // 是否开始考试 isStartExam: false, // 是否开始考试
autoSubmitTimer: null, // 自动提交定时器 autoSubmitTimer: null, // 自动提交定时器
checkStatusTimer: null // 考试状态定时器 checkStatusTimer: null, // 考试状态定时器
submitLoading: false
} }
}, },
computed: { computed: {
...@@ -287,6 +288,7 @@ export default { ...@@ -287,6 +288,7 @@ export default {
}, },
// 请求提交接口 // 请求提交接口
handleSubmitRequest(params) { handleSubmitRequest(params) {
this.submitLoading = true
api api
.submitCourseExam(this.sid, this.cid, this.pid, params) .submitCourseExam(this.sid, this.cid, this.pid, params)
.then(response => { .then(response => {
...@@ -305,6 +307,9 @@ export default { ...@@ -305,6 +307,9 @@ export default {
.catch(error => { .catch(error => {
this.$message.error(error.message) this.$message.error(error.message)
}) })
.finally(() => {
this.submitLoading = false
})
} }
}, },
beforeMount() { beforeMount() {
......
...@@ -62,7 +62,12 @@ ...@@ -62,7 +62,12 @@
</div> </div>
<div class="buttons"> <div class="buttons">
<el-tooltip content="在获老师批改之前,可以多次提交,将以最后一次提交为准" placement="right"> <el-tooltip content="在获老师批改之前,可以多次提交,将以最后一次提交为准" placement="right">
<el-button type="primary" @click="onSubmit" :disabled="isRevised">{{submitText}}</el-button> <el-button
type="primary"
:disabled="isRevised"
:loading="submitLoading"
@click="onSubmit"
>{{submitText}}</el-button>
</el-tooltip> </el-tooltip>
</div> </div>
</template> </template>
...@@ -117,7 +122,8 @@ export default { ...@@ -117,7 +122,8 @@ export default {
}, },
detail: null, detail: null,
loading: false, loading: false,
messageInstance: null messageInstance: null,
submitLoading: false
} }
}, },
computed: { computed: {
...@@ -179,6 +185,7 @@ export default { ...@@ -179,6 +185,7 @@ export default {
}, },
// 请求提交接口 // 请求提交接口
handleSubmitRequest(params) { handleSubmitRequest(params) {
this.submitLoading = true
api api
.updateCourseWork(this.sid, this.cid, params) .updateCourseWork(this.sid, this.cid, params)
.then(response => { .then(response => {
...@@ -192,6 +199,9 @@ export default { ...@@ -192,6 +199,9 @@ export default {
.catch(error => { .catch(error => {
this.$message.error(error.message) this.$message.error(error.message)
}) })
.finally(() => {
this.submitLoading = false
})
} }
}, },
beforeMount() { beforeMount() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论