|
@@ -3,6 +3,7 @@
|
|
$scope.user = {};
|
|
$scope.user = {};
|
|
userService.getUser().then(function (result) {
|
|
userService.getUser().then(function (result) {
|
|
$scope.user = result.data.data;
|
|
$scope.user = result.data.data;
|
|
|
|
+
|
|
}, function (erro) {
|
|
}, function (erro) {
|
|
msg.error(erro.data.message);
|
|
msg.error(erro.data.message);
|
|
});
|
|
});
|
|
@@ -10,7 +11,12 @@
|
|
$state.go('wl.my_profile');
|
|
$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 () {
|
|
$scope.logout = function () {
|
|
data.remove('user');
|
|
data.remove('user');
|
|
data.remove('token');
|
|
data.remove('token');
|
|
@@ -46,10 +52,6 @@
|
|
$scope.modal1.remove();
|
|
$scope.modal1.remove();
|
|
$scope.modal2.remove();
|
|
$scope.modal2.remove();
|
|
});
|
|
});
|
|
- $scope.appversion = '1.0.0';
|
|
|
|
- if (!!window.AppVersion) {
|
|
|
|
- $scope.appversion = AppVersion.version;
|
|
|
|
- }
|
|
|
|
}]);
|
|
}]);
|
|
app.controller('mySetPasswordCtrl', ['$scope', '$state', function ($scope,$state) {
|
|
app.controller('mySetPasswordCtrl', ['$scope', '$state', function ($scope,$state) {
|
|
$scope.vm = {
|
|
$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.user = data.getObject('user');
|
|
$scope.genderOpt = [
|
|
$scope.genderOpt = [
|
|
{ name: "男", value: 1 },
|
|
{ name: "男", value: 1 },
|
|
{ name: "女", value: 0 }
|
|
{ name: "女", value: 0 }
|
|
];
|
|
];
|
|
- userService.getApplyProfile().then(function (result) {
|
|
|
|
- $scope.vm = result;
|
|
|
|
- }, function (erro) {
|
|
|
|
- msg.error(erro);
|
|
|
|
- });
|
|
|
|
|
|
+
|
|
$scope.setAvator = function () {
|
|
$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 () {
|
|
$scope.save = function () {
|
|
data.updateObject('user', $scope.user);
|
|
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);
|
|
$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 = {};
|
|
$scope.vm = {};
|
|
if ($stateParams.item) {
|
|
if ($stateParams.item) {
|
|
$scope.vm = $stateParams.item;
|
|
$scope.vm = $stateParams.item;
|
|
}
|
|
}
|
|
$scope.typeOpt = [
|
|
$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 () {
|
|
$scope.save = function () {
|
|
- msg.loading('保存中...')
|
|
|
|
|
|
+ msg.loading('保存中...');
|
|
myService.addTruck($scope.vm).then(function (result) {
|
|
myService.addTruck($scope.vm).then(function (result) {
|
|
msg.hide();
|
|
msg.hide();
|
|
$state.go('wl.my_truck');
|
|
$state.go('wl.my_truck');
|
|
@@ -247,6 +198,27 @@
|
|
}
|
|
}
|
|
//上传图片
|
|
//上传图片
|
|
$scope.setPhoto = function () {
|
|
$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);
|
|
var more = (result.data.data.length >= $scope.filter.pageSize);
|
|
$scope.filter.hasMore = more;
|
|
$scope.filter.hasMore = more;
|
|
$scope.items = $scope.items.concat(result.data.data);
|
|
$scope.items = $scope.items.concat(result.data.data);
|
|
- debugger;
|
|
|
|
|
|
+
|
|
if (init) {
|
|
if (init) {
|
|
$scope.$broadcast('scroll.refreshComplete');
|
|
$scope.$broadcast('scroll.refreshComplete');
|
|
} else {
|
|
} else {
|