Commit 78156aa614bfeabd22f95132f8efb4f055f26e80

Authored by yangzhi
1 parent 1096394b

级联菜单

src/api/HistoryAnswer.js
1 import request from '@/utils/request' 1 import request from '@/utils/request'
2 - 2 +
3 export function GetHistoryList(params) { 3 export function GetHistoryList(params) {
4 - return request({  
5 - url: `/HistoryAnswerInfo/GetHistoryAnswerListByUser`,  
6 - method: 'get',  
7 - params  
8 - }) 4 + return request({
  5 + url: `/HistoryAnswerInfo/GetHistoryAnswerListByUser`,
  6 + method: 'get',
  7 + params
  8 + })
9 } 9 }
10 -  
11 \ No newline at end of file 10 \ No newline at end of file
  11 +
  12 +export function SelectQuestionBankListForHistoryId(id) {
  13 + return request({
  14 + url: `/HistoryAnswerInfo/SelectQuestionBankListForHistoryId?hid=${id}`,
  15 + method: 'post'
  16 + });
  17 +}
12 \ No newline at end of file 18 \ No newline at end of file
src/utils/routerList.js
@@ -26,6 +26,15 @@ export function getRoutes() { @@ -26,6 +26,15 @@ export function getRoutes() {
26 }, 26 },
27 27
28 { 28 {
  29 + path: '/answerDetail',
  30 + name: '答题详情',
  31 + component: () =>
  32 + import ('@/views/AnswerResult/detail.vue'),
  33 + hidden: true
  34 + },
  35 +
  36 +
  37 + {
29 path: '/', 38 path: '/',
30 component: Layout, 39 component: Layout,
31 redirect: '/dashboard', 40 redirect: '/dashboard',
src/views/AnswerResult/detail.vue 0 → 100644
  1 +<template>
  2 + <div class="container">
  3 + <h3>{{ info.TestPaperName }}</h3>
  4 + <div class="header-opts">
  5 + <el-button type="text">查看回放</el-button>
  6 + </div>
  7 + <div class="questions">
  8 + <el-card class="box-card" v-for="item in list" :key="item.id">
  9 + <h4>
  10 + <el-tag size="mini" type="success" effect="dark">{{
  11 + item.QuestionClassName
  12 + }}</el-tag>
  13 + 【{{ item.subjectName }}】{{ item.subject }}
  14 + </h4>
  15 + <ul v-if="item.subjectType == 1">
  16 + <li v-for="i in item.subjectContentObj" :key="i.option">
  17 + <el-tag size="mini" type="primary" effect="dark">{{
  18 + i.option
  19 + }}</el-tag>
  20 + {{ i.optionContent }}
  21 + </li>
  22 + </ul>
  23 + <p v-if="item.subjectType == 1">Ta的答案:{{ item.answer }}</p>
  24 + <p v-if="item.subjectType == 1">正确答案:B</p>
  25 + </el-card>
  26 + </div>
  27 + </div>
  28 +</template>
  29 +<style lang="scss" scoped>
  30 +.container {
  31 + width: 80%;
  32 + max-width: 1200px;
  33 + min-width: 600px;
  34 + margin: 0 auto;
  35 + display: flex;
  36 + flex-direction: column;
  37 + align-items: center;
  38 + .header-opts{
  39 + display: flex;
  40 + align-items: center;
  41 + justify-content: center;
  42 + padding: 10px;
  43 + }
  44 + .questions {
  45 + width: 100%;
  46 + }
  47 + li {
  48 + list-style: none;
  49 + margin-bottom: 10px;
  50 + }
  51 +}
  52 +</style>
  53 +<script>
  54 +import { SelectQuestionBankListForHistoryId } from "@/api/HistoryAnswer";
  55 +export default {
  56 + data() {
  57 + return {
  58 + info: {},
  59 + list: [],
  60 + };
  61 + },
  62 + created() {
  63 + let id = this.$route.query.id;
  64 + this.getDetail(id);
  65 + },
  66 + methods: {
  67 + getDetail(id) {
  68 + SelectQuestionBankListForHistoryId(id).then((res) => {
  69 + let { info, list } = res.data.data;
  70 + this.info = info;
  71 + this.list = list.map((t) => {
  72 + t.subjectContentObj = JSON.parse(t.subjectContent);
  73 + return t;
  74 + });
  75 + });
  76 + },
  77 + getList() {},
  78 + },
  79 +};
  80 +</script>
  81 +<style lang="scss" scoped>
  82 +</style>
0 \ No newline at end of file 83 \ No newline at end of file
src/views/QuestionBank/index.vue
@@ -156,7 +156,7 @@ @@ -156,7 +156,7 @@
156 </el-form-item> 156 </el-form-item>
157 <el-form-item label="分类" style="padding-top: 5px"> 157 <el-form-item label="分类" style="padding-top: 5px">
158 <el-cascader @change="changequestionclass" v-model="Dataform.QuestionClassId" style="width: 400px" 158 <el-cascader @change="changequestionclass" v-model="Dataform.QuestionClassId" style="width: 400px"
159 - :props="{ emitPath: false ,checkStrictly:true}" :clearable="true" :options="QuestionClass"> 159 + :props="{ emitPath: false ,checkStrictly:true}" :clearable="true" :options="randomQuestionTypeList">
160 </el-cascader> 160 </el-cascader>
161 </el-form-item> 161 </el-form-item>
162 <el-form-item label="题型" style="padding-top: 5px"> 162 <el-form-item label="题型" style="padding-top: 5px">
@@ -241,6 +241,7 @@ @@ -241,6 +241,7 @@
241 }, 241 },
242 data() { 242 data() {
243 return { 243 return {
  244 + randomQuestionTypeList:[],
244 FormClassType: 0, 245 FormClassType: 0,
245 loading: false, 246 loading: false,
246 currentEditDimension: {}, 247 currentEditDimension: {},
@@ -294,7 +295,9 @@ @@ -294,7 +295,9 @@
294 scoreRules:['高','中','低'], 295 scoreRules:['高','中','低'],
295 }; 296 };
296 }, 297 },
297 - created() { }, 298 + created() {
  299 + this.getQuestionClassListHeadler2();
  300 + },
298 mounted() { 301 mounted() {
299 let ContentAreaHight = 302 let ContentAreaHight =
300 window.innerHeight - document.getElementById("elRow").offsetTop - 70; 303 window.innerHeight - document.getElementById("elRow").offsetTop - 70;
@@ -308,6 +311,39 @@ @@ -308,6 +311,39 @@
308 this.getQuestionClassListHeadler(); 311 this.getQuestionClassListHeadler();
309 }, 312 },
310 methods: { 313 methods: {
  314 + getSubTree(id, list) {
  315 + let result = [];
  316 + result = list.filter((t) => t.ParentId == id);
  317 + if (result.length) {
  318 + result = result.map((item) => {
  319 + item.value = item.id;
  320 + item.label = item.ClassificationName;
  321 + item.children = this.getSubTree(item.id, list);
  322 + if(!item.children || !item.children.length){
  323 + delete item.children;
  324 + }
  325 + return item;
  326 + });
  327 + }
  328 + return result;
  329 + },
  330 + getQuestionClassListHeadler2() {
  331 + let _this = this;
  332 + getQuestionClassList().then((res) => {
  333 + let alllist = res.data.data;
  334 + let list = alllist.filter(t=>!t.ParentId);
  335 + list = list.map((t) => {
  336 + t.value = t.id;
  337 + t.label = t.ClassificationName;
  338 + t.children = this.getSubTree(t.id,alllist);
  339 + if(!t.children || !t.children.length){
  340 + delete t.children;
  341 + }
  342 + return t;
  343 + });
  344 + this.randomQuestionTypeList = list;
  345 + });
  346 + },
311 AddSubject() { 347 AddSubject() {
312 this.FormClassType = 0; 348 this.FormClassType = 0;
313 // if(!this.Dataform.scoperule) 349 // if(!this.Dataform.scoperule)
src/views/TestPaper/ManualTestPaper.vue
@@ -125,9 +125,11 @@ @@ -125,9 +125,11 @@
125 <ul class="random-list"> 125 <ul class="random-list">
126 <li v-for="(item,index) in randomSubjectList" :key="index"> 126 <li v-for="(item,index) in randomSubjectList" :key="index">
127 <span>试题分类:</span> 127 <span>试题分类:</span>
128 - <el-select v-model="item.QuestionClassId" style="margin-left:10px;">  
129 - <el-option v-for="option in randomQuestionTypeList" :key="option.id" :label="option.ClassificationName" :value="option.id"></el-option>  
130 - </el-select> 128 + <el-cascader
  129 + style="flex:1"
  130 + v-model="item.QuestionClassId"
  131 + :options="randomQuestionTypeList"
  132 + clearable></el-cascader>
131 <span style="margin-left:10px;">试题数量:</span> 133 <span style="margin-left:10px;">试题数量:</span>
132 <el-input-number v-model="item.Count" :min="1" :max="100" label="描述文字" style="margin-left:10px;"></el-input-number> 134 <el-input-number v-model="item.Count" :min="1" :max="100" label="描述文字" style="margin-left:10px;"></el-input-number>
133 <i class="el-icon-remove-outline" @click="changeSubjectCount(-1,index)" style="margin-left:10px;color:#f56c6c;"></i> 135 <i class="el-icon-remove-outline" @click="changeSubjectCount(-1,index)" style="margin-left:10px;color:#f56c6c;"></i>
@@ -159,7 +161,7 @@ @@ -159,7 +161,7 @@
159 </style> 161 </style>
160 <script> 162 <script>
161 import draggable from "vuedraggable"; 163 import draggable from "vuedraggable";
162 -import { PostRandomGetQuestion, getQuestionList } from "@/api/QuestionBank"; 164 +import { PostRandomGetQuestion, getQuestionList,getQuestionClassList } from "@/api/QuestionBank";
163 import { GetQuestionClassByType } from "@/api/QuestionClass"; 165 import { GetQuestionClassByType } from "@/api/QuestionClass";
164 import { EditTestPaper, GetToplevel } from "@/api/TestPaper"; 166 import { EditTestPaper, GetToplevel } from "@/api/TestPaper";
165 import { formatTime } from "@/utils/util"; 167 import { formatTime } from "@/utils/util";
@@ -275,31 +277,68 @@ export default { @@ -275,31 +277,68 @@ export default {
275 }, 277 },
276 }, 278 },
277 created() { 279 created() {
278 - GetQuestionClassByType({ ClassType: 2 }).then((res) => {  
279 - console.log("GetQuestionClassByType res", res);  
280 - this.randomQuestionTypeList = res.data.data;  
281 - }); 280 + this.getQuestionClassListHeadler();
  281 + this.getQuestionClassListHeadler2();
282 }, 282 },
283 mounted() { 283 mounted() {
284 //计算页面内容区域的高度 284 //计算页面内容区域的高度
285 this.contentHeight = window.innerHeight - 90; 285 this.contentHeight = window.innerHeight - 90;
286 - this.getQuestionClassListHeadler();  
287 //this.GetList(); 286 //this.GetList();
288 }, 287 },
289 methods: { 288 methods: {
  289 + getSubTree(id, list) {
  290 + let result = [];
  291 + result = list.filter((t) => t.ParentId == id);
  292 + if (result.length) {
  293 + result = result.map((item) => {
  294 + item.value = item.id;
  295 + item.label = item.ClassificationName;
  296 + item.children = this.getSubTree(item.id, list);
  297 + if(!item.children || !item.children.length){
  298 + delete item.children;
  299 + }
  300 + return item;
  301 + });
  302 + }
  303 + return result;
  304 + },
  305 + getQuestionClassListHeadler2() {
  306 + let _this = this;
  307 + getQuestionClassList().then((res) => {
  308 + let alllist = res.data.data;
  309 + let list = alllist.filter(t=>!t.ParentId);
  310 + list = list.map((t) => {
  311 + t.value = t.id;
  312 + t.label = t.ClassificationName;
  313 + t.children = this.getSubTree(t.id,alllist);
  314 + if(!t.children || !t.children.length){
  315 + delete t.children;
  316 + }
  317 + return t;
  318 + });
  319 + this.randomQuestionTypeList = list;
  320 + });
  321 + },
290 randomCancel() { 322 randomCancel() {
291 this.dialogTableVisible = false; 323 this.dialogTableVisible = false;
292 }, 324 },
293 randomSubmit() { 325 randomSubmit() {
294 let list = this.randomSubjectList; 326 let list = this.randomSubjectList;
295 - if (list.findIndex((t) => !t.QuestionClassId || !t.Count) > -1) { 327 + if (list.findIndex((t) => !t.QuestionClassId || !t.QuestionClassId.length || !t.Count) > -1) {
296 this.$message.warning("参数不完整"); 328 this.$message.warning("参数不完整");
297 return; 329 return;
298 } 330 }
  331 + list = list.map(t=>{
  332 + t.QuestionClassId = t.QuestionClassId.pop();
  333 + return t;
  334 + });
299 PostRandomGetQuestion(list).then((res) => { 335 PostRandomGetQuestion(list).then((res) => {
300 let list = res.data.data; 336 let list = res.data.data;
301 this.arr2 = list; 337 this.arr2 = list;
302 this.dialogTableVisible = false; 338 this.dialogTableVisible = false;
  339 + if(!list.length){
  340 + this.$message.warning('所选分类没有试题');
  341 + }
303 }); 342 });
304 }, 343 },
305 changeSubjectCount(type, index) { 344 changeSubjectCount(type, index) {
src/views/TestPaper/index.vue
@@ -192,6 +192,7 @@ @@ -192,6 +192,7 @@
192 filters: {}, 192 filters: {},
193 data() { 193 data() {
194 return { 194 return {
  195 + randomQuestionTypeList:[],
195 fileList: [], 196 fileList: [],
196 imageUrl: '', 197 imageUrl: '',
197 header: { 198 header: {
@@ -250,6 +251,7 @@ @@ -250,6 +251,7 @@
250 }, 251 },
251 created() { 252 created() {
252 this.GetList(); 253 this.GetList();
  254 + this.getQuestionClassListHeadler2();
253 this.header.Authorization = getToken() 255 this.header.Authorization = getToken()
254 }, 256 },
255 mounted() { 257 mounted() {
@@ -293,6 +295,39 @@ @@ -293,6 +295,39 @@
293 } 295 }
294 }, 296 },
295 methods: { 297 methods: {
  298 + getSubTree(id, list) {
  299 + let result = [];
  300 + result = list.filter((t) => t.ParentId == id);
  301 + if (result.length) {
  302 + result = result.map((item) => {
  303 + item.value = item.id;
  304 + item.label = item.ClassificationName;
  305 + item.children = this.getSubTree(item.id, list);
  306 + if(!item.children || !item.children.length){
  307 + delete item.children;
  308 + }
  309 + return item;
  310 + });
  311 + }
  312 + return result;
  313 + },
  314 + getQuestionClassListHeadler2() {
  315 + let _this = this;
  316 + getQuestionClassList().then((res) => {
  317 + let alllist = res.data.data;
  318 + let list = alllist.filter(t=>!t.ParentId);
  319 + list = list.map((t) => {
  320 + t.value = t.id;
  321 + t.label = t.ClassificationName;
  322 + t.children = this.getSubTree(t.id,alllist);
  323 + if(!t.children || !t.children.length){
  324 + delete t.children;
  325 + }
  326 + return t;
  327 + });
  328 + this.randomQuestionTypeList = list;
  329 + });
  330 + },
296 handleRemove(file, fileList) { 331 handleRemove(file, fileList) {
297 this.Dataform.subjectImg = '' 332 this.Dataform.subjectImg = ''
298 333
src/views/user/userlist.vue
@@ -174,6 +174,7 @@ @@ -174,6 +174,7 @@
174 <el-table-column label="操作"> 174 <el-table-column label="操作">
175 <template slot-scope="scope"> 175 <template slot-scope="scope">
176 <el-button type="success" @click="handleWatchLive(scope.row)">观看直播</el-button> 176 <el-button type="success" @click="handleWatchLive(scope.row)">观看直播</el-button>
  177 + <el-button type="primary" @click="handleAnswerDetail(scope.row)">答题详情</el-button>
177 </template> 178 </template>
178 </el-table-column> 179 </el-table-column>
179 180
@@ -337,6 +338,9 @@ @@ -337,6 +338,9 @@
337 console.log('handleWatchLive',item); 338 console.log('handleWatchLive',item);
338 this.$router.push(`/live?id=${item.StreamName}`) 339 this.$router.push(`/live?id=${item.StreamName}`)
339 }, 340 },
  341 + handleAnswerDetail(item){
  342 + window.open(`/#/answerDetail?id=${item.id}`,"_blank")
  343 + },
340 submitForm() { 344 submitForm() {
341 this.dialogClassIVIsible = false; 345 this.dialogClassIVIsible = false;
342 }, 346 },