提交 bcb2d9a7 authored 作者: lihuihui's avatar lihuihui

update:下载pdf

上级 87792985
差异被折叠。
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
"lodash": "^4.17.21", "lodash": "^4.17.21",
"query-string": "^7.0.1", "query-string": "^7.0.1",
"vue": "^2.6.14", "vue": "^2.6.14",
"vue-html2pdf": "^1.8.0",
"vue-router": "^3.5.3", "vue-router": "^3.5.3",
"vuex": "^3.6.2" "vuex": "^3.6.2"
}, },
......
<template> <template>
<vue-html2pdf
pdf-format="a1"
:show-layout="false"
:float-layout="false"
:enable-download="true"
:preview-modal="false"
:manual-pagination="true"
:paginate-elements-by-height="500"
filename="file"
pdf-content-width="100%"
ref="html2Pdf"
>
<section slot="pdf-content">
<div class="container"> <div class="container">
<el-row type="flex" class="row-bg" justify="space-between" style="margin-bottom: 30px"> <el-row type="flex" class="row-bg" justify="space-between" style="margin-bottom: 30px">
<el-col <el-col
...@@ -10,7 +23,7 @@ ...@@ -10,7 +23,7 @@
<el-select v-model="value" placeholder="请选择"> <el-select v-model="value" placeholder="请选择">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option> <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-select> </el-select>
<el-button type="text" style="margin-left: 30px">导出pdf</el-button> <el-button type="text" style="margin-left: 30px" @click="$refs.html2Pdf.generatePdf()">导出pdf</el-button>
</el-col> </el-col>
</el-row> </el-row>
<template v-if="dataInfo.paper_info"> <template v-if="dataInfo.paper_info">
...@@ -44,10 +57,13 @@ ...@@ -44,10 +57,13 @@
</el-row> </el-row>
</template> </template>
</div> </div>
</section>
</vue-html2pdf>
</template> </template>
<script> <script>
import { getExamDataInfo } from '../api' import { getExamDataInfo } from '../api'
import VueHtml2pdf from 'vue-html2pdf'
import ExamInfo from '../components/ExamInfo.vue' import ExamInfo from '../components/ExamInfo.vue'
import Submission from '../components/Submission.vue' import Submission from '../components/Submission.vue'
import Score from '../components/Score.vue' import Score from '../components/Score.vue'
...@@ -57,7 +73,7 @@ import Result from '../components/Result.vue' ...@@ -57,7 +73,7 @@ import Result from '../components/Result.vue'
import ScoreRange from '../components/ScoreRange.vue' import ScoreRange from '../components/ScoreRange.vue'
import QuestionType from '../components/QuestionType.vue' import QuestionType from '../components/QuestionType.vue'
export default { export default {
components: { ExamInfo, Submission, Score, ScoreRanking, TitleData, Result, ScoreRange, QuestionType }, components: { VueHtml2pdf, ExamInfo, Submission, Score, ScoreRanking, TitleData, Result, ScoreRange, QuestionType },
data() { data() {
return { return {
options: [ options: [
......
...@@ -15,6 +15,11 @@ export default defineConfig({ ...@@ -15,6 +15,11 @@ export default defineConfig({
}, },
proxy: { proxy: {
'/api': 'https://project-api.ezijing.com' '/api': 'https://project-api.ezijing.com'
// '/api': {
// target: 'http://localhost-zy-api.ezijing.com',
// changeOrigin: true,
// rewrite: path => path.replace(/^\/api\/zy/, '')
// }
} }
}, },
resolve: { resolve: {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论