|
@@ -1,24 +1,28 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div>
|
|
<div>
|
|
|
- <page-header :routes="[{ name: `查看题目`, path: 'question/' }]">
|
|
|
|
|
|
|
+ <page-header
|
|
|
|
|
+ :loading="loadingQuestionList"
|
|
|
|
|
+ :routes="[{ name: `查看题目`, path: 'question/' }]"
|
|
|
|
|
+ >
|
|
|
<template slot="title">
|
|
<template slot="title">
|
|
|
查看题目
|
|
查看题目
|
|
|
</template>
|
|
</template>
|
|
|
</page-header>
|
|
</page-header>
|
|
|
<page-body>
|
|
<page-body>
|
|
|
|
|
+ <page-section-loading :show="loadingQuestionList" />
|
|
|
<!-- container面板-->
|
|
<!-- container面板-->
|
|
|
- <div class="data-table">
|
|
|
|
|
|
|
+ <div v-if="!loadingQuestionList" class="data-table">
|
|
|
<!--下拉框&搜索框-->
|
|
<!--下拉框&搜索框-->
|
|
|
<div class="form-group">
|
|
<div class="form-group">
|
|
|
<!--下拉框-->
|
|
<!--下拉框-->
|
|
|
<b-field>
|
|
<b-field>
|
|
|
<b-select placeholder="选择题目类型">
|
|
<b-select placeholder="选择题目类型">
|
|
|
<option
|
|
<option
|
|
|
- v-for="option in questionType"
|
|
|
|
|
- :value="option.title"
|
|
|
|
|
- :key="option.id"
|
|
|
|
|
|
|
+ v-for="(option, index) in questionType"
|
|
|
|
|
+ :value="option"
|
|
|
|
|
+ :key="index"
|
|
|
>
|
|
>
|
|
|
- {{ option.title }}
|
|
|
|
|
|
|
+ {{ option }}
|
|
|
</option>
|
|
</option>
|
|
|
</b-select>
|
|
</b-select>
|
|
|
</b-field>
|
|
</b-field>
|
|
@@ -29,19 +33,15 @@
|
|
|
placeholder="输入关键字查找题目"
|
|
placeholder="输入关键字查找题目"
|
|
|
type="search"
|
|
type="search"
|
|
|
icon="magnify"
|
|
icon="magnify"
|
|
|
|
|
+ v-model="keyWord"
|
|
|
>
|
|
>
|
|
|
</b-input>
|
|
</b-input>
|
|
|
- <p class="control"><button class="button is-link">查找</button></p>
|
|
|
|
|
|
|
+ <p class="control">
|
|
|
|
|
+ <button class="button is-link" @click="getQuestionsByKey()">
|
|
|
|
|
+ 查找
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </p>
|
|
|
</b-field>
|
|
</b-field>
|
|
|
-
|
|
|
|
|
- <!--<b-field>-->
|
|
|
|
|
- <!--<b-input-->
|
|
|
|
|
- <!--placeholder="输入关键字查找题目"-->
|
|
|
|
|
- <!--type="search"-->
|
|
|
|
|
- <!--icon="magnify"-->
|
|
|
|
|
- <!-->-->
|
|
|
|
|
- <!--</b-input>-->
|
|
|
|
|
- <!--</b-field>-->
|
|
|
|
|
</div>
|
|
</div>
|
|
|
<!--题目table-->
|
|
<!--题目table-->
|
|
|
<div class="question-list">
|
|
<div class="question-list">
|
|
@@ -55,7 +55,10 @@
|
|
|
<router-link
|
|
<router-link
|
|
|
:to="{
|
|
:to="{
|
|
|
path: `${props.row.id}`,
|
|
path: `${props.row.id}`,
|
|
|
- query: { questionName: props.row.name }
|
|
|
|
|
|
|
+ query: {
|
|
|
|
|
+ questionName: props.row.name,
|
|
|
|
|
+ questionId: props.row.id
|
|
|
|
|
+ }
|
|
|
}"
|
|
}"
|
|
|
>{{ props.row.name }}</router-link
|
|
>{{ props.row.name }}</router-link
|
|
|
>
|
|
>
|
|
@@ -80,11 +83,11 @@
|
|
|
|
|
|
|
|
<b-table-column
|
|
<b-table-column
|
|
|
label="平均时长"
|
|
label="平均时长"
|
|
|
- field="expectTime"
|
|
|
|
|
|
|
+ field="expect_time"
|
|
|
sortable
|
|
sortable
|
|
|
centered
|
|
centered
|
|
|
>
|
|
>
|
|
|
- {{ props.row.expectTime }}分钟
|
|
|
|
|
|
|
+ {{ props.row.expect_time }}分钟
|
|
|
</b-table-column>
|
|
</b-table-column>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -94,22 +97,27 @@
|
|
|
<div class="content">
|
|
<div class="content">
|
|
|
<p class="detail-content">
|
|
<p class="detail-content">
|
|
|
<strong>{{ props.row.name }}</strong>
|
|
<strong>{{ props.row.name }}</strong>
|
|
|
- <small
|
|
|
|
|
- ><b-tag type="is-info"
|
|
|
|
|
- >{{ props.row.expectTime }}分钟</b-tag
|
|
|
|
|
- ></small
|
|
|
|
|
- >
|
|
|
|
|
- <small
|
|
|
|
|
- ><b-tag
|
|
|
|
|
|
|
+ <small v-show="props.row.expect_time">
|
|
|
|
|
+ <b-tag type="is-info"
|
|
|
|
|
+ >{{ props.row.expect_time }}分钟</b-tag
|
|
|
|
|
+ >
|
|
|
|
|
+ </small>
|
|
|
|
|
+ <small v-show="props.row.difficulty">
|
|
|
|
|
+ <b-tag
|
|
|
:type="`${difficultyClass(props.row.difficulty)}`"
|
|
:type="`${difficultyClass(props.row.difficulty)}`"
|
|
|
>{{ difficultyType(props.row.difficulty) }}</b-tag
|
|
>{{ difficultyType(props.row.difficulty) }}</b-tag
|
|
|
- ></small
|
|
|
|
|
- >
|
|
|
|
|
- <small
|
|
|
|
|
- ><b-tag type="is-link">{{
|
|
|
|
|
- props.row.assignmentType.value
|
|
|
|
|
- }}</b-tag></small
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ >
|
|
|
|
|
+ </small>
|
|
|
|
|
+ <small v-show="props.row.assignmentType">
|
|
|
|
|
+ <b-tag type="is-link">{{
|
|
|
|
|
+ props.row.assignmentType
|
|
|
|
|
+ }}</b-tag>
|
|
|
|
|
+ </small>
|
|
|
|
|
+ <small v-show="props.row.questionType">
|
|
|
|
|
+ <b-tag type="is-primary">{{
|
|
|
|
|
+ props.row.questionType
|
|
|
|
|
+ }}</b-tag>
|
|
|
|
|
+ </small>
|
|
|
<br /><br />
|
|
<br /><br />
|
|
|
{{ props.row.description }}
|
|
{{ props.row.description }}
|
|
|
</p>
|
|
</p>
|
|
@@ -125,15 +133,20 @@
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
|
import { mapState } from "vuex";
|
|
import { mapState } from "vuex";
|
|
|
-import { getStudentCourseReviewList } from "@/api/review";
|
|
|
|
|
-import { getTeacherQuestions } from "@/api/question";
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ getQuestionsByAssignType,
|
|
|
|
|
+ getTeacherQuestionType,
|
|
|
|
|
+ getTeacherKeywordQuestions
|
|
|
|
|
+} from "@/api/question";
|
|
|
import PageHeader from "@/components/PageHeader";
|
|
import PageHeader from "@/components/PageHeader";
|
|
|
import PageBody from "@/components/PageBody/index";
|
|
import PageBody from "@/components/PageBody/index";
|
|
|
|
|
+import PageSectionLoading from "@/components/PageBody/PageSectionLoading/index";
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
components: {
|
|
components: {
|
|
|
PageHeader,
|
|
PageHeader,
|
|
|
- PageBody
|
|
|
|
|
|
|
+ PageBody,
|
|
|
|
|
+ PageSectionLoading
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
|
...mapState({
|
|
...mapState({
|
|
@@ -144,20 +157,62 @@ export default {
|
|
|
return {
|
|
return {
|
|
|
courses: [],
|
|
courses: [],
|
|
|
review: [],
|
|
review: [],
|
|
|
- questionType: [
|
|
|
|
|
- { id: 1, title: "文档作业题目" },
|
|
|
|
|
- { id: 2, title: "代码作业题目" }
|
|
|
|
|
- ],
|
|
|
|
|
- data: []
|
|
|
|
|
|
|
+ questionType: [],
|
|
|
|
|
+ data: [],
|
|
|
|
|
+ keyWord: "",
|
|
|
|
|
+ errorMessage: "服务器错误,请稍后再试",
|
|
|
|
|
+ loadingQuestionList: true
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
|
- getStudentCourseReviewList(this.courses.id).then(
|
|
|
|
|
- value => (this.review = value.data)
|
|
|
|
|
- );
|
|
|
|
|
- getTeacherQuestions().then(value => (this.data = value.data));
|
|
|
|
|
|
|
+ //获取全部题目分类
|
|
|
|
|
+ this.getQuestionType();
|
|
|
|
|
+ //获取全部题目
|
|
|
|
|
+ this.getQuestions();
|
|
|
|
|
+
|
|
|
|
|
+ this.loadingQuestionList = false;
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ //获取全部题目分类
|
|
|
|
|
+ getQuestionType() {
|
|
|
|
|
+ getTeacherQuestionType()
|
|
|
|
|
+ .then(value => {
|
|
|
|
|
+ this.questionType = value.data;
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(e => {
|
|
|
|
|
+ this.$toast.open({
|
|
|
|
|
+ message: e.message,
|
|
|
|
|
+ type: "is-link"
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ //获取全部题目
|
|
|
|
|
+ getQuestions() {
|
|
|
|
|
+ getQuestionsByAssignType({ type: "DOCUMENT", page: 0, limit: 10 })
|
|
|
|
|
+ .then(value => {
|
|
|
|
|
+ // this.data = value.res.content;
|
|
|
|
|
+ this.data = value.data;
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(e => {
|
|
|
|
|
+ this.$toast.open({
|
|
|
|
|
+ message: e.message,
|
|
|
|
|
+ type: "is-danger"
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ //根据关键字查找题目
|
|
|
|
|
+ getQuestionsByKey() {
|
|
|
|
|
+ getTeacherKeywordQuestions(this.keyWord)
|
|
|
|
|
+ .then(value => {
|
|
|
|
|
+ this.data = value.data;
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(e => {
|
|
|
|
|
+ this.$toast.open({
|
|
|
|
|
+ message: e.message || this.errorMessage,
|
|
|
|
|
+ type: "is-danger"
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
difficultyType: level => {
|
|
difficultyType: level => {
|
|
|
switch (level) {
|
|
switch (level) {
|
|
|
case 1:
|
|
case 1:
|