-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #348 from wanbing/dev_wanbing
fair-online update
- Loading branch information
Showing
3 changed files
with
125 additions
and
5 deletions.
There are no files selected for viewing
122 changes: 121 additions & 1 deletion
122
...project/empty_project/assets/fair/lib_page_hotel_listview_hotel_listview_template.fair.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,121 @@ | ||
GLOBAL['#FairKey#']=(function(__initProps__){const __global__=this;defineModule(1,function(__mod__){with(__mod__.imports){}},[]);return runCallback(function(__mod__){with(__mod__.imports){function HotelModel(){const inner=HotelModel.__inner__;if(this==__global__){return new HotelModel({__args__:arguments});}else{const args=arguments.length>0?arguments[0].__args__||arguments:[];inner.apply(this,args);HotelModel.prototype.ctor.apply(this,args);return this;}}HotelModel.__inner__=function inner(){this.imagePath='';this.titleTxt='';this.subTxt='';this.dist='';this.reviews='';this.perNight='';};HotelModel.prototype={};HotelModel.prototype.ctor=function(){};function _HotelListViewState(){const inner=_HotelListViewState.__inner__;if(this==__global__){return new _HotelListViewState({__args__:arguments});}else{const args=arguments.length>0?arguments[0].__args__||arguments:[];inner.apply(this,args);_HotelListViewState.prototype.ctor.apply(this,args);return this;}}_HotelListViewState.__inner__=function inner(){this._listData=[];this._page=0;};_HotelListViewState.prototype={initState:function initState(){const __thiz__=this;with(__thiz__){onLoad();}},onLoad:function onLoad(){const __thiz__=this;with(__thiz__){requestData();}},onUnload:function onUnload(){const __thiz__=this;with(__thiz__){}},requestData:function requestData(){const __thiz__=this;with(__thiz__){_page++;FairNet().requestData(convertObjectLiteralToSetOrMap({['pageName']:'#FairKey#',['method']:'GET',['url']:'https://wos2.58cdn.com.cn/DeFazYxWvDti/frsupload/3be6c61070d3b48c8165af5d18464c0e_hotel_list_data.json',['data']:convertObjectLiteralToSetOrMap({['page']:_page,}),['success']:function dummy(resp){if(resp==null){return null;}let data=resp.__op_idx__('data');data.forEach(function dummy(item){let dataItem=HotelModel();try{dataItem.imagePath=item.imagePath;dataItem.titleTxt=item.titleTxt;dataItem.subTxt=item.subTxt;dataItem.dist=item.dist+' km';dataItem.reviews=item.reviews+' reviews';dataItem.perNight=item.perNight+'';}catch(e){dataItem.imagePath=item.__op_idx__('imagePath');dataItem.titleTxt=item.__op_idx__('titleTxt');dataItem.subTxt=item.__op_idx__('subTxt');dataItem.dist=`${item['dist']} km`;dataItem.reviews=`${item['reviews']} reviews`;dataItem.perNight=`${item['perNight']}`;}_listData.add(dataItem);});setState('#FairKey#',function dummy(){});},}));}},isDataEmpty:function isDataEmpty(){const __thiz__=this;with(__thiz__){return _listData.isEmpty;}},};_HotelListViewState.prototype.ctor=function(){};;return _HotelListViewState();}},[1]);})(convertObjectLiteralToSetOrMap(JSON.parse('#FairProps#'))); | ||
GLOBAL['#FairKey#'] = (function(__initProps__) { | ||
const __global__ = this; | ||
return runCallback(function(__mod__) { | ||
with(__mod__.imports) { | ||
function HotelModel() { | ||
const inner = HotelModel.__inner__; | ||
if (this == __global__) { | ||
return new HotelModel({ | ||
__args__: arguments | ||
}); | ||
} else { | ||
const args = arguments.length > 0 ? arguments[0].__args__ || arguments: []; | ||
inner.apply(this, args); | ||
HotelModel.prototype.ctor.apply(this, args); | ||
return this; | ||
} | ||
} | ||
HotelModel.__inner__ = function inner() { | ||
this.imagePath = ''; | ||
this.titleTxt = ''; | ||
this.subTxt = ''; | ||
this.dist = ''; | ||
this.reviews = ''; | ||
this.perNight = ''; | ||
}; | ||
HotelModel.prototype = {}; | ||
HotelModel.prototype.ctor = function() {}; | ||
function _HotelListViewState() { | ||
const inner = _HotelListViewState.__inner__; | ||
if (this == __global__) { | ||
return new _HotelListViewState({ | ||
__args__: arguments | ||
}); | ||
} else { | ||
const args = arguments.length > 0 ? arguments[0].__args__ || arguments: []; | ||
inner.apply(this, args); | ||
_HotelListViewState.prototype.ctor.apply(this, args); | ||
return this; | ||
} | ||
} | ||
_HotelListViewState.__inner__ = function inner() { | ||
this._listData = []; | ||
this._page = 0; | ||
}; | ||
_HotelListViewState.prototype = { | ||
initState: function initState() { | ||
const __thiz__ = this; | ||
with(__thiz__) { | ||
onLoad(); | ||
} | ||
}, | ||
onLoad: function onLoad() { | ||
const __thiz__ = this; | ||
with(__thiz__) { | ||
requestData(); | ||
} | ||
}, | ||
onUnload: function onUnload() { | ||
const __thiz__ = this; | ||
with(__thiz__) {} | ||
}, | ||
requestData: function requestData() { | ||
const __thiz__ = this; | ||
with(__thiz__) { | ||
_page++; | ||
FairNet().requestData(convertObjectLiteralToSetOrMap({ ['pageName'] : '#FairKey#', | ||
['method'] : 'GET', | ||
['url'] : 'https://wos2.58cdn.com.cn/DeFazYxWvDti/frsupload/3be6c61070d3b48c8165af5d18464c0e_hotel_list_data.json', | ||
['data'] : convertObjectLiteralToSetOrMap({ ['page'] : _page, | ||
}), | ||
['success'] : function dummy(resp) { | ||
if (resp == null) { | ||
return null; | ||
} | ||
let data = resp.__op_idx__('data'); | ||
data.forEach(function dummy(item) { | ||
let dataItem = HotelModel(); | ||
try { | ||
dataItem.imagePath = item.imagePath; | ||
dataItem.titleTxt = item.titleTxt; | ||
dataItem.subTxt = item.subTxt; | ||
dataItem.dist = item.dist + ' km'; | ||
dataItem.reviews = item.reviews + ' reviews'; | ||
dataItem.perNight = item.perNight + ''; | ||
} catch(e) { | ||
dataItem.imagePath = item.__op_idx__('imagePath'); | ||
dataItem.titleTxt = item.__op_idx__('titleTxt'); | ||
dataItem.subTxt = item.__op_idx__('subTxt'); | ||
dataItem.dist = `$ { | ||
item['dist'] | ||
} | ||
km`; | ||
dataItem.reviews = `$ { | ||
item['reviews'] | ||
} | ||
reviews`; | ||
dataItem.perNight = `$ { | ||
item['perNight'] | ||
}`; | ||
} | ||
_listData.add(dataItem); | ||
}); | ||
setState('#FairKey#', | ||
function dummy() {}); | ||
}, | ||
})); | ||
} | ||
}, | ||
isDataEmpty: function isDataEmpty() { | ||
const __thiz__ = this; | ||
with(__thiz__) { | ||
return _listData.isEmpty; | ||
} | ||
}, | ||
}; | ||
_HotelListViewState.prototype.ctor = function() {};; | ||
return _HotelListViewState(); | ||
} | ||
}, | ||
[]); | ||
})(convertObjectLiteralToSetOrMap(JSON.parse('#FairProps#'))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters