Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
U
uni-pdtravel
Project
Project
Details
Activity
Releases
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
panyongping
uni-pdtravel
Commits
438d3a35
Commit
438d3a35
authored
Aug 28, 2024
by
潘永坪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录优化和原组合票定位取消
parent
3f9c3e3a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
80 deletions
+62
-80
combiChoose.vue
pages/combination/combiChoose/combiChoose.vue
+12
-34
login.vue
pages/login/login.vue
+50
-46
No files found.
pages/combination/combiChoose/combiChoose.vue
View file @
438d3a35
...
...
@@ -28,8 +28,7 @@
</
template
>
</view>
<view
v-if=
"showDistance"
class=
"title-right"
>
距您{{ item.distance ? parseFloat((item.distance / 1000).toFixed(2)) : 0 }}km
<view
class=
"title-right"
>
<u-icon
name=
"arrow-right"
style=
"margin-left: 4rpx;"
size=
'26'
color=
'#B4B4B4'
></u-icon>
</view>
</view>
...
...
@@ -229,7 +228,6 @@ export default {
currentNum
:
0
,
//轮播图下标
imgList
:
[],
//图片列表
scenicList
:
[],
//景区数据
showDistance
:
false
,
//定位成功显示距离
buyKnowData
:
''
,
//购买须知数据
chooseProduct
:
[],
//选中的产品
showModal
:
false
,
//是否显示模态框
...
...
@@ -361,38 +359,18 @@ export default {
let
newTimestamp
=
uni
.
getStorageSync
(
'newTimestamp'
)
||
''
let
token
=
uni
.
getStorageSync
(
'token'
)
if
(
token
)
{
uni
.
getLocation
({
type
:
'wgs84'
,
success
:
res
=>
{
let
latitude
=
res
.
latitude
//纬度
let
longitude
=
res
.
longitude
//经度
this
.
showDistance
=
true
//判断时间戳,之前请求失败,必须大于缓存时间戳才进行请求
if
(
newTimestamp
){
if
(
Date
.
now
()
>
newTimestamp
){
this
.
initList
(
latitude
,
longitude
)
}
else
{
this
.
showTip
=
true
}
}
else
{
this
.
initList
(
latitude
,
longitude
)
}
},
fail
:
res
=>
{
let
latitude
=
''
let
longitude
=
''
//判断时间戳,之前请求失败,必须大于缓存时间戳才进行请求
if
(
newTimestamp
){
if
(
Date
.
now
()
>
newTimestamp
){
this
.
initList
(
latitude
,
longitude
)
}
else
{
this
.
showTip
=
true
}
}
else
{
this
.
initList
(
latitude
,
longitude
)
}
let
latitude
=
''
let
longitude
=
''
//判断时间戳,之前请求失败,必须大于缓存时间戳才进行请求
if
(
newTimestamp
){
if
(
Date
.
now
()
>
newTimestamp
){
this
.
initList
(
latitude
,
longitude
)
}
else
{
this
.
showTip
=
true
}
})
}
else
{
this
.
initList
(
latitude
,
longitude
)
}
}
},
methods
:
{
...
...
pages/login/login.vue
View file @
438d3a35
...
...
@@ -10,7 +10,7 @@ export default {
}
},
onLoad
()
{
this
.
l
ogin
()
this
.
getCodeL
ogin
()
},
// 一般页面用onUnload
// tabbar页面用onHide
...
...
@@ -21,8 +21,8 @@ export default {
}
},
methods
:{
//---登录
l
ogin
(){
//---
获取编码并
登录
getCodeL
ogin
(){
uni
.
getProvider
({
service
:
'oauth'
,
success
:
proRes
=>
{
...
...
@@ -49,48 +49,7 @@ export default {
let
openid
=
res
.
data
.
openid
uni
.
setStorageSync
(
'openid'
,
openid
)
let
userId
=
res
.
data
.
userId
||
''
let
datas
=
{
openid
,
source
,
userId
}
this
.
$request
(
'wechatUser/login/findWxUserAndLogin'
,
datas
).
then
(
res
=>
{
//通过openid获取token
if
(
res
.
code
==
'00'
)
{
let
token
=
res
.
data
.
token
||
''
uni
.
setStorageSync
(
'token'
,
token
)
let
createUserId
=
res
.
data
.
personId
||
''
uni
.
setStorageSync
(
'createUserId'
,
createUserId
)
let
userId
=
res
.
data
.
userId
||
''
uni
.
setStorageSync
(
'userId'
,
userId
)
let
enterOptions
=
uni
.
getStorageSync
(
'enterOptions'
)
let
queryTotal
=
''
for
(
let
key
in
enterOptions
.
query
)
{
queryTotal
+=
'&'
+
key
+
'='
+
enterOptions
.
query
[
key
]
}
queryTotal
=
queryTotal
.
substr
(
1
)
if
(
token
)
{
uni
.
reLaunch
({
url
:
'/'
+
enterOptions
.
path
+
'?'
+
queryTotal
})
//保存当前日期
let
oldDate
=
this
.
$commonjs
.
today
()
uni
.
setStorageSync
(
'oldDate'
,
oldDate
)
// uni.navigateBack({
// delta:1
// })
}
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
icon
:
'none'
})
}
}).
catch
(
err
=>
{
uni
.
showToast
({
title
:
'登录失败,请退出并重新登录'
,
icon
:
'none'
})
this
.
timer
=
setTimeout
(()
=>
{
this
.
login
()
},
2000
)
})
this
.
login
(
openid
,
userId
,
source
)
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
...
...
@@ -103,7 +62,7 @@ export default {
icon
:
'none'
})
this
.
timer
=
setTimeout
(()
=>
{
this
.
l
ogin
()
this
.
getCodeL
ogin
()
},
2000
)
})
}
...
...
@@ -111,6 +70,51 @@ export default {
})
}
})
},
//---登录
login
(
openid
,
userId
,
source
){
let
datas
=
{
openid
,
userId
,
source
}
this
.
$request
(
'wechatUser/login/findWxUserAndLogin'
,
datas
).
then
(
res
=>
{
//通过openid获取token
if
(
res
.
code
==
'00'
)
{
let
token
=
res
.
data
.
token
||
''
uni
.
setStorageSync
(
'token'
,
token
)
let
createUserId
=
res
.
data
.
personId
||
''
uni
.
setStorageSync
(
'createUserId'
,
createUserId
)
let
userId
=
res
.
data
.
userId
||
''
uni
.
setStorageSync
(
'userId'
,
userId
)
let
enterOptions
=
uni
.
getStorageSync
(
'enterOptions'
)
let
queryTotal
=
''
for
(
let
key
in
enterOptions
.
query
)
{
queryTotal
+=
'&'
+
key
+
'='
+
enterOptions
.
query
[
key
]
}
queryTotal
=
queryTotal
.
substr
(
1
)
if
(
token
)
{
uni
.
reLaunch
({
url
:
'/'
+
enterOptions
.
path
+
'?'
+
queryTotal
})
//保存当前日期
let
oldDate
=
this
.
$commonjs
.
today
()
uni
.
setStorageSync
(
'oldDate'
,
oldDate
)
// uni.navigateBack({
// delta:1
// })
}
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
icon
:
'none'
})
}
}).
catch
(
err
=>
{
uni
.
showToast
({
title
:
'登录失败,请退出并重新登录'
,
icon
:
'none'
})
this
.
timer
=
setTimeout
(()
=>
{
this
.
login
(
openid
,
userId
,
source
)
},
2000
)
})
}
}
}
...
...
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