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
f518b4da
Commit
f518b4da
authored
Aug 20, 2024
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复字体上传后无法应用,修复无法重新上传
parent
2c35a49a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
9 deletions
+24
-9
diskSpace.vue
src/components/CloudDisk/diskSpace.vue
+2
-2
Index.vue
src/components/PSD/Index.vue
+15
-1
font.ts
src/store/font.ts
+1
-1
slides.ts
src/store/slides.ts
+6
-5
No files found.
src/components/CloudDisk/diskSpace.vue
View file @
f518b4da
...
@@ -56,7 +56,7 @@
...
@@ -56,7 +56,7 @@
</div>
</div>
<div
ref=
"imgDiskRef"
style=
"height: 420px;padding-top: 20px;"
>
<div
ref=
"imgDiskRef"
style=
"height: 420px;padding-top: 20px;"
>
<div
class=
"CloudDisk-R-Center row"
v-loading=
"loading"
>
<div
class=
"CloudDisk-R-Center row"
v-loading=
"loading"
>
<FileInput
v-if=
"userInfo.it && (userInfo.ia || userInfo.ic)"
:multiple=
"true"
@
change=
"files => insertImageElement(files)"
>
<
!-- <
FileInput v-if="userInfo.it && (userInfo.ia || userInfo.ic)" :multiple="true" @change="files => insertImageElement(files)">
<div class="CloudDisk-R-Box">
<div class="CloudDisk-R-Box">
<div class="CloudDisk-R-Plus column items-center cusor-pointer">
<div class="CloudDisk-R-Plus column items-center cusor-pointer">
<el-icon class="el-input__icon" size="30px" title="">
<el-icon class="el-input__icon" size="30px" title="">
...
@@ -65,7 +65,7 @@
...
@@ -65,7 +65,7 @@
<span>添加图片</span>
<span>添加图片</span>
</div>
</div>
</div>
</div>
</FileInput>
</FileInput>
-->
<
template
v-for=
"(item,index) in dataList"
>
<
template
v-for=
"(item,index) in dataList"
>
<div
class=
"CloudDisk-R-Box cursor-pointer"
<div
class=
"CloudDisk-R-Box cursor-pointer"
...
...
src/components/PSD/Index.vue
View file @
f518b4da
...
@@ -59,6 +59,7 @@
...
@@ -59,6 +59,7 @@
/>
/>
</el-select>
</el-select>
<el-upload
<el-upload
ref=
"uploadFontRef"
v-loading=
"uploadingIndex==i"
v-loading=
"uploadingIndex==i"
:on-change=
"(uploadFile:any, uploadFiles:any)=> uploadFontHandler(uploadFile, uploadFiles,x.fontFamily)"
:on-change=
"(uploadFile:any, uploadFiles:any)=> uploadFontHandler(uploadFile, uploadFiles,x.fontFamily)"
action=
""
action=
""
...
@@ -118,6 +119,7 @@ const emit = defineEmits<{
...
@@ -118,6 +119,7 @@ const emit = defineEmits<{
(
event
:
'closed'
):
void
(
event
:
'closed'
):
void
}
>
()
}
>
()
const
uploadFontRef
=
ref
()
const
visibleStatus
=
ref
(
props
.
visible
)
const
visibleStatus
=
ref
(
props
.
visible
)
const
upload
=
ref
<
UploadInstance
>
()
const
upload
=
ref
<
UploadInstance
>
()
const
isResolving
=
ref
(
false
)
const
isResolving
=
ref
(
false
)
...
@@ -174,7 +176,14 @@ const handleChange: UploadProps['onChange'] = (uploadFile, uploadFiles) => {
...
@@ -174,7 +176,14 @@ const handleChange: UploadProps['onChange'] = (uploadFile, uploadFiles) => {
}
}
}
}
const
clearFilesHandle
=
()
=>
{
if
(
uploadFontRef
.
value
){
uploadFontRef
.
value
[
0
].
clearFiles
()
}
}
const
uploadFontHandler
=
async
(
uploadFile
:
any
,
uploadFiles
:
any
,
fontName
:
string
)
=>
{
const
uploadFontHandler
=
async
(
uploadFile
:
any
,
uploadFiles
:
any
,
fontName
:
string
)
=>
{
const
ns
=
uploadFile
.
name
.
toLowerCase
().
split
(
'.'
)
const
ns
=
uploadFile
.
name
.
toLowerCase
().
split
(
'.'
)
const
n
=
ns
[
ns
.
length
-
1
]
const
n
=
ns
[
ns
.
length
-
1
]
const
acceptFile
=
[
'ttf'
,
'otf'
,
'woff'
]
const
acceptFile
=
[
'ttf'
,
'otf'
,
'woff'
]
...
@@ -182,6 +191,7 @@ const uploadFontHandler = async (uploadFile:any, uploadFiles:any, fontName:strin
...
@@ -182,6 +191,7 @@ const uploadFontHandler = async (uploadFile:any, uploadFiles:any, fontName:strin
ElMessage
.
error
({
ElMessage
.
error
({
message
:
`不支持此类文件上传,目前只支持
${
acceptFile
.
join
(
','
)}
等文件上传`
message
:
`不支持此类文件上传,目前只支持
${
acceptFile
.
join
(
','
)}
等文件上传`
})
})
clearFilesHandle
()
return
;
return
;
}
}
uploadingIndex
.
value
=
fonts
.
value
?.
findIndex
(
x
=>
x
.
fontFamily
==
fontName
)??
-
1
uploadingIndex
.
value
=
fonts
.
value
?.
findIndex
(
x
=>
x
.
fontFamily
==
fontName
)??
-
1
...
@@ -192,6 +202,7 @@ const uploadFontHandler = async (uploadFile:any, uploadFiles:any, fontName:strin
...
@@ -192,6 +202,7 @@ const uploadFontHandler = async (uploadFile:any, uploadFiles:any, fontName:strin
}
catch
(
error
)
{
}
catch
(
error
)
{
ElMessage
.
error
({
message
:
'字体无法识别,请更换'
})
ElMessage
.
error
({
message
:
'字体无法识别,请更换'
})
uploadingIndex
.
value
=-
1
uploadingIndex
.
value
=-
1
clearFilesHandle
()
return
return
}
}
...
@@ -199,6 +210,7 @@ const uploadFontHandler = async (uploadFile:any, uploadFiles:any, fontName:strin
...
@@ -199,6 +210,7 @@ const uploadFontHandler = async (uploadFile:any, uploadFiles:any, fontName:strin
if
(
flagIndex
>
0
){
if
(
flagIndex
>
0
){
ElMessage
.
error
({
message
:
`
${
info
.
name
}
字体已存在,请选择使用已有字体`
})
ElMessage
.
error
({
message
:
`
${
info
.
name
}
字体已存在,请选择使用已有字体`
})
uploadingIndex
.
value
=-
1
uploadingIndex
.
value
=-
1
clearFilesHandle
()
return
return
}
}
let
url
=
await
FileService
.
uploadToFontServerAsync
(
uploadFile
?.
raw
)
let
url
=
await
FileService
.
uploadToFontServerAsync
(
uploadFile
?.
raw
)
...
@@ -238,6 +250,7 @@ const uploadFontHandler = async (uploadFile:any, uploadFiles:any, fontName:strin
...
@@ -238,6 +250,7 @@ const uploadFontHandler = async (uploadFile:any, uploadFiles:any, fontName:strin
})
})
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
clearFilesHandle
()
}
}
uploadingIndex
.
value
=-
1
uploadingIndex
.
value
=-
1
}
}
...
@@ -280,7 +293,8 @@ const resolveToSliderHandler = async()=>{
...
@@ -280,7 +293,8 @@ const resolveToSliderHandler = async()=>{
}
}
}
}
const
replaceFontFamily
=
()
=>
{
const
replaceFontFamily
=
()
=>
{
fonts
.
value
?.
forEach
(
item
=>
{
const
replaceList
=
fonts
.
value
?.
filter
(
x
=>
x
.
selectedFont
&&
x
.
selectedFont
!=
''
)??[]
replaceList
.
forEach
(
item
=>
{
sliders
.
value
.
forEach
(
x
=>
{
sliders
.
value
.
forEach
(
x
=>
{
x
.
elements
.
forEach
((
y
:
any
)
=>
{
x
.
elements
.
forEach
((
y
:
any
)
=>
{
if
(
y
.
defaultFontName
&&
y
.
defaultFontName
.
indexOf
(
item
.
fontFamily
)
!=-
1
){
if
(
y
.
defaultFontName
&&
y
.
defaultFontName
.
indexOf
(
item
.
fontFamily
)
!=-
1
){
...
...
src/store/font.ts
View file @
f518b4da
...
@@ -133,7 +133,7 @@ export const useFontStore = defineStore('fonts',{
...
@@ -133,7 +133,7 @@ export const useFontStore = defineStore('fonts',{
try
{
try
{
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
(
response
.
data
.
data
)
this
.
formatFonts
.
push
({
this
.
formatFonts
.
push
({
label
:
item
.
label
,
label
:
item
.
label
,
value
:
item
.
fontFamily
,
value
:
item
.
fontFamily
,
...
...
src/store/slides.ts
View file @
f518b4da
...
@@ -150,11 +150,12 @@ export const useSlidesStore = defineStore('slides', {
...
@@ -150,11 +150,12 @@ export const useSlidesStore = defineStore('slides', {
let
iFonts
:
string
[]
=
[]
let
iFonts
:
string
[]
=
[]
var
regex
=
/
(?<
=font-family:
\s
*
)
.*
?(?=
;
)
/g
var
regex
=
/
(?<
=font-family:
\s
*
)
.*
?(?=
;
)
/g
slides
.
forEach
(
x
=>
{
slides
.
forEach
(
x
=>
{
x
.
elements
&&
x
.
elements
.
forEach
(
y
=>
{
x
.
elements
&&
x
.
elements
.
forEach
((
y
:
any
)
=>
{
let
temp
=
JSON
.
parse
(
JSON
.
stringify
(
y
))
if
(
y
.
defaultFontName
)
{
if
(
temp
.
defaultFontName
)
iFonts
.
push
(
temp
.
defaultFontName
)
iFonts
.
push
(
y
.
defaultFontName
)
if
(
temp
.
content
){
}
let
tempFonts
=
temp
.
content
.
match
(
regex
)
if
(
y
.
content
){
let
tempFonts
=
y
.
content
.
match
(
regex
)
if
(
tempFonts
){
if
(
tempFonts
){
tempFonts
.
forEach
((
item
:
string
)
=>
{
tempFonts
.
forEach
((
item
:
string
)
=>
{
let
f
=
item
.
replaceAll
(
"'"
,
''
).
replaceAll
(
'"'
,
""
).
trim
().
split
(
','
)
let
f
=
item
.
replaceAll
(
"'"
,
''
).
replaceAll
(
'"'
,
""
).
trim
().
split
(
','
)
...
...
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