Commit 39a1173e authored by rockyl's avatar rockyl

修改了好多东西啊

parent 364ff526
......@@ -4,12 +4,12 @@
"props": {
"left": {
"alias": "左值",
"type": "data",
"type": "dynamic",
"default": ""
},
"right": {
"alias": "右值",
"type": "data",
"type": "dynamic",
"default": ""
},
"operator": {
......
......@@ -5,7 +5,7 @@
"success"
],
"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",
"type": "builtin"
}
......@@ -4,14 +4,14 @@
"props": {
"url": {
"alias": "地址",
"type": "data"
"type": "dynamic"
}
},
"output": [
"complete"
],
"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",
"type": "builtin"
}
......@@ -32,19 +32,6 @@
"5fc7ba4d-6afa-4eab-82d8-f25cbcb79d56": {
"uuid": "5fc7ba4d-6afa-4eab-82d8-f25cbcb79d56",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 31
}
]
}
},
"props": {},
"output": {
"success": [
......@@ -55,44 +42,15 @@
"69e28053-dfb3-459e-a9e5-4964c6e35193": {
"uuid": "69e28053-dfb3-459e-a9e5-4964c6e35193",
"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": {
"url": {
"type": "link"
},
"method": {
"type": "link"
},
"params": {
"type": "link"
}
},
"output": {
......@@ -104,32 +62,6 @@
"39dce565-539b-44b6-901c-0344467795a8": {
"uuid": "39dce565-539b-44b6-901c-0344467795a8",
"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": {},
"output": {
"success": [
......@@ -140,26 +72,6 @@
"e95e7bbc-b592-4f87-b433-77fd03a9ef51": {
"uuid": "e95e7bbc-b592-4f87-b433-77fd03a9ef51",
"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": {
"name": {
"type": "link"
......@@ -172,7 +84,7 @@
"metas": [
{
"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": {},
"isInline": true,
"name": "兑吧接口转换",
......
......@@ -26,7 +26,7 @@
"exception"
],
"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",
"type": "builtin"
}
......@@ -22,7 +22,7 @@
"alias": "参数"
}
},
"name": "api请求",
"name": "API请求",
"output": [
"success",
"failed",
......@@ -32,19 +32,6 @@
"e6a9f1de-40c6-445b-b5e9-5c50a904a4de": {
"uuid": "e6a9f1de-40c6-445b-b5e9-5c50a904a4de",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 31
}
]
}
},
"props": {},
"output": {
"success": [
......@@ -55,26 +42,6 @@
"567169ba-a2c1-4c10-9025-605a2e89ef0f": {
"uuid": "567169ba-a2c1-4c10-9025-605a2e89ef0f",
"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": {
"host": {
"type": "link"
......@@ -92,32 +59,6 @@
"f9a32b46-aec1-4bd2-9b98-3d9a427d87db": {
"uuid": "f9a32b46-aec1-4bd2-9b98-3d9a427d87db",
"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": {
"method": {
"type": "link"
......@@ -125,6 +66,9 @@
"name": {
"type": "link",
"alias": "dataName"
},
"params": {
"type": "link"
}
},
"output": {}
......@@ -134,7 +78,7 @@
"metas": [
{
"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": {
"uri": {
"type": "string",
......@@ -149,6 +93,6 @@
}
],
"id": "api-request",
"group": "projextX",
"group": "projectX",
"type": "builtin"
}
......@@ -18,5 +18,5 @@
}
},
"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) {
const outputPath = path.join(output, sourcePath);
fs.ensureDirSync(path.dirname(outputPath));
fs.writeJsonSync(outputPath + '.json', meta, {spaces: ' '});
fs.writeFileSync(outputPath + '.js', code);
/*fs.writeJsonSync(outputPath + '-req.json', {
/*fs.writeFileSync(outputPath + '.js', result.code);
fs.writeJsonSync(outputPath + '-req.json', {
data: JSON.stringify(meta)
});*/
......
......@@ -2,8 +2,8 @@
"name": "比较",
"desc": "比较两个值",
"props": {
"left": {"alias": "左值","type": "data", "default": ""},
"right": {"alias": "右值","type": "data", "default": ""},
"left": {"alias": "左值","type": "dynamic", "default": ""},
"right": {"alias": "右值","type": "dynamic", "default": ""},
"operator": {"alias": "操作符","type": "enum",
"enum": ["==","!=","===","!==",">",">=","<","<="],
"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){
env = 'weixin'
}
console.log('env:', env);
const payload = args || {};
payload.env = env;
......
......@@ -2,10 +2,8 @@
* Created by rockyl on 2019-11-16.
*/
if (args && args.url) {
location.href = args.url;
} else if (props.url) {
location.href = props.url;
}
let url = engine.findVariable('url', args, props);
location.href = url;
next('complete');
......@@ -4,7 +4,7 @@
"props": {
"url": {
"alias": "地址",
"type": "data"
"type": "dynamic"
}
},
"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 @@
"metas": [
{
"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": {},
"isInline": true,
"name": "兑吧接口转换",
......
......@@ -9,11 +9,13 @@ if (!url) {
console.log('url is empty');
next('exception', '\'url is empty\'');
} else {
engine.httpRequest((s, payload) => {
if (s) {
next('success', payload);
} else {
next('failed', payload);
engine.httpRequest(url, props.method, params, 'json')
.then(
data => {
next('success', data);
},
err => {
next('failed', err);
}
}, url, props.method, params, 'json');
);
}
......@@ -45,7 +45,7 @@ function log(type, data) {
}
let isExposure = type === 'exposure';
engine.httpRequest(null,
engine.httpRequest(
isExposure ? '//embedlog.duiba.com.cn/exposure/standard' : '/log/click',
'get',
params,
......
......@@ -11,6 +11,8 @@ export default class Wave extends engine.ScriptBase {
waveParams: string;
loop: number = -1;
autoPlay: boolean = true;
ratio: string;
revert: boolean = false;
private _playing;
private _waveAlgorithm;
......@@ -18,7 +20,7 @@ export default class Wave extends engine.ScriptBase {
private _oldProps: any = {};
private _loopCounting;
mounted(){
mounted() {
this._startTime = 0;
engine.copyProp(this._oldProps, this.host, oldPropFields);
......@@ -46,15 +48,36 @@ export default class Wave extends engine.ScriptBase {
let r = pass / duration * PI2;
let loopCounting = Math.floor((t - this._startTime) / duration);
if(loopCounting != this._loopCounting){
if (loopCounting != this._loopCounting) {
this._loopCounting = loopCounting;
if(this.onLoopEnd()){
if (this.onLoopEnd()) {
r = PI2;
}
}
let params = waveParams ? (waveParams.split(',')) : [];
let props = _waveAlgorithm(...params, r);
let t2;
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')) {
host.x = (props.x || 0) + _oldProps.x;
......@@ -74,7 +97,7 @@ export default class Wave extends engine.ScriptBase {
}
}
private onLoopEnd(){
private onLoopEnd() {
if (this.loop < 0) {
//this.onLoopComplete.invoke();
} else if (this._loopCounting < this.loop) {
......@@ -98,15 +121,8 @@ export default class Wave extends engine.ScriptBase {
*/
stop(revert = false) {
this._playing = false;
if(revert){
for(let key in this._oldProps){
let prop = this._oldProps[key];
if(typeof prop === 'object'){
engine.injectProp(this.host[key], prop);
}else{
this.host[key] = prop;
}
}
if (revert) {
this.revertProps();
}
}
......@@ -122,7 +138,7 @@ export default class Wave extends engine.ScriptBase {
}
protected onModify(value, key, oldValue) {
switch(key){
switch (key) {
case 'waveMethod':
this._waveAlgorithm = waveLibs[this.waveMethod];
break;
......
......@@ -34,6 +34,15 @@
"alias": "自动播放",
"type": "boolean",
"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