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"
} }
This diff is collapsed.
This diff is collapsed.
...@@ -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 => {
next('failed', err);
} }
}, url, props.method, params, 'json'); );
} }
...@@ -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