Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
H
H5Public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
CI / CD
CI / CD
流水线
作业
日程
统计图
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
H5Public
Commits
cd67f98b
提交
cd67f98b
authored
12月 23, 2019
作者:
王绍森
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加组件
上级
875b1e89
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
323 行增加
和
0 行删除
+323
-0
index.js
HighStateComponent/DrawerWithFIlter/index.js
+41
-0
index.js
baseComponents/Button/index.js
+12
-0
index.less
baseComponents/Button/index.less
+23
-0
ListItem.js
baseComponents/CheckBoxDiy/ListItem.js
+8
-0
ListItem.less
baseComponents/CheckBoxDiy/ListItem.less
+21
-0
index.js
baseComponents/CheckBoxDiy/index.js
+41
-0
index.less
baseComponents/CheckBoxDiy/index.less
+11
-0
index.js
baseComponents/DatePickerDiy/index.js
+29
-0
index.less
baseComponents/DatePickerDiy/index.less
+21
-0
index.js
baseComponents/FilterMenu/index.js
+71
-0
index.less
baseComponents/FilterMenu/index.less
+16
-0
index.js
baseComponents/SeperatedDateRangePicker/index.js
+29
-0
没有找到文件。
HighStateComponent/DrawerWithFIlter/index.js
0 → 100644
浏览文件 @
cd67f98b
import
React
,
{
useState
}
from
'react'
;
import
{
Drawer
}
from
'antd-mobile'
;
import
NavBarDiy
from
'../../baseComponents/NavBarDiy'
;
import
FilterMenu
from
'../../components/FilterMenu'
;
import
FilterIcon
from
'../../components/FilterIcon'
;
const
DrawerWithFIlter
=
({
navBar
:
{
rightContent
,
...
navBarRest
},
drawer
,
children
,
filterMenu
})
=>
{
const
[
sidebarVisible
,
toggleSidebar
]
=
useState
(
false
);
const
navBarRight
=
[
<
FilterIcon
key
=
"0"
style
=
{{
marginLeft
:
'0.3rem'
}}
onClick
=
{()
=>
toggleSidebar
(
v
=>
!
v
)}
/>]
;
function
getRightContent
(
content
)
{
if
(
!
content
)
return
navBarRight
;
if
(
typeof
content
===
'function'
)
{
return
content
(
navBarRight
);
}
if
(
Array
.
isArray
(
content
))
{
return
[...
content
,
...
navBarRight
];
}
}
return
(
<>
<
NavBarDiy
title
=
"首页"
rightContent
=
{
getRightContent
(
rightContent
)}
{...
navBarRest
}
/
>
<
Drawer
style
=
{{
top
:
44
}}
position
=
"right"
sidebar
=
{
<
FilterMenu
onClose
=
{()
=>
toggleSidebar
(
v
=>
!
v
)}
{...
filterMenu
}
/>
}
open
=
{
sidebarVisible
}
onOpenChange
=
{()
=>
toggleSidebar
(
v
=>
!
v
)}
{...
drawer
}
>
{
children
}
<
/Drawer
>
<
/
>
);
};
export
default
DrawerWithFIlter
;
baseComponents/Button/index.js
0 → 100644
浏览文件 @
cd67f98b
import
styles
from
'./index.less'
;
export
default
function
Button
({
children
,
primary
,
inline
,
...
rest
})
{
const
classNames
=
[
styles
.
btn
];
if
(
primary
)
{
classNames
.
push
(
styles
.
primary
);
}
if
(
inline
)
{
classNames
.
push
(
styles
.
inline
);
}
return
<
button
className
=
{
classNames
.
join
(
' '
)}
{...
rest
}
>
{
children
}
<
/button
>
};
baseComponents/Button/index.less
0 → 100644
浏览文件 @
cd67f98b
@primary-color: #5094FF;
.btn {
font-size: 0.32rem;
font-weight: bold;
padding: 0.16rem 0.69rem;
text-align: center;
border: 1px solid @primary-color;
border-radius: 9999px;
color: @primary-color;
background-color: transparent;
display: block;
width: 100%;
}
.primary {
background-color: @primary-color;
color: white;
}
.inline {
display: inline-block;
width: auto;
}
baseComponents/CheckBoxDiy/ListItem.js
0 → 100644
浏览文件 @
cd67f98b
import
styles
from
'./ListItem.less'
;
export
default
({
name
,
onClick
,
active
})
=>
{
return
(
<
div
className
=
{
styles
.
item
+
' '
+
(
active
?
styles
.
active
:
''
)}
onClick
=
{
onClick
}
>
{
name
}
<
/div
>
)
};
baseComponents/CheckBoxDiy/ListItem.less
0 → 100644
浏览文件 @
cd67f98b
.item {
display: inline-block;
// font-size: 16px;
font-size: 0.28rem;
color: rgba(102, 102, 102, 1);
padding: 0.1rem;
border: 1px solid #ccc;
border-radius: 0.04rem;
background-color: #F9F9F9;
margin: 0.16rem 0.12rem;
width: calc(33.33% - 0.24rem);
text-align: center;
transition: all 0.25s;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
&.active {
border-color: rgba(80, 148, 255, 1);
background-color: #EDF4FF;
}
}
baseComponents/CheckBoxDiy/index.js
0 → 100644
浏览文件 @
cd67f98b
import
styles
from
'./index.less'
;
import
ListItem
from
'./ListItem'
;
const
CheckBoxDiy
=
({
className
=
''
,
style
,
name
,
formKey
,
options
=
[],
values
,
onChange
,
single
=
false
,
})
=>
{
const
value
=
values
[
formKey
];
function
toggle
(
option
)
{
const
newVal
=
single
?
value
===
option
.
key
?
undefined
:
option
.
key
:
value
&&
value
.
includes
(
option
.
key
)
?
value
.
filter
(
k
=>
k
!==
option
.
key
)
:
(
value
||
[]).
concat
([
option
.
key
]);
onChange
({...
values
,
[
formKey
]:
newVal
});
}
return
(
<
div
className
=
{
styles
.
wrapper
+
' '
+
className
}
style
=
{
style
}
>
<
div
className
=
{
styles
.
title
}
>
{
name
}
<
/div
>
<
div
className
=
{
styles
.
list
}
>
{
options
.
map
(
option
=>
(
<
ListItem
key
=
{
option
.
key
}
name
=
{
option
.
name
}
onClick
=
{()
=>
toggle
(
option
)}
active
=
{
single
?
value
===
option
.
key
:
value
&&
value
.
includes
(
option
.
key
)}
/
>
))}
<
/div
>
<
/div
>
);
};
export
default
CheckBoxDiy
;
baseComponents/CheckBoxDiy/index.less
0 → 100644
浏览文件 @
cd67f98b
.wrapper {
padding-bottom: 0.16rem;
}
.title {
font-size: 0.32rem;
color: rgba(51, 51, 51, 1);
}
.list {
margin: 0.14rem -0.12rem -0.16rem -0.12rem;
}
baseComponents/DatePickerDiy/index.js
0 → 100644
浏览文件 @
cd67f98b
import
React
from
'react'
;
import
moment
from
'moment'
;
import
{
DatePicker
}
from
'antd-mobile'
;
import
styles
from
'./index.less'
;
const
CustomChildren
=
({
extra
,
onClick
,
children
,
style
})
=>
(
<
div
onClick
=
{
onClick
}
className
=
{
styles
.
container
}
style
=
{
style
}
>
<
div
className
=
{
styles
.
children
}
>
{
children
}
<
/div
>
<
div
className
=
{
styles
.
extra
}
>
{
extra
}
<
/div
>
<
/div
>
);
export
default
function
DatePickerDiy
({
onChange
,
name
,
value
,
style
})
{
return
(
<
DatePicker
mode
=
"date"
title
=
{
name
}
extra
=
{
value
?
moment
(
value
).
format
(
'YYYY-MM-DD'
)
:
null
}
value
=
{
value
?
moment
(
value
).
toDate
()
:
null
}
onChange
=
{
date
=>
onChange
(
moment
(
date
).
format
(
'YYYY-MM-DD'
))}
>
<
CustomChildren
style
=
{
style
}
>
{
name
}
<
/CustomChildren
>
<
/DatePicker
>
);
}
baseComponents/DatePickerDiy/index.less
0 → 100644
浏览文件 @
cd67f98b
.container {
font-size: 0.28rem;
align-items: center;
color: #666;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
.children {
flex: 0 0 auto;
}
.extra {
flex: 1 1 auto;
border: 1px solid rgba(204, 204, 204, 1);
border-radius: 0.04rem;
margin-left: 0.26rem;
padding: 0.15rem 0 0.15rem 0.23rem;
}
baseComponents/FilterMenu/index.js
0 → 100644
浏览文件 @
cd67f98b
import
styles
from
'./index.less'
;
import
{
useEffect
}
from
'react'
import
DatePickerDiy
from
'../DatePickerDiy'
;
import
SeperatedDateRangePicker
from
'../SeperatedDateRangePicker'
;
import
{
useState
}
from
'react'
;
import
CheckBoxDiy
from
'../CheckBoxDiy'
import
Button
from
'../Button'
const
components
=
{
'DatePickerDiy'
:
DatePickerDiy
,
'SeperatedDateRangePicker'
:
SeperatedDateRangePicker
,
CheckBoxDiy
,
};
const
configExample
=
[
{
title
:
'时间选择'
,
type
:
'SeperatedDateRangePicker'
,
key
:
'beginTime'
,
beginKey
:
'beginTime'
,
endKey
:
'endTime'
,
},
{
name
:
'点名类型'
,
type
:
'CheckBoxDiy'
,
key
:
'typeId'
,
formKey
:
'typeId'
,
},
];
export
default
function
FilterMenu
({
formValues
,
onSubmit
,
onClose
,
config
=
configExample
})
{
const
[
values
,
setValues
]
=
useState
({});
useEffect
(()
=>
{
setValues
(
formValues
);
},
[
formValues
]);
function
reset
()
{
onClose
();
onSubmit
({});
}
function
submit
()
{
onClose
();
onSubmit
(
values
);
}
return
(
<
div
className
=
{
styles
.
page
}
>
{
config
.
map
(
item
=>
{
const
Cmp
=
components
[
item
.
type
];
if
(
!
Cmp
)
return
null
;
return
(
<
div
key
=
{
item
.
key
}
style
=
{{
margin
:
'0.24rem'
}}
>
<
Cmp
{...
item
}
values
=
{
values
}
onChange
=
{
vals
=>
setValues
(
origialvals
=>
({
...
origialvals
,
...
vals
}))}
/
>
<
/div
>
);
})}
<
div
className
=
{
styles
.
buttonContainer
}
>
<
Button
inline
onClick
=
{
reset
}
>
重置
<
/Button
>
<
Button
inline
primary
onClick
=
{
submit
}
style
=
{{
marginLeft
:
'0.24rem'
}}
>
确定
<
/Button
>
<
/div
>
<
/div
>
);
}
baseComponents/FilterMenu/index.less
0 → 100644
浏览文件 @
cd67f98b
.page {
width: 80vw;
height: 100%;
background-color: white;
overflow: hidden;
border-top: 2px solid #EEE;
}
.buttonContainer {
bottom: 0.48rem;
position: fixed;
left: 0;
right: 0;
text-align: center;
font-size: 0;
}
baseComponents/SeperatedDateRangePicker/index.js
0 → 100644
浏览文件 @
cd67f98b
import
DatePickerDiy
from
'../DatePickerDiy'
;
export
default
function
SeperatedDateRangePicker
({
values
,
onChange
,
title
=
'时间选择'
,
beginKey
,
beginName
=
'开始时间'
,
endKey
,
endName
=
'结束时间'
,
})
{
return
(
<>
<
div
style
=
{{
fontSize
:
'0.32rem'
,
color
:
'#333'
}}
>
{
title
}
<
/div
>
<
DatePickerDiy
style
=
{{
marginTop
:
'0.3rem'
}}
name
=
{
beginName
}
value
=
{
values
[
beginKey
]}
onChange
=
{
beginTime
=>
onChange
({
...
values
,
[
beginKey
]:
beginTime
})}
/
>
<
DatePickerDiy
style
=
{{
marginTop
:
'0.3rem'
}}
name
=
{
endName
}
value
=
{
values
[
endKey
]}
onChange
=
{
beginTime
=>
onChange
({
...
values
,
[
endKey
]:
beginTime
})}
/
>
<
/
>
);
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论