Commit 39a1173e authored by rockyl's avatar rockyl

修改了好多东西啊

parent 364ff526
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
"props": { "props": {
"left": { "left": {
"alias": "左值", "alias": "左值",
"type": "data", "type": "dynamic",
"default": "" "default": ""
}, },
"right": { "right": {
"alias": "右值", "alias": "右值",
"type": "data", "type": "dynamic",
"default": "" "default": ""
}, },
"operator": { "operator": {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"success" "success"
], ],
"id": "env-judge", "id": "env-judge",
"script": "var ua = navigator.userAgent.toLowerCase();\nvar env;\nif (ua.indexOf('eversunshine') >= 0) {\n env = 'eversunshine';\n}\nelse if (ua.indexOf('micromessenger') >= 0) {\n env = 'weixin';\n}\nvar payload = args || {};\npayload.env = env;\nnext('success', payload);\n", "script": "var ua = navigator.userAgent.toLowerCase();\nvar env;\nif (ua.indexOf('eversunshine') >= 0) {\n env = 'eversunshine';\n}\nelse if (ua.indexOf('micromessenger') >= 0) {\n env = 'weixin';\n}\nconsole.log('env:', env);\nvar payload = args || {};\npayload.env = env;\nnext('success', payload);\n",
"group": "base", "group": "base",
"type": "builtin" "type": "builtin"
} }
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
"props": { "props": {
"url": { "url": {
"alias": "地址", "alias": "地址",
"type": "data" "type": "dynamic"
} }
}, },
"output": [ "output": [
"complete" "complete"
], ],
"id": "jump", "id": "jump",
"script": "if (args && args.url) {\n location.href = args.url;\n}\nelse if (props.url) {\n location.href = props.url;\n}\nnext('complete');\n", "script": "var url = engine.findVariable('url', args, props);\nlocation.href = url;\nnext('complete');\n",
"group": "base", "group": "base",
"type": "builtin" "type": "builtin"
} }
...@@ -32,19 +32,6 @@ ...@@ -32,19 +32,6 @@
"5fc7ba4d-6afa-4eab-82d8-f25cbcb79d56": { "5fc7ba4d-6afa-4eab-82d8-f25cbcb79d56": {
"uuid": "5fc7ba4d-6afa-4eab-82d8-f25cbcb79d56", "uuid": "5fc7ba4d-6afa-4eab-82d8-f25cbcb79d56",
"meta": "entry", "meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 31
}
]
}
},
"props": {}, "props": {},
"output": { "output": {
"success": [ "success": [
...@@ -55,44 +42,15 @@ ...@@ -55,44 +42,15 @@
"69e28053-dfb3-459e-a9e5-4964c6e35193": { "69e28053-dfb3-459e-a9e5-4964c6e35193": {
"uuid": "69e28053-dfb3-459e-a9e5-4964c6e35193", "uuid": "69e28053-dfb3-459e-a9e5-4964c6e35193",
"meta": "http-request", "meta": "http-request",
"design": {
"x": 67,
"y": 139,
"input": {
"default": [
{
"x": 5.5,
"y": 47.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 33.5
}
],
"failed": [
{
"x": 124.5,
"y": 47.5
}
],
"exception": [
{
"x": 124.5,
"y": 61.5
}
]
}
},
"props": { "props": {
"url": { "url": {
"type": "link" "type": "link"
}, },
"method": { "method": {
"type": "link" "type": "link"
},
"params": {
"type": "link"
} }
}, },
"output": { "output": {
...@@ -104,32 +62,6 @@ ...@@ -104,32 +62,6 @@
"39dce565-539b-44b6-901c-0344467795a8": { "39dce565-539b-44b6-901c-0344467795a8": {
"uuid": "39dce565-539b-44b6-901c-0344467795a8", "uuid": "39dce565-539b-44b6-901c-0344467795a8",
"meta": "duiba-api-transform", "meta": "duiba-api-transform",
"design": {
"x": 184,
"y": 275,
"input": {
"default": [
{
"x": 5.5,
"y": 30.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 23.5
}
],
"failed": [
{
"x": 124.5,
"y": 37.5
}
]
}
},
"props": {}, "props": {},
"output": { "output": {
"success": [ "success": [
...@@ -140,26 +72,6 @@ ...@@ -140,26 +72,6 @@
"e95e7bbc-b592-4f87-b433-77fd03a9ef51": { "e95e7bbc-b592-4f87-b433-77fd03a9ef51": {
"uuid": "e95e7bbc-b592-4f87-b433-77fd03a9ef51", "uuid": "e95e7bbc-b592-4f87-b433-77fd03a9ef51",
"meta": "put-data", "meta": "put-data",
"design": {
"x": 280,
"y": 367,
"input": {
"default": [
{
"x": 5.5,
"y": 47.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 47.5
}
]
}
},
"props": { "props": {
"name": { "name": {
"type": "link" "type": "link"
...@@ -172,7 +84,7 @@ ...@@ -172,7 +84,7 @@
"metas": [ "metas": [
{ {
"id": "duiba-api-transform", "id": "duiba-api-transform",
"script": "if (args.success) {\n next('success', args.data);\n}\nelse {\n next('failed');\n}\n", "script": "if (args.success) {\n next('success', args.data);\n}\nelse {\n next('failed', args);\n}\n",
"props": {}, "props": {},
"isInline": true, "isInline": true,
"name": "兑吧接口转换", "name": "兑吧接口转换",
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
"exception" "exception"
], ],
"id": "http-request", "id": "http-request",
"script": "var url = engine.findVariable('url', args, props);\nvar params = engine.findVariable('params', args, props);\nif (!url) {\n console.log('url is empty');\n next('exception', '\\'url is empty\\'');\n}\nelse {\n engine.httpRequest(function (s, payload) {\n if (s) {\n next('success', payload);\n }\n else {\n next('failed', payload);\n }\n }, url, props.method, params, 'json');\n}\n", "script": "var url = engine.findVariable('url', args, props);\nvar params = engine.findVariable('params', args, props);\nif (!url) {\n console.log('url is empty');\n next('exception', '\\'url is empty\\'');\n}\nelse {\n engine.httpRequest(url, props.method, params, 'json')\n .then(function (data) {\n next('success', data);\n }, function (err) {\n next('failed', err);\n });\n}\n",
"group": "net", "group": "net",
"type": "builtin" "type": "builtin"
} }
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"alias": "参数" "alias": "参数"
} }
}, },
"name": "api请求", "name": "API请求",
"output": [ "output": [
"success", "success",
"failed", "failed",
...@@ -32,19 +32,6 @@ ...@@ -32,19 +32,6 @@
"e6a9f1de-40c6-445b-b5e9-5c50a904a4de": { "e6a9f1de-40c6-445b-b5e9-5c50a904a4de": {
"uuid": "e6a9f1de-40c6-445b-b5e9-5c50a904a4de", "uuid": "e6a9f1de-40c6-445b-b5e9-5c50a904a4de",
"meta": "entry", "meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 31
}
]
}
},
"props": {}, "props": {},
"output": { "output": {
"success": [ "success": [
...@@ -55,26 +42,6 @@ ...@@ -55,26 +42,6 @@
"567169ba-a2c1-4c10-9025-605a2e89ef0f": { "567169ba-a2c1-4c10-9025-605a2e89ef0f": {
"uuid": "567169ba-a2c1-4c10-9025-605a2e89ef0f", "uuid": "567169ba-a2c1-4c10-9025-605a2e89ef0f",
"meta": "a4b27753-4cbb-47e3-9b31-51ced475e41a", "meta": "a4b27753-4cbb-47e3-9b31-51ced475e41a",
"design": {
"x": 163,
"y": 133,
"input": {
"default": [
{
"x": 5.5,
"y": 39
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 39
}
]
}
},
"props": { "props": {
"host": { "host": {
"type": "link" "type": "link"
...@@ -92,32 +59,6 @@ ...@@ -92,32 +59,6 @@
"f9a32b46-aec1-4bd2-9b98-3d9a427d87db": { "f9a32b46-aec1-4bd2-9b98-3d9a427d87db": {
"uuid": "f9a32b46-aec1-4bd2-9b98-3d9a427d87db", "uuid": "f9a32b46-aec1-4bd2-9b98-3d9a427d87db",
"meta": "duiba-api", "meta": "duiba-api",
"design": {
"x": 350,
"y": 188,
"input": {
"default": [
{
"x": 5.5,
"y": 64.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 57.5
}
],
"failed": [
{
"x": 124.5,
"y": 71.5
}
]
}
},
"props": { "props": {
"method": { "method": {
"type": "link" "type": "link"
...@@ -125,6 +66,9 @@ ...@@ -125,6 +66,9 @@
"name": { "name": {
"type": "link", "type": "link",
"alias": "dataName" "alias": "dataName"
},
"params": {
"type": "link"
} }
}, },
"output": {} "output": {}
...@@ -134,7 +78,7 @@ ...@@ -134,7 +78,7 @@
"metas": [ "metas": [
{ {
"id": "a4b27753-4cbb-47e3-9b31-51ced475e41a", "id": "a4b27753-4cbb-47e3-9b31-51ced475e41a",
"script": "//var projectX = 'projectX';\n//var projectID = engine.env.projectID;\nvar uri = engine.findVariable('uri', args, props);\nnext('success', {url: uri});//engine.joinPath(projectX, projectID, uri)});", "script": "var uri = engine.findVariable('uri', args, props);\nvar url;\nif(uri.indexOf('//') !== 0 && uri.indexOf('://') < 0 && location.pathname === '/preview' || top.location.hash.indexOf('preview/') >= 0){\n\tvar projectX = 'projectx';\n\tvar projectID = engine.env.projectID;\n url = engine.joinPath(projectX, projectID, uri);\n}else{\n url = uri;\n}\nnext('success', {url:url});",
"props": { "props": {
"uri": { "uri": {
"type": "string", "type": "string",
...@@ -149,6 +93,6 @@ ...@@ -149,6 +93,6 @@
} }
], ],
"id": "api-request", "id": "api-request",
"group": "projextX", "group": "projectX",
"type": "builtin" "type": "builtin"
} }
...@@ -18,5 +18,5 @@ ...@@ -18,5 +18,5 @@
} }
}, },
"id": "buried-point", "id": "buried-point",
"code": "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar BuriedPoint = (function (_super) {\n __extends(BuriedPoint, _super);\n function BuriedPoint() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.dpm = '0.0.0.0';\n _this.dcm = '0.0.0.0';\n _this.dom = '0.0.0.0';\n return _this;\n }\n BuriedPoint.prototype.mounted = function () {\n this.dpm && (this.dpm = fill(this.dpm));\n this.dcm && (this.dcm = fill(this.dcm));\n this.dom && (this.dom = fill(this.dom));\n this.host.addEventListener(engine.MouseEvent.CLICK, this._onClick, this);\n };\n BuriedPoint.prototype.awake = function () {\n log('exposure', this);\n };\n BuriedPoint.prototype._onClick = function (e) {\n log('click', this);\n };\n BuriedPoint.id = 'buried-point';\n return BuriedPoint;\n}(engine.ScriptBase));\nexports.default = BuriedPoint;\nfunction fill(src) {\n var result = src;\n for (var key in engine.env) {\n result = result.replace(key, engine.env[key]);\n }\n return result;\n}\nfunction log(type, data) {\n var dpm = data.dpm, dcm = data.dcm, dom = data.dom;\n var params = {\n dpm: dpm, dcm: dcm, appId: engine.env.app_id\n };\n if (dom !== '0.0.0.0') {\n params.dom = dom;\n }\n var isExposure = type === 'exposure';\n engine.httpRequest(null, isExposure ? '//embedlog.duiba.com.cn/exposure/standard' : '/log/click', 'get', params, isExposure ? 'jsonp' : 'text');\n}\n" "code": "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar BuriedPoint = (function (_super) {\n __extends(BuriedPoint, _super);\n function BuriedPoint() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.dpm = '0.0.0.0';\n _this.dcm = '0.0.0.0';\n _this.dom = '0.0.0.0';\n return _this;\n }\n BuriedPoint.prototype.mounted = function () {\n this.dpm && (this.dpm = fill(this.dpm));\n this.dcm && (this.dcm = fill(this.dcm));\n this.dom && (this.dom = fill(this.dom));\n this.host.addEventListener(engine.MouseEvent.CLICK, this._onClick, this);\n };\n BuriedPoint.prototype.awake = function () {\n log('exposure', this);\n };\n BuriedPoint.prototype._onClick = function (e) {\n log('click', this);\n };\n BuriedPoint.id = 'buried-point';\n return BuriedPoint;\n}(engine.ScriptBase));\nexports.default = BuriedPoint;\nfunction fill(src) {\n var result = src;\n for (var key in engine.env) {\n result = result.replace(key, engine.env[key]);\n }\n return result;\n}\nfunction log(type, data) {\n var dpm = data.dpm, dcm = data.dcm, dom = data.dom;\n var params = {\n dpm: dpm, dcm: dcm, appId: engine.env.app_id\n };\n if (dom !== '0.0.0.0') {\n params.dom = dom;\n }\n var isExposure = type === 'exposure';\n engine.httpRequest(isExposure ? '//embedlog.duiba.com.cn/exposure/standard' : '/log/click', 'get', params, isExposure ? 'jsonp' : 'text');\n}\n"
} }
...@@ -34,8 +34,17 @@ ...@@ -34,8 +34,17 @@
"alias": "自动播放", "alias": "自动播放",
"type": "boolean", "type": "boolean",
"default": true "default": true
},
"revert": {
"alias": "自动恢复",
"type": "boolean",
"default": false
},
"ratio": {
"alias": "时间占比",
"type": "string"
} }
}, },
"id": "wave", "id": "wave",
"code": "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Wave = (function (_super) {\n __extends(Wave, _super);\n function Wave() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.duration = 1000;\n _this.waveMethod = 'rotate';\n _this.loop = -1;\n _this.autoPlay = true;\n _this._oldProps = {};\n return _this;\n }\n Wave.prototype.mounted = function () {\n this._startTime = 0;\n engine.copyProp(this._oldProps, this.host, oldPropFields);\n if (this.autoPlay) {\n this.play();\n }\n };\n Wave.prototype.update = function (t) {\n if (this._playing) {\n if (!this._startTime) {\n this._startTime = t;\n }\n var _a = this, duration = _a.duration, waveParams = _a.waveParams, _waveAlgorithm = _a._waveAlgorithm, host = _a.host, _oldProps = _a._oldProps;\n var pass = (t - this._startTime) % duration;\n var r = pass / duration * PI2;\n var loopCounting = Math.floor((t - this._startTime) / duration);\n if (loopCounting != this._loopCounting) {\n this._loopCounting = loopCounting;\n if (this.onLoopEnd()) {\n r = PI2;\n }\n }\n var params = waveParams ? (waveParams.split(',')) : [];\n var props = _waveAlgorithm.apply(void 0, __spreadArrays(params, [r]));\n if (props.hasOwnProperty('x')) {\n host.x = (props.x || 0) + _oldProps.x;\n }\n if (props.hasOwnProperty('y')) {\n host.y = (props.y || 0) + _oldProps.y;\n }\n if (props.hasOwnProperty('sx')) {\n host.scaleX = props.sx;\n }\n if (props.hasOwnProperty('sy')) {\n host.scaleY = props.sy;\n }\n if (props.hasOwnProperty('r')) {\n host.rotation = props.r;\n }\n }\n };\n Wave.prototype.onLoopEnd = function () {\n if (this.loop < 0) {\n }\n else if (this._loopCounting < this.loop) {\n }\n else {\n this._playing = false;\n return true;\n }\n };\n Wave.prototype.play = function () {\n this._loopCounting = 0;\n this._playing = true;\n this._startTime = 0;\n };\n Wave.prototype.stop = function (revert) {\n if (revert === void 0) { revert = false; }\n this._playing = false;\n if (revert) {\n for (var key in this._oldProps) {\n var prop = this._oldProps[key];\n if (typeof prop === 'object') {\n engine.injectProp(this.host[key], prop);\n }\n else {\n this.host[key] = prop;\n }\n }\n }\n };\n Wave.prototype.onModify = function (value, key, oldValue) {\n switch (key) {\n case 'waveMethod':\n this._waveAlgorithm = waveLibs[this.waveMethod];\n break;\n }\n };\n Wave.id = 'wave';\n __decorate([\n engine.dirtyFieldTrigger\n ], Wave.prototype, \"waveMethod\", void 0);\n return Wave;\n}(engine.ScriptBase));\nexports.default = Wave;\nvar PI2 = Math.PI * 2;\nvar oldPropFields = {\n x: 'x',\n y: 'y',\n scaleX: 'scaleX',\n scaleY: 'scaleY',\n alpha: 'alpha',\n rotation: 'rotation',\n};\nvar cos = Math.cos, sin = Math.sin, PI = Math.PI;\nvar waveLibs = {\n round: function (radius, t) {\n return { x: cos(t) * radius, y: sin(t) * radius };\n },\n cosWave: function (h, t) {\n return { x: cos(t) * h, y: 0 };\n },\n sinWave: function (h, t) {\n h = h || 1;\n return { x: 0, y: sin(t) * h };\n },\n rotate: function (t) {\n return { r: 360 * t / PI / 2 };\n },\n shake: function (angle, count, t) {\n return { r: sin(t * count) * angle };\n },\n breath: function (scale, t) {\n if (scale === void 0) { scale = 0.1; }\n return { sx: sin(t) * scale + 1, sy: -sin(t + PI / 4) * scale + 1 };\n },\n zoom: function (scale, t) {\n if (scale === void 0) { scale = 0.1; }\n return { sx: sin(t) * scale + 1, sy: sin(t) * scale + 1 };\n },\n fade: function (base, t) {\n if (base === void 0) { base = 1; }\n return { alpha: (sin(t) + 1) * 0.5 + base };\n },\n};\n" "code": "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Wave = (function (_super) {\n __extends(Wave, _super);\n function Wave() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.duration = 1000;\n _this.waveMethod = 'rotate';\n _this.loop = -1;\n _this.autoPlay = true;\n _this.revert = false;\n _this._oldProps = {};\n return _this;\n }\n Wave.prototype.mounted = function () {\n this._startTime = 0;\n engine.copyProp(this._oldProps, this.host, oldPropFields);\n if (this.autoPlay) {\n this.play();\n }\n };\n Wave.prototype.sleep = function () {\n if (this.revert) {\n this.revertProps();\n }\n };\n Wave.prototype.update = function (t) {\n if (this._playing) {\n if (!this._startTime) {\n this._startTime = t;\n }\n var _a = this, duration = _a.duration, waveParams = _a.waveParams, _waveAlgorithm = _a._waveAlgorithm, host = _a.host, _oldProps = _a._oldProps;\n var pass = (t - this._startTime) % duration;\n var r = pass / duration * PI2;\n var loopCounting = Math.floor((t - this._startTime) / duration);\n if (loopCounting != this._loopCounting) {\n this._loopCounting = loopCounting;\n if (this.onLoopEnd()) {\n r = PI2;\n }\n }\n var t2 = void 0;\n if (this.ratio) {\n var ratio = this.ratio.split(',').map(function (item) { return parseFloat(item); });\n if (ratio.length === 2) {\n var begin = ratio[0], end = ratio[1];\n if (end >= begin) {\n var tr = r / PI2;\n if (tr >= begin && tr < end) {\n t2 = r / (end - begin);\n }\n else {\n t2 = 0;\n }\n }\n else {\n t2 = 0;\n }\n }\n else {\n t2 = 0;\n }\n }\n else {\n t2 = r;\n }\n var params = waveParams ? (waveParams.split(',').map(function (item) { return parseFloat(item); })) : [];\n var props = _waveAlgorithm.apply(void 0, __spreadArrays(params, [t2]));\n if (props.hasOwnProperty('x')) {\n host.x = (props.x || 0) + _oldProps.x;\n }\n if (props.hasOwnProperty('y')) {\n host.y = (props.y || 0) + _oldProps.y;\n }\n if (props.hasOwnProperty('sx')) {\n host.scaleX = props.sx;\n }\n if (props.hasOwnProperty('sy')) {\n host.scaleY = props.sy;\n }\n if (props.hasOwnProperty('r')) {\n host.rotation = props.r;\n }\n }\n };\n Wave.prototype.onLoopEnd = function () {\n if (this.loop < 0) {\n }\n else if (this._loopCounting < this.loop) {\n }\n else {\n this._playing = false;\n return true;\n }\n };\n Wave.prototype.play = function () {\n this._loopCounting = 0;\n this._playing = true;\n this._startTime = 0;\n };\n Wave.prototype.stop = function (revert) {\n if (revert === void 0) { revert = false; }\n this._playing = false;\n if (revert) {\n this.revertProps();\n }\n };\n Wave.prototype.revertProps = function () {\n for (var key in this._oldProps) {\n var prop = this._oldProps[key];\n if (typeof prop === 'object') {\n engine.injectProp(this.host[key], prop);\n }\n else {\n this.host[key] = prop;\n }\n }\n };\n Wave.prototype.onModify = function (value, key, oldValue) {\n switch (key) {\n case 'waveMethod':\n this._waveAlgorithm = waveLibs[this.waveMethod];\n break;\n }\n };\n Wave.id = 'wave';\n __decorate([\n engine.dirtyFieldTrigger\n ], Wave.prototype, \"waveMethod\", void 0);\n return Wave;\n}(engine.ScriptBase));\nexports.default = Wave;\nvar PI2 = Math.PI * 2;\nvar oldPropFields = {\n x: 'x',\n y: 'y',\n scaleX: 'scaleX',\n scaleY: 'scaleY',\n alpha: 'alpha',\n rotation: 'rotation',\n};\nvar cos = Math.cos, sin = Math.sin, PI = Math.PI;\nvar waveLibs = {\n round: function (radius, t) {\n return { x: cos(t) * radius, y: sin(t) * radius };\n },\n cosWave: function (h, t) {\n return { x: cos(t) * h, y: 0 };\n },\n sinWave: function (h, t) {\n h = h || 1;\n return { x: 0, y: sin(t) * h };\n },\n rotate: function (t) {\n return { r: 360 * t / PI / 2 };\n },\n shake: function (angle, count, t) {\n return { r: sin(t * count) * angle };\n },\n breath: function (scale, t) {\n if (scale === void 0) { scale = 0.1; }\n return { sx: sin(t) * scale + 1, sy: -sin(t + PI / 4) * scale + 1 };\n },\n zoom: function (scale, t) {\n if (scale === void 0) { scale = 0.1; }\n return { sx: sin(t) * scale + 1, sy: sin(t) * scale + 1 };\n },\n fade: function (base, t) {\n if (base === void 0) { base = 1; }\n return { alpha: (sin(t) + 1) * 0.5 + base };\n },\n};\n"
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -35,8 +35,8 @@ function compileProcess(sourcePath, output) { ...@@ -35,8 +35,8 @@ function compileProcess(sourcePath, output) {
const outputPath = path.join(output, sourcePath); const outputPath = path.join(output, sourcePath);
fs.ensureDirSync(path.dirname(outputPath)); fs.ensureDirSync(path.dirname(outputPath));
fs.writeJsonSync(outputPath + '.json', meta, {spaces: ' '}); fs.writeJsonSync(outputPath + '.json', meta, {spaces: ' '});
fs.writeFileSync(outputPath + '.js', code); /*fs.writeFileSync(outputPath + '.js', result.code);
/*fs.writeJsonSync(outputPath + '-req.json', { fs.writeJsonSync(outputPath + '-req.json', {
data: JSON.stringify(meta) data: JSON.stringify(meta)
});*/ });*/
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
"name": "比较", "name": "比较",
"desc": "比较两个值", "desc": "比较两个值",
"props": { "props": {
"left": {"alias": "左值","type": "data", "default": ""}, "left": {"alias": "左值","type": "dynamic", "default": ""},
"right": {"alias": "右值","type": "data", "default": ""}, "right": {"alias": "右值","type": "dynamic", "default": ""},
"operator": {"alias": "操作符","type": "enum", "operator": {"alias": "操作符","type": "enum",
"enum": ["==","!=","===","!==",">",">=","<","<="], "enum": ["==","!=","===","!==",">",">=","<","<="],
"default": "=="} "default": "=="}
......
{
"script": "if(args.name === props.dataName){\nnext('success', args);\n}else{\nnext('cancel')\n}",
"props": {
"dataName": {
"type": "string",
"alias": "数据名"
}
},
"name": "数据中心事件筛选",
"output": [
"success",
"cancel"
]
}
\ No newline at end of file
...@@ -11,6 +11,8 @@ if(ua.indexOf('eversunshine') >= 0){ ...@@ -11,6 +11,8 @@ if(ua.indexOf('eversunshine') >= 0){
env = 'weixin' env = 'weixin'
} }
console.log('env:', env);
const payload = args || {}; const payload = args || {};
payload.env = env; payload.env = env;
......
...@@ -2,10 +2,8 @@ ...@@ -2,10 +2,8 @@
* Created by rockyl on 2019-11-16. * Created by rockyl on 2019-11-16.
*/ */
if (args && args.url) { let url = engine.findVariable('url', args, props);
location.href = args.url;
} else if (props.url) { location.href = url;
location.href = props.url;
}
next('complete'); next('complete');
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"props": { "props": {
"url": { "url": {
"alias": "地址", "alias": "地址",
"type": "data" "type": "dynamic"
} }
}, },
"output": [ "output": [
......
{
"props": {
"cardListNode": {
"type": "node",
"alias": "卡片列表"
},
"cardCount": {
"type": "number",
"default": 6,
"alias": "卡片数量"
}
},
"name": "初始化卡片列表",
"output": [
"success"
]
}
\ No newline at end of file
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
"metas": [ "metas": [
{ {
"id": "duiba-api-transform", "id": "duiba-api-transform",
"script": "if (args.success) {\n next('success', args.data);\n}\nelse {\n next('failed');\n}\n", "script": "if (args.success) {\n next('success', args.data);\n}\nelse {\n next('failed', args);\n}\n",
"props": {}, "props": {},
"isInline": true, "isInline": true,
"name": "兑吧接口转换", "name": "兑吧接口转换",
......
...@@ -9,11 +9,13 @@ if (!url) { ...@@ -9,11 +9,13 @@ if (!url) {
console.log('url is empty'); console.log('url is empty');
next('exception', '\'url is empty\''); next('exception', '\'url is empty\'');
} else { } else {
engine.httpRequest((s, payload) => { engine.httpRequest(url, props.method, params, 'json')
if (s) { .then(
next('success', payload); data => {
} else { next('success', data);
next('failed', payload); },
} err => {
}, url, props.method, params, 'json'); next('failed', err);
}
);
} }
...@@ -45,7 +45,7 @@ function log(type, data) { ...@@ -45,7 +45,7 @@ function log(type, data) {
} }
let isExposure = type === 'exposure'; let isExposure = type === 'exposure';
engine.httpRequest(null, engine.httpRequest(
isExposure ? '//embedlog.duiba.com.cn/exposure/standard' : '/log/click', isExposure ? '//embedlog.duiba.com.cn/exposure/standard' : '/log/click',
'get', 'get',
params, params,
......
...@@ -11,6 +11,8 @@ export default class Wave extends engine.ScriptBase { ...@@ -11,6 +11,8 @@ export default class Wave extends engine.ScriptBase {
waveParams: string; waveParams: string;
loop: number = -1; loop: number = -1;
autoPlay: boolean = true; autoPlay: boolean = true;
ratio: string;
revert: boolean = false;
private _playing; private _playing;
private _waveAlgorithm; private _waveAlgorithm;
...@@ -18,7 +20,7 @@ export default class Wave extends engine.ScriptBase { ...@@ -18,7 +20,7 @@ export default class Wave extends engine.ScriptBase {
private _oldProps: any = {}; private _oldProps: any = {};
private _loopCounting; private _loopCounting;
mounted(){ mounted() {
this._startTime = 0; this._startTime = 0;
engine.copyProp(this._oldProps, this.host, oldPropFields); engine.copyProp(this._oldProps, this.host, oldPropFields);
...@@ -46,15 +48,36 @@ export default class Wave extends engine.ScriptBase { ...@@ -46,15 +48,36 @@ export default class Wave extends engine.ScriptBase {
let r = pass / duration * PI2; let r = pass / duration * PI2;
let loopCounting = Math.floor((t - this._startTime) / duration); let loopCounting = Math.floor((t - this._startTime) / duration);
if(loopCounting != this._loopCounting){ if (loopCounting != this._loopCounting) {
this._loopCounting = loopCounting; this._loopCounting = loopCounting;
if(this.onLoopEnd()){ if (this.onLoopEnd()) {
r = PI2; r = PI2;
} }
} }
let params = waveParams ? (waveParams.split(',')) : []; let t2;
let props = _waveAlgorithm(...params, r); if (this.ratio) {
let ratio = this.ratio.split(',').map(item => parseFloat(item));
if (ratio.length === 2) {
const [begin, end] = ratio;
if(end >= begin){
let tr = r / PI2;
if(tr >= begin && tr < end){
t2 = r / (end - begin);
}else{
t2 = 0;
}
}else{
t2 = 0;
}
}else{
t2 = 0;
}
} else {
t2 = r;
}
let params = waveParams ? (waveParams.split(',').map(item => parseFloat(item))) : [];
let props = _waveAlgorithm(...params, t2);
if (props.hasOwnProperty('x')) { if (props.hasOwnProperty('x')) {
host.x = (props.x || 0) + _oldProps.x; host.x = (props.x || 0) + _oldProps.x;
...@@ -74,7 +97,7 @@ export default class Wave extends engine.ScriptBase { ...@@ -74,7 +97,7 @@ export default class Wave extends engine.ScriptBase {
} }
} }
private onLoopEnd(){ private onLoopEnd() {
if (this.loop < 0) { if (this.loop < 0) {
//this.onLoopComplete.invoke(); //this.onLoopComplete.invoke();
} else if (this._loopCounting < this.loop) { } else if (this._loopCounting < this.loop) {
...@@ -98,15 +121,8 @@ export default class Wave extends engine.ScriptBase { ...@@ -98,15 +121,8 @@ export default class Wave extends engine.ScriptBase {
*/ */
stop(revert = false) { stop(revert = false) {
this._playing = false; this._playing = false;
if(revert){ if (revert) {
for(let key in this._oldProps){ this.revertProps();
let prop = this._oldProps[key];
if(typeof prop === 'object'){
engine.injectProp(this.host[key], prop);
}else{
this.host[key] = prop;
}
}
} }
} }
...@@ -122,7 +138,7 @@ export default class Wave extends engine.ScriptBase { ...@@ -122,7 +138,7 @@ export default class Wave extends engine.ScriptBase {
} }
protected onModify(value, key, oldValue) { protected onModify(value, key, oldValue) {
switch(key){ switch (key) {
case 'waveMethod': case 'waveMethod':
this._waveAlgorithm = waveLibs[this.waveMethod]; this._waveAlgorithm = waveLibs[this.waveMethod];
break; break;
......
...@@ -34,6 +34,15 @@ ...@@ -34,6 +34,15 @@
"alias": "自动播放", "alias": "自动播放",
"type": "boolean", "type": "boolean",
"default": true "default": true
},
"revert": {
"alias": "自动恢复",
"type": "boolean",
"default": false
},
"ratio": {
"alias": "时间占比",
"type": "string"
} }
} }
} }
\ 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