|
|
@@ -77,23 +77,9 @@
|
|
|
<div class="card">
|
|
|
<div class="title">{{ modal.title }}</div>
|
|
|
<div class="content">
|
|
|
- <div v-if="display">
|
|
|
- <b-field label="查找题目"></b-field>
|
|
|
- <b-field :type="$v.searchContent.$error ? 'is-danger' : ''">
|
|
|
- <b-input
|
|
|
- placeholder="输入关键字模糊查找"
|
|
|
- type="search"
|
|
|
- v-model="$v.searchContent.$model"
|
|
|
- expanded
|
|
|
- >
|
|
|
- </b-input>
|
|
|
- <p class="control">
|
|
|
- <button class="button is-link" @click="search(searchContent)">
|
|
|
- 查找
|
|
|
- </button>
|
|
|
- </p>
|
|
|
- </b-field>
|
|
|
- </div>
|
|
|
+ <b-field label="题目名称" v-if="display">
|
|
|
+ <b-input v-model="$v.problemName.$model"></b-input>
|
|
|
+ </b-field>
|
|
|
<b-field
|
|
|
label="作业名称"
|
|
|
:type="$v.params.name.$error ? 'is-danger' : ''"
|
|
|
@@ -140,9 +126,101 @@
|
|
|
></flat-pickr>
|
|
|
</b-field>
|
|
|
|
|
|
- <a class="button is-link" @click="createDocAssignment()">{{
|
|
|
- modal.submit
|
|
|
- }}</a>
|
|
|
+ <a class="button is-link" @click="createDocAssignment()">
|
|
|
+ {{ modal.submit }}
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </b-modal>
|
|
|
+
|
|
|
+ <!--选择题目模态框-->
|
|
|
+ <b-modal :active.sync="isProblemModalActive">
|
|
|
+ <div class="card">
|
|
|
+ <div class="title">请先查找题目</div>
|
|
|
+ <div class="content">
|
|
|
+ <b-field :type="$v.searchContent.$error ? 'is-danger' : ''">
|
|
|
+ <b-input
|
|
|
+ placeholder="输入关键字模糊查找"
|
|
|
+ type="search"
|
|
|
+ v-model="$v.searchContent.$model"
|
|
|
+ expanded
|
|
|
+ >
|
|
|
+ </b-input>
|
|
|
+ <p class="control">
|
|
|
+ <button class="button is-link" @click="search(searchContent)">
|
|
|
+ 查找
|
|
|
+ </button>
|
|
|
+ </p>
|
|
|
+ </b-field>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </b-modal>
|
|
|
+
|
|
|
+ <!--搜索题目展示框-->
|
|
|
+ <b-modal :active.sync="isProblemListModalActive">
|
|
|
+ <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="400">
|
|
|
+ <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">
|
|
|
+ <article class="media">
|
|
|
+ <div class="media-content">
|
|
|
+ <div class="content">
|
|
|
+ <p class="detail-content">{{ props.row.description }}</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </article>
|
|
|
+ </template>
|
|
|
+ </b-table>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</b-modal>
|
|
|
@@ -153,7 +231,7 @@
|
|
|
import PageHeader from "@/components/PageHeader";
|
|
|
import PageBody from "@/components/PageBody/index";
|
|
|
import { getDocAssignmentListTeacherByCrs } from "@/api/assignment";
|
|
|
-import { getQuestionDetail } from "@/api/question";
|
|
|
+import { getTeacherKeywordQuestions } from "@/api/question";
|
|
|
import { postDocAssignment } from "@/api/assignment";
|
|
|
import { putDocAssignment } from "@/api/assignment";
|
|
|
import { delDocAssignment } from "@/api/assignment";
|
|
|
@@ -161,6 +239,8 @@ import timeMixins from "@/mixins/time";
|
|
|
import { required } from "vuelidate/lib/validators";
|
|
|
import pathMixins from "@/mixins/path";
|
|
|
import { mapState } from "vuex";
|
|
|
+import { difficultyType } from "@/data/questionDifficulty";
|
|
|
+import { difficultyClass } from "@/data/questionDifficulty";
|
|
|
|
|
|
export default {
|
|
|
computed: {
|
|
|
@@ -174,15 +254,15 @@ export default {
|
|
|
},
|
|
|
mixins: [timeMixins, pathMixins],
|
|
|
mounted() {
|
|
|
- console.log(this.course.id);
|
|
|
getDocAssignmentListTeacherByCrs(this.course.id).then(res => {
|
|
|
this.docData = res.data;
|
|
|
});
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ problemName: "",
|
|
|
searchContent: "",
|
|
|
- question: {},
|
|
|
+ questions: [],
|
|
|
docData: [],
|
|
|
params: {
|
|
|
name: null,
|
|
|
@@ -193,12 +273,14 @@ export default {
|
|
|
},
|
|
|
// 返回的文档作业信息
|
|
|
isCardModalActive: false,
|
|
|
+ isProblemModalActive: false,
|
|
|
+ isProblemListModalActive: false,
|
|
|
modal: {
|
|
|
title: "新建文档作业",
|
|
|
submit: "确认创建"
|
|
|
},
|
|
|
flag: -1, //区分创建还是修改
|
|
|
- display: true,
|
|
|
+ display: false, //展示新建题目的名称
|
|
|
startAtConfig: {
|
|
|
...this.getDefaultConfig(),
|
|
|
minDate: "today",
|
|
|
@@ -211,35 +293,7 @@ export default {
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
- validations: {
|
|
|
- params: {
|
|
|
- name: {
|
|
|
- required
|
|
|
- },
|
|
|
- description: {
|
|
|
- required
|
|
|
- },
|
|
|
- startAt: {
|
|
|
- required
|
|
|
- },
|
|
|
- endAt: {
|
|
|
- required
|
|
|
- }
|
|
|
- // problem: {
|
|
|
- // required
|
|
|
- // }
|
|
|
- },
|
|
|
- searchContent: {
|
|
|
- required
|
|
|
- }
|
|
|
- },
|
|
|
- watch: {
|
|
|
- isCardModalActive(newValue) {
|
|
|
- if (newValue === false) {
|
|
|
- this.$v.$reset();
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
+
|
|
|
methods: {
|
|
|
/**
|
|
|
* 搜索题目
|
|
|
@@ -247,33 +301,29 @@ export default {
|
|
|
* @return {Promise<void>}
|
|
|
*/
|
|
|
async searchAssis(content) {
|
|
|
- console.log(content);
|
|
|
- await getQuestionDetail().then(res => {
|
|
|
- this.question = res.data;
|
|
|
+ await getTeacherKeywordQuestions(content).then(res => {
|
|
|
+ this.questions = res.data;
|
|
|
});
|
|
|
},
|
|
|
search(content) {
|
|
|
this.searchAssis(content).then(() => {
|
|
|
- this.params.problem = this.question.id;
|
|
|
- this.searchContent = this.question.name;
|
|
|
- this.$dialog.alert({
|
|
|
- title: "题目信息",
|
|
|
- message: `<strong>题目名称</strong><br/>
|
|
|
- ${this.question.name}<br/>
|
|
|
- <strong>题目描述</strong><br/>
|
|
|
- ${this.question.description}<br/>
|
|
|
- <strong>期望时间</strong><br/>
|
|
|
- ${this.question.expectTime}<br/>
|
|
|
- <strong>题目难度</strong><br/>
|
|
|
- ${this.question.difficulty}<br/>
|
|
|
- `,
|
|
|
- confirmText: "OK"
|
|
|
- });
|
|
|
+ this.isProblemModalActive = false;
|
|
|
+ this.isProblemListModalActive = true;
|
|
|
});
|
|
|
},
|
|
|
+ selectAndCreate(problem) {
|
|
|
+ console.log(problem);
|
|
|
+ this.modal.title = "新建文档作业";
|
|
|
+ this.modal.submit = "确认创建";
|
|
|
+ this.params.problem = problem.id;
|
|
|
+ this.isProblemListModalActive = false;
|
|
|
+ this.display = true;
|
|
|
+ this.isCardModalActive = true;
|
|
|
+ this.problemName = problem.name;
|
|
|
+ },
|
|
|
|
|
|
/**
|
|
|
- * 确定删除
|
|
|
+ * 确定删除(模块正常)
|
|
|
* @param id
|
|
|
*/
|
|
|
confirmDelete(id) {
|
|
|
@@ -294,11 +344,9 @@ export default {
|
|
|
} else {
|
|
|
this.$dialog.alert({
|
|
|
title: "删除失败",
|
|
|
- message: res.msg,
|
|
|
+ message: `${res.msg}`,
|
|
|
type: "is-danger",
|
|
|
- hasIcon: true,
|
|
|
- icon: "times-circle",
|
|
|
- iconPack: "fa"
|
|
|
+ hasIcon: true
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
@@ -310,14 +358,12 @@ export default {
|
|
|
* @param id
|
|
|
*/
|
|
|
updateInfo(id) {
|
|
|
- this.isCardModalActive = true;
|
|
|
if (id === -1) {
|
|
|
// 准备新建
|
|
|
- this.display = true;
|
|
|
- this.modal.title = "新建文档作业";
|
|
|
- this.modal.submit = "确认创建";
|
|
|
+ this.isProblemModalActive = true;
|
|
|
this.flag = -1;
|
|
|
} else {
|
|
|
+ this.isCardModalActive = true;
|
|
|
this.display = false;
|
|
|
// 准备修改
|
|
|
this.modal.title = "修改文档作业";
|
|
|
@@ -326,9 +372,6 @@ export default {
|
|
|
if (item.id === id) {
|
|
|
this.params.name = item.name;
|
|
|
this.params.description = item.description;
|
|
|
- // 以下两项无效
|
|
|
- this.params.startAt = item.startAt;
|
|
|
- this.params.endAt = item.endAt;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
@@ -338,9 +381,10 @@ export default {
|
|
|
/**
|
|
|
* 确认新建或者修改
|
|
|
*/
|
|
|
- createDocAssignment() {
|
|
|
+ createDocAssignment(dd) {
|
|
|
+ console.log(dd);
|
|
|
this.$v.$touch();
|
|
|
- if (!this.$v.$invalid) {
|
|
|
+ if (!this.$v.params.$invalid) {
|
|
|
this.isCardModalActive = false;
|
|
|
if (this.flag === -1) {
|
|
|
// 确认新建作业
|
|
|
@@ -358,9 +402,7 @@ export default {
|
|
|
title: "创建失败",
|
|
|
message: res.msg,
|
|
|
type: "is-danger",
|
|
|
- hasIcon: true,
|
|
|
- icon: "times-circle",
|
|
|
- iconPack: "fa"
|
|
|
+ hasIcon: true
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
@@ -380,13 +422,51 @@ export default {
|
|
|
title: "修改失败",
|
|
|
message: res.msg,
|
|
|
type: "is-danger",
|
|
|
- hasIcon: true,
|
|
|
- icon: "times-circle",
|
|
|
- iconPack: "fa"
|
|
|
+ hasIcon: true
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ } else {
|
|
|
+ console.log("无效");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getDifficultyType(level) {
|
|
|
+ return difficultyType(level);
|
|
|
+ },
|
|
|
+ getDifficultyClass(level) {
|
|
|
+ return difficultyClass(level);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ validations: {
|
|
|
+ params: {
|
|
|
+ name: {
|
|
|
+ required
|
|
|
+ },
|
|
|
+ description: {
|
|
|
+ required
|
|
|
+ },
|
|
|
+ startAt: {
|
|
|
+ required
|
|
|
+ },
|
|
|
+ endAt: {
|
|
|
+ required
|
|
|
+ }
|
|
|
+ // problem: {
|
|
|
+ // required
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ problemName: {
|
|
|
+ required
|
|
|
+ },
|
|
|
+ searchContent: {
|
|
|
+ required
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ isCardModalActive(newValue) {
|
|
|
+ if (newValue === false) {
|
|
|
+ this.$v.$reset();
|
|
|
}
|
|
|
}
|
|
|
}
|