zoukankan      html  css  js  c++  java
  • ionic 确认提示操作框

     1 //确认框
     2   .factory('ActionSheet', function ($ionicActionSheet, TipsPort, Service,Loading) {
     3     var ActionSheet = function (urlAction, tipsTitle, params, status, successTips, failTips, successBack, errorBack) {
     4       return $ionicActionSheet.show({
     5         buttons: [
     6           {text: '<b>确定</b>'}
     7         ],
     8         //destructiveText: 'Delete',
     9         titleText: '<b>' + tipsTitle + '</b>',
    10         cancelText: '取消',
    11         cancel: function () {
    12         },
    13         //点击确定
    14         buttonClicked: function (index) {
    15           if (index == "0") {
    16             // console.log(params);//get还是post
    17             // params = ConvertString(params);
    18             Loading(1);
    19             Service.GetData(urlAction, params)
    20               .success(function (res) {
    21                 Loading();
    22                 if (res.status === status) {
    23                   TipsPort(successTips, successBack, res);
    24                 } else {
    25                   TipsPort(failTips, errorBack, res);
    26                 }
    27               }).error(function (err) {
    28               Loading();
    29               TipsPort(failTips);
    30             })
    31           }
    32           return true;
    33         }
    34       });
    35 
    36       return ActionSheet;
    37     }
    38   })
     /**
         * urlAction:请求后台的接口名
         * tipsTitle:提示操作的内容
         * params:提示的参数
         * status:返回数据的请求状态
         * successTips:请求成功的提示
         * failTips:请求失败的提示
         * successBack:请求成功后的操作
         * errorBack:请求失败后的操作
         * */

      应用:ActionSheet("","修改IP链接后会 有可能 导致 无法登录 ,是否进行修改?");      其他参数就不写了,自己看情况加上去

      结果:

      

      //---------------------------------以下内容为代码中附带的代码------------------------------------//

      附上请求数据的 GetData 方法 的代码(这个方法可换成你们自己的请求数据的方法,不唯一):

      

     1 .factory('Service', function ($http, SERVER,Select,$timeout) {
     2     var cbat = {
     3       list: []
     4     };
     5 
     6     cbat.PostData = function (url, params) {
     7       return $http.post(Select.url + url, params,{timeout: 10000})
     8         .success(function (response) {})
     9         .error(function () {});
    10     };
    11 
    12     cbat.GetData = function (url, params) {
    13       return $http({
    14         method: "get",
    15         params: params,
    16         url: Select.url + url,
    17         timeout: 100000
    18       }).success(function (data) {})
    19         .error(function (err) {});
    20     };
    21 
    22     return cbat;
    23   })

      附上 Loading 的方法:

      

     1 .factory('Loading', function ($ionicLoading) {
     2     var Loading = function (flag) {
     3       if (flag == 1) {
     4         $ionicLoading.show({
     5           template: "Loading"
     6         });
     7       } else {
     8         $ionicLoading.hide();
     9       }
    10 
    11     };
    12 
    13     return Loading;
    14   })

      TipsPort的代码:https://www.cnblogs.com/nelsonlei/p/10381988.html

  • 相关阅读:
    关于Xcode的Other Linker Flags
    ios开发――解决UICollectionView的cell间距与设置不符问题
    源码篇:MBProgressHUD
    ios中VRGCalendarView日历控件
    Xcode6与Xcode5中沙盒的变动以及偏好设置目录的变动
    开发者总结的WatchKit App提交技巧
    iOS开发周报-- 第一期
    selective gaussian blur /adaptive-blur
    hader特效——“Barrel Blur”的实现
    OpenCV——径向模糊
  • 原文地址:https://www.cnblogs.com/nelsonlei/p/10382016.html
Copyright © 2011-2022 走看看