123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- (function (app) {
- app.controller('addCtrl', ["$scope", "$state", "storage", "myService", "msg", "$ionicTabsDelegate", "$ionicNavBarDelegate", "$ionicModal", "$ionicHistory", "common"
- , function ($scope, $state, storage, myService, msg, $ionicTabsDelegate, $ionicNavBarDelegate, $ionicModal, $ionicHistory, common) {
- $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={
- dream:'',
- about:'',
- money:""
- };
- $scope.imgs = [];
- $scope.videos = [];
- $scope.addpict = function () {
- common.chooseImage().then(function (img) {
- common.uploadFiles(img,1).then(function (result) {
- var response = JSON.parse(result.response);
- var file = response.data.file;
- $scope.imgs.push(file);
- }, function (erro) {
- msg.erro('图片上传失败');
- });
- }, function (erro) {
- msg.erro('图片选择失败');
- });
- }
- $scope.addvideo = function () {
- var options = { limit: 1, duration:20};
- navigator.device.capture.captureVideo(function (videos) {
- $scope.videos.push(videos[0].fullPath);
- common.uploadFiles(videos[0].fullPath, 2).then(function (result) {
- debugger;
- var response = JSON.parse(result.response);
- var file = response.data.file;
- debugger;
- }, function (erro) {
- debugger;
- msg.erro('视频上传失败');
- });
- }, function (erro) {
- debugger;
- }, options);
- }
- $scope.add=function ()
- {
- var data={
- pic:'http://img.taopic.com/uploads/allimg/130103/240435-1301030P33161.jpg',
- dream:$scope.vm.dream,
- about:$scope.vm.about,
- money:$scope.vm.money
- };
- myService.add(data).then(function(result){
- },function(erro){
- });
- }
- $scope.$on('$ionicView.beforeEnter', function (viewResult) {
- $ionicTabsDelegate.showBar(false);
- $ionicNavBarDelegate.showBackButton(true);
- });
- $scope.$on('$ionicView.leave', function () {
- $ionicTabsDelegate.showBar(true);
- });
- }]);
- })(angular.module('app.controllers'));
|