baimeng 9 jaren geleden
bovenliggende
commit
5e43ecd93e
46 gewijzigde bestanden met toevoegingen van 1368 en 261 verwijderingen
  1. 1 0
      wl/config.xml
  2. BIN
      wl/platforms/android/.gradle/2.2.1/taskArtifacts/cache.properties.lock
  3. BIN
      wl/platforms/android/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin
  4. BIN
      wl/platforms/android/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin
  5. 2 2
      wl/platforms/android/assets/www/css/style.css
  6. 1 0
      wl/platforms/android/assets/www/index.html
  7. 1 0
      wl/platforms/android/assets/www/js/controllers/account.js
  8. 10 5
      wl/platforms/android/assets/www/js/controllers/car.js
  9. 11 12
      wl/platforms/android/assets/www/js/controllers/goods.js
  10. 81 109
      wl/platforms/android/assets/www/js/controllers/my.js
  11. 1 1
      wl/platforms/android/assets/www/templates/account/login.html
  12. 2 2
      wl/platforms/android/assets/www/templates/car/detail.html
  13. 5 2
      wl/platforms/android/assets/www/templates/car/index.html
  14. 2 2
      wl/platforms/android/assets/www/templates/goods/detail.html
  15. 5 4
      wl/platforms/android/assets/www/templates/goods/index.html
  16. 5 5
      wl/platforms/android/assets/www/templates/home/index.html
  17. 7 3
      wl/platforms/android/assets/www/templates/my/setting.html
  18. 3 0
      wl/platforms/android/res/xml/config.xml
  19. 3 0
      wl/plugins/android.json
  20. 197 0
      wl/plugins/cordova-plugin-actionsheet/README.md
  21. 68 0
      wl/plugins/cordova-plugin-actionsheet/demo/index.html
  22. 43 0
      wl/plugins/cordova-plugin-actionsheet/package.json
  23. 70 0
      wl/plugins/cordova-plugin-actionsheet/plugin.xml
  24. BIN
      wl/plugins/cordova-plugin-actionsheet/screenshots/android/android-delete.png
  25. BIN
      wl/plugins/cordova-plugin-actionsheet/screenshots/android/android-logout.png
  26. BIN
      wl/plugins/cordova-plugin-actionsheet/screenshots/android/android-share.png
  27. BIN
      wl/plugins/cordova-plugin-actionsheet/screenshots/ios/ios-delete.png
  28. BIN
      wl/plugins/cordova-plugin-actionsheet/screenshots/ios/ios-logout.png
  29. BIN
      wl/plugins/cordova-plugin-actionsheet/screenshots/ios/ios-share.png
  30. BIN
      wl/plugins/cordova-plugin-actionsheet/screenshots/wp8/wp8-delete.jpg
  31. BIN
      wl/plugins/cordova-plugin-actionsheet/screenshots/wp8/wp8-logout.jpg
  32. BIN
      wl/plugins/cordova-plugin-actionsheet/screenshots/wp8/wp8-share.jpg
  33. 177 0
      wl/plugins/cordova-plugin-actionsheet/src/android/ActionSheet.java
  34. 8 0
      wl/plugins/cordova-plugin-actionsheet/src/ios/ActionSheet.h
  35. 91 0
      wl/plugins/cordova-plugin-actionsheet/src/ios/ActionSheet.m
  36. 213 0
      wl/plugins/cordova-plugin-actionsheet/src/windows/ActionSheetProxy.js
  37. 192 0
      wl/plugins/cordova-plugin-actionsheet/src/wp8/ActionSheet.cs
  38. 30 0
      wl/plugins/cordova-plugin-actionsheet/www/ActionSheet.js
  39. 8 0
      wl/plugins/fetch.json
  40. 1 0
      wl/www/index.html
  41. 6 4
      wl/www/js/controllers/car.js
  42. 7 11
      wl/www/js/controllers/goods.js
  43. 64 98
      wl/www/js/controllers/my.js
  44. 47 0
      wl/www/js/services/nativeservices.js
  45. 3 0
      wl/www/templates/car/index.html
  46. 3 1
      wl/www/templates/goods/index.html

+ 1 - 0
wl/config.xml

xqd
@@ -64,4 +64,5 @@
   <plugin name="cordova-plugin-appversion" version="1.0.0" />
   <plugin name="cordova-plugin-file" version="4.2.0" />
   <plugin name="cordova-plugin-file-transfer" version="1.5.1" />
+  <plugin name="cordova-plugin-actionsheet" version="2.2.2" />
 </widget>

BIN
wl/platforms/android/.gradle/2.2.1/taskArtifacts/cache.properties.lock


BIN
wl/platforms/android/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin


BIN
wl/platforms/android/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin


+ 2 - 2
wl/platforms/android/assets/www/css/style.css

xqd
@@ -68,8 +68,8 @@
 .app-link-item { text-align: center; }
 .app-link-item i { background: no-repeat center / auto 50px; width: 60px; height: 50px; display: inline-block; position: relative }
 .app-link-item i img { height: 24px; }
-.app-link-item span { display: block; font-size:20px; line-height:1.4;color:#fff;font-weight:bold }
-.app-link-item .gray { display: block; font-size:20px; line-height:1.4;color:#333;font-weight:bold }
+.app-link-item span { display: block; font-size:15px; line-height:1.4;color:#fff;font-weight:bold }
+.app-link-item .gray { display: block; font-size:15px; line-height:1.4;color:#333;font-weight:bold }
 .app-link-item p { text-align: center; display: block; line-height: 20px; font-size: 14px; font-weight: bold }
 .app-link-item i.i-applink-add { background-image: url(../img/icon/i_applink_add.png); }
 .app-link-item i.i-applink-addcar { background-image: url(../img/icon/addcar.png); }

+ 1 - 0
wl/platforms/android/assets/www/index.html

xqd
@@ -41,5 +41,6 @@
 <script src="js/services/orderservice.js"></script>
 <script src="js/services/myservice.js"></script>
 <script src="js/services/mapservice.js"></script>
+<script src="js/services/nativeservices.js"></script>
 <!--filters-->
 <script src="js/filters/filter.js"></script>

+ 1 - 0
wl/platforms/android/assets/www/js/controllers/account.js

xqd
@@ -18,6 +18,7 @@
                     $state.go('wl.goods');
                 }
             }, function (erro) {
+                debugger;
                 msg.hide();
                 // msg.error(erro.data.message);
                 msg.error(erro.data.message);

+ 10 - 5
wl/platforms/android/assets/www/js/controllers/car.js

xqd xqd
@@ -9,15 +9,17 @@
             end_address: '',
             midway_address: ''
         }
+        if ($rootScope.location) {
+            var city = $rootScope.location.city;
+            if (city) {
+                $scope.filter.begin_address = city.slice(0, city.length - 1);
+            }
+        }
         $scope.items = [];
         $scope.load = function (init) {
             if (init) {
-             
                 $scope.filter.pageIndex = 1;
                 $scope.items = [];
-                if ($rootScope.location) {
-                    $scope.filter.begin_address = $rootScope.location.city;
-                }
             }
             carService.listCars($scope.filter).then(function (result) {
                 $scope.filter.pageIndex++;
@@ -141,13 +143,16 @@
             });
         }
     }]);
-    app.controller('carSuccessCtrl', ['$scope', '$state', '$ionicHistory', '$stateParams', function ($scope, $state, $ionicHistory, $stateParams) {
+    app.controller('carSuccessCtrl', ['$scope', '$state', '$ionicHistory', '$stateParams', 'msg', function ($scope, $state, $ionicHistory, $stateParams, msg) {
         $scope.vm = $stateParams.item;
         //下单成功
         $scope.back = function () {
             $ionicHistory.clearHistory();
             $state.go('wl.car');
         }
+        $scope.pay = function () {
+            msg.text('支付尚未开通,敬请期待');
+        }
     }]);
 })(angular.module('app.controllers'));
 

+ 11 - 12
wl/platforms/android/assets/www/js/controllers/goods.js

xqd xqd xqd
@@ -10,18 +10,19 @@
             end_address: '',
             midway_address:''
         }
+        if ($rootScope.location) {
+            var city = $rootScope.location.city;
+            if (city) {
+                $scope.filter.begin_address = city.slice(0, city.length - 1);
+            }
+        }
         $scope.items = [];
         $scope.load = function (init) {
             if (init) {
                 $scope.filter.pageIndex = 1;
                 $scope.items = [];
-                if ($rootScope.location) {
-                    $scope.filter.begin_address = $rootScope.location.city;
-                }
             }
-          
             goodsService.listGoods($scope.filter).then(function (result) {
-                 
                 $scope.filter.pageIndex++;
                 var more = (result.data.data.length >= $scope.filter.pageSize);
                 $scope.filter.hasMore = more;
@@ -48,12 +49,7 @@
         $scope.goCar = function () {
             $state.go('wl.car');
         }
-        $scope.load(true); 
-        $scope.getLocation = function () {
-          
-        }
-    
-       
+        $scope.load(true);
     }]);
     app.controller('goodsAddCtrl', ["$scope", "$state", "goodsService", "msg", function ($scope, $state, goodsService, msg) {
 
@@ -132,12 +128,15 @@
             });
         }
     }]);
-    app.controller('goodsSuccessCtrl', ['$scope', '$state', '$ionicHistory', '$stateParams', function ($scope, $state, $ionicHistory, $stateParams) {
+    app.controller('goodsSuccessCtrl', ['$scope', '$state', '$ionicHistory', '$stateParams', 'msg', function ($scope, $state, $ionicHistory, $stateParams, msg) {
         $scope.vm = $stateParams.item;
         //下单成功
         $scope.back = function () {
             $ionicHistory.clearHistory();
             $state.go('wl.goods');
         }
+        $scope.pay = function () {
+            msg.text('支付尚未开通,敬请期待');
+        }
     }]);
 })(angular.module('app.controllers'));

+ 81 - 109
wl/platforms/android/assets/www/js/controllers/my.js

xqd xqd xqd xqd xqd xqd xqd
@@ -3,6 +3,7 @@
         $scope.user = {};
         userService.getUser().then(function (result) {
             $scope.user = result.data.data;
+             
         }, function (erro) {
             msg.error(erro.data.message);
         });
@@ -10,7 +11,12 @@
             $state.go('wl.my_profile');
         }
     }]);
-    app.controller('mySettingCtrl', ['$scope', 'data', '$state', '$http','$ionicModal', function ($scope, data, $state, $http,$ionicModal) {
+    app.controller('mySettingCtrl', ['$scope', 'data', '$state', '$http','$ionicModal','myService', function ($scope, data, $state, $http,$ionicModal,myService) {
+        myService.setting().then(function (result) {
+            $scope.res = result.data;
+        }, function (erro) {
+            msg.error(erro);
+        });
         $scope.logout = function () {
             data.remove('user');
             data.remove('token');
@@ -46,10 +52,6 @@
             $scope.modal1.remove();
             $scope.modal2.remove();
         });
-        $scope.appversion = '1.0.0';
-        if (!!window.AppVersion) {
-            $scope.appversion = AppVersion.version;
-        }
     }]);
     app.controller('mySetPasswordCtrl', ['$scope', '$state', function ($scope,$state) {
         $scope.vm = {
@@ -63,98 +65,47 @@
         }
     }]);
     
-    app.controller('myProfileCtrl', ['$scope','$ionicActionSheet','$ionicPopup','$timeout','userService', 'msg', 'util','data', function ($scope,$ionicActionSheet,$ionicPopup,$timeout, userService, msg, util,data) {
+    app.controller('myProfileCtrl', ['$scope', '$ionicActionSheet', '$ionicPopup', '$timeout', 'userService', 'msg', 'util', 'data', 'camera', function ($scope, $ionicActionSheet, $ionicPopup, $timeout, userService, msg, util, data, camera) {
         $scope.user = data.getObject('user');
         $scope.genderOpt = [
               { name: "男", value: 1 },
               { name: "女", value: 0 }
         ];
-        userService.getApplyProfile().then(function (result) {
-            $scope.vm = result;
-        }, function (erro) {
-            msg.error(erro);
-        });
+     
         $scope.setAvator = function () {
-            var sheet = $ionicActionSheet.show({
-                buttons: [{ text: '<b>拍照</b> 上传' }, { text: '从 <b>相册</b> 中选' }],
-                titleText: '图片上传',
-                cancelText: '取 消',
-                cancel: function() { return true; },
-                buttonClicked: function(index) {
-                    var options = { quality: 50, targetHeight: 112, targetWidth: 112, allowEdit: true};
-                    if (index == 0) options.sourceType = 1;
-                    else options.sourceType = 2;
-                    navigator.camera.getPicture(function(imageUri) {
-                        if (imageUri == undefined) {
-                            var alertPopup = $ionicPopup.alert({
-                               title: '提示',
-                               template: '图片未找到!'
-                             });
-                             alertPopup.then(function(res) {
-                               console.log('1111');
-                             });
-                        }else {
-                            $timeout(function() {
-                                $scope.user.avatar = imageUri;
-                            });
-                            var uploadOptions = new FileUploadOptions();
-                            uploadOptions.fileKey = "photo";
-                            uploadOptions.fileName = "avatar.jpg";
-                            uploadOptions.mimeType = "image/jpeg";
-                            uploadOptions.httpMethod = 'post';
-                            uploadOptions.chunkedMode = true;
-                            var token='Bearer ' + localStorage['token'];
-                            uploadOptions.headers = { "Authorization": token };
-                            console.log("setAvator uploadOptions:"+JSON.stringify(uploadOptions));
-                            var ft = new FileTransfer();
-                            ft.upload(imageUri, encodeURI(config.server+"api/user"), function(sucess) {
-                                console.log("setAvator sucess:"+JSON.stringify(sucess));
-                                // alert(JSON.stringify(sucess));
-                            }, function (fail) {
-                                console.log("setAvator fail:"+JSON.stringify(fail));
-                                // alert(JSON.stringify(fail));
-                            }, uploadOptions); 
-
-                        }
-                    }, function(err) { 
-                        var alertPopup = $ionicPopup.alert({
-                           title: '提示',
-                           template: err
-                         });
-                         alertPopup.then(function(res) {
-                           console.log('1111');
-                         });
-                    }, options);
-
-                    return true;
-                }
+            camera.chooseImage().then(function (imageUri) {
+                $timeout(function () {
+                    $scope.user.avatar = imageUri;
+                });
+                var uploadOptions = new FileUploadOptions();
+                uploadOptions.fileKey = "photo";
+                uploadOptions.fileName = "avatar.jpg";
+                uploadOptions.mimeType = "image/jpeg";
+                uploadOptions.httpMethod = 'post';
+                uploadOptions.chunkedMode = true;
+                var token = 'Bearer ' + localStorage['token'];
+                uploadOptions.headers = { "Authorization": token };
+                var ft = new FileTransfer();
+                ft.upload(imageUri, encodeURI(config.server + "api/user"), function (sucess) {
+                     //alert('上传成功'+JSON.stringify(sucess));
+                }, function (fail) {
+                      //alert('上传失败'+JSON.stringify(fail));
+                }, uploadOptions);
+            }, function (erro) {
+                msg.error(erro);
             });
-         
-            //https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-camera/
-            // navigator.camera.getPicture(function (imageUri) {
-            //     $scope.user.avatar = imageUri;
-
-            //     var uploadOptions = new FileUploadOptions();
-            //     uploadOptions.fileKey = "avatar";
-            //     uploadOptions.fileName = "avatar.jpg";
-            //     uploadOptions.mimeType = "image/jpeg";
-            //     uploadOptions.httpMethod = 'post';
-            //     var token='Bearer ' + localStorage['token'];
-            //     alert(token);
-            //     uploadOptions.headers = { "Authorization": token };
-            //     var ft = new FileTransfer();
-            //     ft.upload(imageUri, encodeURI("http://120.25.204.211/api/user"), function(sucess) {
-            //         alert(JSON.stringify(sucess));
-            //     }, function (fail) {
-            //         alert(JSON.stringify(fail));
-            //     }, options); 
              
-            // }, function (erro) {
-            //     alert(erro);
-            // }, options);
         }
         $scope.save = function () {
             data.updateObject('user', $scope.user);
+            msg.loading('保存中...');
+            userService.update($scope.user).then(function () {
+                msg.hide();
+                msg.success('保存成功');
+            }, function (erro) {
+                msg.hide();
+                msg.error(erro.data.message);
+            });
         }
     }]);
     
@@ -209,34 +160,34 @@
         }
         $scope.load(true);
     }]);
-    app.controller('myTruckAddCtrl', ['$scope', 'myService', 'msg', '$state', '$stateParams', function ($scope, myService, msg, $state, $stateParams) {
+    app.controller('myTruckAddCtrl', ['$scope', 'myService', 'msg', '$state', '$stateParams', 'camera', 'config', function ($scope, myService, msg, $state, $stateParams, camera, config) {
         $scope.vm = {};
         if ($stateParams.item) {
             $scope.vm = $stateParams.item;
         }
         $scope.typeOpt = [
-            { name: '厢式货车', value: '厢式货车' },
-            { name: '面包车', value: '面包车' },
-            { name: '金杯车', value: '金杯车' },
-        { name: '中巴货车', value: '中巴货车' },
-        { name: '高栏车', value: '高栏车' },
-        { name: '低栏车', value: '低栏车' },
-        { name: '平板车', value: '平板车' },
-        { name: '高低板车', value: '高低板车' },
-        { name: '半挂车', value: '半挂车' },
-        { name: '自卸车', value: '自卸车' },
-        { name: '冷藏车', value: '冷藏车' },
-        { name: '保温车', value: '保温车' },
-        { name: '罐式车', value: '罐式车' },
-        { name: '铁笼车', value: '铁笼车' },
-        { name: '集装箱运输车', value: '集装箱运输车' },
-        { name: '大件运输车', value: '大件运输车' },
-        { name: '危险品车', value: '危险品车' },
-        { name: '全挂车', value: '全挂车' },
-        { name: '加长挂车', value: '加长挂车' },
-        { name: '其他', value: '其他' }];
+            { name: '厢式货车', value: '1' },
+            { name: '面包车', value: '2' },
+            { name: '金杯车', value: '3' },
+        { name: '中巴货车', value: '4' },
+        { name: '高栏车', value: '5' },
+        { name: '低栏车', value: '6' },
+        { name: '平板车', value: '7' },
+        { name: '高低板车', value: '8' },
+        { name: '半挂车', value: '9' },
+        { name: '自卸车', value: '10' },
+        { name: '冷藏车', value: '11' },
+        { name: '保温车', value: '12' },
+        { name: '罐式车', value: '13' },
+        { name: '铁笼车', value: '14' },
+        { name: '集装箱运输车', value: '15' },
+        { name: '大件运输车', value: '16' },
+        { name: '危险品车', value: '17' },
+        { name: '全挂车', value: '18' },
+        { name: '加长挂车', value: '19' },
+        { name: '其他', value: '20' }];
         $scope.save = function () {
-            msg.loading('保存中...')
+            msg.loading('保存中...');
             myService.addTruck($scope.vm).then(function (result) {
                 msg.hide();
                 $state.go('wl.my_truck');
@@ -247,6 +198,27 @@
         }
         //上传图片
         $scope.setPhoto = function () {
+            camera.chooseImage().then(function (imageUri) {
+                $timeout(function () {
+                    $scope.vm.photo = imageUri;
+                });
+                var uploadOptions = new FileUploadOptions();
+                uploadOptions.fileKey = "photo";
+                uploadOptions.fileName = "photo.jpg";
+                uploadOptions.mimeType = "image/jpeg";
+                uploadOptions.httpMethod = 'post';
+                uploadOptions.chunkedMode = true;
+                var token = 'Bearer ' + localStorage['token'];
+                uploadOptions.headers = { "Authorization": token };
+                var ft = new FileTransfer();
+                ft.upload(imageUri, encodeURI(config.server + "api/trucks"), function (sucess) {
+                    //alert('上传成功'+JSON.stringify(sucess));
+                }, function (fail) {
+                    //alert('上传失败'+JSON.stringify(fail));
+                }, uploadOptions);
+            }, function (erro) {
+                msg.error(erro);
+            });
 
         }
      
@@ -308,7 +280,7 @@
                 var more = (result.data.data.length >= $scope.filter.pageSize);
                 $scope.filter.hasMore = more;
                 $scope.items = $scope.items.concat(result.data.data);
-                debugger;
+              
                 if (init) {
                     $scope.$broadcast('scroll.refreshComplete');
                 } else {

+ 1 - 1
wl/platforms/android/assets/www/templates/account/login.html

xqd
@@ -6,7 +6,7 @@
         </div>
         <form>
             <div class="list loginform">
-                <label class="item item-input">
+                <label class="item item-input" style="border-width:0">
                     <i class="icon ion-android-phone-portrait placeholder-icon"  ></i>
                     <input type="text" ng-model="vm.mobile" placeholder="手机号码">
                 </label>

+ 2 - 2
wl/platforms/android/assets/www/templates/car/detail.html

xqd
@@ -3,8 +3,8 @@
         <div class="list">
             <img ng-src="{{vm.picUrl}}" style="width:100%;" />
             <div class="list card">
-                <div class="item item-avatar">
-                    <img ng-src="{{user.data.avatar | avator}}"/>
+                <div class="item item-avatar" style="border-width:0">
+                    <img ng-src="{{user.data.avatar | avator}}" />
                     <h2 style="white-space:normal">【{{vm.begin_address | shortAddress}}】-【{{vm.end_address | shortAddress}}】的车源信息</h2>
                     <p>价格:<b style="color:red">¥{{vm.price}}</b></p>
                 </div>

+ 5 - 2
wl/platforms/android/assets/www/templates/car/index.html

xqd xqd xqd
@@ -35,7 +35,7 @@
                         </a>
                     </div>
                 </div>
-                <div class="app-link-bottom"></div>
+           
                 <div class="list">
                     <a class="item item-thumbnail-left"  ng-repeat="item in items" ng-click="detail(item)">
                         <img src="img/demo/defaultcar.png" />
@@ -43,6 +43,9 @@
                         <p><span style="float:left"><b style="color:orangered">¥{{item.price}}</b><em style="padding-left:3px;font-size:0.75em">起</em></span></p>
                         <p><span style="float:left">联系人:{{item.contact_name}}</span> <span style="float:right">电话:{{item.contact_phone}}</span></p> 
                     </a>
+                    <a class="item item-thumbnail-left"  ng-if="items.length==0">
+                        <p style="margin-top:25px;margin-left:12%">没有找到车源信息</p>
+                    </a>
                 </div>
 
                 <!--上拉更多-->
@@ -50,7 +53,7 @@
 
             </ion-content>   
         </ion-side-menu-content>
-        <ion-side-menu side="right">
+        <ion-side-menu  width="220" side="right">
             <ion-content>
                 <div class="list">
                     <div class="padding">

+ 2 - 2
wl/platforms/android/assets/www/templates/goods/detail.html

xqd
@@ -2,8 +2,8 @@
     <ion-content>
         <div class="list">
             <img  ng-src="{{vm.picUrl}}" style="width:100%;"/>
-            <div class="list card">
-                <div class="item item-avatar">
+            <div class="list" >
+                <div class="item item-avatar" style="border-width:0">
                     <img ng-src="{{user.data.avatar | avator}}" />
                     <h2 style="white-space:normal">【{{vm.begin_address | shortAddress}}】-【{{vm.end_address | shortAddress}}】的货源信息</h2>
                     <p>价格:<b style="color:red">¥{{vm.price}}</b></p>

+ 5 - 4
wl/platforms/android/assets/www/templates/goods/index.html

xqd xqd xqd
@@ -33,8 +33,7 @@
                             </div>
                         </a>
                     </div>
-                </div>
-                <div class="app-link-bottom"></div>
+                </div>          
                 <div class="list">
                     <a class="item" ng-repeat="item in items" ng-click="detail(item)">
                         <h2>【{{item.begin_address | shortAddress}}】-【{{item.end_address | shortAddress}}】</h2>
@@ -44,7 +43,9 @@
                         </p>
                         <p><span style="float:left">联系人:{{item.contact_name}}</span> <span style="float:right">电话:{{item.contact_phone}}</span></p> 
                     </a>
-
+                    <a class="item item-thumbnail-left" ng-if="items.length==0">
+                        <p style="margin-top:25px;margin-left:12%">没有找到货源信息</p>
+                    </a>
                 </div>
 
                 <!--上拉更多-->
@@ -52,7 +53,7 @@
 
             </ion-content>   
         </ion-side-menu-content>
-        <ion-side-menu side="right">
+        <ion-side-menu width="220" side="right">
             <ion-content>
                 <div class="list">
                     <div class="padding">

+ 5 - 5
wl/platforms/android/assets/www/templates/home/index.html

xqd xqd xqd
@@ -2,13 +2,13 @@
     <ion-content class="app-content-gray-bg">
         <ion-slide-box class="swiper-index-slide"  >
             <ion-slide  >
-                <img class="slider-img"  src="img/demo/banner.png" />
+                <img class="slider-img"  src="http://wl.youawan.com/banner1.png" />
             </ion-slide>
             <ion-slide>
-                <img class="slider-img" src="img/demo/banner1.png" />
+                <img class="slider-img" src="http://wl.youawan.com/banner2.png" />
             </ion-slide>
             <ion-slide>
-                <img class="slider-img" src="img/demo/banner2.png" />
+                <img class="slider-img" src="http://wl.youawan.com/banner3.png" />
             </ion-slide>
         </ion-slide-box>
         <div class="app-link-bottom"></div>
@@ -57,7 +57,7 @@
                 <h2>【{{item.begin_address | shortAddress}}】-【{{item.end_address | shortAddress}}】</h2>
                 <p><span style="float:left"><b style="color:orangered">¥{{item.price}}</b><em style="padding-left:3px;font-size:0.75em">起</em></span>
                  <span style="float:right">途经:{{item.midway_address | shortAddress}}</span></p>
-                <p><span style="float:left">联系人:{{item.contact_name}}</span> <span style="float:right">电话:{{item.contact_phone}}</span></p> 
+                <p><span style="float:left">联系人:{{item.contact_name}}</span> </p> 
             </a>
         </div>
         <div class="list" ng-if="vm.showIndex==2">
@@ -65,7 +65,7 @@
                 <img ng-src="{{item.truck.data.photo | truckPhoto}}" />
                 <h2 style="white-space:normal">【{{item.begin_address | shortAddress}}】-【{{item.end_address | shortAddress}}】<span style="color:gray;">({{item.title}})</span></h2>
                 <p><span style="float:left"><b style="color:orangered">¥{{item.price}}</b><em style="padding-left:3px;font-size:0.75em">起</em></span></p>
-                <p><span style="float:left">联系人:{{item.contact_name}}</span> <span style="float:right">电话:{{item.contact_phone}}</span></p>
+                <p><span style="float:left">联系人:{{item.contact_name}}</span>  </p>
             </a>
          
         </div>

+ 7 - 3
wl/platforms/android/assets/www/templates/my/setting.html

xqd xqd xqd
@@ -7,7 +7,7 @@
             
             <div class="user-info">
                 <div><span style="color: #444;">掌上物流网</span></div>
-                <div><span style="color: #444;">版本V{{appversion}}</span></div>
+                <div><span style="color: #444;">版本V{{res.appversion}}</span></div>
             </div>
         </div>
         <div class="list">
@@ -38,7 +38,9 @@
       <button class="button button-primary" ng-click="modal1.hide()">关闭</button>
     </ion-header-bar>
     <ion-content>
-      法律条文法律条文法律条文法律条文法律条文!
+      <div style="padding: 20px">
+        {{res.low}}
+      </div>
     </ion-content>
   </ion-modal-view>
 </script>
@@ -51,7 +53,9 @@
       <button class="button button-primary" ng-click="modal2.hide()">关闭</button>
     </ion-header-bar>
     <ion-content>
-      公司介绍公司介绍公司介绍公司介绍公司介绍公司介绍!
+      <div style="padding: 20px">
+        {{res.compay}}
+      </div>
     </ion-content>
   </ion-modal-view>
 </script>

+ 3 - 0
wl/platforms/android/res/xml/config.xml

xqd
@@ -29,6 +29,9 @@
         <param name="android-package" value="io.ionic.keyboard.IonicKeyboard" />
         <param name="onload" value="true" />
     </feature>
+    <feature name="ActionSheet">
+        <param name="android-package" value="nl.xservices.plugins.actionsheet.ActionSheet" />
+    </feature>
     <icon density="ldpi" src="resources/android/icon/icon.png" />
     <icon density="mdpi" src="resources/android/icon/icon.png" />
     <icon density="hdpi" src="resources/android/icon/icon.png" />

+ 3 - 0
wl/plugins/android.json

xqd
@@ -33,6 +33,9 @@
         },
         "ionic-plugin-keyboard": {
             "PACKAGE_NAME": "com.uhisport.football"
+        },
+        "cordova-plugin-actionsheet": {
+            "PACKAGE_NAME": "com.uhisport.football"
         }
     },
     "dependent_plugins": {

+ 197 - 0
wl/plugins/cordova-plugin-actionsheet/README.md

xqd
@@ -0,0 +1,197 @@
+# ActionSheet Cordova / PhoneGap Plugin
+by [Eddy Verbruggen](http://twitter.com/eddyverbruggen)
+
+## 0. Index
+
+1. [Description](#1-description)
+2. [Screenshots](#2-screenshots)
+3. [Installation](#3-installation)
+	3. [Automatically (CLI / Plugman)](#automatically-cli--plugman)
+	3. [Manually](#manually)
+4. [Usage](#4-usage)
+5. [Credits](#5-credits)
+6. [License](#6-license)
+
+## 1. Description
+
+Show a sheet of options the user can choose from.
+
+* Compatible with [Cordova Plugman](https://github.com/apache/cordova-plugman).
+* iOS uses the native `UIActionSheet`.
+* Android uses the native `AlertDialog`.
+* WP8 uses the native `Popup`.
+
+## 2. Screenshots
+
+iOS
+
+<img src="screenshots/ios/ios-share.png" width="235"/>&nbsp;
+<img src="screenshots/ios/ios-delete.png" width="235"/>&nbsp;
+<img src="screenshots/ios/ios-logout.png" width="235"/>
+
+
+Android
+
+<img src="screenshots/android/android-share.png" width="235"/>&nbsp;
+<img src="screenshots/android/android-delete.png" width="235"/>&nbsp;
+<img src="screenshots/android/android-logout.png" width="235"/>
+
+Windows Phone 8
+
+<img src="screenshots/wp8/wp8-share.jpg" width="235"/>&nbsp;
+<img src="screenshots/wp8/wp8-delete.jpg" width="235"/>&nbsp;
+<img src="screenshots/wp8/wp8-logout.jpg" width="235"/>
+
+## 3. Installation
+
+### Automatically (CLI / Plugman)
+```
+$ cordova plugin add cordova-plugin-actionsheet
+$ cordova prepare
+```
+
+ActionSheet.js is brought in automatically. There is no need to change or add anything in your html.
+
+### Manually
+
+1\. Add the following xml to your `config.xml` files:
+
+iOS
+```xml
+<feature name="ActionSheet">
+  <param name="ios-package" value="ActionSheet" />
+</feature>
+```
+
+Android
+```xml
+<feature name="ActionSheet">
+  <param name="android-package" value="nl.xservices.plugins.actionsheet.ActionSheet"/>
+</feature>
+```
+
+WP8
+```xml
+<feature name="ActionSheet">
+  <param name="wp-package" value="ActionSheet"/>
+</feature>
+```
+
+2\. Grab a copy of ActionSheet.js, add it to your project and reference it in `index.html`:
+```html
+<script type="text/javascript" src="js/ActionSheet.js"></script>
+```
+
+3\. Download the source files and copy them to your project.
+
+iOS: Copy the `.h` and `.m` files to `platforms/ios/<ProjectName>/Plugins`
+
+Android: Copy `ActionSheet.java` to `platforms/android/src/nl/xservices/plugins/actionsheet/` (create the folders)
+
+WP8: Copy `ActionSheet.cs` to `platforms/wp8/Plugins/nl.x-services.plugins.actionsheet` (create the folders)
+
+### PhoneGap Build
+ActionSheet  works with PhoneGap build too! Just add the following xml to your `config.xml` to always use the latest version of this plugin:
+```xml
+<gap:plugin name="cordova-plugin-actionsheet" source="npm" />
+```
+
+ActionSheet.js is brought in automatically. Make sure though you include a reference to cordova.js in your index.html's head:
+```html
+<script type="text/javascript" src="cordova.js"></script>
+```
+
+## 4. Usage
+
+### show
+
+Check the [demo code](demo) to get you going quickly,
+or copy-paste some of the code below to replicate the ActionSheets of the screenshots above.
+
+```js
+  var callback = function(buttonIndex) {
+    setTimeout(function() {
+      // like other Cordova plugins (prompt, confirm) the buttonIndex is 1-based (first button is index 1)
+      alert('button index clicked: ' + buttonIndex);
+    });
+  };
+
+  function testShareSheet() {
+    var options = {
+        'androidTheme': window.plugins.actionsheet.ANDROID_THEMES.THEME_HOLO_LIGHT, // default is THEME_TRADITIONAL
+        'title': 'What do you want with this image?',
+        'buttonLabels': ['Share via Facebook', 'Share via Twitter'],
+        'androidEnableCancelButton' : true, // default false
+        'winphoneEnableCancelButton' : true, // default false
+        'addCancelButtonWithLabel': 'Cancel',
+        'addDestructiveButtonWithLabel' : 'Delete it',
+        'position': [20, 40] // for iPad pass in the [x, y] position of the popover
+    };
+    // Depending on the buttonIndex, you can now call shareViaFacebook or shareViaTwitter
+    // of the SocialSharing plugin (https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin)
+    window.plugins.actionsheet.show(options, callback);
+  };
+
+  function testDeleteSheet() {
+    var options = {
+        'addCancelButtonWithLabel': 'Cancel',
+        'addDestructiveButtonWithLabel' : 'Delete note'
+    };
+    window.plugins.actionsheet.show(options, callback);
+  };
+
+  function testLogoutSheet() {
+    var options = {
+        'buttonLabels': ['Log out'],
+        'androidEnableCancelButton' : true, // default false
+        'winphoneEnableCancelButton' : true, // default false
+        'addCancelButtonWithLabel': 'Cancel'
+    };
+    window.plugins.actionsheet.show(options, callback);
+  };
+```
+
+On iOS, you can also position the actionSheet origin by adding `position: [100, 200]`
+
+### hide
+
+If for some reason you want to hide the actionsheet programmatically, do this:
+```js
+  // options and callbacks are optional, so either approach will work:
+  window.plugins.actionsheet.hide();
+  window.plugins.actionsheet.hide({}, onSuccess, onError);
+```
+
+## 5. Credits
+iOS and WP8 code: [Eddy Verbruggen](https://github.com/EddyVerbruggen)
+
+Android code: mostly [Brill Papping](https://github.com/bpappin)
+
+
+## 6. Change history
+* 2.2.2 OK, 2.2.1 has issues with Russian and the like, so reverted. Pass in `Español` as `Espa\u00f1ol` please.
+* 2.2.1 Encoding of diacritical characters fixed on iOS, so you can now use `Español` as a title or button label.
+* 1.1.6 You can now set the iOS actionSheet origin position (uses the iOS `actionSheet.showFromRect` method)
+* 1.1.2 You can now select a theme for your Android popup, see the first example above
+
+## 7. License
+
+[The MIT License (MIT)](http://www.opensource.org/licenses/mit-license.html)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.

+ 68 - 0
wl/plugins/cordova-plugin-actionsheet/demo/index.html

xqd
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta charset="utf-8" />
+  <meta name="format-detection" content="telephone=no" />
+  <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
+  <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height" />
+  <link rel="stylesheet" type="text/css" href="css/index.css" />
+  <meta name="msapplication-tap-highlight" content="no" />
+  <title>Hello ActionSheet</title>
+</head>
+<body>
+<div class="app">
+  <h1>ActionSheet demo</h1>
+  <div id="deviceready" class="blink">
+    <p class="event listening">Connecting to Device</p>
+    <p class="event received">Device is Ready</p>
+    <button onclick="testShareSheet()">Test Share</button><br/><br/>
+    <button onclick="testDeleteSheet()">Test Delete</button><br/><br/>
+    <button onclick="testLogoutSheet()">Test Logout</button>
+  </div>
+</div>
+<script type="text/javascript" src="cordova.js"></script>
+<script type="text/javascript" src="js/index.js"></script>
+<script type="text/javascript">
+
+  app.initialize();
+
+  var callback = function(buttonIndex) {
+    setTimeout(function() {
+      alert('button index clicked: ' + buttonIndex);
+    });
+  };
+
+  function testShareSheet() {
+    var options = {
+      'androidTheme' : window.plugins.actionsheet.ANDROID_THEMES.THEME_HOLO_LIGHT,
+      'title': 'What do you want with this image?',
+      'buttonLabels': ['Share via Facebook', 'Share via Twitter'],
+      'addCancelButtonWithLabel': 'Cancel',
+      'androidEnableCancelButton' : true,
+      'winphoneEnableCancelButton' : true,
+      'addDestructiveButtonWithLabel' : 'Delete it'
+    };
+    window.plugins.actionsheet.show(options, callback);
+  }
+
+  function testDeleteSheet() {
+    var options = {
+      'addCancelButtonWithLabel': 'Cancel',
+      'addDestructiveButtonWithLabel' : 'Delete note'
+    };
+    window.plugins.actionsheet.show(options, callback);
+  }
+
+  function testLogoutSheet() {
+    var options = {
+      'buttonLabels': ['Log out'],
+      'androidEnableCancelButton' : true,
+      'winphoneEnableCancelButton' : true,
+      'addCancelButtonWithLabel': 'Cancel'
+    };
+    window.plugins.actionsheet.show(options, callback);
+  }
+
+</script>
+</body>
+</html>

+ 43 - 0
wl/plugins/cordova-plugin-actionsheet/package.json

xqd
@@ -0,0 +1,43 @@
+{
+  "name": "cordova-plugin-actionsheet",
+  "version": "2.2.2",
+  "description": "Show a sheet of options the user can choose from.",
+  "cordova": {
+    "id": "cordova-plugin-actionsheet",
+    "platforms": [
+      "ios",
+      "android",
+      "wp8"
+    ]
+  },
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/EddyVerbruggen/cordova-plugin-actionsheet.git"
+  },
+  "keywords": [
+    "ActionSheet",
+    "UIActionSheet",
+    "AlertDialog",
+    "Dialog",
+    "List",
+    "Picker",
+    "Popup",
+    "cordova",
+    "ecosystem:cordova",
+    "cordova-ios",
+    "cordova-android",
+    "cordova-wp8"
+  ],
+  "engines": [
+    {
+      "name": "cordova",
+      "version": ">=3.0.0"
+    }
+  ],
+  "author": "Eddy Verbruggen - @EddyVerbruggen",
+  "license": "MIT",
+  "bugs": {
+    "url": "https://github.com/EddyVerbruggen/cordova-plugin-actionsheet/issues"
+  },
+  "homepage": "https://github.com/EddyVerbruggen/cordova-plugin-actionsheet#readme"
+}

+ 70 - 0
wl/plugins/cordova-plugin-actionsheet/plugin.xml

xqd
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin
+    xmlns="http://apache.org/cordova/ns/plugins/1.0"
+		id="cordova-plugin-actionsheet"
+    version="2.2.2">
+
+  <name>ActionSheet</name>
+
+  <description>Show a sheet of options the user can choose from.</description>
+
+  <author>Eddy Verbruggen</author>
+
+  <license>MIT</license>
+
+  <keywords>ActionSheet, UIActionSheet, AlertDialog, Dialog, List, Picker, Popup</keywords>
+
+  <repo>https://github.com/EddyVerbruggen/cordova-plugin-actionsheet.git</repo>
+
+  <issue>https://github.com/EddyVerbruggen/cordova-plugin-actionsheet/issues</issue>
+
+  <engines>
+    <engine name="cordova" version=">=3.0.0"/>
+  </engines>
+
+  <js-module src="www/ActionSheet.js" name="ActionSheet">
+    <clobbers target="window.plugins.actionsheet"/>
+  </js-module>
+
+
+
+  <!-- ios -->
+  <platform name="ios">
+    <config-file target="config.xml" parent="/*">
+      <feature name="ActionSheet">
+        <param name="ios-package" value="ActionSheet"/>
+      </feature>
+    </config-file>
+    <header-file src="src/ios/ActionSheet.h"/>
+    <source-file src="src/ios/ActionSheet.m"/>
+  </platform>
+
+  <!-- android -->
+  <platform name="android">
+    <config-file target="res/xml/config.xml" parent="/*">
+      <feature name="ActionSheet">
+        <param name="android-package" value="nl.xservices.plugins.actionsheet.ActionSheet"/>
+      </feature>
+    </config-file>
+    <source-file src="src/android/ActionSheet.java" target-dir="src/nl/xservices/plugins/actionsheet"/>
+  </platform>
+
+  <!-- wp8 -->
+  <platform name="wp8">
+    <config-file target="config.xml" parent="/*">
+      <feature name="ActionSheet">
+        <param name="wp-package" value="ActionSheet"/>
+      </feature>
+    </config-file>
+    <source-file src="src/wp8/ActionSheet.cs" />
+  </platform>
+
+  <!--windows-->
+  
+  <platform name="windows">
+    <js-module src="src/windows/ActionSheetProxy.js" name="ActionSheetProxy">
+      <merges target="" />
+    </js-module>
+  </platform>
+
+</plugin>

BIN
wl/plugins/cordova-plugin-actionsheet/screenshots/android/android-delete.png


BIN
wl/plugins/cordova-plugin-actionsheet/screenshots/android/android-logout.png


BIN
wl/plugins/cordova-plugin-actionsheet/screenshots/android/android-share.png


BIN
wl/plugins/cordova-plugin-actionsheet/screenshots/ios/ios-delete.png


BIN
wl/plugins/cordova-plugin-actionsheet/screenshots/ios/ios-logout.png


BIN
wl/plugins/cordova-plugin-actionsheet/screenshots/ios/ios-share.png


BIN
wl/plugins/cordova-plugin-actionsheet/screenshots/wp8/wp8-delete.jpg


BIN
wl/plugins/cordova-plugin-actionsheet/screenshots/wp8/wp8-logout.jpg


BIN
wl/plugins/cordova-plugin-actionsheet/screenshots/wp8/wp8-share.jpg


+ 177 - 0
wl/plugins/cordova-plugin-actionsheet/src/android/ActionSheet.java

xqd
@@ -0,0 +1,177 @@
+package nl.xservices.plugins.actionsheet;
+
+import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnClickListener;
+import android.os.Build;
+import android.text.TextUtils;
+import org.apache.cordova.CallbackContext;
+import org.apache.cordova.CordovaInterface;
+import org.apache.cordova.CordovaPlugin;
+import org.apache.cordova.PluginResult;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Original excellent PR by: Brill Pappin
+ * @author Mantainer of the code: Eddy Verbruggen
+ */
+public class ActionSheet extends CordovaPlugin {
+
+  private AlertDialog dialog;
+
+  public ActionSheet() {
+    super();
+  }
+
+  public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
+
+    if ("show".equals(action)) {
+      JSONObject options = args.optJSONObject(0);
+
+      String title = options.optString("title");
+      int theme = options.optInt("androidTheme", 1);
+      JSONArray buttons = options.optJSONArray("buttonLabels");
+
+      boolean androidEnableCancelButton = options.optBoolean("androidEnableCancelButton", false);
+
+      String addCancelButtonWithLabel = options.optString("addCancelButtonWithLabel");
+      String addDestructiveButtonWithLabel = options.optString("addDestructiveButtonWithLabel");
+
+      this.show(title, buttons, addCancelButtonWithLabel,
+          androidEnableCancelButton, addDestructiveButtonWithLabel,
+          theme,
+          callbackContext);
+      // need to return as this call is async.
+      return true;
+    } else if ("hide".equals(action)) {
+      if (dialog != null && dialog.isShowing()) {
+        dialog.dismiss();
+        callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, -1));
+      }
+      return true;
+    }
+    return false;
+  }
+
+  public synchronized void show(final String title,
+                                final JSONArray buttonLabels,
+                                final String addCancelButtonWithLabel,
+                                final boolean androidEnableCancelButton,
+                                final String addDestructiveButtonWithLabel,
+                                final int theme,
+                                final CallbackContext callbackContext) {
+
+    final CordovaInterface cordova = this.cordova;
+
+    Runnable runnable = new Runnable() {
+      public void run() {
+
+        final AlertDialog.Builder builder;
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+          builder = new AlertDialog.Builder(cordova.getActivity(), theme);
+        } else {
+          builder = new AlertDialog.Builder(cordova.getActivity());
+        }
+
+        builder
+            .setTitle(title)
+            .setCancelable(true);
+
+
+        // Although there is not really anything technically wrong
+        // with adding a cancel button, Android typically doesn't use
+        // one for this kind of list dialog.
+        // We'll allow the user to override the "smart" option and
+        // include it if they insist anyway.
+
+        if (androidEnableCancelButton && !TextUtils.isEmpty(addCancelButtonWithLabel)) {
+          builder.setNegativeButton(addCancelButtonWithLabel,
+              new OnClickListener() {
+                @Override
+                public void onClick(DialogInterface dialog, int which) {
+                  dialog.cancel();
+                  // We catch the cancel event and return
+                  // the index then.
+                }
+              });
+        }
+
+        // So what do we do with the iOS destructive button?
+        // Android doesn't really have the concept, so we're going to
+        // ignore it until we have a situation where we can come up with
+        // a good way to implement it. Most likely adding an image
+        // or some other indicator.
+//        if (!TextUtils.isEmpty(addDestructiveButtonWithLabel)) {
+//          builder.setPositiveButton(addDestructiveButtonWithLabel,
+//              new OnClickListener() {
+//                @Override
+//                public void onClick(DialogInterface dialog, int which) {
+//                  dialog.dismiss();
+//                  callbackContext
+//                      .sendPluginResult(new PluginResult(
+//                          PluginResult.Status.OK, 0));
+//                }
+//              });
+//        }
+
+        final String[] buttons = getStringArray(
+            buttonLabels,
+            (TextUtils.isEmpty(addDestructiveButtonWithLabel) ? null
+                : addDestructiveButtonWithLabel));
+
+        builder.setItems(buttons, new OnClickListener() {
+          @Override
+          public void onClick(DialogInterface dialog, int which) {
+            // java 0 based index converted to cordova 1 based
+            // index, so we don't confuse the webbies.
+            callbackContext.sendPluginResult(new PluginResult(
+                PluginResult.Status.OK, which + 1));
+          }
+        });
+
+        builder.setOnCancelListener(new AlertDialog.OnCancelListener() {
+          public void onCancel(DialogInterface dialog) {
+            // Match the way the iOS plugin works. Cancel is
+            // always the last index and destructive is always the
+            // first, if it exists. Even though we don't handle the
+            // destructive button, we want the selected index to
+            // match.
+            int cancelButtonIndex = buttons.length + 1;
+            callbackContext.sendPluginResult(new PluginResult(
+                PluginResult.Status.OK, cancelButtonIndex));
+          }
+        });
+
+        dialog = builder.create();
+        dialog.show();
+      }
+    };
+    this.cordova.getActivity().runOnUiThread(runnable);
+  }
+
+  private String[] getStringArray(JSONArray jsonArray, String... prepend) {
+
+    List<String> btn = new ArrayList<String>();
+
+    // Add prefix items like destructive buttons.
+    for (String aPrepend : prepend) {
+      if (!TextUtils.isEmpty(aPrepend)) {
+        btn.add(aPrepend);
+      }
+    }
+
+    // add the rest of the buttons from the list.
+    if (jsonArray != null) {
+      for (int i = 0; i < jsonArray.length(); i++) {
+        btn.add(jsonArray.optString(i));
+      }
+
+    }
+    return btn.toArray(new String[btn.size()]);
+  }
+}

+ 8 - 0
wl/plugins/cordova-plugin-actionsheet/src/ios/ActionSheet.h

xqd
@@ -0,0 +1,8 @@
+#import <Cordova/CDVPlugin.h>
+
+@interface ActionSheet :CDVPlugin<UIActionSheetDelegate>
+
+- (void) show:(CDVInvokedUrlCommand*)command;
+- (void) hide:(CDVInvokedUrlCommand*)command;
+
+@end

+ 91 - 0
wl/plugins/cordova-plugin-actionsheet/src/ios/ActionSheet.m

xqd
@@ -0,0 +1,91 @@
+#import "ActionSheet.h"
+
+@implementation ActionSheet
+
+NSString* theCallbackId;
+UIActionSheet *actionSheet;
+
+#pragma mark - Cordova interface methods
+- (void) show:(CDVInvokedUrlCommand*)command {
+  theCallbackId = command.callbackId;
+  NSDictionary* options = command.arguments[0];
+  
+  NSString *title  = options[@"title"] ?: nil;
+  NSArray *buttons = options[@"buttonLabels"];
+  NSArray *position = options[@"position"] ?: nil;
+  NSString *addCancelButtonWithLabel = options[@"addCancelButtonWithLabel"] ?: nil;
+  NSString *addDestructiveButtonWithLabel = options[@"addDestructiveButtonWithLabel"] ?: nil;
+  
+  [self.commandDelegate runInBackground:^{
+
+    actionSheet = [[UIActionSheet alloc] initWithTitle:[self encodeString:title]
+                                              delegate:self
+                                     cancelButtonTitle:nil
+                                destructiveButtonTitle:[self encodeString:addDestructiveButtonWithLabel]
+                                     otherButtonTitles:nil];
+    
+    for(int i = 0; i < [buttons count]; i++) {
+      [actionSheet addButtonWithTitle:[self encodeString:buttons[i]]];
+    }
+    
+    if (addCancelButtonWithLabel != nil) {
+      [actionSheet addButtonWithTitle:[self encodeString:addCancelButtonWithLabel]];
+      actionSheet.cancelButtonIndex = [buttons count]+(addDestructiveButtonWithLabel == nil ? 0 : 1);
+    }
+    
+    dispatch_async(dispatch_get_main_queue(), ^{
+      if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
+        if (position!= nil) {
+          CGRect rect = [self getPopupRectFromIPadPopupCoordinates:position];
+          [actionSheet showFromRect:rect inView:self.webView.superview animated:YES];
+        } else {
+          [actionSheet showInView:self.webView.superview];
+        }
+      }
+      else{
+        // In this case the device is an iPhone/iPod Touch.
+        [actionSheet showInView:self.webView.superview];
+      }
+    });
+  }];
+}
+
+- (void) hide:(CDVInvokedUrlCommand*)command {
+  dispatch_async(dispatch_get_main_queue(), ^{
+    // dismissing with -2 because it's +1'd by didDismissWithButtonIndex below and we want it to report -1
+    [actionSheet dismissWithClickedButtonIndex:-2 animated:true];
+    CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+    [self.commandDelegate sendPluginResult:pluginResult callbackId:theCallbackId];
+  });
+}
+
+#pragma mark - helper methods
+- (NSString*) encodeString:(NSString*)input {
+  if (input == nil) {
+    return nil;
+  } else {
+    return input;
+  }
+}
+
+- (CGRect)getPopupRectFromIPadPopupCoordinates:(NSArray*)comps {
+  CGRect rect = CGRectZero;
+  if ([comps count] == 2) {
+    rect = CGRectMake([[comps objectAtIndex:0] integerValue], [[comps objectAtIndex:1] integerValue], 0, 0);
+  } else if ([comps count] == 4) {
+    rect = CGRectMake([[comps objectAtIndex:0] integerValue], [[comps objectAtIndex:1] integerValue], [[comps objectAtIndex:2] integerValue], [[comps objectAtIndex:3] integerValue]);
+  }
+  return rect;
+}
+
+#pragma mark - UIActionSheetDelegate methods
+- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
+  
+  // ActionSheet button index is 0-based, but other Cordova plugins are 1-based (prompt, confirm)
+  buttonIndex++;
+  
+  CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:(int)buttonIndex];
+  [self.commandDelegate sendPluginResult:pluginResult callbackId:theCallbackId];
+}
+
+@end

+ 213 - 0
wl/plugins/cordova-plugin-actionsheet/src/windows/ActionSheetProxy.js

xqd
@@ -0,0 +1,213 @@
+/*
+@date  : 11.05.2015
+@author: Pavel Durov
+@note  :  In order to use ActionSheetProxy on Universal Windows Platform -
+		  Make sure that you are referencing base.js and ui.js 
+ */
+function ActionSheet() { /* CTOR...*/ }
+
+
+ActionSheet.prototype.show = function (options, successCallback, errorCallback) {
+	
+    ActionSheet.prototype.successCallBack = successCallback;
+    ActionSheet.prototype.errorCallback = errorCallback;
+
+    if (cordova.platformId == "windows") {
+        ActionSheet.prototype._injectWinJsFlyoutHTML();
+    }
+
+    if (options) {
+        var actionSheetProxyFlyoutDiv = document.getElementById("actionSheetProxyFlyoutDiv");
+        //Settings popup
+        this._clearChildren(actionSheetProxyFlyoutDiv);
+
+        if (options.title) {    //Append Title
+            this._addTitle(options.title, actionSheetProxyFlyoutDiv);
+        }
+
+        if (options.addDestructiveButtonWithLabel) {    //Generate Desctructive Button
+            this._addDestructiveButton(options.addDestructiveButtonWithLabel, actionSheetProxyFlyoutDiv);
+        }
+
+        if (options.buttonLabels && options.buttonLabels instanceof Array) {    //Appending Buttons to main Flyout Div
+            this._addbuttons(options.buttonLabels, actionSheetProxyFlyoutDiv);
+        }
+
+        if (options.winphoneEnableCancelButton && options.addCancelButtonWithLabel) {
+
+            this._addCancelButton(options.addCancelButtonWithLabel, actionSheetProxyFlyoutDiv);
+        }
+        
+        var fly = document.getElementById("fly-test");
+        WinJS.UI.process(fly).done(function () {
+
+            if (fly && fly.winControl) {
+                //var bodys = document.getElementsByClassName('bodyClass')[0];
+                var anchor = document.getElementById("actionSheetSetPoint");
+                if (anchor) {
+                    fly.winControl.show(anchor, "bottom");
+                }
+
+
+            } else {
+                console.log("winControl is undefined");
+            }
+        });
+    }
+
+    document.addEventListener('backbutton', window.plugins.actionsheet.hide, false)
+};
+
+
+ActionSheet.prototype.hide = function (options, successCallback, errorCallback) {
+    console.log("//\\//\\//\\//\\//\\ ActionSheet.prototype.hide ");
+
+    var fly = document.getElementById("fly-test");
+
+    WinJS.UI.process(fly).done(function () {
+        if (fly.winControl && fly.winControl.hide) {
+            //WinJS.UI.Animation.hidePopup(fly).done( /* Your success and error handlers */);
+            fly.winControl.hide();
+        }
+    });
+};
+
+
+
+ActionSheet.prototype.ANDROID_THEMES = {
+    THEME_TRADITIONAL: 1, // default
+    THEME_HOLO_DARK: 2,
+    THEME_HOLO_LIGHT: 3,
+    THEME_DEVICE_DEFAULT_DARK: 4,
+    THEME_DEVICE_DEFAULT_LIGHT: 5
+};
+
+ActionSheet.prototype.install = function () {
+    if (!window.plugins) {
+        window.plugins = {};
+    }
+    window.plugins.actionsheet = new ActionSheet();
+
+    return window.plugins.actionsheet;
+};
+
+cordova.addConstructor(ActionSheet.prototype.install);
+cordova.commandProxy.add("ActionSheet", ActionSheet);
+
+
+//Helpers
+
+
+ActionSheet.prototype._addTitle = function (label, destinationCtrl) {
+    var textCtrl = this._generateTitle(label)
+    destinationCtrl.appendChild(textCtrl);
+}
+
+
+ActionSheet.prototype._addDestructiveButton = function (label, destinationCtrl) {
+    if (label && destinationCtrl) {
+        var destructive_btn = this._generateButton(label, this._getDestructiveButtonStyle());
+        destinationCtrl.appendChild(destructive_btn);
+    }
+}
+
+ActionSheet.prototype._addCancelButton = function (label, destinationCtrl) {
+    if (label && destinationCtrl) {
+        var cancel_btn = this._generateButton(label, this._getCancelButtonStyle());
+        cancel_btn.onclick = function () {
+            ActionSheet.prototype.hide();
+        }
+
+        destinationCtrl.appendChild(cancel_btn);
+    }
+}
+
+ActionSheet.prototype._addbuttons = function (lables, destinationCtrl) {
+    if (lables && destinationCtrl) {
+        for (var i = 0; i < lables.length; i++) {
+            var btn = this._generateButton(lables[i], this._getButtonStyle());
+	    (function (i) {
+            	btn.onclick = function () {
+                    if (ActionSheet.prototype.successCallBack) {
+                    	ActionSheet.prototype.successCallBack(i + 1);
+                    	ActionSheet.prototype.hide();
+                    }                
+            	}
+            })(i);
+            destinationCtrl.appendChild(btn);
+        }
+    }
+}
+
+ActionSheet.prototype._clearChildren = function (element) {
+    if (element && element.hasChildNodes) {
+        while (element.hasChildNodes()) {
+            element.removeChild(element.lastChild);
+        }
+    }
+}
+
+ActionSheet.prototype._generateButton = function (content, style) {
+
+    var btn = document.createElement("input");
+    btn.setAttribute("type", "button");
+    btn.setAttribute("value", content);
+
+    btn.setAttribute("style", style);//;
+
+    return btn;
+}
+
+
+//Style
+ActionSheet.prototype._getButtonStyle = function () {
+    return "display: table-row; font-size: 20px; background-color :black;" +
+            " color: white; width: 98%; position: relative; margin: 1%; background: black; margin-top: 20px; height: 60px;"
+}
+//The only diffrence beweet regulat button and cancel vuttokn styles is WIDTH!!
+ActionSheet.prototype._getCancelButtonStyle = function () {
+    return "display: table-row; font-size: 20px; background-color :black;" +
+            " color: white; width: 49%; position: relative; margin: 1%; background: black; margin-top: 20px; height: 60px;"
+}
+//The only diffrence beweet destructive button and regular is its color (orange)!
+ActionSheet.prototype._getDestructiveButtonStyle = function () {
+    return "display: table-row; font-size: 20px; background-color : black;" +
+            " color: orange; width: 98%; position: relative; margin: 1%; background: black; margin-top: 20px; height: 60px;"
+}
+
+
+
+ActionSheet.prototype._getMainDivStyle = function () {
+    return "position:absolute; width:99%; display: table; background-color: #4F4F4F; padding: 15px; visibility:collapse ; text-align : center;";
+}
+
+ActionSheet.prototype._getTitleStyle = function () {
+    return "color:white; font-size: 30px; ";
+}
+
+ActionSheet.prototype._generateTitle = function (textLebel) {
+    var spanCtrl = document.createElement("span");
+    spanCtrl.setAttribute("style", this._getTitleStyle());
+    spanCtrl.innerHTML = textLebel;
+    return spanCtrl;
+}
+
+ActionSheet.prototype._injectWinJsFlyoutHTML = function () {
+    var divSetPoint = document.createElement("div");
+    divSetPoint.setAttribute("id", "actionSheetSetPoint");
+    divSetPoint.setAttribute("aria-haspopup", "true");
+    divSetPoint.setAttribute("style", "visibility:collapse");
+
+    var flyoutDiv = document.createElement("div");
+    flyoutDiv.setAttribute("data-win-control", "WinJS.UI.Flyout");
+    flyoutDiv.setAttribute("id", "fly-test");
+    flyoutDiv.setAttribute("style", this._getMainDivStyle());
+
+    var internalDiv = document.createElement("div");
+    internalDiv.setAttribute("id", "actionSheetProxyFlyoutDiv");
+
+    flyoutDiv.appendChild(internalDiv);
+
+    document.body.appendChild(flyoutDiv);
+    document.body.appendChild(divSetPoint);
+}

+ 192 - 0
wl/plugins/cordova-plugin-actionsheet/src/wp8/ActionSheet.cs

xqd
@@ -0,0 +1,192 @@
+using Microsoft.Phone.Tasks;
+using Microsoft.Phone.Controls;
+using WPCordovaClassLib.Cordova;
+using WPCordovaClassLib.Cordova.Commands;
+using WPCordovaClassLib.Cordova.JSON;
+using System.Runtime.Serialization;
+using System;
+using System.Windows;
+using System.Windows.Media;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using WPCordovaClassLib;
+
+namespace Cordova.Extension.Commands
+{
+    public class ActionSheet : BaseCommand
+    {
+
+        [DataContract]
+        public class ActionSheetOptions
+        {
+            [DataMember(IsRequired = false, Name = "buttonLabels")]
+            public string[] buttonLabels { get; set; }
+
+            [DataMember(IsRequired = false, Name = "title")]
+            public string title { get; set; }
+
+            [DataMember(IsRequired = false, Name = "addCancelButtonWithLabel")]
+            public string addCancelButtonWithLabel { get; set; }
+
+            [DataMember(IsRequired = false, Name = "addDestructiveButtonWithLabel")]
+            public string addDestructiveButtonWithLabel { get; set; }
+
+            [DataMember(IsRequired = false, Name = "winphoneEnableCancelButton")]
+            public bool winphoneEnableCancelButton { get; set; }
+        }
+
+        private ActionSheetOptions actionSheetOptions = null;
+
+        private Popup popup = new Popup();
+
+        private Brush darkBrush = new SolidColorBrush(Color.FromArgb(250, 40, 40, 40));
+
+        public void show(string options)
+        {
+            try
+            {
+                String jsonOptions = JsonHelper.Deserialize<string[]>(options)[0];
+                actionSheetOptions = JsonHelper.Deserialize<ActionSheetOptions>(jsonOptions);
+            }
+            catch (Exception)
+            {
+                DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
+                return;
+            }
+
+            Deployment.Current.Dispatcher.BeginInvoke(() =>
+            {
+                // attach a backbutton listener to the view and dim it a bit
+                CordovaView cView = getCordovaView();
+                cView.Browser.Dispatcher.BeginInvoke(() =>
+                {
+                    cView.Browser.InvokeScript("execScript", "document.addEventListener('backbutton', window.plugins.actionsheet.hide, false)");
+                    cView.Browser.Opacity = 0.5d;
+                });
+
+                Border border = new Border();
+                border.Width = Application.Current.Host.Content.ActualWidth;
+                border.Background = darkBrush;
+                border.Padding = new Thickness(10, 10, 10, 10);
+
+
+                // container for the buttons
+                StackPanel panel = new StackPanel();
+                panel.HorizontalAlignment = HorizontalAlignment.Stretch;
+                panel.VerticalAlignment = VerticalAlignment.Center;
+                panel.Width = Application.Current.Host.Content.ActualWidth - 60;
+
+
+                // title
+                if (actionSheetOptions.title != null)
+                {
+                    TextBlock textblock1 = new TextBlock();
+                    textblock1.Text = actionSheetOptions.title;
+                    textblock1.TextWrapping = TextWrapping.Wrap;
+                    textblock1.Margin = new Thickness(20, 10, 20, 0); // left, top, right, bottom
+                    textblock1.FontSize = 22;
+                    textblock1.Foreground = new SolidColorBrush(Colors.White);
+                    panel.Children.Add(textblock1);
+                }
+
+                int buttonIndex = 1;
+
+                // desctructive button
+                if (actionSheetOptions.addDestructiveButtonWithLabel != null)
+                {
+                    Button button = new Button();
+                    button.TabIndex = buttonIndex++;
+                    button.Content = actionSheetOptions.addDestructiveButtonWithLabel;
+                    button.Background = darkBrush; // new SolidColorBrush(Colors.White);
+                    button.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 69, 0));
+                    button.Padding = new Thickness(10);
+                    button.Margin = new Thickness(5);
+                    button.Click += new RoutedEventHandler(buttonClickListener);
+                    panel.Children.Add(button);
+                }
+
+
+                // regular buttons
+                if (actionSheetOptions.buttonLabels != null)
+                {
+                    foreach (String buttonLabel in actionSheetOptions.buttonLabels)
+                    {
+                        Button button = new Button();
+                        button.TabIndex = buttonIndex++;
+                        button.Content = buttonLabel;
+                        button.Background = darkBrush;
+                        button.Foreground = new SolidColorBrush(Colors.White);
+                        button.Padding = new Thickness(10);
+                        button.Margin = new Thickness(5);
+                        button.Click += new RoutedEventHandler(buttonClickListener);
+                        panel.Children.Add(button);
+                    }
+                }
+
+                // cancel button
+                if (actionSheetOptions.winphoneEnableCancelButton && actionSheetOptions.addCancelButtonWithLabel != null)
+                {
+                    Button button = new Button();
+                    button.HorizontalAlignment = HorizontalAlignment.Left;
+                    button.TabIndex = buttonIndex++;
+                    button.Content = actionSheetOptions.addCancelButtonWithLabel;
+                    button.Padding = new Thickness(50, 10, 50, 10);
+                    button.Margin = new Thickness(5, 0, 20, 5);
+                    button.FontSize = 17;
+                    button.Background = darkBrush;
+                    button.Foreground = new SolidColorBrush(Colors.White);
+
+                    button.Click += new RoutedEventHandler(buttonClickListener);
+                    panel.Children.Add(button);
+
+                }
+
+                border.Child = panel;
+                popup.Child = border;
+
+                // Set where the popup will show up on the screen.
+                popup.VerticalOffset = 30;
+
+                // Open the popup.
+                popup.IsOpen = true;
+            });
+        }
+
+        void buttonClickListener(object sender, RoutedEventArgs e)
+        {
+            // Close the popup
+            hide(null);
+
+            // Get the clicked button index
+            Button button = (Button)sender;
+            DispatchCommandResult(new PluginResult(PluginResult.Status.OK, button.TabIndex));
+        }
+
+        public void hide(string options)
+        {
+            Deployment.Current.Dispatcher.BeginInvoke(() =>
+            {
+                // remove the backbutton listener from the view and undim it
+                CordovaView cView = getCordovaView();
+                getCordovaView().Browser.Dispatcher.BeginInvoke(() =>
+                {
+                    cView.Browser.InvokeScript("execScript", "document.removeEventListener('backbutton', window.plugins.actionsheet.hide, false)");
+                    cView.Browser.Opacity = 1d;
+                });
+
+                if (popup.IsOpen)
+                {
+                    popup.IsOpen = false;
+                }
+            });
+        }
+
+        // note: needs to be invoked from within Deployment.Current.Dispatcher.BeginInvoke ..
+        private CordovaView getCordovaView()
+        {
+            PhoneApplicationFrame frame = (PhoneApplicationFrame)Application.Current.RootVisual;
+            PhoneApplicationPage page = (PhoneApplicationPage)frame.Content;
+            return (CordovaView)page.FindName("CordovaView");
+        }
+    }
+}

+ 30 - 0
wl/plugins/cordova-plugin-actionsheet/www/ActionSheet.js

xqd
@@ -0,0 +1,30 @@
+function ActionSheet() {
+}
+
+ActionSheet.prototype.show = function (options, successCallback, errorCallback) {
+  cordova.exec(successCallback, errorCallback, "ActionSheet", "show", [options]);
+};
+
+ActionSheet.prototype.hide = function (options, successCallback, errorCallback) {
+  cordova.exec(successCallback, errorCallback, "ActionSheet", "hide", [options]);
+};
+
+ActionSheet.prototype.ANDROID_THEMES = {
+  THEME_TRADITIONAL          : 1, // default
+  THEME_HOLO_DARK            : 2,
+  THEME_HOLO_LIGHT           : 3,
+  THEME_DEVICE_DEFAULT_DARK  : 4,
+  THEME_DEVICE_DEFAULT_LIGHT : 5
+};
+
+ActionSheet.install = function () {
+  if (!window.plugins) {
+    window.plugins = {};
+  }
+
+  window.plugins.actionsheet = new ActionSheet();
+
+  return window.plugins.actionsheet;
+};
+
+cordova.addConstructor(ActionSheet.install);

+ 8 - 0
wl/plugins/fetch.json

xqd
@@ -78,5 +78,13 @@
         },
         "is_top_level": true,
         "variables": {}
+    },
+    "cordova-plugin-actionsheet": {
+        "source": {
+            "type": "registry",
+            "id": "cordova-plugin-actionsheet@2.2.2"
+        },
+        "is_top_level": true,
+        "variables": {}
     }
 }

+ 1 - 0
wl/www/index.html

xqd
@@ -41,5 +41,6 @@
 <script src="js/services/orderservice.js"></script>
 <script src="js/services/myservice.js"></script>
 <script src="js/services/mapservice.js"></script>
+<script src="js/services/nativeservices.js"></script>
 <!--filters-->
 <script src="js/filters/filter.js"></script>

+ 6 - 4
wl/www/js/controllers/car.js

xqd
@@ -9,15 +9,17 @@
             end_address: '',
             midway_address: ''
         }
+        if ($rootScope.location) {
+            var city = $rootScope.location.city;
+            if (city) {
+                $scope.filter.begin_address = city.slice(0, city.length - 1);
+            }
+        }
         $scope.items = [];
         $scope.load = function (init) {
             if (init) {
-             
                 $scope.filter.pageIndex = 1;
                 $scope.items = [];
-                if ($rootScope.location) {
-                    $scope.filter.begin_address = $rootScope.location.city;
-                }
             }
             carService.listCars($scope.filter).then(function (result) {
                 $scope.filter.pageIndex++;

+ 7 - 11
wl/www/js/controllers/goods.js

xqd xqd
@@ -10,18 +10,19 @@
             end_address: '',
             midway_address:''
         }
+        if ($rootScope.location) {
+            var city = $rootScope.location.city;
+            if (city) {
+                $scope.filter.begin_address = city.slice(0, city.length - 1);
+            }
+        }
         $scope.items = [];
         $scope.load = function (init) {
             if (init) {
                 $scope.filter.pageIndex = 1;
                 $scope.items = [];
-                if ($rootScope.location) {
-                   // $scope.filter.begin_address = $rootScope.location.city;
-                }
             }
-          
             goodsService.listGoods($scope.filter).then(function (result) {
-                 
                 $scope.filter.pageIndex++;
                 var more = (result.data.data.length >= $scope.filter.pageSize);
                 $scope.filter.hasMore = more;
@@ -48,12 +49,7 @@
         $scope.goCar = function () {
             $state.go('wl.car');
         }
-        $scope.load(true); 
-        $scope.getLocation = function () {
-          
-        }
-    
-       
+        $scope.load(true);
     }]);
     app.controller('goodsAddCtrl', ["$scope", "$state", "goodsService", "msg", function ($scope, $state, goodsService, msg) {
 

+ 64 - 98
wl/www/js/controllers/my.js

xqd xqd xqd xqd
@@ -65,7 +65,7 @@
         }
     }]);
     
-    app.controller('myProfileCtrl', ['$scope','$ionicActionSheet','$ionicPopup','$timeout','userService', 'msg', 'util','data', function ($scope,$ionicActionSheet,$ionicPopup,$timeout, userService, msg, util,data) {
+    app.controller('myProfileCtrl', ['$scope', '$ionicActionSheet', '$ionicPopup', '$timeout', 'userService', 'msg', 'util', 'data', 'camera', function ($scope, $ionicActionSheet, $ionicPopup, $timeout, userService, msg, util, data, camera) {
         $scope.user = data.getObject('user');
         $scope.genderOpt = [
               { name: "男", value: 1 },
@@ -73,83 +73,28 @@
         ];
      
         $scope.setAvator = function () {
-            var sheet = $ionicActionSheet.show({
-                buttons: [{ text: '<b>拍照</b> 上传' }, { text: '从 <b>相册</b> 中选' }],
-                titleText: '图片上传',
-                cancelText: '取 消',
-                cancel: function() { return true; },
-                buttonClicked: function(index) {
-                    var options = { quality: 50, targetHeight: 112, targetWidth: 112, allowEdit: true};
-                    if (index == 0) options.sourceType = 1;
-                    else options.sourceType = 2;
-                    navigator.camera.getPicture(function(imageUri) {
-                        if (imageUri == undefined) {
-                            var alertPopup = $ionicPopup.alert({
-                               title: '提示',
-                               template: '图片未找到!'
-                             });
-                             alertPopup.then(function(res) {
-                               console.log('1111');
-                             });
-                        }else {
-                            $timeout(function() {
-                                $scope.user.avatar = imageUri;
-                            });
-                            var uploadOptions = new FileUploadOptions();
-                            uploadOptions.fileKey = "photo";
-                            uploadOptions.fileName = "avatar.jpg";
-                            uploadOptions.mimeType = "image/jpeg";
-                            uploadOptions.httpMethod = 'post';
-                            uploadOptions.chunkedMode = true;
-                            var token='Bearer ' + localStorage['token'];
-                            uploadOptions.headers = { "Authorization": token };
-                            console.log("setAvator uploadOptions:"+JSON.stringify(uploadOptions));
-                            var ft = new FileTransfer();
-                            ft.upload(imageUri, encodeURI(config.server+"api/user"), function(sucess) {
-                                console.log("setAvator sucess:"+JSON.stringify(sucess));
-                                // alert(JSON.stringify(sucess));
-                            }, function (fail) {
-                                console.log("setAvator fail:"+JSON.stringify(fail));
-                                // alert(JSON.stringify(fail));
-                            }, uploadOptions); 
-
-                        }
-                    }, function(err) { 
-                        var alertPopup = $ionicPopup.alert({
-                           title: '提示',
-                           template: err
-                         });
-                         alertPopup.then(function(res) {
-                           console.log('1111');
-                         });
-                    }, options);
-
-                    return true;
-                }
+            camera.chooseImage().then(function (imageUri) {
+                $timeout(function () {
+                    $scope.user.avatar = imageUri;
+                });
+                var uploadOptions = new FileUploadOptions();
+                uploadOptions.fileKey = "photo";
+                uploadOptions.fileName = "avatar.jpg";
+                uploadOptions.mimeType = "image/jpeg";
+                uploadOptions.httpMethod = 'post';
+                uploadOptions.chunkedMode = true;
+                var token = 'Bearer ' + localStorage['token'];
+                uploadOptions.headers = { "Authorization": token };
+                var ft = new FileTransfer();
+                ft.upload(imageUri, encodeURI(config.server + "api/user"), function (sucess) {
+                     //alert('上传成功'+JSON.stringify(sucess));
+                }, function (fail) {
+                      //alert('上传失败'+JSON.stringify(fail));
+                }, uploadOptions);
+            }, function (erro) {
+                msg.error(erro);
             });
-         
-            //https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-camera/
-            // navigator.camera.getPicture(function (imageUri) {
-            //     $scope.user.avatar = imageUri;
-
-            //     var uploadOptions = new FileUploadOptions();
-            //     uploadOptions.fileKey = "avatar";
-            //     uploadOptions.fileName = "avatar.jpg";
-            //     uploadOptions.mimeType = "image/jpeg";
-            //     uploadOptions.httpMethod = 'post';
-            //     var token='Bearer ' + localStorage['token'];
-            //     alert(token);
-            //     uploadOptions.headers = { "Authorization": token };
-            //     var ft = new FileTransfer();
-            //     ft.upload(imageUri, encodeURI("http://120.25.204.211/api/user"), function(sucess) {
-            //         alert(JSON.stringify(sucess));
-            //     }, function (fail) {
-            //         alert(JSON.stringify(fail));
-            //     }, options); 
              
-            // }, function (erro) {
-            //     alert(erro);
-            // }, options);
         }
         $scope.save = function () {
             data.updateObject('user', $scope.user);
@@ -215,34 +160,34 @@
         }
         $scope.load(true);
     }]);
-    app.controller('myTruckAddCtrl', ['$scope', 'myService', 'msg', '$state', '$stateParams', function ($scope, myService, msg, $state, $stateParams) {
+    app.controller('myTruckAddCtrl', ['$scope', 'myService', 'msg', '$state', '$stateParams', 'camera', 'config', function ($scope, myService, msg, $state, $stateParams, camera, config) {
         $scope.vm = {};
         if ($stateParams.item) {
             $scope.vm = $stateParams.item;
         }
         $scope.typeOpt = [
-            { name: '厢式货车', value: '厢式货车' },
-            { name: '面包车', value: '面包车' },
-            { name: '金杯车', value: '金杯车' },
-        { name: '中巴货车', value: '中巴货车' },
-        { name: '高栏车', value: '高栏车' },
-        { name: '低栏车', value: '低栏车' },
-        { name: '平板车', value: '平板车' },
-        { name: '高低板车', value: '高低板车' },
-        { name: '半挂车', value: '半挂车' },
-        { name: '自卸车', value: '自卸车' },
-        { name: '冷藏车', value: '冷藏车' },
-        { name: '保温车', value: '保温车' },
-        { name: '罐式车', value: '罐式车' },
-        { name: '铁笼车', value: '铁笼车' },
-        { name: '集装箱运输车', value: '集装箱运输车' },
-        { name: '大件运输车', value: '大件运输车' },
-        { name: '危险品车', value: '危险品车' },
-        { name: '全挂车', value: '全挂车' },
-        { name: '加长挂车', value: '加长挂车' },
-        { name: '其他', value: '其他' }];
+            { name: '厢式货车', value: '1' },
+            { name: '面包车', value: '2' },
+            { name: '金杯车', value: '3' },
+        { name: '中巴货车', value: '4' },
+        { name: '高栏车', value: '5' },
+        { name: '低栏车', value: '6' },
+        { name: '平板车', value: '7' },
+        { name: '高低板车', value: '8' },
+        { name: '半挂车', value: '9' },
+        { name: '自卸车', value: '10' },
+        { name: '冷藏车', value: '11' },
+        { name: '保温车', value: '12' },
+        { name: '罐式车', value: '13' },
+        { name: '铁笼车', value: '14' },
+        { name: '集装箱运输车', value: '15' },
+        { name: '大件运输车', value: '16' },
+        { name: '危险品车', value: '17' },
+        { name: '全挂车', value: '18' },
+        { name: '加长挂车', value: '19' },
+        { name: '其他', value: '20' }];
         $scope.save = function () {
-            msg.loading('保存中...')
+            msg.loading('保存中...');
             myService.addTruck($scope.vm).then(function (result) {
                 msg.hide();
                 $state.go('wl.my_truck');
@@ -253,6 +198,27 @@
         }
         //上传图片
         $scope.setPhoto = function () {
+            camera.chooseImage().then(function (imageUri) {
+                $timeout(function () {
+                    $scope.vm.photo = imageUri;
+                });
+                var uploadOptions = new FileUploadOptions();
+                uploadOptions.fileKey = "photo";
+                uploadOptions.fileName = "photo.jpg";
+                uploadOptions.mimeType = "image/jpeg";
+                uploadOptions.httpMethod = 'post';
+                uploadOptions.chunkedMode = true;
+                var token = 'Bearer ' + localStorage['token'];
+                uploadOptions.headers = { "Authorization": token };
+                var ft = new FileTransfer();
+                ft.upload(imageUri, encodeURI(config.server + "api/trucks"), function (sucess) {
+                    //alert('上传成功'+JSON.stringify(sucess));
+                }, function (fail) {
+                    //alert('上传失败'+JSON.stringify(fail));
+                }, uploadOptions);
+            }, function (erro) {
+                msg.error(erro);
+            });
 
         }
      

+ 47 - 0
wl/www/js/services/nativeservices.js

xqd
@@ -0,0 +1,47 @@
+(function (app) {
+    app.factory('camera', ["$q", function ($q) {
+        return {
+            chooseImage: function (cameraOptions) {
+                var deferred = $q.defer();
+                var defaultCameraOptions = {
+                    quality: 50,
+                    sourceType: 1,
+                    allowEdit: true,
+                    encodingType: 0,//0为jpg,1为png
+                    targetHeight: 112,
+                    targetWidth: 112
+                };
+                var options = angular.extend(defaultCameraOptions, cameraOptions);
+                var sheetOptions = {
+                    title: '选择图片方式',
+                    buttonLabels: ['拍摄照片', '从图库选择'],
+                    addCancelButtonWithLabel: '取消',
+                    androidEnableCancelButton: true
+                };
+                window.plugins.actionsheet.show(sheetOptions, function (index) {
+                    switch (index) {
+                        case 1: //拍摄图片
+                            options.sourceType = 1;
+                            break;
+                        case 2://从图库选择
+                            options.sourceType = 2;
+                            break;
+                        default:
+                            deferred.resolve();
+                            break;
+                    }
+                    navigator.camera.getPicture(function (imageUri) {
+                        if (imageUri) {
+                            deferred.resolve(imageUri);
+                        } else {
+                            deferred.reject('图片未找到');
+                        }
+                    }, function (error) {
+                        deferred.reject(error);
+                    }, options);
+                });
+                return deferred.promise;
+            }
+        };
+    }]);
+})(angular.module('app.services'));

+ 3 - 0
wl/www/templates/car/index.html

xqd
@@ -43,6 +43,9 @@
                         <p><span style="float:left"><b style="color:orangered">¥{{item.price}}</b><em style="padding-left:3px;font-size:0.75em">起</em></span></p>
                         <p><span style="float:left">联系人:{{item.contact_name}}</span> <span style="float:right">电话:{{item.contact_phone}}</span></p> 
                     </a>
+                    <a class="item item-thumbnail-left"  ng-if="items.length==0">
+                        <p style="margin-top:25px;margin-left:12%">没有找到车源信息</p>
+                    </a>
                 </div>
 
                 <!--上拉更多-->

+ 3 - 1
wl/www/templates/goods/index.html

xqd
@@ -43,7 +43,9 @@
                         </p>
                         <p><span style="float:left">联系人:{{item.contact_name}}</span> <span style="float:right">电话:{{item.contact_phone}}</span></p> 
                     </a>
-
+                    <a class="item item-thumbnail-left" ng-if="items.length==0">
+                        <p style="margin-top:25px;margin-left:12%">没有找到货源信息</p>
+                    </a>
                 </div>
 
                 <!--上拉更多-->