Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
啊嘞嘞EC
vue-vben-admin
提交
58940930
V
vue-vben-admin
项目概览
啊嘞嘞EC
/
vue-vben-admin
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-vben-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
58940930
编写于
2月 13, 2021
作者:
V
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
perf: adjust the return value of the interface to obtain user information in array format #259
上级
993538de
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
60 addition
and
45 deletion
+60
-45
CHANGELOG.zh_CN.md
CHANGELOG.zh_CN.md
+4
-0
mock/sys/user.ts
mock/sys/user.ts
+14
-10
package.json
package.json
+2
-1
src/api/sys/model/userModel.ts
src/api/sys/model/userModel.ts
+1
-1
src/store/modules/user.ts
src/store/modules/user.ts
+2
-4
src/utils/http/axios/Axios.ts
src/utils/http/axios/Axios.ts
+10
-14
src/utils/http/axios/checkStatus.ts
src/utils/http/axios/checkStatus.ts
+3
-3
yarn.lock
yarn.lock
+24
-12
未找到文件。
CHANGELOG.zh_CN.md
浏览文件 @
58940930
...
...
@@ -6,6 +6,10 @@
-
升级 husky 到 5.0
-
新增
`brotli`
|
`gzip`
压缩及相关测试命令
### ⚡ Performance Improvements
-
调整获取用户信息接口返回值为数组格式
### 🐛 Bug Fixes
-
修复 Upload 组件 maxNumber 失效问题
...
...
mock/sys/user.ts
浏览文件 @
58940930
...
...
@@ -10,10 +10,12 @@ function createFakeUserList() {
desc
:
'
manager
'
,
password
:
'
123456
'
,
token
:
'
fakeToken1
'
,
role
:
{
roleName
:
'
Super Admin
'
,
value
:
'
super
'
,
},
roles
:
[
{
roleName
:
'
Super Admin
'
,
value
:
'
super
'
,
},
],
},
{
userId
:
'
2
'
,
...
...
@@ -22,10 +24,12 @@ function createFakeUserList() {
realName
:
'
test user
'
,
desc
:
'
tester
'
,
token
:
'
fakeToken2
'
,
role
:
{
roleName
:
'
Tester
'
,
value
:
'
test
'
,
},
roles
:
[
{
roleName
:
'
Tester
'
,
value
:
'
test
'
,
},
],
},
];
}
...
...
@@ -49,9 +53,9 @@ export default [
if
(
!
checkUser
)
{
return
resultError
(
'
Incorrect account or password!
'
);
}
const
{
userId
,
username
:
_username
,
token
,
realName
,
desc
,
role
}
=
checkUser
;
const
{
userId
,
username
:
_username
,
token
,
realName
,
desc
,
role
s
}
=
checkUser
;
return
resultSuccess
({
role
,
role
s
,
userId
,
username
:
_username
,
token
,
...
...
package.json
浏览文件 @
58940930
...
...
@@ -113,7 +113,8 @@
},
"resolutions"
:
{
"//"
:
"Used to install imagemin dependencies, because imagemin may not be installed in China.If it is abroad, you can delete it"
,
"bin-wrapper"
:
"npm:bin-wrapper-china"
"bin-wrapper"
:
"npm:bin-wrapper-china"
,
"ecstatic"
:
"4.1.4"
},
"repository"
:
{
"type"
:
"git"
,
...
...
src/api/sys/model/userModel.ts
浏览文件 @
58940930
...
...
@@ -31,7 +31,7 @@ export interface LoginResultModel {
* @description: Get user information return value
*/
export
interface
GetUserInfoByUserIdModel
{
role
:
RoleInfo
;
role
s
:
RoleInfo
[]
;
// 用户id
userId
:
string
|
number
;
// 用户名
...
...
src/store/modules/user.ts
浏览文件 @
58940930
...
...
@@ -113,8 +113,6 @@ class User extends VuexModule {
// get user info
const
userInfo
=
await
this
.
getUserInfoAction
({
userId
});
// const name = FULL_PAGE_NOT_FOUND_ROUTE.name;
// name && router.removeRoute(name);
goHome
&&
(
await
router
.
replace
(
PageEnum
.
BASE_HOME
));
return
userInfo
;
}
catch
(
error
)
{
...
...
@@ -125,8 +123,8 @@ class User extends VuexModule {
@
Action
async
getUserInfoAction
({
userId
}:
GetUserInfoByUserIdParams
)
{
const
userInfo
=
await
getUserInfoById
({
userId
});
const
{
role
}
=
userInfo
;
const
roleList
=
[
role
.
value
]
as
RoleEnum
[];
const
{
role
s
}
=
userInfo
;
const
roleList
=
roles
.
map
((
item
)
=>
item
.
value
)
as
RoleEnum
[];
this
.
commitUserInfoState
(
userInfo
);
this
.
commitRoleListState
(
roleList
);
return
userInfo
;
...
...
src/utils/http/axios/Axios.ts
浏览文件 @
58940930
...
...
@@ -6,14 +6,13 @@ import { isFunction } from '/@/utils/is';
import
{
cloneDeep
}
from
'
lodash-es
'
;
import
type
{
RequestOptions
,
CreateAxiosOptions
,
Result
,
UploadFileParams
}
from
'
./types
'
;
// import { ContentTypeEnum } from '/@/enums/httpEnum';
import
{
errorResult
}
from
'
./const
'
;
import
{
ContentTypeEnum
}
from
'
/@/enums/httpEnum
'
;
export
*
from
'
./axiosTransform
'
;
/**
* @description: axios
模块
* @description: axios
module
*/
export
class
VAxios
{
private
axiosInstance
:
AxiosInstance
;
...
...
@@ -26,7 +25,7 @@ export class VAxios {
}
/**
* @description:
创建axios实例
* @description:
Create axios instance
*/
private
createAxios
(
config
:
CreateAxiosOptions
):
void
{
this
.
axiosInstance
=
axios
.
create
(
config
);
...
...
@@ -42,7 +41,7 @@ export class VAxios {
}
/**
* @description:
重新配置
axios
* @description:
Reconfigure
axios
*/
configAxios
(
config
:
CreateAxiosOptions
)
{
if
(
!
this
.
axiosInstance
)
{
...
...
@@ -52,7 +51,7 @@ export class VAxios {
}
/**
* @description:
设置通用
header
* @description:
Set general
header
*/
setHeader
(
headers
:
any
):
void
{
if
(
!
this
.
axiosInstance
)
{
...
...
@@ -62,7 +61,7 @@ export class VAxios {
}
/**
* @description:
拦截器配置
* @description:
Interceptor configuration
*/
private
setupInterceptors
()
{
const
transform
=
this
.
getTransform
();
...
...
@@ -78,7 +77,7 @@ export class VAxios {
const
axiosCanceler
=
new
AxiosCanceler
();
//
请求拦截器配置处理
//
Request interceptor configuration processing
this
.
axiosInstance
.
interceptors
.
request
.
use
((
config
:
AxiosRequestConfig
)
=>
{
// If cancel repeat request is turned on, then cancel repeat request is prohibited
const
{
...
...
@@ -91,12 +90,12 @@ export class VAxios {
return
config
;
},
undefined
);
//
请求拦截器错误捕获
//
Request interceptor error capture
requestInterceptorsCatch
&&
isFunction
(
requestInterceptorsCatch
)
&&
this
.
axiosInstance
.
interceptors
.
request
.
use
(
undefined
,
requestInterceptorsCatch
);
//
响应结果拦截器处理
//
Response result interceptor processing
this
.
axiosInstance
.
interceptors
.
response
.
use
((
res
:
AxiosResponse
<
any
>
)
=>
{
res
&&
axiosCanceler
.
removePending
(
res
.
config
);
if
(
responseInterceptors
&&
isFunction
(
responseInterceptors
))
{
...
...
@@ -105,14 +104,14 @@ export class VAxios {
return
res
;
},
undefined
);
//
响应结果拦截器错误捕获
//
Response result interceptor error capture
responseInterceptorsCatch
&&
isFunction
(
responseInterceptorsCatch
)
&&
this
.
axiosInstance
.
interceptors
.
response
.
use
(
undefined
,
responseInterceptorsCatch
);
}
/**
* @description:
文件上传
* @description:
File Upload
*/
uploadFile
<
T
=
any
>
(
config
:
AxiosRequestConfig
,
params
:
UploadFileParams
)
{
const
formData
=
new
window
.
FormData
();
...
...
@@ -145,9 +144,6 @@ export class VAxios {
});
}
/**
* @description: 请求方法
*/
request
<
T
=
any
>
(
config
:
AxiosRequestConfig
,
options
?:
RequestOptions
):
Promise
<
T
>
{
let
conf
:
AxiosRequestConfig
=
cloneDeep
(
config
);
const
transform
=
this
.
getTransform
();
...
...
src/utils/http/axios/checkStatus.ts
浏览文件 @
58940930
...
...
@@ -10,9 +10,9 @@ export function checkStatus(status: number, msg: string): void {
case
400
:
error
(
`
${
msg
}
`
);
break
;
// 401:
未登录
//
未登录则跳转登录页面,并携带当前页面的路径
//
在登录成功后返回当前页面,这一步需要在登录页操作。
// 401:
Not logged in
//
Jump to the login page if not logged in, and carry the path of the current page
//
Return to the current page after successful login. This step needs to be operated on the login page.
case
401
:
error
(
t
(
'
sys.api.errMsg401
'
));
userStore
.
loginOut
(
true
);
...
...
yarn.lock
浏览文件 @
58940930
...
...
@@ -2807,6 +2807,11 @@ chardet@^0.7.0:
resolved "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e"
integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==
charset@^1.0.1:
version "1.0.1"
resolved "https://registry.npmjs.org/charset/-/charset-1.0.1.tgz#8d59546c355be61049a8fa9164747793319852bd"
integrity sha512-6dVyOOYjpfFcL1Y4qChrAoQLRHvj2ziyhcm0QJlhOcAhykL/k1kTUPbeo+87MNRTRdk2OIIsIXbuF3x2wi5EXg==
chokidar@^3.5.1:
version "3.5.1"
resolved "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz#ee9ce7bbebd2b79f49f304799d5468e31e14e68a"
...
...
@@ -3811,15 +3816,17 @@ echarts@^4.9.0:
dependencies:
zrender "4.3.2"
ecstatic@^3.3.2:
version "
3.3.2
"
resolved "https://registry.npmjs.org/ecstatic/-/ecstatic-
3.3.2.tgz#6d1dd49814d00594682c652adb66076a69d46c48
"
integrity sha512-
fLf9l1hnwrHI2xn9mEDT7KIi22UDqA2jaCwyCbSUJh9a1V+LEUSL/JO/6TIz/QyuBURWUHrFL5Kg2TtO1bkkog
==
ecstatic@
4.1.4, ecstatic@
^3.3.2:
version "
4.1.4
"
resolved "https://registry.npmjs.org/ecstatic/-/ecstatic-
4.1.4.tgz#86bf340dabe56c4d0c93d406ac36c040f68e1d79
"
integrity sha512-
8E4ZLK4uRuB9pwywGpy/B9vcz4gCp6IY7u4cMbeCINr/fjb1v+0wf0Ae2XlfSnG8xZYnE4uaJBjFkYI0bqcIdw
==
dependencies:
charset "^1.0.1"
he "^1.1.1"
mime "^
1.6.0
"
mime "^
2.4.1
"
minimist "^1.1.0"
url-join "^2.0.5"
on-finished "^2.3.0"
url-join "^4.0.0"
ee-first@1.1.1:
version "1.1.1"
...
...
@@ -6416,11 +6423,16 @@ mime-types@~2.1.24:
dependencies:
mime-db "1.45.0"
mime@^1.4.1
, mime@^1.6.0
:
mime@^1.4.1:
version "1.6.0"
resolved "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==
mime@^2.4.1:
version "2.5.0"
resolved "https://registry.npmjs.org/mime/-/mime-2.5.0.tgz#2b4af934401779806ee98026bb42e8c1ae1876b1"
integrity sha512-ft3WayFSFUVBuJj7BMLKAQcSlItKtfjsKDDsii3rqFDAZ7t11zRe8ASw/GlmivGwVUYtwkQrxiGGpL6gFvB0ag==
mimic-fn@^1.0.0:
version "1.2.0"
resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022"
...
...
@@ -6768,7 +6780,7 @@ omit.js@^2.0.0:
resolved "https://registry.npmjs.org/omit.js/-/omit.js-2.0.2.tgz#dd9b8436fab947a5f3ff214cb2538631e313ec2f"
integrity sha512-hJmu9D+bNB40YpL9jYebQl4lsTW6yEHRTroJzNLqQJYHm7c+NQnJGfZmIWh8S3q3KoaxV1aLhV6B3+0N0/kyJg==
on-finished@~2.3.0:
on-finished@
^2.3.0, on-finished@
~2.3.0:
version "2.3.0"
resolved "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947"
integrity sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=
...
...
@@ -9166,10 +9178,10 @@ urix@^0.1.0:
resolved "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72"
integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=
url-join@^
2.0.5
:
version "
2.0.5
"
resolved "https://registry.npmjs.org/url-join/-/url-join-
2.0.5.tgz#5af22f18c052a000a48d7b82c5e9c2e2feeda728
"
integrity sha
1-WvIvGMBSoACkjXuCxenC4v7tpyg
=
url-join@^
4.0.0
:
version "
4.0.1
"
resolved "https://registry.npmjs.org/url-join/-/url-join-
4.0.1.tgz#b642e21a2646808ffa178c4c5fda39844e12cde7
"
integrity sha
512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA=
=
url-parse-lax@^1.0.0:
version "1.0.0"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录