|
|
@@ -105,60 +105,65 @@
|
|
|
<b-notification type="is-danger" :active.sync="isServerError">
|
|
|
{{ errorMassage }}
|
|
|
</b-notification>
|
|
|
- <div class="card">
|
|
|
- <div class="title">选择题目</div>
|
|
|
- <div class="content">
|
|
|
- <div class="question-list">
|
|
|
- <b-table :data="questions" detailed detail-key="id">
|
|
|
- <template slot-scope="props">
|
|
|
- <b-table-column
|
|
|
- field="id"
|
|
|
- label="ID"
|
|
|
- width="40"
|
|
|
- numeric
|
|
|
- sortable
|
|
|
- >
|
|
|
- {{ props.row.id }}
|
|
|
- </b-table-column>
|
|
|
- <b-table-column label="题目名称">
|
|
|
- <a @click="selectAndCreate(props.row)">{{
|
|
|
- props.row.name
|
|
|
- }}</a>
|
|
|
- </b-table-column>
|
|
|
- <b-table-column label="题目描述" width="100">
|
|
|
- <div class="description">{{ props.row.description }}</div>
|
|
|
- </b-table-column>
|
|
|
- <b-table-column
|
|
|
- field="difficulty"
|
|
|
- label="题目难度"
|
|
|
- sortable
|
|
|
- centered
|
|
|
- >
|
|
|
- <span
|
|
|
- :class="[
|
|
|
- 'tag',
|
|
|
- `${getDifficultyClass(props.row.difficulty)}`
|
|
|
- ]"
|
|
|
+ <div>
|
|
|
+ <div class="card" v-if="isAnyQuestion">
|
|
|
+ <div class="title">选择题目</div>
|
|
|
+ <div class="content">
|
|
|
+ <div class="question-list">
|
|
|
+ <b-table :data="questions" detailed detail-key="id">
|
|
|
+ <template slot-scope="props">
|
|
|
+ <b-table-column
|
|
|
+ field="id"
|
|
|
+ label="ID"
|
|
|
+ width="40"
|
|
|
+ numeric
|
|
|
+ sortable
|
|
|
>
|
|
|
- {{ getDifficultyType(props.row.difficulty) }}
|
|
|
- </span>
|
|
|
- </b-table-column>
|
|
|
+ {{ props.row.id }}
|
|
|
+ </b-table-column>
|
|
|
+ <b-table-column label="题目名称">
|
|
|
+ <a @click="selectAndCreate(props.row)">{{
|
|
|
+ props.row.name
|
|
|
+ }}</a>
|
|
|
+ </b-table-column>
|
|
|
+ <b-table-column label="题目描述" width="100">
|
|
|
+ <div class="description">{{ props.row.description }}</div>
|
|
|
+ </b-table-column>
|
|
|
+ <b-table-column
|
|
|
+ field="difficulty"
|
|
|
+ label="题目难度"
|
|
|
+ sortable
|
|
|
+ centered
|
|
|
+ >
|
|
|
+ <span
|
|
|
+ :class="[
|
|
|
+ 'tag',
|
|
|
+ `${getDifficultyClass(props.row.difficulty)}`
|
|
|
+ ]"
|
|
|
+ >
|
|
|
+ {{ getDifficultyType(props.row.difficulty) }}
|
|
|
+ </span>
|
|
|
+ </b-table-column>
|
|
|
|
|
|
- <b-table-column
|
|
|
- label="平均时长"
|
|
|
- field="expectTime"
|
|
|
- sortable
|
|
|
- centered
|
|
|
- >
|
|
|
- {{ props.row.expectTime }}分钟
|
|
|
- </b-table-column>
|
|
|
- </template>
|
|
|
- <template slot="detail" slot-scope="props">
|
|
|
- <div>{{ props.row.description }}</div>
|
|
|
- </template>
|
|
|
- </b-table>
|
|
|
+ <b-table-column
|
|
|
+ label="平均时长"
|
|
|
+ field="expectTime"
|
|
|
+ sortable
|
|
|
+ centered
|
|
|
+ >
|
|
|
+ {{ props.row.expectTime }}分钟
|
|
|
+ </b-table-column>
|
|
|
+ </template>
|
|
|
+ <template slot="detail" slot-scope="props">
|
|
|
+ <div>{{ props.row.description }}</div>
|
|
|
+ </template>
|
|
|
+ </b-table>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div class="card" v-else>
|
|
|
+ 没有查找到题目,请<a @click="reResearch()">重新查找</a>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</b-modal>
|
|
|
</div>
|
|
|
@@ -177,7 +182,7 @@ import { difficultyClass } from "@/data/questionDifficulty";
|
|
|
export default {
|
|
|
props: {
|
|
|
courseId: {
|
|
|
- type: String
|
|
|
+ type: Number
|
|
|
},
|
|
|
assignType: {
|
|
|
type: Number
|
|
|
@@ -207,6 +212,7 @@ export default {
|
|
|
problemName: "",
|
|
|
searchContent: "",
|
|
|
questions: [],
|
|
|
+ isAnyQuestion: false,
|
|
|
|
|
|
// 控制modal活动
|
|
|
isCreateModalActive: false,
|
|
|
@@ -262,6 +268,9 @@ export default {
|
|
|
this.isSearchModalActive = false;
|
|
|
this.loadingSearchQuestions = false;
|
|
|
this.isProblemListModalActive = true;
|
|
|
+ if (this.questions.length !== 0) {
|
|
|
+ this.isAnyQuestion = true;
|
|
|
+ }
|
|
|
});
|
|
|
} catch (e) {
|
|
|
this.errorMassage = e.message;
|
|
|
@@ -277,6 +286,15 @@ export default {
|
|
|
this.isProblemListModalActive = false;
|
|
|
this.isCreateModalActive = true;
|
|
|
},
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 重新查找
|
|
|
+ */
|
|
|
+ reResearch() {
|
|
|
+ this.isProblemListModalActive = false;
|
|
|
+ this.isSearchModalActive = true;
|
|
|
+ },
|
|
|
+
|
|
|
/**
|
|
|
* 确认新建
|
|
|
*/
|