Browse Source

前台登录;后台发起活动部分问题。

dongbw 8 years ago
parent
commit
d9083014ec
30 changed files with 290 additions and 222 deletions
  1. 5 1
      donate-console/src/main/java/com/uas/console/donate/controller/ActivityController.java
  2. 3 1
      donate-console/src/main/java/com/uas/console/donate/service/impl/ActivityServiceImpl.java
  3. 1 0
      donate-console/src/main/webapp/WEB-INF/views/index.html
  4. 1 5
      donate-console/src/main/webapp/resources/css/base.css
  5. 5 8
      donate-console/src/main/webapp/resources/js/common/services.js
  6. 24 15
      donate-console/src/main/webapp/resources/js/index/app.js
  7. 1 1
      donate-console/src/main/webapp/resources/view/activity/activity_launch.html
  8. 1 1
      donate-service/src/main/java/com/uas/service/donate/Application.java
  9. 8 2
      donate-service/src/main/java/com/uas/service/donate/SSOConfiguration.java
  10. 36 7
      donate-service/src/main/java/com/uas/service/donate/controller/SecurityController.java
  11. 2 0
      donate-service/src/main/java/com/uas/service/donate/web/filter/SSOInterceptor.java
  12. 2 0
      donate-service/src/main/webapp/WEB-INF/views/activity.html
  13. 2 0
      donate-service/src/main/webapp/WEB-INF/views/approval.html
  14. 1 0
      donate-service/src/main/webapp/WEB-INF/views/project.html
  15. 2 0
      donate-service/src/main/webapp/WEB-INF/views/userAgreement.html
  16. 2 0
      donate-service/src/main/webapp/WEB-INF/views/userCenter.html
  17. 1 1
      donate-service/src/main/webapp/resources/js/activity/main.js
  18. 1 1
      donate-service/src/main/webapp/resources/js/approval/main.js
  19. 53 116
      donate-service/src/main/webapp/resources/js/common/controllers/commonCtrls.js
  20. 2 1
      donate-service/src/main/webapp/resources/js/common/query/User.js
  21. 24 27
      donate-service/src/main/webapp/resources/js/common/services.js
  22. 3 1
      donate-service/src/main/webapp/resources/js/project/controllers/ProjectDetailCtrl.js
  23. 2 0
      donate-service/src/main/webapp/resources/js/project/controllers/ProjectListCtrl.js
  24. 1 1
      donate-service/src/main/webapp/resources/js/project/main.js
  25. 1 1
      donate-service/src/main/webapp/resources/js/user/main.js
  26. 62 0
      donate-service/src/main/webapp/resources/view/common/logout.html
  27. 20 11
      donate-service/src/main/webapp/resources/view/common/nav.html
  28. 8 5
      donate-service/src/main/webapp/resources/view/project/project_detail.html
  29. 1 1
      donate-service/src/main/webapp/resources/view/project/project_detail_side.html
  30. 15 15
      donate-service/src/main/webapp/resources/view/project/project_list.html

+ 5 - 1
donate-console/src/main/java/com/uas/console/donate/controller/ActivityController.java

@@ -6,6 +6,7 @@ import com.uas.console.donate.model.*;
 import com.uas.console.donate.service.ActivityRecodeService;
 import com.uas.console.donate.service.ActivityService;
 import com.uas.console.donate.service.AwardService;
+import com.uas.console.donate.util.StringUtils;
 import com.uas.dfs.service.FileClient;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.PageParams;
@@ -295,7 +296,10 @@ public class ActivityController {
     @RequestMapping(value = "/getActivityRelatedProjects", method = RequestMethod.GET)
     @ResponseBody
     public List<Project> getActivityRelatedProjects(String keyword, String selectedIds) {
-        List<Long> proIds = JSONObject.parseArray(selectedIds, Long.class);
+        List<Long> proIds = new ArrayList<>();
+        if (!StringUtils.isEmpty(selectedIds)) {
+            proIds = JSONObject.parseArray(selectedIds, Long.class);
+        }
         return activityService.getActivityRelatedProjects(keyword, proIds);
     }
 

+ 3 - 1
donate-console/src/main/java/com/uas/console/donate/service/impl/ActivityServiceImpl.java

@@ -199,7 +199,9 @@ public class ActivityServiceImpl implements ActivityService{
     public List<Project> getActivityRelatedProjects(final String keyword, final List<Long> proIds) {
         // 获取所有已被关联的项目id
         List<Long> relatedIds = projectDao.getProjectIdsRelated();
-        proIds.addAll(relatedIds);
+        if (!CollectionUtils.isEmpty(relatedIds)) {
+            proIds.addAll(relatedIds);
+        }
         // 默认返回100条
         final PageInfo pageInfo = new PageInfo(1, 100);
         return projectDao.findAll(new Specification<Project>() {

+ 1 - 0
donate-console/src/main/webapp/WEB-INF/views/index.html

@@ -57,6 +57,7 @@
                     <li class="dropdown user user-menu">
                         <a href="#" class="dropdown-toggle">
                             <span class="hidden-xs" ng-bind="userInfo.name"></span>
+                            <i class="fa fa-user fa-lg"></i>
                             <!--<img src="static/images/avatar.jpg" class="user-image">-->
                         </a>
                     </li>

+ 1 - 5
donate-console/src/main/webapp/resources/css/base.css

@@ -223,11 +223,6 @@ input,button,select,textarea{outline:none}
 	opacity: .7
 }
 
-button[disabled] {
-	cursor: not-allowed;
-	background-color: #a0a0a0;
-}
-
 /*loading*/
 .loading {
 	display: none;
@@ -266,4 +261,5 @@ input.ng-invalid.ng-dirty, textarea.ng-invalid.ng-dirty {
 /*按钮不可用*/
 button[disabled] {
 	background-color: #a0a0a0!important;
+	cursor: not-allowed !important;
 }

+ 5 - 8
donate-console/src/main/webapp/resources/js/common/services.js

@@ -176,13 +176,10 @@ define([ 'angular', 'common/utils', 'ngResource'], function(angular, utils, Big)
 				logout.success(uncacheSession);
 				logout.success(function(data){
 					var pathName = document.location.pathname;
-					/*var str = pathName.replace('platform-b2c/','');
-					console.log(str);
-					console.log(document.location);*/
-					var index = pathName.substr(1).indexOf("/");// platform-b2c/logout/proxy
+					var index = pathName.substr(1).indexOf("/");
 					var result = pathName.substr(0,index);
 					var uri = pathName.substr(13,index+1000) + document.location.hash;
-					if (result == '/platform-b2c') {
+					if (result == '/') {
 						var contextPath = ''
 						/*var contextPath = (function getContextPath() {
 							var pathName = document.location.pathname;
@@ -255,9 +252,9 @@ define([ 'angular', 'common/utils', 'ngResource'], function(angular, utils, Big)
 				request.error(uncacheSession);
 				return request;
 			},
-			reSignin : function(enUU) {
-				return $http.get(rootPath + '/user/authentication/' + enUU);
-			}
+			// reSignin : function(enUU) {
+			// 	return $http.get(rootPath + '/user/authentication/' + enUU);
+			// }
 		};
 	}]).factory('TableService', ['$parse', 'ngTableParams', function($parse, ngTableParams){
 		var scope;

+ 24 - 15
donate-console/src/main/webapp/resources/js/index/app.js

@@ -161,7 +161,8 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
         return url;
     };
 
-    app.controller('AuthCtrl', ['$scope', '$window', 'AuthenticationService', 'toaster', 'BaseService', '$modal', function ($scope, $window, AuthenticationService, toaster, BaseService, $modal) {
+    app.controller('AuthCtrl', ['$scope', '$window', 'AuthenticationService', 'toaster', 'BaseService', '$modal', 'SessionService',
+        function ($scope, $window, AuthenticationService, toaster, BaseService, $modal, SessionService) {
         $scope.isAuthed = AuthenticationService.isAuthed();		//AuthenticationService模块在common/下
 
         AuthenticationService.getAuthentication().success(function (data) {
@@ -171,22 +172,24 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
             if (data == null || !data.content) {
                 $scope.isAuthed = false;
                 AuthenticationService.redirectSignin();
-            } else {
-                //跳转到手机号码验证
-//				checkTel($scope.userInfo);
             }
         });
 
-        $scope.logout = function () {
-            $modal.open({
-                templateUrl: 'static/view/user/logout.html',
-                controller: 'LogOutCtrl'
-            }).result.then(function (s) {
-                if (s) {
-                    AuthenticationService.logout();
-                }
+        $scope.logout = function() {
+            AuthenticationService.logout().success(function() {
+                SessionService.removeCookie($rootScope.userInfo.userUU);
             });
         };
+        // $scope.logout = function () {
+        //     $modal.open({
+        //         templateUrl: 'static/view/user/logout.html',
+        //         controller: 'LogOutCtrl'
+        //     }).result.then(function (s) {
+        //         if (s) {
+        //             AuthenticationService.logout();
+        //         }
+        //     });
+        // };
 
     }]);
 
@@ -2160,6 +2163,9 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
 
         // 添加奖品
         $scope.addAward = function() {
+            if (angular.isUndefined($scope.awards)) {
+                $scope.awards = [];
+            }
             if ($scope.awards.length >= 4) {
                 toaster.pop('warning', '提示', '最多可添加四个奖品');
             } else {
@@ -2259,9 +2265,12 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
             $scope.selectedProjects = angular.copy($scope.tempSelectedProjects);
         };
 
-        // 刷新
-        $scope.refresh = function() {
-            window.location.reload();
+        // 清空内容
+        $scope.clearActivity = function() {
+            $scope.activity = {
+                awards:[],
+                projects: []
+            };
         };
 
         // 图片上传

+ 1 - 1
donate-console/src/main/webapp/resources/view/activity/activity_launch.html

@@ -658,7 +658,7 @@
                             <div class="button">
                                 <button ng-click="submit(true)" ng-disabled="activityForm.$invalid || !activity.summary || !actImgUrl || !bannerUrl" class="launch">发布</button>
                                 <button ng-click="submit(false)" class="draft">存为草稿</button>
-                                <span class="clear" ng-click="refresh()">清空内容</span>
+                                <span class="clear" ng-click="clearActivity()">清空内容</span>
                             </div>
                         </div>
                     </div>

+ 1 - 1
donate-service/src/main/java/com/uas/service/donate/Application.java

@@ -9,7 +9,7 @@ import org.springframework.context.ApplicationListener;
 import org.springframework.context.annotation.ImportResource;
 import org.springframework.web.bind.annotation.RestController;
 
-@SpringBootApplication
+@SpringBootApplication(scanBasePackages = "com.uas.service.donate")
 @RestController
 @ImportResource("classpath:spring/*.xml")
 @EnableConfigurationProperties({WxPayProperties.class})

+ 8 - 2
donate-service/src/main/java/com/uas/service/donate/SSOConfiguration.java

@@ -6,6 +6,7 @@ import com.uas.service.donate.profile.Prod;
 import com.uas.service.donate.profile.Test;
 import com.uas.service.donate.util.ContextUtils;
 import com.uas.service.donate.web.filter.SSOInterceptor;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
@@ -22,14 +23,19 @@ import java.util.Properties;
 @Configuration
 public class SSOConfiguration extends WebMvcConfigurerAdapter {
 
+    @Autowired
+    private SSOInterceptor ssoInterceptor;
 
     @Override
     public void addInterceptors(InterceptorRegistry registry) {
         /**
          * 拦截器配置
          */
-//        registry.addInterceptor(new SSOInterceptor()).addPathPatterns("/**").
-//                excludePathPatterns("/WEB-INF/**","/**/static/**", "/sso/login/**", "/sso/logout/**");
+        registry.addInterceptor(ssoInterceptor).addPathPatterns("/**").
+                excludePathPatterns("/WEB-INF/**","/**/static/**", "/sso/login/**", "/sso/logout/**",
+                        "/", "/project/**", "/activity/**","/carousels/**", "/message/**",
+                        "/org/**", "/projectconclude/**", "/projectevolve/**", "/projectfinance/**",
+                        "/projectrecode/**", "/wxpay/**", "/alipay/**");
     }
 
     @Bean

+ 36 - 7
donate-service/src/main/java/com/uas/service/donate/controller/SecurityController.java

@@ -49,15 +49,20 @@ public class SecurityController extends CommonController {
      * @throws IOException
      */
     @RequestMapping(value = "/login", method = RequestMethod.GET)
-    public ModelMap getLoginPage() throws IOException {
+    public ModelMap getLoginPage(HttpServletRequest request, HttpServletResponse response, String returnUrl) throws IOException {
         SSOHelper.clearLogin(request, response);
-        String url= SSOHelper.getRedirectRefererLoginUrl(request);
+        String redirectUrl = null;
+        if (org.apache.commons.lang3.StringUtils.isEmpty(returnUrl)) {
+            redirectUrl = SSOHelper.getRedirectRefererLoginUrl(request);
+        } else {
+            redirectUrl = SSOHelper.getRedirectLoginUrl(request, returnUrl);
+        }
         boolean cross = SSOHelper.isCrossDomain(request);
         if (cross) {
             // 跨域代理界面
-            url = "login/proxy";
+            redirectUrl = request.getContextPath() + "/login/proxy";
         }
-        return success(url);
+        return new ModelMap("content", redirectUrl);
     }
 
     /**
@@ -67,11 +72,13 @@ public class SecurityController extends CommonController {
      */
     @RequestMapping(value = "/logout", method = RequestMethod.GET, headers = "Accept=application/json")
     @ResponseStatus(value= HttpStatus.OK)
-    public ModelMap logout(HttpServletRequest request, HttpServletResponse response, HttpSession session) throws IOException {
+    public ModelMap logout(HttpServletRequest request, HttpServletResponse response, HttpSession session, String returnUrl) throws IOException {
         session.invalidate();
         SSOHelper.clearLogin(request, response);
         SystemSession.clear();
-        String returnUrl = request.getHeader("Referer");
+        if (StringUtils.isEmpty(returnUrl)) {
+            returnUrl = request.getHeader("Referer");
+        }
         boolean cross = SSOHelper.isCrossDomain(request);
         if (cross) {
             request.getSession().setAttribute(SSOConfig.SSOReferer, returnUrl);
@@ -89,7 +96,7 @@ public class SecurityController extends CommonController {
      * @return
      * @throws IOException
      */
-    @RequestMapping(value = "/login/page")
+    @RequestMapping(value = "/login/page", method = RequestMethod.POST)
     @ResponseBody
     public ModelMap signin(HttpServletRequest request, HttpServletResponse response) throws IOException {
         request.getSession().setAttribute(SSOConfig.SSOReferer, request.getHeader("Referer"));
@@ -198,4 +205,26 @@ public class SecurityController extends CommonController {
         return model;
     }
 
+    /**
+     * 获取跳转注册的url
+     *
+     * @param request
+     * @param response
+     * @return
+     * @throws IOException
+     */
+    @RequestMapping(value = "/register/page")
+    @ResponseBody
+    public ModelMap register(HttpServletRequest request, HttpServletResponse response, String returnUrl) throws IOException {
+        request.getSession().setAttribute(SSOConfig.SSOReferer, returnUrl );
+        SSOHelper.clearLogin(request, response);
+        String redirectUrl = null;
+        if (org.apache.commons.lang3.StringUtils.isEmpty(returnUrl)) {
+            redirectUrl = SSOHelper.getRedirectRefererRegisterUrl(request);
+        } else {
+            redirectUrl = SSOHelper.getRedirectRegisterUrl(request, returnUrl);
+        }
+        return new ModelMap("content", redirectUrl);
+    }
+
 }

+ 2 - 0
donate-service/src/main/java/com/uas/service/donate/web/filter/SSOInterceptor.java

@@ -9,6 +9,7 @@ import com.uas.service.donate.util.StringUtils;
 import com.uas.sso.SSOHelper;
 import com.uas.sso.SSOToken;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -16,6 +17,7 @@ import javax.servlet.http.HttpServletResponse;
 /**
  * 登录拦截
  */
+@Component
 public class SSOInterceptor extends AbstractSSOInterceptor {
 
 	@Autowired

+ 2 - 0
donate-service/src/main/webapp/WEB-INF/views/activity.html

@@ -11,6 +11,8 @@
     <!--css begin-->
     <link href="static/images/icon/u.png" rel="icon" type="image/x-icon" />
     <link rel="stylesheet" href="static/lib/bootstrap/css/bootstrap.min.css">
+    <link rel="stylesheet" href="static/lib/font-awesome/css/font-awesome.min.css">
+    <link rel="stylesheet" href="static/lib/angular/toaster.css">
     <link rel="stylesheet" href="static/css/base.css">
     <style>
         body{

+ 2 - 0
donate-service/src/main/webapp/WEB-INF/views/approval.html

@@ -11,6 +11,8 @@
     <!--css begin-->
     <link href="static/images/icon/u.png" rel="icon" type="image/x-icon" />
     <link rel="stylesheet" href="static/lib/bootstrap/css/bootstrap.min.css">
+    <link rel="stylesheet" href="static/lib/font-awesome/css/font-awesome.min.css">
+    <link rel="stylesheet" href="static/lib/angular/toaster.css">
     <link rel="stylesheet" href="static/css/base.css">
     <style>
         body{

+ 1 - 0
donate-service/src/main/webapp/WEB-INF/views/project.html

@@ -11,6 +11,7 @@
     <!--css begin-->
     <link href="static/images/icon/u.png" rel="icon" type="image/x-icon" />
     <link rel="stylesheet" href="static/lib/bootstrap/css/bootstrap.min.css">
+    <link rel="stylesheet" href="static/lib/font-awesome/css/font-awesome.min.css">
     <link rel="stylesheet" href="static/lib/angular/toaster.css">
     <link rel="stylesheet" href="static/css/base.css">
 

+ 2 - 0
donate-service/src/main/webapp/WEB-INF/views/userAgreement.html

@@ -11,6 +11,8 @@
     <!--css begin-->
     <link href="static/images/icon/u.png" rel="icon" type="image/x-icon" />
     <link rel="stylesheet" href="static/lib/bootstrap/css/bootstrap.min.css">
+    <link rel="stylesheet" href="static/lib/font-awesome/css/font-awesome.min.css">
+    <link rel="stylesheet" href="static/lib/angular/toaster.css">
     <link rel="stylesheet" href="static/css/base.css">
     <style>
         body{

+ 2 - 0
donate-service/src/main/webapp/WEB-INF/views/userCenter.html

@@ -11,6 +11,8 @@
     <!--css begin-->
     <link href="static/images/icon/u.png" rel="icon" type="image/x-icon" />
     <link rel="stylesheet" href="static/lib/bootstrap/css/bootstrap.min.css">
+    <link rel="stylesheet" href="static/lib/font-awesome/css/font-awesome.min.css">
+    <link rel="stylesheet" href="static/lib/angular/toaster.css">
     <link rel="stylesheet" href="static/css/base.css">
     <style>
         body{

+ 1 - 1
donate-service/src/main/webapp/resources/js/activity/main.js

@@ -70,6 +70,6 @@ require.config({
 		}
 	}
 });
-require([ 'app/app' ], function(app) {
+require([ 'app/app', 'common/controllers/commonCtrls' ], function(app) {
 	app.init();
 });

+ 1 - 1
donate-service/src/main/webapp/resources/js/approval/main.js

@@ -70,6 +70,6 @@ require.config({
 		}
 	}
 });
-require([ 'app/app' ], function(app) {
+require([ 'app/app', 'common/controllers/commonCtrls' ], function(app) {
 	app.init();
 });

+ 53 - 116
donate-service/src/main/webapp/resources/js/common/controllers/commonCtrls.js

@@ -1,6 +1,5 @@
 define([ 'app/app' ], function(app) {
 	'use strict';
-
 	app.config(['$httpProvider', function($httpProvider) {
 		// 设置http拦截器
 		$httpProvider.interceptors.push('httpInterceptor');
@@ -48,22 +47,27 @@ define([ 'app/app' ], function(app) {
 	}]);
 
 	// 身份认证
-	app.controller('AuthenticationCtrl', ['$scope', '$window', 'AuthenticationService', '$rootScope', 'SessionService', 'collectionService', '$modal', 'toaster','$q', 'Cart',
-		function($scope, $window, AuthenticationService, $rootScope, SessionService, collectionService, $modal, toaster, $q, Cart) {
+    app.controller('AuthCtrl', ['$scope', '$window', 'AuthenticationService', '$rootScope', 'SessionService', '$modal', 'toaster', '$http', 'BaseService',
+		function($scope, $window, AuthenticationService, $rootScope, SessionService, $modal, toaster, $http, BaseService) {
 			$scope.user = {
 				j_username : "",
 				j_password : "",
 				loginType : 'uu'
 			};
+            var rootPath = BaseService.getRootPath();
 
 			// 登录
 			$scope.login = function(user) {
-				AuthenticationService.login(user).success(function(responseText, status) {
-					if (status == 200) {
-					}
-				}).error(function(response) {
-					toaster.pop('error', response);
-				});
+                // AuthenticationService.login(user).success(function(responseText, status) {
+                // 	if (status == 200) {
+                // 	}
+                // }).error(function(response) {
+                // 	toaster.pop('error', response);
+                // });
+                AuthenticationService.redirectSignin();
+                // $.getJSON(rootPath + "/sso/login", {}, function (data) {
+                //     window.location.href = data.content;
+                // })
 			};
 
 			// 退出
@@ -72,94 +76,31 @@ define([ 'app/app' ], function(app) {
 					SessionService.removeCookie($rootScope.userInfo.userUU);
 				});
 			};
-
-			// 企业换企业开关
-			$scope.toggleSwitch = function () {
-				$scope.switching = !$scope.switching;
-			};
-
-			// 切换企业
-			$scope.switchto = function(enUU) {
-				AuthenticationService.reSignin(enUU).success(function(){
-					$window.location.reload();
-				});
-			};
+            // $scope.logout = function () {
+             //    $modal.open({
+             //        templateUrl: 'static/view/common/logout.html',
+             //        controller: 'LogOutCtrl'
+             //    }).result.then(function (s) {
+             //        if (s) {
+             //            AuthenticationService.logout();
+             //        }
+             //    });
+            // };
 
 			// 是否已经登录
 			$scope.isAuthed = AuthenticationService.isAuthed();
 			$scope.userInfo = {};
 
 			// 获取已登录的用户信息
-			var getAuthentication = function() {
-				return AuthenticationService.getAuthentication().success(function(data) {
-					if(data && data.enterprises) {
-						//data.enterprise = data.enterprises[data.enterprises.length - 1];
-						if(data.enterprises.length > 1) {
-							var enSelect = [];
-							angular.forEach(data.enterprises, function(e){
-								if(e.current)
-									data.enterprise = e;
-								else
-									enSelect.push(e);
-							});
-							data.enSelect = enSelect;
-						}
-					}
-					$scope.userInfo = data;
-					// 增加收藏功能的代码
-					$rootScope.userInfo = data;
-					$rootScope.brandCount = 0;
-					$rootScope.componentCount = 0;
-					// 以用户的身份进入系统
-					if(SessionService.get('authenticated')) {
-						collectionService.getStoreByUU({}, function(data) {
-							var store = [];
-							var brandCount = 0;
-							var componentCount = 0;
-							for(var i = 0; i < data.length; i++) {
-								if(data[i].kind == 1) {
-									brandCount++;
-								}else if (data[i].kind == 2){
-									componentCount++;
-								}
-								store.push(data[i]);
-							}
-							$rootScope.brandCount = brandCount;
-							$rootScope.componentCount = componentCount;
-							SessionService.setCookie($rootScope.userInfo.enterprise ? $rootScope.userInfo.userUU +"-"+ $rootScope.userInfo.enterprise.uu : $rootScope.userInfo.userUU, angular.toJson(store));
-							// 默认在登录界面游客收藏的数据已传输成功,删除游客的数据
-							SessionService.removeCookie('visitor');
-						}, function(response) {
-						});
-					}else { // 以游客身份登录系统
-						// 获取本地的数据
-						var arrs = angular.fromJson(SessionService.getCookie('visitor'));
-						angular.forEach(arrs, function(store) {
-							if(store.kind == 2) {
-								$rootScope.componentCount++;
-							}else {
-								$rootScope.brandCount++;
-							}
-						});
-					}
-
-					$scope.isAuthed = data != null && data.userUU;
-				});
-			};
-
-			//根据用户的信息
-			$q.all([getAuthentication()]).then(function () {
-				if(AuthenticationService.isAuthed()) {
-					Cart.getCount({}, function(data){
-						$rootScope.countCart = data.count;
-					}, function(res){
-						toaster.pop('error', '系统错误', '获取购物车失败');
-					});
+			AuthenticationService.getAuthentication().success(function(data) {
+				if(data && data.content) {
+					$scope.userInfo = data.content;
+					console.log(data.content);
 				}
-			}, function () {
+				$scope.isAuthed = data !== null && !angular.isUndefined(data.content);
 			});
 
-			// 打开登录模态框
+			// 登录
 			$scope.signinModal = function() {
 //			var modalInstance = $modal.open({
 //				templateUrl : 'static/view/common/modal/signin.html',// 指向上面创建的视图
@@ -185,6 +126,15 @@ define([ 'app/app' ], function(app) {
 			};
 		}]);
 
+    /**
+	 * 登出
+     */
+    app.controller('LogOutCtrl', ['$scope', '$modalInstance', function ($scope, $modalInstance) {
+        $scope.close = function (confirm) {
+            $modalInstance.close(confirm);
+        };
+    }]);
+
 	// 登录模态框
 	app.controller('SigninModalCtrl', ['$scope', '$modalInstance', 'AuthenticationService', 'toaster', function($scope, $modalInstance, AuthenticationService, toaster) {
 		$scope.user = {
@@ -224,32 +174,19 @@ define([ 'app/app' ], function(app) {
 		};
 	}]);
 
-	// 跳至顶部
-	app.controller('ScrollToTopCtrl', ['$scope', 'SmoothScroll', 'toaster', 'CommonGoodsBrowsingHistory', 'AuthenticationService', function($scope, SmoothScroll, toaster, CommonGoodsBrowsingHistory, AuthenticationService){
-		$scope.scrollToTop = function(){
-			SmoothScroll.scrollTo(null, 'site-nav');
-		};
-
-		AuthenticationService.getAuthentication().success(function(data){
-			$scope.userInfo = data;
-			if(data){
-				loadData();
-			}
-		});
-
-		// // 获取浏览历史
-		// var  loadData = function(){
-		// 	CommonGoodsBrowsingHistory.getAllHistory({ }, { }, function (response) {
-		// 		$scope.inithistory = response;
-		// 		$scope.history = [];
-		// 		angular.forEach($scope.inithistory, function(data){
-		// 			if(data.isDelete == 1){
-		// 				$scope.history.push(data);
-		// 			}
-		// 		})
-		// 	})
-		// }
-
-	}]);
-
+	// // 跳至顶部
+	// app.controller('ScrollToTopCtrl', ['$scope', 'SmoothScroll', 'toaster', 'CommonGoodsBrowsingHistory', 'AuthenticationService', function($scope, SmoothScroll, toaster, CommonGoodsBrowsingHistory, AuthenticationService){
+	// 	$scope.scrollToTop = function(){
+	// 		SmoothScroll.scrollTo(null, 'site-nav');
+	// 	};
+    //
+	// 	AuthenticationService.getAuthentication().success(function(data){
+	// 		$scope.userInfo = data;
+	// 		if(data){
+	// 			loadData();
+	// 		}
+	// 	});
+	// }]);
+
+    return app;
 });

+ 2 - 1
donate-service/src/main/webapp/resources/js/common/query/User.js

@@ -4,7 +4,8 @@ define ([ 'ngResource' ], function() {
             // 获取参加项目记录
             getProjectRecord: {
                 url: 'projectrecode/joins',
-                method: 'GET'
+                method: 'GET',
+                isArray: true
             },
             // 获取参加活动记录
             getActivityRecord: {

+ 24 - 27
donate-service/src/main/webapp/resources/js/common/services.js

@@ -98,7 +98,7 @@ define([ 'angular', 'common/utils', 'ngResource'], function(angular, utils, Big)
 		        }
 		        return requestParams;
 			},
-			// 获取platform-b2c之后的路径
+			// 获取之后的路径
 			getCurrentUrl: function() {
 				var fullPath = window.document.location.href;
 				return fullPath.substring(this.getRootPath().length, fullPath.length);
@@ -150,17 +150,17 @@ define([ 'angular', 'common/utils', 'ngResource'], function(angular, utils, Big)
 			root : function() {
 				return rootPath;	
 			},
-			/*login : function(user) {
+			login : function(user) {
 				var payload = SerializerUtil.param(user);
 				var config = {
 					headers : {
 						'Content-Type' : 'application/x-www-form-urlencoded; charset=UTF-8'
 					}
 				};
-				var login = $http.post(rootPath + "/j_spring_security_check", payload, config);
+				var login = $http.post(rootPath + "/sso/login/page", payload, config);
 				login.success(cacheSession);
 				return login;
-			},*/
+			},
 			logout : function() {
 				var config = {
 					cache: false,
@@ -172,26 +172,23 @@ define([ 'angular', 'common/utils', 'ngResource'], function(angular, utils, Big)
             			returnUrl: window.location.href
             		}
 				};
-				var logout = $http.get(rootPath + "/logout", config);
+				var logout = $http.get(rootPath + "/sso/logout", config);
 				logout.success(uncacheSession);
 				logout.success(function(data){
-					var pathName = document.location.pathname;
-					/*var str = pathName.replace('platform-b2c/','');
-					console.log(str);
-					console.log(document.location);*/
-					var index = pathName.substr(1).indexOf("/");// platform-b2c/logout/proxy
-					var result = pathName.substr(0,index);
-					var uri = pathName.substr(13,index+1000) + document.location.hash;
-					if (result == '/platform-b2c') {
-						var contextPath = ''
-						/*var contextPath = (function getContextPath() {
-							var pathName = document.location.pathname;
-							var index = pathName.substr(1).indexOf("/");
-							var result = pathName.substr(0,index+1);
-							return result;
-						})();*/
-						data.content = contextPath + uri;
-					}
+					// var pathName = document.location.pathname;
+					// var index = pathName.substr(1).indexOf("/project");
+					// var result = pathName.substr(0,index);
+					// var uri = pathName.substr(13,index+1000) + document.location.hash;
+					// if (result == '/project') {
+					// 	var contextPath = '/'
+					// 	/*var contextPath = (function getContextPath() {
+					// 		var pathName = document.location.pathname;
+					// 		var index = pathName.substr(1).indexOf("/");
+					// 		var result = pathName.substr(0,index+1);
+					// 		return result;
+					// 	})();*/
+					// 	data.content = contextPath + uri;
+					// }
 					if (data.content) {
 						if (data.content == window.location.href) {
 							window.location.reload();
@@ -204,7 +201,7 @@ define([ 'angular', 'common/utils', 'ngResource'], function(angular, utils, Big)
 			},
             redirectSignin: function() {
             	// 获取跳转登录的url
-            	$http.get(rootPath + '/login/page', {
+            	$http.get(rootPath + '/sso/login', {
             		params: {
             			returnUrl: window.location.href
             		}
@@ -245,7 +242,7 @@ define([ 'angular', 'common/utils', 'ngResource'], function(angular, utils, Big)
         				'Pragma': 'no-cache'
 					}
 				};
-				var request = $http.get(rootPath + '/user/authentication', config);
+				var request = $http.get(rootPath + '/sso/account', config);
 				request.success(function(data){
 					if(data)
 						cacheSession();
@@ -255,9 +252,9 @@ define([ 'angular', 'common/utils', 'ngResource'], function(angular, utils, Big)
 				request.error(uncacheSession);
 				return request;
 			},
-			reSignin : function(enUU) {
-				return $http.get(rootPath + '/user/authentication/' + enUU);
-			}
+			// reSignin : function(enUU) {
+			// 	return $http.get(rootPath + '/user/authentication/' + enUU);
+			// }
 		};
 	}]).factory('TableService', ['$parse', 'ngTableParams', function($parse, ngTableParams){
 		var scope;

+ 3 - 1
donate-service/src/main/webapp/resources/js/project/controllers/ProjectDetailCtrl.js

@@ -2,6 +2,7 @@ define([ 'app/app' ], function(app) {
     'use strict';
     app.register.controller('ProjectDetailCtrl', ['$scope', '$rootScope', 'Project', '$stateParams', 'BaseService', '$sce',
         function ($scope, $rootScope, Project, $stateParams, BaseService, $sce) {
+        $scope.loading = true;
         $rootScope.page = 'project';
         BaseService.scrollBackToTop();
         $scope.donation = null;
@@ -28,6 +29,8 @@ define([ 'app/app' ], function(app) {
                 $scope.project = data;
                 $scope.organization = data.organization;
                 $scope.percentage = data.totalAmount / data.target;
+                $scope.loading = false;
+                $scope.canDonate = data.overdue !== '已结束';
             }, function (error) {
                 console.log(error);
             });
@@ -71,7 +74,6 @@ define([ 'app/app' ], function(app) {
             }, function (error) {
                 console.log(error);
             });
-
         };
         init();
 

+ 2 - 0
donate-service/src/main/webapp/resources/js/project/controllers/ProjectListCtrl.js

@@ -22,6 +22,8 @@ define([ 'app/app' ], function(app) {
 
 	app.register.controller('ProjectListCtrl', ['$scope', 'toaster', 'ngTableParams', 'BaseService', 'Project',
         function ($scope, toaster, ngTableParams, BaseService, Project) {
+	    // 使用freemaker首页,不使用此首页
+	    window.location.href = '/';
         BaseService.scrollBackToTop();
 	    $scope.scope = $scope;
 	    $scope.active = 'todo';

+ 1 - 1
donate-service/src/main/webapp/resources/js/project/main.js

@@ -62,6 +62,6 @@ require.config({
 		}
 	}
 });
-require([ 'app/app'], function(app) {
+require([ 'app/app', 'common/controllers/commonCtrls'], function(app) {
 	app.init();
 });

+ 1 - 1
donate-service/src/main/webapp/resources/js/user/main.js

@@ -67,6 +67,6 @@ require.config({
 		}
 	}
 });
-require([ 'app/app' ], function(app) {
+require([ 'app/app', 'common/controllers/commonCtrls'], function(app) {
 	app.init();
 });

+ 62 - 0
donate-service/src/main/webapp/resources/view/common/logout.html

@@ -0,0 +1,62 @@
+<style>
+	.modal-content {
+		width: 350px;
+		height: 150px;
+	}
+
+	.modal-title {
+		text-align: left;
+		font-size: 14px;
+	}
+	.modal-body {
+		text-align: center;
+	}
+	.modal-body .tip-content{
+		font-size: 16px;
+		line-height: 49px;
+		margin-top: 5px;
+	}
+	.modal-body .btn {
+		margin: 0 10px;
+		width: 94px;
+		height: 36px;
+		font-size: 14px;
+		display: inline-block;
+		text-align: center;
+		border-radius: 0;
+	}
+	.modal-btn{
+		margin-top: 5px;
+	}
+	.modal-btn .btn-danger{
+		background: #5078cb;
+		border: #5078cb 1px solid;
+	}
+	.modal-btn .btn-default{
+		border: #5078cb 1px solid;
+		color: #5078cb;
+	}
+	.modal-btn .btn:hover{
+		background: #327ebe;
+		color: #fff;
+	}
+	.modal-header{
+		height: 40px;
+	}
+	.modal-body{
+		height: 110px;
+		padding: 0;
+	}
+</style>
+<div class="modal-header">
+	<span class="modal-title">
+		提示
+	</span>
+</div>
+<div class="modal-body">
+	<div class="tip-content">是否确认退出?</div>
+	<div class="modal-btn">
+		<button class="btn btn-danger" ng-click="close(true)">是</button>
+		<button class="btn btn-default" ng-click="close(false)" type="button">否</button>
+	</div>
+</div>

+ 20 - 11
donate-service/src/main/webapp/resources/view/common/nav.html

@@ -1,21 +1,30 @@
-<div id="nav">
+<div id="nav" ng-controller="AuthCtrl">
     <div class="container clearfix">
         <div class="fl">
-            <a href="http://www.ubtob.com" title="优软云首页">
-                <img src="static/images/uas.png" alt=""/>
+            <a href="http://www.ubtob.com" target="_blank" title="优软云首页">
+                <img src="static/images/uas.png" alt="UAS" title="UAS"/>
             </a>
             <span>
                 <a href="/" title="返回首页" style="color: #fff;font-size: 18px;font-weight: bold;">一元捐</a>
                  <!--<a href="/project" title="返回首页" style="color: #fff;">一元捐</a>-->
             </span>
         </div>
-        <div class="fr"><a href="#" id="login">登录</a><a href="https://account.ubtob.com/sso/register">注册</a><a href="http://www.ubtob.com">进入优软云</a></div>
+        <div class="fr" ng-if="!isAuthed">
+            <a ng-click="login()">登录</a>
+            <a ng-click="registerModal()">注册</a>
+            <a href="http://www.ubtob.com" target="_blank">进入优软云</a>
+        </div>
+        <div class="fr" ng-if="isAuthed">
+            <a><span ng-bind="userInfo.name"></span><i class="fa fa-user fa-lg"></i></a>
+            <a ng-click="logout()">退出</a>
+            <a href="http://www.ubtob.com" target="_blank">进入优软云</a>
+        </div>
     </div>
 </div>
-<script>
-    $('#login').on('click', function () {
-        $.get('sso/login', function(data) {
-            data.content && (window.location.href = data.content);
-        });
-    });
-</script>
+<!--<script>-->
+    <!--$('#login').on('click', function () {-->
+        <!--$.get('sso/login', function(data) {-->
+            <!--data.content && (window.location.href = data.content);-->
+        <!--});-->
+    <!--});-->
+<!--</script>-->

+ 8 - 5
donate-service/src/main/webapp/resources/view/project/project_detail.html

@@ -398,7 +398,7 @@
     .section2 .project-box .box3{
         padding: 30px 0 0 30px;
         width: 310px;
-        height: 270px;
+        /*height: 270px;*/
         text-align: left;
         border: 1px solid #e1e1e1;
     }
@@ -672,6 +672,9 @@
     }
 </style>
 <body>
+<!-- loading start -->
+<div class="loading in" ng-class="{'in': loading}"><i></i></div>
+<!-- loading end -->
 <div class="main">
     <div class="container">
         <div class="section section1">
@@ -748,15 +751,15 @@
                         <span>已筹款:<em ng-bind="project.totalAmount || 0 | number: 2"></em>元<span>({{percentage * 100 || 0 | number: 2}}%)</span></span>
                     </div>
                     <!--我要捐款-->
-                    <button class="button" data-toggle="modal" data-target="#layer" ng-disabled="project.overdue == '已结束'">我要捐款</button>
+                    <button class="button" data-toggle="modal" data-target="#layer" ng-disabled="!canDonate">我要捐款</button>
                 </div>
             </div>
         </div>
         <div class="section section2">
             <div class="top clearfix" id="top">
                 <div class="active fl tabNav"><em></em><span>项目详情</span></div>
-                <div class="fl tabNav" ng-if="schedules.length != 0"><em></em><span>项目进度</span></div>
-                <div class="fl tabNav" ng-if="proReport.length != 0"><em></em><span>结项报告</span></div>
+                <div class="fl tabNav" ng-if="!loading && schedules.length != 0"><em></em><span>项目进度</span></div>
+                <div class="fl tabNav" ng-if="!loading && proReport.length != 0"><em></em><span>结项报告</span></div>
             </div>
             <!--项目详情-->
             <div class="bottom clearfix show" >
@@ -785,7 +788,7 @@
                         <p>联系电话:<span ng-bind="project.personTel"></span></p>
                     </div>
                     <div class="button">
-                        <button class="button" data-toggle="modal" data-target="#layer"  ng-disabled="project.overdue == '已结束'">我要捐款</button>
+                        <button class="button" data-toggle="modal" data-target="#layer"  ng-disabled="cannotDonate">我要捐款</button>
                     </div>
                 </div>
                 <div ng-include src="'static/view/project/project_detail_side.html'"></div>

+ 1 - 1
donate-service/src/main/webapp/resources/view/project/project_detail_side.html

@@ -28,7 +28,7 @@
     <!--执行机构简介-->
     <div class="box box2">
         <span class="join">执行机构简介</span>
-        <p class="title"><a ui-sref="organization({id:project.id})">{{organization.name}}</a></p>
+        <p class="title"><a style="color: #5078cb;" ui-sref="organization({id:project.id})">{{organization.name}}</a></p>
         <div class="box-details">
             <p>{{organization.summary}}</p>
             <img src="{{organization.logo}}" alt="机构LOGO"/>

+ 15 - 15
donate-service/src/main/webapp/resources/view/project/project_list.html

@@ -563,20 +563,20 @@
                             <em class="red"></em>
                         </a>
                     </div>
-                    <div class="top-item">
-                        <!--<a ng-if="已认证" ui-sref="newBase">-->
-                            <!--<img src="static/images/index/icon_3.png" alt=""/>-->
-                            <!--<p>发起项目</p>-->
-                        <!--</a>-->
-                        <!--<a ng-if="未认证" ui-sref="newBase">-->
+                    <!--<div class="top-item">-->
+                        <!--&lt;!&ndash;<a ng-if="已认证" ui-sref="newBase">&ndash;&gt;-->
+                            <!--&lt;!&ndash;<img src="static/images/index/icon_3.png" alt=""/>&ndash;&gt;-->
+                            <!--&lt;!&ndash;<p>发起项目</p>&ndash;&gt;-->
+                        <!--&lt;!&ndash;</a>&ndash;&gt;-->
+                        <!--&lt;!&ndash;<a ng-if="未认证" ui-sref="newBase">&ndash;&gt;-->
+                            <!--&lt;!&ndash;<img src="static/images/index/icon_3.png" alt=""/>&ndash;&gt;-->
+                            <!--&lt;!&ndash;<p>发起项目</p>&ndash;&gt;-->
+                        <!--&lt;!&ndash;</a>&ndash;&gt;-->
+                        <!--<a ui-sref="newBase">-->
                             <!--<img src="static/images/index/icon_3.png" alt=""/>-->
                             <!--<p>发起项目</p>-->
                         <!--</a>-->
-                        <a ui-sref="newBase">
-                            <img src="static/images/index/icon_3.png" alt=""/>
-                            <p>发起项目</p>
-                        </a>
-                    </div>
+                    <!--</div>-->
                 </div>
                 <div class="button">
                     <span class="active">项目中心</span><a href="/activity"><span>活动中心</span></a>
@@ -585,11 +585,11 @@
                 <div class="buttons show">
                     <div class="bottom-item">
                         <div class="title"><span>历史参加人次</span></div>
-                        <div class="count"><span ng-bind="joinedPersonHistory | number"></span><span>人次</span></div>
+                        <div class="count"><span ng-bind="joinedPersonHistory || 0 | number"></span><span>人次</span></div>
                     </div>
                     <div class="bottom-item">
                         <div class="title"><span>历史捐款总额</span></div>
-                        <div class="count" style="margin-left: -10px;"><span ng-bind="totalDonationsHistory | number"></span><span>元</span></div>
+                        <div class="count" style="margin-left: -10px;"><span ng-bind="totalDonationsHistory || 0 | number"></span><span>元</span></div>
                     </div>
                 </div>
                 <!--<div class="buttons">-->
@@ -670,8 +670,8 @@
                                             <em ng-if="project.overdue == 1">已结束</em>
                                         </span>
                                     </div>
-                                    <div><span>已参与:<em>{{joinedHistory | number || 0}}</em>人次</span></div>
-                                    <div><span>已筹款:<em>{{project.totalAmount | number || 0}}</em>元(({{project.totalAmount*100/project.target}})||0.00%)</span></div>
+                                    <div><span>已参与:<em>{{joinedHistory || 0 | number}}</em>人次</span></div>
+                                    <div><span>已筹款:<em>{{project.totalAmount || 0 | number}}</em>元(({{project.totalAmount*100/project.target}})||0.00%)</span></div>
                                 </div>
                                 <a class="fr donation" data-toggle="modal" data-target="#layer">我要捐款</a>
                             </div>