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
dfa0cadd
authored
Jun 02, 2021
by
wong.peiyi
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
增加F1打开开发者工具
parent
d7704f9d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
3 deletions
android/app/src/main/java/com/bonehouse_business_app/RNToolsManager.java
src/pages/index/index.tsx
src/pages/order/quick.tsx
src/utils/utils.ts
android/app/src/main/java/com/bonehouse_business_app/RNToolsManager.java
View file @
dfa0cadd
package
com
.
bonehouse_business_app
;
package
com
.
bonehouse_business_app
;
import
com.facebook.react.ReactApplication
;
import
com.facebook.react.bridge.Callback
;
import
com.facebook.react.bridge.Callback
;
import
com.facebook.react.bridge.LifecycleEventListener
;
import
com.facebook.react.bridge.Promise
;
import
com.facebook.react.bridge.Promise
;
import
com.facebook.react.bridge.ReactApplicationContext
;
import
com.facebook.react.bridge.ReactApplicationContext
;
import
com.facebook.react.bridge.ReactContextBaseJavaModule
;
import
com.facebook.react.bridge.ReactContextBaseJavaModule
;
import
com.facebook.react.bridge.ReactMethod
;
import
com.facebook.react.bridge.ReactMethod
;
import
com.facebook.react.uimanager.IllegalViewOperationException
;
import
com.facebook.react.uimanager.IllegalViewOperationException
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.content.pm.PackageInfo
;
import
android.content.pm.PackageInfo
;
import
android.content.pm.PackageManager
;
import
android.content.pm.PackageManager
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.view.KeyEvent
;
import
com.imagepicker.FileProvider
;
import
com.imagepicker.FileProvider
;
import
java.io.File
;
import
java.io.File
;
public
class
RNToolsManager
extends
ReactContextBaseJavaModule
{
public
class
RNToolsManager
extends
ReactContextBaseJavaModule
implements
LifecycleEventListener
{
public
RNToolsManager
(
ReactApplicationContext
reactContext
)
{
public
RNToolsManager
(
ReactApplicationContext
reactContext
)
{
super
(
reactContext
);
super
(
reactContext
);
reactContext
.
addLifecycleEventListener
(
this
);
}
}
// 重写getName方法声明Module类名称,在RN调用时用到
// 重写getName方法声明Module类名称,在RN调用时用到
...
@@ -82,4 +89,38 @@ public class RNToolsManager extends ReactContextBaseJavaModule {
...
@@ -82,4 +89,38 @@ public class RNToolsManager extends ReactContextBaseJavaModule {
String
STRING_API_ENV
=
getReactApplicationContext
().
getResources
().
getString
(
R
.
string
.
baseUrl
);
// 需要在 android/app/build.gradle 添加'productFlavors'
String
STRING_API_ENV
=
getReactApplicationContext
().
getResources
().
getString
(
R
.
string
.
baseUrl
);
// 需要在 android/app/build.gradle 添加'productFlavors'
promise
.
resolve
(
STRING_API_ENV
);
promise
.
resolve
(
STRING_API_ENV
);
}
}
/**
* 用于开发时打开开发者工具
*/
private
BroadcastReceiver
keyReceive
=
new
BroadcastReceiver
()
{
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
int
keyCode
=
intent
.
getIntExtra
(
"keyCode"
,
0
);
if
(
BuildConfig
.
DEBUG
&&
keyCode
==
KeyEvent
.
KEYCODE_F1
)
{
ReactApplication
application
=
(
ReactApplication
)
getReactApplicationContext
()
.
getCurrentActivity
()
.
getApplication
();
application
.
getReactNativeHost
().
getReactInstanceManager
().
showDevOptionsDialog
();
}
}
};
@Override
public
void
onHostResume
()
{
IntentFilter
filter
=
new
IntentFilter
();
filter
.
addAction
(
"android.rfid.FUN_KEY"
);
getCurrentActivity
().
registerReceiver
(
keyReceive
,
filter
);
}
@Override
public
void
onHostPause
()
{
getCurrentActivity
().
unregisterReceiver
(
keyReceive
);
}
@Override
public
void
onHostDestroy
()
{
}
}
}
\ No newline at end of file
src/pages/index/index.tsx
View file @
dfa0cadd
...
@@ -48,7 +48,9 @@ class Index extends Component<IProps> {
...
@@ -48,7 +48,9 @@ class Index extends Component<IProps> {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
const
{
navigation
,
store
,
orgStore
}
=
this
.
props
const
{
navigation
,
store
,
orgStore
}
=
this
.
props
!
store
.
token
&&
navigation
.
navigate
(
'Signin'
)
if
(
!
store
.
token
)
{
return
navigation
.
navigate
(
'Signin'
)
}
orgStore
.
getOrganizations
()
orgStore
.
getOrganizations
()
},
0
)
},
0
)
...
...
src/pages/order/quick.tsx
View file @
dfa0cadd
...
@@ -17,7 +17,7 @@ import * as R from 'ramda'
...
@@ -17,7 +17,7 @@ import * as R from 'ramda'
import
Form
from
'../../components/form'
import
Form
from
'../../components/form'
import
{
FieldType
}
from
'../../enums'
import
{
FieldType
}
from
'../../enums'
import
Header
from
'../../components/header/header'
import
Header
from
'../../components/header/header'
import
{
g
,
getFormItem
,
isBlank
,
isNotBlank
,
show
}
from
'../../utils/utils'
import
{
g
,
getFormItem
,
isBlank
,
isNotBlank
,
show
,
translateSysprofile
}
from
'../../utils/utils'
import
styles
from
'./quick.styl'
import
styles
from
'./quick.styl'
type
IProps
=
{
type
IProps
=
{
...
@@ -185,6 +185,42 @@ class QuickOrder extends Component<IProps> {
...
@@ -185,6 +185,42 @@ class QuickOrder extends Component<IProps> {
*/
*/
setOptionsFormItems
()
{
setOptionsFormItems
()
{
const
{
sysProfiles
}
=
this
.
props
.
sysStore
const
{
sysProfiles
}
=
this
.
props
.
sysStore
let
{
formItems
}
=
this
.
state
// 部门(00)第一位显示、第二位必需
let
dep
=
translateSysprofile
(
sysProfiles
.
OBS_MOBILE_DEPARTMENT_DISPLAY
)
if
(
dep
.
show
)
{
formItems
=
R
.
insert
(
2
,
{
field
:
'departmentCode'
,
label
:
'部门'
,
type
:
FieldType
.
SELECT
,
placeholder
:
'请选择'
,
options
:
[],
rules
:
[{
required
:
dep
.
required
,
message
:
'请选择客户'
}],
refrence
:
[
'orgCode'
],
},
formItems
,
)
}
// 业务经理(00)第一位显示、第二位必需
let
businessManager
=
translateSysprofile
(
sysProfiles
.
OBS_MOBILE_DEPARTMENT_DISPLAY
)
if
(
businessManager
.
show
)
{
}
// 跟台员(00)第一位显示、第二位必需
let
follower
=
translateSysprofile
(
sysProfiles
.
OBS_MOBILE_SUR_FOLLOWER_DISPLAY
)
if
(
follower
.
show
)
{
}
// 送货员(00)第一位显示、第二位必需
let
deliver
=
translateSysprofile
(
sysProfiles
.
OBS_MOBILE_DELIVERYMAN_DISPLAY
)
if
(
deliver
.
show
)
{
}
this
.
setState
({
formItems
})
}
}
/**
/**
...
...
src/utils/utils.ts
View file @
dfa0cadd
...
@@ -189,3 +189,17 @@ export const debounce = (fn: Function, wait = 300): Function => {
...
@@ -189,3 +189,17 @@ export const debounce = (fn: Function, wait = 300): Function => {
*/
*/
export
const
getFormItem
=
(
items
:
IFormField
[],
fieldName
:
string
)
=>
export
const
getFormItem
=
(
items
:
IFormField
[],
fieldName
:
string
)
=>
R
.
find
(
R
.
propEq
(
'field'
,
fieldName
),
items
)
R
.
find
(
R
.
propEq
(
'field'
,
fieldName
),
items
)
/**
* @description: 解释配置性的表单项的显示及必填
* @param {string} profile
* @return {*}
*/
export
const
translateSysprofile
=
(
profile
:
string
)
=>
{
if
(
isBlank
(
profile
))
{
return
{
show
:
false
,
required
:
false
}
}
const
show
=
R
.
ifElse
(
R
.
pathEq
([
0
],
'1'
),
R
.
T
,
R
.
F
)(
profile
)
const
required
=
R
.
ifElse
(
R
.
pathEq
([
1
],
'1'
),
R
.
T
,
R
.
F
)(
profile
)
return
{
show
,
required
}
}
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