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

修改bug

上级 695c3573
...@@ -4,13 +4,14 @@ ...@@ -4,13 +4,14 @@
<el-select @change="changes" v-model="value" size="small" clearable> <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-option v-for="item in options" :key="item.id" :label="item.english_name" :value="item.id"> </el-option>
</el-select> </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>
<div class="certs-img" v-if="imgUrl"> <div class="certs-img" v-if="imgUrl">
<img :src="imgUrl" /> <img :src="imgUrl" />
{{ pdfUrl }}
</div> </div>
<div class="null" v-else> <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 class="text">No certificate information currently available</div>
</div> </div>
</div> </div>
...@@ -32,6 +33,23 @@ export default { ...@@ -32,6 +33,23 @@ export default {
this.getCondition() this.getCondition()
}, },
methods: { 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() { openPdf() {
if (this.pdfUrl) { if (this.pdfUrl) {
window.open(this.pdfUrl) window.open(this.pdfUrl)
......
...@@ -3,8 +3,16 @@ ...@@ -3,8 +3,16 @@
<div class="info-top"> <div class="info-top">
<div class="info-top_box" v-for="(item, index) in infoItem" :key="index"> <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="temp" v-for="cItem in item" :key="cItem.name">
<div class="name">{{ cItem.name }}</div> <template v-if="cItem.name.indexOf('Announcement') != -1">
<div class="value">{{ cItem.value }}</div> <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> </div>
</div> </div>
...@@ -31,6 +39,9 @@ export default { ...@@ -31,6 +39,9 @@ export default {
}, },
program: { program: {
type: String type: String
},
courseName: {
type: String
} }
}, },
data() { data() {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
ref="html2Pdf" ref="html2Pdf"
> >
<section slot="pdf-content"> <section slot="pdf-content">
<app-info :data="data" :program="program" /> <app-info :data="data" :program="program" :courseName="courseName" />
</section> </section>
</vue-html2pdf> </vue-html2pdf>
</div> </div>
...@@ -31,7 +31,8 @@ export default { ...@@ -31,7 +31,8 @@ export default {
pageData: null, pageData: null,
htmlTitle: 'pdf', htmlTitle: 'pdf',
data: {}, data: {},
program: '' program: '',
courseName: ''
} }
}, },
mounted() { mounted() {
...@@ -40,10 +41,10 @@ export default { ...@@ -40,10 +41,10 @@ export default {
methods: { methods: {
search(params) { search(params) {
this.program = params.programName this.program = params.programName
this.courseName = params.form.course_id
this.getScore(params.form) this.getScore(params.form)
}, },
downPdf() { downPdf() {
// this.getPdf('#pdfDom')
this.$refs.html2Pdf.generatePdf() this.$refs.html2Pdf.generatePdf()
}, },
getScore(param) { getScore(param) {
......
...@@ -59,7 +59,6 @@ export default { ...@@ -59,7 +59,6 @@ export default {
} }
}, },
mounted() { mounted() {
this.getSchoolInfo()
this.getCondition() this.getCondition()
}, },
methods: { methods: {
...@@ -71,6 +70,8 @@ export default { ...@@ -71,6 +70,8 @@ export default {
.getCondition() .getCondition()
.then(response => { .then(response => {
this.options = response.data.get_school_info.project_map 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(() => {}) .finally(() => {})
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论