|
@@ -2,74 +2,41 @@
|
|
app.controller('myCtrl', ["$scope", "$state", "$http", "storage", "myService", "common", "config", "msg"
|
|
app.controller('myCtrl', ["$scope", "$state", "$http", "storage", "myService", "common", "config", "msg"
|
|
, function ($scope, $state, $http, storage, myService, common, config, msg) {
|
|
, function ($scope, $state, $http, storage, myService, common, config, msg) {
|
|
$scope.$on('$ionicView.beforeEnter', function (viewResult) {
|
|
$scope.$on('$ionicView.beforeEnter', function (viewResult) {
|
|
-
|
|
|
|
|
|
+ myService.myIndex().then(function(result){
|
|
|
|
+ console.log(result.data.data);
|
|
|
|
+ $scope.user = result.data.data
|
|
|
|
+ });
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
- $scope.testuploadFile = function(files) { //单次提交图片的函数
|
|
|
|
- console.log(files[0]);
|
|
|
|
- var formData = new FormData();
|
|
|
|
- formData.append('file', files[0]);
|
|
|
|
- formData.append('tag', 'avatar');
|
|
|
|
-
|
|
|
|
- $http({
|
|
|
|
- method: 'POST',
|
|
|
|
- url: config.server + 'api/attachment/upload',
|
|
|
|
- transformRequest: angular.identity,
|
|
|
|
- data: formData,
|
|
|
|
- // headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8' }
|
|
|
|
- headers: {'Content-Type': undefined}
|
|
|
|
- }).then(function (result) {
|
|
|
|
- // alert(JSON.stringify(result));
|
|
|
|
- console.log("attachment upload result:"+JSON.stringify(result));
|
|
|
|
- }, function (error) {
|
|
|
|
- console.log("attachment upload error:"+JSON.stringify(error));
|
|
|
|
-
|
|
|
|
- })
|
|
|
|
|
|
+
|
|
|
|
+ $scope.setAvator = function () {
|
|
|
|
+ common.setAvator().then(function (result) {
|
|
|
|
+ var response = JSON.parse(result.response);
|
|
|
|
+ $timeout(function () {
|
|
|
|
+ $scope.vm.user.avatar = response.data.md5;
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+ $scope.toprofile = function () {
|
|
|
|
+ $state.go('app.my_profile');
|
|
};
|
|
};
|
|
- $scope.toprofile = function () {
|
|
|
|
- $state.go('app.my_profile');
|
|
|
|
- };
|
|
|
|
|
|
|
|
//我的设置
|
|
//我的设置
|
|
$scope.setting = function(){
|
|
$scope.setting = function(){
|
|
myService.setting().then(function(result){
|
|
myService.setting().then(function(result){
|
|
-
|
|
|
|
- },function(error){
|
|
|
|
-
|
|
|
|
});
|
|
});
|
|
};
|
|
};
|
|
-
|
|
|
|
- //我的收藏
|
|
|
|
- $scope.collect = function(){
|
|
|
|
- myService.collect().then(function(result){
|
|
|
|
-
|
|
|
|
- },function(error){
|
|
|
|
-
|
|
|
|
- });
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- //我的梦想
|
|
|
|
- $scope.myDream = function(){
|
|
|
|
- myService.myDream().then(function(result){
|
|
|
|
-
|
|
|
|
- },function(error){
|
|
|
|
-
|
|
|
|
- });
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
|
|
+
|
|
//修改个人信息
|
|
//修改个人信息
|
|
$scope.myMaterial = function(){
|
|
$scope.myMaterial = function(){
|
|
myService.myMaterial().then(function(result){
|
|
myService.myMaterial().then(function(result){
|
|
-
|
|
|
|
- },function(error){
|
|
|
|
-
|
|
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}]);
|
|
}]);
|
|
|
|
|
|
- app.controller('profileCtrl', ["$scope", "$state", "storage", "myService", "msg", "common"
|
|
|
|
- , function ($scope, $state, storage, myService, msg, common) {
|
|
|
|
|
|
+ app.controller('profileCtrl', ["$scope", "$state","$filter", "storage", "myService", "msg", "common"
|
|
|
|
+ , function ($scope, $state, $filter, storage, myService, msg, common) {
|
|
$scope.setAvator = function () {
|
|
$scope.setAvator = function () {
|
|
common.setAvator().then(function (result) {
|
|
common.setAvator().then(function (result) {
|
|
debugger;
|
|
debugger;
|
|
@@ -94,8 +61,10 @@
|
|
$scope.$on('$ionicView.beforeEnter', function () {
|
|
$scope.$on('$ionicView.beforeEnter', function () {
|
|
msg.loading();
|
|
msg.loading();
|
|
myService.myIndex().then(function(result){
|
|
myService.myIndex().then(function(result){
|
|
- // alert(JSON.stringify(result.data.data.user));
|
|
|
|
- $scope.vm = result.data.data.user;
|
|
|
|
|
|
+ // alert(JSON.stringify(result.data.data));
|
|
|
|
+ $scope.vm = result.data.data;
|
|
|
|
+ $scope.vm.sex = $scope.vm.sex+'';
|
|
|
|
+ $scope.vm.emotion = $scope.vm.emotion+'';
|
|
if($scope.vm.birthday){
|
|
if($scope.vm.birthday){
|
|
var arr1 = $scope.vm.birthday.split("-");
|
|
var arr1 = $scope.vm.birthday.split("-");
|
|
$scope.vm.birthday1 = new Date(arr1[0],parseInt(arr1[1])-1,arr1[2]);
|
|
$scope.vm.birthday1 = new Date(arr1[0],parseInt(arr1[1])-1,arr1[2]);
|
|
@@ -108,7 +77,6 @@
|
|
});
|
|
});
|
|
|
|
|
|
$scope.saveMaterial = function(){
|
|
$scope.saveMaterial = function(){
|
|
-
|
|
|
|
var data = {
|
|
var data = {
|
|
pic:'http://img.taopic.com/uploads/allimg/130103/240435-1301030P33161.jpg',
|
|
pic:'http://img.taopic.com/uploads/allimg/130103/240435-1301030P33161.jpg',
|
|
sex:$scope.vm.sex,
|
|
sex:$scope.vm.sex,
|
|
@@ -126,6 +94,7 @@
|
|
myService.saveMaterial(data).then(function(result){
|
|
myService.saveMaterial(data).then(function(result){
|
|
msg.hide();
|
|
msg.hide();
|
|
msg.success("保存成功!");
|
|
msg.success("保存成功!");
|
|
|
|
+ $state.go('app.my')
|
|
},function(error){
|
|
},function(error){
|
|
msg.hide();
|
|
msg.hide();
|
|
msg.error(error.data.message);
|
|
msg.error(error.data.message);
|
|
@@ -147,15 +116,16 @@
|
|
}]);
|
|
}]);
|
|
app.controller('rechargeCtrl', ["$scope", "$state", "myService", "msg"
|
|
app.controller('rechargeCtrl', ["$scope", "$state", "myService", "msg"
|
|
, function ($scope, $state, myService, msg) {
|
|
, function ($scope, $state, myService, msg) {
|
|
- $scope.$on('$ionicView.beforeEnter', function () {
|
|
|
|
|
|
+ $scope.$on('$ionicView.beforeEnter', function () {
|
|
|
|
|
|
|
|
+ $scope.vm = {
|
|
|
|
+ money:"",
|
|
|
|
+ }
|
|
});
|
|
});
|
|
//充值
|
|
//充值
|
|
- $scope.recharge = function(){
|
|
|
|
- myService.recharge().then(function(result){
|
|
|
|
-
|
|
|
|
- },function(error){
|
|
|
|
-
|
|
|
|
|
|
+ $scope.recharge = function(money){
|
|
|
|
+ myService.recharge(money).then(function(result){
|
|
|
|
+ $state.go('app.my');
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
@@ -186,14 +156,22 @@
|
|
app.controller('dreamCtrl', ["$scope", "$state", "myService", "msg"
|
|
app.controller('dreamCtrl', ["$scope", "$state", "myService", "msg"
|
|
, function ($scope, $state, myService, msg) {
|
|
, function ($scope, $state, myService, msg) {
|
|
$scope.$on('$ionicView.beforeEnter', function () {
|
|
$scope.$on('$ionicView.beforeEnter', function () {
|
|
-
|
|
|
|
|
|
+ myService.myDream().then(function(result){
|
|
|
|
+ console.log(result.data.data);
|
|
|
|
+ $scope.dreams = result.data.data;
|
|
|
|
+ });
|
|
});
|
|
});
|
|
|
|
+ $scope.toDetail = function (id) {
|
|
|
|
+ $state.go('app.my_dreamdetail',id);
|
|
|
|
+ };
|
|
|
|
|
|
}]);
|
|
}]);
|
|
app.controller('collectCtrl', ["$scope", "$state", "myService", "msg"
|
|
app.controller('collectCtrl', ["$scope", "$state", "myService", "msg"
|
|
, function ($scope, $state, myService, msg) {
|
|
, function ($scope, $state, myService, msg) {
|
|
$scope.$on('$ionicView.beforeEnter', function () {
|
|
$scope.$on('$ionicView.beforeEnter', function () {
|
|
-
|
|
|
|
|
|
+ myService.collect().then(function(result){
|
|
|
|
+ console.log(result.data.data);
|
|
|
|
+ });
|
|
});
|
|
});
|
|
}]);
|
|
}]);
|
|
app.controller('messageSysCtrl', ["$scope", "$state", "myService", "msg"
|
|
app.controller('messageSysCtrl', ["$scope", "$state", "myService", "msg"
|