123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361 |
- (function (app) {
- app.controller('myCtrl', ["$scope","$ionicTabsDelegate", "$state", "$http", "storage", "myService", "common", "config", "msg","$timeout"
- , function ($scope,$ionicTabsDelegate, $state, $http, storage, myService, common, config, msg, $timeout) {
- $scope.$on('$ionicView.beforeEnter', function (viewResult) {
- $ionicTabsDelegate.showBar(true);
- myService.myInfo().then(function(result){
- console.log(result.data.data);
- $scope.user = result.data.data
- });
- });
- $scope.setAvator = function () {
- common.setAvator().then(function (result) {
- var response = JSON.parse(result.response);
- $timeout(function () {
- $scope.vm.avatar = response.data.file;
- });
- });
- };
- }]);
- app.controller('profileCtrl', ["$scope", "$ionicTabsDelegate","$state","$filter", "storage", "myService", "msg", "common"
- , function ($scope,$ionicTabsDelegate, $state, $filter, storage, myService, msg, common) {
- $scope.$on('$ionicView.beforeEnter', function () {
- $ionicTabsDelegate.showBar(false);
- });
- $scope.setAvator = function () {
- common.setAvator().then(function (result) {
- var response = JSON.parse(result.response);
- $timeout(function () {
- $scope.vm.avatar = response.data.file;
- });
- });
- };
-
- //保存个人信息
- $scope.vm={
- pic:"",
- sex:"",
- signture:"",
- emotion:"",
- job:"",
- tall:""
- };
- $scope.$on('$ionicView.beforeEnter', function () {
- msg.loading();
- myService.myInfo().then(function(result){
- // 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){
- var arr1 = $scope.vm.birthday.split("-");
- $scope.vm.birthday1 = new Date(arr1[0],parseInt(arr1[1])-1,arr1[2]);
- }
- msg.hide();
- },function(error){
- msg.hide();
- // msg.error(error.data.message);
- })
- });
-
- $scope.saveMaterial = function(){
- var data = {
- sex:$scope.vm.sex,
- signture:$scope.vm.signture,
- emotion:$scope.vm.emotion,
- work:$scope.vm.work,
- height:$scope.vm.height,
- city:$scope.vm.city
- };
- if($scope.vm.birthday1){
- data.birthday = $filter('date')($scope.vm.birthday1, "yyyy-MM-dd");
- }
- if($scope.vm.avatar){
- data.pic = $scope.vm.avatar;
- }
- msg.loading('提交中...');
-
- myService.saveMaterial(data).then(function(result){
- msg.hide();
- msg.success("保存成功!");
- $state.go('app.my');
- myService.myInfo();
- },function(error){
- msg.hide();
- msg.error(error.data.message);
- })
- }
- }]);
- app.controller('settingCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
- , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
- $scope.$on('$ionicView.beforeEnter', function () {
- $ionicTabsDelegate.showBar(false);
- });
- //退出登陆
- $scope.logout = function(){
- storage.remove("token");
- storage.remove("user");
- $state.go("login");
- }
- }]);
- app.controller('aboutMiaoCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
- , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
- }]);
- app.controller('withdrawCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
- , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
- }]);
- app.controller('payoutCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
- , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
- }]);
- app.controller('payExplainCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
- , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
- }]);
- app.controller('explainCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
- , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
- }]);
- app.controller('contactCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
- , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
- }]);
- app.controller('attentionCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
- , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
- $scope.toDetail = function(){
- $state.go("app.attention_Detail");
- }
- }]);
- app.controller('attention_DetailCtrl', ["$scope", "$state", "$ionicModal","storage","msg", "common", "config", "homeService", "$ionicTabsDelegate", "$stateParams", "$ionicModal", "$timeout", "$ionicScrollDelegate", "$interval"
- , function ($scope, $state,$ionicModal, storage , msg, common, config, homeService, $ionicTabsDelegate, $stateParams, $ionicModal, $timeout, $ionicScrollDelegate, $interval) {
- var id = $stateParams.id;
- $scope.$on('$ionicView.beforeEnter', function () {
- $ionicTabsDelegate.showBar(false);
- });
- $scope.load = function (id) {
- msg.loading();
- homeService.dreamDetail(id).then(function (result) {
- msg.hide();
- $scope.user = result.data.data;
- }, function (error) {
- msg.hide();
- });
- };
- $scope.load(id);
- $scope.cancelSupport = function () {
- $scope.tosupport = false;
- $scope.toshare = false;
- };
- $scope.toshare = false;
- $scope.share = function ($event) {
- $event.stopPropagation();
- $scope.toshare = true;
- };
- $scope.shareDream = function(){
- $state.go("app.shareDream",{item:$scope.user});
- };
- $scope.toDetail = function (id) {
- $state.go('app.my_dreamdetail',{id:id});
- };
- $scope.toOldDream = function(){
- $state.go("app.myOldDream");
- };
- $scope.toSupportDream = function(){
- $state.go("app.mySupportDream");
- };
- }]);
- app.controller('messageReplyCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
- , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
- }]);
- app.controller('personalLetterCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
- , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
- }]);
- app.controller('rechargeCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg"
- , function ($scope, $ionicTabsDelegate,$state, myService, msg) {
- $scope.$on('$ionicView.beforeEnter', function () {
- $ionicTabsDelegate.showBar(false);
- myService.myInfo().then(function(result){
- $scope.vm = result.data.data;
- $scope.vm.money = '';
- })
- });
- $scope.payExplain = function(){
- $state.go("app.payExplain")
- };
- $scope.withdraw = function(){
- $state.go("app.withdraw")
- };
- //充值
- $scope.recharge = function(money){
- myService.recharge(money).then(function(result){
- msg.text("充值成功");
- $state.go('app.my');
- });
- }
- }]);
- app.controller('payCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg"
- , function ($scope,$ionicTabsDelegate, $state, myService, msg) {
- $scope.$on('$ionicView.beforeEnter', function () {
- myService.myInfo().then(function(result){
- $scope.vm = result.data.data;
- $scope.vm.money = '';
- })
- });
- $scope.payExplain = function(){
- $state.go("app.explain")
- };
- $scope.withdraw = function(){
- $state.go("app.payout")
- };
- //充值
- $scope.recharge = function(money){
- myService.recharge(money).then(function(result){
- msg.text("充值成功");
- $state.go('app.my');
- });
- }
- }]);
- app.controller('messageCtrl', ["$scope", "$ionicTabsDelegate","$state", "myService", "msg"
- , function ($scope,$ionicTabsDelegate, $state, myService, msg) {
- $scope.$on('$ionicView.beforeEnter', function () {
- $ionicTabsDelegate.showBar(false);
- });
- //系统消息
- $scope.systemInfo = function(){
- $state.go("app.my_message_sys");
- myService.systemInfo().then(function(result){
- },function(error){
- });
- };
- //回复我的
- $scope.replyMy = function(){
- $state.go("app.my_message_reply");
- myService.replyMy().then(function(result){
- //$scope.comments = result;
- },function(error){
- });
- };
- $scope.personalLetter = function(){
- $state.go("app.personalLetter");
- }
- }]);
- app.controller('homeMessageCtrl', ["$scope", "$ionicTabsDelegate","$state", "myService", "msg"
- , function ($scope,$ionicTabsDelegate, $state, myService, msg) {
- $scope.$on('$ionicView.beforeEnter', function () {
- $ionicTabsDelegate.showBar(false);
- });
- //系统消息
- $scope.systemInfo = function(){
- $state.go("app.message_sys");
- myService.systemInfo().then(function(result){
- },function(error){
- });
- };
- //回复我的
- $scope.replyMy = function(){
- $state.go("app.message_reply");
- myService.replyMy().then(function(result){
- //$scope.comments = result;
- },function(error){
- });
- };
- $scope.personalLetter = function(){
- $state.go("app.letter");
- }
- }]);
- app.controller('dreamCtrl', ["$scope", "$ionicTabsDelegate","$state", "myService", "msg"
- , function ($scope, $ionicTabsDelegate,$state, myService, msg) {
- $scope.$on('$ionicView.beforeEnter', function () {
- $ionicTabsDelegate.showBar(false);
- myService.myDream().then(function(result){
- $scope.dreams = result.data.data;
- });
- myService.myInfo().then(function(result){
- $scope.user = result.data.data
- });
- });
- $scope.toDetail = function (id) {
- $state.go('app.my_dreamdetail',{id:id});
- };
- }]);
- app.controller('collectCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg"
- , function ($scope, $ionicTabsDelegate,$state, myService, msg) {
- $scope.$on('$ionicView.beforeEnter', function () {
- $ionicTabsDelegate.showBar(false);
- myService.collect().then(function(result){
- $scope.dreams = result.data.data.dreams;
- $scope.users = result.data.data.users;
- });
- });
- $scope.toDetail = function (id) {
- $state.go('app.my_dreamdetail',{id:id});
- };
- }]);
- app.controller('messageSysCtrl', ["$scope", "$ionicTabsDelegate","$state", "myService", "msg"
- , function ($scope,$ionicTabsDelegate, $state, myService, msg) {
- }]);
- app.controller('sysCtrl', ["$scope", "$ionicTabsDelegate","$state", "myService", "msg"
- , function ($scope,$ionicTabsDelegate, $state, myService, msg) {
- }]);
- app.controller('letterCtrl', ["$scope", "$ionicTabsDelegate","$state", "myService", "msg"
- , function ($scope,$ionicTabsDelegate, $state, myService, msg) {
- }]);
- app.controller('messageReplyCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg", "$ionicModal"
- , function ($scope,$ionicTabsDelegate, $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.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'));
|