Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jd-vx-app
Project
Project
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
Administrator
jd-vx-app
Commits
3dff4007
Commit
3dff4007
authored
Dec 29, 2022
by
肖健
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
适配扫二维码打开绑定挪车码或者通知车主
parent
fbbf8b59
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
72 deletions
+84
-72
main.vue
pages/main.vue
+42
-47
moveCar.vue
pages/moveCar.vue
+42
-25
No files found.
pages/main.vue
View file @
3dff4007
...
...
@@ -105,32 +105,36 @@
uni
.
scanCode
({
success
:
(
res
)
=>
{
this
.
scanClick
=
true
let
path
=
res
.
path
if
(
path
)
{
let
paths
=
path
.
split
(
'?'
)[
1
]
let
scene
=
paths
.
split
(
"="
)[
1
]
// this.$http.request({
// url:'/app/user/c/m/c',
// method:'post',
// data:{
// code: scene
// },
// }).then(res => {
// console.log(res, "扫码通知车主")
// if (res.bindFlag) {
// that.gotoMoveCar(scene)
// } else {
// that.gotoBindMoveCar(scene)
// }
// })
this
.
goScene
(
scene
)
}
else
{
uni
.
showToast
({
title
:
"扫码失败!"
,
icon
:
'error'
,
})
}
if
(
res
.
errMsg
===
'scanCode:ok'
)
{
let
scanType
=
res
.
scanType
let
path
=
''
//扫的小程序码
if
(
scanType
===
'WX_CODE'
)
{
path
=
res
.
path
}
//扫的二维码
if
(
scanType
===
'QR_CODE'
)
{
path
=
res
.
result
}
if
(
path
)
{
let
paths
=
path
.
split
(
'?'
)[
1
]
let
scene
=
paths
.
split
(
"="
)[
1
]
this
.
goScene
(
scene
)
}
else
{
uni
.
showToast
({
title
:
"扫码失败!"
,
icon
:
'error'
,
})
}
}
else
{
uni
.
showToast
({
title
:
"扫码失败!"
,
icon
:
'error'
,
})
}
},
fail
:
()
=>
{
this
.
scanClick
=
true
...
...
@@ -255,6 +259,18 @@
}
},
onLoad
(
option
)
{
//扫码二维码进入小程序
if
(
option
.
q
)
{
let
q
=
decodeURIComponent
(
option
.
q
)
let
paths
=
q
.
split
(
'?'
)[
1
]
let
sceneParam
=
paths
.
split
(
"="
)[
1
]
//设置option里面的scene参数,以供接下来流程使用
option
.
scene
=
sceneParam
//清空二维码的q参数值
option
.
q
=
null
}
// 静默授权获取openid
let
openid
=
uni
.
getStorageSync
(
'openid'
);
if
(
!
openid
)
{
...
...
@@ -331,27 +347,6 @@
//获取二维码携带的参数
//扫码后得到的参数
this
.
goScene
(
that
.
scene
)
// that.http.httpTokenRequest({
// url: '/app/user/c/m/c',
// method: 'post'
// }, {
// code: that.scene
// }).then(res => {
// if (res.data.code == 200) {
// if (res.data.data.bindFlag) {
// that.gotoMoveCar(that.scene);
// } else {
// that.gotoBindMoveCar(that.scene);
// }
// uni.removeStorageSync('scene')
// } else {
// uni.showToast({
// title: res.data.msg,
// icon: 'none',
// duration: 2000
// });
// }
// })
}
else
{
let
routerLogin
=
uni
.
getStorageSync
(
'routerLogin'
)
let
tabbar
=
uni
.
getStorageSync
(
'tabbar'
)
...
...
pages/moveCar.vue
View file @
3dff4007
...
...
@@ -124,31 +124,48 @@
uni
.
scanCode
({
success
:
(
res
)
=>
{
this
.
scanClick
=
true
let
path
=
res
.
path
if
(
path
)
{
let
paths
=
path
.
split
(
'?'
)[
1
]
let
scene
=
paths
.
split
(
"="
)[
1
]
this
.
$http
.
request
({
url
:
'/app/user/c/m/c'
,
method
:
'post'
,
data
:{
code
:
scene
},
}).
then
(
res
=>
{
console
.
log
(
res
,
"扫码通知车主"
)
if
(
res
.
bindFlag
)
{
that
.
gotoMoveCar
(
scene
)
}
else
{
that
.
gotoBindMoveCar
(
scene
)
}
})
}
else
{
uni
.
showToast
({
title
:
"扫码失败!"
,
icon
:
'error'
,
})
}
if
(
res
.
errMsg
===
'scanCode:ok'
)
{
let
scanType
=
res
.
scanType
let
path
=
''
//扫的小程序码
if
(
scanType
===
'WX_CODE'
)
{
path
=
res
.
path
}
//扫的二维码
if
(
scanType
===
'QR_CODE'
)
{
path
=
res
.
result
}
if
(
path
)
{
let
paths
=
path
.
split
(
'?'
)[
1
]
let
scene
=
paths
.
split
(
"="
)[
1
]
this
.
$http
.
request
({
url
:
'/app/user/c/m/c'
,
method
:
'post'
,
data
:{
code
:
scene
},
}).
then
(
res
=>
{
console
.
log
(
res
,
"扫码通知车主"
)
if
(
res
.
bindFlag
)
{
that
.
gotoMoveCar
(
scene
)
}
else
{
that
.
gotoBindMoveCar
(
scene
)
}
})
}
else
{
uni
.
showToast
({
title
:
"扫码失败!"
,
icon
:
'error'
,
})
}
}
else
{
uni
.
showToast
({
title
:
"扫码失败!"
,
icon
:
'error'
,
})
}
},
fail
:
()
=>
{
this
.
scanClick
=
true
...
...
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