bugfix
This commit is contained in:
parent
c197dd0f71
commit
849751feb4
@ -1,6 +1,6 @@
|
|||||||
var bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
|
|
||||||
var formatMs=function(ms,all){
|
bricks.formatMs=function(ms,all){
|
||||||
var ss=ms%1000;ms=(ms-ss)/1000;
|
var ss=ms%1000;ms=(ms-ss)/1000;
|
||||||
var s=ms%60;ms=(ms-s)/60;
|
var s=ms%60;ms=(ms-s)/60;
|
||||||
var m=ms%60;ms=(ms-m)/60;
|
var m=ms%60;ms=(ms-m)/60;
|
||||||
@ -103,7 +103,7 @@ bricks.AudioRecorder = class extends bricks.HBox {
|
|||||||
// document.querySelector(".recpowerx").style.width=powerLevel+"%";
|
// document.querySelector(".recpowerx").style.width=powerLevel+"%";
|
||||||
//可视化图形绘制
|
//可视化图形绘制
|
||||||
// wave.input(buffers[buffers.length-1],powerLevel,bufferSampleRate);
|
// wave.input(buffers[buffers.length-1],powerLevel,bufferSampleRate);
|
||||||
this.rec_time.set_text(' ' + formatMs(bufferDuration,1));
|
this.rec_time.set_text(' ' + bricks.formatMs(bufferDuration,1));
|
||||||
|
|
||||||
}
|
}
|
||||||
recOpen(){
|
recOpen(){
|
||||||
@ -180,6 +180,7 @@ bricks.AudioRecorder = class extends bricks.HBox {
|
|||||||
this.recClose();
|
this.recClose();
|
||||||
}
|
}
|
||||||
upload = async function(){
|
upload = async function(){
|
||||||
|
var running = new bricks.Running({target:this});
|
||||||
if(!this.recordData){
|
if(!this.recordData){
|
||||||
bricks.debug("DUTn::请先录音,然后停止后再上传");
|
bricks.debug("DUTn::请先录音,然后停止后再上传");
|
||||||
return;
|
return;
|
||||||
@ -197,6 +198,7 @@ bricks.AudioRecorder = class extends bricks.HBox {
|
|||||||
});
|
});
|
||||||
bricks.debug('ret=', ret);
|
bricks.debug('ret=', ret);
|
||||||
this.dispatch('uploaded', ret)
|
this.dispatch('uploaded', ret)
|
||||||
|
running.dismiss();
|
||||||
}
|
}
|
||||||
download(){
|
download(){
|
||||||
if(!this.recordData){
|
if(!this.recordData){
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
SOURCES=" page_data_loader.js factory.js uitypesdef.js utils.js \
|
SOURCES=" page_data_loader.js factory.js uitypesdef.js utils.js \
|
||||||
i18n.js widget.js layout.js bricks.js image.js \
|
i18n.js widget.js layout.js bricks.js image.js \
|
||||||
jsoncall.js myoperator.js scroll.js menu.js modal.js \
|
jsoncall.js myoperator.js scroll.js menu.js modal.js running.js \
|
||||||
markdown_viewer.js video.js audio.js toolbar.js tab.js \
|
markdown_viewer.js video.js audio.js toolbar.js tab.js \
|
||||||
input.js registerfunction.js button.js accordion.js \
|
input.js registerfunction.js button.js accordion.js \
|
||||||
tree.js multiple_state_image.js dynamiccolumn.js form.js message.js conform.js \
|
tree.js multiple_state_image.js dynamiccolumn.js form.js message.js conform.js \
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
var bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
bricks.AccordionItem = class extends bricks.FHBox {
|
bricks.AccordionItem = class extends bricks.FVBox {
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
super(opts);
|
super(opts);
|
||||||
this.set_css('accordion-item');
|
this.set_css('accordion-item');
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
var bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
|
|
||||||
bricks.Modal = class extends bricks.Layout {
|
bricks.BaseModal = class extends bricks.Layout {
|
||||||
min_zindex = 5000;
|
min_zindex = 5000;
|
||||||
last_zindex = 5000;
|
last_zindex = 5000;
|
||||||
constructor(options){
|
constructor(options){
|
||||||
@ -26,13 +26,10 @@ bricks.Modal = class extends bricks.Layout {
|
|||||||
this.panel = new bricks.VBox({});
|
this.panel = new bricks.VBox({});
|
||||||
this.ancestor_add_widget(this.panel);
|
this.ancestor_add_widget(this.panel);
|
||||||
this.panel.set_width(this.opts.width);
|
this.panel.set_width(this.opts.width);
|
||||||
this.panel.dom_element.style.backgroundColor = this.opts.bgcolor|| '#e8e8e8';
|
|
||||||
this.panel.set_height(this.opts.height);
|
this.panel.set_height(this.opts.height);
|
||||||
|
this.panel.dom_element.style.backgroundColor = this.opts.bgcolor|| '#e8e8e8';
|
||||||
this.panel.set_css('modal');
|
this.panel.set_css('modal');
|
||||||
archorize(this.panel.dom_element, objget(this.opts, 'archor', 'cc'));
|
archorize(this.panel.dom_element, objget(this.opts, 'archor', 'cc'));
|
||||||
this.create_title();
|
|
||||||
this.content = new bricks.Filler({width:'100%'});
|
|
||||||
this.panel.add_widget(this.content);
|
|
||||||
this.target_w = null;
|
this.target_w = null;
|
||||||
if (this.target){
|
if (this.target){
|
||||||
if (typeof this.target === typeof ''){
|
if (typeof this.target === typeof ''){
|
||||||
@ -46,24 +43,6 @@ bricks.Modal = class extends bricks.Layout {
|
|||||||
}
|
}
|
||||||
this.target_w.add_widget(this);
|
this.target_w.add_widget(this);
|
||||||
}
|
}
|
||||||
create_title(){
|
|
||||||
this.title_box = new bricks.HBox({width:'100%', height:'auto'});
|
|
||||||
this.title_box.set_css('title');
|
|
||||||
this.panel.add_widget(this.title_box);
|
|
||||||
this.title_w = new bricks.Filler({height:'100%'});
|
|
||||||
var icon = new bricks.Icon({url:bricks_resource('imgs/delete.png')});
|
|
||||||
icon.bind('click', this.dismiss.bind(this));
|
|
||||||
this.title_box.add_widget(this.title_w);
|
|
||||||
this.title_box.add_widget(icon);
|
|
||||||
if (this.title){
|
|
||||||
var w = new bricks.Text({
|
|
||||||
otext:this.title,
|
|
||||||
i18n:true,
|
|
||||||
dynsize:true
|
|
||||||
});
|
|
||||||
this.title_w.add_widget(w);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
get_zindex(){
|
get_zindex(){
|
||||||
var idx = bricks.last_zindex;
|
var idx = bricks.last_zindex;
|
||||||
bricks.last_zindex += 1;
|
bricks.last_zindex += 1;
|
||||||
@ -82,6 +61,60 @@ bricks.Modal = class extends bricks.Layout {
|
|||||||
e.style.backgroundColor = 'rgba(0,0,0,0.4)'; /* Fallback color */
|
e.style.backgroundColor = 'rgba(0,0,0,0.4)'; /* Fallback color */
|
||||||
this.dom_element = e;
|
this.dom_element = e;
|
||||||
}
|
}
|
||||||
|
add_widget(w, index){
|
||||||
|
this.panel.add_widget(w, index);
|
||||||
|
if (this.opts.auto_open){
|
||||||
|
this.open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
open(){
|
||||||
|
this.dom_element.style.display = "";
|
||||||
|
}
|
||||||
|
dismiss(){
|
||||||
|
this.dom_element.style.display = "none";
|
||||||
|
this.target_w.remove_widget(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bricks.Modal = class extends bricks.BaseModal {
|
||||||
|
constructor(options){
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
target: string or Layout
|
||||||
|
auto_open:
|
||||||
|
auto_close:
|
||||||
|
org_index:
|
||||||
|
width:
|
||||||
|
height:
|
||||||
|
bgcolor:
|
||||||
|
title:
|
||||||
|
archor: cc ( tl, tc, tr
|
||||||
|
cl, cc, cr
|
||||||
|
bl, bc, br )
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
super(options);
|
||||||
|
this.create_title();
|
||||||
|
this.content = new bricks.Filler({width:'100%'});
|
||||||
|
this.panel.add_widget(this.content);
|
||||||
|
}
|
||||||
|
create_title(){
|
||||||
|
this.title_box = new bricks.HBox({width:'100%', height:'auto'});
|
||||||
|
this.title_box.set_css('title');
|
||||||
|
this.panel.add_widget(this.title_box);
|
||||||
|
this.title_w = new bricks.Filler({height:'100%'});
|
||||||
|
var icon = new bricks.Icon({url:bricks_resource('imgs/delete.png')});
|
||||||
|
icon.bind('click', this.dismiss.bind(this));
|
||||||
|
this.title_box.add_widget(this.title_w);
|
||||||
|
this.title_box.add_widget(icon);
|
||||||
|
if (this.title){
|
||||||
|
var w = new bricks.Text({
|
||||||
|
otext:this.title,
|
||||||
|
i18n:true,
|
||||||
|
dynsize:true
|
||||||
|
});
|
||||||
|
this.title_w.add_widget(w);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
add_widget(w, index){
|
add_widget(w, index){
|
||||||
this.content.add_widget(w, index);
|
this.content.add_widget(w, index);
|
||||||
@ -101,13 +134,13 @@ bricks.Modal = class extends bricks.Layout {
|
|||||||
var f = this.click_handler.bind(this);
|
var f = this.click_handler.bind(this);
|
||||||
this.bind('click', f);
|
this.bind('click', f);
|
||||||
}
|
}
|
||||||
this.dom_element.style.display = "";
|
bricks.BaseModal.prototype.open.bind(this)();
|
||||||
}
|
}
|
||||||
dismiss(){
|
dismiss(){
|
||||||
this.dom_element.style.display = "none";
|
|
||||||
if (this.opts.auto_close){
|
if (this.opts.auto_close){
|
||||||
this.unbind('click', this.click_handler.bind(this));
|
this.unbind('click', this.click_handler.bind(this));
|
||||||
}
|
}
|
||||||
|
bricks.BaseModal.prototype.dismiss.bind(this)();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,15 +3,14 @@
|
|||||||
"widgettype":"AudioRecorder",
|
"widgettype":"AudioRecorder",
|
||||||
"options":{
|
"options":{
|
||||||
"height":"40px",
|
"height":"40px",
|
||||||
"upload_url":"{{entire_url('stt.dspy')}}",
|
"upload_url":"{{entire_url('stt.dspy')}}"
|
||||||
"start_icon":"/bricks/imgs/start_recording.png"
|
|
||||||
},
|
},
|
||||||
"binds":[
|
"binds":[
|
||||||
{
|
{
|
||||||
"wid":"self",
|
"wid":"self",
|
||||||
"event":"uploaded",
|
"event":"uploaded",
|
||||||
"actiontype":"script",
|
"actiontype":"script",
|
||||||
"script":"alert('kwargs', kwargs, args)"
|
"script":"alert(event.params)"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user