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

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

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