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
9b82625e
Commit
9b82625e
authored
May 23, 2019
by
陈帅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new style
parent
3b2f0085
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
142 deletions
+41
-142
src/components/CopyBlock/index.less
src/components/CopyBlock/index.less
+22
-6
src/components/CopyBlock/index.tsx
src/components/CopyBlock/index.tsx
+4
-8
src/layouts/BasicLayout.tsx
src/layouts/BasicLayout.tsx
+3
-2
src/services/api.js
src/services/api.js
+0
-126
src/utils/utils.ts
src/utils/utils.ts
+12
-0
No files found.
src/components/CopyBlock/index.less
View file @
9b82625e
...
@@ -6,20 +6,36 @@
...
@@ -6,20 +6,36 @@
flex-direction: column;
flex-direction: column;
align-items: center;
align-items: center;
justify-content: center;
justify-content: center;
width:
8
0px;
width:
4
0px;
height:
8
0px;
height:
4
0px;
font-size: 20px;
font-size: 20px;
background: #fff;
background: #fff;
border-radius: 40px;
border-radius: 40px;
box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14),
box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14),
0 1px 10px 0 rgba(0, 0, 0, 0.12);
0 1px 10px 0 rgba(0, 0, 0, 0.12);
cursor: pointer;
cursor: pointer;
}
.copy-block-view {
position: relative;
:global {
.ant-typography-copy {
position: absolute;
right: 5px;
bottom: 0px;
}
}
.copy-block-code {
color: #fff;
margin: 0 0.2em;
padding: 0.2em 0.4em 0.1em;
font-size: 85%;
background: rgba(0, 0, 0, 0.06);
border-radius: 3px;
display: inline-block;
}
.copy-block-text {
.copy-block-text {
font-size: 12px;
font-size: 12px;
margin: 0;
}
}
}
}
.copy-block-code {
color: #fff;
background: #000;
}
src/components/CopyBlock/index.tsx
View file @
9b82625e
...
@@ -17,9 +17,10 @@ const BlockCodeView: React.SFC<{
...
@@ -17,9 +17,10 @@ const BlockCodeView: React.SFC<{
url
,
url
,
)}
--npm-client=cnpm --path=
${
url
}
`
;
)}
--npm-client=cnpm --path=
${
url
}
`
;
return
(
return
(
<
div
>
<
div
className
=
{
styles
[
'
copy-block-view
'
]
}
>
<
p
className
=
{
styles
[
'
copy-block-text
'
]
}
>
下载到项目中:
</
p
>
<
Typography
.
Paragraph
copyable
>
<
Typography
.
Paragraph
copyable
>
<
code
className
=
{
styles
[
'
copy-block-code
'
]
}
>
{
blockUrl
}
</
code
>
<
div
className
=
{
styles
[
'
copy-block-code
'
]
}
>
{
blockUrl
}
</
div
>
</
Typography
.
Paragraph
>
</
Typography
.
Paragraph
>
</
div
>
</
div
>
);
);
...
@@ -29,12 +30,7 @@ export default ({ url }: { url: string }) => {
...
@@ -29,12 +30,7 @@ export default ({ url }: { url: string }) => {
return
(
return
(
<
Tooltip
placement
=
"topLeft"
title
=
{
<
BlockCodeView
url
=
{
url
}
/>
}
trigger
=
"click"
>
<
Tooltip
placement
=
"topLeft"
title
=
{
<
BlockCodeView
url
=
{
url
}
/>
}
trigger
=
"click"
>
<
div
className
=
{
styles
[
'
copy-block
'
]
}
>
<
div
className
=
{
styles
[
'
copy-block
'
]
}
>
<
Icon
type
=
"code"
/>
<
Icon
type
=
"download"
/>
<
div
className
=
{
styles
[
'
copy-block-text
'
]
}
>
下载到
<
br
/>
项目中
</
div
>
</
div
>
</
div
>
</
Tooltip
>
</
Tooltip
>
);
);
...
...
src/layouts/BasicLayout.tsx
View file @
9b82625e
...
@@ -14,6 +14,7 @@ import {
...
@@ -14,6 +14,7 @@ import {
SettingDrawer
,
SettingDrawer
,
}
from
'
@ant-design/pro-layout
'
;
}
from
'
@ant-design/pro-layout
'
;
import
Link
from
'
umi/link
'
;
import
Link
from
'
umi/link
'
;
import
{
isAntDesignProOrDev
}
from
'
@/utils/utils
'
;
export
interface
BasicLayoutProps
extends
BasicLayoutComponentsProps
,
ConnectProps
{
export
interface
BasicLayoutProps
extends
BasicLayoutComponentsProps
,
ConnectProps
{
breadcrumbNameMap
:
{
[
path
:
string
]:
MenuDataItem
};
breadcrumbNameMap
:
{
[
path
:
string
]:
MenuDataItem
};
...
@@ -81,7 +82,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = props => {
...
@@ -81,7 +82,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = props => {
>
>
{
children
}
{
children
}
</
BasicLayoutComponents
>
</
BasicLayoutComponents
>
{
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION
===
'
site
'
&&
(
{
isAntDesignProOrDev
()
&&
(
<
SettingDrawer
<
SettingDrawer
settings
=
{
settings
}
settings
=
{
settings
}
onSettingChange
=
{
config
=>
onSettingChange
=
{
config
=>
...
@@ -92,7 +93,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = props => {
...
@@ -92,7 +93,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = props => {
}
}
/>
/>
)
}
)
}
<
CopyBlock
url
=
{
location
!
.
pathname
}
/>
{
isAntDesignProOrDev
()
&&
<
CopyBlock
url
=
{
location
!
.
pathname
}
/>
}
</>
</>
);
);
};
};
...
...
src/services/api.js
deleted
100644 → 0
View file @
3b2f0085
import
{
stringify
}
from
'
qs
'
;
import
request
from
'
@/utils/request
'
;
export
async
function
queryProjectNotice
()
{
return
request
(
'
/api/project/notice
'
);
}
export
async
function
queryActivities
()
{
return
request
(
'
/api/activities
'
);
}
export
async
function
queryRule
(
params
)
{
return
request
(
`/api/rule?
${
stringify
(
params
)}
`
);
}
export
async
function
removeRule
(
params
)
{
return
request
(
'
/api/rule
'
,
{
method
:
'
POST
'
,
data
:
{
...
params
,
method
:
'
delete
'
,
},
});
}
export
async
function
addRule
(
params
)
{
return
request
(
'
/api/rule
'
,
{
method
:
'
POST
'
,
data
:
{
...
params
,
method
:
'
post
'
,
},
});
}
export
async
function
updateRule
(
params
=
{})
{
return
request
(
`/api/rule?
${
stringify
(
params
.
query
)}
`
,
{
method
:
'
POST
'
,
data
:
{
...
params
.
body
,
method
:
'
update
'
,
},
});
}
export
async
function
fakeSubmitForm
(
params
)
{
return
request
(
'
/api/forms
'
,
{
method
:
'
POST
'
,
data
:
params
,
});
}
export
async
function
fakeChartData
()
{
return
request
(
'
/api/fake_chart_data
'
);
}
export
async
function
queryTags
()
{
return
request
(
'
/api/tags
'
);
}
export
async
function
queryBasicProfile
(
id
)
{
return
request
(
`/api/profile/basic?id=
${
id
}
`
);
}
export
async
function
queryAdvancedProfile
()
{
return
request
(
'
/api/profile/advanced
'
);
}
export
async
function
queryFakeList
(
params
)
{
return
request
(
`/api/fake_list?
${
stringify
(
params
)}
`
);
}
export
async
function
removeFakeList
(
params
)
{
const
{
count
=
5
,
...
restParams
}
=
params
;
return
request
(
`/api/fake_list?count=
${
count
}
`
,
{
method
:
'
POST
'
,
data
:
{
...
restParams
,
method
:
'
delete
'
,
},
});
}
export
async
function
addFakeList
(
params
)
{
const
{
count
=
5
,
...
restParams
}
=
params
;
return
request
(
`/api/fake_list?count=
${
count
}
`
,
{
method
:
'
POST
'
,
data
:
{
...
restParams
,
method
:
'
post
'
,
},
});
}
export
async
function
updateFakeList
(
params
)
{
const
{
count
=
5
,
...
restParams
}
=
params
;
return
request
(
`/api/fake_list?count=
${
count
}
`
,
{
method
:
'
POST
'
,
data
:
{
...
restParams
,
method
:
'
update
'
,
},
});
}
export
async
function
fakeAccountLogin
(
params
)
{
return
request
(
'
/api/login/account
'
,
{
method
:
'
POST
'
,
data
:
params
,
});
}
export
async
function
fakeRegister
(
params
)
{
return
request
(
'
/api/register
'
,
{
method
:
'
POST
'
,
data
:
params
,
});
}
export
async
function
queryNotices
(
params
=
{})
{
return
request
(
`/api/notices?
${
stringify
(
params
)}
`
);
}
export
async
function
getFakeCaptcha
(
mobile
)
{
return
request
(
`/api/captcha?mobile=
${
mobile
}
`
);
}
src/utils/utils.ts
View file @
9b82625e
...
@@ -4,3 +4,15 @@ const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(
...
@@ -4,3 +4,15 @@ const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(
export
function
isUrl
(
path
:
string
)
{
export
function
isUrl
(
path
:
string
)
{
return
reg
.
test
(
path
);
return
reg
.
test
(
path
);
}
}
// 给官方演示站点用,用于关闭真实开发环境不需要使用的特性
export
function
isAntDesignProOrDev
()
{
const
{
NODE_ENV
}
=
process
.
env
;
if
(
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION
===
'
site
'
)
{
return
true
;
}
if
(
NODE_ENV
===
'
development
'
)
{
return
true
;
}
return
window
.
location
.
hostname
===
'
preview.pro.ant.design
'
;
}
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