Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
songxia-wxherr
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
songxia-wxherr
Commits
c1a8daa6
Commit
c1a8daa6
authored
Jun 16, 2017
by
杨培
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化 api 对跨域策略的判断
parent
1e22ba1e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
api.js
src/utils/api.js
+4
-1
No files found.
src/utils/api.js
View file @
c1a8daa6
/**
* Created by pader on 2017/6/14.
*/
var
headerAuthorize
=
__BASE_URL__
==
__SERVER_URL__
;
//Web端与Server端根网址一致则采用 header 授权方案
var
serverParse
=
__SERVER_URL__
.
match
(
/^
(
https
?
:
)?(\/\/[\w\.\-
:
]
+
)\/
/
);
var
serverOrigin
=
(
serverParse
[
1
]
?
serverParse
[
1
]
:
location
.
protocol
)
+
serverParse
[
2
];
var
headerAuthorize
=
location
.
origin
==
serverOrigin
;
function
getUrl
(
uri
)
{
return
__SERVER_URL__
+
uri
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment