detail.vue
3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<template>
<div class="container">
<h3>{{ info.TestPaperName }}</h3>
<div class="header-opts">
<el-dropdown @command="handleCommand" v-if="videos && videos.length">
<span class="el-dropdown-link">
查看回放<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="item in videos" :key="item.id" :command="item.video_url">{{ item.file_id }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<div class="questions">
<el-card class="box-card" v-for="item in list" :key="item.id">
<h4>
<el-tag size="mini" type="success" effect="dark">{{
item.QuestionClassName
}}</el-tag>
【{{ item.subjectName }}】{{ item.subject }}
</h4>
<div v-if="item.subjectType == 4 || item.subjectType == 3">
<template v-if="item.audio">
<p >{{ item.answer }}</p>
<audio controls>
<source :src="BASE_URL + item.audio" />
</audio>
</template>
<template v-else-if="isAnswerAudio(item.answer)">
<audio controls>
<source :src="BASE_URL + item.answer" />
</audio>
</template>
<template v-else>
<p>{{ item.answer }}</p>
</template>
</div>
<ul class="answer-list" v-if="item.subjectType == 1">
<li
v-for="i in item.subjectContentObj"
:key="i.option"
:class="{ active: item.answer == i.option }"
>
<el-tag size="mini" type="primary" effect="dark">{{
i.option
}}</el-tag>
{{ i.optionContent }}
</li>
</ul>
<!-- <p v-if="item.subjectType == 1">Ta的答案:{{ item.answer }}</p> -->
<!-- <p v-if="item.subjectType == 1">正确答案:B</p> -->
</el-card>
</div>
</div>
</template>
<style lang="scss" scoped>
.container {
width: 80%;
max-width: 1200px;
min-width: 600px;
margin: 0 auto;
display: flex;
flex-direction: column;
align-items: center;
.header-opts {
display: flex;
align-items: center;
justify-content: center;
padding: 10px;
}
.box-card {
margin-bottom: 20px;
}
.questions {
width: 100%;
}
.answer-list {
display: flex;
flex-direction: column;
li {
list-style: none;
margin-bottom: 10px;
padding: 10px 10px;
&.active {
border: 2px solid #00c9ff;
border-radius: 10px;
}
}
}
}
</style>
<script>
import { SelectQuestionBankListForHistoryId } from "@/api/HistoryAnswer";
export default {
data() {
return {
info: {},
list: [],
videos:[],
};
},
created() {
let id = this.$route.query.id;
this.getDetail(id);
},
methods: {
handleCommand(command){
window.open(command, "_blank");
},
getDetail(id) {
SelectQuestionBankListForHistoryId(id).then((res) => {
let { info, list,videos } = res.data.data;
this.videos = videos;
this.info = info;
this.list = list.map((t) => {
t.subjectContentObj = JSON.parse(t.subjectContent);
return t;
});
});
},
isAnswerAudio(answer){
return /[\/a-zA-Z_\d]+\.mp3/.test(answer);
},
getList() {},
},
};
</script>
<style lang="scss" scoped>
</style>