baimeng 9 rokov pred
rodič
commit
8ea5964eaa

+ 10 - 2
wl/platforms/android/assets/www/js/controllers/account.js

xqd xqd
@@ -114,7 +114,7 @@
             }, 1000);
         };
     }]);
-    app.controller('forgetPasswordCtrl', ["$scope", "util", 'userService', '$timeout', function ($scope, util, userService, $timeout) {
+    app.controller('forgetPasswordCtrl', ["$scope", "util", 'userService', '$timeout', '$state', function ($scope, util, userService, $timeout, $state) {
         $scope.vm = {
             mobile: '',
             code: '',
@@ -141,7 +141,15 @@
                 msg.text('密码前后输入不一致');
                 return;
             }
-
+            msg.loading('请稍等...');
+            userService.resetPassword().then(function () {
+                msg.hide();
+                msg.success('密码找回成功');
+                $state.go('login');
+            }, function (erro) {
+                msg.hide();
+                msg.error(erro);
+            });
         }
         var wait = function (seconds) {
             if (seconds > 0) {

+ 4 - 1
wl/platforms/android/assets/www/js/controllers/car.js

xqd
@@ -48,7 +48,10 @@
         $scope.goGoods = function () {
             $state.go('wl.goods');
         }
-        $scope.load(true);
+        $scope.$on('$ionicView.enter', function (viewResult) {
+            $scope.load(true);
+        });
+        
     }]);
     app.controller('carAddCtrl', ["$scope", "$state", "carService", "msg", function ($scope, $state, carService, msg) {
         $scope.vm = { type: 1 };

+ 3 - 1
wl/platforms/android/assets/www/js/controllers/goods.js

xqd
@@ -49,7 +49,9 @@
         $scope.goCar = function () {
             $state.go('wl.car');
         }
-        $scope.load(true);
+        $scope.$on('$ionicView.enter', function (viewResult) {
+            $scope.load(true);
+        });
     }]);
     app.controller('goodsAddCtrl', ["$scope", "$state", "goodsService", "msg", function ($scope, $state, goodsService, msg) {
 

+ 27 - 7
wl/platforms/android/assets/www/js/controllers/my.js

xqd xqd xqd xqd xqd
@@ -53,15 +53,24 @@
             $scope.modal2.remove();
         });
     }]);
-    app.controller('mySetPasswordCtrl', ['$scope', '$state', function ($scope,$state) {
+    app.controller('mySetPasswordCtrl', ['$scope', '$state', 'myService', 'msg', function ($scope, $state, myService, msg) {
         $scope.vm = {
+            oldpassword:'',
             password: '',
-            password2: '',
+            password1: '',
             isloading: false,
 
         };
         $scope.submit = function () {
-
+            msg.loading('保存中...');
+            var model = { old_password: $scope.vm.oldpassword, password: $scope.vm.password, password_confirmation: $scope.vm.password1 };
+            myService.resetPassword(model).then(function () {
+                msg.hide();
+                msg.success('密码修改成功');
+            }, function (erro) {
+                msg.hide();
+                msg.error(erro);
+            });
         }
     }]);
     
@@ -158,7 +167,9 @@
                 }
             });
         }
-        $scope.load(true);
+        $scope.$on('$ionicView.enter', function (viewResult) {
+            $scope.load(true);
+        });
     }]);
     app.controller('myTruckAddCtrl', ['$scope', 'myService', 'msg', '$state', '$stateParams', 'camera', 'config', '$timeout', function ($scope, myService, msg, $state, $stateParams, camera, config, $timeout) {
         $scope.vm = {};
@@ -268,7 +279,12 @@
             });
         }
         $scope.close = function () {
-            $scope.shouldShowDelete = true;
+            if ($scope.shouldShowDelete) {
+                $scope.shouldShowDelete = false;
+            } else {
+                $scope.shouldShowDelete = true;
+            }
+            
         }
         $scope.detail = function (item) {
             $state.go('wl.my_message_detail', { item: item });
@@ -281,7 +297,9 @@
                 msg.error(erro.data.message);
             });
         }
-        $scope.load(true);
+        $scope.$on('$ionicView.enter', function (viewResult) {
+            $scope.load(true);
+        });
     }]);
     app.controller('myMessageDetailCtrl', ['$scope', '$stateParams', function ($scope, $stateParams) {
         $scope.vm = $stateParams.item;
@@ -347,7 +365,9 @@
         $scope.detail = function (item) {
             $state.go('wl.my_order_detail', { item: item });
         }
-        $scope.load(true);
+        $scope.$on('$ionicView.enter', function (viewResult) {
+            $scope.load(true);
+        });
     }]);
     app.controller('myOrderDetailCtrl', ['$scope', '$stateParams', function ($scope, $stateParams) {
         $scope.vm = $stateParams.item;

+ 10 - 2
wl/www/js/controllers/account.js

xqd xqd
@@ -114,7 +114,7 @@
             }, 1000);
         };
     }]);
-    app.controller('forgetPasswordCtrl', ["$scope", "util", 'userService', '$timeout', function ($scope, util, userService, $timeout) {
+    app.controller('forgetPasswordCtrl', ["$scope", "util", 'userService', '$timeout', '$state', function ($scope, util, userService, $timeout, $state) {
         $scope.vm = {
             mobile: '',
             code: '',
@@ -141,7 +141,15 @@
                 msg.text('密码前后输入不一致');
                 return;
             }
-
+            msg.loading('请稍等...');
+            userService.resetPassword().then(function () {
+                msg.hide();
+                msg.success('密码找回成功');
+                $state.go('login');
+            }, function (erro) {
+                msg.hide();
+                msg.error(erro);
+            });
         }
         var wait = function (seconds) {
             if (seconds > 0) {

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

xqd
@@ -48,7 +48,10 @@
         $scope.goGoods = function () {
             $state.go('wl.goods');
         }
-        $scope.load(true);
+        $scope.$on('$ionicView.enter', function (viewResult) {
+            $scope.load(true);
+        });
+        
     }]);
     app.controller('carAddCtrl', ["$scope", "$state", "carService", "msg", function ($scope, $state, carService, msg) {
         $scope.vm = { type: 1 };

+ 3 - 1
wl/www/js/controllers/goods.js

xqd
@@ -49,7 +49,9 @@
         $scope.goCar = function () {
             $state.go('wl.car');
         }
-        $scope.load(true);
+        $scope.$on('$ionicView.enter', function (viewResult) {
+            $scope.load(true);
+        });
     }]);
     app.controller('goodsAddCtrl', ["$scope", "$state", "goodsService", "msg", function ($scope, $state, goodsService, msg) {
 

+ 27 - 7
wl/www/js/controllers/my.js

xqd xqd xqd xqd xqd
@@ -53,15 +53,24 @@
             $scope.modal2.remove();
         });
     }]);
-    app.controller('mySetPasswordCtrl', ['$scope', '$state', function ($scope,$state) {
+    app.controller('mySetPasswordCtrl', ['$scope', '$state', 'myService', 'msg', function ($scope, $state, myService, msg) {
         $scope.vm = {
+            oldpassword:'',
             password: '',
-            password2: '',
+            password1: '',
             isloading: false,
 
         };
         $scope.submit = function () {
-
+            msg.loading('保存中...');
+            var model = { old_password: $scope.vm.oldpassword, password: $scope.vm.password, password_confirmation: $scope.vm.password1 };
+            myService.resetPassword(model).then(function () {
+                msg.hide();
+                msg.success('密码修改成功');
+            }, function (erro) {
+                msg.hide();
+                msg.error(erro);
+            });
         }
     }]);
     
@@ -158,7 +167,9 @@
                 }
             });
         }
-        $scope.load(true);
+        $scope.$on('$ionicView.enter', function (viewResult) {
+            $scope.load(true);
+        });
     }]);
     app.controller('myTruckAddCtrl', ['$scope', 'myService', 'msg', '$state', '$stateParams', 'camera', 'config', '$timeout', function ($scope, myService, msg, $state, $stateParams, camera, config, $timeout) {
         $scope.vm = {};
@@ -268,7 +279,12 @@
             });
         }
         $scope.close = function () {
-            $scope.shouldShowDelete = true;
+            if ($scope.shouldShowDelete) {
+                $scope.shouldShowDelete = false;
+            } else {
+                $scope.shouldShowDelete = true;
+            }
+            
         }
         $scope.detail = function (item) {
             $state.go('wl.my_message_detail', { item: item });
@@ -281,7 +297,9 @@
                 msg.error(erro.data.message);
             });
         }
-        $scope.load(true);
+        $scope.$on('$ionicView.enter', function (viewResult) {
+            $scope.load(true);
+        });
     }]);
     app.controller('myMessageDetailCtrl', ['$scope', '$stateParams', function ($scope, $stateParams) {
         $scope.vm = $stateParams.item;
@@ -347,7 +365,9 @@
         $scope.detail = function (item) {
             $state.go('wl.my_order_detail', { item: item });
         }
-        $scope.load(true);
+        $scope.$on('$ionicView.enter', function (viewResult) {
+            $scope.load(true);
+        });
     }]);
     app.controller('myOrderDetailCtrl', ['$scope', '$stateParams', function ($scope, $stateParams) {
         $scope.vm = $stateParams.item;

+ 1 - 1
wl/www/js/services/myservice.js

xqd
@@ -19,7 +19,7 @@
             updateTruck: function (model) {
                 return $http({
                     url: config.server + 'api/trucks/'+model.id,
-                    method: "post",
+                    method: "put",
                     data: model
                 })
             },

+ 8 - 1
wl/www/js/services/userservice.js

xqd
@@ -54,7 +54,14 @@
                 return new Promise(function (resolve, reject) {
                     resolve('ok');
                 });
-            } 
+            },
+            resetPassword: function (model) {
+                return $http({
+                    url: config.server + 'api/auth/reset',
+                    method: "post",
+                    data: model
+                })
+            }
         };
     }]);
 })(angular.module('app.services'));

+ 1 - 1
wl/www/templates/my/message.html

xqd
@@ -3,7 +3,7 @@
         <ion-nav-back-button>
         </ion-nav-back-button>
         <ion-nav-buttons side="right">
-            <button class="button  button-clear icon-left ion-ios-trash-outline" ng-click="close()">关闭
+            <button class="button  button-clear icon-left ion-ios-trash-outline" ng-click="close()">{{shouldShowDelete?'取消':'关闭'}}
             </button>
         </ion-nav-buttons>
     </ion-nav-bar>

+ 5 - 2
wl/www/templates/my/setPassword.html

xqd
@@ -3,13 +3,16 @@
         <form ng-submit="submit()" name="form" novalidate="novalidate">
            
             <div class="list list-inset list-bg-transparent list-border-no form-width">
+                <div class="item-input-placeholder">
+                    <input type="password" name="password" ng-model="data.oldpassword" highlight-color="balanced" placeholder="输入旧密码" />
+                </div>
                 <div class="item-input-placeholder">
                     <input type="password" name="password" ng-model="data.password" highlight-color="balanced" placeholder="输入新密码"/>
                 </div>
                 <div class="item-input-placeholder">
-                    <input type="password" name="password" ng-model="data.password2" highlight-color="balanced" placeholder="再次输入新密码" />
+                    <input type="password" name="password" ng-model="data.password1" highlight-color="balanced" placeholder="再次输入新密码" />
                 </div>
-                <button class="button button-block  button-assertive  button-radius-full"  ng-click="reset()"  ng-disabled="data.isloading" type="submit">更新密码</button>
+                <button class="button button-block  button-assertive  button-radius-full"    ng-disabled="data.isloading" type="submit">更新密码</button>
             </div>
         </form>
     </ion-content>