Browse Source

机构注册选择页面相关逻辑判断

huangct 8 years ago
parent
commit
84b978db3c

+ 111 - 2
donate-console/src/main/webapp/resources/js/index/app.js

@@ -436,14 +436,123 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
     /**
      * 机构入驻选择
      */
-    app.controller('SelectInstitutionsNatureCtrl', ['$scope', 'toaster', 'Organization',
-        function ($scope, toaster, Organization) {
+    app.controller('SelectInstitutionsNatureCtrl', ['$scope', 'toaster', 'Organization', '$location',
+        function ($scope, toaster, Organization, $location) {
             // 获取当前账户注册机构情况
             Organization.getByUuid({uuid : 222222}, {}, function(data) {//10041558
                 $scope.org = data;
             }, function() {
                 toaster.pop('error', '注册情况加载失败');
             });
+
+            //公益机构注册
+            $scope.registerCharityCertification = function () {
+                if (typeof $scope.org.id == 'undefined') {
+                    $location.path('charityCertificationStep0');
+                } else {
+                    if ($scope.org.type == 2) {
+                        //之前已填写过公益机构注册信息
+                        if ($scope.org.publish != 2) {
+                            //未完成或保存为草稿
+                            $location.path('charityCertificationStep1');
+                        } else {
+                            //发布正式
+                            if ($scope.org.status == 0) {
+                                //已发布待审核 (暂时)
+                                $location.path('charityCertificationStep4');
+                            } else if ($scope.org.status == 1) {
+                                //已发布已审核
+                                $location.path('charityCertificationStep4');
+                            } else if ($scope.org.status == 2) {
+                                //已发布已驳回
+                                $location.path('charityCertificationStep1');
+                            }
+                        }
+                    } else if ($scope.org.type == 1) {
+                        //之前填写过公募机构注册信息
+                        if ($scope.org.publish != 2) {
+                            //未完成或保存为草稿
+                            //TODO 模态框判断
+                            var decideContinue = false;
+                            if (decideContinue) {
+                                //TODO 继续注册公益机构并替换掉之前的公募机构注册信息
+                                $location.path('charityCertificationStep0');
+                            } else {
+                                //TODO 继续之前的公募机构注册信息
+                                toaster.pop('info', '继续之前的公募机构注册信息');
+                                $location.path('publicOfferingCertificationStep1');
+                            }
+                        } else {
+                            //发布正式
+                            if ($scope.org.status == 0) {
+                                //已发布待审核 (暂时)
+                                $location.path('publicOfferingCertificationStep5');
+                            } else if ($scope.org.status == 1) {
+                                //已发布已审核
+                                $location.path('publicOfferingCertificationStep5');
+                            } else if ($scope.org.status == 2) {
+                                //已发布已驳回
+                                $location.path('publicOfferingCertificationStep1');
+                            }
+                        }
+                    }
+                }
+            }
+
+            //公募机构注册
+            $scope.registerPublicOfferingCertification = function () {
+                if (typeof $scope.org.id == 'undefined') {
+                    $location.path('publicOfferingCertificationStep0');
+                } else {
+                    if ($scope.org.type == 1) {
+                        //之前已填写过公募机构注册信息
+                        if ($scope.org.publish != 2) {
+                            //未完成或保存为草稿
+                            $location.path('publicOfferingCertificationStep1');
+                        } else {
+                            //发布正式
+                            if ($scope.org.status == 0) {
+                                //已发布待审核 (暂时)
+                                $location.path('publicOfferingCertificationStep5');
+                            } else if ($scope.org.status == 1) {
+                                //已发布已审核
+                                $location.path('publicOfferingCertificationStep5');
+                            } else if ($scope.org.status == 2) {
+                                //已发布已驳回
+                                $location.path('publicOfferingCertificationStep1');
+                            }
+                        }
+                    } else if ($scope.org.type == 2) {
+                        //之前填写过公益机构注册信息
+                        if ($scope.org.publish != 2) {
+                            //未完成或保存为草稿
+                            //TODO 模态框判断
+                            var decideContinue = false;
+                            if (decideContinue) {
+                                //TODO 继续注册公募机构并替换掉之前的公益机构注册信息
+                                $location.path('publicOfferingCertificationStep0');
+                            } else {
+                                //TODO 继续之前的公益机构注册信息
+                                toaster.pop('info', '继续之前的公益机构注册信息');
+                                $location.path('charityCertificationStep1');
+                            }
+                        } else {
+                            //发布正式
+                            if ($scope.org.status == 0) {
+                                //已发布待审核 (暂时)
+                                $location.path('charityCertificationStep4');
+                            } else if ($scope.org.status == 1) {
+                                //已发布已审核
+                                $location.path('charityCertificationStep4');
+                            } else if ($scope.org.status == 2) {
+                                //已发布已驳回
+                                $location.path('charityCertificationStep1');
+                            }
+                        }
+                    }
+                }
+            }
+
         }]);
 
     /**

+ 2 - 53
donate-console/src/main/webapp/resources/view/user/selectInstitutionsNature.html

@@ -100,67 +100,16 @@
                     <p class="choose-txt">请选择适合您的身份,完成以下注册和认证,以便快速发布公益项目。</p>
                     <div class="choose-about">
                         <div class="choose-item">
-                            <a ng-if="org.id == null || org.publish == 1" ui-sref="charityCertificationStep0">
+                            <a ng-click="registerCharityCertification()">
                                 <div class="img">
                                     <img src="static/images/non-public.png" alt=""/>
                                 </div>
                                 <p>公益机构</p>
                                 <span>适合慈善组织(务公开募捐资格证书)、民办非企业单位、社会团体、企业等,不具备直接面向公众募捐的性质</span>
                             </a>
-
-                            <a ng-if="org.publish == 2 && org.status == 0" ui-sref="charityCertificationStep4"><!--跳到待审核页面-->
-                                <div class="img">
-                                    <img src="static/images/non-public.png" alt=""/>
-                                </div>
-                                <p>公益机构</p>
-                                <span>适合慈善组织(务公开募捐资格证书)、民办非企业单位、社会团体、企业等,不具备直接面向公众募捐的性质</span>
-                            </a>
-
-                            <a ng-if="org.publish == 2 && org.status == 1" ui-sref="charityCertificationStep4"><!--跳到已批准页面-->
-                                <div class="img">
-                                    <img src="static/images/non-public.png" alt=""/>
-                                </div>
-                                <p>公益机构</p>
-                                <span>适合慈善组织(务公开募捐资格证书)、民办非企业单位、社会团体、企业等,不具备直接面向公众募捐的性质</span>
-                            </a>
-
-                            <a ng-if="org.publish == 2 && org.status == 2" href="#"><!--跳到批准不通过页面-->
-                                <div class="img">
-                                    <img src="static/images/non-public.png" alt=""/>
-                                </div>
-                                <p>公益机构</p>
-                                <span>适合慈善组织(务公开募捐资格证书)、民办非企业单位、社会团体、企业等,不具备直接面向公众募捐的性质</span>
-                            </a>
-
-
-
                         </div>
                         <div class="choose-item">
-                            <a ng-if="org.id == null || org.publish == 1" ui-sref="publicOfferingCertificationStep0">
-                                <div class="img">
-                                    <img src="static/images/public.png" alt=""/>
-                                </div>
-                                <p>慈善组织(公募)</p>
-                                <span>适合民证部批准,持有法人登记证书、公开募捐资格证书,具备向公众募捐集资金性质的公募基金会。</span>
-                            </a>
-
-                            <a ng-if="org.publish == 2 && org.status == 0" ui-sref="publicOfferingCertificationStep5">
-                                <div class="img">
-                                    <img src="static/images/public.png" alt=""/>
-                                </div>
-                                <p>慈善组织(公募)</p>
-                                <span>适合民证部批准,持有法人登记证书、公开募捐资格证书,具备向公众募捐集资金性质的公募基金会。</span>
-                            </a>
-
-                            <a ng-if="org.publish == 2 && org.status == 1" ui-sref="publicOfferingCertificationStep5">
-                                <div class="img">
-                                    <img src="static/images/public.png" alt=""/>
-                                </div>
-                                <p>慈善组织(公募)</p>
-                                <span>适合民证部批准,持有法人登记证书、公开募捐资格证书,具备向公众募捐集资金性质的公募基金会。</span>
-                            </a>
-
-                            <a ng-if="org.publish == 2 && org.status == 2" href="#">
+                            <a ng-click="registerPublicOfferingCertification()">
                                 <div class="img">
                                     <img src="static/images/public.png" alt=""/>
                                 </div>