Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
web-project
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
紫光云
web-project
Commits
73f2ac34
Commit
73f2ac34
authored
May 31, 2024
by
jiaxu.yan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:文件类型声明
parent
e0bd8504
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
19 deletions
+26
-19
userModel.ts
src/api/sys/model/userModel.ts
+12
-2
user.ts
src/store/modules/user.ts
+1
-3
crypto.ts
src/utils/crypto.ts
+1
-1
LoginForm.vue
src/views/sys/login/LoginForm.vue
+12
-12
axios.d.ts
types/axios.d.ts
+0
-1
No files found.
src/api/sys/model/userModel.ts
View file @
73f2ac34
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*/
*/
export
interface
LoginParams
{
export
interface
LoginParams
{
username
:
string
;
username
:
string
;
password
:
string
;
password
:
string
|
boolean
;
redirectUrl
:
string
;
redirectUrl
:
string
;
redirectUri
:
string
;
redirectUri
:
string
;
rememberMe
:
boolean
;
rememberMe
:
boolean
;
...
@@ -27,5 +27,15 @@ export interface LoginResultModel {
...
@@ -27,5 +27,15 @@ export interface LoginResultModel {
* @description: Get user information return value
* @description: Get user information return value
*/
*/
export
interface
GetUserInfoModel
{
export
interface
GetUserInfoModel
{
data
:
any
;
roles
:
RoleInfo
[];
// 用户id
userId
:
string
|
number
;
// 用户名
username
:
string
;
// 真实名字
realName
:
string
;
// 头像
avatar
:
string
;
// 介绍
desc
?:
string
;
}
}
src/store/modules/user.ts
View file @
73f2ac34
...
@@ -98,7 +98,7 @@ export const useUserStore = defineStore({
...
@@ -98,7 +98,7 @@ export const useUserStore = defineStore({
// const { token } = data;
// const { token } = data;
// save token
// save token
// this.setToken(token
);
this
.
setToken
(
'c061d9c2-a0f2-44c8-a869-cad99e9c1fea'
);
return
this
.
afterLoginAction
(
goHome
);
return
this
.
afterLoginAction
(
goHome
);
}
catch
(
error
)
{
}
catch
(
error
)
{
return
Promise
.
reject
(
error
);
return
Promise
.
reject
(
error
);
...
@@ -108,7 +108,6 @@ export const useUserStore = defineStore({
...
@@ -108,7 +108,6 @@ export const useUserStore = defineStore({
// if (!this.getToken) return null;
// if (!this.getToken) return null;
// get user info
// get user info
const
userInfo
=
await
this
.
getUserInfoAction
();
const
userInfo
=
await
this
.
getUserInfoAction
();
console
.
log
(
userInfo
);
const
sessionTimeout
=
this
.
sessionTimeout
;
const
sessionTimeout
=
this
.
sessionTimeout
;
if
(
sessionTimeout
)
{
if
(
sessionTimeout
)
{
this
.
setSessionTimeout
(
false
);
this
.
setSessionTimeout
(
false
);
...
@@ -133,7 +132,6 @@ export const useUserStore = defineStore({
...
@@ -133,7 +132,6 @@ export const useUserStore = defineStore({
// if (!this.getToken) return null;
// if (!this.getToken) return null;
const
userInfo
=
await
getUserInfo
();
const
userInfo
=
await
getUserInfo
();
const
{
data
}
=
userInfo
;
const
{
data
}
=
userInfo
;
console
.
log
(
data
);
// if (isArray(roles)) {
// if (isArray(roles)) {
// const roleList = roles.map((item) => item.value) as RoleEnum[];
// const roleList = roles.map((item) => item.value) as RoleEnum[];
// this.setRoleList(roleList);
// this.setRoleList(roleList);
...
...
src/utils/crypto.ts
View file @
73f2ac34
...
@@ -3,7 +3,7 @@ import { JSEncrypt } from 'jsencrypt';
...
@@ -3,7 +3,7 @@ import { JSEncrypt } from 'jsencrypt';
const
keyHex
=
const
keyHex
=
'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMvGlIdli5G4Wpq780OxXm6U81CFIEyRAQkLsV+z/org+ut2Uz2z9tUOw5oMWEMZRwLhHcYDjm6Kh9DQmRKRnyMCAwEAAQ=='
;
'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMvGlIdli5G4Wpq780OxXm6U81CFIEyRAQkLsV+z/org+ut2Uz2z9tUOw5oMWEMZRwLhHcYDjm6Kh9DQmRKRnyMCAwEAAQ=='
;
// 加密
// 加密
function
encryptText
(
text
)
{
function
encryptText
(
text
:
string
):
string
|
boolean
{
const
instance
=
new
JSEncrypt
();
const
instance
=
new
JSEncrypt
();
instance
.
setPublicKey
(
keyHex
.
trim
());
instance
.
setPublicKey
(
keyHex
.
trim
());
console
.
log
(
keyHex
);
console
.
log
(
keyHex
);
...
...
src/views/sys/login/LoginForm.vue
View file @
73f2ac34
...
@@ -133,26 +133,26 @@
...
@@ -133,26 +133,26 @@
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
// const token = Cookies.get('JSESSIONID');
// const token = Cookies.get('JSESSIONID');
const
cookies
=
getJSESSIONID
();
const
cookies
=
document
.
cookie
;
// getSessionId();
console
.
log
(
cookies
);
console
.
log
(
cookies
);
// console.log(token);
// // 异步操作
// // 异步操作
// if (!token) {
// if (!token) {
// await handleLogin();
// await handleLogin();
// }
// }
});
});
function
getSessionId
()
{
function
getJSESSIONID
()
{
var
c_name
=
'JSESSIONID'
;
var
cookies
=
document
.
cookie
.
split
(
';'
);
if
(
document
.
cookie
.
length
>
0
)
{
for
(
var
i
=
0
;
i
<
cookies
.
length
;
i
++
)
{
var
c_start
=
document
.
cookie
.
indexOf
(
c_name
+
'='
);
var
cookie
=
cookies
[
i
].
trim
();
if
(
c_start
!=
-
1
)
{
// 检查当前cookie是否是'JSESSIONID'
c_start
=
c_start
+
c_name
.
length
+
1
;
if
(
cookie
.
startsWith
(
'JSESSIONID'
))
{
var
c_end
=
document
.
cookie
.
indexOf
(
';'
,
c_start
);
// 获取等号后面的部分,即JSESSIONID的值
if
(
c_end
==
-
1
)
c_end
=
document
.
cookie
.
length
;
var
value
=
cookie
.
split
(
'='
)[
1
];
return
unescape
(
document
.
cookie
.
substring
(
c_start
,
c_end
));
return
value
;
}
}
}
}
return
null
;
// 如果没有找到JSESSIONID,则返回null
}
}
async
function
handleLogin
()
{
async
function
handleLogin
()
{
const
data
=
await
validForm
();
const
data
=
await
validForm
();
...
...
types/axios.d.ts
View file @
73f2ac34
...
@@ -37,7 +37,6 @@ export interface RetryRequest {
...
@@ -37,7 +37,6 @@ export interface RetryRequest {
}
}
export
interface
Result
<
T
=
any
>
{
export
interface
Result
<
T
=
any
>
{
code
:
number
;
code
:
number
;
// type: 'success' | 'error' | 'warning';
dara
:
T
;
dara
:
T
;
msg
:
string
;
msg
:
string
;
}
}
...
...
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