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
P
pro-blocks
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
pro-blocks
Commits
7c729cdc
Commit
7c729cdc
authored
Jun 25, 2018
by
陈帅
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into v2
parents
ff2fc1a8
494a4681
Changes
36
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
216 additions
and
88 deletions
+216
-88
.gitignore
.gitignore
+7
-1
.webpackrc.js
.webpackrc.js
+6
-10
README.md
README.md
+5
-1
README.zh-CN.md
README.zh-CN.md
+5
-1
jsconfig.json
jsconfig.json
+10
-0
package.json
package.json
+4
-4
src/components/Authorized/CheckPermissions.js
src/components/Authorized/CheckPermissions.js
+5
-1
src/components/Authorized/index.js
src/components/Authorized/index.js
+2
-23
src/components/Authorized/index.md
src/components/Authorized/index.md
+5
-5
src/components/Authorized/renderAuthorize.js
src/components/Authorized/renderAuthorize.js
+24
-0
src/components/Charts/WaterWave/index.js
src/components/Charts/WaterWave/index.js
+5
-2
src/components/CountDown/index.js
src/components/CountDown/index.js
+5
-1
src/components/DescriptionList/Description.js
src/components/DescriptionList/Description.js
+2
-1
src/components/Ellipsis/index.d.ts
src/components/Ellipsis/index.d.ts
+1
-0
src/components/Ellipsis/index.en-US.md
src/components/Ellipsis/index.en-US.md
+1
-0
src/components/Ellipsis/index.js
src/components/Ellipsis/index.js
+45
-6
src/components/Ellipsis/index.test.js
src/components/Ellipsis/index.test.js
+13
-0
src/components/Ellipsis/index.zh-CN.md
src/components/Ellipsis/index.zh-CN.md
+1
-0
src/components/HeaderSearch/index.d.ts
src/components/HeaderSearch/index.d.ts
+1
-0
src/components/HeaderSearch/index.js
src/components/HeaderSearch/index.js
+14
-0
src/components/PageHeader/index.less
src/components/PageHeader/index.less
+6
-1
src/components/SiderMenu/index.js
src/components/SiderMenu/index.js
+9
-8
src/components/StandardTable/index.js
src/components/StandardTable/index.js
+2
-1
src/index.ejs
src/index.ejs
+0
-1
src/models/register.js
src/models/register.js
+2
-2
src/models/user.js
src/models/user.js
+1
-1
src/routes/Dashboard/Workplace.js
src/routes/Dashboard/Workplace.js
+2
-1
src/routes/Forms/BasicForm.js
src/routes/Forms/BasicForm.js
+4
-2
src/routes/Forms/StepForm/Step2.js
src/routes/Forms/StepForm/Step2.js
+5
-1
src/routes/List/Articles.js
src/routes/List/Articles.js
+2
-1
src/routes/Profile/AdvancedProfile.js
src/routes/Profile/AdvancedProfile.js
+4
-3
src/routes/Result/Error.js
src/routes/Result/Error.js
+4
-2
src/routes/Result/Success.js
src/routes/Result/Success.js
+4
-2
src/routes/User/RegisterResult.js
src/routes/User/RegisterResult.js
+2
-1
src/utils/request.js
src/utils/request.js
+5
-1
src/utils/utils.js
src/utils/utils.js
+3
-4
No files found.
.gitignore
View file @
7c729cdc
...
@@ -8,7 +8,7 @@ _roadhog-api-doc
...
@@ -8,7 +8,7 @@ _roadhog-api-doc
# production
# production
/dist
/dist
/vscode
/
.
vscode
# misc
# misc
.DS_Store
.DS_Store
...
@@ -20,5 +20,11 @@ yarn-error.log
...
@@ -20,5 +20,11 @@ yarn-error.log
yarn.lock
yarn.lock
package-lock.json
package-lock.json
*bak
*bak
<<<<<<< HEAD
jsconfig.json
jsconfig.json
.vscode
.vscode
=======
# visual studio code
.history
>>>>>>> master
.webpackrc.js
View file @
7c729cdc
...
@@ -2,21 +2,17 @@ const path = require('path');
...
@@ -2,21 +2,17 @@ const path = require('path');
export
default
{
export
default
{
entry
:
'
src/index.js
'
,
entry
:
'
src/index.js
'
,
extraBabelPlugins
:
[
extraBabelPlugins
:
[[
'
import
'
,
{
libraryName
:
'
antd
'
,
libraryDirectory
:
'
es
'
,
style
:
true
}]],
[
'
import
'
,
{
libraryName
:
'
antd
'
,
libraryDirectory
:
'
es
'
,
style
:
true
,
},
],
],
env
:
{
env
:
{
development
:
{
development
:
{
extraBabelPlugins
:
[
'
dva-hmr
'
],
extraBabelPlugins
:
[
'
dva-hmr
'
],
},
},
},
},
externals
:
{
'
@antv/data-set
'
:
'
DataSet
'
,
bizcharts
:
'
BizCharts
'
,
rollbar
:
'
rollbar
'
,
},
alias
:
{
alias
:
{
components
:
path
.
resolve
(
__dirname
,
'
src/components/
'
),
components
:
path
.
resolve
(
__dirname
,
'
src/components/
'
),
},
},
...
...
README.md
View file @
7c729cdc
...
@@ -2,7 +2,11 @@ English | [简体中文](./README.zh-CN.md)
...
@@ -2,7 +2,11 @@ English | [简体中文](./README.zh-CN.md)
# Ant Design Pro
# Ant Design Pro
[

](https://travis-ci.org/ant-design/ant-design-pro)
[

](https://ci.appveyor.com/project/afc163/ant-design-pro/branch/master)
[

](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[

](https://travis-ci.org/ant-design/ant-design-pro)
[

](https://ci.appveyor.com/project/afc163/ant-design-pro/branch/master)
[

](https://david-dm.org/ant-design/ant-design-pro)
[

](https://david-dm.org/ant-design/ant-design-pro#info=devDependencies&view=list)
[

](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
An out-of-box UI solution for enterprise applications as a React boilerplate.
An out-of-box UI solution for enterprise applications as a React boilerplate.
...
...
README.zh-CN.md
View file @
7c729cdc
...
@@ -2,7 +2,11 @@
...
@@ -2,7 +2,11 @@
# Ant Design Pro
# Ant Design Pro
[

](https://travis-ci.org/ant-design/ant-design-pro)
[

](https://ci.appveyor.com/project/afc163/ant-design-pro/branch/master)
[

](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[

](https://travis-ci.org/ant-design/ant-design-pro)
[

](https://ci.appveyor.com/project/afc163/ant-design-pro/branch/master)
[

](https://david-dm.org/ant-design/ant-design-pro)
[

](https://david-dm.org/ant-design/ant-design-pro#info=devDependencies&view=list)
[

](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
开箱即用的中台前端/设计解决方案。
开箱即用的中台前端/设计解决方案。
...
...
jsconfig.json
0 → 100644
View file @
7c729cdc
{
"compilerOptions"
:
{
"emitDecoratorMetadata"
:
true
,
"experimentalDecorators"
:
true
,
"baseUrl"
:
"."
,
"paths"
:
{
"components/*"
:
[
"./src/components/*"
]
}
}
}
package.json
View file @
7c729cdc
...
@@ -61,11 +61,11 @@
...
@@ -61,11 +61,11 @@
"
cross-env
"
:
"
^5.1.1
"
,
"
cross-env
"
:
"
^5.1.1
"
,
"
cross-port-killer
"
:
"
^1.0.1
"
,
"
cross-port-killer
"
:
"
^1.0.1
"
,
"
enzyme
"
:
"
^3.1.0
"
,
"
enzyme
"
:
"
^3.1.0
"
,
"
eslint
"
:
"
^
4.14
.0
"
,
"
eslint
"
:
"
^
5.0
.0
"
,
"
eslint-config-airbnb
"
:
"
^17.0.0
"
,
"
eslint-config-airbnb
"
:
"
^17.0.0
"
,
"
eslint-config-prettier
"
:
"
^2.9.0
"
,
"
eslint-config-prettier
"
:
"
^2.9.0
"
,
"
eslint-plugin-babel
"
:
"
^5.1.0
"
,
"
eslint-plugin-babel
"
:
"
^5.1.0
"
,
"
eslint-plugin-compat
"
:
"
^2.
4
.0
"
,
"
eslint-plugin-compat
"
:
"
^2.
1
.0
"
,
"
eslint-plugin-import
"
:
"
^2.8.0
"
,
"
eslint-plugin-import
"
:
"
^2.8.0
"
,
"
eslint-plugin-jsx-a11y
"
:
"
^6.0.3
"
,
"
eslint-plugin-jsx-a11y
"
:
"
^6.0.3
"
,
"
eslint-plugin-markdown
"
:
"
^1.0.0-beta.6
"
,
"
eslint-plugin-markdown
"
:
"
^1.0.0-beta.6
"
,
...
@@ -79,9 +79,9 @@
...
@@ -79,9 +79,9 @@
"
redbox-react
"
:
"
^1.5.0
"
,
"
redbox-react
"
:
"
^1.5.0
"
,
"
regenerator-runtime
"
:
"
^0.11.1
"
,
"
regenerator-runtime
"
:
"
^0.11.1
"
,
"
roadhog
"
:
"
^2.4.2
"
,
"
roadhog
"
:
"
^2.4.2
"
,
"
roadhog-api-doc
"
:
"
^1.0.
4
"
,
"
roadhog-api-doc
"
:
"
^1.0.
3
"
,
"
stylelint
"
:
"
^9.2.1
"
,
"
stylelint
"
:
"
^9.2.1
"
,
"
stylelint-config-prettier
"
:
"
^3.
3.0
"
,
"
stylelint-config-prettier
"
:
"
^3.
0.4
"
,
"
stylelint-config-standard
"
:
"
^18.0.0
"
"
stylelint-config-standard
"
:
"
^18.0.0
"
},
},
"optionalDependencies"
:
{
"optionalDependencies"
:
{
...
...
src/components/Authorized/CheckPermissions.js
View file @
7c729cdc
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
PromiseRender
from
'
./PromiseRender
'
;
import
PromiseRender
from
'
./PromiseRender
'
;
import
{
CURRENT
}
from
'
./
index
'
;
import
{
CURRENT
}
from
'
./
renderAuthorize
'
;
function
isPromise
(
obj
)
{
function
isPromise
(
obj
)
{
return
(
return
(
...
@@ -49,6 +49,10 @@ const checkPermissions = (authority, currentAuthority, target, Exception) => {
...
@@ -49,6 +49,10 @@ const checkPermissions = (authority, currentAuthority, target, Exception) => {
if
(
typeof
authority
===
'
function
'
)
{
if
(
typeof
authority
===
'
function
'
)
{
try
{
try
{
const
bool
=
authority
(
currentAuthority
);
const
bool
=
authority
(
currentAuthority
);
// 函数执行后返回值是 Promise
if
(
isPromise
(
bool
))
{
return
<
PromiseRender
ok
=
{
target
}
error
=
{
Exception
}
promise
=
{
bool
}
/>
;
}
if
(
bool
)
{
if
(
bool
)
{
return
target
;
return
target
;
}
}
...
...
src/components/Authorized/index.js
View file @
7c729cdc
...
@@ -2,31 +2,10 @@ import Authorized from './Authorized';
...
@@ -2,31 +2,10 @@ import Authorized from './Authorized';
import
AuthorizedRoute
from
'
./AuthorizedRoute
'
;
import
AuthorizedRoute
from
'
./AuthorizedRoute
'
;
import
Secured
from
'
./Secured
'
;
import
Secured
from
'
./Secured
'
;
import
check
from
'
./CheckPermissions.js
'
;
import
check
from
'
./CheckPermissions.js
'
;
import
renderAuthorize
from
'
./renderAuthorize
'
;
/* eslint-disable import/no-mutable-exports */
let
CURRENT
=
'
NULL
'
;
Authorized
.
Secured
=
Secured
;
Authorized
.
Secured
=
Secured
;
Authorized
.
AuthorizedRoute
=
AuthorizedRoute
;
Authorized
.
AuthorizedRoute
=
AuthorizedRoute
;
Authorized
.
check
=
check
;
Authorized
.
check
=
check
;
/**
export
default
renderAuthorize
(
Authorized
);
* use authority or getAuthority
* @param {string|()=>String} currentAuthority
*/
const
renderAuthorize
=
currentAuthority
=>
{
if
(
currentAuthority
)
{
if
(
currentAuthority
.
constructor
.
name
===
'
Function
'
)
{
CURRENT
=
currentAuthority
();
}
if
(
currentAuthority
.
constructor
.
name
===
'
String
'
)
{
CURRENT
=
currentAuthority
;
}
}
else
{
CURRENT
=
'
NULL
'
;
}
return
Authorized
;
};
export
{
CURRENT
};
export
default
renderAuthorize
;
src/components/Authorized/index.md
View file @
7c729cdc
...
@@ -25,14 +25,14 @@ order: 15
...
@@ -25,14 +25,14 @@ order: 15
| 参数 | 说明 | 类型 | 默认值 |
| 参数 | 说明 | 类型 | 默认值 |
|----------|------------------------------------------|-------------|-------|
|----------|------------------------------------------|-------------|-------|
| children | 正常渲染的元素,权限判断通过时展示 | ReactNode | - |
| children | 正常渲染的元素,权限判断通过时展示 | ReactNode | - |
| authority | 准入权限/权限判断 |
`string | array | Promise | (currentAuthority) => boolean`
| - |
| authority | 准入权限/权限判断 |
`string | array | Promise | (currentAuthority) => boolean
| Promise
`
| - |
| noMatch | 权限异常渲染元素,权限判断不通过时展示 | ReactNode | - |
| noMatch | 权限异常渲染元素,权限判断不通过时展示 | ReactNode | - |
### Authorized.AuthorizedRoute
### Authorized.AuthorizedRoute
| 参数 | 说明 | 类型 | 默认值 |
| 参数 | 说明 | 类型 | 默认值 |
|----------|------------------------------------------|-------------|-------|
|----------|------------------------------------------|-------------|-------|
| authority | 准入权限/权限判断 |
`string | array | Promise | (currentAuthority) => boolean`
| - |
| authority | 准入权限/权限判断 |
`string | array | Promise | (currentAuthority) => boolean
| Promise
`
| - |
| redirectPath | 权限异常时重定向的页面路由 | string | - |
| redirectPath | 权限异常时重定向的页面路由 | string | - |
其余参数与
`Route`
相同。
其余参数与
`Route`
相同。
...
@@ -43,16 +43,16 @@ order: 15
...
@@ -43,16 +43,16 @@ order: 15
| 参数 | 说明 | 类型 | 默认值 |
| 参数 | 说明 | 类型 | 默认值 |
|----------|------------------------------------------|-------------|-------|
|----------|------------------------------------------|-------------|-------|
| authority | 准入权限/权限判断 |
`string | Promise | (currentAuthority) => boolean`
| - |
| authority | 准入权限/权限判断 |
`string | Promise | (currentAuthority) => boolean
| Promise
`
| - |
| error | 权限异常时渲染元素 | ReactNode |
<Exception
type=
"403"
/>
|
| error | 权限异常时渲染元素 | ReactNode |
<Exception
type=
"403"
/>
|
### Authorized.check
### Authorized.check
函数形式的 Authorized,用于某些不能被 HOC 包裹的组件。
`Authorized.check(authority, target, Exception)`
函数形式的 Authorized,用于某些不能被 HOC 包裹的组件。
`Authorized.check(authority, target, Exception)`
注意:传入一个 Promise 时,无论正确还是错误返回的都是一个 ReactClass。
注意:传入一个 Promise 时,无论正确还是错误返回的都是一个 ReactClass。
| 参数 | 说明 | 类型 | 默认值 |
| 参数 | 说明 | 类型 | 默认值 |
|----------|------------------------------------------|-------------|-------|
|----------|------------------------------------------|-------------|-------|
| authority | 准入权限/权限判断 |
`string | Promise | (currentAuthority) => boolean`
| - |
| authority | 准入权限/权限判断 |
`string | Promise | (currentAuthority) => boolean
| Promise
`
| - |
| target | 权限判断通过时渲染的元素 | ReactNode | - |
| target | 权限判断通过时渲染的元素 | ReactNode | - |
| Exception | 权限异常时渲染元素 | ReactNode | - |
| Exception | 权限异常时渲染元素 | ReactNode | - |
src/components/Authorized/renderAuthorize.js
0 → 100644
View file @
7c729cdc
/* eslint-disable import/no-mutable-exports */
let
CURRENT
=
'
NULL
'
;
/**
* use authority or getAuthority
* @param {string|()=>String} currentAuthority
*/
const
renderAuthorize
=
Authorized
=>
{
return
currentAuthority
=>
{
if
(
currentAuthority
)
{
if
(
currentAuthority
.
constructor
.
name
===
'
Function
'
)
{
CURRENT
=
currentAuthority
();
}
if
(
currentAuthority
.
constructor
.
name
===
'
String
'
)
{
CURRENT
=
currentAuthority
;
}
}
else
{
CURRENT
=
'
NULL
'
;
}
return
Authorized
;
};
};
export
{
CURRENT
};
export
default
Authorized
=>
renderAuthorize
(
Authorized
);
src/components/Charts/WaterWave/index.js
View file @
7c729cdc
...
@@ -47,7 +47,7 @@ export default class WaterWave extends PureComponent {
...
@@ -47,7 +47,7 @@ export default class WaterWave extends PureComponent {
const
data
=
percent
/
100
;
const
data
=
percent
/
100
;
const
self
=
this
;
const
self
=
this
;
if
(
!
this
.
node
||
!
data
)
{
if
(
!
this
.
node
||
(
data
!==
0
&&
!
data
)
)
{
return
;
return
;
}
}
...
@@ -196,7 +196,10 @@ export default class WaterWave extends PureComponent {
...
@@ -196,7 +196,10 @@ export default class WaterWave extends PureComponent {
<
/div
>
<
/div
>
<
div
className
=
{
styles
.
text
}
style
=
{{
width
:
height
}}
>
<
div
className
=
{
styles
.
text
}
style
=
{{
width
:
height
}}
>
{
title
&&
<
span
>
{
title
}
<
/span>
}
{
title
&&
<
span
>
{
title
}
<
/span>
}
<
h4
>
{
percent
}
%<
/h4
>
<
h4
>
{
percent
}
%
<
/h4
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
);
);
...
...
src/components/CountDown/index.js
View file @
7c729cdc
...
@@ -73,7 +73,11 @@ class CountDown extends Component {
...
@@ -73,7 +73,11 @@ class CountDown extends Component {
const
s
=
Math
.
floor
((
time
-
h
*
hours
-
m
*
minutes
)
/
1000
);
const
s
=
Math
.
floor
((
time
-
h
*
hours
-
m
*
minutes
)
/
1000
);
return
(
return
(
<
span
>
<
span
>
{
fixedZero
(
h
)}:{
fixedZero
(
m
)}:{
fixedZero
(
s
)}
{
fixedZero
(
h
)}
:
{
fixedZero
(
m
)}
:
{
fixedZero
(
s
)}
<
/span
>
<
/span
>
);
);
};
};
...
...
src/components/DescriptionList/Description.js
View file @
7c729cdc
...
@@ -10,7 +10,8 @@ const Description = ({ term, column, className, children, ...restProps }) => {
...
@@ -10,7 +10,8 @@ const Description = ({ term, column, className, children, ...restProps }) => {
return
(
return
(
<
Col
className
=
{
clsString
}
{...
responsive
[
column
]}
{...
restProps
}
>
<
Col
className
=
{
clsString
}
{...
responsive
[
column
]}
{...
restProps
}
>
{
term
&&
<
div
className
=
{
styles
.
term
}
>
{
term
}
<
/div>
}
{
term
&&
<
div
className
=
{
styles
.
term
}
>
{
term
}
<
/div>
}
{
children
&&
<
div
className
=
{
styles
.
detail
}
>
{
children
}
<
/div>
}
{
children
!==
null
&&
children
!==
undefined
&&
<
div
className
=
{
styles
.
detail
}
>
{
children
}
<
/div>
}
<
/Col
>
<
/Col
>
);
);
};
};
...
...
src/components/Ellipsis/index.d.ts
View file @
7c729cdc
...
@@ -5,6 +5,7 @@ export interface IEllipsisProps {
...
@@ -5,6 +5,7 @@ export interface IEllipsisProps {
lines
?:
number
;
lines
?:
number
;
style
?:
React
.
CSSProperties
;
style
?:
React
.
CSSProperties
;
className
?:
string
;
className
?:
string
;
fullWidthRecognition
?:
boolean
;
}
}
export
default
class
Ellipsis
extends
React
.
Component
<
IEllipsisProps
,
any
>
{}
export
default
class
Ellipsis
extends
React
.
Component
<
IEllipsisProps
,
any
>
{}
src/components/Ellipsis/index.en-US.md
View file @
7c729cdc
...
@@ -13,3 +13,4 @@ Property | Description | Type | Default
...
@@ -13,3 +13,4 @@ Property | Description | Type | Default
tooltip | tooltip for showing the full text content when hovering over | boolean | -
tooltip | tooltip for showing the full text content when hovering over | boolean | -
length | maximum number of characters in the text before being truncated | number | -
length | maximum number of characters in the text before being truncated | number | -
lines | maximum number of rows in the text before being truncated | number |
`1`
lines | maximum number of rows in the text before being truncated | number |
`1`
fullWidthRecognition | whether consider full-width character length as 2 when calculate string length | boolean | -
src/components/Ellipsis/index.js
View file @
7c729cdc
...
@@ -8,11 +8,40 @@ import styles from './index.less';
...
@@ -8,11 +8,40 @@ import styles from './index.less';
const
isSupportLineClamp
=
document
.
body
.
style
.
webkitLineClamp
!==
undefined
;
const
isSupportLineClamp
=
document
.
body
.
style
.
webkitLineClamp
!==
undefined
;
const
EllipsisText
=
({
text
,
length
,
tooltip
,
...
other
})
=>
{
export
const
getStrFullLength
=
(
str
=
''
)
=>
{
return
str
.
split
(
''
).
reduce
((
pre
,
cur
)
=>
{
const
charCode
=
cur
.
charCodeAt
(
0
);
if
(
charCode
>=
0
&&
charCode
<=
128
)
{
return
pre
+
1
;
}
else
{
return
pre
+
2
;
}
},
0
);
};
export
const
cutStrByFullLength
=
(
str
=
''
,
maxLength
)
=>
{
let
showLength
=
0
;
return
str
.
split
(
''
).
reduce
((
pre
,
cur
)
=>
{
const
charCode
=
cur
.
charCodeAt
(
0
);
if
(
charCode
>=
0
&&
charCode
<=
128
)
{
showLength
+=
1
;
}
else
{
showLength
+=
2
;
}
if
(
showLength
<=
maxLength
)
{
return
pre
+
cur
;
}
else
{
return
pre
;
}
},
''
);
};
const
EllipsisText
=
({
text
,
length
,
tooltip
,
fullWidthRecognition
,
...
other
})
=>
{
if
(
typeof
text
!==
'
string
'
)
{
if
(
typeof
text
!==
'
string
'
)
{
throw
new
Error
(
'
Ellipsis children must be string.
'
);
throw
new
Error
(
'
Ellipsis children must be string.
'
);
}
}
if
(
text
.
length
<=
length
||
length
<
0
)
{
const
textLength
=
fullWidthRecognition
?
getStrFullLength
(
text
)
:
text
.
length
;
if
(
textLength
<=
length
||
length
<
0
)
{
return
<
span
{...
other
}
>
{
text
}
<
/span>
;
return
<
span
{...
other
}
>
{
text
}
<
/span>
;
}
}
const
tail
=
'
...
'
;
const
tail
=
'
...
'
;
...
@@ -20,7 +49,7 @@ const EllipsisText = ({ text, length, tooltip, ...other }) => {
...
@@ -20,7 +49,7 @@ const EllipsisText = ({ text, length, tooltip, ...other }) => {
if
(
length
-
tail
.
length
<=
0
)
{
if
(
length
-
tail
.
length
<=
0
)
{
displayText
=
''
;
displayText
=
''
;
}
else
{
}
else
{
displayText
=
text
.
slice
(
0
,
length
);
displayText
=
fullWidthRecognition
?
cutStrByFullLength
(
text
,
length
)
:
text
.
slice
(
0
,
length
);
}
}
if
(
tooltip
)
{
if
(
tooltip
)
{
...
@@ -55,7 +84,8 @@ export default class Ellipsis extends Component {
...
@@ -55,7 +84,8 @@ export default class Ellipsis extends Component {
}
}
componentDidUpdate
(
perProps
)
{
componentDidUpdate
(
perProps
)
{
if
(
this
.
props
.
lines
!==
perProps
.
lines
)
{
const
{
lines
}
=
this
.
props
;
if
(
lines
!==
perProps
.
lines
)
{
this
.
computeLine
();
this
.
computeLine
();
}
}
}
}
...
@@ -80,7 +110,7 @@ export default class Ellipsis extends Component {
...
@@ -80,7 +110,7 @@ export default class Ellipsis extends Component {
// bisection
// bisection
const
len
=
text
.
length
;
const
len
=
text
.
length
;
const
mid
=
Math
.
floor
(
len
/
2
);
const
mid
=
Math
.
ceil
(
len
/
2
);
const
count
=
this
.
bisection
(
targetHeight
,
mid
,
0
,
len
,
text
,
shadowNode
);
const
count
=
this
.
bisection
(
targetHeight
,
mid
,
0
,
len
,
text
,
shadowNode
);
...
@@ -147,7 +177,15 @@ export default class Ellipsis extends Component {
...
@@ -147,7 +177,15 @@ export default class Ellipsis extends Component {
render
()
{
render
()
{
const
{
text
,
targetCount
}
=
this
.
state
;
const
{
text
,
targetCount
}
=
this
.
state
;
const
{
children
,
lines
,
length
,
className
,
tooltip
,
...
restProps
}
=
this
.
props
;
const
{
children
,
lines
,
length
,
className
,
tooltip
,
fullWidthRecognition
,
...
restProps
}
=
this
.
props
;
const
cls
=
classNames
(
styles
.
ellipsis
,
className
,
{
const
cls
=
classNames
(
styles
.
ellipsis
,
className
,
{
[
styles
.
lines
]:
lines
&&
!
isSupportLineClamp
,
[
styles
.
lines
]:
lines
&&
!
isSupportLineClamp
,
...
@@ -170,6 +208,7 @@ export default class Ellipsis extends Component {
...
@@ -170,6 +208,7 @@ export default class Ellipsis extends Component {
length
=
{
length
}
length
=
{
length
}
text
=
{
children
||
''
}
text
=
{
children
||
''
}
tooltip
=
{
tooltip
}
tooltip
=
{
tooltip
}
fullWidthRecognition
=
{
fullWidthRecognition
}
{...
restProps
}
{...
restProps
}
/
>
/
>
);
);
...
...
src/components/Ellipsis/index.test.js
0 → 100644
View file @
7c729cdc
import
{
getStrFullLength
,
cutStrByFullLength
}
from
'
./index.js
'
;
describe
(
'
test calculateShowLength
'
,
()
=>
{
it
(
'
get full length
'
,
()
=>
{
expect
(
getStrFullLength
(
'
一二,a,
'
)).
toEqual
(
8
);
});
it
(
'
cut str by full length
'
,
()
=>
{
expect
(
cutStrByFullLength
(
'
一二,a,
'
,
7
)).
toEqual
(
'
一二,a
'
);
});
it
(
'
cut str when length small
'
,
()
=>
{
expect
(
cutStrByFullLength
(
'
一22三
'
,
5
)).
toEqual
(
'
一22
'
);
});
});
src/components/Ellipsis/index.zh-CN.md
View file @
7c729cdc
...
@@ -14,3 +14,4 @@ order: 10
...
@@ -14,3 +14,4 @@ order: 10
tooltip | 移动到文本展示完整内容的提示 | boolean | -
tooltip | 移动到文本展示完整内容的提示 | boolean | -
length | 在按照长度截取下的文本最大字符数,超过则截取省略 | number | -
length | 在按照长度截取下的文本最大字符数,超过则截取省略 | number | -
lines | 在按照行数截取下最大的行数,超过则截取省略 | number |
`1`
lines | 在按照行数截取下最大的行数,超过则截取省略 | number |
`1`
fullWidthRecognition | 是否将全角字符的长度视为2来计算字符串长度 | boolean | -
src/components/HeaderSearch/index.d.ts
View file @
7c729cdc
...
@@ -6,6 +6,7 @@ export interface IHeaderSearchProps {
...
@@ -6,6 +6,7 @@ export interface IHeaderSearchProps {
onChange
?:
(
value
:
string
)
=>
void
;
onChange
?:
(
value
:
string
)
=>
void
;
onPressEnter
?:
(
value
:
string
)
=>
void
;
onPressEnter
?:
(
value
:
string
)
=>
void
;
style
?:
React
.
CSSProperties
;
style
?:
React
.
CSSProperties
;
className
?:
string
;
}
}
export
default
class
HeaderSearch
extends
React
.
Component
<
IHeaderSearchProps
,
any
>
{}
export
default
class
HeaderSearch
extends
React
.
Component
<
IHeaderSearchProps
,
any
>
{}
src/components/HeaderSearch/index.js
View file @
7c729cdc
...
@@ -2,6 +2,8 @@ import React, { PureComponent } from 'react';
...
@@ -2,6 +2,8 @@ import React, { PureComponent } from 'react';
import
PropTypes
from
'
prop-types
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
Input
,
Icon
,
AutoComplete
}
from
'
antd
'
;
import
{
Input
,
Icon
,
AutoComplete
}
from
'
antd
'
;
import
classNames
from
'
classnames
'
;
import
classNames
from
'
classnames
'
;
import
Debounce
from
'
lodash-decorators/debounce
'
;
import
Bind
from
'
lodash-decorators/bind
'
;
import
styles
from
'
./index.less
'
;
import
styles
from
'
./index.less
'
;
export
default
class
HeaderSearch
extends
PureComponent
{
export
default
class
HeaderSearch
extends
PureComponent
{
...
@@ -71,6 +73,18 @@ export default class HeaderSearch extends PureComponent {
...
@@ -71,6 +73,18 @@ export default class HeaderSearch extends PureComponent {
});
});
};
};
// NOTE: 不能小于500,如果长按某键,第一次触发auto repeat的间隔是500ms,小于500会导致触发2次
@
Bind
()
@
Debounce
(
500
,
{
leading
:
true
,
trailing
:
false
,
})
debouncePressEnter
()
{
const
{
onPressEnter
}
=
this
.
props
;
const
value
=
this
.
state
;
onPressEnter
(
value
);
}
render
()
{
render
()
{
const
{
className
,
placeholder
,
...
restProps
}
=
this
.
props
;
const
{
className
,
placeholder
,
...
restProps
}
=
this
.
props
;
delete
restProps
.
defaultOpen
;
// for rc-select not affected
delete
restProps
.
defaultOpen
;
// for rc-select not affected
...
...
src/components/PageHeader/index.less
View file @
7c729cdc
...
@@ -63,15 +63,20 @@
...
@@ -63,15 +63,20 @@
}
}
.title,
.title,
.content {
flex: auto;
}
.action,
.action,
.content,
.extraContent,
.extraContent,
.main {
.main {
flex: 0 1 auto;
flex: 0 1 auto;
}
}
.main {
.main {
width: 100%;
width: 100%;
}
}
.title,
.title,
.action {
.action {
margin-bottom: 16px;
margin-bottom: 16px;
...
...
src/components/SiderMenu/index.js
View file @
7c729cdc
...
@@ -19,26 +19,27 @@ const getFlatMenuKeys = menuData => {
...
@@ -19,26 +19,27 @@ const getFlatMenuKeys = menuData => {
return
keys
;
return
keys
;
};
};
const
SiderMenuWrapper
=
props
=>
const
SiderMenuWrapper
=
props
=>
{
props
.
isMobile
?
(
const
{
isMobile
,
menuData
,
collapsed
}
=
props
;
return
isMobile
?
(
<
DrawerMenu
<
DrawerMenu
parent
=
{
null
}
getContainer
=
{
null
}
level
=
{
null
}
level
=
{
null
}
handleChild
=
{
null
}
handleChild
=
{
null
}
open
=
{
!
props
.
collapsed
}
open
=
{
!
collapsed
}
onMaskClick
=
{()
=>
{
onMaskClick
=
{()
=>
{
props
.
onCollapse
(
true
);
props
.
onCollapse
(
true
);
}}
}}
width
=
"
256px
"
>
>
<
SiderMenu
<
SiderMenu
{...
props
}
{...
props
}
flatMenuKeys
=
{
getFlatMenuKeys
(
props
.
menuData
)}
flatMenuKeys
=
{
getFlatMenuKeys
(
menuData
)}
collapsed
=
{
props
.
isMobile
?
false
:
props
.
collapsed
}
collapsed
=
{
isMobile
?
false
:
collapsed
}
/
>
/
>
<
/DrawerMenu
>
<
/DrawerMenu
>
)
:
(
)
:
(
<
SiderMenu
{...
props
}
flatMenuKeys
=
{
getFlatMenuKeys
(
props
.
menuData
)}
/
>
<
SiderMenu
{...
props
}
flatMenuKeys
=
{
getFlatMenuKeys
(
menuData
)}
/
>
);
);
};
export
default
SiderMenuWrapper
;
export
default
SiderMenuWrapper
;
src/components/StandardTable/index.js
View file @
7c729cdc
...
@@ -97,7 +97,8 @@ class StandardTable extends PureComponent {
...
@@ -97,7 +97,8 @@ class StandardTable extends PureComponent {
已选择
<
a
style
=
{{
fontWeight
:
600
}}
>
{
selectedRowKeys
.
length
}
<
/a> 项  
;
已选择
<
a
style
=
{{
fontWeight
:
600
}}
>
{
selectedRowKeys
.
length
}
<
/a> 项  
;
{
needTotalList
.
map
(
item
=>
(
{
needTotalList
.
map
(
item
=>
(
<
span
style
=
{{
marginLeft
:
8
}}
key
=
{
item
.
dataIndex
}
>
<
span
style
=
{{
marginLeft
:
8
}}
key
=
{
item
.
dataIndex
}
>
{
item
.
title
}
总计
&
nbsp
;
{
item
.
title
}
总计
&
nbsp
;
<
span
style
=
{{
fontWeight
:
600
}}
>
<
span
style
=
{{
fontWeight
:
600
}}
>
{
item
.
render
?
item
.
render
(
item
.
total
)
:
item
.
total
}
{
item
.
render
?
item
.
render
(
item
.
total
)
:
item
.
total
}
<
/span
>
<
/span
>
...
...
src/index.ejs
View file @
7c729cdc
...
@@ -11,7 +11,6 @@
...
@@ -11,7 +11,6 @@
</script>
</script>
<script
src=
" https://gw.alipayobjects.com/os/rmsportal/TKSqiyoUxzrHoMwjViwA.js "
></script>
<script
src=
" https://gw.alipayobjects.com/os/rmsportal/TKSqiyoUxzrHoMwjViwA.js "
></script>
<script
src=
"https://gw.alipayobjects.com/os/antv/assets/data-set/0.8.7/data-set.min.js"
></script>
<script
src=
"https://gw.alipayobjects.com/os/antv/assets/data-set/0.8.7/data-set.min.js"
></script>
</head>
</head>
<body>
<body>
...
...
src/models/register.js
View file @
7c729cdc
...
@@ -10,8 +10,8 @@ export default {
...
@@ -10,8 +10,8 @@ export default {
},
},
effects
:
{
effects
:
{
*
submit
(
_
,
{
call
,
put
})
{
*
submit
(
{
payload
}
,
{
call
,
put
})
{
const
response
=
yield
call
(
fakeRegister
);
const
response
=
yield
call
(
fakeRegister
,
payload
);
yield
put
({
yield
put
({
type
:
'
registerHandle
'
,
type
:
'
registerHandle
'
,
payload
:
response
,
payload
:
response
,
...
...
src/models/user.js
View file @
7c729cdc
...
@@ -35,7 +35,7 @@ export default {
...
@@ -35,7 +35,7 @@ export default {
saveCurrentUser
(
state
,
action
)
{
saveCurrentUser
(
state
,
action
)
{
return
{
return
{
...
state
,
...
state
,
currentUser
:
action
.
payload
,
currentUser
:
action
.
payload
||
{}
,
};
};
},
},
changeNotifyCount
(
state
,
action
)
{
changeNotifyCount
(
state
,
action
)
{
...
...
src/routes/Dashboard/Workplace.js
View file @
7c729cdc
...
@@ -144,7 +144,8 @@ export default class Workplace extends PureComponent {
...
@@ -144,7 +144,8 @@ export default class Workplace extends PureComponent {
<
div
className
=
{
styles
.
statItem
}
>
<
div
className
=
{
styles
.
statItem
}
>
<
p
>
团队内排名
<
/p
>
<
p
>
团队内排名
<
/p
>
<
p
>
<
p
>
8
<
span
>
/ 24</
span
>
8
<
span
>
/ 24</
span
>
<
/p
>
<
/p
>
<
/div
>
<
/div
>
<
div
className
=
{
styles
.
statItem
}
>
<
div
className
=
{
styles
.
statItem
}
>
...
...
src/routes/Forms/BasicForm.js
View file @
7c729cdc
...
@@ -138,7 +138,8 @@ export default class BasicForms extends PureComponent {
...
@@ -138,7 +138,8 @@ export default class BasicForms extends PureComponent {
{...
formItemLayout
}
{...
formItemLayout
}
label
=
{
label
=
{
<
span
>
<
span
>
邀评人
<
em
className
=
{
styles
.
optional
}
>
(
选填
)
<
/em
>
邀评人
<
em
className
=
{
styles
.
optional
}
>
(
选填
)
<
/em
>
<
/span
>
<
/span
>
}
}
>
>
...
@@ -150,7 +151,8 @@ export default class BasicForms extends PureComponent {
...
@@ -150,7 +151,8 @@ export default class BasicForms extends PureComponent {
{...
formItemLayout
}
{...
formItemLayout
}
label
=
{
label
=
{
<
span
>
<
span
>
权重
<
em
className
=
{
styles
.
optional
}
>
(
选填
)
<
/em
>
权重
<
em
className
=
{
styles
.
optional
}
>
(
选填
)
<
/em
>
<
/span
>
<
/span
>
}
}
>
>
...
...
src/routes/Forms/StepForm/Step2.js
View file @
7c729cdc
...
@@ -55,7 +55,11 @@ class Step2 extends React.PureComponent {
...
@@ -55,7 +55,11 @@ class Step2 extends React.PureComponent {
<
/Form.Item
>
<
/Form.Item
>
<
Form
.
Item
{...
formItemLayout
}
className
=
{
styles
.
stepFormText
}
label
=
"
转账金额
"
>
<
Form
.
Item
{...
formItemLayout
}
className
=
{
styles
.
stepFormText
}
label
=
"
转账金额
"
>
<
span
className
=
{
styles
.
money
}
>
{
data
.
amount
}
<
/span
>
<
span
className
=
{
styles
.
money
}
>
{
data
.
amount
}
<
/span
>
<
span
className
=
{
styles
.
uppercase
}
>
(
{
digitUppercase
(
data
.
amount
)}
)
<
/span
>
<
span
className
=
{
styles
.
uppercase
}
>
(
{
digitUppercase
(
data
.
amount
)}
)
<
/span
>
<
/Form.Item
>
<
/Form.Item
>
<
Divider
style
=
{{
margin
:
'
24px 0
'
}}
/
>
<
Divider
style
=
{{
margin
:
'
24px 0
'
}}
/
>
<
Form
.
Item
{...
formItemLayout
}
label
=
"
支付密码
"
required
=
{
false
}
>
<
Form
.
Item
{...
formItemLayout
}
label
=
"
支付密码
"
required
=
{
false
}
>
...
...
src/routes/List/Articles.js
View file @
7c729cdc
...
@@ -82,7 +82,8 @@ export default class SearchList extends Component {
...
@@ -82,7 +82,8 @@ export default class SearchList extends Component {
<
div
className
=
{
styles
.
description
}
>
{
content
}
<
/div
>
<
div
className
=
{
styles
.
description
}
>
{
content
}
<
/div
>
<
div
className
=
{
styles
.
extra
}
>
<
div
className
=
{
styles
.
extra
}
>
<
Avatar
src
=
{
avatar
}
size
=
"
small
"
/>
<
Avatar
src
=
{
avatar
}
size
=
"
small
"
/>
<
a
href
=
{
href
}
>
{
owner
}
<
/a> 发布在 <a href={href}>{href}</
a
>
<
a
href
=
{
href
}
>
{
owner
}
<
/a> 发布
在
<
a
href
=
{
href
}
>
{
href
}
<
/a
>
<
em
>
{
moment
(
updatedAt
).
format
(
'
YYYY-MM-DD HH:mm
'
)}
<
/em
>
<
em
>
{
moment
(
updatedAt
).
format
(
'
YYYY-MM-DD HH:mm
'
)}
<
/em
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
...
src/routes/Profile/AdvancedProfile.js
View file @
7c729cdc
...
@@ -226,7 +226,7 @@ export default class AdvancedProfile extends Component {
...
@@ -226,7 +226,7 @@ export default class AdvancedProfile extends Component {
}
}
render
()
{
render
()
{
const
{
stepDirection
}
=
this
.
state
;
const
{
stepDirection
,
operationkey
}
=
this
.
state
;
const
{
profile
,
loading
}
=
this
.
props
;
const
{
profile
,
loading
}
=
this
.
props
;
const
{
advancedOperation1
,
advancedOperation2
,
advancedOperation3
}
=
profile
;
const
{
advancedOperation1
,
advancedOperation2
,
advancedOperation3
}
=
profile
;
const
contentList
=
{
const
contentList
=
{
...
@@ -333,7 +333,8 @@ export default class AdvancedProfile extends Component {
...
@@ -333,7 +333,8 @@ export default class AdvancedProfile extends Component {
<
/Card
>
<
/Card
>
<
Card
title
=
"
用户近半年来电记录
"
style
=
{{
marginBottom
:
24
}}
bordered
=
{
false
}
>
<
Card
title
=
"
用户近半年来电记录
"
style
=
{{
marginBottom
:
24
}}
bordered
=
{
false
}
>
<
div
className
=
{
styles
.
noData
}
>
<
div
className
=
{
styles
.
noData
}
>
<
Icon
type
=
"
frown-o
"
/>
暂无数据
<
Icon
type
=
"
frown-o
"
/>
暂无数据
<
/div
>
<
/div
>
<
/Card
>
<
/Card
>
<
Card
<
Card
...
@@ -342,7 +343,7 @@ export default class AdvancedProfile extends Component {
...
@@ -342,7 +343,7 @@ export default class AdvancedProfile extends Component {
tabList
=
{
operationTabList
}
tabList
=
{
operationTabList
}
onTabChange
=
{
this
.
onOperationTabChange
}
onTabChange
=
{
this
.
onOperationTabChange
}
>
>
{
contentList
[
this
.
state
.
operationkey
]}
{
contentList
[
operationkey
]}
<
/Card
>
<
/Card
>
<
/PageHeaderLayout
>
<
/PageHeaderLayout
>
);
);
...
...
src/routes/Result/Error.js
View file @
7c729cdc
...
@@ -16,13 +16,15 @@ const extra = (
...
@@ -16,13 +16,15 @@ const extra = (
您提交的内容有如下错误
:
您提交的内容有如下错误
:
<
/div
>
<
/div
>
<
div
style
=
{{
marginBottom
:
16
}}
>
<
div
style
=
{{
marginBottom
:
16
}}
>
<
Icon
style
=
{{
color
:
'
#f5222d
'
,
marginRight
:
8
}}
type
=
"
close-circle-o
"
/>
您的账户已被冻结
<
Icon
style
=
{{
color
:
'
#f5222d
'
,
marginRight
:
8
}}
type
=
"
close-circle-o
"
/>
您的账户已被冻结
<
a
style
=
{{
marginLeft
:
16
}}
>
<
a
style
=
{{
marginLeft
:
16
}}
>
立即解冻
<
Icon
type
=
"
right
"
/>
立即解冻
<
Icon
type
=
"
right
"
/>
<
/a
>
<
/a
>
<
/div
>
<
/div
>
<
div
>
<
div
>
<
Icon
style
=
{{
color
:
'
#f5222d
'
,
marginRight
:
8
}}
type
=
"
close-circle-o
"
/>
您的账户还不具备申请资格
<
Icon
style
=
{{
color
:
'
#f5222d
'
,
marginRight
:
8
}}
type
=
"
close-circle-o
"
/>
您的账户还不具备申请资格
<
a
style
=
{{
marginLeft
:
16
}}
>
<
a
style
=
{{
marginLeft
:
16
}}
>
立即升级
<
Icon
type
=
"
right
"
/>
立即升级
<
Icon
type
=
"
right
"
/>
<
/a
>
<
/a
>
...
...
src/routes/Result/Success.js
View file @
7c729cdc
...
@@ -15,7 +15,8 @@ const desc1 = (
...
@@ -15,7 +15,8 @@ const desc1 = (
}}
}}
>
>
<
div
style
=
{{
margin
:
'
8px 0 4px
'
}}
>
<
div
style
=
{{
margin
:
'
8px 0 4px
'
}}
>
曲丽丽
<
Icon
style
=
{{
marginLeft
:
8
}}
type
=
"
dingding-o
"
/>
曲丽丽
<
Icon
style
=
{{
marginLeft
:
8
}}
type
=
"
dingding-o
"
/>
<
/div
>
<
/div
>
<
div
>
2016
-
12
-
12
12
:
32
<
/div
>
<
div
>
2016
-
12
-
12
12
:
32
<
/div
>
<
/div
>
<
/div
>
...
@@ -24,7 +25,8 @@ const desc1 = (
...
@@ -24,7 +25,8 @@ const desc1 = (
const
desc2
=
(
const
desc2
=
(
<
div
style
=
{{
fontSize
:
12
,
position
:
'
relative
'
,
left
:
42
}}
>
<
div
style
=
{{
fontSize
:
12
,
position
:
'
relative
'
,
left
:
42
}}
>
<
div
style
=
{{
margin
:
'
8px 0 4px
'
}}
>
<
div
style
=
{{
margin
:
'
8px 0 4px
'
}}
>
周毛毛
<
Icon
type
=
"
dingding-o
"
style
=
{{
color
:
'
#00A0E9
'
,
marginLeft
:
8
}}
/
>
周毛毛
<
Icon
type
=
"
dingding-o
"
style
=
{{
color
:
'
#00A0E9
'
,
marginLeft
:
8
}}
/
>
<
/div
>
<
/div
>
<
div
>
<
div
>
<
a
href
=
""
>
催一下
<
/a
>
<
a
href
=
""
>
催一下
<
/a
>
...
...
src/routes/User/RegisterResult.js
View file @
7c729cdc
...
@@ -23,7 +23,8 @@ const RegisterResult = ({ location }) => (
...
@@ -23,7 +23,8 @@ const RegisterResult = ({ location }) => (
type
=
"
success
"
type
=
"
success
"
title
=
{
title
=
{
<
div
className
=
{
styles
.
title
}
>
<
div
className
=
{
styles
.
title
}
>
你的账户
:
{
location
.
state
?
location
.
state
.
account
:
'
AntDesign@example.com
'
}
注册成功
你的账户
:
{
location
.
state
?
location
.
state
.
account
:
'
AntDesign@example.com
'
}
注册成功
<
/div
>
<
/div
>
}
}
description
=
"
激活邮件已发送到你的邮箱中,邮件有效期为24小时。请及时登录邮箱,点击邮件中的链接激活帐户。
"
description
=
"
激活邮件已发送到你的邮箱中,邮件有效期为24小时。请及时登录邮箱,点击邮件中的链接激活帐户。
"
...
...
src/utils/request.js
View file @
7c729cdc
...
@@ -47,7 +47,11 @@ export default function request(url, options) {
...
@@ -47,7 +47,11 @@ export default function request(url, options) {
credentials
:
'
include
'
,
credentials
:
'
include
'
,
};
};
const
newOptions
=
{
...
defaultOptions
,
...
options
};
const
newOptions
=
{
...
defaultOptions
,
...
options
};
if
(
newOptions
.
method
===
'
POST
'
||
newOptions
.
method
===
'
PUT
'
)
{
if
(
newOptions
.
method
===
'
POST
'
||
newOptions
.
method
===
'
PUT
'
||
newOptions
.
method
===
'
DELETE
'
)
{
if
(
!
(
newOptions
.
body
instanceof
FormData
))
{
if
(
!
(
newOptions
.
body
instanceof
FormData
))
{
newOptions
.
headers
=
{
newOptions
.
headers
=
{
Accept
:
'
application/json
'
,
Accept
:
'
application/json
'
,
...
...
src/utils/utils.js
View file @
7c729cdc
...
@@ -124,11 +124,10 @@ function getRenderArr(routes) {
...
@@ -124,11 +124,10 @@ function getRenderArr(routes) {
let
renderArr
=
[];
let
renderArr
=
[];
renderArr
.
push
(
routes
[
0
]);
renderArr
.
push
(
routes
[
0
]);
for
(
let
i
=
1
;
i
<
routes
.
length
;
i
+=
1
)
{
for
(
let
i
=
1
;
i
<
routes
.
length
;
i
+=
1
)
{
let
isAdd
=
false
;
// 是否包含
isAdd
=
renderArr
.
every
(
item
=>
getRelation
(
item
,
routes
[
i
])
===
3
);
// 去重
// 去重
renderArr
=
renderArr
.
filter
(
item
=>
getRelation
(
item
,
routes
[
i
])
!==
1
);
renderArr
=
renderArr
.
filter
(
item
=>
getRelation
(
item
,
routes
[
i
])
!==
1
);
// 是否包含
const
isAdd
=
renderArr
.
every
(
item
=>
getRelation
(
item
,
routes
[
i
])
===
3
);
if
(
isAdd
)
{
if
(
isAdd
)
{
renderArr
.
push
(
routes
[
i
]);
renderArr
.
push
(
routes
[
i
]);
}
}
...
@@ -164,7 +163,7 @@ export function getRoutes(path, routerData) {
...
@@ -164,7 +163,7 @@ export function getRoutes(path, routerData) {
}
}
/* eslint no-useless-escape:0 */
/* eslint no-useless-escape:0 */
const
reg
=
/
(((
^https
?
:
(?:\/\/)?)(?:[
-;:&=
\+\$
,
\w]
+@
)?[
A-Za-z0-9.-
]
+
|
(?:
www.|
[
-;:&=
\+\$
,
\w]
+@
)[
A-Za-z0-9.-
]
+
)((?:\/[\+
~%
\/
.
\w
-_
]
*
)?\??(?:[
-
\+
=&;%@.
\w
_
]
*
)
#
?(?:[\w]
*
))?)
$/g
;
const
reg
=
/
(((
^https
?
:
(?:\/\/)?)(?:[
-;:&=
\+\$
,
\w]
+@
)?[
A-Za-z0-9.-
]
+
(?:
:
\d
+
)?
|
(?:
www.|
[
-;:&=
\+\$
,
\w]
+@
)[
A-Za-z0-9.-
]
+
)((?:\/[\+
~%
\/
.
\w
-_
]
*
)?\??(?:[
-
\+
=&;%@.
\w
_
]
*
)
#
?(?:[\w]
*
))?)
$/
;
export
function
isUrl
(
path
)
{
export
function
isUrl
(
path
)
{
return
reg
.
test
(
path
);
return
reg
.
test
(
path
);
...
...
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