Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wx-school-app-public
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-public
Commits
3445931e
Commit
3445931e
authored
Apr 23, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整请求逻辑
parent
11e46672
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
29 deletions
+21
-29
index.tsx
src/pages/index/index.tsx
+21
-29
No files found.
src/pages/index/index.tsx
View file @
3445931e
...
...
@@ -62,7 +62,6 @@ class Index extends Component {
componentWillMount
()
{
this
.
loginHandle
().
then
(()
=>
{
const
{
userinfo
}
=
this
.
props
;
let
queryArr
=
Object
.
keys
(
this
.
$router
.
params
);
console
.
log
(
this
.
$router
.
params
);
...
...
@@ -70,22 +69,10 @@ class Index extends Component {
console
.
log
(
'scene:'
,
scene
);
if
(
scene
)
{
Taro
.
showLoading
();
let
entity
=
this
.
getDeviceEntity
(
scene
);
if
(
entity
)
{
getDeviceConfig
({
customerId
:
userinfo
.
customerId
,
...
entity
,
})
.
then
(
res
=>
{
console
.
log
(
res
);
})
.
catch
(
err
=>
{
console
.
error
(
err
);
Taro
.
showToast
({
title
:
err
.
msg
||
'设备码有误'
,
icon
:
'none'
,
});
});
this
.
getDeviceConfigHandle
(
entity
);
}
}
});
...
...
@@ -119,26 +106,41 @@ class Index extends Component {
}
scanHandle
()
{
const
{
userinfo
,
updateDeviceData
,
updatePayData
}
=
this
.
props
;
Taro
.
scanCode
({
onlyFromCamera
:
true
,
scanType
:
[
'qrCode'
],
})
.
then
(
res
=>
{
console
.
log
(
res
);
const
{
path
,
result
}
=
res
;
if
(
path
)
{
let
queryArr
=
path
.
split
(
'?'
);
let
queryStr
=
queryArr
.
length
>=
2
?
queryArr
[
1
]
:
''
;
console
.
log
(
result
,
queryArr
,
queryStr
);
const
{
serviceId
,
equipmentNum
}
=
this
.
getDeviceEntity
(
queryStr
);
const
entity
=
this
.
getDeviceEntity
(
queryStr
);
this
.
getDeviceConfigHandle
(
entity
);
}
else
{
Taro
.
showToast
({
title
:
'请扫描正确的设备码'
,
icon
:
'none'
,
});
}
})
.
catch
(
err
=>
{
console
.
error
(
err
);
});
}
getDeviceConfig
({
getDeviceConfigHandle
({
equipmentNum
,
serviceId
}:
DeviceEntity
)
{
Taro
.
showLoading
();
const
{
userinfo
,
updateDeviceData
,
updatePayData
}
=
this
.
props
;
return
getDeviceConfig
({
customerId
:
userinfo
.
customerId
,
equipmentNum
:
equipmentNum
,
serviceId
:
serviceId
,
})
.
then
(
res
=>
{
Taro
.
hideLoading
();
console
.
log
(
res
);
const
{
deviceInfoResponse
,
prepayConfigs
}
=
res
;
if
(
deviceInfoResponse
.
isUsed
)
{
...
...
@@ -158,16 +160,6 @@ class Index extends Component {
icon
:
'none'
,
});
});
}
else
{
Taro
.
showToast
({
title
:
'请扫描正确的设备码'
,
icon
:
'none'
,
});
}
})
.
catch
(
err
=>
{
console
.
error
(
err
);
});
}
getUserInfoHandle
(
res
)
{
...
...
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