|
|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <page-header :routes="[{ name: '查看题目', path: 'question' }]">
|
|
|
+ <page-header :routes="[{ name: `查看题目`, path: 'question' }]">
|
|
|
<template slot="title">
|
|
|
查看题目
|
|
|
</template>
|
|
|
@@ -37,27 +37,20 @@
|
|
|
<b-table
|
|
|
:data="data"
|
|
|
paginated
|
|
|
- per-page="5"
|
|
|
+ per-page="10"
|
|
|
detailed
|
|
|
detail-key="id"
|
|
|
- @details-open="
|
|
|
- (row, index) => $toast.open(`Expanded ${row.user.first_name}`)
|
|
|
- "
|
|
|
>
|
|
|
<template slot-scope="props">
|
|
|
<b-table-column field="id" label="ID" width="40" numeric sortable>
|
|
|
- <!--{{ props.row.id }}-->1
|
|
|
+ {{ props.row.id }}
|
|
|
</b-table-column>
|
|
|
|
|
|
- <b-table-column field="user.first_name" label="题目名称">
|
|
|
+ <b-table-column label="题目名称">
|
|
|
{{ props.row.name }}
|
|
|
</b-table-column>
|
|
|
|
|
|
- <b-table-column
|
|
|
- field="user.last_name"
|
|
|
- label="题目描述"
|
|
|
- width="400"
|
|
|
- >
|
|
|
+ <b-table-column label="题目描述" width="400">
|
|
|
<div class="description">{{ props.row.description }}</div>
|
|
|
</b-table-column>
|
|
|
|
|
|
@@ -67,8 +60,10 @@
|
|
|
sortable
|
|
|
centered
|
|
|
>
|
|
|
- <span class="tag is-success">
|
|
|
- {{ props.row.difficulty == 1 ? "简单" : "困难" }}
|
|
|
+ <span
|
|
|
+ :class="['tag', `${difficultyClass(props.row.difficulty)}`]"
|
|
|
+ >
|
|
|
+ {{ difficultyType(props.row.difficulty) }}
|
|
|
</span>
|
|
|
</b-table-column>
|
|
|
|
|
|
@@ -80,23 +75,31 @@
|
|
|
>
|
|
|
{{ props.row.expectTime }}分钟
|
|
|
</b-table-column>
|
|
|
- <b-table-column label="题目标签">
|
|
|
- {{ props.row.assignmentType.value }}
|
|
|
- </b-table-column>
|
|
|
</template>
|
|
|
|
|
|
<template slot="detail" slot-scope="props">
|
|
|
<article class="media">
|
|
|
- <!--<figure class="media-left">-->
|
|
|
- <!--<p class="image is-64x64">-->
|
|
|
- <!--<img src="/static/img/placeholder-128x128.png">-->
|
|
|
- <!--</p>-->
|
|
|
- <!--</figure>-->
|
|
|
<div class="media-content">
|
|
|
<div class="content">
|
|
|
- <p>
|
|
|
+ <p class="detail-content">
|
|
|
<strong>{{ props.row.name }}</strong>
|
|
|
- <small>@{{ props.row.expectTime }}分钟</small> <br />
|
|
|
+ <small
|
|
|
+ ><b-tag type="is-info"
|
|
|
+ >{{ props.row.expectTime }}分钟</b-tag
|
|
|
+ ></small
|
|
|
+ >
|
|
|
+ <small
|
|
|
+ ><b-tag
|
|
|
+ :type="`${difficultyClass(props.row.difficulty)}`"
|
|
|
+ >{{ difficultyType(props.row.difficulty) }}</b-tag
|
|
|
+ ></small
|
|
|
+ >
|
|
|
+ <small
|
|
|
+ ><b-tag type="is-link">{{
|
|
|
+ props.row.assignmentType.value
|
|
|
+ }}</b-tag></small
|
|
|
+ >
|
|
|
+ <br /><br />
|
|
|
{{ props.row.description }}
|
|
|
</p>
|
|
|
</div>
|
|
|
@@ -169,6 +172,32 @@ export default {
|
|
|
value => (this.review = value.data)
|
|
|
);
|
|
|
getTeacherQuestions().then(value => (this.data = value.data));
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ difficultyType: level => {
|
|
|
+ switch (level) {
|
|
|
+ case 1:
|
|
|
+ return "简单";
|
|
|
+ case 2:
|
|
|
+ return "中等";
|
|
|
+ case 3:
|
|
|
+ return "困难";
|
|
|
+ default:
|
|
|
+ return "--";
|
|
|
+ }
|
|
|
+ },
|
|
|
+ difficultyClass: level => {
|
|
|
+ switch (level) {
|
|
|
+ case 1:
|
|
|
+ return "is-success";
|
|
|
+ case 2:
|
|
|
+ return "is-warning";
|
|
|
+ case 3:
|
|
|
+ return "is-danger";
|
|
|
+ default:
|
|
|
+ return "is-link";
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
@@ -199,4 +228,13 @@ export default {
|
|
|
word-break: break-all;
|
|
|
display: -webkit-box;
|
|
|
}
|
|
|
+.detail-content {
|
|
|
+ strong {
|
|
|
+ font-size: 1.2rem;
|
|
|
+ margin-right: 10px;
|
|
|
+ }
|
|
|
+ small {
|
|
|
+ margin-right: 10px;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|