-
Notifications
You must be signed in to change notification settings - Fork 2.2k
基础用法
require("NSString, USERDEFAULTS, BannerModel, FloorListModel, USERDEFAULTS");
defineClass("MainViewController", { loadRequest: function() { self.banner2().removeAllObjects(); self.DataArray().removeAllObjects(); self.activetyArr().removeAllObjects(); self.imgMarr().removeAllObjects(); self.scrollURL().removeAllObjects(); var slf = self; self.post_withParam_success_failure(NSString.stringWithFormat("%@%@", YH_REQUEST_DOMAIN, "site/index"), self.parm(), block('id', function(responseObject) { var code = responseObject.intForKey("code"); if (code == 200) { var cityDic = responseObject.objectForKey("city"); if (cityDic != null) { NSLog("#####%@", cityDic); USERDEFAULTS.setObject_forKey(cityDic, "cityDic"); USERDEFAULTS.setObject_forKey(cityDic.stringForKey("id"), "district"); } var dataDic = responseObject.objectForKey("list"); var carouselArray = dataDic.arrayForKey("carousel_list"); var banner_listArray = dataDic.arrayForKey("banner_list"); var floor_list = dataDic.arrayForKey("floor_list"); carouselArray.enumerateObjectsUsingBlock(block("id, NSUInteger, BOOL", function(obj, idx, stop) { var dic = obj; slf.activetyArr().addObject(dic.stringForKey("url")); slf.imgMarr().addObject(dic.stringForKey("image")); })); slf.setScrollURL(carouselArray.mutableCopy()); imgRunView.setURLimgArray(slf.imgMarr()); banner_listArray.enumerateObjectsUsingBlock(block("id, NSUInteger, BOOL", function(obj, idx, stop) { var banModel = BannerModel.modelWithDictionary(obj); slf.banner2().addObject(banModel); })); floor_list.enumerateObjectsUsingBlock(block("id, NSUInteger, BOOL", function(obj, idx, stop) { var floorListModel = FloorListModel.modelWithDictionary(obj); NSLog("floorListModel = %@", floorListModel); slf.DataArray().addObject(floorListModel); })); NSLog("++self.DataArr = %@", slf.DataArray()); slf.myTableView().reloadData(); slf.reloadAnyData(); } else { var str = responseObject.objectForKey("msg"); slf.toast(str); } }), null); } }, {});