diff --git a/package.json b/package.json index ed5690b..2e2c17a 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,8 @@ "axios": "^0.19.0", "core-js": "^2.6.5", "element-ui": "^2.12.0", + "html2canvas": "^1.0.0-rc.5", + "jspdf": "^1.5.3", "mavon-editor": "^2.7.6", "node-sass": "^4.12.0", "sass-loader": "^8.0.0", diff --git a/src/components/FooterNav.vue b/src/components/FooterNav.vue index b264054..61b7b1f 100644 --- a/src/components/FooterNav.vue +++ b/src/components/FooterNav.vue @@ -6,7 +6,7 @@
- +

微信公众号

@@ -14,7 +14,7 @@

微信公众号

- +

微信公众号

@@ -29,7 +29,9 @@ export default { return { imgUrl: { foot: require('../../static/img/foot.png'), - foot1: require('../../static/img/foot1.png') + foot1: require('../../static/img/foot1.png'), + wxtp0: require('../../static/img/wxtp0.png'), + wxtp1: require('../../static/img/wxtp1.png') } } }, @@ -62,6 +64,8 @@ export default { margin-top: 34px; img { + width: 80px; + height: 80px; margin-bottom: 11px; } diff --git a/src/htmlToPdf.js b/src/htmlToPdf.js new file mode 100644 index 0000000..d435c75 --- /dev/null +++ b/src/htmlToPdf.js @@ -0,0 +1,35 @@ +import html2Canvas from 'html2canvas' +import JsPDF from 'jspdf' +export default { + install (Vue, options) { + Vue.prototype.getPdf = function (idStr, title) { + html2Canvas(document.querySelector('#' + idStr), { + allowTaint: true + }).then(function (canvas) { + let contentWidth = canvas.width + let contentHeight = canvas.height + let pageHeight = contentWidth / 592.28 * 841.89 + let leftHeight = contentHeight + let position = 0 + let imgWidth = 595.28 + let imgHeight = 592.28 / contentWidth * contentHeight + let pageData = canvas.toDataURL('image/jpeg', 1.0) + let PDF = new JsPDF('', 'pt', 'a4') + if (leftHeight < pageHeight) { + PDF.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight) + } else { + while (leftHeight > 0) { + PDF.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight) + leftHeight -= pageHeight + position -= 841.89 + if (leftHeight > 0) { + PDF.addPage() + } + } + } + PDF.save(title + '.pdf') + } + ) + } + } +} diff --git a/src/main.js b/src/main.js index 4c42514..344f317 100644 --- a/src/main.js +++ b/src/main.js @@ -8,6 +8,7 @@ import ElementUI from 'element-ui' import md5 from 'js-md5' import VueQuillEditor from 'vue-quill-editor' import mavonEditor from 'mavon-editor' +import htmlToPdf from './htmlToPdf' import 'mavon-editor/dist/css/index.css' import 'quill/dist/quill.core.css' @@ -33,6 +34,7 @@ Vue.prototype.$jParams = function (url, parameters) { }) } +Vue.use(htmlToPdf) Vue.use(mavonEditor) Vue.use(VueQuillEditor) Vue.use(ElementUI) diff --git a/src/views/project/Application.vue b/src/views/project/Application.vue index 8f4e14f..e86a3cc 100644 --- a/src/views/project/Application.vue +++ b/src/views/project/Application.vue @@ -113,7 +113,7 @@
- +
@@ -200,7 +200,7 @@
- +
@@ -348,12 +348,13 @@ - 只能上传一张图片 + 只能上传一张不同的图片
@@ -442,7 +443,8 @@ export default { funds: '', proimages: '', file: '', - subStatus: 0 + subStatus: 0, + src: '' }; }, computed: {}, @@ -465,7 +467,7 @@ export default { this.sub = s } - this.sub = s + // this.sub = s if (s == 1) { if (this.name == '' || this.company == '' || this.tid == '' || @@ -486,7 +488,16 @@ export default { }, /** 上传文件 */ getFile(event) { + let _this = this let file = event.target.files[0]; +/* + let reader = new FileReader() + reader.readAsDataURL(file) // 这里是最关键的一步,转换就在这里 + reader.onloadend = function () { + _this.src = this.result + } +*/ + let param = new FormData(); //创建form对象 param.append('file', file);//通过append向form对象添加数据 // console.log(param.get('file')); //FormData私有类对象,访问不到,可以通过get判断值是否传进去 @@ -498,6 +509,7 @@ export default { let url = response.data.data.url this.file = url }) + console.log(this.file) }, /** 保存和提交 */ submit(index) { @@ -529,8 +541,8 @@ export default { s = index; this.subStatus = s this.proimages = this.file - if(this.proimages === ''){ - alert('文件未上传!') + if (this.proimages === '') { + alert('文件还未上传!') return } let _this = this @@ -591,7 +603,7 @@ export default { }).then(res => { if (res.data.code === 200) { alert(res.data.data.msg) - _this.file = '' + _this.proimages = '' } else { alert(res.data.message) } @@ -669,7 +681,13 @@ export default { margin-top: 25px; width: 150px; height: 250px; + + &::-webkit-scrollbar { + width: 0px; + height: 00x; + } } + .wrapper { min-width: 1280px; box-sizing: border-box; diff --git a/src/views/project/Project.vue b/src/views/project/Project.vue index acb9a71..ca2dc6f 100644 --- a/src/views/project/Project.vue +++ b/src/views/project/Project.vue @@ -5,9 +5,11 @@
-
- {{bgValue.announcement.name + bgValue.announcement.pro_content}} - +
+ + {{bgValue.announcement[0].name + bgValue.announcement[0].pro_content}} + +
暂无项目申报内容 @@ -118,7 +120,10 @@
- 当前申报阶段:{{item.status}} + + 项目状态: + {{item.status}} +
@@ -178,7 +183,8 @@ export default { area_value: '全部', value_date: '', start_time: '', - end_time: '' + end_time: '', + cd: Number }; }, computed: {}, @@ -251,7 +257,9 @@ export default { }).then(res => { if (res.data.code === 200) { _this.bgValue = res.data.data - // console.log(_this.bgValue) + + console.log(_this.bgValue) + _this.cd = _this.bgValue.announcement.length } else { _this.$message.error('请求数据有问题!') } @@ -413,12 +421,16 @@ export default { color: #666666; } - .block { + .block-k { width: 288px; height: 14px; line-height: 14px; display: inline-block; overflow: hidden; + + b { + font-weight: 900; + } } } diff --git a/src/views/project/Schedule.vue b/src/views/project/Schedule.vue index 6c49600..dbbb2ad 100644 --- a/src/views/project/Schedule.vue +++ b/src/views/project/Schedule.vue @@ -8,15 +8,15 @@ 项目进度 项目信息
-
项目导出
+
项目导出
-
+
@@ -66,7 +66,7 @@ + -->
立项评审中 @@ -86,7 +86,7 @@
-
+

一、基本信息

    @@ -172,7 +172,7 @@

五、经费预算:

-

{{zData.funds}}

+

{{zData.funds}}

六、申报单位承诺:

@@ -182,7 +182,9 @@

- 下载 + + 下载 +  |  预览 @@ -192,7 +194,7 @@

- +
@@ -255,6 +257,9 @@ export default { } }, methods: { + download() { + this.getPdf('pdfDom', '企业信用报告') + }, preview() { this.popupStatus = !this.popupStatus }, diff --git a/static/img/wxtp0.png b/static/img/wxtp0.png new file mode 100644 index 0000000..510e031 Binary files /dev/null and b/static/img/wxtp0.png differ diff --git a/static/img/wxtp1.png b/static/img/wxtp1.png new file mode 100644 index 0000000..f2184d0 Binary files /dev/null and b/static/img/wxtp1.png differ