Commit 25b731e0 authored by Li MingZhe's avatar Li MingZhe

fix: 表单优化

parent 522aa0ae
No preview for this file type
......@@ -38,8 +38,8 @@
(ngModelChange)="changePlaybackRate($event)"
[nzMax]="2" [nzMin]="0.25" [nzStep]="0.25"></nz-slider>
</span>
<label style="margin-right: 20px;margin-left: 20px">文字大小: <nz-input-number [(ngModel)]="LRCData.fontSize" [nzMin]="1" [nzMax]="100" [nzStep]="1"></nz-input-number></label>
<label style="">行高: <nz-input-number [(ngModel)]="LRCData.lineHeight" [nzMin]="1" [nzMax]="100" [nzStep]="1"></nz-input-number></label>
<!-- <label style="margin-right: 20px;margin-left: 20px">文字大小: <nz-input-number [(ngModel)]="LRCData.fontSize" [nzMin]="1" [nzMax]="100" [nzStep]="1"></nz-input-number></label> -->
<!-- <label style="">行高: <nz-input-number [(ngModel)]="LRCData.lineHeight" [nzMin]="1" [nzMax]="100" [nzStep]="1"></nz-input-number></label> -->
<input type="file" onclick="this.value=null;" accept=".lrc" style="display: none" #uploadBtn>
<button [disabled]="!LRCData.audio_url" nz-button nzType="link" (click)="uploadLRC()">上传LRC文件</button>
<nz-select [(ngModel)]="lrcFileEncoding" (ngModelChange)="changeLrcFileEncoding($event)">
......
......@@ -3,15 +3,33 @@
<div style="width: 100%; margin-top: 15px; margin-bottom: 50px;" align="center">
<h2>标题设置</h2>
<div style="width: 50%">
<input type="text" nz-input [(ngModel)]="item.title" (blur)="save()" style="width: 80%;margin-top: 5px">
<div style="width: 50%; display: flex; justify-content: center; align-items: center;">
<input type="text" nz-input [(ngModel)]="item.title" (blur)="save()" style="width: 200px;margin-top: 5px">
<app-audio-recorder
style="margin-top: 5px; margin-left: 5px;"
[audioUrl]="item.title_audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'title_audio_url', item)"
></app-audio-recorder>
</div>
</div>
<div *ngFor="let it of songArr; let i = index" align="center">
<div style="width: 100%;" align=center style="margin: 30px">
<span>
歌曲选择:
</span>
<nz-radio-group [(ngModel)]="curIndex">
<label nz-radio nzValue="0">歌曲-1</label>
<label nz-radio nzValue="1">歌曲-2</label>
<label nz-radio nzValue="2">歌曲-3</label>
<label nz-radio nzValue="3">歌曲-4</label>
</nz-radio-group>
</div>
<div *ngFor="let it of songArr; let i = index" align="center" style="padding-bottom: 1px;">
<div class="song-box" >
<div *ngIf="i == curIndex" class="song-box" >
<h2>歌曲-{{i+1}}</h2>
<nz-divider nzText="配置歌词"></nz-divider>
......
......@@ -68,6 +68,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
{color: '#00ff00', text: '绿色'},
];
curIndex = "0";
constructor(private appRef: ApplicationRef,private changeDetectorRef: ChangeDetectorRef, private message: NzMessageService) {
......
......@@ -6,7 +6,7 @@
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
// cc.audioEngine = require('../components/karaoke/scripts/audioEngineEx.js')
import { getSprNode, getSprNodeByUrl, setSprNodeMaxLen } from "./util";
import { getSprNode, getSprNodeByUrl, playAudioByUrl, setSprNodeMaxLen } from "./util";
cc.Class({
extends: cc.Component,
......@@ -121,7 +121,7 @@ cc.Class({
getDefaultData() {
const data = {"songArr":[{"lrcData":{"audio_url":"http://staging-teach.cdn.ireadabc.com/9259e1b99cc17f61210e7edc17f1d697.mp3","fontSize":24,"lineHeight":32,"lyrics":[{"time":0.063225,"data":"AA","newLine":true},{"time":0.371827,"data":"bbb ccc aaa","newLine":false}]},"pic_url":"http://staging-teach.cdn.ireadabc.com/c8abf7383d65bcbdba8f390785cece60.png","accompany_audio_url":"http://staging-teach.cdn.ireadabc.com/22e9facddfbf087ecdf2b60dba6019ef.mp3"},{"lrcData":{"audio_url":"http://staging-teach.cdn.ireadabc.com/2a25aaff4b6c84b859b4d77f944de57a.mp3","fontSize":24,"lineHeight":32,"lyrics":[{"time":19.06,"data":"安静地离去","newLine":true},{"time":21.7,"data":"和孤单一起","newLine":true},{"time":26.55,"data":"拥挤的回忆时间抹去","newLine":true}]},"pic_url":"http://staging-teach.cdn.ireadabc.com/f6f4bbef497409fef3c8f1d375893829.png","accompany_audio_url":"http://staging-teach.cdn.ireadabc.com/86614bd904f63ab02fc69304e99618c6.mp3"},{},{}],"title":""}
const data = {"songArr":[{"lrcData":{"audio_url":"http://staging-teach.cdn.ireadabc.com/3fa65d5f667a2ef9059d3dfc5df74a4d.mp3","fontSize":24,"lineHeight":32,"lyrics":[{"time":4.81026,"data":"AAA","newLine":true},{"time":8.63464,"data":"aaaaa vbbbb ccc ddd","newLine":true},{"time":10.489051,"data":"eeee fffff gg hhh","newLine":false}]},"pic_url":"http://staging-teach.cdn.ireadabc.com/c8abf7383d65bcbdba8f390785cece60.png","accompany_audio_url":"http://staging-teach.cdn.ireadabc.com/22e9facddfbf087ecdf2b60dba6019ef.mp3"},{"lrcData":{"audio_url":"http://staging-teach.cdn.ireadabc.com/2a25aaff4b6c84b859b4d77f944de57a.mp3","fontSize":24,"lineHeight":32,"lyrics":[{"time":19.06,"data":"安静地离去","newLine":true},{"time":21.7,"data":"和孤单一起","newLine":true},{"time":26.55,"data":"拥挤的回忆时间抹去","newLine":true}]},"pic_url":"http://staging-teach.cdn.ireadabc.com/f6f4bbef497409fef3c8f1d375893829.png","accompany_audio_url":"http://staging-teach.cdn.ireadabc.com/86614bd904f63ab02fc69304e99618c6.mp3"},{},{}],"title":"Let's play","title_audio_url":"http://staging-teach.cdn.ireadabc.com/cd8daa8b4d8ff707b3a3680e80bc4761.mp3"}
return data;
},
......@@ -160,6 +160,7 @@ cc.Class({
}
}
this._audioResList.push({ url: this.data.title_audio_url || '' });
},
......@@ -227,6 +228,13 @@ cc.Class({
title.x = -this.canvas.width / 2 + title.width / 2 * title.scale;
title.y = this.canvas.height / 2 - title.height / 2 * title.scale;
title.addComponent(cc.Button)
title.on('click', () => {
if (this.data.title_audio_url) {
playAudioByUrl(this.data.title_audio_url);
}
})
const labelNode = new cc.Node();
labelNode.parent = title;
const label = labelNode.addComponent(cc.RichText);
......
......@@ -98,3 +98,15 @@ export function getSprNodeByUrl(url, cb) {
})
}
export function playAudioByUrl(audio_url, cb=null) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
const audioId = cc.audioEngine.playEffect(audioClip, false, 0.8);
if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => {
cb();
});
}
});
}
}
......@@ -7,8 +7,8 @@
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 79,
"height": 96,
"width": 88,
"height": 88,
"platformSettings": {},
"subMetas": {
"btn_musicoff": {
......
No preview for this file type
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