Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
ls_gramophone
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
ls_gramophone
Commits
93df25a3
Commit
93df25a3
authored
Jun 17, 2022
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
表单处理完成
parent
b44a96ab
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
188 additions
and
74 deletions
+188
-74
form.component.html
form/src/app/form/form.component.html
+155
-62
form.component.ts
form/src/app/form/form.component.ts
+32
-12
styles.css
form/src/styles.css
+1
-0
No files found.
form/src/app/form/form.component.html
View file @
93df25a3
<style>
.border-solid
{
border
:
1px
solid
#333
;
border-radius
:
10px
;
padding
:
20px
;
}
.border-dashed
{
border
:
1px
dashed
#333
;
border-radius
:
10px
;
padding
:
20px
;
}
.option-title
{
color
:
#000
;
font-size
:
18px
;
min-width
:
70px
;
/* margin-right: 10px; */
}
.option-content
{
border
:
1px
dashed
#333
;
border-radius
:
1px
;
padding
:
20px
;
margin-right
:
10px
;
width
:
800px
;
}
.option-img
{
margin-top
:
10px
;
}
.option-audio
{
margin-top
:
10px
;
}
.option-text
{
margin-top
:
10px
;
}
.option-time
{
margin-top
:
10px
;
}
.word-type-title
{
color
:
#169BD5
;
font-size
:
18px
;
}
.word-type-option-title
{
color
:
#333
;
font-size
:
18px
;
}
.word-input-title
{
color
:
#333
;
font-size
:
20px
;
}
.btn-blue
{
color
:
#169BD5
;
border-color
:
#169BD5
;
}
.btn-red
{
color
:
#f00
;
border-color
:
#f00
;
}
.input-place-red
::-webkit-input-placeholder
{
color
:
rgba
(
255
,
0
,
0
,
0.3
);
font-size
:
12px
;
}
</style>
<div
class=
"model-content"
>
<div
nz-row
>
...
...
@@ -19,14 +93,21 @@
<nz-form-label
[
nzSpan
]="
4
"
>
题目音频
</nz-form-label>
<nz-form-control
[
nzSpan
]="
12
"
>
<app-audio-recorder
[
audioUrl
]="
item
.
questionTextAudio
"
[
_audioName
]="
item
.
questionTextAudioName
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
item
,
'
questionTextAudio
')"
(
audioName
)="
onAudioName
($
event
,
item
,
'
questionTextAudioName
')"
>
</app-audio-recorder>
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
item
,
'
questionTextAudio
')"
(
audioName
)="
onAudioName
($
event
,
item
,
'
questionTextAudioName
')"
></app-audio-recorder>
</nz-form-control>
</nz-form-item>
</nz-card>
</div>
</div>
<br
/>
<br/>
<!--页面区域-->
<div
nz-row
>
<div
nz-col
[
nzSpan
]="
18
"
[
nzOffset
]="
1
"
>
<div
*
ngFor=
"let page of item.pages; let j=index"
style=
"margin-bottom: 5mm;"
nz-col
[
nzXs
]='
24
'
[
nzSm
]='
24
'
[
nzMd
]='
24
'
[
nzLg
]='
24
'
>
<nz-card
nzTitle=
"第{{j+1}}页"
[
nzHoverable
]="
true
"
[
nzExtra
]="
actionCard
"
>
<!--题目区域-->
<div
nz-row
>
<div
nz-col
[
nzSpan
]="
18
"
[
nzOffset
]="
1
"
>
...
...
@@ -35,36 +116,31 @@
<nz-form-label
[
nzSpan
]="
4
"
>
完整音频
</nz-form-label>
<nz-form-control
[
nzSpan
]="
12
"
>
<app-audio-recorder
[
audioUrl
]="
item
.
pageAudio
"
[
_audioName
]="
item
.
pageAudioName
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
item
,
'
pageAudio
')"
(
audioName
)="
onAudioName
($
event
,
item
,
'
pageAudioName
')"
>
</app-audio-recorder>
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
item
,
'
pageAudio
')"
(
audioName
)="
onAudioName
($
event
,
item
,
'
pageAudioName
')"
></app-audio-recorder>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label
[
nzSpan
]="
4
"
>
故事图片
</nz-form-label>
<nz-form-control
[
nzSpan
]="
6
"
>
<app-upload-image-with-preview
style=
"width: 100%"
[
picUrl
]="
item
.
pageImage
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
item
,
'
pageImage
')"
>
</app-upload-image-with-preview>
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
item
,
'
pageImage
')"
></app-upload-image-with-preview>
</nz-form-control>
</nz-form-item>
</nz-card>
</div>
</div>
<br
/>
<br/>
<!--题目区域-->
<div
nz-row
>
<div
nz-col
[
nzSpan
]="
18
"
[
nzOffset
]="
1
"
>
<h4
nz-typography
>
文本内容:
</h4>
<div
*
ngFor=
"let data of item.sentences; let i=index"
style=
"margin-bottom: 5mm;"
nz-col
[
nzXs
]='
24
'
[
nzSm
]='
24
'
[
nzMd
]='
24
'
[
nzLg
]='
24
'
>
<div
*
ngFor=
"let data of page; let i=index"
style=
"margin-bottom: 5mm;"
nz-col
[
nzXs
]='
24
'
[
nzSm
]='
24
'
[
nzMd
]='
24
'
[
nzLg
]='
24
'
>
<nz-card
nzTitle=
"文本{{i+1}}"
[
nzHoverable
]="
true
"
[
nzExtra
]="
actionCard
"
>
<nz-form-item>
<nz-form-label
[
nzSpan
]="
4
"
>
音频
</nz-form-label>
<nz-form-control
[
nzSpan
]="
14
"
>
<app-audio-recorder
[
audioUrl
]="
data
.
audio
"
[
_audioName
]="
data
.
audioName
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
data
,
'
audio
')"
(
audioName
)="
onAudioName
($
event
,
data
,
'
audioName
')"
>
</app-audio-recorder>
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
data
,
'
audio
')"
(
audioName
)="
onAudioName
($
event
,
data
,
'
audioName
')"
></app-audio-recorder>
</nz-form-control>
</nz-form-item>
<nz-form-item>
...
...
@@ -83,23 +159,40 @@
</nz-form-item>
</nz-card>
<ng-template
#
actionCard
>
<button
nz-button
nzType=
"danger"
(
click
)="
delCard
(
item
,
i
)"
>
<button
nz-button
nzType=
"danger"
(
click
)="
delCard
(
item
.
pages
[
j
]
,
i
)"
>
<i
nz-icon
nzType=
"delete"
nzTheme=
"outline"
></i>
删除
</button>
<button
nz-button
nzType=
"default"
(
click
)="
copyCard
(
item
,
i
)"
>
<button
nz-button
nzType=
"default"
(
click
)="
copyCard
(
item
.
pages
[
j
]
,
i
)"
>
<i
nz-icon
nzType=
"copy"
nzTheme=
"outline"
></i>
复制
</button>
</ng-template>
</div>
</div>
</div>
<br
/>
<br
/>
<div
nz-row
>
<div
nz-col
[
nzSpan
]="
18
"
[
nzOffset
]="
1
"
>
<button
nz-button
nzType=
"primary"
nzSize=
"large"
(
click
)="
addCard
(
)"
>
<button
nz-button
nzType=
"primary"
nzSize=
"large"
(
click
)="
addCard
(
item
.
pages
[
j
]
)"
>
<font
style=
"font-weight: 800;"
>
+增加文本
</font>
</button>
</div>
</div>
<br
/>
<br/>
</nz-card>
<ng-template
#
actionCard
>
<button
nz-button
nzType=
"danger"
(
click
)="
delPage
(
j
)"
>
<i
nz-icon
nzType=
"delete"
nzTheme=
"outline"
></i>
删除
</button>
</ng-template>
</div>
</div>
</div>
<div
nz-row
>
<div
nz-col
[
nzSpan
]="
18
"
[
nzOffset
]="
1
"
>
<button
nz-button
nzType=
"primary"
nzSize=
"large"
(
click
)="
addPage
()"
>
<font
style=
"font-weight: 800;"
>
+增加页面
</font>
</button>
</div>
</div>
</div>
\ No newline at end of file
form/src/app/form/form.component.ts
View file @
93df25a3
...
...
@@ -67,8 +67,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this
.
save
();
}
if
(
!
this
.
item
.
sentences
)
{
this
.
item
.
sentences
=
[];
if
(
!
this
.
item
.
pages
)
{
this
.
item
.
pages
=
[];
this
.
addPage
()
this
.
save
();
}
}
...
...
@@ -117,36 +118,55 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
},
1
);
}
delCard
(
item
,
index
)
{
delCard
(
list
,
index
)
{
if
(
confirm
(
"
确认删除吗?
"
))
{
if
(
index
!==
-
1
)
{
item
.
sentences
.
splice
(
index
,
1
);
list
.
splice
(
index
,
1
);
item
.
sentences
=
[...
item
.
sentences
];
list
=
[...
list
];
this
.
save
();
}
}
}
copyCard
(
item
,
index
)
{
copyCard
(
list
,
index
)
{
let
word
=
JSON
.
parse
(
JSON
.
stringify
(
list
[
index
]));
let
word
=
JSON
.
parse
(
JSON
.
stringify
(
item
.
sentences
[
index
]));
this
.
item
.
sentences
.
push
(
word
);
list
.
push
(
word
);
this
.
save
();
}
addCard
()
{
addCard
(
list
)
{
let
word
=
getDefExercises
();
this
.
item
.
sentences
.
push
(
word
);
list
.
push
(
word
);
this
.
save
();
}
addPage
()
{
let
list
=
[];
this
.
item
.
pages
.
push
(
list
);
this
.
addCard
(
this
.
item
.
pages
[
this
.
item
.
pages
.
length
-
1
]);
this
.
save
();
}
delPage
(
index
)
{
let
list
=
this
.
item
.
pages
;
if
(
confirm
(
"
确认删除吗?
"
))
{
if
(
index
!==
-
1
)
{
list
.
splice
(
index
,
1
);
list
=
[...
list
];
this
.
save
();
}
}
}
copyPage
(
i
)
{
}
isVisible
=
false
;
deleteTitle
=
"
是否删除题目
"
;
deleteCallback
=
function
()
{
};
...
...
form/src/styles.css
View file @
93df25a3
/* You can add global styles to this file, and also import other style files */
@import
"~ng-zorro-antd/ng-zorro-antd.min.css"
;
\ 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