Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
intelligent_qp_manager
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
张伯涛
intelligent_qp_manager
Commits
b91b53d9
Commit
b91b53d9
authored
Oct 14, 2024
by
张伯涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
部分文件添加注释,以及登录接口调整
parent
9407724b
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
118 additions
and
13 deletions
+118
-13
.env.development
.env.development
+6
-0
.env.production
.env.production
+7
-0
package.json
package.json
+1
-0
userModel.ts
src/api/sys/model/userModel.ts
+3
-0
user.ts
src/api/sys/user.ts
+11
-6
httpEnum.ts
src/enums/httpEnum.ts
+1
-1
encryptionSetting.ts
src/settings/encryptionSetting.ts
+3
-0
localeSetting.ts
src/settings/localeSetting.ts
+5
-0
projectSetting.ts
src/settings/projectSetting.ts
+17
-0
user.ts
src/store/modules/user.ts
+5
-5
index.ts
src/utils/http/axios/index.ts
+1
-1
jsencrypt.js
src/utils/jsencrypt.js
+58
-0
No files found.
.env.development
View file @
b91b53d9
# Whether to open mock
# 是否开启mock数据,关闭时需要自行对接后台接口
VITE_USE_MOCK = true
# public path
# 资源公共路径,需要以 /开头和结尾
VITE_PUBLIC_PATH = /
# Basic interface address SPA
# 接口地址
# 如果没有跨域问题,直接在这里配置即可
VITE_GLOB_API_URL = /basic-api
# File upload address, optional
# 文件上传接口 可选
VITE_GLOB_UPLOAD_URL = /upload
# Interface prefix
# 接口地址前缀,有些系统所有接口地址都有前缀,可以在这里统一加,方便切换
VITE_GLOB_API_URL_PREFIX =
.env.production
View file @
b91b53d9
# Whether to open mock
# 是否开启mock
VITE_USE_MOCK = true
# public path
...
...
@@ -7,15 +8,21 @@ VITE_PUBLIC_PATH = /
# Whether to enable gzip or brotli compression
# Optional: gzip | brotli | none
# If you need multiple forms, you can use `,` to separate
# 打包是否输出gz|br文件
# 可选: gzip | brotli | none
# 也可以有多个, 例如 ‘gzip’|'brotli',这样会同时生成 .gz和.br文件
VITE_BUILD_COMPRESS = 'none'
# Basic interface address SPA
# 接口地址 可以由nginx做转发或者直接写实际地址
VITE_GLOB_API_URL = /basic-api
# File upload address, optional
# It can be forwarded by nginx or write the actual address directly
# 文件上传地址 可以由nginx做转发或者直接写实际地址
VITE_GLOB_UPLOAD_URL = /upload
# Interface prefix
# 接口地址前缀,有些系统所有接口地址都有前缀,可以在这里统一加,方便切换
VITE_GLOB_API_URL_PREFIX =
package.json
View file @
b91b53d9
...
...
@@ -85,6 +85,7 @@
"
dayjs
"
:
"
^1.11.10
"
,
"
echarts
"
:
"
^5.5.0
"
,
"
exceljs
"
:
"
^4.4.0
"
,
"
jsencrypt
"
:
"
^3.0.0-rc.1
"
,
"
html2canvas
"
:
"
^1.4.1
"
,
"
lodash-es
"
:
"
^4.17.21
"
,
"
mockjs
"
:
"
^1.1.0
"
,
...
...
src/api/sys/model/userModel.ts
View file @
b91b53d9
...
...
@@ -4,6 +4,9 @@
export
interface
LoginParams
{
username
:
string
;
password
:
string
;
rememberMe
:
boolean
;
code
:
string
|
number
;
uuid
:
string
|
number
}
export
interface
RoleInfo
{
...
...
src/api/sys/user.ts
View file @
b91b53d9
import
{
defHttp
}
from
'@/utils/http/axios'
;
import
{
LoginParams
,
LoginResultModel
,
GetUserInfoModel
}
from
'./model/userModel'
;
import
Qs
from
'qs'
;
import
{
ErrorMessageMode
}
from
'#/axios'
;
import
{
encrypt
}
from
'@/utils/jsencrypt.js'
import
{
ContentTypeEnum
}
from
"@/enums/httpEnum"
;
enum
Api
{
Login
=
'/login'
,
Login
=
'/
auth/
login'
,
Logout
=
'/logout'
,
GetUserInfo
=
'/
getUser
Info'
,
GetUserInfo
=
'/
system/user/get
Info'
,
GetPermCode
=
'/getPermCode'
,
TestRetry
=
'/testRetry'
,
}
...
...
@@ -15,10 +17,13 @@ enum Api {
* @description: user login api
*/
export
function
loginApi
(
params
:
LoginParams
,
mode
:
ErrorMessageMode
=
'modal'
)
{
return
defHttp
.
post
<
LoginResultModel
>
(
return
defHttp
.
post
<
any
>
(
{
url
:
Api
.
Login
,
params
,
data
:
Qs
.
stringify
({
sign
:
encrypt
(
params
)
}),
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded'
},
},
{
errorMessageMode
:
mode
,
...
...
@@ -30,7 +35,7 @@ export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal')
* @description: getUserInfo
*/
export
function
getUserInfo
()
{
return
defHttp
.
get
<
GetUserInfoModel
>
({
url
:
Api
.
GetUserInfo
},
{
errorMessageMode
:
'none'
});
return
defHttp
.
get
<
any
>
({
url
:
Api
.
GetUserInfo
},
{
errorMessageMode
:
'none'
});
}
export
function
getPermCode
()
{
...
...
src/enums/httpEnum.ts
View file @
b91b53d9
...
...
@@ -2,7 +2,7 @@
* @description: Request result set
*/
export
enum
ResultEnum
{
SUCCESS
=
0
,
SUCCESS
=
20
0
,
ERROR
=
-
1
,
TIMEOUT
=
401
,
TYPE
=
'success'
,
...
...
src/settings/encryptionSetting.ts
View file @
b91b53d9
import
{
isDevMode
}
from
'@/utils/env'
;
// System default cache time, in seconds
// 缓存默认过期时间
export
const
DEFAULT_CACHE_TIME
=
60
*
60
*
24
*
7
;
// aes encryption key
// 开启缓存加密后,加密密钥。采用aes加密
export
const
cacheCipher
=
{
key
:
'_11111000001111@'
,
iv
:
'@11111000001111_'
,
};
// Whether the system cache is encrypted using aes
// 是否加密缓存,默认生产环境加密
export
const
SHOULD_ENABLE_STORAGE_ENCRYPTION
=
!
isDevMode
();
src/settings/localeSetting.ts
View file @
b91b53d9
...
...
@@ -7,16 +7,21 @@ export const LOCALE: { [key: string]: LocaleType } = {
};
export
const
localeSetting
:
LocaleSetting
=
{
// 是否显示语言选择器
showPicker
:
true
,
// Locale
// 当前语言
locale
:
LOCALE
.
ZH_CN
,
// Default locale
// 默认语言
fallback
:
LOCALE
.
ZH_CN
,
// available Locales
// 允许的语言
availableLocales
:
[
LOCALE
.
ZH_CN
,
LOCALE
.
EN_US
],
};
// locale list
// 语言列表
export
const
localeList
:
DropMenu
[]
=
[
{
text
:
'简体中文'
,
...
...
src/settings/projectSetting.ts
View file @
b91b53d9
...
...
@@ -16,32 +16,49 @@ import {
}
from
'./designSetting'
;
// ! You need to clear the browser cache after the change
// ! 改动后需要清空浏览器缓存
const
setting
:
ProjectConfig
=
{
// Whether to show the configuration button
// 是否显示SettingButton
showSettingButton
:
true
,
// Whether to show the theme switch button
// 是否显示主题切换按钮
showDarkModeToggle
:
true
,
// `Settings` button position
// 设置按钮位置 可选项
// SettingButtonPositionEnum.AUTO: 自动选择
// SettingButtonPositionEnum.HEADER: 位于头部
// SettingButtonPositionEnum.FIXED: 固定在右侧
settingButtonPosition
:
SettingButtonPositionEnum
.
AUTO
,
// Permission mode
// 权限模式,默认前端角色权限模式
// ROUTE_MAPPING: 前端模式(菜单由路由生成,默认)
// ROLE:前端模式(菜单路由分开)
permissionMode
:
PermissionModeEnum
.
ROUTE_MAPPING
,
// Permission-related cache is stored in sessionStorage or localStorage
// 权限缓存存放位置。默认存放于localStorage
permissionCacheType
:
CacheTypeEnum
.
LOCAL
,
// Session timeout processing
// 会话超时处理方案
// SessionTimeoutProcessingEnum.ROUTE_JUMP: 路由跳转到登录页
// SessionTimeoutProcessingEnum.PAGE_COVERAGE: 生成登录弹窗,覆盖当前页面
sessionTimeoutProcessing
:
SessionTimeoutProcessingEnum
.
ROUTE_JUMP
,
// color
// 项目主题色
themeColor
:
APP_PRESET_COLOR_LIST
[
0
],
// Website gray mode, open for possible mourning dates
// 网站灰色模式,用于可能悼念的日期开启
grayMode
:
false
,
// Color Weakness Mode
// 色弱模式
colorWeak
:
false
,
// Whether to cancel the menu, the top, the multi-tab page display, for possible embedded in other systems
...
...
src/store/modules/user.ts
View file @
b91b53d9
...
...
@@ -87,20 +87,19 @@ export const useUserStore = defineStore({
goHome
?:
boolean
;
mode
?:
ErrorMessageMode
;
},
):
Promise
<
GetUserInfoModel
|
null
>
{
):
Promise
<
any
|
null
>
{
try
{
const
{
goHome
=
true
,
mode
,
...
loginParams
}
=
params
;
const
data
=
await
loginApi
(
loginParams
,
mode
);
const
{
token
}
=
data
;
// save token
const
token
=
data
.
data
;
// 存储token
this
.
setToken
(
token
);
return
this
.
afterLoginAction
(
goHome
);
}
catch
(
error
)
{
return
Promise
.
reject
(
error
);
}
},
async
afterLoginAction
(
goHome
?:
boolean
):
Promise
<
GetUserInfoModel
|
null
>
{
async
afterLoginAction
(
goHome
?:
boolean
):
Promise
<
any
|
null
>
{
if
(
!
this
.
getToken
)
return
null
;
// get user info
const
userInfo
=
await
this
.
getUserInfoAction
();
...
...
@@ -128,6 +127,7 @@ export const useUserStore = defineStore({
async
getUserInfoAction
():
Promise
<
UserInfo
|
null
>
{
if
(
!
this
.
getToken
)
return
null
;
const
userInfo
=
await
getUserInfo
();
console
.
log
(
'userInfo'
,
userInfo
)
const
{
roles
=
[]
}
=
userInfo
;
if
(
isArray
(
roles
))
{
const
roleList
=
roles
.
map
((
item
)
=>
item
.
value
)
as
RoleEnum
[];
...
...
src/utils/http/axios/index.ts
View file @
b91b53d9
...
...
@@ -40,7 +40,7 @@ const transform: AxiosTransform = {
}
// 不进行任何处理,直接返回
// 用于页面代码可能需要直接获取code,data,message这些信息时开启
if
(
!
isTransformResponse
)
{
if
(
isTransformResponse
)
{
return
res
.
data
;
}
// 错误的时候返回
...
...
src/utils/jsencrypt.js
0 → 100644
View file @
b91b53d9
import
JSEncrypt
from
'jsencrypt/bin/jsencrypt'
// 密钥对生成 http://web.chacuo.net/netrsakeypair
const
publicKey
=
'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu6EsPHTuCzwyZ7D0/OhW
\
n'
+
'QDQdB9tByC0vDnb7k7gmT0h77/mmJYcwvuqUdj+PXKO+V1NlJJqlf61UjcQkWD9o
\
n'
+
'K6M1MHLHlS1qWXeXGaETClNUXAhdw2IkdBouXSHxyDkXYIDINYlOd91chxEBuBac
\
n'
+
'igJI0c5p9BA62QcOKDUE2mDJL+LOd70NCYsJf3um1IAgfKDX8RH2H3aPxy/BJ8aS
\
n'
+
'Edu+M9YDWsF6VFpaBr/WPPdouuPPjfs5203PCbvp0pvco+05JNDSiurEFcL+VDMm
\
n'
+
'wFNKExmeCvn/zr+UIkRPWHwxfJq+/gw/lt+UzBO2NURhCv4pQZy19vdFLLLeMM09
\
n'
+
'ewIDAQAB'
export
function
encrypt
(
data
)
{
const
json
=
JSON
.
stringify
(
data
)
const
encryptor
=
new
JSEncrypt
()
encryptor
.
setPublicKey
(
publicKey
)
return
encryptor
.
encrypt
(
json
)
}
export
function
encryptTwo
(
data
)
{
const
json
=
data
const
encryptor
=
new
JSEncrypt
()
encryptor
.
setPublicKey
(
publicKey
)
return
encryptor
.
encrypt
(
json
)
}
export
function
decrypt
(
txt
)
{
const
encryptor
=
new
JSEncrypt
()
encryptor
.
setPrivateKey
(
''
)
return
encryptor
.
decrypt
(
txt
)
}
const
passwordPublicKey
=
'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD
\
n'
+
'2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ=='
const
passwordPrivateKey
=
'MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8
\
n'
+
'mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9p
\
n'
+
'B6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue
\
n'
+
'/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZ
\
n'
+
'UBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6
\
n'
+
'vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha
\
n'
+
'4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3
\
n'
+
'tTbklZkD2A=='
// 加密
export
function
passwordEncrypt
(
txt
)
{
const
encryptor
=
new
JSEncrypt
()
encryptor
.
setPublicKey
(
passwordPublicKey
)
// 设置公钥
return
encryptor
.
encrypt
(
txt
)
// 对需要加密的数据进行加密
}
// 解密
export
function
passwordDecrypt
(
txt
)
{
const
encryptor
=
new
JSEncrypt
()
encryptor
.
setPrivateKey
(
passwordPrivateKey
)
return
encryptor
.
decrypt
(
txt
)
}
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