Commit 9f5f5457 authored by liujiangnan's avatar liujiangnan

feat: 音频上传组件样式

parent 2e380fa0
...@@ -411,6 +411,39 @@ export function showTrebleFirework(baseNode, rabbonList) { ...@@ -411,6 +411,39 @@ export function showTrebleFirework(baseNode, rabbonList) {
showFireworks(right); 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 = ()=>{}) { export function onHomeworkFinish(data = "", callback = ()=>{}) {
const middleLayer = cc.find('middleLayer'); const middleLayer = cc.find('middleLayer');
if (middleLayer) { if (middleLayer) {
...@@ -430,3 +463,4 @@ export function callMiddleLayerFunction(apiName: string, data: any, callback: Fu ...@@ -430,3 +463,4 @@ export function callMiddleLayerFunction(apiName: string, data: any, callback: Fu
console.log('callMiddleLayerFunction: ' + apiName); console.log('callMiddleLayerFunction: ' + apiName);
} }
} }
...@@ -128,5 +128,8 @@ ...@@ -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
This diff is collapsed.
...@@ -47,10 +47,14 @@ ...@@ -47,10 +47,14 @@
</ng-template> </ng-template>
</div> </div>
<div class="p-progress ml-2" (click)="onBtnPlay()" *ngIf="audioUrl || audioBlob"> <div class="p-progress ml-2" (click)="onBtnPlay()" *ngIf="audioUrl || audioBlob"
<nz-progress [nzPercent]="percent" [nzWidth]="30" [nzFormat]="progressText" style="background-color: #70B603; width: 35px; height: 35px; border-radius: 35px; margin-left: 10px;margin-top:-1px">
nzType="circle"></nz-progress> <nz-progress [nzPercent]="percent" [nzWidth]="35" [nzFormat]="progressText"
<div class="p-btn-play" [style.left]="isPlaying?'8px':''"> 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> <fa-icon [icon]="playIcon"></fa-icon>
</div> </div>
</div> </div>
......
...@@ -11,8 +11,12 @@ ...@@ -11,8 +11,12 @@
<span style="font-size: 20px;">题目说明: </span> <span style="font-size: 20px;">题目说明: </span>
<input type="text" nz-input [(ngModel)]="item.questionText" (blur)="save()"> <input type="text" nz-input [(ngModel)]="item.questionText" (blur)="save()">
<span style="font-size: 20px;">题目说明音频: </span> <span style="font-size: 20px;">题目说明音频: </span>
<app-audio-recorder [audioUrl]="item.questionTextAudio" <app-audio-recorder
(audioUploaded)="onAssetUploadSuccess($event, 'item','questionTextAudio')"></app-audio-recorder> [audioUrl]="item.questionTextAudio"
(audioUploaded)="onAssetUploadSuccess($event, 'questionTextAudio')"
[_audioName]="item.audioFileName"
(audioName)="saveAudioFileName($event)"
></app-audio-recorder>
</div> </div>
<div class="border" style="width: 1000px;"> <div class="border" style="width: 1000px;">
......
...@@ -17,6 +17,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -17,6 +17,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
title: '', title: '',
questionText: '', questionText: '',
questionTextAudio: '', questionTextAudio: '',
audioFileName: '',
questions: [], questions: [],
}; };
...@@ -34,4 +35,9 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -34,4 +35,9 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
this.item.questions.splice(idx, 1); this.item.questions.splice(idx, 1);
this.save(); this.save();
} }
saveAudioFileName(name) {
this.item.audioFileName=name;
this.save();
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment