update bar
This commit is contained in:
parent
a9aba9ac7e
commit
2539869100
25
main.aardio
25
main.aardio
@ -1,10 +1,11 @@
|
||||
//低代码框架 amis
|
||||
import win.ui;
|
||||
/*DSG{{*/
|
||||
var winform = win.form(text="WebView2 - 调用百度低代码前端框架 amis";right=966;bottom=622;border="none";maximize=1)
|
||||
var winform = win.form(text="WebView2 - 调用百度低代码前端框架 amis";right=966;bottom=622;border="none";maximize=1;)
|
||||
winform.add(
|
||||
bk={cls="bk";left=0;top=-1;right=967;bottom=30;bgcolor=10789024;dl=1;dr=1;dt=1;z=1};
|
||||
custom={cls="custom";text="自定义控件";left=0;top=32;right=967;bottom=623;db=1;dl=1;dr=1;dt=1;z=2}
|
||||
bk={cls="bk";left=0;top=-1;right=967;bottom=30;bgcolor=10789024;dl=1;dr=1;dt=1;z=1;};
|
||||
custom={cls="custom";text="自定义控件";left=0;top=32;right=967;bottom=623;db=1;dl=1;dr=1;dt=1;z=2;};
|
||||
|
||||
)
|
||||
/*}}*/
|
||||
|
||||
@ -115,22 +116,8 @@ udpSend = function(d){
|
||||
|
||||
|
||||
getStatus = function(){
|
||||
var str = /**
|
||||
// API 返回数据
|
||||
|
||||
{
|
||||
"id": 1,
|
||||
"state": "success",
|
||||
"color": "#00FF00"
|
||||
}
|
||||
|
||||
|
||||
|
||||
**/
|
||||
|
||||
return web.json.parse(str);
|
||||
|
||||
;
|
||||
var seed = string.random("Success","Fault","PowerDown")
|
||||
return {state=seed};
|
||||
}
|
||||
|
||||
|
||||
|
16
res/cfg.json
16
res/cfg.json
@ -182,10 +182,10 @@
|
||||
"data": {
|
||||
"maxBarCnt":"60",
|
||||
"items": [
|
||||
{"color": "#FF0000"},
|
||||
{"color": "#00FF00"},
|
||||
{"color": "#0000FF"},
|
||||
{"color": "#FFFF00"},
|
||||
{"color": "#808080"},
|
||||
{"color": "#808080"},
|
||||
{"color": "#808080"},
|
||||
{"color": "#808080"},
|
||||
]
|
||||
},
|
||||
"body": [
|
||||
@ -194,11 +194,11 @@
|
||||
"name": "items",
|
||||
"items": {
|
||||
"type": "tpl",
|
||||
"tpl": "<div style='width: 3px; height: 50px; border-radius: 2px; background-color: ${color}; box-shadow: 0 0 5px ${color}, 0 0 10px ${color} inset'></div>",
|
||||
"tpl": "<div style='width: 3px; height: 50px; border-radius: 2px; background-color: ${color}; box-shadow: 0 0 5px ${color}, 0 0 10px ${color} inset' title='${state}'></div><br><div style='width: 3px; height: 50px; border-radius: 2px; background-color: ${color}; box-shadow: 0 0 5px ${color}, 0 0 10px ${color} inset' title='${state}'></div>",
|
||||
"style": {
|
||||
"display": "inline-block",
|
||||
"marginRight": "10px",
|
||||
"marginBottom": "10px"
|
||||
"marginRight": "5px",
|
||||
"marginBottom": "5px"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -208,7 +208,7 @@
|
||||
"actions": [
|
||||
{
|
||||
"actionType": "custom",
|
||||
"script": "const color = event.data.responseData.items;\ncontext.props.data.items.push(color)\nif (context.props.data.items.length > context.props.data.maxBarCnt) {\n context.props.data.items.shift(); // Remove the oldest value\n};"
|
||||
"script": "const colorMap={'Success':'#00ff00','Fault':'#ff0000','PowerDown':'#808080'};\n const ncolor = colorMap[event.data.responseData.state];\n console.log(event.data.responseData.state,ncolor);\ncontext.props.data.items.push({'color':ncolor})\nif (context.props.data.items.length > context.props.data.maxBarCnt) {\n context.props.data.items.shift(); // Remove the oldest value\n};"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user