Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
addInsured-AIA-POC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liujianghai
addInsured-AIA-POC
Commits
a6a0885f
Commit
a6a0885f
authored
Mar 08, 2020
by
marsandheart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加app的Loading组件,通过redux控制
parent
f8f90ae4
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
185 additions
and
44 deletions
+185
-44
App.js
src/App.js
+4
-2
Loading.jsx
src/components/Loading.jsx
+19
-0
Loading.module.scss
src/components/Loading.module.scss
+11
-0
TouchSpan.jsx
src/components/TouchSpan.jsx
+64
-0
DoubleRecord.jsx
src/pages/DoubleRecord.jsx
+3
-2
InsuredInfo.jsx
src/pages/InsuredInfo.jsx
+45
-15
InsuredInfo.module.scss
src/pages/InsuredInfo.module.scss
+5
-0
ProductListModal.jsx
src/pages/insuredsInfo.components/ProductListModal.jsx
+10
-13
ProductListModal.module.scss
...ages/insuredsInfo.components/ProductListModal.module.scss
+0
-11
app.js
src/store/app.js
+21
-0
index.js
src/store/index.js
+3
-1
No files found.
src/App.js
View file @
a6a0885f
...
@@ -2,15 +2,17 @@ import React from 'react';
...
@@ -2,15 +2,17 @@ import React from 'react';
import
{
Provider
}
from
'react-redux'
;
import
{
Provider
}
from
'react-redux'
;
import
'./assets/css/basic.css'
;
import
'./assets/css/basic.css'
;
import
store
from
'./store/index'
;
import
store
from
'./store/index'
;
import
Router
from
'./Router'
;
import
Router
from
'./Router'
;
import
Loading
from
'./components/Loading'
;
function
App
()
{
function
App
()
{
return
(
return
(
<
Provider
store
=
{
store
}
>
<
Provider
store
=
{
store
}
>
<
div
>
<
Router
/>
<
Router
/>
<
Loading
/>
<
/div
>
<
/Provider
>
<
/Provider
>
);
);
}
}
...
...
src/components/Loading.jsx
0 → 100644
View file @
a6a0885f
import
React
from
'react'
;
import
{
connect
}
from
'react-redux'
;
import
styles
from
'./Loading.module.scss'
;
import
{
Spin
}
from
'antd'
;
const
Loading
=
(
props
)
=>
{
return
props
.
visible
?
(
<
div
className=
{
styles
.
loading
}
>
<
Spin
tip=
"Loading..."
></
Spin
>
</
div
>
)
:
(
<
div
></
div
>
);
};
const
mapState
=
(
state
)
=>
({
visible
:
state
.
app
.
loadingQueue
>
0
});
export
default
connect
(
mapState
,
null
)(
Loading
);
src/components/Loading.module.scss
0 → 100644
View file @
a6a0885f
.loading
{
position
:
absolute
;
background-color
:
rgba
(
$color
:
#000000
,
$alpha
:
0
.3
);
padding
:
20px
;
border-radius
:
10px
;
left
:
50%
;
top
:
50%
;
transform
:
translate
(
-50%
,-
50%
);
}
\ No newline at end of file
src/components/TouchSpan.jsx
0 → 100644
View file @
a6a0885f
import
*
as
React
from
'react'
;
// interface IProps {
// className?: string;
// onClick?: (ev: React.MouseEvent<HTMLDivElement>) => any;
// }
// type IState = Readonly<{
// style: React.CSSProperties;
// }>;
class
TouchOpacity
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
style
:
{
opacity
:
1
}
};
this
.
timer
=
null
;
}
onClick
=
(
ev
)
=>
{
const
{
onClick
}
=
this
.
props
;
ev
.
stopPropagation
();
this
.
setState
(
{
style
:
{
opacity
:
0.5
}
},
()
=>
{
this
.
timer
=
setTimeout
(()
=>
{
this
.
setState
({
style
:
{
opacity
:
1
}
});
},
50
);
}
);
if
(
onClick
)
{
onClick
(
ev
);
}
};
componentWillUnmount
()
{
clearTimeout
(
this
.
timer
);
}
render
()
{
const
{
children
,
onClick
,
...
otherProps
}
=
this
.
props
;
return
(
<
span
{
...
otherProps
}
style=
{
this
.
state
.
style
}
onClick=
{
this
.
onClick
}
>
{
children
}
</
span
>
);
}
}
export
default
TouchOpacity
;
src/pages/DoubleRecord.jsx
View file @
a6a0885f
...
@@ -183,7 +183,8 @@ const defaultSteps = [
...
@@ -183,7 +183,8 @@ const defaultSteps = [
至少3秒,保证标题清晰后给投保人阅读
至少3秒,保证标题清晰后给投保人阅读
</
span
>
</
span
>
),
),
voice
:
'请销售人员点击链接向镜头展示《免除保险人责任条款》至少3秒,保证标题清晰后给投保人阅读'
voice
:
'请销售人员点击链接向镜头展示《免除保险人责任条款》至少3秒,保证标题清晰后给投保人阅读'
}
}
]
]
},
},
...
@@ -449,7 +450,7 @@ export default function(props) {
...
@@ -449,7 +450,7 @@ export default function(props) {
const
toStep
=
(
sId
)
=>
{
const
toStep
=
(
sId
)
=>
{
setStepId
(
sId
);
setStepId
(
sId
);
setQuestionId
(
'1'
);
setQuestionId
(
'1'
);
}
}
;
return
(
return
(
<
div
className=
{
styles
.
page
}
>
<
div
className=
{
styles
.
page
}
>
...
...
src/pages/InsuredInfo.jsx
View file @
a6a0885f
import
React
,
{
useState
}
from
'react'
;
import
React
,
{
useState
}
from
'react'
;
import
{
connect
}
from
'react-redux'
;
import
{
Table
,
Divider
}
from
'antd'
;
import
{
Table
,
Divider
}
from
'antd'
;
import
'antd/dist/antd.css'
;
import
'antd/dist/antd.css'
;
...
@@ -14,6 +15,7 @@ import IconReturn from 'assets/img/return.png';
...
@@ -14,6 +15,7 @@ import IconReturn from 'assets/img/return.png';
import
IconHome
from
'assets/img/home.png'
;
import
IconHome
from
'assets/img/home.png'
;
import
TouchOpacity
from
'../components/TouchOpacity'
;
import
TouchOpacity
from
'../components/TouchOpacity'
;
import
TouchSpan
from
'../components/TouchSpan'
;
import
TabTitle
from
'./InsuredsInfo.components/TabTitle'
;
import
TabTitle
from
'./InsuredsInfo.components/TabTitle'
;
import
ProductListModal
from
'./InsuredsInfo.components/ProductListModal'
;
import
ProductListModal
from
'./InsuredsInfo.components/ProductListModal'
;
...
@@ -36,7 +38,15 @@ const initTableData = [
...
@@ -36,7 +38,15 @@ const initTableData = [
}
}
];
];
const
columns
=
[
const
sleep
=
(
ms
)
=>
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
ms
));
const
InsuredInfo
=
(
props
)
=>
{
const
{
history
,
showLoading
,
hideLoading
}
=
props
;
const
[
selectedDataKey
,
setSelectedDataKey
]
=
useState
(
''
);
const
[
tableData
,
setTableData
]
=
useState
(
initTableData
);
const
[
modalVisible
,
setModalVisible
]
=
useState
(
false
);
const
columns
=
[
{
{
title
:
'保险计划'
,
title
:
'保险计划'
,
dataIndex
:
'plan'
,
dataIndex
:
'plan'
,
...
@@ -68,25 +78,37 @@ const columns = [
...
@@ -68,25 +78,37 @@ const columns = [
key
:
'action'
,
key
:
'action'
,
render
:
(
text
,
record
)
=>
(
render
:
(
text
,
record
)
=>
(
<
div
>
<
div
>
<
span
className=
{
styles
.
actText
}
>
修改保额
</
s
pan
>
<
TouchSpan
className=
{
styles
.
actText
}
>
修改保额
</
TouchS
pan
>
<
Divider
type=
"vertical"
/>
<
Divider
type=
"vertical"
/>
<
span
className=
{
styles
.
actText
}
>
删除
</
span
>
<
TouchSpan
className=
{
record
.
key
===
'1'
?
styles
.
actTextDefault
:
styles
.
actText
}
onClick=
{
()
=>
{
removeTableData
(
record
.
key
);
}
}
>
删除
</
TouchSpan
>
</
div
>
</
div
>
)
)
}
}
];
];
export
default
function
(
props
)
{
const
{
history
}
=
props
;
const
[
selectedDataKey
,
setSelectedDataKey
]
=
useState
(
''
);
const
[
tableData
,
setTableData
]
=
useState
(
initTableData
);
const
[
modalVisible
,
setModalVisible
]
=
useState
(
false
);
const
addPolicy
=
()
=>
{
const
addPolicy
=
()
=>
{
setModalVisible
(
!
modalVisible
);
setModalVisible
(
!
modalVisible
);
};
};
const
addTableData
=
(
product
)
=>
{
const
removeTableData
=
async
(
key
)
=>
{
showLoading
();
await
sleep
(
500
);
hideLoading
();
const
newTableData
=
tableData
.
filter
((
ele
)
=>
ele
.
key
!==
key
);
setTableData
(
newTableData
);
};
const
addTableData
=
async
(
product
)
=>
{
showLoading
();
await
sleep
(
500
);
hideLoading
();
const
key
=
String
(
tableData
.
length
+
1
);
const
key
=
String
(
tableData
.
length
+
1
);
setSelectedDataKey
(
key
);
setSelectedDataKey
(
key
);
setTableData
([
setTableData
([
...
@@ -126,7 +148,7 @@ export default function(props) {
...
@@ -126,7 +148,7 @@ export default function(props) {
<
img
alt=
"pay"
src=
{
IconMoney
}
className=
{
styles
.
titleIcon
}
/>
<
img
alt=
"pay"
src=
{
IconMoney
}
className=
{
styles
.
titleIcon
}
/>
<
span
>
借/领/退款
</
span
>
<
span
>
借/领/退款
</
span
>
</
TabTitle
>
</
TabTitle
>
<
div
className=
{
styles
.
user
}
>
<
div
className=
{
styles
.
user
}
>
<
div
>
<
div
>
<
img
src=
{
IconReturn
}
alt=
"return"
></
img
>
<
img
src=
{
IconReturn
}
alt=
"return"
></
img
>
<
img
src=
{
IconHome
}
alt=
"home"
></
img
>
<
img
src=
{
IconHome
}
alt=
"home"
></
img
>
...
@@ -167,9 +189,9 @@ export default function(props) {
...
@@ -167,9 +189,9 @@ export default function(props) {
<
span
>
付款账号:622********3042
</
span
>
<
span
>
付款账号:622********3042
</
span
>
</
div
>
</
div
>
<
div
className=
{
styles
.
premLine
}
>
<
div
className=
{
styles
.
premLine
}
>
<
span
>
原保费:
559
元
</
span
>
<
span
>
原保费:
680
元
</
span
>
<
span
>
<
span
>
下一期保费:
<
span
className=
{
styles
.
actText
}
>
762
元
</
span
>
下一期保费:
<
span
className=
{
styles
.
actText
}
>
{
tableData
.
length
*
180
+
500
}
元
</
span
>
</
span
>
</
span
>
<
TouchOpacity
className=
{
styles
.
actText
}
>
<
TouchOpacity
className=
{
styles
.
actText
}
>
<
img
src=
{
IconDetail
}
alt=
"detail"
></
img
>
<
img
src=
{
IconDetail
}
alt=
"detail"
></
img
>
...
@@ -197,10 +219,18 @@ export default function(props) {
...
@@ -197,10 +219,18 @@ export default function(props) {
<
ProductListModal
<
ProductListModal
visible=
{
modalVisible
}
visible=
{
modalVisible
}
addTableData=
{
addTableData
}
addTableData=
{
addTableData
}
showLoading=
{
showLoading
}
hideLoading=
{
hideLoading
}
close=
{
()
=>
{
close=
{
()
=>
{
setModalVisible
(
false
);
setModalVisible
(
false
);
}
}
}
}
/>
/>
</
div
>
</
div
>
);
);
}
};
const
mapDispatch
=
({
app
:
{
showLoading
,
hideLoading
}
})
=>
({
showLoading
,
hideLoading
});
export
default
connect
(
null
,
mapDispatch
)(
InsuredInfo
);
src/pages/InsuredInfo.module.scss
View file @
a6a0885f
...
@@ -124,6 +124,11 @@
...
@@ -124,6 +124,11 @@
}
}
}
}
.actTextDefault
{
@extend
.actText
;
color
:
#D7D4D7
;
}
.accountLine
{
.accountLine
{
display
:
flex
;
display
:
flex
;
flex-direction
:
row-reverse
;
flex-direction
:
row-reverse
;
...
...
src/pages/insuredsInfo.components/ProductListModal.jsx
View file @
a6a0885f
import
React
,
{
useState
}
from
'react'
;
import
React
,
{
useState
}
from
'react'
;
import
{
Spin
}
from
'antd'
;
import
styles
from
'./ProductListModal.module.scss'
;
import
styles
from
'./ProductListModal.module.scss'
;
import
TouchOpacity
from
'../../components/TouchOpacity'
;
import
TouchOpacity
from
'../../components/TouchOpacity'
;
...
@@ -77,9 +76,8 @@ const productList = [
...
@@ -77,9 +76,8 @@ const productList = [
];
];
export
default
function
(
props
)
{
export
default
function
(
props
)
{
const
{
visible
,
addTableData
,
close
}
=
props
;
const
{
visible
,
addTableData
,
close
,
showLoading
,
hideLoading
}
=
props
;
const
[
productId
,
setProductId
]
=
useState
(
''
);
const
[
productId
,
setProductId
]
=
useState
(
''
);
const
[
loadingVisible
,
toggleLoadingVisible
]
=
useState
(
false
);
const
clickMain
=
(
event
)
=>
{
const
clickMain
=
(
event
)
=>
{
// 点击主体的时候禁止冒泡,不关闭modal
// 点击主体的时候禁止冒泡,不关闭modal
...
@@ -90,17 +88,17 @@ export default function(props) {
...
@@ -90,17 +88,17 @@ export default function(props) {
if
(
productId
===
id
)
{
if
(
productId
===
id
)
{
setProductId
(
''
);
setProductId
(
''
);
}
else
{
}
else
{
toggleLoadingVisible
(
true
);
showLoading
(
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
setProductId
(
id
);
setProductId
(
id
);
toggleLoadingVisible
(
false
);
hideLoading
(
);
},
Math
.
random
()
*
1000
);
},
Math
.
random
()
*
1000
);
}
}
};
};
const
reset
=
()
=>
{
const
reset
=
()
=>
{
setProductId
(
''
);
setProductId
(
''
);
}
}
;
const
submit
=
()
=>
{
const
submit
=
()
=>
{
const
selectedProduct
=
productList
.
find
((
p
)
=>
p
.
id
===
productId
);
const
selectedProduct
=
productList
.
find
((
p
)
=>
p
.
id
===
productId
);
...
@@ -121,7 +119,9 @@ export default function(props) {
...
@@ -121,7 +119,9 @@ export default function(props) {
<
div
className=
{
styles
.
info
}
>
<
div
className=
{
styles
.
info
}
>
<
span
>
被保险人出生日期:1974年08月07日
</
span
>
<
span
>
被保险人出生日期:1974年08月07日
</
span
>
<
span
>
请谨慎选择以下产品的成人或儿童计划
</
span
>
<
span
>
请谨慎选择以下产品的成人或儿童计划
</
span
>
<
TouchOpacity
className=
{
styles
.
btn
}
onClick=
{
reset
}
>
重置
</
TouchOpacity
>
<
TouchOpacity
className=
{
styles
.
btn
}
onClick=
{
reset
}
>
重置
</
TouchOpacity
>
</
div
>
</
div
>
<
div
className=
{
styles
.
list
}
>
<
div
className=
{
styles
.
list
}
>
{
productList
.
map
((
ele
)
=>
(
{
productList
.
map
((
ele
)
=>
(
...
@@ -138,18 +138,15 @@ export default function(props) {
...
@@ -138,18 +138,15 @@ export default function(props) {
))
}
))
}
</
div
>
</
div
>
<
div
className=
{
styles
.
footer
}
>
<
div
className=
{
styles
.
footer
}
>
<
TouchOpacity
className=
{
styles
.
btnCancel
}
onClick=
{
close
}
>
取消
</
TouchOpacity
>
<
TouchOpacity
className=
{
styles
.
btnCancel
}
onClick=
{
close
}
>
取消
</
TouchOpacity
>
<
TouchOpacity
className=
{
styles
.
btn
}
onClick=
{
submit
}
>
<
TouchOpacity
className=
{
styles
.
btn
}
onClick=
{
submit
}
>
确定
确定
</
TouchOpacity
>
</
TouchOpacity
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
{
loadingVisible
&&
(
<
div
className=
{
styles
.
loading
}
>
<
Spin
tip=
"Loading..."
></
Spin
>
</
div
>
)
}
</
div
>
</
div
>
);
);
}
}
src/pages/insuredsInfo.components/ProductListModal.module.scss
View file @
a6a0885f
...
@@ -128,13 +128,3 @@ $itemWidth: 22vw;
...
@@ -128,13 +128,3 @@ $itemWidth: 22vw;
margin-left
:
30%
;
margin-left
:
30%
;
}
}
}
}
.loading
{
position
:
absolute
;
background-color
:
rgba
(
$color
:
#000000
,
$alpha
:
0
.3
);
padding
:
20px
;
border-radius
:
10px
;
left
:
50%
;
top
:
50%
;
transform
:
translate
(
-50%
,-
50%
);
}
\ No newline at end of file
src/store/app.js
0 → 100644
View file @
a6a0885f
const
app
=
{
state
:
{
loadingQueue
:
0
},
reducers
:
{
showLoading
(
state
)
{
return
{
...
state
,
loadingQueue
:
state
.
loadingQueue
+
1
};
},
hideLoading
(
state
)
{
return
{
...
state
,
loadingQueue
:
state
.
loadingQueue
-
1
};
}
}
};
export
default
app
;
src/store/index.js
View file @
a6a0885f
import
{
init
}
from
'@rematch/core'
;
import
{
init
}
from
'@rematch/core'
;
import
count
from
'./count'
;
import
count
from
'./count'
;
import
app
from
'./app'
;
const
store
=
init
({
const
store
=
init
({
models
:
{
models
:
{
count
count
,
app
}
}
});
});
...
...
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