Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_wechat
Overview
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
pseer
gxpt_wechat
Commits
a69592a1
Commit
a69592a1
authored
Jan 06, 2024
by
zhangzhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户登录优化
parent
429ca7ba
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
15 deletions
+64
-15
index.js
common/vmeitime-http/index.js
+22
-5
login.vue
components/login/login.vue
+4
-0
order.vue
pages/order/order.vue
+6
-7
orderRecord.vue
pages/orderRecord/orderRecord.vue
+32
-3
No files found.
common/vmeitime-http/index.js
View file @
a69592a1
...
...
@@ -16,6 +16,8 @@ http.interceptor.request = (config => {
if
(
tokenHeaders
)
{
config
.
header
[
tokenHeaders
]
=
uni
.
getStorageSync
(
tokenHeaders
);
}
else
{
config
.
header
[
'Authori-zation'
]
=
''
}
let
data
=
config
.
data
;
...
...
@@ -72,11 +74,26 @@ http.interceptor.response = (config) => {
/
\/
chessCards
\/
consumeByUser/g
]
// if (urls.some(item => item.test(config.config.url)) && config.data.code == 401) {
// uni.navigateTo({
// url: '/pages/login/login'
// })
// }
if
(
config
.
data
.
code
==
401
)
{
// wx.login({
// success: (res) => {
// console.log(343444)
// let url=`/wechat/authorize/program/login?code=`+res.code
// http.post(url,res.code).then(res => {
// if (res.data.code == 200) {
// if (res.data.data.type === "login") {
// uni.setStorageSync('tokenHeaders', "Authori-zation")
// uni.setStorage({
// key: uni.getStorageSync('tokenHeaders'),
// data: res.data.data.token
// })
// }
// }
// })
// }
// })
}
if
(
!
[
401
,
200
,
500
].
includes
(
config
.
data
.
code
))
{
uni
.
showToast
({
icon
:
"none"
,
...
...
components/login/login.vue
View file @
a69592a1
...
...
@@ -49,6 +49,10 @@
uni
.
removeStorageSync
(
'tokenHeaders'
)
this
.
$refs
.
popupPhone
.
open
();
}
}
else
{
setTimeout
(()
=>
{
that
.
open
()
},
300
)
}
})
}
...
...
pages/order/order.vue
View file @
a69592a1
...
...
@@ -691,7 +691,7 @@
this
.
onUpdateIntervalList
()
},
// 更新时间的选取状态
onUpdateIntervalList
()
{
async
onUpdateIntervalList
()
{
this
.
useDateStatus
=
true
let
start
=
Number
(
this
.
startTime
.
split
(
":"
)[
0
])
...
...
@@ -709,7 +709,7 @@
}
else
if
(
this
.
orderType
==
1
&&
end
<=
start
)
{
end
+=
24
}
this
.
dateObj
=
this
.
onSetDateTime
(
this
.
startTime
,
this
.
endTime
);
this
.
dateObj
=
await
this
.
onSetDateTime
(
this
.
startTime
,
this
.
endTime
);
this
.
onGetUseCoupon
()
// 重新将数据还原到元数据
this
.
intervalList
=
[
...
...
@@ -753,13 +753,12 @@
preStartDate
:
this
.
dateObj
.
startDate
,
preEndDate
:
this
.
dateObj
.
endDate
}).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
&&
res
.
data
.
data
.
length
)
{
this
.
useCouponList
=
res
.
data
.
data
.
filter
(
item
=>
item
.
isAvailable
===
0
).
sort
((
a
,
b
)
=>
b
.
subPrice
-
a
.
subPrice
);
}
}
else
if
(
res
.
data
.
code
==
200
)
{
}
else
if
(
res
.
data
.
code
==
401
)
{
this
.
$refs
.
loginPop
.
open
();
}
this
.
onComputePrice
();
...
...
@@ -834,7 +833,7 @@
this
.
distanceIndex
=
0
;
this
.
onSetEndTime
()
},
onChangeMode
(
i
)
{
async
onChangeMode
(
i
)
{
if
(
this
.
modeIndex
===
i
)
return
;
this
.
modeIndex
=
i
;
this
.
duration
=
Number
(
this
.
packageMode
[
this
.
modeIndex
].
duration
);
...
...
@@ -874,7 +873,7 @@
})
}
// this.onComputePrice();
this
.
dateObj
=
this
.
onSetDateTime
(
this
.
startTime
,
this
.
endTime
);
this
.
dateObj
=
await
this
.
onSetDateTime
(
this
.
startTime
,
this
.
endTime
);
this
.
onGetUseCoupon
()
},
onDurationChange
(
i
)
{
...
...
@@ -1125,7 +1124,7 @@
}
},
// 将时间转换成完整日期
onSetDateTime
(
startTime
,
endTime
)
{
onSetDateTime
(
startTime
,
endTime
)
{
let
obj
=
{
startDate
:
""
,
endDate
:
''
...
...
pages/orderRecord/orderRecord.vue
View file @
a69592a1
...
...
@@ -107,7 +107,7 @@
<u-loadmore
:status=
"status"
:icon=
"true"
:line=
'true'
:loading-text=
"loadingText"
:loadmore-text=
"loadmoreText"
:nomore-text=
"nomoreText"
/>
</view>
<NoLogin
v-model=
"loginStatus"
/>
<NoLogin
v-model=
"loginStatus"
@
success=
"onLoading"
/>
<f-tabbar></f-tabbar>
</view>
</
template
>
...
...
@@ -115,7 +115,7 @@
<
script
>
import
config
from
"@/config/index.config"
import
fTabbar
from
'@/components/module/f-tabbar/f-tabbar'
;
import
{
dictList
}
from
"@/api/index.js"
;
import
{
dictList
,
login
}
from
"@/api/index.js"
;
import
{
orderList
}
from
"@/api/order.js"
...
...
@@ -217,6 +217,7 @@ import NoLogin from "@/components/noLogin/noLogin"
orderList
(
this
.
queryParams
).
then
(
res
=>
{
uni
.
hideLoading
()
if
(
res
.
data
.
code
==
200
)
{
this
.
loginStatus
=
true
let
list
=
res
.
data
.
rows
.
map
(
item
=>
{
return
{
...
item
,
...
...
@@ -235,10 +236,38 @@ import NoLogin from "@/components/noLogin/noLogin"
this
.
status
=
'nomore'
}
}
else
if
(
res
.
data
.
code
==
401
){
this
.
loginStatus
=
false
this
.
onLogin
()
}
})
},
onLogin
(){
let
that
=
this
;
wx
.
login
({
success
:
(
res
)
=>
{
login
(
res
.
code
).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
data
.
type
===
"login"
)
{
uni
.
setStorageSync
(
'tokenHeaders'
,
"Authori-zation"
)
uni
.
setStorage
({
key
:
uni
.
getStorageSync
(
'tokenHeaders'
),
data
:
res
.
data
.
data
.
token
})
setTimeout
(()
=>
{
that
.
queryParams
.
pageNum
=
1
that
.
onLoading
()
},
300
)
}
else
{
uni
.
removeStorageSync
(
'tokenHeaders'
)
this
.
loginStatus
=
false
}
}
else
{
that
.
onLogin
()
}
})
}
})
},
tabSelect
(
i
)
{
this
.
statusIndex
=
i
;
this
.
queryParams
.
pageNum
=
1
;
...
...
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