Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wx-school-app
Project
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
姜雷
wx-school-app
Commits
d6447b62
Commit
d6447b62
authored
Jun 27, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改蓝牙洗浴设备开启逻辑
parent
56c23f9a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
3 deletions
+25
-3
Shower.tsx
src/pages/Shower/Shower.tsx
+25
-3
No files found.
src/pages/Shower/Shower.tsx
View file @
d6447b62
...
@@ -29,6 +29,10 @@ import OrderTitle from '../Order/components/OrderTitle/OrderTitle';
...
@@ -29,6 +29,10 @@ import OrderTitle from '../Order/components/OrderTitle/OrderTitle';
import
OrderInfo
from
'../Order/components/OrderInfo/OrderInfo'
;
import
OrderInfo
from
'../Order/components/OrderInfo/OrderInfo'
;
import
OrderPayway
from
'../Order/components/OrderPayway/OrderPayway'
;
import
OrderPayway
from
'../Order/components/OrderPayway/OrderPayway'
;
enum
BlueToothError
{
BlueToothNotOpen
=
'BlueToothNotOpen'
,
}
type
DeviceInfo
=
{
type
DeviceInfo
=
{
deviceId
:
string
;
deviceId
:
string
;
uuid
:
string
;
uuid
:
string
;
...
@@ -392,7 +396,7 @@ class Shower extends Component {
...
@@ -392,7 +396,7 @@ class Shower extends Component {
}
}
warnBluetoothOpen
()
{
warnBluetoothOpen
()
{
Taro
.
showModal
({
return
Taro
.
showModal
({
title
:
'警告'
,
title
:
'警告'
,
content
:
'为保障正常使用,请打开蓝牙功能'
,
content
:
'为保障正常使用,请打开蓝牙功能'
,
});
});
...
@@ -448,10 +452,12 @@ class Shower extends Component {
...
@@ -448,10 +452,12 @@ class Shower extends Component {
if
(
isOnlyBluetooth
)
{
if
(
isOnlyBluetooth
)
{
timer
=
setTimeout
(()
=>
{
timer
=
setTimeout
(()
=>
{
Taro
.
stopBluetoothDevicesDiscovery
();
Taro
.
stopBluetoothDevicesDiscovery
();
this
.
sendStartShower
();
},
10000
);
},
10000
);
}
else
{
}
else
{
timer
=
setTimeout
(()
=>
{
timer
=
setTimeout
(()
=>
{
Taro
.
stopBluetoothDevicesDiscovery
();
Taro
.
stopBluetoothDevicesDiscovery
();
this
.
sendStartShower
();
},
5000
);
},
5000
);
}
}
Taro
.
onBluetoothDeviceFound
(
res
=>
{
Taro
.
onBluetoothDeviceFound
(
res
=>
{
...
@@ -478,8 +484,24 @@ class Shower extends Component {
...
@@ -478,8 +484,24 @@ class Shower extends Component {
});
});
}
else
{
}
else
{
Taro
.
hideLoading
();
Taro
.
hideLoading
();
this
.
warnBluetoothOpen
();
return
this
.
warnBluetoothOpen
().
then
(
res
=>
{
throw
'未开启蓝牙'
;
if
(
res
.
confirm
)
{
const
{
isOnlyBluetooth
}
=
this
.
props
.
bluetoothDevice
;
if
(
!
isOnlyBluetooth
)
{
Taro
.
showLoading
({
title
:
'开启中'
,
mask
:
true
,
});
return
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
this
.
sendStartShower
();
reject
();
},
5000
);
});
}
}
throw
BlueToothError
.
BlueToothNotOpen
;
});
}
}
}
}
...
...
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