Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pu09
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
pu09
Commits
db8fffe1
Commit
db8fffe1
authored
Jun 11, 2020
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 表单提交
parent
3695f7ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
13 deletions
+43
-13
form.component.html
src/app/form/form.component.html
+25
-12
form.component.ts
src/app/form/form.component.ts
+18
-1
No files found.
src/app/form/form.component.html
View file @
db8fffe1
<div
class=
"model-content"
>
<div
style=
"padding: 40px; margin-left: 30px"
>
<div
style=
"position: absolute; left: 200px; top: 100px; width: 800px;"
>
<h2>
背景图:
</h2>
<div
style=
"width: 400px"
>
<app-upload-image-with-preview
[
picUrl
]="
item
.
pic_url
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
'
pic_url
')"
></app-upload-image-with-preview>
</div>
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
text
"
(
blur
)="
save
()"
>
<app-upload-image-with-preview
[
picUrl
]="
item
.
pic_url
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
'
pic_url
')"
></app-upload-image-with-preview>
<h2
style=
"margin-top: 40px"
>
音频:
</h2>
<app-audio-recorder
[
audioUrl
]="
item
.
audio_url
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
audio_url
')"
></app-audio-recorder>
<app-custom-hot-zone></app-custom-hot-zone>
<app-upload-video></app-upload-video>
<app-lesson-title-config></app-lesson-title-config>
<h2
style=
"margin-top: 40px"
>
句子:
</h2>
<div
*
ngFor=
"let sentence of item.sentences;let i = index"
style=
"width: 500px; padding-bottom: 15px;"
>
<div
style=
"display: flex; align-items: center; justify-content: center; width: 100%;"
>
<span
style=
"width: 70px"
>
句子-{{i+1}}:
</span>
<input
type=
"text"
nz-input
[(
ngModel
)]="
sentence
.
text
"
(
blur
)="
save
()"
>
<button
nz-button
nzType=
"danger"
(
click
)="
deleteSentence
(
i
)"
style=
"margin-left: 5px"
>
删除
</button>
</div>
</div>
<div
*
ngIf=
"item.sentences.length < 6"
>
<button
nz-button
nzType=
"dashed"
(
click
)="
addSentence
()"
>
添加句子
</button>
</div>
</div>
</div>
\ No newline at end of file
src/app/form/form.component.ts
View file @
db8fffe1
...
...
@@ -10,7 +10,7 @@ import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, Ap
export
class
FormComponent
implements
OnInit
,
OnChanges
,
OnDestroy
{
// 储存数据用
saveKey
=
"
test_0011
"
;
saveKey
=
"
pu09
"
;
// 储存对象
item
;
...
...
@@ -23,6 +23,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
ngOnInit
()
{
this
.
item
=
{};
this
.
item
.
sentences
=
[];
// 获取存储的数据
(
<
any
>
window
).
courseware
.
getData
((
data
)
=>
{
...
...
@@ -53,6 +54,22 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
addSentence
()
{
const
sentence
=
{
text
:
''
};
this
.
item
.
sentences
.
push
(
sentence
);
this
.
save
();
}
deleteSentence
(
index
)
{
this
.
item
.
sentences
.
splice
(
index
,
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