Commit 03d02ac8 authored by rockyl's avatar rockyl

传个版本

parent 7175d6a5
{
"script": "if(args.name === props.dataName){\nnext('success', args);\n}else{\nnext('cancel')\n}",
"props": {
"dataName": {
"type": "string",
"alias": "数据名"
}
},
"name": "数据中心事件筛选",
"output": [
"success",
"cancel"
],
"id": "data-center-event-filter",
"group": "base",
"type": "builtin"
}
{
"props": {
"cardListNode": {
"type": "node",
"alias": "卡片列表"
},
"cardCount": {
"type": "number",
"default": 6,
"alias": "卡片数量"
}
},
"name": "初始化卡片列表",
"output": [
"success"
],
"id": "card-list-init",
"script": "var cardListNode = props.cardListNode, cardCount = props.cardCount, badgeName = props.badgeName, badgeLabName = props.badgeLabName, dataName = props.dataName;\nvar listNode = cardListNode || target;\nfor (var i = 0; i < cardCount; i++) {\n var cardNode = listNode.getChildAt(i);\n var card0 = cardNode.getChildByName('0');\n card0.visible = true;\n var card1 = cardNode.getChildByName('1');\n card1.visible = false;\n var badge = cardNode.getChildByName(badgeName);\n var badgeLab = badge.getChildByName(badgeLabName);\n badgeLab.text = '${' + dataName + '|' + i + '}';\n}\n",
"group": "custom",
"type": "builtin"
}
{
"props": {
"uri": {
"type": "string",
"alias": "链接"
},
"method": {
"type": "enum",
"enum": [
"get",
"post"
],
"alias": "方法",
"default": "get"
},
"count": {
"type": "number",
"alias": "次数",
"default": 10
},
"delay": {
"type": "number",
"default": 500,
"alias": "单次延时"
},
"dataName": {
"type": "string",
"alias": "数据名"
},
"field": {
"type": "string",
"alias": "字段名"
},
"successValues": {
"type": "string",
"alias": "成功值"
},
"params": {
"type": "map",
"alias": "参数"
}
},
"name": "API轮询",
"output": [
"success",
"failed",
"timeout",
"exception"
],
"sub": {
"442452af-e4d2-47be-b931-86fef866056f": {
"uuid": "442452af-e4d2-47be-b931-86fef866056f",
"meta": "entry",
"design": {
"x": 26,
"y": 15,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 31
}
]
}
},
"props": {},
"output": {
"success": [
"37b87a14-679b-49b8-9293-321b82d6019d"
]
}
},
"9def8371-1326-4daa-8220-78cf888297e3": {
"uuid": "9def8371-1326-4daa-8220-78cf888297e3",
"meta": "wait",
"design": {
"x": 265,
"y": 313,
"input": {
"default": [
{
"x": 5.5,
"y": 39
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 39
}
]
}
},
"props": {
"duration": {
"type": "link",
"alias": "delay"
}
},
"output": {
"complete": [
"37b87a14-679b-49b8-9293-321b82d6019d"
]
}
},
"b88c8995-28eb-470f-a8a2-7484c9f98e05": {
"uuid": "b88c8995-28eb-470f-a8a2-7484c9f98e05",
"meta": "http-polling-judge",
"design": {
"x": 441,
"y": 57,
"input": {
"default": [
{
"x": 5.5,
"y": 56
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 42
}
],
"continue": [
{
"x": 124.5,
"y": 56
}
],
"timeout": [
{
"x": 124.5,
"y": 70
}
]
}
},
"props": {
"count": {
"type": "link"
},
"field": {
"type": "link"
},
"successValues": {
"type": "link"
}
},
"output": {
"continue": [
"9def8371-1326-4daa-8220-78cf888297e3"
]
}
},
"37b87a14-679b-49b8-9293-321b82d6019d": {
"uuid": "37b87a14-679b-49b8-9293-321b82d6019d",
"meta": "api-request",
"design": {
"x": 250,
"y": 43,
"input": {
"default": [
{
"x": 5.5,
"y": 64.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 50.5
}
],
"failed": [
{
"x": 124.5,
"y": 64.5
}
],
"exception": [
{
"x": 124.5,
"y": 78.5
}
]
}
},
"props": {
"uri": {
"type": "link"
},
"method": {
"type": "link"
},
"dataName": {
"type": "link"
},
"params": {
"type": "link"
}
},
"output": {
"success": [
"b88c8995-28eb-470f-a8a2-7484c9f98e05"
]
}
}
},
"subEntry": "442452af-e4d2-47be-b931-86fef866056f",
"metas": [
{
"script": "var count = props.count, field = props.field, successValues = props.successValues;\nvar key = 'counting-' + vm.id;\nvar counting = global[key] || 0;\ncounting++;\nvar successArr = successValues.split(',');\nif (successArr.indexOf(args[field] + '') >= 0) {\n delete global[key];\n next('success', args);\n}\nelse if (counting < count) {\n global[key] = counting;\n next('continue');\n}\nelse {\n delete global[key];\n next('timeout');\n}\n",
"props": {
"count": {
"type": "number",
"default": 5,
"alias": "次数"
},
"field": {
"type": "string",
"alias": "字段名",
"default": "status"
},
"successValues": {
"type": "string",
"alias": "成功值"
}
},
"name": "轮询判断",
"output": [
"success",
"continue",
"timeout"
],
"id": "http-polling-judge",
"group": "projextX",
"type": "builtin"
}
],
"id": "api-polling",
"group": "projextX",
"type": "builtin"
}
/**
* Created by rockyl on 2019-11-27.
*/
const {cardListNode, cardCount, badgeName, badgeLabName, dataName} = props;
const listNode = cardListNode || target;
for (let i = 0; i < cardCount; i++) {
const cardNode = <engine.Container>listNode.getChildAt(i);
const card0 = cardNode.getChildByName('0');
card0.visible = true;
const card1 = cardNode.getChildByName('1');
card1.visible = false;
const badge = cardNode.getChildByName(badgeName);
const badgeLab = badge.getChildByName(badgeLabName);
badgeLab.text = '${' + dataName + '|' + i + '}';
}
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