|
|
@@ -58,7 +58,13 @@
|
|
|
></flat-pickr>
|
|
|
</b-field>
|
|
|
|
|
|
- <a class="button is-link" @click="createAssignment()"> 确认新建 </a>
|
|
|
+ <a
|
|
|
+ class="button is-link"
|
|
|
+ :class="{ 'is-loading': submitting }"
|
|
|
+ @click="createAssignment()"
|
|
|
+ >
|
|
|
+ 确认新建
|
|
|
+ </a>
|
|
|
</div>
|
|
|
</div>
|
|
|
</b-modal>
|
|
|
@@ -78,13 +84,13 @@
|
|
|
v-model="$v.searchContent.$model"
|
|
|
expanded
|
|
|
>
|
|
|
- <b-loading
|
|
|
- :is-full-page="false"
|
|
|
- :active.sync="isLoading"
|
|
|
- ></b-loading>
|
|
|
</b-input>
|
|
|
<p class="control">
|
|
|
- <button class="button is-link" @click="search(searchContent)">
|
|
|
+ <button
|
|
|
+ class="button is-link"
|
|
|
+ :class="{ 'is-loading': submitting }"
|
|
|
+ @click="search(searchContent)"
|
|
|
+ >
|
|
|
查找
|
|
|
</button>
|
|
|
</p>
|
|
|
@@ -95,8 +101,11 @@
|
|
|
|
|
|
<!--题目列表展示框-->
|
|
|
<b-modal :active.sync="isProblemListModalActive">
|
|
|
+ <b-notification type="is-danger" :active.sync="isServerError">
|
|
|
+ {{ errorMassage }}
|
|
|
+ </b-notification>
|
|
|
<div class="card">
|
|
|
- <div class="title">点击选择题目</div>
|
|
|
+ <div class="title">选择题目</div>
|
|
|
<div class="content">
|
|
|
<div class="question-list">
|
|
|
<b-table :data="questions" detailed detail-key="id">
|
|
|
@@ -144,13 +153,7 @@
|
|
|
</b-table-column>
|
|
|
</template>
|
|
|
<template slot="detail" slot-scope="props">
|
|
|
- <article class="media">
|
|
|
- <div class="media-content">
|
|
|
- <div class="content">
|
|
|
- <p class="detail-content">{{ props.row.description }}</p>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </article>
|
|
|
+ <div>{{ props.row.description }}</div>
|
|
|
</template>
|
|
|
</b-table>
|
|
|
</div>
|
|
|
@@ -205,7 +208,6 @@ export default {
|
|
|
isCreateModalActive: false,
|
|
|
isSearchModalActive: false,
|
|
|
isProblemListModalActive: false,
|
|
|
- isLoading: false,
|
|
|
startAtConfig: {
|
|
|
...this.getDefaultConfig(),
|
|
|
minDate: "today",
|
|
|
@@ -215,31 +217,41 @@ export default {
|
|
|
...this.getDefaultConfig(),
|
|
|
minDate: "today",
|
|
|
maxDate: null
|
|
|
- }
|
|
|
+ },
|
|
|
+ errorMassage: null,
|
|
|
+ isServerError: false,
|
|
|
+ submitting: false
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
/**
|
|
|
- * 准备新建或者修改
|
|
|
+ * 准备新建
|
|
|
*/
|
|
|
startCreation() {
|
|
|
+ if (this.submitting) return;
|
|
|
this.isSearchModalActive = true;
|
|
|
},
|
|
|
/**
|
|
|
* 搜索题目
|
|
|
- * @param content
|
|
|
- * @return {Promise<void>}
|
|
|
*/
|
|
|
async search(content) {
|
|
|
+ if (this.submitting) return;
|
|
|
+ this.isServerError = false;
|
|
|
this.$v.searchContent.$touch();
|
|
|
if (!this.$v.searchContent.$invalid) {
|
|
|
- this.isLoading = true;
|
|
|
- await getTeacherKeywordQuestions(content).then(res => {
|
|
|
- this.questions = res.data;
|
|
|
- });
|
|
|
- this.isLoading = false;
|
|
|
- this.isSearchModalActive = false;
|
|
|
- this.isProblemListModalActive = true;
|
|
|
+ this.submitting = true;
|
|
|
+ try {
|
|
|
+ await getTeacherKeywordQuestions(content).then(res => {
|
|
|
+ this.questions = res.data;
|
|
|
+ });
|
|
|
+ this.isSearchModalActive = false;
|
|
|
+ this.isProblemListModalActive = true;
|
|
|
+ } catch (e) {
|
|
|
+ this.errorMassage = e.message;
|
|
|
+ this.isServerError = true;
|
|
|
+ } finally {
|
|
|
+ this.submitting = false;
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
selectAndCreate(problem) {
|
|
|
@@ -249,11 +261,13 @@ export default {
|
|
|
this.isCreateModalActive = true;
|
|
|
},
|
|
|
/**
|
|
|
- * 确认新建或者修改
|
|
|
+ * 确认新建
|
|
|
*/
|
|
|
createAssignment() {
|
|
|
+ if (this.submitting) return;
|
|
|
this.$v.params.$touch();
|
|
|
if (!this.$v.params.$invalid) {
|
|
|
+ this.submitting = true;
|
|
|
this.isCreateModalActive = false;
|
|
|
this.params["type"] = this.postParam;
|
|
|
this.parseParams();
|
|
|
@@ -288,8 +302,7 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
- } else {
|
|
|
- console.log("参数太少");
|
|
|
+ this.submitting = false;
|
|
|
}
|
|
|
},
|
|
|
getDifficultyType(level) {
|
|
|
@@ -340,6 +353,7 @@ export default {
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
.card {
|
|
|
+ text-align: left;
|
|
|
padding: 30px;
|
|
|
.title {
|
|
|
font-size: 1.25rem;
|