Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
zhangzhonghua
/
BoneHouse_Business_APP
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b1e53680
authored
Jun 05, 2020
by
Denglingling
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1、完善自动登录;2、完善pc端配置菜单权限,APP显示动态菜单;
parent
dfd91c2c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
110 additions
and
45 deletions
app/Router.js
app/action/LoginAction.js
app/containers/common/SubSuccPage.js
app/containers/home/HomePage.js
app/containers/login/LoginPage.js
app/utils/Utils.js
app/Router.js
View file @
b1e53680
...
...
@@ -18,7 +18,7 @@ import FillUnitPricePage from './containers/equipConsu/module/FillUnitPricePage'
import
QuickOrderPage
from
'./containers/quickOrder/QuickOrderPage'
;
import
TransOrderPage
from
'./containers/transOrder/TransOrderPage'
;
import
TransSearchPage
from
'./containers/transOrder/module/TransSearchPage'
;
//
import HistoricalOrderPage from './containers/historicalOrder/HistoricalOrderPage';
import
HistoricalOrderPage
from
'./containers/historicalOrder/HistoricalOrderPage'
;
import
LineOrderPage
from
'./containers/historicalOrder/module/LineOrderPage'
;
import
SubSuccPage
from
'./containers/common/SubSuccPage'
;
...
...
@@ -35,7 +35,7 @@ const Router = createAppContainer(createStackNavigator({
QuickOrderPage
:
{
screen
:
QuickOrderPage
},
TransOrderPage
:
{
screen
:
TransOrderPage
},
TransSearchPage
:
{
screen
:
TransSearchPage
},
//
HistoricalOrderPage: {screen: HistoricalOrderPage},
HistoricalOrderPage
:
{
screen
:
HistoricalOrderPage
},
LineOrderPage
:
{
screen
:
LineOrderPage
},
SubSuccPage
:
{
screen
:
SubSuccPage
}
},
{
...
...
app/action/LoginAction.js
View file @
b1e53680
...
...
@@ -7,7 +7,7 @@ import {
AUTO_LOGIN_FAILURE
,
SET_DOMAIN_CONFIGURATE
}
from
'../base/ActionTypes'
;
import
{
PostRequest
,
GetRequest
}
from
'../network/RequestUtils'
;
import
{
PostRequest
}
from
'../network/RequestUtils'
;
import
{
show
}
from
'../utils/Utils'
;
export
function
requestLogin
(
params
)
{
...
...
@@ -15,16 +15,17 @@ export function requestLogin(params) {
dispatch
(
logining
());
let
{
global_domain_config
}
=
getState
().
login
PostRequest
(
global_domain_config
,
'/access_token/password/search?app_code=MOBILE'
,
params
).
then
((
res
)
=>
{
// console.log('res-------', res)
if
(
res
.
error_code
===
0
){
//
if(res.functions && res.functions.length) {
//
show('登录成功');
//
dispatch(loginSuccess(res, params.data.user_name, params.data.user_password));
//
} else {
//
show(`当前用户没有菜单权限,\n请联系管理员配置!`)
//
dispatch(loginFailure())
//
}
show
(
'登录成功'
);
dispatch
(
loginSuccess
(
res
,
params
.
data
.
user_name
,
params
.
data
.
user_password
));
if
(
res
.
functions
&&
res
.
functions
.
length
)
{
show
(
'登录成功'
);
dispatch
(
loginSuccess
(
res
,
params
.
data
.
user_name
,
params
.
data
.
user_password
));
}
else
{
show
(
`当前用户没有菜单权限,\n请联系管理员配置!`
)
dispatch
(
loginFailure
())
}
//
show('登录成功');
//
dispatch(loginSuccess(res, params.data.user_name, params.data.user_password));
}
else
{
let
error_msg
=
res
.
error_msg
||
res
.
message
if
(
res
.
error_code
==
-
3
)
{
...
...
@@ -87,13 +88,13 @@ export function autoLogin(params) {
PostRequest
(
global_domain_config
,
'/access_token/password/search?app_code=MOBILE'
,
params
).
then
((
res
)
=>
{
if
(
res
.
error_code
===
0
){
// console.warn('auto------',res);
//
if(res.functions && res.functions.length) {
//
dispatch(autoLoginSuccess(res));
//
} else {
//
show(`当前用户没有菜单权限,\n请联系管理员配置!`)
//
dispatch(autoLoginFailure())
//
}
dispatch
(
autoLoginSuccess
(
res
))
if
(
res
.
functions
&&
res
.
functions
.
length
)
{
dispatch
(
autoLoginSuccess
(
res
));
}
else
{
show
(
`当前用户没有菜单权限,\n请联系管理员配置!`
)
dispatch
(
autoLoginFailure
())
}
//
dispatch(autoLoginSuccess(res))
}
else
{
console
.
warn
(
res
.
error_msg
);
show
(
res
.
error_msg
);
...
...
app/containers/common/SubSuccPage.js
View file @
b1e53680
...
...
@@ -8,7 +8,6 @@ import {
TouchableOpacity
,
Clipboard
}
from
'react-native'
;
import
{
connect
}
from
'react-redux'
;
import
HeadBackItem
from
'./HeadBackItem'
;
import
{
promary_color
,
...
...
app/containers/home/HomePage.js
View file @
b1e53680
This diff is collapsed.
Click to expand it.
app/containers/login/LoginPage.js
View file @
b1e53680
...
...
@@ -48,8 +48,6 @@ class LoginPage extends Component{
}
componentDidMount
()
{
// this.subAutoLogin()
SplashScreen
.
hide
()
//关闭启动屏幕
this
.
timer
=
setTimeout
(()
=>
{
this
.
getLocalUserName
()
...
...
@@ -86,14 +84,19 @@ class LoginPage extends Component{
}
// 获取当前用户名
???
// 获取当前用户名
getLocalUserName
()
{
let
{
username
}
=
this
.
props
let
{
username
,
password
}
=
this
.
props
if
(
username
)
{
this
.
setState
({
username
})
}
if
(
password
)
{
this
.
setState
({
password
})
}
}
// 判断是否打开域名弹窗
...
...
@@ -135,18 +138,15 @@ class LoginPage extends Component{
// this.enterHomePage()
let
{
username
,
password
,
isSubLoding
}
=
this
.
state
// let {global_domain_config} = this.props
// if(global_domain_config.includes("obs.uat.guke.tech")) {
// show('请修改正确域名')
// return
// }
if
(
!
isSubLoding
)
{
if
(
isEmpty
(
username
))
{
show
(
'请输入用户名'
)
return
}
if
(
isEmpty
(
password
))
{
show
(
'请输入密码'
)
if
(
!
this
.
judgeRequireIsEmpty
())
{
return
}
let
params
=
{
...
...
@@ -162,25 +162,36 @@ class LoginPage extends Component{
// 自动登录
subAutoLogin
()
{
let
{
username
,
password
,
autoLogin
}
=
this
.
props
this
.
setState
({
username
,
password
})
// let { autoLogin } = this.props
// let { username, password } = this.state
// if(!this.judgeRequireIsEmpty()) {
// return
// }
// let params = {
// data:{
// grant_type: "PASSWORD",
// user_name: username,
// user_password: password
// }
// }
// autoLogin(params)
}
// 判断用户名、密码是否填写
judgeRequireIsEmpty
()
{
let
flag
=
true
let
{
username
,
password
}
=
this
.
state
if
(
isEmpty
(
username
))
{
return
show
(
'请输入用户名'
)
flag
=
false
return
flag
}
if
(
isEmpty
(
password
))
{
return
}
let
params
=
{
data
:{
grant_type
:
"PASSWORD"
,
user_name
:
username
,
user_password
:
password
}
show
(
'请输入密码'
)
flag
=
false
return
flag
}
autoLogin
(
params
)
return
flag
}
// 用户名改变
...
...
app/utils/Utils.js
View file @
b1e53680
...
...
@@ -159,6 +159,60 @@ export function cloneObject(obj) {
return
JSON
.
parse
(
JSON
.
stringify
(
obj
))
}
/**
* 引用数组升序排序
* @param {Array} arr 原数组
* @param {String} typeName 排序字段名
*/
export
function
ascArray
(
arr
,
typeName
)
{
if
(
!
arr
.
length
)
{
return
}
arr
.
sort
((
obj1
,
obj2
)
=>
{
return
obj1
[
typeName
]
-
obj2
[
typeName
]
})
return
arr
}
/**
* 引用数组降序排序
* @param {Array} arr 原数组
* @param {String} typeName 排序字段名
*/
export
function
descArray
(
arr
,
typeName
)
{
if
(
!
arr
.
length
)
{
return
}
arr
.
sort
((
obj1
,
obj2
)
=>
{
return
obj2
[
typeName
]
-
obj1
[
typeName
]
})
return
arr
}
/**
* 引用数组每一个对象,指定字段名及子项指定字段,的排序字段,都进行排序
* 如:arr= [{id:2, name: 'xiaomi', child: [{ id:8, name: 'caiyan', child: [] }, { id:6, name: 'change', child: [] }, { id:1, name: 'wangsan', child: [] }]
* @param {Array} arr 原数组 如:arr
* @param {String} speciField 指定字段 如:'child'
* @param {String} typeName 排序字段名 如:'id'
* @param {String} sortType 排序方式 默认 'asc', 降序'desc'
*/
export
function
referenceArrSort
(
arr
,
speciField
,
typeName
,
sortType
)
{
if
(
!
arr
.
length
)
{
return
}
if
(
sortType
==
'desc'
)
{
descArray
(
arr
,
typeName
)
}
else
{
ascArray
(
arr
,
typeName
)
}
arr
=
arr
.
map
(
item
=>
{
if
(
item
[
speciField
]
&&
item
[
speciField
].
length
)
{
referenceArrSort
(
item
[
speciField
],
speciField
,
typeName
,
sortType
)
}
return
item
})
return
arr
}
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