Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
X
xzzxzmj
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
qd01
xzzxzmj
Commits
ddf31052
Commit
ddf31052
authored
Feb 14, 2025
by
zhangsan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
e8d3913e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
14 deletions
+33
-14
index.ts
src/router/index.ts
+9
-1
cookie.ts
src/utils/cookie.ts
+13
-0
index.vue
src/views/login/index.vue
+11
-13
No files found.
src/router/index.ts
View file @
ddf31052
...
@@ -4,7 +4,7 @@ import "nprogress/nprogress.css";
...
@@ -4,7 +4,7 @@ import "nprogress/nprogress.css";
import
{
useUserInfo
}
from
"
@/composables/useUserInfo
"
;
import
{
useUserInfo
}
from
"
@/composables/useUserInfo
"
;
import
{
checkVersion
}
from
"
@/services/version
"
;
import
{
checkVersion
}
from
"
@/services/version
"
;
import
{
generateRoutes
}
from
"
@/utils/generateRoutes
"
;
import
{
generateRoutes
}
from
"
@/utils/generateRoutes
"
;
import
request
from
"
@/utils/request
"
;
// 生成路由配置
// 生成路由配置
const
routes
=
generateRoutes
();
const
routes
=
generateRoutes
();
...
@@ -58,6 +58,14 @@ router.beforeEach(async (to, from, next) => {
...
@@ -58,6 +58,14 @@ router.beforeEach(async (to, from, next) => {
if
(
token
)
{
if
(
token
)
{
const
{
getUserInfo
}
=
useUserInfo
();
const
{
getUserInfo
}
=
useUserInfo
();
await
getUserInfo
();
await
getUserInfo
();
request
.
get
(
'
/system/config/configKeys?code=appVersion
'
).
then
(
res
=>
{
if
(
res
.
code
==
200
)
{
if
(
res
?.
data
?.
appVersion
!==
sessionStorage
.
getItem
(
'
appVersion
'
))
{
sessionStorage
.
setItem
(
'
appVersion
'
,
res
?.
data
?.
appVersion
)
window
.
location
.
reload
()
}
}
})
}
}
});
});
...
...
src/utils/cookie.ts
0 → 100644
View file @
ddf31052
export
const
setCookie
=
(
name
:
string
,
value
:
string
)
=>
{
document
.
cookie
=
`
${
name
}
=
${
value
}
; path=/`
}
export
const
getCookie
=
(
name
:
string
)
=>
{
return
document
.
cookie
.
split
(
'
;
'
).
find
(
row
=>
row
.
startsWith
(
`
${
name
}
=`
))?.
split
(
'
=
'
)[
1
]
}
export
const
removeCookie
=
(
name
:
string
)
=>
{
document
.
cookie
=
`
${
name
}
=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT`
}
export
const
clearCookie
=
()
=>
{
document
.
cookie
=
'
token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT
'
}
src/views/login/index.vue
View file @
ddf31052
...
@@ -49,13 +49,14 @@
...
@@ -49,13 +49,14 @@
import
{
ref
}
from
'
vue
'
import
{
ref
}
from
'
vue
'
import
{
useRouter
}
from
'
vue-router
'
import
{
useRouter
}
from
'
vue-router
'
import
request
from
'
@/utils/request
'
import
request
from
'
@/utils/request
'
import
{
clearCookie
}
from
'
@/utils/cookie
'
const
router
=
useRouter
()
const
router
=
useRouter
()
const
loginFormRef
=
ref
()
const
loginFormRef
=
ref
()
const
loginUsername
=
ref
(
''
)
const
loginUsername
=
ref
(
''
)
const
loginPassword
=
ref
(
''
)
const
loginPassword
=
ref
(
''
)
const
loginLoading
=
ref
(
false
)
const
loginLoading
=
ref
(
false
)
sessionStorage
.
clear
()
clearCookie
()
const
onLoginSubmit
=
async
()
=>
{
const
onLoginSubmit
=
async
()
=>
{
const
isValid
=
await
loginFormRef
.
value
?.
validate
()
const
isValid
=
await
loginFormRef
.
value
?.
validate
()
if
(
isValid
)
{
if
(
isValid
)
{
...
@@ -80,17 +81,14 @@ const onLoginSubmit = async () => {
...
@@ -80,17 +81,14 @@ const onLoginSubmit = async () => {
}
}
}
}
}
}
// request.get('/business/businessConfig/queryConfigByCode', {
// kfurl,appdownload,appVersion
// params: {
request
.
get
(
'
/system/config/configKeys?code=appVersion
'
).
then
(
res
=>
{
// code: 'kfurl,appdownload,appVersion'
if
(
res
.
code
==
200
)
{
// }
sessionStorage
.
setItem
(
'
kfurl
'
,
res
?.
data
?.
kfurl
)
// }).then(res => {
sessionStorage
.
setItem
(
'
appdownload
'
,
res
?.
data
?.
appdownload
)
// if (res.code == 200) {
sessionStorage
.
setItem
(
'
appVersion
'
,
res
?.
data
?.
appVersion
)
// sessionStorage.setItem('kfurl', res.result.kfurl)
}
// sessionStorage.setItem('appdownload', res.result.appdownload)
})
// sessionStorage.setItem('appVersion', res.result.appVersion)
// }
// })
const
downloadApp
=
()
=>
{
const
downloadApp
=
()
=>
{
window
.
location
.
href
=
sessionStorage
.
getItem
(
'
appdownload
'
)
||
''
window
.
location
.
href
=
sessionStorage
.
getItem
(
'
appdownload
'
)
||
''
}
}
...
...
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