Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
take_order
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
和慭琛
take_order
Commits
f2474220
Commit
f2474220
authored
May 17, 2021
by
Damon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
token过期处理
parent
502c78b5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
8 deletions
+19
-8
App.vue
take-order/App.vue
+15
-6
common.js
take-order/common/api/common.js
+4
-2
No files found.
take-order/App.vue
View file @
f2474220
...
...
@@ -133,7 +133,6 @@ export default {
var
that
=
this
that
.
globalData
.
token
=
util
.
getToken
()
console
.
log
(
that
.
globalData
.
token
,
'that.globalData.token'
)
that
.
initAPIneedToken
()
// uni.getStorage({
// key: 'token',
...
...
@@ -151,11 +150,21 @@ export default {
},
onShow
:
function
()
{
//if (!util.getToken()) {
this
.
autoLogin
()
//}
if
(
util
.
getToken
())
{
this
.
loginCheck
()
}
else
{
this
.
autoLogin
()
}
},
methods
:
{
methods
:
{
async
loginCheck
()
{
setTimeout
(
async
()
=>
{
let
result
=
await
this
.
$u
.
api
.
loginCheck
({
token
:
util
.
getToken
()})
if
(
!
result
.
data
)
{
this
.
autoLogin
()
}
},
0
)
},
getSystemInfo
()
{
try
{
let
a
=
wx
.
getSystemInfoSync
();
...
...
@@ -347,7 +356,7 @@ export default {
/**
* 用户自动登录
*/
autoLogin
()
{
autoLogin
()
{
let
that
=
this
uni
.
login
({
async
success
(
res
)
{
...
...
take-order/common/api/common.js
View file @
f2474220
...
...
@@ -4,12 +4,14 @@ const ucenterApiUrl = globalUrl.ucenterUrl.apiUrl
let
commonApiFun
=
function
(
vm
){
let
loginWxByUser
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
'/wxh-support-rest/rest/ssoinfo/v3/getUsersByCode'
,
params
);
let
loginWxByPhone
=
async
(
params
=
{})
=>
await
vm
.
$u
.
post
(
'/wxh-support-rest/rest/ssoinfo/v3/findByMobile'
,
params
,{
'content-type'
:
'application/x-www-form-urlencoded'
});
let
loginWechatAuth
=
async
(
params
=
{})
=>
await
vm
.
$u
.
post
(
'/wxh-support-rest/rest/ssoinfo/wxapp/unify/authorization'
,
params
,
{
'content-type'
:
'application/x-www-form-urlencoded'
});
let
loginWechatAuth
=
async
(
params
=
{})
=>
await
vm
.
$u
.
post
(
'/wxh-support-rest/rest/ssoinfo/wxapp/unify/authorization'
,
params
,
{
'content-type'
:
'application/x-www-form-urlencoded'
});
let
loginCheck
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
`/wxh-support-rest/rest/ssoinfo/wxapp/unify/check/
${
params
.
token
}
`
);
const
commonApi
=
{
loginWxByUser
,
loginWxByPhone
,
loginWechatAuth
,
loginWechatAuth
,
loginCheck
}
return
commonApi
}
...
...
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