Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
H
huamu
Project
Project
Details
Activity
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
郭铭瑶
huamu
Commits
932e7989
Commit
932e7989
authored
Sep 23, 2021
by
lihaihan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
3ab38e45
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
54 deletions
+9
-54
api.ts
src/ajax/api.ts
+9
-54
No files found.
src/ajax/api.ts
View file @
932e7989
import
{
tokenIns
}
from
'@/util/tokenUtil'
import
{
tokenIns
}
from
'@/util/tokenUtil'
import
{
getCookie
,
setCookie
}
from
'@/util/cookieUtil'
let
BASE_URL
:
string
=
''
let
BASE_URL
:
string
=
''
let
TOKEN
:
string
=
''
let
mdtUser
:
string
=
''
let
imperToken
:
string
=
''
let
imperMdtUser
:
string
=
''
let
MAP_CONFIG
:
{
jsApiUrl
:
string
;
cssUrl
:
string
}
=
{
let
MAP_CONFIG
:
{
jsApiUrl
:
string
;
cssUrl
:
string
}
=
{
jsApiUrl
:
''
,
jsApiUrl
:
''
,
cssUrl
:
''
,
cssUrl
:
''
,
};
};
function
getToken
()
{
let
TOKEN
=
getCookie
(
"__DM_TOKEN__"
);
const
header
=
window
.
__DM_GLOBE_UTIL
let
mdtUser
=
getCookie
(
"__DM_MDT_USER__"
);
?
window
.
__DM_GLOBE_UTIL
.
getHeader
()
let
imperToken
=
getCookie
(
"__DM_IMPER_TOKEN__"
);
:
null
let
imperMdtUser
=
getCookie
(
"__DM_IMPER_MDT_USER__"
);
return
header
?
header
.
authorization
:
tokenIns
.
get
()
}
let
header
=
window
.
__DM_GLOBE_UTIL
?
window
.
__DM_GLOBE_UTIL
.
getHeader
()
:
null
;
switch
(
process
.
env
.
NODE_ENV
)
{
switch
(
process
.
env
.
NODE_ENV
)
{
case
'production'
:
case
'production'
:
BASE_URL
=
'https://www.maicedata.com/collector/data/'
// 生产环境
BASE_URL
=
'https://www.maicedata.com/collector/data/'
// 生产环境
if
(
header
)
{
//新版的取值方式
TOKEN
=
header
[
'authorization'
];
mdtUser
=
header
[
'mdt-user'
];
imperToken
=
header
[
'x-impersonate-token'
];
imperMdtUser
=
header
[
'x-impersonate-user'
];
}
else
{
//旧版的取值方式
TOKEN
=
tokenIns
.
get
();
mdtUser
=
tokenIns
.
getMdtUser
();
imperToken
=
tokenIns
.
getImperToken
();
imperMdtUser
=
tokenIns
.
getImperMdtUser
();
}
// TOKEN = getToken()
// TOKEN = getToken()
MAP_CONFIG
=
{
MAP_CONFIG
=
{
jsApiUrl
:
'http://10.108.3.48/api418/arcgis_js_api/library/4.18/init.js'
,
jsApiUrl
:
'http://10.108.3.48/api418/arcgis_js_api/library/4.18/init.js'
,
...
@@ -47,19 +26,6 @@ switch (process.env.NODE_ENV) {
...
@@ -47,19 +26,6 @@ switch (process.env.NODE_ENV) {
BASE_URL
=
'https://survey.maicedata.com/api/data/'
// 测试环境(暂时部署在测绘院用)
BASE_URL
=
'https://survey.maicedata.com/api/data/'
// 测试环境(暂时部署在测绘院用)
// TOKEN = '91e315a9-b2a8-4950-97fa-9dbf84a230d6'
// TOKEN = '91e315a9-b2a8-4950-97fa-9dbf84a230d6'
if
(
header
)
{
//新版的取值方式
TOKEN
=
header
[
'authorization'
];
mdtUser
=
header
[
'mdt-user'
];
imperToken
=
header
[
'x-impersonate-token'
];
imperMdtUser
=
header
[
'x-impersonate-user'
];
}
else
{
//旧版的取值方式
TOKEN
=
tokenIns
.
get
();
mdtUser
=
tokenIns
.
getMdtUser
();
imperToken
=
tokenIns
.
getImperToken
();
imperMdtUser
=
tokenIns
.
getImperMdtUser
();
}
MAP_CONFIG
=
{
MAP_CONFIG
=
{
jsApiUrl
:
'http://10.108.3.41/arcgis_js_api/library/4.18/init.js'
,
jsApiUrl
:
'http://10.108.3.41/arcgis_js_api/library/4.18/init.js'
,
cssUrl
:
'http://10.108.3.41/arcgis_js_api/library/4.18/esri/css/main.css'
,
cssUrl
:
'http://10.108.3.41/arcgis_js_api/library/4.18/esri/css/main.css'
,
...
@@ -69,19 +35,7 @@ switch (process.env.NODE_ENV) {
...
@@ -69,19 +35,7 @@ switch (process.env.NODE_ENV) {
BASE_URL
=
'/api'
// vite.config 代理 https://survey.maicedata.com/api/data/
BASE_URL
=
'/api'
// vite.config 代理 https://survey.maicedata.com/api/data/
// TOKEN = '91e315a9-b2a8-4950-97fa-9dbf84a230d6'
// TOKEN = '91e315a9-b2a8-4950-97fa-9dbf84a230d6'
if
(
header
)
{
//新版的取值方式
TOKEN
=
header
[
'authorization'
];
mdtUser
=
header
[
'mdt-user'
];
imperToken
=
header
[
'x-impersonate-token'
];
imperMdtUser
=
header
[
'x-impersonate-user'
];
}
else
{
//旧版的取值方式
TOKEN
=
tokenIns
.
get
();
mdtUser
=
tokenIns
.
getMdtUser
();
imperToken
=
tokenIns
.
getImperToken
();
imperMdtUser
=
tokenIns
.
getImperMdtUser
();
}
MAP_CONFIG
=
{
MAP_CONFIG
=
{
jsApiUrl
:
'http://10.108.3.41/arcgis_js_api/library/4.18/init.js'
,
jsApiUrl
:
'http://10.108.3.41/arcgis_js_api/library/4.18/init.js'
,
cssUrl
:
'http://10.108.3.41/arcgis_js_api/library/4.18/esri/css/main.css'
,
cssUrl
:
'http://10.108.3.41/arcgis_js_api/library/4.18/esri/css/main.css'
,
...
@@ -92,6 +46,7 @@ export default {
...
@@ -92,6 +46,7 @@ export default {
TOKEN
,
TOKEN
,
mdtUser
,
mdtUser
,
imperToken
,
imperToken
,
imperMdtUser
,
BASE_URL
,
BASE_URL
,
MAP_CONFIG
,
MAP_CONFIG
,
ORGANIZATION
:
'733d0ac0-f67e-4bde-8872-3ca00983f18c'
,
ORGANIZATION
:
'733d0ac0-f67e-4bde-8872-3ca00983f18c'
,
...
...
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