Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bh_face_counter
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄天晨
bh_face_counter
Commits
00d89c03
Commit
00d89c03
authored
Mar 13, 2021
by
zhonghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
弹窗优化3
parent
02273754
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
5 deletions
+32
-5
FacePage.js
src/pages/FacePage.js
+14
-5
tools.js
src/utils/tools.js
+18
-0
No files found.
src/pages/FacePage.js
View file @
00d89c03
...
@@ -24,6 +24,7 @@ import {qrHost} from '../utils/config';
...
@@ -24,6 +24,7 @@ import {qrHost} from '../utils/config';
import
Icons
from
'react-native-vector-icons/MaterialIcons'
;
import
Icons
from
'react-native-vector-icons/MaterialIcons'
;
import
AutoClick
from
'../utils/AutoClick'
;
import
AutoClick
from
'../utils/AutoClick'
;
import
validity
from
'../utils/validity'
;
import
validity
from
'../utils/validity'
;
import
{
simpleDebounce
}
from
"../utils/tools"
;
@
connect
(({
admin
})
=>
({
admin
}))
@
connect
(({
admin
})
=>
({
admin
}))
class
FacePage
extends
Component
{
class
FacePage
extends
Component
{
...
@@ -41,7 +42,7 @@ class FacePage extends Component {
...
@@ -41,7 +42,7 @@ class FacePage extends Component {
tip
:
''
,
tip
:
''
,
tipsModal
:
false
,
tipsModal
:
false
,
faceType
:
'wxpay'
,
faceType
:
'wxpay'
,
sleep
:
true
,
// 屏保模式
//
sleep: true, // 屏保模式
loadingModal
:
false
,
loadingModal
:
false
,
qrCode
:
''
,
qrCode
:
''
,
goTipsModal
:
false
,
goTipsModal
:
false
,
...
@@ -52,9 +53,13 @@ class FacePage extends Component {
...
@@ -52,9 +53,13 @@ class FacePage extends Component {
phone
=
''
;
// 监听用户输入手机
phone
=
''
;
// 监听用户输入手机
// 设备类型
// 设备类型
//
sense = true; // 测试即拿刷脸设备
sense
=
true
;
// 测试即拿刷脸设备
async
componentWillMount
()
{
async
componentWillMount
()
{
this
.
goodsCounterInter
=
setInterval
(()
=>
{
this
.
getOrderDetailMiniCounter
();
},
800
);
this
.
orderDetailMiniPop
(
true
);
this
.
storeKey
=
await
AsyncStorage
.
getItem
(
'KEY'
);
this
.
storeKey
=
await
AsyncStorage
.
getItem
(
'KEY'
);
let
contact
=
await
AsyncStorage
.
getItem
(
'CONTACT'
);
let
contact
=
await
AsyncStorage
.
getItem
(
'CONTACT'
);
let
storeName
=
await
AsyncStorage
.
getItem
(
'NAME'
);
let
storeName
=
await
AsyncStorage
.
getItem
(
'NAME'
);
...
@@ -175,10 +180,11 @@ class FacePage extends Component {
...
@@ -175,10 +180,11 @@ class FacePage extends Component {
orderDetailMini
:
true
,
orderDetailMini
:
true
,
});
});
this
.
goodsCounterTimer
=
setTimeout
(()
=>
{
this
.
goodsCounterTimer
=
setTimeout
(()
=>
{
let
data
=
[];
clearInterval
(
this
.
goodsCounterInter
);
clearInterval
(
this
.
goodsCounterInter
);
this
.
setState
({
this
.
setState
({
orderDetailMini
:
false
,
orderDetailMini
:
false
,
goodsArr
:
[]
,
goodsArr
:
data
,
});
});
},
timeout
);
},
timeout
);
};
};
...
@@ -190,10 +196,12 @@ class FacePage extends Component {
...
@@ -190,10 +196,12 @@ class FacePage extends Component {
const
{
data
}
=
await
this
.
props
.
dispatch
({
const
{
data
}
=
await
this
.
props
.
dispatch
({
type
:
'goods/getOrderCounter'
,
type
:
'goods/getOrderCounter'
,
});
});
if
(
data
.
length
!==
0
)
{
if
(
data
.
length
!==
0
){
simpleDebounce
(()
=>
{
this
.
setState
({
this
.
setState
({
goodsArr
:
data
,
goodsArr
:
data
,
});
});
},
1000
)
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
Toast
.
show
(
'当前网络存在异常'
);
Toast
.
show
(
'当前网络存在异常'
);
...
@@ -393,9 +401,10 @@ class FacePage extends Component {
...
@@ -393,9 +401,10 @@ class FacePage extends Component {
}
else
if
(
this
.
sense
)
{
}
else
if
(
this
.
sense
)
{
this
.
setState
({
loadingModal
:
false
});
this
.
setState
({
loadingModal
:
false
});
if
(
ret
.
action
===
'enter'
)
{
if
(
ret
.
action
===
'enter'
)
{
// 轮询获取订单数据
this
.
goodsCounterInter
=
setInterval
(()
=>
{
this
.
goodsCounterInter
=
setInterval
(()
=>
{
this
.
getOrderDetailMiniCounter
();
this
.
getOrderDetailMiniCounter
();
},
30
00
);
},
5
00
);
this
.
orderDetailMiniPop
(
600000
);
// 十分钟后关闭弹窗
this
.
orderDetailMiniPop
(
600000
);
// 十分钟后关闭弹窗
}
}
}
}
...
...
src/utils/tools.js
0 → 100644
View file @
00d89c03
/**
* 简单防抖
* @param {Function} 防抖回调函数
* @param {Number} 触发时间
*/
export
function
simpleDebounce
(
fn
,
delay
=
500
)
{
let
timer
=
null
;
return
function
()
{
if
(
timer
)
{
clearTimeout
(
timer
);
}
timer
=
setTimeout
(()
=>
{
fn
.
apply
(
this
,
arguments
);
timer
=
null
;
},
delay
);
};
}
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