feat: 问题修复
This commit is contained in:
parent
0996737f2d
commit
b7804faedc
|
@ -2,7 +2,9 @@ import request from '@/utils/request'
|
|||
|
||||
const answerApi = {
|
||||
answerViewReport: 'answer/viewReport', // 查看报告
|
||||
answerViewResolution: 'answer/viewResolution' // 查看解析
|
||||
answerViewResolution: 'answer/viewResolution', // 查看解析
|
||||
collection: 'practice/collection', // 收藏
|
||||
collectionCancel: 'practice/cancel/collection' // 取消收藏
|
||||
}
|
||||
|
||||
export function answerViewReport (params) {
|
||||
|
@ -13,6 +15,24 @@ export function answerViewReport (params) {
|
|||
})
|
||||
}
|
||||
|
||||
export function reqCollection (params) {
|
||||
return request({
|
||||
url: answerApi.collection,
|
||||
method: 'post',
|
||||
params: params,
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
export function reqCollectionCancel (params) {
|
||||
return request({
|
||||
url: answerApi.collectionCancel,
|
||||
method: 'get',
|
||||
params: params,
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
export function answerViewResolution (params) {
|
||||
return request({
|
||||
url: answerApi.answerViewResolution,
|
||||
|
|
|
@ -15,6 +15,16 @@
|
|||
<template v-for="(item, index) in collectionInfo.list">
|
||||
<div :key="index">
|
||||
<DbQuestionInfoItem :data="item" :questionIndex="index + 1"></DbQuestionInfoItem>
|
||||
<div style="text-align: right;">
|
||||
<a-button
|
||||
@click="handlerDelete(item, 1)"
|
||||
icon="delete"
|
||||
type="danger"
|
||||
size="small"
|
||||
>
|
||||
删除
|
||||
</a-button>
|
||||
</div>
|
||||
<a-divider></a-divider>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -44,6 +54,16 @@
|
|||
<template v-for="(item, index) in wrongInfo.list">
|
||||
<div :key="index">
|
||||
<DbQuestionInfoItem :data="item" :questionIndex="index + 1"></DbQuestionInfoItem>
|
||||
<div style="text-align: right;">
|
||||
<a-button
|
||||
@click="handlerDelete(item, 2)"
|
||||
icon="delete"
|
||||
type="danger"
|
||||
size="small"
|
||||
>
|
||||
删除
|
||||
</a-button>
|
||||
</div>
|
||||
<a-divider></a-divider>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -115,6 +135,7 @@ import {
|
|||
practiceRecordPageList,
|
||||
practiceWrongPageList
|
||||
} from '@/api/practice/practice'
|
||||
import { reqCollectionCancel } from '@/api/practice/report'
|
||||
|
||||
export default {
|
||||
components: { DbQuestionInfoItem, 'a-pagination': Pagination },
|
||||
|
@ -152,6 +173,20 @@ export default {
|
|||
this.getPracticerecordPageList()
|
||||
this.getPracticewrongPageList()
|
||||
},
|
||||
handlerDelete (data, type) {
|
||||
const _this = this
|
||||
this.$confirm({
|
||||
title: '安全培训',
|
||||
content: '确定删除吗?',
|
||||
onOk () {
|
||||
reqCollectionCancel({ questionId: data.questionId, type: type }).then(res => {
|
||||
_this.$message.success('删除成功!')
|
||||
_this.initData()
|
||||
})
|
||||
},
|
||||
onCancel () {}
|
||||
})
|
||||
},
|
||||
goBack () {
|
||||
this.$router.go(-1)
|
||||
},
|
||||
|
|
|
@ -35,6 +35,19 @@
|
|||
<template v-for="(item, index) in questionList">
|
||||
<div :key="index">
|
||||
<DbQuestionInfoItem :data="item" :questionIndex="index + 1"></DbQuestionInfoItem>
|
||||
<div style="text-align: right;">
|
||||
<a-button
|
||||
@click="handlerLike(0, item)"
|
||||
v-if="item.isCollection"
|
||||
icon="star"
|
||||
size="small"
|
||||
>
|
||||
取消收藏
|
||||
</a-button>
|
||||
<a-button v-else @click="handlerLike(1, item)" icon="star" size="small">
|
||||
收藏
|
||||
</a-button>
|
||||
</div>
|
||||
<a-divider></a-divider>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -47,7 +60,12 @@
|
|||
<script>
|
||||
import DbQuestionInfoItem from '@/components/DbQuestionInfoItem/index.vue'
|
||||
import DbReport from '@/components/DbReport/index.vue'
|
||||
import { answerViewReport, answerViewResolution } from '@/api/practice/report'
|
||||
import {
|
||||
answerViewReport,
|
||||
answerViewResolution,
|
||||
reqCollection,
|
||||
reqCollectionCancel
|
||||
} from '@/api/practice/report'
|
||||
|
||||
export default {
|
||||
components: { DbQuestionInfoItem, DbReport },
|
||||
|
@ -77,6 +95,20 @@ export default {
|
|||
goBack () {
|
||||
this.$router.go(-1)
|
||||
},
|
||||
handlerLike (type, data) {
|
||||
if (type === 1) {
|
||||
reqCollection({ questionId: data.questionId, type: 1 }).then(res => {
|
||||
this.$message.success('收藏成功!')
|
||||
this.$set(data, 'isCollection', 1)
|
||||
})
|
||||
}
|
||||
if (type === 0) {
|
||||
reqCollectionCancel({ questionId: data.questionId, type: 1 }).then(res => {
|
||||
this.$message.success('取消收藏成功!')
|
||||
this.$set(data, 'isCollection', 0)
|
||||
})
|
||||
}
|
||||
},
|
||||
// 考试 start
|
||||
// getExamViewReport () {
|
||||
// reqExamViewReport({ projectId: this.query.reportId }).then(res => {
|
||||
|
|
Loading…
Reference in New Issue