fix 插入图片

This commit is contained in:
赵霄
2023-09-18 09:15:15 +08:00
parent 95a5029010
commit 71b7cec560
+10 -4
View File
@@ -86,6 +86,7 @@ export default {
},
loading: false,
imageUrl: '',
imageIpUrl: '', // 用IP的图片,给onlyoffice的
plainOptions,
form: {
title: '',
@@ -432,7 +433,7 @@ export default {
handleOk () {
console.log('图片上传和了')
this.visible = false
window.Asc.scope.imageUrl = this.imageUrl
window.Asc.scope.imageUrl = this.imageIpUrl
window.Asc.scope.title = this.form.title
window.Asc.scope.imgSize = this.form.size
const width = pxConversionMm(this.imgOrigin.width)
@@ -467,6 +468,7 @@ export default {
imgSize.height = 89.3
break
}
console.log('创建文档图片的地址', Asc.scope.imageUrl)
const oDrawing = Api.CreateImage(Asc.scope.imageUrl, imgSize.width * 36000, imgSize.height * 36000)
imgOParagraph.AddDrawing(oDrawing)
// const allElement = oDocument.GetElementsCount()
@@ -523,6 +525,7 @@ export default {
})
setTimeout(() => {
this.form = {}
this.imageIpUrl = ''
this.imageUrl = ''
}, 200)
@@ -566,10 +569,13 @@ export default {
data: _data
}).then(res => {
this.loading = false
console.log(res)
this.imageUrl = this.downloadFilePath + '?path=' + res.result.url
this.imageUrl = this.staticFilePath + '?path=' + res.result.url
this.imageIpUrl = this.downloadFilePath + '?path=' + res.result.url
const img = new Image()
img.src = this.downloadFilePath + '?path=' + res.result.url
img.src = this.staticFilePath + '?path=' + res.result.url
console.log('给onlyoffice的', this.imageIpUrl)
console.log('页面显示的', img.src)
console.log('页面显示的true', this.imageUrl)
if (img.complete) {
this.imgOrigin = {
width: img.width,