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
f2a7de83
Commit
f2a7de83
authored
Dec 01, 2023
by
zhengke
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/viitto/pptist
parents
fc73730a
e6abb973
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
107 additions
and
48 deletions
+107
-48
components.d.ts
components.d.ts
+0
-1
Index.vue
src/components/PSD/Index.vue
+5
-4
font.ts
src/store/font.ts
+7
-1
index.ts
src/utils/prosemirror/index.ts
+1
-1
font.ts
src/utils/psdParser/font.ts
+3
-3
index.ts
src/utils/psdParser/index.ts
+2
-2
layer.ts
src/utils/psdParser/layer.ts
+2
-2
resolve.ts
src/utils/psdParser/resolve.ts
+9
-8
aliyun.ts
src/utils/upload/aliyun.ts
+1
-1
index.vue
src/views/Editor/EditorHeader/index.vue
+77
-25
No files found.
components.d.ts
View file @
f2a7de83
...
@@ -28,7 +28,6 @@ declare module 'vue' {
...
@@ -28,7 +28,6 @@ declare module 'vue' {
ElInput
:
typeof
import
(
'element-plus/es'
)[
'ElInput'
]
ElInput
:
typeof
import
(
'element-plus/es'
)[
'ElInput'
]
ElOption
:
typeof
import
(
'element-plus/es'
)[
'ElOption'
]
ElOption
:
typeof
import
(
'element-plus/es'
)[
'ElOption'
]
ElPagination
:
typeof
import
(
'element-plus/es'
)[
'ElPagination'
]
ElPagination
:
typeof
import
(
'element-plus/es'
)[
'ElPagination'
]
ElPopover
:
typeof
import
(
'element-plus/es'
)[
'ElPopover'
]
ElRow
:
typeof
import
(
'element-plus/es'
)[
'ElRow'
]
ElRow
:
typeof
import
(
'element-plus/es'
)[
'ElRow'
]
ElSelect
:
typeof
import
(
'element-plus/es'
)[
'ElSelect'
]
ElSelect
:
typeof
import
(
'element-plus/es'
)[
'ElSelect'
]
ElTable
:
typeof
import
(
'element-plus/es'
)[
'ElTable'
]
ElTable
:
typeof
import
(
'element-plus/es'
)[
'ElTable'
]
...
...
src/components/PSD/Index.vue
View file @
f2a7de83
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<template
#
header
>
<template
#
header
>
<div
class=
"text-title"
>
导入PSD设计文件
</div>
<div
class=
"text-title"
>
导入PSD设计文件
</div>
</
template
>
</
template
>
<div
v-if=
"!thumbnails || thumbnails.length==0"
>
<div
v-if=
"!thumbnails || thumbnails.length==0
|| isResolving
"
>
<el-upload
<el-upload
v-loading=
"isResolving"
v-loading=
"isResolving"
ref=
"upload"
ref=
"upload"
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
<div
class=
"row"
style=
"flex-wrap:wrap"
>
<div
class=
"row"
style=
"flex-wrap:wrap"
>
<img
v-for=
"(x,i) in thumbnails"
:key=
"i"
style=
"height:auto;width:calc(25% - 10px);"
class=
"q-mr-md rounded q-mt-md"
:src=
"x"
/>
<img
v-for=
"(x,i) in thumbnails"
:key=
"i"
style=
"height:auto;width:calc(25% - 10px);"
class=
"q-mr-md rounded q-mt-md"
:src=
"x"
/>
</div>
</div>
<div
class=
"text-small text-grey q-mt-lg"
>
请完善以下字体信息补充:
</div>
<div
class=
"text-small text-grey q-mt-lg"
v-if=
"fonts && fonts.length>0"
>
请完善以下字体信息补充:
</div>
<div
class=
"row items-center q-mt-md"
v-for=
"(x,i) in fonts"
:key=
"x"
>
<div
class=
"row items-center q-mt-md"
v-for=
"(x,i) in fonts"
:key=
"x"
>
<div
class=
"text-small col"
>
字体名称:{{ x }}
</div>
<div
class=
"text-small col"
>
字体名称:{{ x }}
</div>
<el-upload
<el-upload
...
@@ -113,7 +113,7 @@ const handleChange: UploadProps['onChange'] = (uploadFile, uploadFiles) => {
...
@@ -113,7 +113,7 @@ const handleChange: UploadProps['onChange'] = (uploadFile, uploadFiles) => {
try
{
try
{
PSD
.
fromURL
(
url
).
then
(
async
(
psd
:
any
)
=>
{
PSD
.
fromURL
(
url
).
then
(
async
(
psd
:
any
)
=>
{
thumbnails
.
value
=
await
toThumbnails
(
psd
)
thumbnails
.
value
=
await
toThumbnails
(
psd
)
sliders
.
value
=
toSlider
(
psd
)
sliders
.
value
=
await
toSlider
(
psd
)
fonts
.
value
=
getFonts
(
psd
)
fonts
.
value
=
getFonts
(
psd
)
if
(
fonts
.
value
){
if
(
fonts
.
value
){
fonts
.
value
=
fonts
.
value
.
filter
(
x
=>
useFontStore
().
getFonts
.
findIndex
(
y
=>
y
.
fontFamily
==
x
)
==-
1
)
fonts
.
value
=
fonts
.
value
.
filter
(
x
=>
useFontStore
().
getFonts
.
findIndex
(
y
=>
y
.
fontFamily
==
x
)
==-
1
)
...
@@ -134,7 +134,7 @@ const uploadFontHandler = async (uploadFile:any, uploadFiles:any, fontName:strin
...
@@ -134,7 +134,7 @@ const uploadFontHandler = async (uploadFile:any, uploadFiles:any, fontName:strin
const
url
=
await
AliyunUpload
.
UploadAsync
(
uploadFile
?.
raw
,
"tripfont/"
+
uploadFile
.
name
)
const
url
=
await
AliyunUpload
.
UploadAsync
(
uploadFile
?.
raw
,
"tripfont/"
+
uploadFile
.
name
)
if
(
url
&&
url
!=
''
){
if
(
url
&&
url
!=
''
){
//添加字体
//添加字体
uploadFinishFont
.
value
.
push
(
fontName
)
//
uploadFinishFont.value.push(fontName)
let
data
:
CustomerFonts
=
{
let
data
:
CustomerFonts
=
{
fontFamily
:
fontName
,
fontFamily
:
fontName
,
label
:
uploadFile
.
name
.
split
(
'.'
)[
0
],
label
:
uploadFile
.
name
.
split
(
'.'
)[
0
],
...
@@ -182,6 +182,7 @@ const resolveToSliderHandler = async()=>{
...
@@ -182,6 +182,7 @@ const resolveToSliderHandler = async()=>{
type
:
'error'
type
:
'error'
})
})
}
else
{
}
else
{
await
useFontStore
().
loadAllFonts
()
useSlidesStore
().
setSlides
(
sliders
.
value
)
useSlidesStore
().
setSlides
(
sliders
.
value
)
useSlidesStore
().
updateSlideIndex
(
0
)
useSlidesStore
().
updateSlideIndex
(
0
)
close
()
close
()
...
...
src/store/font.ts
View file @
f2a7de83
...
@@ -52,7 +52,9 @@ export const useFontStore = defineStore('fonts',{
...
@@ -52,7 +52,9 @@ export const useFontStore = defineStore('fonts',{
text
:
'正在加载字体文件'
text
:
'正在加载字体文件'
})
})
let
fonts
=
Array
.
from
(
new
Set
(
items
))
let
fonts
=
Array
.
from
(
new
Set
(
items
))
console
.
log
(
fonts
)
for
(
let
i
=
0
;
i
<
fonts
.
length
;
i
++
)
{
fonts
[
i
]
=
fonts
[
i
].
split
(
','
)[
0
]
}
fonts
=
fonts
.
filter
(
x
=>
this
.
loaded
.
indexOf
(
x
)
==-
1
)
fonts
=
fonts
.
filter
(
x
=>
this
.
loaded
.
indexOf
(
x
)
==-
1
)
const
loadFonts
=
this
.
fonts
.
filter
(
x
=>
fonts
.
indexOf
(
x
.
fontFamily
)
!=-
1
)
const
loadFonts
=
this
.
fonts
.
filter
(
x
=>
fonts
.
indexOf
(
x
.
fontFamily
)
!=-
1
)
if
(
loadFonts
&&
loadFonts
.
length
>
0
){
if
(
loadFonts
&&
loadFonts
.
length
>
0
){
...
@@ -79,6 +81,10 @@ export const useFontStore = defineStore('fonts',{
...
@@ -79,6 +81,10 @@ export const useFontStore = defineStore('fonts',{
const
response
=
await
FontService
.
SetFontAsync
(
data
)
const
response
=
await
FontService
.
SetFontAsync
(
data
)
if
(
response
.
data
.
resultCode
==
ApiResult
.
SUCCESS
){
if
(
response
.
data
.
resultCode
==
ApiResult
.
SUCCESS
){
this
.
fonts
.
push
(
item
)
this
.
fonts
.
push
(
item
)
this
.
formatFonts
.
push
({
label
:
item
.
label
,
value
:
item
.
fontFamily
})
return
true
return
true
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
...
...
src/utils/prosemirror/index.ts
View file @
f2a7de83
...
@@ -13,7 +13,7 @@ export const createDocument = (content: string) => {
...
@@ -13,7 +13,7 @@ export const createDocument = (content: string) => {
const
htmlString
=
`<div>
${
content
}
</div>`
const
htmlString
=
`<div>
${
content
}
</div>`
const
parser
=
new
window
.
DOMParser
()
const
parser
=
new
window
.
DOMParser
()
const
element
=
parser
.
parseFromString
(
htmlString
,
'text/html'
).
body
.
firstElementChild
const
element
=
parser
.
parseFromString
(
htmlString
,
'text/html'
).
body
.
firstElementChild
console
.
log
(
element
)
return
DOMParser
.
fromSchema
(
schema
).
parse
(
element
as
Element
)
return
DOMParser
.
fromSchema
(
schema
).
parse
(
element
as
Element
)
}
}
...
...
src/utils/psdParser/font.ts
View file @
f2a7de83
export
const
ResolveFonts
=
(
item
:
any
):
any
[]
=>
{
export
const
ResolveFonts
=
(
item
:
any
):
any
[]
=>
{
const
ignore
=
[
'AdobeInvisFont'
,
'AdobeHeitiStd-Regular'
]
let
f
=
item
.
layer
.
typeTool
().
export
()
let
f
=
item
.
layer
.
typeTool
().
export
()
const
{
font
}
=
f
const
{
font
}
=
f
const
{
names
}
=
font
const
{
names
}
=
font
let
fonts
=
names
.
filter
((
x
:
any
)
=>
ignore
.
indexOf
(
x
)
==-
1
)
return
name
s
return
font
s
}
}
\ No newline at end of file
src/utils/psdParser/index.ts
View file @
f2a7de83
import
{
ResolvePsdToSliderHandler
,
ResolveThumbHandler
,
ResolveSliderFonts
}
from
"./resolve"
import
{
ResolvePsdToSliderHandler
,
ResolveThumbHandler
,
ResolveSliderFonts
}
from
"./resolve"
export
const
toSlider
=
(
psd
:
any
)
=>
{
export
const
toSlider
=
async
(
psd
:
any
)
=>
{
const
sliders
=
ResolvePsdToSliderHandler
(
psd
);
const
sliders
=
await
ResolvePsdToSliderHandler
(
psd
);
return
sliders
return
sliders
}
}
export
const
getFonts
=
(
psd
:
any
)
=>
{
export
const
getFonts
=
(
psd
:
any
)
=>
{
...
...
src/utils/psdParser/layer.ts
View file @
f2a7de83
import
{
PPTImageElement
}
from
'@/types/slides'
;
import
{
PPTImageElement
}
from
'@/types/slides'
;
import
{
compressionThumbnail
}
from
'./compressor'
;
import
{
compressionThumbnail
}
from
'./compressor'
;
export
const
ResolveLayer
=
(
item
:
any
,
index
:
number
,
offsetLeft
:
number
,
offsetTop
:
number
):
PPTImageElement
|
null
=>
{
export
const
ResolveLayer
=
async
(
item
:
any
,
index
:
number
,
offsetLeft
:
number
,
offsetTop
:
number
):
Promise
<
PPTImageElement
|
null
>
=>
{
//await compressionThumbnail(item.layer.image.toBase64(), "image/png", 0, 0.8)
//await compressionThumbnail(item.layer.image.toBase64(), "image/png", 0, 0.8)
try
{
try
{
const
src
=
item
.
layer
.
image
.
toBase64
()
const
src
=
await
compressionThumbnail
(
item
.
layer
.
image
.
toBase64
(),
"image/png"
,
0
,
0.8
)
//
item.layer.image.toBase64()
const
left
=
item
.
coords
.
left
-
offsetLeft
const
left
=
item
.
coords
.
left
-
offsetLeft
const
width
=
item
.
coords
.
right
-
item
.
coords
.
left
const
width
=
item
.
coords
.
right
-
item
.
coords
.
left
const
top
=
item
.
coords
.
top
-
offsetTop
const
top
=
item
.
coords
.
top
-
offsetTop
...
...
src/utils/psdParser/resolve.ts
View file @
f2a7de83
...
@@ -26,7 +26,7 @@ export const ResolveThumbHandler = async (psd:any)=>{
...
@@ -26,7 +26,7 @@ export const ResolveThumbHandler = async (psd:any)=>{
return
imgs
return
imgs
}
}
export
const
ResolvePsdToSliderHandler
=
(
psd
:
any
)
=>
{
export
const
ResolvePsdToSliderHandler
=
async
(
psd
:
any
)
=>
{
const
ID_PREV
=
"import-slide-"
const
ID_PREV
=
"import-slide-"
let
items
:
Array
<
any
>
=
psd
.
tree
().
children
().
filter
((
x
:
any
)
=>
x
.
layer
.
visible
)
let
items
:
Array
<
any
>
=
psd
.
tree
().
children
().
filter
((
x
:
any
)
=>
x
.
layer
.
visible
)
...
@@ -42,7 +42,7 @@ export const ResolvePsdToSliderHandler = (psd:any) => {
...
@@ -42,7 +42,7 @@ export const ResolvePsdToSliderHandler = (psd:any) => {
if
(
_children
&&
_children
.
length
>
0
){
if
(
_children
&&
_children
.
length
>
0
){
const
{
top
,
left
}
=
x
.
layer
.
artboard
().
export
().
coords
const
{
top
,
left
}
=
x
.
layer
.
artboard
().
export
().
coords
t
.
elements
=
GetSlidersHandler
(
_children
,
left
,
top
).
reverse
()
t
.
elements
=
(
await
GetSlidersHandler
(
_children
,
left
,
top
)
).
reverse
()
}
}
sliders
.
push
(
t
)
sliders
.
push
(
t
)
...
@@ -77,26 +77,27 @@ const CreateDefaultSlider = (id:string):Slide =>{
...
@@ -77,26 +77,27 @@ const CreateDefaultSlider = (id:string):Slide =>{
}
}
}
}
const
GetSlidersHandler
=
(
child
:
any
[],
offsetLeft
:
number
,
offsetTop
:
number
)
:
PPTElement
[]
=>
{
const
GetSlidersHandler
=
async
(
child
:
any
[],
offsetLeft
:
number
,
offsetTop
:
number
)
:
Promise
<
PPTElement
[]
>
=>
{
let
elements
=
[]
as
Array
<
PPTElement
>
let
elements
=
[]
as
Array
<
PPTElement
>
child
.
forEach
(
x
=>
{
for
(
let
i
=
0
;
i
<
child
.
length
;
i
++
)
{
const
x
=
child
[
i
]
Z_INDEX
--
Z_INDEX
--
if
(
x
.
layer
.
typeTool
){
if
(
x
.
layer
.
typeTool
){
elements
.
push
(
ResolveText
(
x
,
Z_INDEX
,
offsetLeft
,
offsetTop
))
elements
.
push
(
ResolveText
(
x
,
Z_INDEX
,
offsetLeft
,
offsetTop
))
}
}
else
if
(
x
.
width
&&
x
.
width
>
0
&&
x
.
layer
.
image
){
else
if
(
x
.
width
&&
x
.
width
>
0
&&
x
.
layer
.
image
){
let
ele
=
ResolveLayer
(
x
,
Z_INDEX
,
offsetLeft
,
offsetTop
)
let
ele
=
await
ResolveLayer
(
x
,
Z_INDEX
,
offsetLeft
,
offsetTop
)
if
(
ele
)
elements
.
push
(
ele
)
if
(
ele
)
elements
.
push
(
ele
)
}
}
if
(
x
.
_children
&&
x
.
_children
.
length
>
0
){
if
(
x
.
_children
&&
x
.
_children
.
length
>
0
){
let
childers
=
GetSlidersHandler
(
x
.
_children
,
offsetLeft
,
offsetTop
)
??
[]
let
childers
=
await
GetSlidersHandler
(
x
.
_children
,
offsetLeft
,
offsetTop
)
??
[]
elements
=
elements
.
concat
(
childers
)
elements
=
elements
.
concat
(
childers
)
}
}
}
)
}
return
elements
return
elements
}
}
...
...
src/utils/upload/aliyun.ts
View file @
f2a7de83
...
@@ -16,7 +16,7 @@ class AliyunUpload {
...
@@ -16,7 +16,7 @@ class AliyunUpload {
})
})
}
}
static
UploadAsync
=
async
(
file
:
FormData
,
name
:
string
)
=>
{
static
UploadAsync
=
async
(
file
:
any
,
name
:
string
)
=>
{
try
{
try
{
const
oss
=
this
.
GetOSS
()
const
oss
=
this
.
GetOSS
()
let
result
=
await
oss
.
put
(
name
,
file
)
let
result
=
await
oss
.
put
(
name
,
file
)
...
...
src/views/Editor/EditorHeader/index.vue
View file @
f2a7de83
...
@@ -65,13 +65,13 @@
...
@@ -65,13 +65,13 @@
</div>
</div>
<!-- <el-button type="danger" v-tooltip="'保存'"
<!-- <el-button type="danger" v-tooltip="'保存'"
size="small" icon="Check" circle :loading="datas.loading"
size="small" icon="Check" circle :loading="datas.loading"
@click="setTemplate()" style="color: #ffff;"></el-button> -->
@click="setTemplate()" style="color: #ffff;"></el-button>
setTemplate()
-->
<el-button
type=
"danger"
<el-button
type=
"danger"
v-if=
"(userInfo.IsEditTripTemplate==1&&model)||ConfigId>0"
v-if=
"(userInfo.IsEditTripTemplate==1&&model)||ConfigId>0"
size=
"small"
:loading=
"datas.loading"
size=
"small"
:loading=
"datas.loading"
@
click=
"setTemplate
()
"
style=
"color: #ffff;margin-left: 10px;"
>
@
click=
"setTemplate"
style=
"color: #ffff;margin-left: 10px;"
>
<
template
v-if=
"userInfo.IsEditTripTemplate==1&&model"
>
<
template
v-if=
"userInfo.IsEditTripTemplate==1&&model"
>
保存模
版
保存模
板
</
template
>
</
template
>
<
template
v-if=
"ConfigId>0"
>
<
template
v-if=
"ConfigId>0"
>
保存行程
保存行程
...
@@ -128,6 +128,9 @@ import Drawer from '@/components/Drawer.vue'
...
@@ -128,6 +128,9 @@ import Drawer from '@/components/Drawer.vue'
import
Input
from
'@/components/Input.vue'
import
Input
from
'@/components/Input.vue'
import
Popover
from
'@/components/Popover.vue'
import
Popover
from
'@/components/Popover.vue'
import
PopoverMenuItem
from
'@/components/PopoverMenuItem.vue'
import
PopoverMenuItem
from
'@/components/PopoverMenuItem.vue'
import
{
PPTImageElement
}
from
'@/types/slides'
import
AliyunUpload
from
'@/utils/upload/aliyun'
import
{
ElLoading
,
ElMessage
}
from
'element-plus'
const
mainStore
=
useMainStore
()
const
mainStore
=
useMainStore
()
...
@@ -218,33 +221,80 @@ const UploadPsdHandler = () => {
...
@@ -218,33 +221,80 @@ const UploadPsdHandler = () => {
// 新增修改模版
// 新增修改模版
const
SetTripTemplateSlide
=
async
()
=>
{
const
SetTripTemplateSlide
=
async
()
=>
{
// console.log(JSON.parse(queryObj.value.TempData),'--------')
try
{
try
{
console
.
log
(
queryObj
.
value
,
'新增修改模版---'
)
let
TemplateRes
=
await
ConfigService
.
SetTripTemplateSlide
(
queryObj
.
value
);
let
TemplateRes
=
await
ConfigService
.
SetTripTemplateSlide
(
queryObj
.
value
);
if
(
TemplateRes
.
data
.
resultCode
==
1
)
{
if
(
TemplateRes
.
data
.
resultCode
==
1
)
{
if
(
!
queryObj
.
value
.
TempId
){
if
(
!
queryObj
.
value
.
TempId
){
queryObj
.
value
.
TempId
=
TemplateRes
.
data
.
data
.
TempId
queryObj
.
value
.
TempId
=
TemplateRes
.
data
.
data
.
TempId
searchData
.
value
.
TempId
=
TemplateRes
.
data
.
data
.
TempId
searchData
.
value
.
TempId
=
TemplateRes
.
data
.
data
.
TempId
}
ElMessage
({
showClose
:
true
,
message
:
'操作成功'
,
type
:
'success'
,
})
dataLoadingStore
.
setDataLoading
(
1
)
}
else
{
ElMessage
({
showClose
:
true
,
message
:
'操作失败'
,
type
:
'warning'
,
})
}
}
catch
(
error
)
{}
datas
.
loading
=
false
}
const
uploadImageHandler
=
async
()
=>
{
let
count
=
0
let
index
=
0
const
instance
=
ElLoading
.
service
({
text
:
'收集需要处理的图片'
})
for
(
let
i
=
0
;
i
<
slides
.
value
.
length
;
i
++
)
{
const
slide
=
slides
.
value
[
i
];
if
(
slide
.
elements
){
count
+=
(
slide
.
elements
.
filter
(
x
=>
"src"
in
x
&&
x
.
src
.
startsWith
(
"data:image"
))
??
[]).
length
}
}
if
(
count
>
0
){
for
(
let
i
=
0
;
i
<
slides
.
value
.
length
;
i
++
)
{
const
slide
=
slides
.
value
[
i
];
if
(
slide
.
elements
){
let
temp
=
slide
.
elements
.
filter
(
x
=>
"src"
in
x
&&
x
.
src
.
startsWith
(
"data:image"
))
??
[]
for
(
let
j
=
0
;
j
<
temp
.
length
;
j
++
){
index
++
instance
.
text
.
value
=
`当前图片处理进度:
${
index
}
/
${
count
}
`
const
item
=
temp
[
j
]
as
PPTImageElement
let
name
=
new
Date
().
getTime
()
+
".png"
const
file
=
dataURLtoFile
(
item
.
src
,
name
)
let
url
=
await
AliyunUpload
.
UploadAsync
(
file
,
`pptist/desgin/
${
name
}
`
)
item
.
src
=
url
const
props
=
{
src
:
url
}
slidesStore
.
updateElement
({
id
:
item
.
id
,
props
,
slideId
:
slide
.
id
})
}
}
ElMessage
({
showClose
:
true
,
message
:
'操作成功'
,
type
:
'success'
,
})
dataLoadingStore
.
setDataLoading
(
1
)
}
else
{
ElMessage
({
showClose
:
true
,
message
:
'操作失败'
,
type
:
'warning'
,
})
}
}
datas
.
loading
=
false
}
}
catch
(
error
)
{
}
datas
.
loading
=
false
instance
.
close
()
}
const
dataURLtoFile
=
(
dataurl
:
string
,
filename
:
string
)
=>
{
let
arr
=
dataurl
.
split
(
","
)
let
mime
=
arr
[
0
].
match
(
/:
(
.*
?)
;/
)[
1
],
bstr
=
atob
(
arr
[
1
]),
n
=
bstr
.
length
,
u8arr
=
new
Uint8Array
(
n
);
while
(
n
--
)
{
u8arr
[
n
]
=
bstr
.
charCodeAt
(
n
);
}
}
return
new
File
([
u8arr
],
filename
,
{
type
:
mime
});
}
}
// 用户新增修改数据
// 用户新增修改数据
const
SetTripTemplateConfig
=
async
()
=>
{
const
SetTripTemplateConfig
=
async
()
=>
{
try
{
try
{
...
@@ -290,6 +340,7 @@ const SetTripTemplateConfig = async () => {
...
@@ -290,6 +340,7 @@ const SetTripTemplateConfig = async () => {
}
}
// 保存
// 保存
const
setTemplate
=
async
()
=>
{
const
setTemplate
=
async
()
=>
{
await
uploadImageHandler
()
let
arr
=
JSON
.
parse
(
JSON
.
stringify
(
slides
.
value
))
let
arr
=
JSON
.
parse
(
JSON
.
stringify
(
slides
.
value
))
if
(
dataLoading
.
value
){
if
(
dataLoading
.
value
){
dataLoadingStore
.
setDataLoading
(
0
)
dataLoadingStore
.
setDataLoading
(
0
)
...
@@ -340,6 +391,7 @@ const setTemplate = async () =>{
...
@@ -340,6 +391,7 @@ const setTemplate = async () =>{
}
}
}
}
// console.log(arr,'-------tttt')
// console.log(arr,'-------tttt')
queryObj
.
value
.
TempData
=
JSON
.
stringify
(
arr
)
queryObj
.
value
.
TempData
=
JSON
.
stringify
(
arr
)
datas
.
loading
=
true
datas
.
loading
=
true
if
(
model
.
value
&&
userInfo
.
value
.
IsEditTripTemplate
==
1
){
if
(
model
.
value
&&
userInfo
.
value
.
IsEditTripTemplate
==
1
){
...
...
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