Browse Source

修改getRootPath方法

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@3254 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
yingp 10 năm trước cách đây
mục cha
commit
bec10bfc44

+ 7 - 4
src/main/webapp/resources/js/common/services.js

@@ -51,10 +51,13 @@ define(['angular', 'toaster'], function(angular) {
     }).factory('BaseService', function() {
         return {
             getRootPath: function() {
-                var fullPath = window.document.location.href;
-                var path = window.document.location.pathname; // 返回当前部分路径
-                var pos = fullPath.indexOf(path);
-                return fullPath.substring(0, pos) + path.substring(0, path.substr(1).indexOf('/') + 1);
+            	var pathName = window.location.pathname.substring(1);
+            	var webName = pathName == '' ? '': pathName.substring(0, pathName.indexOf('/'));
+            	if (webName == "") {
+            	    return window.location.protocol + '//' + window.location.host;
+            	} else {
+            	    return window.location.protocol + '//' + window.location.host + '/' + webName;
+            	}
             },
             isNumber: function(n) {
                 return ! isNaN(parseFloat(n)) && isFinite(n);

+ 1 - 1
src/main/webapp/resources/js/index/mobile.index.app.js

@@ -1,4 +1,4 @@
-define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'service/Make', 'ui.router','service/Fa','ui.bootstrap' ], function() {
+define([ 'toaster', 'ngTable', 'common/services', 'service/Purc', 'service/Make', 'ui.router','service/Fa','ui.bootstrap' ], function() {
 	'use strict';
 	var app = angular.module('myApp', ['ngAnimate', 'toaster', 'ui.router', 'common.services', 'PurcServices', 'MakeServices', 'FaServices' , 'ui.bootstrap']);
 

+ 0 - 3
src/main/webapp/resources/js/index/mobile.index.main.js

@@ -5,8 +5,6 @@ require.config({
 		'angular' : 'lib/angular/angular',
 		'ngAnimate': 'lib/angular/angular-animate.min',
 		'toaster' : 'lib/angular/angular-toaster.min',
-		'd3' : 'lib/angular/d3.min',
-		'charts' : 'lib/angular/angular-charts.min',
 		'common' : 'js/common',
 		'service' : 'js/index/services',
 		'ui.router' : 'lib/angular/angular-ui-router.min',
@@ -21,7 +19,6 @@ require.config({
 		'ngAnimate' : ['angular'],
 		'ngResource' : ['angular'],
 		'toaster' : ['angular', 'ngAnimate'],
-		'charts' : ['angular', 'd3'],
 		'ui.router' : ['angular'],
 		'ui.bootstrap' : [ 'angular' ],
 		'ngTable' : {