| xqd
@@ -1,14 +1,21 @@
|
|
|
(function (app) {
|
|
|
- app.controller('myCtrl', ["$scope", "$state", 'userService', 'msg','config', function ($scope, $state, userService,msg,config) {
|
|
|
+ app.controller('myCtrl', ["$scope", "$state", 'userService', 'msg','config','$timeout', function ($scope, $state, userService,msg,config,$timeout) {
|
|
|
$scope.user = {};
|
|
|
$scope.host = config.server +'/upload/avatar/';
|
|
|
- userService.getUser().then(function (result) {
|
|
|
- $scope.user = result.data.data;
|
|
|
- }, function (erro) {
|
|
|
- msg.error(erro.data.message);
|
|
|
+ $scope.$on('$ionicView.beforeEnter', function (viewResult) {
|
|
|
+ $scope.load(true);
|
|
|
});
|
|
|
- $scope.toProfile = function () {
|
|
|
- $state.go('wl.my_profile');
|
|
|
+ $scope.load = function (init) {
|
|
|
+ userService.getUser().then(function (result) {
|
|
|
+ $timeout(function () {
|
|
|
+ $scope.user = result.data.data;
|
|
|
+ });
|
|
|
+ }, function (erro) {
|
|
|
+ msg.error(erro.data.message);
|
|
|
+ });
|
|
|
+ $scope.toProfile = function () {
|
|
|
+ $state.go('wl.my_profile');
|
|
|
+ }
|
|
|
}
|
|
|
}]);
|
|
|
app.controller('mySettingCtrl', ['$scope', 'data', '$state', '$http','$ionicModal','myService', function ($scope, data, $state, $http,$ionicModal,myService) {
|
| xqd
@@ -61,11 +68,16 @@
|
|
|
isloading: false,
|
|
|
|
|
|
};
|
|
|
- $scope.submit = function () {
|
|
|
+ $scope.submit = function (vm) {
|
|
|
msg.loading('保存中...');
|
|
|
- var model = { old_password: $scope.vm.oldpassword, password: $scope.vm.password, password_confirmation: $scope.vm.password1 };
|
|
|
+ var model = { old_password: vm.oldpassword, password: vm.password, password_confirmation: vm.password1 };
|
|
|
myService.resetPassword(model).then(function () {
|
|
|
msg.hide();
|
|
|
+ $scope.vm = {
|
|
|
+ oldpassword:'',
|
|
|
+ password: '',
|
|
|
+ password1: '',
|
|
|
+ };
|
|
|
msg.success('密码修改成功');
|
|
|
}, function (erro) {
|
|
|
msg.hide();
|
| xqd
@@ -172,7 +184,7 @@
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- $scope.$on('$ionicView.enter', function (viewResult) {
|
|
|
+ $scope.$on('$ionicView.beforEnter', function (viewResult) {
|
|
|
$scope.load(true);
|
|
|
});
|
|
|
}]);
|
| xqd
@@ -315,7 +327,7 @@
|
|
|
msg.error(erro.data.message);
|
|
|
});
|
|
|
}
|
|
|
- $scope.$on('$ionicView.enter', function (viewResult) {
|
|
|
+ $scope.$on('$ionicView.beforeEnter', function (viewResult) {
|
|
|
$scope.load(true);
|
|
|
});
|
|
|
}]);
|
| xqd
@@ -383,7 +395,7 @@
|
|
|
$scope.detail = function (item) {
|
|
|
$state.go('wl.my_order_detail', { item: item });
|
|
|
}
|
|
|
- $scope.$on('$ionicView.enter', function (viewResult) {
|
|
|
+ $scope.$on('$ionicView.beforeEnter', function (viewResult) {
|
|
|
$scope.load(true);
|
|
|
});
|
|
|
}]);
|