Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
komatsu-lease-app
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
komatsu
komatsu-lease-app
Commits
bfe89019
Commit
bfe89019
authored
Dec 29, 2022
by
Step_by_step
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat 登录改造
parent
223aeb36
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
3 deletions
+20
-3
App.vue
src/App.vue
+18
-2
http.js
src/utils/http.js
+1
-1
login.js
src/utils/login.js
+1
-0
No files found.
src/App.vue
View file @
bfe89019
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
<
script
>
<
script
>
import
login
from
'@/utils/login'
import
login
from
'@/utils/login'
import
{
post
}
from
'@/utils/http'
export
default
{
export
default
{
name
:
"App"
,
name
:
"App"
,
...
@@ -30,10 +31,14 @@ export default {
...
@@ -30,10 +31,14 @@ export default {
};
};
},
},
async
mounted
()
{
async
mounted
()
{
localStorage
.
setItem
(
'userId'
,
5
)
localStorage
.
setItem
(
'userId'
,
5
)
// 可删
const
TempAccess
=
import
.
meta
.
env
.
DEV
?
'cb3939fa-8c0a-447d-8842-2d17d7b4555b'
:
''
localStorage
.
setItem
(
'phone'
,
"18388105084"
)
const
TempAccess
=
import
.
meta
.
env
.
DEV
?
'bcec5d6e-6d4e-4cff-abcc-b5a92ad6b58b'
:
''
if
(
import
.
meta
.
env
.
DEV
)
window
.
localStorage
.
setItem
(
'access_token'
,
TempAccess
)
// 可删
let
homePage
=
{
path
:
"applications"
,
replace
:
true
}
let
homePage
=
{
path
:
"applications"
,
replace
:
true
}
this
.
getBusinessToken
()
if
(
import
.
meta
.
env
.
PROD
)
{
if
(
import
.
meta
.
env
.
PROD
)
{
// 得保证 每个子应用中首页有 title
// 得保证 每个子应用中首页有 title
let
jumRouter
;
let
jumRouter
;
...
@@ -59,6 +64,17 @@ export default {
...
@@ -59,6 +64,17 @@ export default {
}
}
this
.
$router
.
push
(
homePage
);
this
.
$router
.
push
(
homePage
);
},
methods
:
{
async
getBusinessToken
()
{
const
baseURL
=
import
.
meta
.
env
.
DEV
?
'/api'
:
import
.
meta
.
env
.
VITE_HTTP_BASE_URL
let
res
=
await
post
(
`
${
baseURL
}
/app/api/app/user/token/get`
,
{
mobilePhone
:
window
.
localStorage
.
getItem
(
'phone'
),
loginType
:
'HLS_LOGIN'
,
hlsUserId
:
window
.
localStorage
.
getItem
(
'userId'
),
receivets
:
+
new
Date
()
+
''
})
if
(
res
.
success
&&
res
.
total
>
0
)
{
window
.
localStorage
.
setItem
(
'_token'
,
res
.
rows
[
0
]?.
token
)
}
}
}
}
};
};
</
script
>
</
script
>
...
...
src/utils/http.js
View file @
bfe89019
...
@@ -169,7 +169,7 @@ export function post(url, param = {}) {
...
@@ -169,7 +169,7 @@ export function post(url, param = {}) {
method
:
'post'
,
method
:
'post'
,
headers
:
headers
,
headers
:
headers
,
url
,
url
,
data
:
param
,
data
:
{...
param
,
_token
:
window
.
localStorage
.
getItem
(
'_token'
)}
,
}).
then
((
res
)
=>
{
}).
then
((
res
)
=>
{
resolve
(
res
)
resolve
(
res
)
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
...
...
src/utils/login.js
View file @
bfe89019
...
@@ -14,6 +14,7 @@ export function bridgeLogin() {
...
@@ -14,6 +14,7 @@ export function bridgeLogin() {
pushExtra
:
object
.
pushExtra
pushExtra
:
object
.
pushExtra
}
}
window
.
localStorage
.
setItem
(
'userId'
,
object
.
userId
)
window
.
localStorage
.
setItem
(
'userId'
,
object
.
userId
)
window
.
localStorage
.
setItem
(
'phone'
,
object
.
loginAccount
)
resolve
(
data
)
resolve
(
data
)
}
}
...
...
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