Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
LoginSystem
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
LoginSystem
Commits
13542d34
Commit
13542d34
authored
Feb 03, 2023
by
wangshufen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed:登录模块修改
parent
f1f79fcc
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
186 additions
and
177 deletions
+186
-177
.eslintrc.js
+21
-0
jsconfig.json
+11
-0
src/App.js
+1
-0
src/components/ContentMain/index.js
+1
-1
src/index.js
+0
-1
src/routes/Home/index.js
+40
-67
src/routes/Login/AccountLogin.js
+44
-62
src/utils/request.js
+44
-34
src/utils/utils.js
+24
-12
No files found.
.eslintrc.js
0 → 100644
View file @
13542d34
module
.
exports
=
{
root
:
true
,
//此项是用来告诉eslint找当前配置文件不能往父级查找
env
:
{
node
:
true
,
},
// "off" -> 0 关闭规则 "warn" -> 1 开启警告规则 "error" -> 2 开启错误规则
rules
:
{
'generator-star-spacing'
:
'off'
,
'no-tabs'
:
'off'
,
'no-unused-vars'
:
'off'
,
//声明的变量未使用
'no-console'
:
'off'
,
'no-irregular-whitespace'
:
'off'
,
'no-debugger'
:
'off'
,
eqeqeq
:
'off'
,
// 使用全等
},
parser
:
'babel-eslint'
,
parserOptions
:
{
ecmaVersion
:
7
,
sourceType
:
'module'
,
},
};
jsconfig.json
0 → 100644
View file @
13542d34
{
"compilerOptions"
:
{
"baseUrl"
:
"./"
,
"experimentalDecorators"
:
true
,
"paths"
:
{
"@/*"
:
[
"src/*"
]
}
}
}
\ No newline at end of file
src/App.js
View file @
13542d34
...
...
@@ -8,6 +8,7 @@ import './App.css'
import
'./assets/font/iconfont.css'
var
baseURL
=
'http://52.83.169.190:8005 '
class
App
extends
Component
{
render
()
{
return
(
...
...
src/components/ContentMain/index.js
View file @
13542d34
...
...
@@ -37,7 +37,7 @@ class ContentMain extends React.Component {
<
PrivateRoute
exact
path
=
'/home/SequenceDetails'
component
=
{
SequenceDetails
}
/
>
<
PrivateRoute
exact
path
=
'/computationalTools/ProteinTools'
component
=
{
ProteinTools
}
/
>
<
PrivateRoute
exact
path
=
'/computationalTools/MultipleSequenceAlignment'
component
=
{
MultipleSequenceAlignment
}
/
>
<
Redirect
exact
from
=
'/'
to
=
'/
home
'
/>
<
Redirect
exact
from
=
'/'
to
=
'/
login
'
/>
<
/Switch
>
<
/div
>
)
...
...
src/index.js
View file @
13542d34
...
...
@@ -9,7 +9,6 @@ import { Provider } from 'mobx-react'
import
{
LocaleProvider
}
from
'antd'
import
zh_CN
from
'antd/lib/locale-provider/zh_CN'
import
store
from
'./store'
//打包时,用的HashRouter并加上了basename,因为放在服务器的二级目录下
ReactDOM
.
render
(
<
HashRouter
>
...
...
src/routes/Home/index.js
View file @
13542d34
import
React
from
"react"
;
import
{
Form
,
Input
,
Button
,
Select
,
Tabs
,
message
,
Radio
,
Checkbox
,
Row
,
Col
,
Card
,
}
from
"antd"
;
import
LogoTitlte
from
"../../components/LogoTitlte/index"
;
import
{
Jsme
}
from
"jsme-react"
;
import
qs
from
"qs"
;
import
request
from
"../../utils/request"
;
import
"./index.css"
;
import
React
from
'react'
;
import
{
Form
,
Input
,
Button
,
Select
,
Tabs
,
message
,
Radio
,
Checkbox
,
Row
,
Col
,
Card
}
from
'antd'
;
import
LogoTitlte
from
'../../components/LogoTitlte/index'
;
import
{
Jsme
}
from
'jsme-react'
;
import
qs
from
'qs'
;
import
request
from
'../../utils/request'
;
import
'./index.css'
;
const
{
TabPane
}
=
Tabs
;
const
{
Option
}
=
Select
;
const
{
Meta
}
=
Card
;
...
...
@@ -24,27 +12,22 @@ const { Meta } = Card;
class
Home
extends
React
.
Component
{
state
=
{
// list: qs.parse(this.props.location.search.slice(1))
list
:
[
]
list
:
[],
};
componentDidMount
()
{
if
(
qs
.
parse
(
this
.
props
.
location
.
search
.
slice
(
1
)))
{
let
list
=
qs
.
parse
(
this
.
props
.
location
.
search
.
slice
(
1
))
var
arr
=
Array
.
from
(
Object
.
values
(
list
),
x
=>
x
);
let
list
=
qs
.
parse
(
this
.
props
.
location
.
search
.
slice
(
1
));
var
arr
=
Array
.
from
(
Object
.
values
(
list
),
(
x
)
=>
x
);
this
.
setState
({
list
:
arr
})
list
:
arr
,
})
;
}
}
getList
=
(
e
)
=>
{
this
.
setState
({
list
:
e
})
}
getList
=
(
e
)
=>
{
this
.
setState
({
list
:
e
,
});
};
getantibodyName
=
(
e
)
=>
{
const
{
value
}
=
e
.
target
;
let
searchData
=
this
.
state
.
searchData
;
...
...
@@ -94,7 +77,7 @@ class Home extends React.Component {
console
.
log
(
qs
.
parse
(
this
.
props
.
location
.
search
.
slice
(
1
)));
this
.
setState
({
loading
:
true
});
request
.
get
(
"/common/codes"
)
.
get
(
'/common/codes'
)
.
then
((
res
)
=>
{
console
.
log
(
res
);
if
(
res
.
data
.
code
===
0
)
{
...
...
@@ -138,7 +121,7 @@ class Home extends React.Component {
clinicalIndication
:
this
.
state
.
searchData
.
clinicalIndication
,
};
this
.
props
.
history
.
push
({
pathname
:
"/home/AutoimmuneDiseases"
,
pathname
:
'/home/AutoimmuneDiseases'
,
search
:
qs
.
stringify
(
data
),
});
};
...
...
@@ -146,7 +129,7 @@ class Home extends React.Component {
getList
=
()
=>
{
let
data
=
this
.
state
.
searchData
;
this
.
props
.
history
.
push
({
pathname
:
"/home/StructureSearch"
,
pathname
:
'/home/StructureSearch'
,
search
:
qs
.
stringify
(
data
),
});
};
...
...
@@ -184,9 +167,10 @@ class Home extends React.Component {
list
:
newList
,
});
};
getOne
=
(
e
)
=>
{
window
.
open
(
e
)
}
getOne
=
(
e
)
=>
{
console
.
log
(
'token========='
,
e
+
`?token=
${
localStorage
.
getItem
(
'token'
)}
`
);
window
.
open
(
e
+
`?token=
${
localStorage
.
getItem
(
'token'
)}
`
);
};
render
()
{
const
{
list
}
=
this
.
state
;
...
...
@@ -204,8 +188,8 @@ class Home extends React.Component {
wrapperCol
:
{
span
:
13
,
offset
:
8
},
};
return
(
<
div
className
=
"Docking-div"
>
<
div
className
=
"Docking-center"
>
<
div
className
=
'Docking-div'
>
<
div
className
=
'Docking-center'
>
{
/* <div className="logo-topdiv">
<img
alt="example"
...
...
@@ -213,52 +197,41 @@ class Home extends React.Component {
src={require("../../../assets/img/logo.png")}
/>
</div> */
}
<
div
className
=
"top-div"
>
<
div
className
=
'top-div'
>
<
Card
hoverable
style
=
{{
width
:
"100%"
,
width
:
'100%'
,
// backgroundColor: "#00FF00",
textAlign
:
"center"
,
fontSize
:
"30px"
,
textAlign
:
'center'
,
fontSize
:
'30px'
,
fontWeight
:
600
,
height
:
"150px"
,
lineHeight
:
"100px"
,
height
:
'150px'
,
lineHeight
:
'100px'
,
}}
>
<
div
className
=
"Computational-div"
>
<
div
className
=
'Computational-div'
>
<
div
>
welcome
to
our
platform
<
/div
>
<
/div
>
<
/Card
>
<
/div
>
<
div
className
=
"home-center"
>
<
div
className
=
"left-div"
>
<
div
className
=
'home-center'
>
<
div
className
=
'left-div'
>
{
list
.
map
((
item
,
index
)
=>
{
return
(
<
Button
type
=
{
item
.
state
?
"primary"
:
""
}
size
=
"large"
onClick
=
{()
=>
this
.
getListOne
(
index
,
item
.
name
)}
key
=
{
index
}
>
<
Button
type
=
{
item
.
state
?
'primary'
:
''
}
size
=
'large'
onClick
=
{()
=>
this
.
getListOne
(
index
,
item
.
name
)}
key
=
{
index
}
>
{
item
.
name
}
<
/Button
>
);
})}
<
/div
>
<
div
className
=
"right-div"
>
{
list
.
map
((
item
,
index
)
=>
{
<
div
className
=
'right-div'
>
{
list
.
map
((
item
,
index
)
=>
{
return
(
<
a
className
=
{
item
.
state
?
""
:
"displaydiv"
}
size
=
"large"
onClick
=
{()
=>
this
.
getOne
(
item
.
url
)}
key
=
{
index
}
>
欢迎进入
{
item
.
name
}
平台
<
a
className
=
{
item
.
state
?
''
:
'displaydiv'
}
size
=
'large'
onClick
=
{()
=>
this
.
getOne
(
item
.
url
)}
key
=
{
index
}
>
欢迎进入
{
item
.
name
}
平台
<
/a
>
);
})}
...
...
src/routes/Login/AccountLogin.js
View file @
13542d34
import
React
,
{
Component
}
from
"react"
;
import
{
inject
,
observer
}
from
'mobx-react/index'
import
{
withRouter
}
from
'react-router-dom'
import
{
Input
,
Button
,
Card
,
message
,
Form
,
Icon
,
Row
,
Col
}
from
"antd"
;
import
"./AccountLogin.css"
;
import
request
from
"../../utils/request"
;
import
qs
from
'qs'
import
React
,
{
Component
}
from
'react'
;
import
{
inject
,
observer
}
from
'mobx-react/index'
;
import
{
withRouter
}
from
'react-router-dom'
;
import
{
Input
,
Button
,
Card
,
message
,
Form
,
Icon
,
Row
,
Col
}
from
'antd'
;
import
'./AccountLogin.css'
;
import
request
from
'../../utils/request'
;
import
qs
from
'qs'
;
const
{
TextArea
}
=
Input
;
@
withRouter
@
inject
(
'appStore'
)
@
observer
@
Form
.
create
()
@
withRouter
@
inject
(
'appStore'
)
@
observer
@
Form
.
create
()
export
default
class
ProteinView
extends
Component
{
state
=
{
sequence
:
""
,
sequence
:
''
,
loading
:
false
,
listData
:
{},
imgUrl
:
""
,
imgUrl
:
''
,
};
componentDidMount
()
{
this
.
getImg
();
...
...
@@ -26,7 +29,7 @@ export default class ProteinView extends Component {
getList
()
{
this
.
setState
({
loading
:
true
});
request
.
post
(
"/tool/calc-protein-property"
,
{
sequence
:
this
.
state
.
sequence
})
.
post
(
'/tool/calc-protein-property'
,
{
sequence
:
this
.
state
.
sequence
})
.
then
((
res
)
=>
{
console
.
log
(
res
);
this
.
setState
({
loading
:
false
});
...
...
@@ -43,11 +46,11 @@ export default class ProteinView extends Component {
}
getImg
=
()
=>
{
request
.
get
(
"yszh-login/auth/getPicCaptchCode"
)
.
get
(
'yszh-login/auth/getPicCaptchCode'
)
.
then
((
res
)
=>
{
console
.
log
(
res
.
request
.
responseURL
);
var
num
=
Math
.
ceil
(
Math
.
random
()
*
10000
)
this
.
setState
({
imgUrl
:
res
.
request
.
responseURL
+
'?num='
+
num
});
var
num
=
Math
.
ceil
(
Math
.
random
()
*
10000
)
;
this
.
setState
({
imgUrl
:
res
.
request
.
responseURL
+
'?num='
+
num
});
})
.
catch
((
err
)
=>
{
this
.
setState
({
loading
:
false
});
...
...
@@ -67,24 +70,28 @@ export default class ProteinView extends Component {
userAccount
:
userAccount
,
userPwd
:
userPwd
,
picCaptcha
:
picCaptcha
,
type
:
"1"
,
type
:
'1'
,
};
if
(
!
err
)
{
request
.
post
(
"yszh-login/pub/login"
,
data
)
.
post
(
'yszh-login/pub/login'
,
data
)
.
then
((
res
)
=>
{
console
.
log
(
res
);
this
.
setState
({
loading
:
false
});
if
(
res
.
data
.
code
===
200
)
{
message
.
success
(
"登录成功"
);
console
.
log
(
res
.
data
.
result
.
indexVOList
);
window
.
localStorage
.
setItem
(
'token'
,
res
.
data
.
result
.
token
)
let
indexVOList
=
res
.
data
.
result
.
indexVOList
indexVOList
[
0
].
state
=
true
message
.
success
(
'登录成功'
);
window
.
localStorage
.
setItem
(
'token'
,
res
.
data
.
result
.
token
);
let
indexVOList
=
res
.
data
.
result
.
indexVOList
;
console
.
log
(
'indexVOList'
,
indexVOList
);
// indexVOList.push({ name: 'Kinase', url: 'http://172.16.20.12:3001/#/Kinase', state: false });
// indexVOList.push({ name: 'Computed', url: 'http://172.16.20.12:3002/#/home/Docking', state: false });
indexVOList
[
0
].
state
=
true
;
console
.
log
(
indexVOList
);
this
.
props
.
appStore
.
toggleLogin
(
true
,
{
username
:
'hahah'
})
const
{
from
}
=
{
from
:
{
pathname
:
'/home'
,
search
:
qs
.
stringify
(
indexVOList
),}}
this
.
props
.
history
.
push
(
from
)
this
.
props
.
appStore
.
toggleLogin
(
true
,
{
username
:
'hahah'
});
const
{
from
}
=
{
from
:
{
pathname
:
'/home'
,
search
:
qs
.
stringify
(
indexVOList
)
}
};
console
.
log
(
'qs.stringify(indexVOList)'
,
qs
.
stringify
(
indexVOList
));
console
.
log
(
'from'
,
from
);
this
.
props
.
history
.
push
(
from
);
}
else
{
message
.
error
(
res
.
data
.
message
);
}
...
...
@@ -103,61 +110,36 @@ export default class ProteinView extends Component {
const
{
getFieldDecorator
}
=
this
.
props
.
form
;
return
(
<
Form
onSubmit
=
{
this
.
handleSubmit
}
className
=
"login-form"
>
<
Form
onSubmit
=
{
this
.
handleSubmit
}
className
=
'login-form'
>
<
Form
.
Item
>
{
getFieldDecorator
(
"userAccount"
,
{
rules
:
[{
required
:
true
,
message
:
"帐号不能为空"
}],
})(
<
Input
prefix
=
{
<
Icon
type
=
"user"
style
=
{{
color
:
"rgba(0,0,0,.25)"
}}
/>
}
placeholder
=
"请输入帐号"
/>
)}
{
getFieldDecorator
(
'userAccount'
,
{
rules
:
[{
required
:
true
,
message
:
'帐号不能为空'
}],
})(
<
Input
prefix
=
{
<
Icon
type
=
'user'
style
=
{{
color
:
'rgba(0,0,0,.25)'
}}
/>} placeholder='请输入帐号' /
>
)}
<
/Form.Item
>
<
Form
.
Item
>
{
getFieldDecorator
(
"userPwd"
,
{
rules
:
[
{
required
:
true
,
message
:
"密码不能为空"
},
{
pattern
:
"^[^ ]+$"
,
message
:
"密码不能有空格"
},
],
})(
<
Input
prefix
=
{
<
Icon
type
=
"lock"
style
=
{{
color
:
"rgba(0,0,0,.25)"
}}
/>
}
type
=
"password"
placeholder
=
"密码"
/>
)}
{
getFieldDecorator
(
'userPwd'
,
{
rules
:
[{
required
:
true
,
message
:
'密码不能为空'
},
{
pattern
:
'^[^ ]+$'
,
message
:
'密码不能有空格'
}],
})(
<
Input
prefix
=
{
<
Icon
type
=
'lock'
style
=
{{
color
:
'rgba(0,0,0,.25)'
}}
/>} type='password' placeholder='密码' /
>
)}
<
/Form.Item
>
<
Form
.
Item
>
{
getFieldDecorator
(
"picCaptcha"
,
{
{
getFieldDecorator
(
'picCaptcha'
,
{
validateFirst
:
true
,
rules
:
[{
required
:
true
,
message
:
"请输入验证码"
}],
rules
:
[{
required
:
true
,
message
:
'请输入验证码'
}],
})(
<
Row
>
<
Col
span
=
{
15
}
>
<
Input
maxLength
=
{
5
}
placeholder
=
"验证码"
/>
<
Input
maxLength
=
{
5
}
placeholder
=
'验证码'
/>
<
/Col
>
<
Col
span
=
{
9
}
>
<
div
className
=
"Verification-code"
onClick
=
{
this
.
getImg
}
>
<
img
className
=
"VerifyCodeImg"
id
=
"showImg"
src
=
{
this
.
state
.
imgUrl
}
alt
=
""
/>
<
div
className
=
'Verification-code'
onClick
=
{
this
.
getImg
}
>
<
img
className
=
'VerifyCodeImg'
id
=
'showImg'
src
=
{
this
.
state
.
imgUrl
}
alt
=
''
/>
<
/div
>
<
/Col
>
<
/Row
>
)}
<
/Form.Item
>
<
Form
.
Item
>
<
Button
type
=
"primary"
style
=
{{
width
:
"100%"
}}
htmlType
=
"submit"
className
=
"login-form-button"
>
<
Button
type
=
'primary'
style
=
{{
width
:
'100%'
}}
htmlType
=
'submit'
className
=
'login-form-button'
>
登录
<
/Button
>
<
/Form.Item
>
...
...
src/utils/request.js
View file @
13542d34
// import axios from 'axios';
// axios.defaults.timeout = 15000
// export const request = axios.create({
// baseURL: 'http://52.83.230.236:9001/yszh/1/api/',
// });
import
axios
from
"axios"
;
// import { bind } from "file-loader";
axios
.
defaults
.
timeout
=
15000
console
.
log
(
window
.
localStorage
.
getItem
(
'token'
));
//设置请求得基准地址
axios
.
defaults
.
baseURL
=
'http://69.235.144.91:8048/'
const
request
=
axios
.
create
();
//设置请求头
// document.onkeydown = function () {
// var e = window.event || arguments[0]
// if (e.keyCode == 123) {
// return false
// } else if ((e.ctrlKey) && (e.shiftKey) && (e.keyCode == 73)) {
// return false
// }
// }
// document.oncontextmenu = function () {
// return false
// }
import
axios
from
'axios'
;
import
{
getQueryString
}
from
'./utils'
;
//禁用F12功能
function
disableF12
()
{
document
.
onkeydown
=
function
()
{
var
e
=
window
.
event
||
arguments
[
0
];
if
(
e
.
keyCode
==
123
)
{
return
false
;
}
else
if
(
e
.
ctrlKey
&&
e
.
shiftKey
&&
e
.
keyCode
==
73
)
{
return
false
;
}
};
//禁用鼠标右键
document
.
oncontextmenu
=
function
()
{
return
false
;
};
}
// disableF12();
// console.log('window.location.href', window.location);
// console.log('window-----', localStorage.getItem('token'));
// console.log('getQueryString', getQueryString('token'));
// console.log('localStorage', localStorage.getItem('token'));
const
baseURL
=
'http://69.235.144.91:8048/'
;
const
token
=
getQueryString
(
'token'
)
||
localStorage
.
getItem
(
'token'
);
const
request
=
axios
.
create
({
baseURL
,
timeout
:
15000
,
headers
:
{
// 'Content-Type': 'application/json',
accessToken
:
token
,
},
});
axios
.
defaults
.
headers
[
'content-type'
]
=
'application/json'
;
request
.
interceptors
.
request
.
use
(
config
=>
{
// 给请求头加token的字段,值为token
config
.
headers
.
token
=
window
.
localStorage
.
getItem
(
'token'
)
// request.interceptors.request.use((config) => {
// return config;
// });
// request.interceptors.response.use(
// (res) => {
// return res;
// },
// (err) => {
// console.log('err', err);
// return err;
// }
// );
return
config
})
//导出
export
default
request
;
src/utils/utils.js
View file @
13542d34
...
...
@@ -2,9 +2,9 @@ function accMul(arg1, arg2) {
let
m
=
0
;
const
s1
=
arg1
.
toString
();
const
s2
=
arg2
.
toString
();
m
+=
s1
.
split
(
"."
).
length
>
1
?
s1
.
split
(
"."
)[
1
].
length
:
0
;
m
+=
s2
.
split
(
"."
).
length
>
1
?
s2
.
split
(
"."
)[
1
].
length
:
0
;
return
Number
(
s1
.
replace
(
"."
,
""
))
*
Number
(
s2
.
replace
(
"."
,
""
))
/
10
**
m
;
m
+=
s1
.
split
(
'.'
).
length
>
1
?
s1
.
split
(
'.'
)[
1
].
length
:
0
;
m
+=
s2
.
split
(
'.'
).
length
>
1
?
s2
.
split
(
'.'
)[
1
].
length
:
0
;
return
(
Number
(
s1
.
replace
(
'.'
,
''
))
*
Number
(
s2
.
replace
(
'.'
,
''
)
))
/
10
**
m
;
}
export
function
digitUppercase
(
n
)
{
...
...
@@ -33,7 +33,6 @@ export function digitUppercase(n) {
.
replace
(
/^整$/
,
'零元整'
);
}
/**
* 生成指定区间的随机整数
* @param min
...
...
@@ -49,8 +48,8 @@ export function randomNum(min, max) {
* @param str
* @returns {number}
*/
export
function
calculateWidth
(
arr
){
return
30
+
arr
[
0
].
length
*
15
export
function
calculateWidth
(
arr
)
{
return
30
+
arr
[
0
].
length
*
15
;
}
/**
...
...
@@ -59,8 +58,22 @@ export function calculateWidth(arr){
* @constructor
*/
export
function
preloadingImages
(
arr
)
{
arr
.
forEach
(
item
=>
{
const
img
=
new
Image
()
img
.
src
=
item
})
}
\ No newline at end of file
arr
.
forEach
((
item
)
=>
{
const
img
=
new
Image
();
img
.
src
=
item
;
});
}
/**
* 获取URL中指定的参数
*/
export
function
getQueryString
(
name
)
{
let
reg
=
new
RegExp
(
'(^|&)'
+
name
+
'=([^&]*)(&|$)'
,
'i'
);
let
r
=
window
.
location
.
hash
.
split
(
'?'
)[
1
]
&&
window
.
location
.
hash
.
split
(
'?'
)[
1
].
match
(
reg
);
//获取url中"?"符后的字符串并正则匹配
let
context
=
''
;
if
(
r
!=
null
)
context
=
decodeURIComponent
(
r
[
2
]);
reg
=
null
;
r
=
null
;
return
context
==
null
||
context
==
''
||
context
==
'undefined'
?
''
:
context
;
}
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