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
34a3c442
Commit
34a3c442
authored
Jun 17, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into test
parents
90bbc848
9546f8ed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
5 deletions
+68
-5
waterDispenser.ts
src/api/waterDispenser.ts
+25
-0
WaterDispenser.tsx
src/pages/WaterDispenser/WaterDispenser.tsx
+43
-5
No files found.
src/api/waterDispenser.ts
View file @
34a3c442
...
...
@@ -71,3 +71,28 @@ export const fetchWaterEquipmentInfo = (params: {
url
:
`/dcxy/api/gx/devices/
${
params
.
deviceCode
}
`
,
data
:
params
,
});
enum
DefualtMode
{
code
=
1
,
scan
=
2
,
}
enum
Mode
{
code
=
1
,
scan
=
2
,
mix
=
3
,
}
export
type
PageConfigResponse
=
{
/** 校区id */
campusId
:
string
;
/** 混合模式下的默认使用方式(1.条码,2扫码) */
defualtMode
:
DefualtMode
;
/** 使用方式(1.条码,2扫码,3 混合) */
mode
:
Mode
;
};
export
const
fetchPageConfig
=
(
params
:
{
campusId
:
number
})
=>
gxFetch
({
url
:
'/dcxy/api/gx/pageConfigs'
,
data
:
params
,
});
src/pages/WaterDispenser/WaterDispenser.tsx
View file @
34a3c442
...
...
@@ -14,6 +14,8 @@ import {
waterBeginning
,
fetchWaterEquipmentInfo
,
DeviceInfoResponse
,
fetchPageConfig
,
PageConfigResponse
,
}
from
'@/api/waterDispenser'
;
import
{
Customer
}
from
'@/types/Customer/Customer'
;
import
{
connect
}
from
'@tarojs/redux'
;
...
...
@@ -33,6 +35,7 @@ type PageState = {
waterUsingState
:
boolean
;
useList
:
DeviceInfo
[];
timer
:
number
|
null
;
showToggleTag
:
boolean
;
};
type
IProps
=
PageStateProps
;
...
...
@@ -45,7 +48,7 @@ interface WaterDispenser {
userinfo
,
}))
class
WaterDispenser
extends
Component
{
constructor
(
props
)
{
constructor
(
props
:
IProps
)
{
super
(
props
);
this
.
state
=
{
waterUsingState
:
false
,
...
...
@@ -55,17 +58,49 @@ class WaterDispenser extends Component {
},
useList
:
[],
timer
:
null
,
showToggleTag
:
false
,
};
}
componentWillMount
()
{
this
.
getUsedEquipment
();
this
.
fetchPageConfig
();
}
componentWillUnmount
()
{
this
.
clearTimer
();
}
fetchPageConfig
()
{
const
{
userinfo
}
=
this
.
props
;
fetchPageConfig
({
campusId
:
userinfo
.
areaId
,
})
.
then
((
res
:
ResponseDataEntity
<
PageConfigResponse
>
)
=>
{
console
.
log
(
res
);
const
data
=
res
.
data
;
if
(
data
.
mode
===
3
)
{
if
(
data
.
defualtMode
===
1
)
{
this
.
toggleCodeState
();
}
else
{
this
.
setState
({
showToggleTag
:
true
,
});
}
}
else
if
(
data
.
mode
===
2
)
{
this
.
setState
({
showToggleTag
:
false
,
});
}
else
if
(
data
.
mode
===
1
)
{
Taro
.
redirectTo
({
url
:
'/pages/BarCode/BarCode'
,
});
}
})
.
catch
(
err
=>
{
console
.
error
(
err
);
});
}
clearTimer
()
{
const
{
timer
}
=
this
.
state
;
if
(
timer
)
{
...
...
@@ -215,13 +250,16 @@ class WaterDispenser extends Component {
waterUsingState
,
deviceInfo
:
{
code
,
position
},
useList
,
showToggleTag
,
}
=
this
.
state
;
return
(
<
View
className=
'WaterDispenser'
>
<
View
className=
'WaterDispenser-tg'
onClick=
{
this
.
toggleCodeState
}
>
<
Image
className=
'icon'
src=
{
CodeIcon
}
/>
<
Text
className=
'text'
>
显示条码
</
Text
>
</
View
>
{
showToggleTag
&&
(
<
View
className=
'WaterDispenser-tg'
onClick=
{
this
.
toggleCodeState
}
>
<
Image
className=
'icon'
src=
{
CodeIcon
}
/>
<
Text
className=
'text'
>
显示条码
</
Text
>
</
View
>
)
}
<
DeviceInfo
size=
'small'
code=
{
code
}
position=
{
position
}
/>
<
View
className=
'btn-box'
>
...
...
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