Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
NJ_BookTable
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
NJ_BookTable
Commits
015dcb32
Commit
015dcb32
authored
Jun 10, 2022
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 表单配置
parent
a51e2ffb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
70 deletions
+39
-70
form.component.html
form/src/app/form/form.component.html
+31
-50
form.component.ts
form/src/app/form/form.component.ts
+8
-20
No files found.
form/src/app/form/form.component.html
View file @
015dcb32
<div
class=
"model-content"
>
<div
class=
"model-content"
>
<div
style=
"padding: 10px;"
>
<div
style=
"padding: 10px;"
>
<div
class=
"border"
style=
"width: 1000px;"
>
<div
class=
"border"
style=
"width: 80%; display: inline-block;"
>
<textarea
style=
"width: 955px; height: 300px;"
(
blur
)="
load
()"
#
itemTextarea
>
{{itemStr}}
</textarea>
<button
(
click
)="
copyData
();"
>
Copy
</button>
</div>
<div
class=
"border"
style=
"width: 1000px;"
>
<span
style=
"font-size: 20px;"
>
标题:
</span>
<span
style=
"font-size: 20px;"
>
标题:
</span>
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
title
"
(
blur
)="
save
()"
>
<input
style=
"width: 200px;"
type=
"text"
nz-input
[(
ngModel
)]="
item
.
title
"
(
blur
)="
save
()"
>
<span
style=
"font-size: 20px;"
>
题目说明:
</span>
<br><br>
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
questionText
"
(
blur
)="
save
()"
>
<span
style=
"font-size: 20px;"
>
引导音频:
</span>
<span
style=
"font-size: 20px;"
>
题目说明音频:
</span>
<app-audio-recorder
<app-audio-recorder
style=
"display: inline-block;"
[
audioUrl
]="
item
.
questionTextAudio
"
[
audioUrl
]="
item
.
questionTextAudio
"
(
audioUploaded
)="
onAssetUploadSuccess
($
event
,
'
questionTextAudio
')"
(
audioUploaded
)="
onAssetUploadSuccess
($
event
,
'
questionTextAudio
')"
[
_audioName
]="
item
.
audioFileName
"
[
_audioName
]="
item
.
audioFileName
"
(
audioName
)="
saveAudioFileName
($
event
)"
(
audioName
)="
saveAudioFileName
($
event
,
'
audioFileName
'
)"
></app-audio-recorder>
></app-audio-recorder>
</div>
<br><br>
<span
style=
"font-size: 20px;"
>
选择级别:
</span>
<div
class=
"border"
style=
"width: 1000px;"
>
<nz-select
[(
ngModel
)]="
item
.
choseLevel
"
style=
"width: 100px;"
(
ngModelChange
)="
save
()"
>
<div
*
ngFor=
"let question of item.questions; let i = index"
>
<nz-option
nzValue=
"1"
nzLabel=
"L1"
></nz-option>
<div
class=
"border"
style=
"width: 950px;"
>
<nz-option
nzValue=
"2"
nzLabel=
"L2"
></nz-option>
<span
style=
"font-size: 20px;"
>
选项类型:
</span>
<nz-option
nzValue=
"3"
nzLabel=
"L3"
></nz-option>
<div
*
ngIf=
"question.type=='img'"
>
<nz-option
nzValue=
"4"
nzLabel=
"L4"
></nz-option>
<button
class=
"button-right"
>
图片
</button>
<nz-option
nzValue=
"5"
nzLabel=
"L5"
></nz-option>
</nz-select>
<button
class=
"button-disable"
(
click
)="
question
.
type=
'txt'
;
save
();"
>
文字
</button>
<br><br>
</div>
<span
style=
"font-size: 20px;"
>
书本图片:
</span>
<div
*
ngIf=
"question.type=='txt'"
>
<div
style=
"width: 300px; display: inline-block;"
>
<button
class=
"button-disable"
(
click
)="
question
.
type=
'img'
;
save
();"
>
图片
</button>
<app-upload-image-with-preview
[
picUrl
]="
item
.
bookImg
"
(
imageUploaded
)="
onAssetUploadSuccess
($
event
,
'
bookImg
')"
>
<button
class=
"button-right"
>
文字
</button>
</div>
<div
*
ngIf=
"question.type=='img'"
>
图片:
<div
style=
"width: 300px;"
>
<app-upload-image-with-preview
[
picUrl
]="
question
.
image
"
(
imageUploaded
)="
onAssetUploadSuccess
($
event
,
'
questions
',
i
,
'
image
')"
>
</app-upload-image-with-preview>
</app-upload-image-with-preview>
</div>
</div>
<br><br>
<span
style=
"font-size: 20px;"
>
书本音频:
</span>
<app-audio-recorder
style=
"display: inline-block;"
[
audioUrl
]="
item
.
bookAudio
"
(
audioUploaded
)="
onAssetUploadSuccess
($
event
,
'
bookAudio
')"
[
_audioName
]="
item
.
bookAudioFileName
"
(
audioName
)="
saveAudioFileName
($
event
,
'
bookAudioFileName
')"
></app-audio-recorder>
</div>
</div>
<span>
音频:
</span>
<app-audio-recorder
[
audioUrl
]="
question
.
audio
"
(
audioUploaded
)="
onAssetUploadSuccess
($
event
,
'
questions
',
i
,
'
audio
')"
>
</app-audio-recorder>
<div
*
ngIf=
"question.type=='txt'"
>
<span>
文本:
</span>
<input
type=
"text"
nz-input
[(
ngModel
)]="
question
.
text
"
(
blur
)="
save
()"
>
</div>
<br>
<button
style=
"width: 900px; height: 30px; color: red;"
(
click
)="
removeQuestion
(
i
)"
>
删除题目
</button>
</div>
</div>
<div
class=
"border"
style=
"width: 950px;"
>
<button
style=
"width: 900px; height: 100px;"
(
click
)="
addQuestion
()"
>
增加题目
</button>
</div>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
form/src/app/form/form.component.ts
View file @
015dcb32
import
{
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnChanges
,
OnInit
,
Output
,
ApplicationRef
,
ChangeDetectorRef
}
from
'
@angular/core
'
;
import
{
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnChanges
,
OnInit
,
Output
,
ApplicationRef
,
ChangeDetectorRef
}
from
'
@angular/core
'
;
import
{
JsonPipe
}
from
'
@angular/common
'
;
import
{
ComponentBase
}
from
'
./ComponentBase
'
;
import
{
ComponentBase
}
from
'
./ComponentBase
'
;
...
@@ -11,33 +10,22 @@ import { ComponentBase } from './ComponentBase';
...
@@ -11,33 +10,22 @@ import { ComponentBase } from './ComponentBase';
export
class
FormComponent
extends
ComponentBase
implements
OnInit
,
OnChanges
,
OnDestroy
{
export
class
FormComponent
extends
ComponentBase
implements
OnInit
,
OnChanges
,
OnDestroy
{
// 储存数据用
// 储存数据用
saveKey
=
"
card_machin
e
"
;
saveKey
=
"
NJ_BookTabl
e
"
;
// 储存对象
// 储存对象
item
:
any
=
{
item
:
any
=
{
title
:
''
,
title
:
''
,
questionText
:
''
,
questionTextAudio
:
''
,
questionTextAudio
:
''
,
audioFileName
:
''
,
audioFileName
:
''
,
questions
:
[],
choseLevel
:
1
,
bookImg
:
''
,
bookAudio
:
''
,
bookAudioFileName
:
''
,
};
};
addQuestion
()
{
this
.
item
.
questions
.
push
({
type
:
'
img
'
,
audio
:
''
,
text
:
''
,
image
:
''
});
this
.
save
();
}
removeQuestion
(
idx
)
{
this
.
item
.
questions
.
splice
(
idx
,
1
);
this
.
save
();
}
saveAudioFileName
(
name
)
{
saveAudioFileName
(
name
,
key
)
{
this
.
item
.
audioFileName
=
name
;
this
.
item
[
key
]
=
name
;
this
.
save
();
this
.
save
();
}
}
}
}
\ No newline at end of file
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