提交 1f55a7e8 authored 作者: lihuihui's avatar lihuihui

修改bug

上级 695c3573
......@@ -4,13 +4,14 @@
<el-select @change="changes" v-model="value" size="small" clearable>
<el-option v-for="item in options" :key="item.id" :label="item.english_name" :value="item.id"> </el-option>
</el-select>
<div class="down-btn" @click="openPdf">{{ $t('shmsLang.downloadBtn') }}</div>
<div class="down-btn" @click="openPdf"><a></a>{{ $t('shmsLang.downloadBtn') }}</div>
</div>
<div class="certs-img" v-if="imgUrl">
<img :src="imgUrl" />
{{ pdfUrl }}
</div>
<div class="null" v-else>
<img src="https://webapp-pub.ezijing.com/certificate/certs-null.png" alt="" />
<img src="https://webapp-pub.ezijing.com/certificate/certs-null.png" alt="" id="img" />
<div class="text">No certificate information currently available</div>
</div>
</div>
......@@ -32,6 +33,23 @@ export default {
this.getCondition()
},
methods: {
downLoadImg(name, url) {
const image = document.getElementById('img')
image.setAttribute('crossOrigin', 'anonymous')
image.onload = function () {
var canvas = document.createElement('canvas')
canvas.width = image.width
canvas.height = image.height
var ctx = canvas.getContext('2d')
ctx.drawImage(image, 0, 0, image.width, image.height)
var url = canvas.toDataURL('image/png')
var a = document.createElement('a')
a.download = name
a.href = url
a.click()
}
image.src = url
},
openPdf() {
if (this.pdfUrl) {
window.open(this.pdfUrl)
......
......@@ -3,8 +3,16 @@
<div class="info-top">
<div class="info-top_box" v-for="(item, index) in infoItem" :key="index">
<div class="temp" v-for="cItem in item" :key="cItem.name">
<div class="name">{{ cItem.name }}</div>
<div class="value">{{ cItem.value }}</div>
<template v-if="cItem.name.indexOf('Announcement') != -1">
<template v-if="courseName">
<div class="name">{{ cItem.name }}</div>
<div class="value">{{ cItem.value }}</div>
</template>
</template>
<template v-else>
<div class="name">{{ cItem.name }}</div>
<div class="value">{{ cItem.value }}</div>
</template>
</div>
</div>
</div>
......@@ -31,6 +39,9 @@ export default {
},
program: {
type: String
},
courseName: {
type: String
}
},
data() {
......
......@@ -14,7 +14,7 @@
ref="html2Pdf"
>
<section slot="pdf-content">
<app-info :data="data" :program="program" />
<app-info :data="data" :program="program" :courseName="courseName" />
</section>
</vue-html2pdf>
</div>
......@@ -31,7 +31,8 @@ export default {
pageData: null,
htmlTitle: 'pdf',
data: {},
program: ''
program: '',
courseName: ''
}
},
mounted() {
......@@ -40,10 +41,10 @@ export default {
methods: {
search(params) {
this.program = params.programName
this.courseName = params.form.course_id
this.getScore(params.form)
},
downPdf() {
// this.getPdf('#pdfDom')
this.$refs.html2Pdf.generatePdf()
},
getScore(param) {
......
......@@ -59,7 +59,6 @@ export default {
}
},
mounted() {
this.getSchoolInfo()
this.getCondition()
},
methods: {
......@@ -71,6 +70,8 @@ export default {
.getCondition()
.then(response => {
this.options = response.data.get_school_info.project_map
this.programValue = response.data.get_school_info.project_map[0].id
this.getSchoolInfo({ project_id: this.programValue })
})
.finally(() => {})
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论