Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dfzx_10
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
dfzx_10
Commits
750385c9
Commit
750385c9
authored
Sep 18, 2019
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改文件上传
parent
9bbf94dd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
17 deletions
+14
-17
package.json
package.json
+1
-0
audio-recorder.component.html
src/app/common/audio-recorder/audio-recorder.component.html
+4
-5
audio-recorder.component.ts
src/app/common/audio-recorder/audio-recorder.component.ts
+9
-12
No files found.
package.json
View file @
750385c9
...
...
@@ -3,6 +3,7 @@
"version"
:
"0.0.1"
,
"scripts"
:
{
"start"
:
"ng serve"
,
"build"
:
"ng build --build--optimizer --aot --base-href /JGT/v3/"
,
"publish"
:
"node ./bin/publish.js"
},
"private"
:
true
,
...
...
src/app/common/audio-recorder/audio-recorder.component.html
View file @
750385c9
...
...
@@ -11,11 +11,10 @@
</div>
<nz-upload
[
nzAccept
]
=
"'.
mp3
'"
[
nzShowUploadList
]="
false
"
[
nzBeforeUpload
]="
beforeUpload
"
>
<!-- nzAction="/user/resource" -->
<!--(nzChange)="handleChange($event)"-->
[
nzShowUploadList
]="
false
"
[
nzAction
]="
uploadUrl
"
[
nzData
]="
uploadData
"
(
nzChange
)="
handleChange
($
event
)"
>
<div
class=
"btn-upload"
[
ngClass
]="{'
has-clear
'
:
withRmBtn
&&
(
audioUrl
||
audioBlob
)}"
*
ngIf=
"type===Type.UPLOAD && !isUploading"
>
<fa
name=
"upload"
></fa>
...
...
src/app/common/audio-recorder/audio-recorder.component.ts
View file @
750385c9
...
...
@@ -21,6 +21,9 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
Type
=
Type
;
withRmBtn
=
false
;
uploadUrl
=
(
<
any
>
window
).
courseware
.
uploadUrl
();
uploadData
=
(
<
any
>
window
).
courseware
.
uploadData
();
@
Input
()
needRemove
=
false
;
...
...
@@ -70,6 +73,7 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
// this.beforeUpload(this.audioItem);
}
ngOnInit
()
{
this
.
audio
.
onplay
=
()
=>
{
this
.
onPlay
();
};
...
...
@@ -148,7 +152,7 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
this
.
audioRemoved
.
emit
();
}
handleChange
(
info
:
{
type
:
string
,
file
:
UploadFile
,
event
:
any
}):
void
{
handleChange
(
info
:
{
type
:
string
,
file
:
UploadFile
,
event
:
any
}):
void
{
switch
(
info
.
type
)
{
case
'
start
'
:
this
.
isUploading
=
true
;
...
...
@@ -156,6 +160,7 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
break
;
case
'
success
'
:
this
.
isUploading
=
false
;
this
.
uploadSuccess
(
info
.
file
.
response
);
this
.
audioUploaded
.
emit
(
info
.
file
.
response
);
break
;
case
'
progress
'
:
...
...
@@ -184,20 +189,12 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
this
.
audioUrl
=
null
;
if
(
!
this
.
checkSelectFile
(
file
))
{
return
;
return
false
;
}
this
.
isUploading
=
true
;
this
.
progress
=
0
;
let
path
=
'
/imman/audios/
'
;
if
(
!
environment
.
production
)
{
path
=
'
/dev
'
+
path
;
}
window
[
'
net
'
].
doUpload
(
file
as
any
,
1
,
path
,
this
.
doProgress
,
this
.
uploadSuccess
,
this
.
uploadFailure
);
return
false
;
this
.
progress
=
0
;
}
uploadSuccess
=
(
id
,
name
,
hash
,
url
,
file
?:
File
,
inOss
=
false
)
=>
{
uploadSuccess
=
(
url
)
=>
{
this
.
nzMessageService
.
info
(
'
Upload Success
'
);
this
.
isUploading
=
false
;
this
.
audioUrl
=
url
;
...
...
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