Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cocos_generator
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
cocos_generator
Commits
9f5f5457
Commit
9f5f5457
authored
Jun 08, 2022
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 音频上传组件样式
parent
2e380fa0
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
702 additions
and
156 deletions
+702
-156
util.ts
assets/cocos_generator/script/util.ts
+35
-1
angular.json
form_angular/angular.json
+5
-2
package-lock.json
form_angular/package-lock.json
+641
-146
package.json
form_angular/package.json
+1
-1
audio-recorder.component.html
...c/app/common/audio-recorder/audio-recorder.component.html
+8
-4
form.component.html
form_angular/src/app/form/form.component.html
+6
-2
form.component.ts
form_angular/src/app/form/form.component.ts
+6
-0
No files found.
assets/cocos_generator/script/util.ts
View file @
9f5f5457
...
...
@@ -411,6 +411,39 @@ export function showTrebleFirework(baseNode, rabbonList) {
showFireworks
(
right
);
}
export
function
httpHeadCall
(
requsetUrl
:
string
,
callback
)
{
let
xhr
=
new
XMLHttpRequest
();
console
.
log
(
"
Status: Send Post Request to
"
+
requsetUrl
);
try
{
xhr
.
onreadystatechange
=
()
=>
{
try
{
console
.
log
(
'
xhr.readyState:
'
,
xhr
.
readyState
);
if
(
xhr
.
readyState
==
4
)
{
if
((
xhr
.
status
>=
200
&&
xhr
.
status
<
400
))
{
callback
(
true
);
}
else
{
callback
(
false
);
}
}
}
catch
(
e
)
{
console
.
log
(
e
)
}
};
xhr
.
open
(
"
HEAD
"
,
requsetUrl
,
true
);
xhr
.
send
();
xhr
.
timeout
=
15000
;
xhr
.
onerror
=
(
e
)
=>
{
callback
(
false
);
};
xhr
.
ontimeout
=
(
e
)
=>
{
callback
(
false
);
};
}
catch
(
e
)
{
console
.
log
(
"
Send Get Request error:
"
,
e
);
}
}
export
function
onHomeworkFinish
(
data
=
""
,
callback
=
()
=>
{})
{
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
middleLayer
)
{
...
...
@@ -429,4 +462,5 @@ export function callMiddleLayerFunction(apiName: string, data: any, callback: Fu
}
else
{
console
.
log
(
'
callMiddleLayerFunction:
'
+
apiName
);
}
}
\ No newline at end of file
}
form_angular/angular.json
View file @
9f5f5457
...
...
@@ -128,5 +128,8 @@
}
}
},
"defaultProject"
:
"ng-template-generator"
}
"defaultProject"
:
"ng-template-generator"
,
"cli"
:
{
"analytics"
:
"5f501d82-8f25-4817-a608-9ac70d1f1f70"
}
}
\ No newline at end of file
form_angular/package-lock.json
View file @
9f5f5457
This diff is collapsed.
Click to expand it.
form_angular/package.json
View file @
9f5f5457
...
...
@@ -55,4 +55,4 @@
"tslint"
:
"~5.18.0"
,
"typescript"
:
"~3.7.5"
}
}
\ No newline at end of file
}
form_angular/src/app/common/audio-recorder/audio-recorder.component.html
View file @
9f5f5457
...
...
@@ -47,10 +47,14 @@
</ng-template>
</div>
<div
class=
"p-progress ml-2"
(
click
)="
onBtnPlay
()"
*
ngIf=
"audioUrl || audioBlob"
>
<nz-progress
[
nzPercent
]="
percent
"
[
nzWidth
]="
30
"
[
nzFormat
]="
progressText
"
nzType=
"circle"
></nz-progress>
<div
class=
"p-btn-play"
[
style
.
left
]="
isPlaying
?'
8px
'
:
''"
>
<div
class=
"p-progress ml-2"
(
click
)="
onBtnPlay
()"
*
ngIf=
"audioUrl || audioBlob"
style=
"background-color: #70B603; width: 35px; height: 35px; border-radius: 35px; margin-left: 10px;margin-top:-1px"
>
<nz-progress
[
nzPercent
]="
percent
"
[
nzWidth
]="
35
"
[
nzFormat
]="
progressText
"
nzType=
"circle"
>
</nz-progress>
<div
class=
"p-btn-play"
style=
"color: white;margin-left: 2px;margin-top: 1px;"
[
style
.
left
]="
isPlaying
?'
8px
'
:
''"
>
<fa-icon
[
icon
]="
playIcon
"
></fa-icon>
</div>
</div>
...
...
form_angular/src/app/form/form.component.html
View file @
9f5f5457
...
...
@@ -11,8 +11,12 @@
<span
style=
"font-size: 20px;"
>
题目说明:
</span>
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
questionText
"
(
blur
)="
save
()"
>
<span
style=
"font-size: 20px;"
>
题目说明音频:
</span>
<app-audio-recorder
[
audioUrl
]="
item
.
questionTextAudio
"
(
audioUploaded
)="
onAssetUploadSuccess
($
event
,
'
item
','
questionTextAudio
')"
></app-audio-recorder>
<app-audio-recorder
[
audioUrl
]="
item
.
questionTextAudio
"
(
audioUploaded
)="
onAssetUploadSuccess
($
event
,
'
questionTextAudio
')"
[
_audioName
]="
item
.
audioFileName
"
(
audioName
)="
saveAudioFileName
($
event
)"
></app-audio-recorder>
</div>
<div
class=
"border"
style=
"width: 1000px;"
>
...
...
form_angular/src/app/form/form.component.ts
View file @
9f5f5457
...
...
@@ -17,6 +17,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
title
:
''
,
questionText
:
''
,
questionTextAudio
:
''
,
audioFileName
:
''
,
questions
:
[],
};
...
...
@@ -34,4 +35,9 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
this
.
item
.
questions
.
splice
(
idx
,
1
);
this
.
save
();
}
saveAudioFileName
(
name
)
{
this
.
item
.
audioFileName
=
name
;
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