Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pptist
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
viitto
pptist
Commits
90e9cee1
Commit
90e9cee1
authored
Jan 20, 2024
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改销售设计行程,图片下载为后台实现
parent
f3887f44
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
21 deletions
+45
-21
ExportImage.vue
src/views/Editor/ExportDialog/ExportImage.vue
+41
-6
ExportPDF.vue
src/views/Editor/ExportDialog/ExportPDF.vue
+4
-15
No files found.
src/views/Editor/ExportDialog/ExportImage.vue
View file @
90e9cee1
...
...
@@ -62,11 +62,14 @@
<Switch
v-model:value=
"ignoreWebfont"
v-tooltip=
"'导出时默认忽略在线字体,若您在幻灯片中使用了在线字体,且希望导出后保留相关样式,可选择关闭【忽略在线字体】选项,但要注意这将会增加导出用时。'"
/>
</div>
</div>
<div
class=
"tip"
style=
"color:red"
v-if=
"searchData.sellId==0"
>
当前设计文档没有保存,无法生成图片,请先保存文档。
</div>
</div>
<a
ref=
"downloadLink"
target=
"_blank"
:href=
"fileUrl"
style=
"display:none"
v-if=
"param.model=='2' && searchData.sellId!=0"
></a>
<div
class=
"btns"
>
<Button
class=
"btn export"
type=
"primary"
@
click=
"expImage()"
>
导出图片
</Button>
<Button
class=
"btn export"
type=
"primary"
@
click=
"expImage()"
v-if=
"param.model!='2'"
>
导出图片
</Button
>
<Button
class=
"btn export"
type=
"primary"
@
click=
"exportOnlineImage()"
v-if=
"param.model=='2' && searchData.sellId!=0"
>
导出图片
</Button>
<Button
class=
"btn close"
@
click=
"emit('close')"
>
关闭
</Button>
</div>
...
...
@@ -75,7 +78,7 @@
</
template
>
<
script
lang=
"ts"
setup
>
import
{
computed
,
r
ef
}
from
'vue'
import
{
computed
,
inject
,
ref
,
nextTick
,
watch
,
R
ef
}
from
'vue'
import
{
storeToRefs
}
from
'pinia'
import
{
useSlidesStore
,
useScreenStore
}
from
'@/store'
import
useExport
from
'@/hooks/useExport'
...
...
@@ -88,20 +91,27 @@ import Slider from '@/components/Slider.vue'
import
Button
from
'@/components/Button.vue'
import
RadioButton
from
'@/components/RadioButton.vue'
import
RadioGroup
from
'@/components/RadioGroup.vue'
import
{
injectKeyTemplate
}
from
'@/types/injectKey'
import
{
query
}
from
'@/utils/common'
const
emit
=
defineEmits
<
{
(
event
:
'close'
):
void
}
>
()
const
{
slides
,
currentSlide
,
viewportRatio
}
=
storeToRefs
(
useSlidesStore
())
const
{
slides
,
currentSlide
,
viewportRatio
,
slideIndex
}
=
storeToRefs
(
useSlidesStore
())
const
searchData
=
ref
({}
as
any
)
searchData
.
value
=
inject
(
injectKeyTemplate
)
const
imageThumbnailsRef
=
ref
<
HTMLElement
>
()
const
rangeType
=
ref
<
'all'
|
'current'
|
'custom'
>
(
'current'
)
const
range
=
ref
<
[
number
,
number
]
>
([
1
,
slides
.
value
.
length
])
const
format
=
ref
<
'jpeg'
|
'png'
>
(
'jpeg'
)
const
quality
=
ref
(
1
)
const
ignoreWebfont
=
ref
(
false
)
//开启在线字体
let
param
=
query
()
const
autoSave
=
inject
(
'SellTravelSave'
)
as
Ref
<
number
>
const
downloadLink
=
ref
()
const
fileUrl
=
ref
(
""
)
const
renderSlides
=
computed
(()
=>
{
if
(
rangeType
.
value
===
'all'
)
return
slides
.
value
...
...
@@ -118,7 +128,32 @@ const expImage = () => {
if
(
!
imageThumbnailsRef
.
value
)
return
exportImage
(
imageThumbnailsRef
.
value
,
format
.
value
,
quality
.
value
,
ignoreWebfont
.
value
)
}
console
.
log
(
'页面进入'
)
const
exportOnlineImage
=
()
=>
{
autoSave
.
value
=
1
}
const
beginDownload
=
async
()
=>
{
let
rangeArray
:
number
[]
=
[]
if
(
rangeType
.
value
===
'all'
)
rangeArray
.
push
(
0
)
else
if
(
rangeType
.
value
===
'current'
)
rangeArray
.
push
(
slideIndex
.
value
+
1
)
else
{
const
[
min
,
max
]
=
range
.
value
for
(
let
i
=
min
;
i
<=
max
;
i
++
)
{
rangeArray
.
push
(
i
)
}
}
fileUrl
.
value
=
`http://fileservice.oytour.com/api/img/
${
searchData
.
value
.
sellId
}
/
${
rangeArray
.
join
(
','
)}
/
${
format
.
value
==
'png'
?
'png'
:
'jpg'
}
/
${
quality
.
value
}
`
//http://fileservice.oytour.com
console
.
log
(
fileUrl
.
value
)
nextTick
(()
=>
{
downloadLink
.
value
.
click
()
})
}
watch
(()
=>
autoSave
.
value
,(
newVal
)
=>
{
if
(
newVal
==
2
){
beginDownload
()
}
})
</
script
>
<
style
lang=
"scss"
scoped
>
...
...
src/views/Editor/ExportDialog/ExportPDF.vue
View file @
90e9cee1
...
...
@@ -20,7 +20,7 @@
</
template
>
</div>
</div>
<div
class=
"configs"
v-if=
"param.model!='2'"
>
<div
class=
"configs"
>
<div
class=
"row"
>
<div
class=
"title"
>
导出范围:
</div>
<RadioGroup
...
...
@@ -52,10 +52,11 @@
<div
class=
"tip"
>
提示:若打印预览与实际样式不一致,请在弹出的打印窗口中勾选【背景图形】选项。
</div>
<div
class=
"tip"
style=
"color:red"
v-if=
"searchData.sellId==0"
>
当前设计文档没有保存,无法下载PDF,请先保存文档。
</div>
</div>
<a
ref=
"downloadLink"
target=
"_blank"
:href=
"fileUrl"
@
load=
"downLoadEndHandler"
style=
"display:none"
v-else
></a>
<a
ref=
"downloadLink"
target=
"_blank"
:href=
"fileUrl"
style=
"display:none"
v-if=
"param.model=='2' &&searchData.sellId!=0"
></a>
<!-- <a ref="downloadLink" :href="fileUrl" @click.prevent="downloadFile" style="display:none" v-else></a> -->
<div
class=
"q-mt-lg configs"
style=
"font-size: 12px;color:red"
v-if=
"searchData.sellId==0"
>
当前设计文档没有保存,无法下载PDF,请先保存文档。
</div>
<div
class=
"btns"
>
<Button
class=
"btn export"
type=
"primary"
@
click=
"expPDF()"
v-if=
"param.model!='2'"
>
导出PDF
</Button>
<Button
class=
"btn export"
type=
"primary"
@
click=
"exportOnlinePdf()"
v-if=
"param.model=='2' && searchData.sellId!=0"
>
导出PDF
</Button>
...
...
@@ -79,7 +80,6 @@ import Button from '@/components/Button.vue'
import
RadioButton
from
'@/components/RadioButton.vue'
import
RadioGroup
from
'@/components/RadioGroup.vue'
import
Select
from
'@/components/Select.vue'
import
{
ElLoading
}
from
'element-plus'
import
{
injectKeyTemplate
}
from
'@/types/injectKey'
import
{
watch
}
from
'vue'
import
{
nextTick
}
from
'vue'
...
...
@@ -93,7 +93,6 @@ const { slides, currentSlide, viewportRatio } = storeToRefs(useSlidesStore())
const
newSlides
=
ref
<
Array
<
any
>>
([])
const
searchData
=
ref
({}
as
any
)
searchData
.
value
=
inject
(
injectKeyTemplate
)
console
.
log
(
searchData
.
value
)
const
pdfThumbnailsRef
=
ref
<
HTMLElement
>
()
const
rangeType
=
ref
<
'all'
|
'current'
>
(
'all'
)
const
count
=
ref
(
1
)
...
...
@@ -128,20 +127,10 @@ const exportOnlinePdf=()=>{
autoSave
.
value
=
1
}
const
beginDownload
=
async
()
=>
{
// loadingObj.value = ElLoading.service({
// text:'正在下载中,请耐心等待',
// lock:true,
// body:true
// })
fileUrl
.
value
=
`http://fileservice.oytour.com/api/pdf/
${
searchData
.
value
.
sellId
}
`
nextTick
(()
=>
{
downloadLink
.
value
.
click
()
})
//downloadLink.value.click()
}
const
downLoadEndHandler
=
()
=>
{
if
(
loadingObj
.
value
)
loadingObj
.
value
.
close
()
loadingObj
.
value
=
null
}
watch
(()
=>
autoSave
.
value
,(
newVal
)
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment