JSPatch 使用Demo
来源:互联网 发布:三菱q系列编程手册 pdf 编辑:程序博客网 时间:2024/06/15 14:36
defineClass("AllControlViewController", {
//instance method definitions
///ROOT_URL_STR 问题 强制转换问题
///@selector 直接使用字符串
///block中使用self var sel = self;
///代码中包含_的变量 需要用__代替
///intValue() 需要用js的转换方式 parseInt
Unity.addLoadingView_andLoadingTitle(self.view(), "正在哈哈,请稍候...");
var manager = AFHTTPRequestOperationManager.manager();
var sel = self;
manager.POST_parameters_success_failure(NSString.stringWithFormat("%@/User/Logout", "http://xxxxxxxx"), {}, block('AFHTTPRequestOperation*,id', function(operation, responseObject) {
Unity.removeLoadingView(sel.view());
if (parseInt(responseObject.objectForKey("status")) == 0) {
{
//退出登录需要重新获取clientid
// [GeTuiSdk enterBackground];
//把登录状态置为0
NSUserDefaults.standardUserDefaults().setValue_forKey("0", NSString.stringWithFormat("%@%", "APP_LOGIN_SUCESS_SVAE_MSG", Unity.getCurrentVersion()));
NSUserDefaults.standardUserDefaults().setValue_forKey("0", "APP_LOGIN_USER_CURRENT_LOGIN_ID");
// [APP_USERDEFAULTS setValue:"0" forKey:[NSString stringWithFormat:"%@%", [AppDelegate getInstance].currentLoginID(), USER_SET_NOTIFY_ON_OFF]];
UIApplication.sharedApplication().cancelAllLocalNotifications();
NSNotificationCenter.defaultCenter().removeObserver_name_object(sel, "REFRESH_HOME_SCROLLVIEW", null);
NSNotificationCenter.defaultCenter().removeObserver(AppDelegate.getInstance().allControlViewController());
//判断如果蓝牙连接 取消连接
if (AppDelegate.getInstance().blueManager().bleModel().bleManager().isConnected()) {
var p = AppDelegate.getInstance().connectedPeripheral();
AppDelegate.getInstance().disconnectPeripheral(p);
}
//清空必要的数据
AppDelegate.getInstance().selectedUserIdArr().removeAllObjects();
var rootNav = AppDelegate.getInstance().window().rootViewController();
if (rootNav.viewControllers().firstObject().isEqual(sel)) {
var lvc = LoginViewController.alloc().init();
var rootNav = UINavigationController.alloc().initWithRootViewController(lvc);
AppDelegate.getInstance().window().setRootViewController(rootNav);
rootNav.setNavigationBarHidden(true);
return;
}
//退出到登录界面
sel.navigationController().popToRootViewControllerAnimated(YES);
}
} else if (parseInt(responseObject.objectForKey("status")) == 3) {
NSNotificationCenter.defaultCenter().addObserver_selector_name_object(sel, "logoutThroughServer", "RE_LOGIN_NOTIFY_NAME", null);
Unity.reLoginTheApp(sel);
} else {
Unity.showSystemAlertWithMessage_andViewController(responseObject.objectForKey("error_message"), null);
}
}), block('AFHTTPRequestOperation*,NSError*', function(operation, error) {
Unity.removeLoadingView(sel.view());
Unity.showTheErrorWhenNetworkConnetFailed(sel);
}));
}
});
//instance method definitions
///ROOT_URL_STR 问题 强制转换问题
///@selector 直接使用字符串
///block中使用self var sel = self;
///代码中包含_的变量 需要用__代替
///intValue() 需要用js的转换方式 parseInt
///变量比较 isEqual()
///获取成员变量 var data = self.valueForKey("_data")
/// 基础问题:https://github.com/bang590/JSPatch/wiki
Unity.addLoadingView_andLoadingTitle(self.view(), "正在哈哈,请稍候...");
var manager = AFHTTPRequestOperationManager.manager();
var sel = self;
manager.POST_parameters_success_failure(NSString.stringWithFormat("%@/User/Logout", "http://xxxxxxxx"), {}, block('AFHTTPRequestOperation*,id', function(operation, responseObject) {
Unity.removeLoadingView(sel.view());
if (parseInt(responseObject.objectForKey("status")) == 0) {
{
//退出登录需要重新获取clientid
// [GeTuiSdk enterBackground];
//把登录状态置为0
NSUserDefaults.standardUserDefaults().setValue_forKey("0", NSString.stringWithFormat("%@%", "APP_LOGIN_SUCESS_SVAE_MSG", Unity.getCurrentVersion()));
NSUserDefaults.standardUserDefaults().setValue_forKey("0", "APP_LOGIN_USER_CURRENT_LOGIN_ID");
// [APP_USERDEFAULTS setValue:"0" forKey:[NSString stringWithFormat:"%@%", [AppDelegate getInstance].currentLoginID(), USER_SET_NOTIFY_ON_OFF]];
UIApplication.sharedApplication().cancelAllLocalNotifications();
NSNotificationCenter.defaultCenter().removeObserver_name_object(sel, "REFRESH_HOME_SCROLLVIEW", null);
NSNotificationCenter.defaultCenter().removeObserver(AppDelegate.getInstance().allControlViewController());
//判断如果蓝牙连接 取消连接
if (AppDelegate.getInstance().blueManager().bleModel().bleManager().isConnected()) {
var p = AppDelegate.getInstance().connectedPeripheral();
AppDelegate.getInstance().disconnectPeripheral(p);
}
//清空必要的数据
AppDelegate.getInstance().selectedUserIdArr().removeAllObjects();
var rootNav = AppDelegate.getInstance().window().rootViewController();
if (rootNav.viewControllers().firstObject().isEqual(sel)) {
var lvc = LoginViewController.alloc().init();
var rootNav = UINavigationController.alloc().initWithRootViewController(lvc);
AppDelegate.getInstance().window().setRootViewController(rootNav);
rootNav.setNavigationBarHidden(true);
return;
}
//退出到登录界面
sel.navigationController().popToRootViewControllerAnimated(YES);
}
} else if (parseInt(responseObject.objectForKey("status")) == 3) {
NSNotificationCenter.defaultCenter().addObserver_selector_name_object(sel, "logoutThroughServer", "RE_LOGIN_NOTIFY_NAME", null);
Unity.reLoginTheApp(sel);
} else {
Unity.showSystemAlertWithMessage_andViewController(responseObject.objectForKey("error_message"), null);
}
}), block('AFHTTPRequestOperation*,NSError*', function(operation, error) {
Unity.removeLoadingView(sel.view());
Unity.showTheErrorWhenNetworkConnetFailed(sel);
}));
}
});
0 0
- JSPatch 使用Demo
- JSPatch使用
- JSPatch使用
- JSPatch Loader 使用文档
- JSPatch使用原理详解
- JSPatch-使用经验记录
- JSPatch的使用
- JSPatch的使用
- JSPatch使用小记
- JSPatch使用小记
- JSPatch的一些使用
- jsPatch使用总结
- iOS - JSPatch具体使用
- JSPatch
- JSPatch
- JSPatch
- JSPatch
- JSPatch
- Javascript学习笔记
- C++中的四种类型转换
- hibernate缓存机制-简述
- PorterDuff及Xfermode详解
- fileapi ajax上传图片显示
- JSPatch 使用Demo
- inSSIDer使用方法
- eclipse启动weblogic控制台显示乱码问题
- 第十一周上机实践——存储班长的信息学生类(补)
- vim vi模式下分割窗口快捷键
- 免费的天气接口
- 通达OA二次开发,多选部门和多选人员的源代码
- 文献管理软件-Mendeley
- MySQL与MongoDB的操作对比,以及区别