Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
X
xgdlapp
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
李苏
xgdlapp
Commits
2700e536
Commit
2700e536
authored
Jan 31, 2023
by
李苏
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gtoken
parent
038220d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
service.js
common/service/service.js
+2
-2
login.vue
pages/login/login.vue
+10
-0
No files found.
common/service/service.js
View file @
2700e536
...
@@ -9,7 +9,7 @@ let apiUrl = configService.apiUrl;
...
@@ -9,7 +9,7 @@ let apiUrl = configService.apiUrl;
const
getTokenStorage
=
()
=>
{
const
getTokenStorage
=
()
=>
{
let
token
=
''
let
token
=
''
try
{
try
{
token
=
uni
.
getStorageSync
(
ACCESS_TOKEN
)
token
=
uni
.
getStorageSync
(
'Gtoken'
)
}
catch
(
e
){
}
catch
(
e
){
//TODO handle the exception
//TODO handle the exception
console
.
log
(
"getTokenStorage"
,
token
)
console
.
log
(
"getTokenStorage"
,
token
)
...
@@ -50,7 +50,7 @@ uni.getStorageInfo({
...
@@ -50,7 +50,7 @@ uni.getStorageInfo({
})
})
config
.
header
=
{
config
.
header
=
{
...
config
.
header
,
...
config
.
header
,
'
X-Access-T
oken'
:
getTokenStorage
()
'
Gt
oken'
:
getTokenStorage
()
}
}
/*
/*
if (!token) { // 如果token不存在,调用cancel 会取消本次请求,但是该函数的catch() 仍会执行
if (!token) { // 如果token不存在,调用cancel 会取消本次请求,但是该函数的catch() 仍会执行
...
...
pages/login/login.vue
View file @
2700e536
...
@@ -223,6 +223,16 @@
...
@@ -223,6 +223,16 @@
"password"
:
""
"password"
:
""
})
})
}
}
uni
.
setStorage
({
key
:
'Gtoken'
,
data
:
res
.
data
.
data
.
token
,
success
:
function
(){
},
fail
()
{
}
})
uni
.
setStorage
({
uni
.
setStorage
({
key
:
'url_ley'
,
key
:
'url_ley'
,
data
:
s
,
data
:
s
,
...
...
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