| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- <template>
- <el-dialog title="个性化提升手册" :visible="visible" width="530px" @abort="handleClose">
- <div class="box">
- <div class="item" :class="{ active: active === 1 }" @click="changeAnswer(1)">答案解析在每题后</div>
- <div class="item" :class="{ active: active === 2 }" @click="changeAnswer(2)">答案解析在尾部</div>
- <div class="item" :class="{ active: active === 0 }" @click="changeAnswer(0)">无答案解析</div>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="handleClose">取 消</el-button>
- <el-button type="primary" @click="download">下载</el-button>
- </span>
- </el-dialog>
- </template>
- <script>
- import { downloadStudentErrorQuestion } from '../../../http/api/errorQuestion';
- import { ExtractFilename, DownloadFile, CreateLoadingInstance } from './tools'
- export default {
- props: {
- visible: {
- type: Boolean,
- default: false
- },
- examId: {
- type: [String, Number],
- required: true
- },
- subjectCode: {
- type: [String, Number],
- required: true
- }
- },
- data() {
- return {
- active: 1
- };
- },
- methods: {
- handleClose() {
- this.$emit('update:visible', false);
- },
- changeAnswer(value) {
- this.active = value;
- },
- download() {
- const loadingInstance = CreateLoadingInstance()
- let isAnswer = this.active;
- if (this.active === 1 || this.active === 2) {
- isAnswer = 1;
- }
- downloadStudentErrorQuestion({
- examId: this.examId,
- subjectCode: this.subjectCode,
- isAnswer
- }).then(response => {
- const blob2 = new Blob([response.data], {
- type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
- });
- const contentDisposition = response.headers['content-disposition'];
- const fileName = ExtractFilename(contentDisposition)
- DownloadFile(blob2, fileName)
- }).catch(error => {
- this.$message.error('下载失败,请稍后重试');
- }).finally(() => {
- loadingInstance.close();
- });
- }
- }
- };
- </script>
- <style scoped lang="scss">
- .box {
- display: flex;
- justify-content: space-between;
- padding: 20px 0;
- .item {
- text-align: center;
- font-size: 14px;
- line-height: 22px;
- color: #909399;
- padding: 15px 20px;
- background: #EDEFF6;
- border-radius: 4px;
- cursor: pointer;
- &.active {
- color: #2B65FF;
- background: #fff;
- border: 2px solid #2B65FF;
- box-shadow: 0 2px 6px rgba(43, 101, 255, 0.12);
- position: relative;
- /* 右下角的蓝色三角与对勾 */
- &::after {
- content: '';
- position: absolute;
- right: 0;
- bottom: 0;
- border: 12px solid #2B65FF;
- border-top-color: transparent;
- border-left-color: transparent;
- }
- /* 对勾图形(使用伪元素并旋转) */
- &::before {
- content: '√';
- color: #fff;
- position: absolute;
- right: 5px;
- bottom: -5px;
- border-top-color: transparent;
- border-left-color: transparent;
- // transform: rotate(45deg);
- z-index: 1;
- }
- }
- }
- }
- </style>
|