Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JJ_EXAM
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
JJ_EXAM
Commits
dfa7d78e
Commit
dfa7d78e
authored
Apr 21, 2026
by
JinWei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/jj_exam' into 'master'
feat:显示之前上传的图片 See merge request
!8
parents
42d22a27
62194f52
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
form.component.html
src/app/form/form.component.html
+11
-0
form.component.ts
src/app/form/form.component.ts
+12
-0
No files found.
src/app/form/form.component.html
View file @
dfa7d78e
...
...
@@ -36,6 +36,17 @@
<div
style=
"margin: 20px; display: flex; align-items: flex-start;"
>
<h3
style=
"min-width: 150px; text-align:left; line-height: 32px;"
>
封面图片:
</h3>
<div
style=
"display: flex; flex-wrap: wrap; gap: 15px; flex: 1; max-width: 640px;"
>
<!-- 只有一张图片且在 cover 字段时显示 -->
<div
*
ngIf=
"(!item.covers || item.covers.length === 0) && item.cover"
style=
"width: 200px; position: relative;"
>
<app-upload-image-with-preview
[
picUrl
]="
item
.
cover
"
[
disableUpload
]="
true
"
>
</app-upload-image-with-preview>
<button
nz-button
nzType=
"danger"
nzShape=
"circle"
nzSize=
"small"
style=
"position: absolute; top: -10px; right: -10px; z-index: 10;"
(
click
)="
onDeletaImg
(
item
,
'
cover
')"
>
<i
nz-icon
nzType=
"close"
></i>
</button>
</div>
<div
*
ngFor=
"let url of item.covers; let imgIndex = index"
style=
"width: 200px; position: relative;"
>
<app-upload-image-with-preview
[
picUrl
]="
url
"
[
disableUpload
]="
true
"
>
</app-upload-image-with-preview>
...
...
src/app/form/form.component.ts
View file @
dfa7d78e
...
...
@@ -52,6 +52,10 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
if
(
q
.
optionArr
)
{
this
.
syncOptionKeys
(
q
.
optionArr
);
}
// 兼容旧版本:如果只有 cover 没有 covers,或者 covers 为空但 cover 有值
if
(
q
.
cover
&&
(
!
q
.
covers
||
q
.
covers
.
length
===
0
))
{
q
.
covers
=
[
q
.
cover
];
}
});
}
...
...
@@ -136,12 +140,20 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
item
[
key
]
=
[];
}
item
[
key
].
push
(
e
.
url
);
if
(
item
[
key
].
length
===
1
)
{
item
.
cover
=
item
[
key
][
0
];
}
this
.
save
();
}
onDeleteCoverMultiImg
(
item
,
index
,
key
=
'
covers
'
)
{
if
(
item
[
key
]
&&
item
[
key
][
index
])
{
item
[
key
].
splice
(
index
,
1
);
if
(
item
[
key
].
length
>
0
)
{
item
.
cover
=
item
[
key
][
0
];
}
else
{
item
.
cover
=
""
;
}
this
.
save
();
}
}
...
...
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