Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
40d489f4
Commit
40d489f4
authored
Jul 01, 2019
by
duanledexianxianxian
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync code
parent
02708f8a
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
42 additions
and
9 deletions
+42
-9
config/plugin.config.ts
config/plugin.config.ts
+1
-0
src/components/SettingDrawer/themeColorClient.ts
src/components/SettingDrawer/themeColorClient.ts
+1
-0
src/config.js
src/config.js
+2
-0
src/models/setting.ts
src/models/setting.ts
+4
-3
src/utils/index.js
src/utils/index.js
+1
-0
src/utils/kim-request.js
src/utils/kim-request.js
+0
-1
src/utils/request.js
src/utils/request.js
+25
-4
src/utils/utils.ts
src/utils/utils.ts
+8
-1
No files found.
config/plugin.config.ts
View file @
40d489f4
...
...
@@ -26,6 +26,7 @@ function getModulePackageName(module: { context: string }) {
export
default
(
config
:
any
)
=>
{
// preview.pro.ant.design only do not use in your production;
console
.
log
(
process
.
env
.
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION
,
process
.
env
.
NODE_ENV
);
if
(
process
.
env
.
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION
===
'
site
'
||
process
.
env
.
NODE_ENV
!==
'
production
'
...
...
src/components/SettingDrawer/themeColorClient.ts
View file @
40d489f4
...
...
@@ -25,6 +25,7 @@ export default {
return
`/
${
cssUrl
}
`
;
},
};
console
.
log
(
options
);
return
client
.
changer
.
changeColor
(
options
,
Promise
);
},
};
src/config.js
View file @
40d489f4
...
...
@@ -7,6 +7,8 @@ export default {
resMessageKey
:
'
message
'
,
// 后台正常返回错误编码
successCode
:
'
sys.success
'
,
// 后台正常返回错误编码
isThrowError
:
true
,
// 默认为true
authCodes
:
[
'
system.authc
'
],
apiType
:
0
,
// 接口模式0-code 模式 1-stauts模式
},
copyright
:
`
${
new
Date
().
getFullYear
()}
KIM3.0技术中台部出品`
,
homePage
:
'
/dashboard/analysis
'
,
...
...
src/models/setting.ts
View file @
40d489f4
...
...
@@ -20,6 +20,7 @@ export interface SettingModelType {
const
updateTheme
=
(
newPrimaryColor
?:
string
)
=>
{
if
(
newPrimaryColor
)
{
console
.
log
(
newPrimaryColor
);
const
timeOut
=
0
;
const
hideMessage
=
message
.
loading
(
'
正在切换主题!
'
,
timeOut
);
themeColorClient
.
changeColor
(
newPrimaryColor
).
finally
(()
=>
hideMessage
());
...
...
@@ -121,9 +122,9 @@ const SettingModel: SettingModelType = {
primaryColor
:
appTheme
,
layout
:
navigatorStyle
===
0
?
'
sidemenu
'
:
'
topmenu
'
,
contentWidth
:
contentWidth
===
0
?
'
Fluid
'
:
'
Fixed
'
,
fixedHeader
:
fixedHead
,
autoHideHeader
:
hideHead
,
fixSiderbar
:
fixedSide
,
fixedHeader
:
fixedHead
===
1
,
autoHideHeader
:
hideHead
===
1
,
fixSiderbar
:
fixedSide
===
1
,
};
}
yield
put
({
...
...
src/utils/index.js
View file @
40d489f4
...
...
@@ -2,6 +2,7 @@
/* eslint-disable no-bitwise */
import
pathToRegexp
from
'
path-to-regexp
'
;
import
{
parse
}
from
'
qs
'
;
import
{
async
}
from
'
q
'
;
/**
* 获取链接的query url部分
...
...
src/utils/kim-request.js
View file @
40d489f4
import
axios
from
'
axios
'
;
import
{
string
}
from
'
prop-types
'
;
class
HttpRequest
{
constructor
(
options
)
{
...
...
src/utils/request.js
View file @
40d489f4
import
{
notification
}
from
'
antd
'
;
import
router
from
'
umi/router
'
;
import
HttpRequest
from
'
./kim-request
'
;
import
config
from
'
@/config
'
;
import
store
from
'
@/utils/store
'
;
import
{
clearLoginStatus
}
from
'
@/utils/utils
'
;
/**
* todo 还需处理国际化
...
...
@@ -32,7 +34,7 @@ const {
resMessageKey
,
successCode
,
isThrowError
=
true
,
redirectFunc
,
authCodes
=
[
'
system.authc
'
]
,
},
}
=
config
;
...
...
@@ -84,7 +86,7 @@ const handleResponse = (response, more) => {
const
handleError
=
error
=>
{
const
{
response
}
=
error
;
//
如果response存在
//
status
if
(
response
&&
response
.
status
)
{
const
errorText
=
codeMessage
[
response
.
status
]
||
response
.
statusText
;
const
{
...
...
@@ -92,17 +94,36 @@ const handleError = error => {
config
:
{
url
},
}
=
response
;
notification
.
error
({
message
:
`请求错误
${
status
}
:
${
url
}
`
,
description
:
errorText
,
message
:
`请求错误
${
status
}
`
,
description
:
`
${
url
}${
errorText
}
`
,
});
// if (status >= 404 && status < 422) {
// router.push('/exception/404');
// }
if
(
status
<=
504
&&
status
>=
500
)
{
router
.
push
(
'
/exception/500
'
);
}
// 跳转到登录页面 可能原因:token 失效
if
(
status
===
403
&&
status
===
401
)
{
clearLoginStatus
();
router
.
push
(
'
/user/login
'
);
}
}
else
{
// code
const
{
code
,
message
}
=
error
;
notification
.
error
({
key
:
`notification_
${
code
?
message
:
code
}
`
,
message
:
'
请求错误
'
,
description
:
message
,
});
// 跳转到登录页面 可能原因:token 失效
if
(
authCodes
&&
authCodes
.
includes
(
code
))
{
// 清空相关信息
clearLoginStatus
();
router
.
push
(
'
/user/login
'
);
}
}
if
(
isThrowError
)
{
throw
error
;
}
else
{
...
...
src/utils/utils.ts
View file @
40d489f4
import
store
from
'
@/utils/store
'
;
/* eslint no-useless-escape:0 import/prefer-default-export:0 */
const
reg
=
/
(((
^https
?
:
(?:\/\/)?)(?:[
-;:&=
\+\$
,
\w]
+@
)?[
A-Za-z0-9.-
]
+
(?:
:
\d
+
)?
|
(?:
www.|
[
-;:&=
\+\$
,
\w]
+@
)[
A-Za-z0-9.-
]
+
)((?:\/[\+
~%
\/
.
\w
-_
]
*
)?\??(?:[
-
\+
=&;%@.
\w
_
]
*
)
#
?(?:[\w]
*
))?)
$/
;
...
...
@@ -22,4 +24,9 @@ const isAntDesignProOrDev = (): boolean => {
return
isAntDesignPro
();
};
export
{
isAntDesignProOrDev
,
isAntDesignPro
,
isUrl
};
const
clearLoginStatus
=
()
=>
{
store
.
set
(
'
token
'
,
''
);
store
.
set
(
'
userId
'
,
''
);
};
export
{
isAntDesignProOrDev
,
isAntDesignPro
,
isUrl
,
clearLoginStatus
};
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