日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

JSPatch 使用Demo

發布時間:2023/12/29 javascript 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 JSPatch 使用Demo 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
defineClass("AllControlViewController", {
??????????? //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

??????????? logoutThroughServer: function() {
?????????? ?
??????????? 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);
?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? }));
?????????? ?
??????????? }
??????????? });

總結

以上是生活随笔為你收集整理的JSPatch 使用Demo的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。