Browse Source

发起项目修改

dongbw 8 years ago
parent
commit
f8bbfcb821
1 changed files with 10 additions and 4 deletions
  1. 10 4
      donate-console/src/main/webapp/resources/js/index/app.js

+ 10 - 4
donate-console/src/main/webapp/resources/js/index/app.js

@@ -37,7 +37,7 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
             templateUrl : 'static/view/project/project_launch_1.html',
             controller : 'ProjectNewCtrl'
         }).state("launchProject2", {
-            url : '/launchProject/detail',
+            url : '/launchProject/detail/:id',
             title : '项目发起2',
             templateUrl : 'static/view/project/project_launch_2.html',
             controller : 'ProjectNewCtrl'
@@ -765,8 +765,8 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
     /**
      * 新建项目
      */
-    app.controller('ProjectNewCtrl', ['$scope', 'BaseService', 'Project', '$http', 'toaster',
-        function($scope, BaseService, Project, $http, toaster) {
+    app.controller('ProjectNewCtrl', ['$scope', 'BaseService', 'Project', '$http', 'toaster', '$stateParams',
+        function($scope, BaseService, Project, $http, toaster, $stateParams) {
 
         // 捐助领域
         $scope.areas = ['疾病援助', '扶贫/救灾', '教育/助学' , '环境/动物保护', '其他'];
@@ -796,6 +796,12 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
                     $scope.project = data;
                 }
             });
+
+            if (!angular.isUndefined($stateParams.id)) {
+              Project.getDetailById({id : $stateParams.id}, {}, function(data) {
+                  $scope.project = data;
+              });
+            };
         };
         getSavedProject();
 
@@ -826,7 +832,7 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
             Project.saveBaseInfo({}, project, function(data) {
                 $scope.project = data;
                 BaseService.scrollBackToTop();
-                window.location.hash = '#/launchProject/detail';
+                window.location.hash = '#/launchProject/detail/' + $scope.project.id;
             }, function(response) {
                 toaster.pop('error', '出现错误');
             });