mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-16 06:26:44 +08:00
添加上传接口获取图片地址
This commit is contained in:
@@ -118,3 +118,13 @@ export function exportExcel(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
export function base64Excel(data) {
|
||||
return request({
|
||||
// url: 'http://10.10.100.98:7012/updown/uploadBase64Image',
|
||||
url: getUrl('/uploadBase64Image', 1,2),
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
<script>
|
||||
import html2canvas from 'html2canvas'
|
||||
import { base64Excel } from '@/api/ebiz/nbs'
|
||||
export default {
|
||||
name: 'generateImg',
|
||||
data() {
|
||||
@@ -78,7 +79,7 @@ export default {
|
||||
width: domElement.offsetWidth,
|
||||
height: domElement.offsetHeight,
|
||||
backgroundColor: '#fff',
|
||||
scale: 2,
|
||||
scale: 1,
|
||||
dpi: 300
|
||||
}).then((canvas) => {
|
||||
// 转换canvas为PNG图片并压缩
|
||||
@@ -94,29 +95,24 @@ export default {
|
||||
// URL.revokeObjectURL(newimg.src)
|
||||
// callback(newimg)
|
||||
// }
|
||||
// this.blobToBase64(blob).then((base64String) => {
|
||||
// console.log(base64String, '==')
|
||||
// EWebBridge.webCallAppInJs('download', {
|
||||
// name: '业绩贺报.png',
|
||||
// url: base64String
|
||||
// })
|
||||
// .then(() => {
|
||||
// console.log('下载完成')
|
||||
// })
|
||||
// .catch(() => {
|
||||
// this.$toast.fail('图片下载失败,请重新下载!')
|
||||
// })
|
||||
// })
|
||||
let newimg = new Image()
|
||||
newimg.src = URL.createObjectURL(blob)
|
||||
newimg.onload = function () {
|
||||
URL.revokeObjectURL(newimg.src)
|
||||
console.log(newimg.src);
|
||||
EWebBridge.webCallAppInJs('download', {
|
||||
name: '开门红方案.png',
|
||||
url: newimg.src
|
||||
this.blobToBase64(blob).then((base64String) => {
|
||||
base64Excel({ base64Img: base64String }).then(res => {
|
||||
if (res.result == '0') {
|
||||
EWebBridge.webCallAppInJs('download', {
|
||||
name: '业绩贺报.png',
|
||||
url: location.origin + res.path
|
||||
})
|
||||
.then(() => {
|
||||
console.log('下载完成')
|
||||
})
|
||||
.catch(() => {
|
||||
this.$toast.fail('图片下载失败,请重新下载!')
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
'image/png'
|
||||
// quality
|
||||
@@ -136,31 +132,37 @@ img {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.box {
|
||||
position: absolute;
|
||||
width: 80%;
|
||||
height: 40%;
|
||||
top: 38%;
|
||||
left: 10%;
|
||||
|
||||
.title {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
// left: 30%;
|
||||
top: 24%;
|
||||
font-weight: bold;
|
||||
|
||||
p {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.organ {
|
||||
font-size: 12px;
|
||||
color: #b7170b;
|
||||
}
|
||||
|
||||
.name {
|
||||
font-size: 17px;
|
||||
color: #b7170b;
|
||||
}
|
||||
}
|
||||
|
||||
.pName {
|
||||
position: absolute;
|
||||
top: 44%;
|
||||
@@ -170,6 +172,7 @@ img {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.type {
|
||||
font-size: 22px;
|
||||
color: #efbc4f;
|
||||
@@ -179,6 +182,7 @@ img {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.yuan {
|
||||
font-size: 30px;
|
||||
color: #efbc4f;
|
||||
@@ -188,11 +192,13 @@ img {
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
vertical-align: bottom;
|
||||
|
||||
span {
|
||||
font-size: 14px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.time {
|
||||
font-size: 14px;
|
||||
color: #efbc4f;
|
||||
@@ -203,13 +209,16 @@ img {
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
.border-color {
|
||||
z-index: 9999;
|
||||
border: 2px solid;
|
||||
border-image: radial-gradient(circle, rgba(255, 233, 124, 1), rgba(222, 144, 34, 1)) 2 2;
|
||||
}
|
||||
|
||||
/deep/ .van-button--danger {
|
||||
background: linear-gradient(to right, #f26e43, #ac0209) !important; /*设置按钮为渐变颜色*/
|
||||
background: linear-gradient(to right, #f26e43, #ac0209) !important;
|
||||
/*设置按钮为渐变颜色*/
|
||||
border: none !important;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user