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
d4a11193
Commit
d4a11193
authored
Jun 06, 2022
by
Chen Jiping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:增加音频名显示,并增加音频转换处理
parent
6f6efa65
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
11 deletions
+33
-11
audio-recorder.component.html
...c/app/common/audio-recorder/audio-recorder.component.html
+2
-5
audio-recorder.component.scss
...c/app/common/audio-recorder/audio-recorder.component.scss
+7
-0
audio-recorder.component.ts
...src/app/common/audio-recorder/audio-recorder.component.ts
+8
-0
form.component.html
form/src/app/form/form.component.html
+6
-6
form.component.ts
form/src/app/form/form.component.ts
+10
-0
No files found.
form/src/app/common/audio-recorder/audio-recorder.component.html
View file @
d4a11193
...
...
@@ -29,7 +29,6 @@
</div>
</div>
<div
*
ngIf=
"audioUrl && needRemove; then truthyTemplate else falsyTemplate"
></div>
<ng-template
#
truthyTemplate
>
...
...
@@ -45,10 +44,6 @@
<fa-icon
icon=
"cog"
></fa-icon>
</div>
</ng-template>
</div>
<div
class=
"p-progress ml-2"
(
click
)="
onBtnPlay
()"
*
ngIf=
"audioUrl || audioBlob"
>
...
...
@@ -58,4 +53,6 @@
<fa-icon
[
icon
]="
playIcon
"
></fa-icon>
</div>
</div>
<div
class=
"audio-name"
>
{{_audioName}}
</div>
</div>
form/src/app/common/audio-recorder/audio-recorder.component.scss
View file @
d4a11193
...
...
@@ -103,6 +103,13 @@
}
}
.audio-name
{
margin-top
:
3
.5px
;
position
:
relative
;
margin-left
:
7px
;;
line-height
:
26px
;
}
:host
::ng-deep
nz-upload
{
line-height
:
33px
;
}
...
...
form/src/app/common/audio-recorder/audio-recorder.component.ts
View file @
d4a11193
...
...
@@ -31,6 +31,9 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
@
Input
()
audioItem
:
any
=
null
;
@
Input
()
_audioName
:
any
=
null
;
@
Input
()
set
audioUrl
(
url
)
{
this
.
_audioUrl
=
url
;
...
...
@@ -48,6 +51,7 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
@
Output
()
audioUploaded
=
new
EventEmitter
();
@
Output
()
audioUploadFailure
=
new
EventEmitter
();
@
Output
()
audioRemoved
=
new
EventEmitter
();
@
Output
()
audioName
=
new
EventEmitter
();
percent
=
0
;
progress
=
0
;
recorder
:
any
;
...
...
@@ -168,8 +172,12 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
break
;
case
'
success
'
:
this
.
isUploading
=
false
;
let
url
=
info
.
file
.
response
.
url
;
url
=
url
.
substring
(
0
,
url
.
lastIndexOf
(
"
.
"
))
+
"
_l.mp3
"
;
info
.
file
.
response
.
url
=
url
;
this
.
uploadSuccess
(
info
.
file
.
response
);
this
.
audioUploaded
.
emit
(
info
.
file
.
response
);
this
.
audioName
.
emit
(
info
.
file
.
name
);
break
;
case
'
progress
'
:
this
.
progress
=
parseInt
(
info
.
event
.
percent
,
10
);
...
...
form/src/app/form/form.component.html
View file @
d4a11193
...
...
@@ -18,8 +18,8 @@
<nz-form-item>
<nz-form-label
[
nzSpan
]="
4
"
>
题目音频
</nz-form-label>
<nz-form-control
[
nzSpan
]="
12
"
>
<app-audio-recorder
[
audioUrl
]="
item
.
questionTextAudio
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
item
,
'
questionTextAudio
')"
>
<app-audio-recorder
[
audioUrl
]="
item
.
questionTextAudio
"
[
_audioName
]="
item
.
questionTextAudioName
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
item
,
'
questionTextAudio
')"
(
audioName
)="
onAudioName
($
event
,
item
,
'
questionTextAudioName
')"
>
</app-audio-recorder>
</nz-form-control>
</nz-form-item>
...
...
@@ -34,8 +34,8 @@
<nz-form-item>
<nz-form-label
[
nzSpan
]="
4
"
>
完整音频
</nz-form-label>
<nz-form-control
[
nzSpan
]="
12
"
>
<app-audio-recorder
[
audioUrl
]="
item
.
pageAudio
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
item
,
'
pageAudio
')"
>
<app-audio-recorder
[
audioUrl
]="
item
.
pageAudio
"
[
_audioName
]="
item
.
pageAudioName
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
item
,
'
pageAudio
')"
(
audioName
)="
onAudioName
($
event
,
item
,
'
pageAudioName
')"
>
</app-audio-recorder>
</nz-form-control>
</nz-form-item>
...
...
@@ -62,8 +62,8 @@
<nz-form-item>
<nz-form-label
[
nzSpan
]="
4
"
>
音频
</nz-form-label>
<nz-form-control
[
nzSpan
]="
14
"
>
<app-audio-recorder
[
audioUrl
]="
data
.
audio
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
data
,
'
audio
')"
>
<app-audio-recorder
[
audioUrl
]="
data
.
audio
"
[
_audioName
]="
data
.
audioName
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
data
,
'
audio
')"
(
audioName
)="
onAudioName
($
event
,
data
,
'
audioName
')"
>
</app-audio-recorder>
</nz-form-control>
</nz-form-item>
...
...
form/src/app/form/form.component.ts
View file @
d4a11193
...
...
@@ -62,6 +62,11 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this
.
save
();
}
if
(
!
this
.
item
.
questionTextAudioName
)
{
this
.
item
.
questionTextAudioName
=
"
故事留声机游戏说明.MP3
"
;
this
.
save
();
}
if
(
!
this
.
item
.
sentences
)
{
this
.
item
.
sentences
=
[];
this
.
save
();
...
...
@@ -88,6 +93,11 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this
.
save
();
}
onAudioName
(
e
,
item
,
key
){
item
[
key
]
=
e
;
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