Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
elegantDeepKinase
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
elegantDeepKinase
Commits
72f1dc61
Commit
72f1dc61
authored
Feb 08, 2023
by
wangshufen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed:修改request.js token校验
parent
a05cccab
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
144 additions
and
145 deletions
+144
-145
src/components/SiderNav/index.js
+10
-10
src/routes/Home/TargetDetails/index.js
+1
-1
src/routes/Kinase/IndicationDetails/index.js
+75
-93
src/routes/Kinase/TargetDetails/index.js
+9
-5
src/routes/drugbank/TargetDetails/index.js
+1
-1
src/routes/drugbank/index.js
+0
-0
src/utils/request.js
+48
-35
No files found.
src/components/SiderNav/index.js
View file @
72f1dc61
...
...
@@ -12,16 +12,16 @@ const menus = [
icon
:
'search'
,
key
:
'/Kinase'
,
},
{
title
:
'PDB小分子搜索'
,
icon
:
'search'
,
key
:
'/MolecularSearch'
,
},
{
title
:
'分子对接'
,
icon
:
''
,
key
:
'/dockingUploadDetails'
,
},
//
{
//
title: 'PDB小分子搜索',
//
icon: 'search',
//
key: '/MolecularSearch',
//
},
//
{
//
title: '分子对接',
//
icon: '',
//
key: '/dockingUploadDetails',
//
},
{
title
:
'Drugbank'
,
icon
:
'medicine-box'
,
...
...
src/routes/Home/TargetDetails/index.js
View file @
72f1dc61
...
...
@@ -684,7 +684,7 @@ export default class TargetDetails extends Component {
columns
=
{
columnsMutation
}
/
>
<
/Panel
>
<
Panel
header
=
"Drug & Clinical i
m
formation"
key
=
"4"
>
<
Panel
header
=
"Drug & Clinical i
n
formation"
key
=
"4"
>
<
Table
bordered
rowKey
=
'item'
...
...
src/routes/Kinase/IndicationDetails/index.js
View file @
72f1dc61
import
React
,
{
Component
}
from
'react'
import
{
Pagination
,
message
,
Button
,
Tabs
,
Spin
,
Table
,
Tag
,
Typography
}
from
'antd'
import
request
from
'../../../utils/request'
import
'./index.css'
import
qs
from
'qs'
const
{
Title
}
=
Typography
import
React
,
{
Component
}
from
'react'
;
import
{
Pagination
,
message
,
Button
,
Tabs
,
Spin
,
Table
,
Tag
,
Typography
}
from
'antd'
;
import
request
from
'../../../utils/request'
;
import
'./index.css'
;
import
qs
from
'qs'
;
const
{
Title
}
=
Typography
;
export
default
class
IndicationDetails
extends
Component
{
state
=
{
IndicationList
:
[],
smilesData
:
qs
.
parse
(
this
.
props
.
location
.
search
.
slice
(
1
)),
total_num
:
0
total_num
:
0
,
};
componentDidMount
()
{
this
.
getDetails
();
}
componentDidMount
()
{
this
.
getDetails
()
}
getDetails
()
{
this
.
setState
({
loading
:
true
})
request
.
post
(
'/kinase/indication_search'
,
this
.
state
.
smilesData
)
.
then
(
res
=>
{
this
.
setState
({
loading
:
false
})
getDetails
()
{
this
.
setState
({
loading
:
true
});
request
.
post
(
'/kinase/indication_search'
,
this
.
state
.
smilesData
)
.
then
((
res
)
=>
{
this
.
setState
({
loading
:
false
});
if
(
res
.
data
.
code
===
200
)
{
this
.
setState
({
IndicationList
:
res
.
data
.
data
})
this
.
setState
({
total_num
:
res
.
data
.
total_num
})
this
.
setState
({
IndicationList
:
res
.
data
.
data
});
this
.
setState
({
total_num
:
res
.
data
.
total_num
});
}
else
{
message
.
error
(
res
.
data
.
msg
)
message
.
error
(
res
.
data
.
msg
)
;
}
})
.
catch
(
err
=>
{
console
.
error
(
err
)
})
.
catch
(
(
err
)
=>
{
console
.
error
(
err
)
;
})
;
}
onShowSizeChange
=
(
current
,
pageSize
)
=>
{
let
smilesData
=
this
.
state
.
smilesData
smilesData
.
page
=
current
smilesData
.
page_size
=
pageSize
let
smilesData
=
this
.
state
.
smilesData
;
smilesData
.
page
=
current
;
smilesData
.
page_size
=
pageSize
;
this
.
setState
({
smilesData
})
smilesData
,
})
;
this
.
getDetails
()
}
this
.
getDetails
()
;
}
;
onChange
=
(
current
,
pageSize
)
=>
{
let
smilesData
=
this
.
state
.
smilesData
smilesData
.
page
=
current
smilesData
.
page_size
=
pageSize
let
smilesData
=
this
.
state
.
smilesData
;
smilesData
.
page
=
current
;
smilesData
.
page_size
=
pageSize
;
this
.
setState
({
smilesData
})
this
.
getDetails
()
}
getOne
(
e
)
{
console
.
log
(
e
)
const
{
dataid
,
datatype
}
=
e
smilesData
,
});
this
.
getDetails
();
};
getOne
(
e
)
{
console
.
log
(
e
);
const
{
dataid
,
datatype
}
=
e
;
let
data
=
{
dataid
,
datatype
}
this
.
props
.
history
.
push
({
pathname
:
'/home/SearchDetails'
,
search
:
qs
.
stringify
(
data
)
})
datatype
,
};
this
.
props
.
history
.
push
({
pathname
:
'/kinase/SearchDetails'
,
search
:
qs
.
stringify
(
data
)
});
}
getOne2
(
e
)
{
console
.
log
(
e
)
const
{
dataid
,
datatype
}
=
e
getOne2
(
e
)
{
console
.
log
(
e
)
;
const
{
dataid
,
datatype
}
=
e
;
let
data
=
{
dataid
,
datatype
}
this
.
props
.
history
.
push
({
pathname
:
'/home/TargetDetails'
,
search
:
qs
.
stringify
(
data
)
})
datatype
,
};
this
.
props
.
history
.
push
({
pathname
:
'/kinase/TargetDetails'
,
search
:
qs
.
stringify
(
data
)
});
}
getReferences
=
(
e
)
=>
{
window
.
open
(
e
)
}
window
.
open
(
e
)
;
}
;
render
()
{
render
()
{
const
columns
=
[
{
title
:
'indicationName'
,
...
...
@@ -111,13 +97,17 @@ export default class IndicationDetails extends Component {
title
:
'Drug'
,
dataIndex
:
'Drug'
,
key
:
'Drug'
,
render
:
Drug
=>
(
render
:
(
Drug
)
=>
(
<
span
>
{
<
Tag
color
=
"blue"
onClick
=
{()
=>
{
this
.
getOne
(
Drug
)
}}
>
{(
Drug
.
name
)}
<
Tag
color
=
'blue'
onClick
=
{()
=>
{
this
.
getOne
(
Drug
);
}}
>
{
Drug
.
name
}
<
/Tag
>
}
<
/span
>
),
...
...
@@ -150,42 +140,34 @@ export default class IndicationDetails extends Component {
{
title
:
'References'
,
dataIndex
:
'References'
,
render
:
References
=>
(
render
:
(
References
)
=>
(
<
span
>
{
References
.
map
(
item
=>
{
{
References
.
map
(
(
item
)
=>
{
return
(
<
Tag
color
=
"blue"
key
=
{
item
}
onClick
=
{()
=>
{
this
.
getReferences
(
item
)
}}
>
<
Tag
color
=
'blue'
key
=
{
item
}
onClick
=
{()
=>
{
this
.
getReferences
(
item
);
}}
>
{
item
.
toUpperCase
()}
<
/Tag
>
)
)
;
})}
<
/span
>
),
},
]
const
{
IndicationList
,
total_num
}
=
this
.
state
]
;
const
{
IndicationList
,
total_num
}
=
this
.
state
;
return
(
<
div
className
=
'IndicationDetails-div'
>
<
Title
>
{
IndicationList
.
name
}
<
/Title
>
<
Table
bordered
rowKey
=
'item'
dataSource
=
{
IndicationList
}
pagination
=
{
false
}
columns
=
{
columns
}
/
>
<
Table
bordered
rowKey
=
'item'
dataSource
=
{
IndicationList
}
pagination
=
{
false
}
columns
=
{
columns
}
/
>
<
div
className
=
'bottom-div'
>
<
Pagination
showSizeChanger
onShowSizeChange
=
{
this
.
onShowSizeChange
}
onChange
=
{
this
.
onChange
}
total
=
{
total_num
}
/
>
<
Pagination
showSizeChanger
onShowSizeChange
=
{
this
.
onShowSizeChange
}
onChange
=
{
this
.
onChange
}
total
=
{
total_num
}
/
>
<
/div
>
<
/div
>
)
)
;
}
}
src/routes/Kinase/TargetDetails/index.js
View file @
72f1dc61
...
...
@@ -1144,7 +1144,7 @@ export default class TargetDetails extends Component {
<
Link
href
=
'#Sequence'
title
=
'Sequence'
/>
<
Link
href
=
'#Structure'
title
=
'Structure'
/>
<
Link
href
=
'#Mutation'
title
=
'Mutation'
/>
<
Link
href
=
'#Drug'
title
=
'Drug & Clinical i
m
formation'
/>
<
Link
href
=
'#Drug'
title
=
'Drug & Clinical i
n
formation'
/>
<
Link
href
=
'#Bioassay'
title
=
'Bioassay'
/>
<
/Anchor
>
<
/div
>
...
...
@@ -1261,9 +1261,13 @@ export default class TargetDetails extends Component {
{
/* {PanelList} */
}
<
Collapse
defaultActiveKey
=
{[
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
]}
onChange
=
{
this
.
callback
}
>
<
Panel
header
=
'Sequence'
key
=
'1'
id
=
'Sequence'
>
<
Button
type
=
'primary'
onClick
=
{
this
.
alignmentEve
}
>
alignment
<
/Button
>
<
div
>
<
Button
type
=
'primary'
onClick
=
{
this
.
alignmentEve
}
>
alignment
<
/Button
>
<
div
style
=
{{
width
:
'90%'
,
overflow
:
'scroll'
}}
>
{
targetsDetail
.
SequenceStr
}
<
/div
>
<
/div
>
<
div
className
=
'Sequence-div'
>
{
targetsDetail
.
Sequence
&&
targetsDetail
.
Sequence
.
map
((
item
,
index
)
=>
{
...
...
@@ -1451,7 +1455,7 @@ export default class TargetDetails extends Component {
<
Table
bordered
rowKey
=
'item'
dataSource
=
{
targetsDetail
.
MutationList
}
pagination
=
{
false
}
columns
=
{
columnsMutation
}
onChange
=
{
this
.
onChangeTable
}
/
>
<
Pagination
showSizeChanger
onShowSizeChange
=
{
this
.
onShowSizeChange
}
onChange
=
{
this
.
onChange
}
total
=
{
total_num
}
/
>
<
/Panel
>
<
Panel
header
=
'Drug & Clinical i
m
formation'
key
=
'4'
id
=
'Drug'
>
<
Panel
header
=
'Drug & Clinical i
n
formation'
key
=
'4'
id
=
'Drug'
>
<
Table
bordered
rowKey
=
'item'
dataSource
=
{
targetsDetail
.
DrugsInformation
}
pagination
=
{
false
}
expandedRowRender
=
{
expandedRowRender
}
columns
=
{
columnsDrug
}
/
>
<
Pagination
showSizeChanger
onShowSizeChange
=
{
this
.
onShowSizeChange3
}
onChange
=
{
this
.
onChange3
}
total
=
{
total_num3
}
/
>
<
/Panel
>
...
...
src/routes/drugbank/TargetDetails/index.js
View file @
72f1dc61
...
...
@@ -777,7 +777,7 @@ export default class TargetDetails extends Component {
})}
<
/Tabs
>
<
/Panel
>
<
Panel
header
=
"Drug&Clinical i
m
formation"
key
=
"6"
>
<
Panel
header
=
"Drug&Clinical i
n
formation"
key
=
"6"
>
<
Table
bordered
rowKey
=
"item"
...
...
src/routes/drugbank/index.js
View file @
72f1dc61
This diff is collapsed.
Click to expand it.
src/utils/request.js
View file @
72f1dc61
...
...
@@ -17,13 +17,54 @@ function disableF12() {
}
// disableF12();
//对axios二次封装
const
token
=
getQueryString
(
'token'
);
function
checkFetchToken
()
{
fetch
(
'http://69.235.144.91:8048/yszh-login/auth/checkToken'
,
{
method
:
'GET'
,
headers
:
{
accessToken
:
token
,
},
})
.
then
((
res
)
=>
res
.
json
())
.
then
((
res
)
=>
{
console
.
log
(
'fetch--res'
,
res
);
if
(
res
.
code
===
200
)
{
//校验通过,存储token
token
&&
localStorage
.
setItem
(
'token'
,
token
);
}
else
{
alert
(
'token校验失败,返回登录页'
);
// window.open('http://localhost:3000/#/login', '_self');
window
.
open
(
'http://69.235.144.91:3048/#/login'
,
'_self'
);
}
})
.
catch
(
function
(
err
)
{
console
.
log
(
'err'
,
err
);
window
.
open
(
'http://69.235.144.91:3048/#/login'
,
'_self'
);
});
// request
// .get('http://69.235.144.91:8048/yszh-login/auth/checkToken')
// .then((res) => {
// console.log('--res', res);
// if (res.data.code === 200) {
// console.log('token 检验通过');
// return config;
// } else {
// console.log('token校验没通过 返回登录页');
// window.open('http://69.235.144.91:3048/#/login', '_self');
// }
// })
// .catch((err) => {
// console.log('token校验没通过 返回登录页');
// window.open('http://69.235.144.91:3048/#/login', '_self');
// console.log('err', err);
// });
}
checkFetchToken
();
const
baseURL
=
'http://52.83.169.190:8002/'
;
//线上正式环境
// const baseURL = 'http://69.235.144.91:8002/'; 测试环境
//对axios二次封装
// console.log('getQueryString', getQueryString('token'));
// console.log('localStorage', localStorage.getItem('token'));
const
token
=
getQueryString
(
'token'
)
||
localStorage
.
getItem
(
'token'
);
const
request
=
axios
.
create
({
baseURL
,
timeout
:
15000
,
...
...
@@ -34,44 +75,16 @@ const request = axios.create({
},
});
function
checkToken
(
config
)
{
// alert(' 校验token111');
request
.
get
(
'http://69.235.144.91:8048/yszh-login/auth/checkToken'
)
.
then
((
res
)
=>
{
console
.
log
(
'--res'
,
res
);
if
(
res
.
data
.
code
===
200
)
{
console
.
log
(
'token 检验通过'
);
return
config
;
}
else
{
localStorage
.
removeItem
(
'token'
);
// alert(' 失败');
console
.
log
(
'token校验没通过 返回登录页'
);
// window.open('http://localhost:3000/#/login', '_self');
window
.
open
(
'http://69.235.144.91:3048/#/login'
,
'_self'
);
}
})
.
catch
((
err
)
=>
{
localStorage
.
removeItem
(
'token'
);
// alert(' 服务器报错');
console
.
log
(
'token校验没通过 返回登录页'
);
window
.
open
(
'http://69.235.144.91:3048/#/login'
,
'_self'
);
console
.
log
(
'err'
,
err
);
return
false
;
});
}
checkToken
();
//拦截器
request
.
interceptors
.
request
.
use
((
config
)
=>
{
// alert('拦截器..');
console
.
log
(
'token---'
,
'拦截器方法校验token'
);
console
.
log
(
config
);
if
(
getQueryString
(
'token'
)
||
localStorage
.
getItem
(
'token'
))
{
checkToken
(
config
);
if
(
localStorage
.
getItem
(
'token'
))
{
config
.
headers
[
'accessToken'
]
=
localStorage
.
getItem
(
'token'
);
return
config
;
}
else
{
console
.
log
(
'token为空....'
);
localStorage
.
removeItem
(
'token'
);
window
.
open
(
'http://69.235.144.91:3048/#/login'
,
'_self'
);
}
});
...
...
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