yangc 7 лет назад
Родитель
Сommit
2962fea049

+ 12 - 0
src/main/webapp/resources/js/common/query/authority.js

@@ -0,0 +1,12 @@
+define([ 'ngResource' ], function() {
+	angular.module('authorityServices', [ 'ngResource' ]).factory('Authority', ['$resource', 'BaseService', function($resource, BaseService) {
+		const rootPath = BaseService.getRootPath();
+		// 获取接口权限
+		return $resource('user/authentication/isauthority', {}, {
+			getAuthority : {
+				url : 'user/authentication/isauthority',
+				method : 'GET'
+			}
+		});
+	}])
+});

+ 2 - 2
src/main/webapp/resources/js/usercenter/app.js

@@ -1,7 +1,7 @@
 
 
-define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'common/services', 'common/directives','common/query/kind', 'common/query/brand', 'common/query/component', 'common/query/order', 'common/query/cart', 'common/query/goods', 'common/query/return' ,'angular-toaster', 'common/query/urlencryption', 'ui-jquery', 'common/query/bankTransfer', 'common/query/bankInfo', 'common/query/change', 'common/query/rate', 'common/query/logistics', 'common/query/address' ,'angular-toaster','common/query/collection', 'common/query/proofing', 'common/query/bill', 'common/query/user','file-upload', 'file-upload-shim', 'common/query/bankInfo' , 'common/query/responseLogistics', 'common/query/payment', 'common/query/afterSale', 'common/query/messageBoard', 'common/query/importDeclaration', 'common/query/enterprise', 'common/query/invoice', 'common/query/refund', 'common/query/recommendation', 'common/query/logisticsPort', 'common/query/storeInfo', 'common/query/tradeMessageNotice', 'common/query/tradeBasicProperties', 'common/query/browsingHistory', 'common/query/internalMessage', 'common/module/chat_web_module', 'angular-filter', 'common/query/vendor','common/query/seekPurchase', 'common/query/search', 'angular-sanitize'], function(angularAMD) {
+define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'common/services', 'common/directives','common/query/kind', 'common/query/brand', 'common/query/component', 'common/query/order', 'common/query/cart', 'common/query/goods', 'common/query/return' ,'angular-toaster', 'common/query/urlencryption', 'ui-jquery', 'common/query/bankTransfer', 'common/query/bankInfo', 'common/query/change', 'common/query/rate', 'common/query/logistics', 'common/query/address' ,'angular-toaster','common/query/collection', 'common/query/proofing', 'common/query/bill', 'common/query/user','file-upload', 'file-upload-shim', 'common/query/bankInfo' , 'common/query/responseLogistics', 'common/query/payment', 'common/query/afterSale', 'common/query/messageBoard', 'common/query/importDeclaration', 'common/query/enterprise', 'common/query/invoice', 'common/query/refund', 'common/query/recommendation', 'common/query/logisticsPort', 'common/query/storeInfo', 'common/query/tradeMessageNotice', 'common/query/tradeBasicProperties', 'common/query/browsingHistory', 'common/query/internalMessage', 'common/module/chat_web_module', 'angular-filter', 'common/query/vendor','common/query/seekPurchase', 'common/query/search', 'angular-sanitize', 'common/query/authority'], function(angularAMD) {
 	'use strict';
 	'use strict';
-	var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ng.local', 'ngTable', 'common.services', 'common.directives', 'tool.directives', 'common.query.kind', 'brandServices', 'componentServices', 'orderServices', 'cartServices', 'goodsServices', 'returnServices' , 'toaster', 'urlencryptionServices', 'ui.jquery', 'bankTransfer', 'bankInfo', 'changeServices','rateServices', 'logisticsServices', 'addressServices', 'toaster','collection','proofingServices', 'billServices', 'common.query.user', 'angularFileUpload', 'bankInfo', 'responseLogisticsService', 'PaymentService', 'afterSaleService', 'messageBoardServices', 'table.directives', 'importDeclaration', 'common.query.enterprise', 'invoiceServices', 'refundModule', 'recommendation','logisticsPortService', 'storeInfoServices', 'tradeMessageNoticeModule', 'tradeBasicPropertiesServices', 'BrowsingHistory', 'internalMessageServices', 'WebChatModule', 'angular.filter', 'vendorServices','seekPurchaseServices', 'searchService', 'ngSanitize']);
+	var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ng.local', 'ngTable', 'common.services', 'common.directives', 'tool.directives', 'common.query.kind', 'brandServices', 'componentServices', 'orderServices', 'cartServices', 'goodsServices', 'returnServices' , 'toaster', 'urlencryptionServices', 'ui.jquery', 'bankTransfer', 'bankInfo', 'changeServices','rateServices', 'logisticsServices', 'addressServices', 'toaster','collection','proofingServices', 'billServices', 'common.query.user', 'angularFileUpload', 'bankInfo', 'responseLogisticsService', 'PaymentService', 'afterSaleService', 'messageBoardServices', 'table.directives', 'importDeclaration', 'common.query.enterprise', 'invoiceServices', 'refundModule', 'recommendation','logisticsPortService', 'storeInfoServices', 'tradeMessageNoticeModule', 'tradeBasicPropertiesServices', 'BrowsingHistory', 'internalMessageServices', 'WebChatModule', 'angular.filter', 'vendorServices','seekPurchaseServices', 'searchService', 'ngSanitize', 'authorityServices']);
 	app.init = function() {
 	app.init = function() {
 		angularAMD.bootstrap(app);
 		angularAMD.bootstrap(app);
 	};
 	};

+ 21 - 13
src/main/webapp/resources/js/usercenter/controllers/forstore/pay_center_ctrl.js

@@ -3,7 +3,7 @@
  */
  */
 define(['app/app'], function(app) {
 define(['app/app'], function(app) {
 	'use strict';
 	'use strict';
-	app.register.controller('payCenterCtrl', ['$scope', '$rootScope', 'ngTableParams', 'BaseService', 'bankInfoService', '$filter', 'SessionService', '$modal', 'toaster', 'OrderSimpleInfo', 'Loading', function($scope, $rootScope, ngTableParams, BaseService, bankInfoService, $filter, SessionService, $modal, toaster, OrderSimpleInfo, Loading) {
+	app.register.controller('payCenterCtrl', ['$scope', '$rootScope', 'ngTableParams', 'BaseService', 'bankInfoService', '$filter', 'SessionService', '$modal', 'toaster', 'OrderSimpleInfo', 'Loading', 'Authority', function($scope, $rootScope, ngTableParams, BaseService, bankInfoService, $filter, SessionService, $modal, toaster, OrderSimpleInfo, Loading, Authority) {
 		$rootScope.active = 'pay_center';
 		$rootScope.active = 'pay_center';
 
 
 		document.title = '支付中心-优软商城';
 		document.title = '支付中心-优软商城';
@@ -368,18 +368,26 @@ define(['app/app'], function(app) {
 				var str = strArray.join("&");
 				var str = strArray.join("&");
 				url = url + "?" + str;
 				url = url + "?" + str;
 			}
 			}
-			var form = $("<form>");   //定义一个form表单
-			form.attr('style', 'display:none');   //在form表单中添加查询参数
-			form.attr('target', '');
-			form.attr('method', 'POST');
-			form.attr('action', url);
-
-			$('body').append(form);  //将表单放置在web中
-			form.submit();
-
-			$scope.$$record.clockID = setInterval(function() {
-				getDownLoadStatus();
-			}, 500);
+			Authority.getAuthority({resUrl: url}, function (data) {
+				if (data.status == 'fail') {
+					toaster.pop('error', data.msg);
+					return;
+				}
+				var form = $("<form>");   //定义一个form表单
+				form.attr('style', 'display:none');   //在form表单中添加查询参数
+				form.attr('target', '');
+				form.attr('method', 'POST');
+				form.attr('action', url);
+
+				$('body').append(form);  //将表单放置在web中
+				form.submit();
+
+				$scope.$$record.clockID = setInterval(function() {
+					getDownLoadStatus();
+				}, 500);
+			}, function (err) {
+				toaster.pop('error', err || '获取权限失败');
+			})
 		};
 		};
 
 
 		var getDownLoadStatus = function () {
 		var getDownLoadStatus = function () {

+ 9 - 9
src/main/webapp/resources/js/vendor/controllers/forstore/pay_center_ctrl.js

@@ -3,7 +3,7 @@
  */
  */
 define(['app/app'], function(app) {
 define(['app/app'], function(app) {
     'use strict';
     'use strict';
-    app.register.controller('payCenterCtrl', ['$scope', '$rootScope', 'bankInfoService', 'toaster', '$upload', 'bankTransferService', 'Purchase', '$filter', 'Loading', 'ngTableParams', 'BaseService', 'SessionService', '$stateParams', '$http', function($scope, $rootScope, bankInfoService, toaster, $upload, bankTransferService, Purchase, $filter, Loading, ngTableParams, BaseService, SessionService, $stateParams, $http) {
+    app.register.controller('payCenterCtrl', ['$scope', '$rootScope', 'bankInfoService', 'toaster', '$upload', 'bankTransferService', 'Purchase', '$filter', 'Loading', 'ngTableParams', 'BaseService', 'SessionService', '$stateParams', '$http', 'Authority', function($scope, $rootScope, bankInfoService, toaster, $upload, bankTransferService, Purchase, $filter, Loading, ngTableParams, BaseService, SessionService, $stateParams, $http, Authority) {
         $rootScope.active = 'pay_center';
         $rootScope.active = 'pay_center';
 
 
         document.title = '结算中心-优软商城';
         document.title = '结算中心-优软商城';
@@ -607,11 +607,11 @@ define(['app/app'], function(app) {
                 var str = strArray.join("&");
                 var str = strArray.join("&");
                 url = url + "?" + str;
                 url = url + "?" + str;
             }
             }
-            $http({
-                method: 'post',
-                dataType: 'json',
-                url: url
-            }).success(function (data) {
+            Authority.getAuthority({resUrl: url}, function (data) {
+                if (data.status == 'fail') {
+                    toaster.pop('error', data.msg);
+                    return;
+                }
                 var form = $("<form>");   //定义一个form表单
                 var form = $("<form>");   //定义一个form表单
                 form.attr('style', 'display:none');   //在form表单中添加查询参数
                 form.attr('style', 'display:none');   //在form表单中添加查询参数
                 form.attr('target', '');
                 form.attr('target', '');
@@ -624,9 +624,9 @@ define(['app/app'], function(app) {
                 $scope.$$transfer.clockID = setInterval(function() {
                 $scope.$$transfer.clockID = setInterval(function() {
                     getDownLoadStatus();
                     getDownLoadStatus();
                 }, 500);
                 }, 500);
-            }).error(function (response) {
-                toaster.pop('error', response);
-            });
+            }, function (err) {
+                toaster.pop('error', err || '获取权限失败');
+            })
         };
         };
 
 
         var getDownLoadStatus = function () {
         var getDownLoadStatus = function () {