Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sn_config
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
sn_config
Commits
6382c08e
Commit
6382c08e
authored
Oct 14, 2023
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:配置完成
parent
1de9a314
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
48 deletions
+21
-48
form.component.html
form/src/app/form/form.component.html
+14
-33
form.component.ts
form/src/app/form/form.component.ts
+7
-15
No files found.
form/src/app/form/form.component.html
View file @
6382c08e
...
...
@@ -4,56 +4,37 @@
<div
class=
"border"
style=
"width: 1000px;"
>
<span
style=
"font-size: 20px;"
>
标题:
</span>
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
title
"
(
blur
)="
save
()"
>
<span
style=
"font-size: 20px;"
>
题目说明:
</span>
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
questionText
"
(
blur
)="
save
()"
>
<span
style=
"font-size: 20px;"
>
题目说明音频:
</span>
<app-audio-recorder
[
audioUrl
]="
item
.
questionTextAudio
"
(
audioUploaded
)="
onAssetUploadSuccess
($
event
,
'
questionTextAudio
')"
[
_audioName
]="
item
.
audioFileName
"
(
audioName
)="
saveAudioFileName
($
event
)"
></app-audio-recorder>
</div>
<div
class=
"border"
style=
"width: 1000px;"
>
<div
*
ngFor=
"let
question of item.question
s; let i = index"
>
<div
*
ngFor=
"let
page of item.page
s; let i = index"
>
<div
class=
"border"
style=
"width: 950px;"
>
<span
style=
"font-size: 20px;"
>
选项类型:
</span>
<div
*
ngIf=
"question.type=='img'"
>
<button
class=
"button-right"
>
图片
</button>
<button
class=
"button-disable"
(
click
)="
question
.
type=
'txt'
;
save
();"
>
文字
</button>
</div>
<div
*
ngIf=
"question.type=='txt'"
>
<button
class=
"button-disable"
(
click
)="
question
.
type=
'img'
;
save
();"
>
图片
</button>
<button
class=
"button-right"
>
文字
</button>
<div>
<span>
副标题:
</span>
<input
type=
"text"
nz-input
[(
ngModel
)]="
page
.
sub_title
"
(
blur
)="
save
()"
>
</div>
<div
*
ngIf=
"question.type=='img'"
>
图片:
<div>
<span>
图片:
</span>
<div
style=
"width: 300px;"
>
<app-upload-image-with-preview
[
picUrl
]="
question
.
image
"
(
imageUploaded
)="
onAssetUploadSuccess
($
event
,
'
question
s
',
i
,
'
image
')"
>
<app-upload-image-with-preview
[
picUrl
]="
page
.
image
"
(
imageUploaded
)="
onAssetUploadSuccess
($
event
,
'
page
s
',
i
,
'
image
')"
>
</app-upload-image-with-preview>
</div>
</div>
<span>
音频:
</span>
<app-audio-recorder
[
audioUrl
]="
question
.
audio
"
(
audioUploaded
)="
onAssetUploadSuccess
($
event
,
'
question
s
',
i
,
'
audio
')"
>
<app-audio-recorder
[
audioUrl
]="
page
.
audio
"
(
audioUploaded
)="
onAssetUploadSuccess
($
event
,
'
page
s
',
i
,
'
audio
')"
>
</app-audio-recorder>
<div
*
ngIf=
"question.type=='txt'"
>
<div>
<span>
文本:
</span>
<
input
type=
"text"
nz-input
[(
ngModel
)]="
question
.
text
"
(
blur
)="
save
()"
>
<
textarea
rows=
"4"
nz-input
[(
ngModel
)]="
page
.
text
"
(
blur
)="
save
()"
></textarea
>
</div>
<br>
<button
style=
"width: 900px; height: 30px; color: red;"
(
click
)="
remove
Question
(
i
)"
>
删除题目
</button>
<button
style=
"width: 900px; height: 30px; color: red;"
(
click
)="
remove
Page
(
i
)"
>
删除页面
</button>
</div>
</div>
<div
class=
"border"
style=
"width: 950px;"
>
<button
style=
"width: 900px; height: 100px;"
(
click
)="
add
Question
()"
>
增加题目
</button>
<button
style=
"width: 900px; height: 100px;"
(
click
)="
add
Page
()"
>
增加页面
</button>
</div>
</div>
</div>
...
...
form/src/app/form/form.component.ts
View file @
6382c08e
...
...
@@ -11,19 +11,16 @@ import { ComponentBase } from './ComponentBase';
export
class
FormComponent
extends
ComponentBase
implements
OnInit
,
OnChanges
,
OnDestroy
{
// 储存数据用
saveKey
=
"
card_machine
"
;
saveKey
=
"
sn_config
"
;
// 储存对象
item
:
any
=
{
title
:
''
,
questionText
:
''
,
questionTextAudio
:
''
,
audioFileName
:
''
,
questions
:
[],
pages
:
[],
};
add
Question
()
{
this
.
item
.
question
s
.
push
({
type
:
'
img
'
,
add
Page
()
{
this
.
item
.
page
s
.
push
({
sub_title
:
'
'
,
audio
:
''
,
text
:
''
,
image
:
''
...
...
@@ -31,13 +28,8 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
this
.
save
();
}
removeQuestion
(
idx
)
{
this
.
item
.
questions
.
splice
(
idx
,
1
);
this
.
save
();
}
saveAudioFileName
(
name
)
{
this
.
item
.
audioFileName
=
name
;
removePage
(
idx
)
{
this
.
item
.
pages
.
splice
(
idx
,
1
);
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