123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- (function (app) {
- app.controller('myCtrl', ["$scope", "$state", "$http", "storage", "myService", "common", "config", "msg"
- , function ($scope, $state, $http, storage, myService, common, config, msg) {
- $scope.$on('$ionicView.beforeEnter', function (viewResult) {
-
- });
- $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.toprofile = function () {
- $state.go('app.my_profile');
- };
- //我的设置
- $scope.setting = function(){
- 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(){
- myService.myMaterial().then(function(result){
- },function(error){
- })
- }
- }]);
- app.controller('profileCtrl', ["$scope", "$state", "storage", "myService", "msg", "common"
- , function ($scope, $state, storage, myService, msg, common) {
- $scope.setAvator = function () {
- common.setAvator().then(function (result) {
- debugger;
- var response = JSON.parse(result.response);
- $timeout(function () {
- $scope.vm.user.avatar = response.data.md5;
- });
- }, function (error) {
- msg.error(JSON.stringify(error));
- });
- };
- $scope.$on('$ionicView.beforeEnter', function () {
- });
- //保存个人信息
- $scope.vm={
- pic:"",
- sex:"",
- signture:"",
- emotion:"",
- job:"",
- tall:""
- };
- $scope.saveMaterial = function(){
- var data = {
- pic:['http://img.taopic.com/uploads/allimg/130103/240435-1301030P33161.jpg'],
- //pic:$scope.vm.user.avatar,
- sex:$scope.vm.sex,
- signture:$scope.vm.signture,
- emotion:$scope.vm.emotion,
- job:$scope.vm.job,
- tall:$scope.vm.tall
- };
- myService.saveMaterial(data).then(function(result){
- },function(error){
- })
- }
- }]);
- app.controller('settingCtrl', ["$scope", "$state", "myService", "msg","storage"
- , function ($scope, $state,myService, msg, storage) {
- $scope.$on('$ionicView.beforeEnter', function () {
- });
- //退出登陆
- $scope.logout = function(){
- storage.remove("token");
- storage.remove("user");
- $state.go("login");
- }
- }]);
- app.controller('rechargeCtrl', ["$scope", "$state", "myService", "msg"
- , function ($scope, $state, myService, msg) {
- $scope.$on('$ionicView.beforeEnter', function () {
- });
- //充值
- $scope.recharge = function(){
- myService.recharge().then(function(result){
- },function(error){
- });
- }
- }]);
- app.controller('messageCtrl', ["$scope", "$state", "myService", "msg"
- , function ($scope, $state, myService, msg) {
- $scope.$on('$ionicView.beforeEnter', function () {
- });
- //系统消息
- $scope.systemInfo = function(){
- myService.systemInfo().then(function(result){
- },function(error){
- });
- };
- //回复我的
- $scope.replyMy = function(){
- myService.replyMy().then(function(result){
- //$scope.comments = result;
- },function(error){
- });
- };
- }]);
- app.controller('dreamCtrl', ["$scope", "$state", "myService", "msg"
- , function ($scope, $state, myService, msg) {
- $scope.$on('$ionicView.beforeEnter', function () {
- });
- }]);
- app.controller('collectCtrl', ["$scope", "$state", "myService", "msg"
- , function ($scope, $state, myService, msg) {
- $scope.$on('$ionicView.beforeEnter', function () {
- });
- }]);
- app.controller('messageSysCtrl', ["$scope", "$state", "myService", "msg"
- , function ($scope, $state, myService, msg) {
- $scope.$on('$ionicView.beforeEnter', function () {
- });
- }]);
- app.controller('messageReplyCtrl', ["$scope", "$state", "myService", "msg", "$ionicModal"
- , function ($scope, $state, myService, msg, $ionicModal) {
- $ionicModal.fromTemplateUrl('my-modal.html', {
- scope: $scope,
- animation: 'slide-in-up'
- }).then(function (modal) {
- $scope.modal = modal;
- });
- $scope.openModal = function () {
- $scope.modal.show();
- };
- $scope.closeModal = function () {
- $scope.modal.hide();
- };
- $scope.$on('$ionicView.beforeEnter', function () {
- });
- //我的回复
- $scope.vm={
- content:"",
- comment_id:""
- };
- $scope.myReplay = function(){
- var data = {
- content:$scope.vm.content,
- comment_id:$scope.vm.id
- };
- myService.myReplay(data).then(function(result){
- },function(error){
- });
- $scope.modal.hide();
- }
- }]);
-
- })(angular.module('app.controllers'));
|