Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
computingPlatform
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangshufen
computingPlatform
Commits
9971d82c
Commit
9971d82c
authored
Feb 28, 2023
by
wangshufen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加readme.md文件
parent
35506fd4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
33 deletions
+68
-33
README.md
+42
-0
src/utils/request.js
+26
-33
No files found.
README.md
View file @
9971d82c
项目启动:
1.
yarn
2.
yarn start
项目打包上线
yarn build
项目改动的地方:
1.
Pharmacophore Tab页新增GPCR和Kinase

2.
Docking页面上传文件修改

src/utils/request.js
View file @
9971d82c
...
@@ -22,7 +22,8 @@ function disableF12() {
...
@@ -22,7 +22,8 @@ function disableF12() {
//对axios二次封装
//对axios二次封装
const
token
=
getQueryString
(
'token'
)
||
localStorage
.
getItem
(
'token'
);
const
token
=
getQueryString
(
'token'
)
||
localStorage
.
getItem
(
'token'
);
const
request
=
axios
.
create
({
const
request
=
axios
.
create
({
baseURL
:
'http://69.235.144.91:8087/'
,
// baseURL: 'http://69.235.144.91:8087/',
baseURL
:
'http://192.168.50.8:8087/'
,
//苏州本地
// baseURL: 'http://tcal.atelligence-ai.com/',
// baseURL: 'http://tcal.atelligence-ai.com/',
timeout
:
15000
,
timeout
:
15000
,
headers
:
{
headers
:
{
...
@@ -31,44 +32,36 @@ const request = axios.create({
...
@@ -31,44 +32,36 @@ const request = axios.create({
},
},
});
});
function
checkFetchToken
()
{
// 封装同步Ajax请求
fetch
(
'http://69.235.144.91:8048/yszh-login/auth/checkToken'
,
{
function
checkAjaxToken
()
{
method
:
'GET'
,
const
token
=
getQueryString
(
'token'
)
||
localStorage
.
getItem
(
'token'
);
headers
:
{
let
xhr
=
new
XMLHttpRequest
();
accessToken
:
token
,
xhr
.
open
(
'GET'
,
'http://69.235.144.91:8048/yszh-login/auth/checkToken'
,
false
);
},
xhr
.
setRequestHeader
(
'accessToken'
,
token
);
})
xhr
.
send
(
null
);
.
then
((
res
)
=>
res
.
json
())
console
.
log
(
xhr
);
//准备状态
.
then
((
res
)
=>
{
if
(
xhr
.
status
==
200
&&
JSON
.
parse
(
xhr
.
responseText
).
code
==
200
)
{
console
.
log
(
'fetch--res'
,
res
);
// 获取响应结果
if
(
res
.
code
===
200
)
{
// console.log(xhr.responseText);
//校验通过,存储token
token
&&
localStorage
.
setItem
(
'token'
,
token
);
token
&&
localStorage
.
setItem
(
'token'
,
token
);
return
true
;
}
else
{
}
else
{
alert
(
'token校验失败,返回登录页'
);
console
.
log
(
'状态码:'
+
xhr
.
status
+
',原因:'
+
xhr
.
responseText
);
// window.open('http://localhost:3000/#/login', '_self');
return
false
;
window
.
open
(
'http://ysplatform.atelligence-ai.com/#/login'
,
'_self'
);
}
}
})
.
catch
(
function
(
err
)
{
console
.
log
(
'err'
,
err
);
window
.
open
(
'http://ysplatform.atelligence-ai.com/#/login'
,
'_self'
);
});
}
}
checkFetch
Token
();
// checkAjax
Token();
//拦截器
//拦截器
request
.
interceptors
.
request
.
use
((
config
)
=>
{
// request.interceptors.request.use((config) => {
console
.
log
(
'token---'
,
'拦截器方法校验token'
);
// console.log('config', config);
console
.
log
(
config
);
// if (checkAjaxToken()) {
if
(
localStorage
.
getItem
(
'token'
))
{
// return config;
config
.
headers
[
'accessToken'
]
=
localStorage
.
getItem
(
'token'
);
// } else {
return
config
;
// console.log('token校验失败...');
}
else
{
// window.open('http://ysplatform.atelligence-ai.com/#/login', '_self');
console
.
log
(
'token为空....'
);
// }
window
.
open
(
'http://ysplatform.atelligence-ai.com/#/login'
,
'_self'
);
// });
}
});
request
.
interceptors
.
response
.
use
(
request
.
interceptors
.
response
.
use
(
(
res
)
=>
{
(
res
)
=>
{
...
...
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