Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
dev
/
pingan-life-index-pro
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
907d3d38
authored
2020-02-14 14:46:17 +0800
by
simon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
默认提交
1 parent
cad08a2d
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
272 additions
and
201 deletions
src/components/clarms/clarms-plugins-material.js
src/components/clarms/clarms-plugins-material.scss
src/components/clarms/clarms-plugins-material.vue
src/components/clarms/clarms-plugins-verifyform.js
src/components/clarms/clarms-plugins-verifyform.vue
src/components/date-picker/date-picker.js
src/pages/clarms/clarms.vue
src/utils/utils.js
src/components/clarms/clarms-plugins-material.js
View file @
907d3d3
...
...
@@ -16,6 +16,8 @@ import {
Option
}
from
'element-ui'
;
import
{
ddMMyyyy2yyyyMMdd
}
from
'@utils/utils.js'
;
Vue
.
use
(
Loading
);
Vue
.
use
(
Select
);
Vue
.
use
(
Option
);
...
...
@@ -109,6 +111,17 @@ export default {
let
b10
=
this
.
policyIllegal
;
// console.log("b1:",b1);
// console.log("b2:",b2);
// console.log("b3:",b3);
// console.log("b4:",b4);
// console.log("b5:",b5);
// console.log("b6:",b6);
// console.log("b7:",b7);
// console.log("b8:",b8);
// console.log("b9:",b9);
// console.log("b10:",b10);
return
b1
||
b2
||
b3
||
b4
||
b5
||
b6
||
b7
||
b8
||
b9
||
b10
;
}
},
...
...
@@ -217,7 +230,8 @@ export default {
cid
:
this
.
cid
,
insuredId
:
insured
.
insuredId
,
policyId
:
policy
.
policyId
,
accidentTime
:
this
.
data
.
contactDate
,
// accidentTime: this.data.contactDate,
accidentTime
:
ddMMyyyy2yyyyMMdd
(
this
.
data
.
contactDate
),
applyReasonList
:
this
.
typeSelected
.
join
(
","
),
treatmentAmount
:
this
.
data
.
amount
,
imageList
:
imageList
...
...
src/components/clarms/clarms-plugins-material.scss
View file @
907d3d3
...
...
@@ -176,7 +176,7 @@ input {
margin-top
:
48px
;
}
.mt24
{
.mt24
{
margin-top
:
24px
;
}
...
...
@@ -203,9 +203,13 @@ input {
hr
{
border-top
:
1px
solid
#eee
;
margin-top
:
4
8
px
;
margin-top
:
4
2
px
;
}
// .hr2{
// margin-top: 42px;
// }
.tips
{
display
:
flex
;
justify-content
:
flex-start
;
...
...
@@ -224,7 +228,7 @@ input {
}
}
.tips2
{
.tips2
{
margin-top
:
-12px
;
}
...
...
@@ -361,13 +365,14 @@ input {
width
:
100%
;
display
:
flex
;
justify-content
:
flex-start
;
padding
:
0
$marginSmall
;
//
padding: 0 $marginSmall;
margin-bottom
:
1
.333333rem
;
.label
{
@extend
.bb
;
align-items
:
center
;
width
:
30%
;
padding-left
:
5
px
;
min-width
:
260px
;
padding-left
:
70
px
;
letter-spacing
:
.25rem
;
font-size
:
20px
;
...
...
@@ -402,12 +407,13 @@ input {
.ipt2
{
width
:
100%
;
//
width: 100%;
border-bottom
:
1px
solid
#ccc
;
height
:
3rem
;
display
:
flex
;
align-items
:
center
;
margin-bottom
:
.833333rem
;
width
:
700px
;
}
// 长文本
...
...
@@ -433,6 +439,10 @@ input {
}
}
&
-item-3
{
margin-bottom
:
0
;
}
}
...
...
src/components/clarms/clarms-plugins-material.vue
View file @
907d3d3
...
...
@@ -103,7 +103,7 @@
<div
class=
"down-arrow"
></div>
<div
class=
"cont"
>
<div
class=
"ipt-date"
>
<date-picker
v-model=
"data.contactDate"
:filtModel=
"['future']"
:check=
"checkDate"
:cusStyle=
"{border:'none !important','background-color':'transparent !important','height':'58px', 'color':'#ff6839','font-weight':'bold','text-align': 'center'}"
></date-picker>
<date-picker
v-model=
"data.contactDate"
:f
ormatter=
"'dd-MM-yyyy'"
:f
iltModel=
"['future']"
:check=
"checkDate"
:cusStyle=
"{border:'none !important','background-color':'transparent !important','height':'58px', 'color':'#ff6839','font-weight':'bold','text-align': 'center'}"
></date-picker>
</div>
</div>
</div>
...
...
@@ -111,7 +111,7 @@
</div>
<
template
v-if=
"data.contactDate"
>
<div
class=
"pure-u-1 form-item-2 mt20"
>
<div
class=
"pure-u-1 form-item-2
form-item-3
mt20"
>
<div
class=
"label"
>
<div
class=
"main-label"
>
{{
$t
(
'clarms.step2.label10'
)
}}
...
...
@@ -123,7 +123,7 @@
</div>
</div>
<div
class=
"pure-u-1 form-item-2
mt20
"
>
<div
class=
"pure-u-1 form-item-2
form-item-3 mt24
"
>
<div
class=
"label"
>
<div
class=
"main-label"
>
{{
$t
(
'clarms.step2.label13'
)
}}
...
...
@@ -138,7 +138,7 @@
</
template
>
</div>
<
template
v-if=
"(data.HT41 && data.HT41.length > 0) && (data.HT26 && data.HT26.length > 0)"
>
<hr
v-if=
"data.amount > 0"
>
<hr
class=
"hr2"
v-if=
"data.amount > 0"
>
<div
class=
"bottom-tip orange mt20"
>
{{
$t
(
'clarms.step2.label17'
)
}}
</div>
<div
class=
"bottom-tip gray mt10"
>
{{
$t
(
'clarms.step2.tip1'
)
}}
</div>
...
...
src/components/clarms/clarms-plugins-verifyform.js
View file @
907d3d3
...
...
@@ -12,10 +12,14 @@ import DatePicker from '@/components/date-picker/date-picker.vue';
import
{
Loading
}
from
'vant'
;
import
{
Select
,
Option
}
from
'element-ui'
;
import
{
ddMMyyyy2yyyyMMdd
}
from
'@utils/utils.js'
;
Vue
.
use
(
Select
);
Vue
.
use
(
Option
);
Vue
.
use
(
Loading
);
export
default
{
data
()
{
return
{
...
...
@@ -90,8 +94,10 @@ export default {
if
(
this
.
loading
)
{
return
;
}
this
.
loading
=
true
;
httpPost
({
url
:
api
.
getCidByVerify
,
data
:
this
.
data
}).
then
(
res
=>
{
this
.
loading
=
true
;
let
param
=
this
.
data
;
param
.
birthDate
=
ddMMyyyy2yyyyMMdd
(
param
.
birthDate
);
httpPost
({
url
:
api
.
getCidByVerify
,
data
:
param
}).
then
(
res
=>
{
if
(
res
)
{
let
cid
=
res
;
httpPost
({
url
:
api
.
clarmsCustomerList
,
data
:
{
cid
:
cid
}
}).
then
(
res
=>
{
...
...
src/components/clarms/clarms-plugins-verifyform.vue
View file @
907d3d3
...
...
@@ -4,7 +4,8 @@
<u>
<span
class=
"pointer"
@
click=
"toRegisterPage"
>
{{
$t
(
'clarms.step1.register'
)
}}
</span>
/
<span
class=
"pointer"
@
click=
"toLoginPage"
>
{{
$t
(
'clarms.step1.login'
)
}}
</span>
</u>
{{
$t
(
'clarms.step1.t1'
)
}}
</div>
</u>
<span
v-if=
"$i18n.locale == 'en'"
>
</span>
{{
$t
(
'clarms.step1.t1'
)
}}
</div>
<div
class=
"form-name default-mt"
>
{{
$t
(
'clarms.step1.label0'
)
}}
</div>
<div
class=
"gird-g form default-mt"
>
<div
class=
"form-item"
>
...
...
@@ -63,7 +64,7 @@
<div
class=
"ipt-wrap"
>
<div
class=
"down-arrow"
></div>
<div
class=
"cont"
>
<date-picker
class=
"ipt-date"
v-model=
"data.birthDate"
:filtModel=
"['future']"
:check=
"checkDate"
:cusStyle=
"
{border:'none !important','background-color':'transparent !important',height:'48px', padding:'0', color:'#606266'}">
</date-picker>
<date-picker
class=
"ipt-date"
:formatter=
"'dd-MM-yyyy'"
v-model=
"data.birthDate"
:filtModel=
"['future']"
:check=
"checkDate"
:cusStyle=
"
{border:'none !important','background-color':'transparent !important',height:'48px', padding:'0', color:'#606266'}">
</date-picker>
</div>
</div>
</div>
...
...
src/components/date-picker/date-picker.js
View file @
907d3d3
...
...
@@ -6,14 +6,22 @@ import {
import
Date
from
'@/utils/date.js'
;
import
{
ddMMyyyy2yyyyMMdd
}
from
'@utils/utils.js'
;
export
default
{
inheritAttrs
:
false
,
props
:
{
// 周末是否可选
value
:
{
type
:
String
,
default
:
""
},
// 日期格式 默认yyyy-MM-dd
formatter
:
{
type
:
String
,
default
:
"yyyy-MM-dd"
},
// 周末是否可选
weekend
:
{
type
:
Boolean
,
...
...
@@ -26,14 +34,14 @@ export default {
// today : 当日不可选择
filtModel
:
{
type
:
Array
,
default
()
{
default
()
{
return
[
"history"
,
"weekend"
,
"today"
]
}
},
// 需要过滤的日期列表 格式 ["yyyy-MM-dd","yyyy-MM-dd"]
filterDates
:
{
type
:
Array
,
default
()
{
default
()
{
return
[]
// ["2019-11-26", "2019-11-28"]
}
},
...
...
@@ -62,7 +70,7 @@ export default {
},
cusStyle
:
{
type
:
Object
,
default
()
{
default
()
{
return
{};
}
},
...
...
@@ -125,7 +133,13 @@ export default {
},
methods
:
{
activity
(
item
)
{
let
ymd
=
item
.
year
+
"-"
+
(
item
.
month
>
9
?
item
.
month
:
"0"
+
item
.
month
)
+
"-"
+
(
item
.
date
>
9
?
item
.
date
:
"0"
+
item
.
date
);
let
year
=
item
.
year
;
let
month
=
item
.
month
>
9
?
item
.
month
:
"0"
+
item
.
month
;
let
date
=
item
.
date
>
9
?
item
.
date
:
"0"
+
item
.
date
;
let
ymd
=
`
${
year
}
-
${
month
}
-
${
date
}
`
;
if
(
this
.
formatter
==
"dd-MM-yyyy"
)
{
ymd
=
`
${
date
}
-
${
month
}
-
${
year
}
`
;
}
return
ymd
==
this
.
dateValue
;
},
/**
...
...
@@ -361,13 +375,18 @@ export default {
}
},
formatDateValue
(
year
,
month
,
date
)
{
// console.log("year:", year);
// console.log("month:", month);
// console.log("date:", date);
if
(
month
<
10
)
{
month
=
"0"
+
month
}
if
(
date
<
10
)
{
date
=
"0"
+
date
}
this
.
dateValue
=
`
${
year
}
-
${
month
}
-
${
date
}
`
;
// this.dateValue = `${year}-${month}-${date}`;
this
.
dateValue
=
Date
.
parse
(
`
${
year
}
.
${
month
}
.
${
date
}
`
).
toString
(
this
.
formatter
);
// console.log("this.dateValue:", this.dateValue);
},
/**
* 校验并返回日期
...
...
@@ -384,14 +403,16 @@ export default {
fortmatMonthData
.
forEach
((
element
,
idx
)
=>
{
if
(
element
)
{
let
curDate
=
`
${
element
.
year
}
-
${
element
.
month
}
-
${
element
.
date
}
`
;
curDate
=
Date
.
parse
(
curDate
).
toString
(
"yyyy-MM-dd"
);
//转成yyyy-MM-dd
curDate
=
Date
.
parse
(
curDate
).
toString
(
this
.
formatter
);
//转成yyyy-MM-dd
if
(
curDate
==
dateValue
&&
element
.
disable
==
true
)
{
disable
=
true
;
}
}
});
if
(
!
disable
)
{
disable
=
!
/^
((?!
0000
)[
0-9
]{4}
-
((
0
[
1-9
]
|1
[
0-2
])
-
(
0
[
1-9
]
|1
[
0-9
]
|2
[
0-8
])
|
(
0
[
13-9
]
|1
[
0-2
])
-
(
29|30
)
|
(
0
[
13578
]
|1
[
02
])
-31
)
|
([
0-9
]{2}(
0
[
48
]
|
[
2468
][
048
]
|
[
13579
][
26
])
|
(
0
[
48
]
|
[
2468
][
048
]
|
[
13579
][
26
])
00
)
-02-29
)
$/
.
test
(
dateValue
);
if
(
this
.
formatter
==
"yyyy-MM-dd"
)
{
disable
=
!
/^
((?!
0000
)[
0-9
]{4}
-
((
0
[
1-9
]
|1
[
0-2
])
-
(
0
[
1-9
]
|1
[
0-9
]
|2
[
0-8
])
|
(
0
[
13-9
]
|1
[
0-2
])
-
(
29|30
)
|
(
0
[
13578
]
|1
[
02
])
-31
)
|
([
0-9
]{2}(
0
[
48
]
|
[
2468
][
048
]
|
[
13579
][
26
])
|
(
0
[
48
]
|
[
2468
][
048
]
|
[
13579
][
26
])
00
)
-02-29
)
$/
.
test
(
dateValue
);
}
}
let
result
=
{
dateValue
:
this
.
dateValue
,
...
...
@@ -404,15 +425,29 @@ export default {
// 设置今天日期
let
isInit
=
false
;
if
(
this
.
value
)
{
let
ymd
=
this
.
value
.
split
(
"-"
);
if
(
ymd
.
length
==
3
)
{
try
{
this
.
year
=
Number
(
ymd
[
0
]);
this
.
month
=
Number
(
ymd
[
1
]);
this
.
date
=
Number
(
ymd
[
2
]);
isInit
=
true
;
}
catch
(
e
)
{
}
}
// console.log("this.value:", this.value);
// let ymd = this.value.split("-");
// if (ymd.length == 3) {
// try {
// this.year = Number(ymd[0]);
// this.month = Number(ymd[1]);
// this.date = Number(ymd[2]);
// isInit = true;
// } catch (e) {}
// }
try
{
let
dateStr
=
this
.
value
;
if
(
this
.
formatter
==
"dd-MM-yyyy"
)
{
// dateStr = this.value.replace(/-/g, '').replace(/^(\d{2})(\d{2})(\d{4})$/, "$3-$2-$1");
dateStr
=
ddMMyyyy2yyyyMMdd
(
this
.
value
);
}
let
curDate
=
Date
.
parse
(
dateStr
);
this
.
year
=
curDate
.
getFullYear
();
this
.
month
=
curDate
.
getMonth
()
+
1
;
this
.
date
=
curDate
.
getDate
();
isInit
=
true
;
}
catch
(
error
)
{}
}
if
(
!
isInit
)
{
let
today
=
Date
.
today
();
...
...
@@ -447,7 +482,7 @@ export default {
}
},
mounted
()
{
},
mounted
()
{},
created
()
{
this
.
initData
();
},
...
...
src/pages/clarms/clarms.vue
View file @
907d3d3
...
...
@@ -3,7 +3,7 @@
<div
class=
"navigate"
>
<div
class=
"bg"
></div>
<div
class=
"cont"
>
<span
class=
"tt"
>
索償申請
</span>
<span
class=
"tt"
>
{{
$t
(
'customService.menu5'
)
}}
</span>
</div>
</div>
<div
class=
"content clarms"
>
...
...
src/utils/utils.js
View file @
907d3d3
// 正在表达式
export
const
REGEXPS
=
{
"mobile"
:
/^
1
\
d
{
10
}
$
/
"mobile"
:
/^
1
\
d
{
10
}
$
/
}
// 验证手机
export
function
checkMobile
(
str
)
{
return
REGEXPS
.
mobile
.
test
(
str
);
return
REGEXPS
.
mobile
.
test
(
str
);
}
/**
...
...
@@ -14,45 +14,45 @@ export function checkMobile(str) {
* @param {*} url
*/
export
function
param2Obj
(
url
)
{
const
search
=
url
.
split
(
'?'
)[
1
]
if
(
!
search
)
{
return
{}
}
return
JSON
.
parse
(
'{"'
+
decodeURIComponent
(
search
)
.
replace
(
/"/g
,
'\\"'
)
.
replace
(
/&/g
,
'","'
)
.
replace
(
/=/g
,
'":"'
)
+
'"}'
)
const
search
=
url
.
split
(
'?'
)[
1
]
if
(
!
search
)
{
return
{}
}
return
JSON
.
parse
(
'{"'
+
decodeURIComponent
(
search
)
.
replace
(
/"/g
,
'\\"'
)
.
replace
(
/&/g
,
'","'
)
.
replace
(
/=/g
,
'":"'
)
+
'"}'
)
}
//获取cookie、
export
function
getCookie
(
name
)
{
var
arr
,
reg
=
new
RegExp
(
"(^| )"
+
name
+
"=([^;]*)(;|$)"
);
if
(
arr
=
document
.
cookie
.
match
(
reg
))
return
(
arr
[
2
]);
else
return
null
;
var
arr
,
reg
=
new
RegExp
(
"(^| )"
+
name
+
"=([^;]*)(;|$)"
);
if
(
arr
=
document
.
cookie
.
match
(
reg
))
return
(
arr
[
2
]);
else
return
null
;
}
//设置cookie
export
function
setCookie
(
c_name
,
value
,
second
)
{
var
exdate
=
new
Date
();
exdate
.
setTime
(
exdate
.
getTime
()
+
second
*
1000
);
document
.
cookie
=
c_name
+
"="
+
escape
(
value
)
+
((
second
==
null
)
?
""
:
";expires="
+
exdate
.
toGMTString
());
var
exdate
=
new
Date
();
exdate
.
setTime
(
exdate
.
getTime
()
+
second
*
1000
);
document
.
cookie
=
c_name
+
"="
+
escape
(
value
)
+
((
second
==
null
)
?
""
:
";expires="
+
exdate
.
toGMTString
());
};
//删除cookie
export
function
delCookie
(
name
)
{
var
exp
=
new
Date
();
exp
.
setTime
(
exp
.
getTime
()
-
1
);
var
cval
=
getCookie
(
name
);
if
(
cval
!=
null
)
document
.
cookie
=
name
+
"="
+
cval
+
";expires="
+
exp
.
toGMTString
();
var
exp
=
new
Date
();
exp
.
setTime
(
exp
.
getTime
()
-
1
);
var
cval
=
getCookie
(
name
);
if
(
cval
!=
null
)
document
.
cookie
=
name
+
"="
+
cval
+
";expires="
+
exp
.
toGMTString
();
};
...
...
@@ -61,36 +61,36 @@ export function delCookie(name) {
* @return {Object} 环境信息对象
*/
export
function
getEnv
()
{
var
nav
=
window
.
navigator
;
var
env
=
{
"iphone"
:
false
,
"ipad"
:
false
,
"android"
:
false
,
"pc"
:
false
,
"ios"
:
false
,
"ver"
:
"0"
};
var
nav
=
window
.
navigator
;
var
env
=
{
"iphone"
:
false
,
"ipad"
:
false
,
"android"
:
false
,
"pc"
:
false
,
"ios"
:
false
,
"ver"
:
"0"
};
var
ua
=
nav
.
userAgent
;
var
android
=
ua
.
match
(
/
(
Android
)\s
+
([\d
.
]
+
)
/
);
var
ipad
=
ua
.
match
(
/
(
iPad
)
.*OS
\s([\d
_
]
+
)
/
);
var
iphone
=
!
ipad
&&
ua
.
match
(
/
(
iPhone
\s
OS
)\s([\d
_
]
+
)
/
);
if
(
ipad
)
{
env
.
ipad
=
ipad
[
1
]
&&
true
||
false
;
env
.
ver
=
ipad
[
2
]
&&
ipad
[
2
].
replace
(
/-/g
,
"."
)
||
""
;
env
.
ios
=
true
;
}
else
if
(
iphone
)
{
env
.
iphone
=
iphone
[
1
]
&&
true
||
false
;
env
.
ver
=
iphone
[
2
]
&&
iphone
[
2
].
replace
(
/-/g
,
"."
)
||
""
;
env
.
ios
=
true
;
}
else
if
(
android
)
{
env
.
android
=
android
[
1
]
&&
true
||
false
;
env
.
ver
=
android
[
2
];
}
else
{
env
.
pc
=
true
;
}
var
ua
=
nav
.
userAgent
;
var
android
=
ua
.
match
(
/
(
Android
)\s
+
([\d
.
]
+
)
/
);
var
ipad
=
ua
.
match
(
/
(
iPad
)
.*OS
\s([\d
_
]
+
)
/
);
var
iphone
=
!
ipad
&&
ua
.
match
(
/
(
iPhone
\s
OS
)\s([\d
_
]
+
)
/
);
if
(
ipad
)
{
env
.
ipad
=
ipad
[
1
]
&&
true
||
false
;
env
.
ver
=
ipad
[
2
]
&&
ipad
[
2
].
replace
(
/-/g
,
"."
)
||
""
;
env
.
ios
=
true
;
}
else
if
(
iphone
)
{
env
.
iphone
=
iphone
[
1
]
&&
true
||
false
;
env
.
ver
=
iphone
[
2
]
&&
iphone
[
2
].
replace
(
/-/g
,
"."
)
||
""
;
env
.
ios
=
true
;
}
else
if
(
android
)
{
env
.
android
=
android
[
1
]
&&
true
||
false
;
env
.
ver
=
android
[
2
];
}
else
{
env
.
pc
=
true
;
}
return
env
;
return
env
;
}
/**
...
...
@@ -98,48 +98,48 @@ export function getEnv() {
* @param {[type]} title [description]
*/
export
function
setTitle
(
title
)
{
if
(
!
title
)
{
return
;
}
document
.
title
=
title
;
// if (ENV.ios && navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1) {
// 修复微信端IOS无法修改document.title的情况
if
(
getEnv
().
ios
&&
(
navigator
.
userAgent
.
toLowerCase
().
indexOf
(
"micromessenger"
)
!==
-
1
||
navigator
.
userAgent
.
toLowerCase
().
indexOf
(
"alipay"
)
!==
-
1
))
{
//修复IOS微信端和支付宝无法修改document.title的情况
var
$iframe
=
document
.
createElement
(
'iframe'
);
$iframe
.
className
=
"C-hiddenIframe"
;
$iframe
.
src
=
"/"
+
location
.
pathname
.
split
(
'/'
)[
1
]
+
"/favicon.ico"
;
$iframe
.
style
.
visibility
=
'hidden'
;
$iframe
.
style
.
width
=
'1px'
;
$iframe
.
style
.
height
=
'1px'
;
$iframe
.
onload
=
function
onIframeLoad
()
{
setTimeout
(
function
()
{
$iframe
.
onload
=
null
;
onIframeLoad
=
null
;
document
.
body
.
removeChild
(
$iframe
);
$iframe
=
null
;
},
0
);
};
document
.
body
.
appendChild
(
$iframe
);
}
if
(
!
title
)
{
return
;
}
document
.
title
=
title
;
// if (ENV.ios && navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1) {
// 修复微信端IOS无法修改document.title的情况
if
(
getEnv
().
ios
&&
(
navigator
.
userAgent
.
toLowerCase
().
indexOf
(
"micromessenger"
)
!==
-
1
||
navigator
.
userAgent
.
toLowerCase
().
indexOf
(
"alipay"
)
!==
-
1
))
{
//修复IOS微信端和支付宝无法修改document.title的情况
var
$iframe
=
document
.
createElement
(
'iframe'
);
$iframe
.
className
=
"C-hiddenIframe"
;
$iframe
.
src
=
"/"
+
location
.
pathname
.
split
(
'/'
)[
1
]
+
"/favicon.ico"
;
$iframe
.
style
.
visibility
=
'hidden'
;
$iframe
.
style
.
width
=
'1px'
;
$iframe
.
style
.
height
=
'1px'
;
$iframe
.
onload
=
function
onIframeLoad
()
{
setTimeout
(
function
()
{
$iframe
.
onload
=
null
;
onIframeLoad
=
null
;
document
.
body
.
removeChild
(
$iframe
);
$iframe
=
null
;
},
0
);
};
document
.
body
.
appendChild
(
$iframe
);
}
}
// 为链接添加参数
export
function
addQuery
(
url
,
query
)
{
query
=
query
||
{}
query
=
(
function
(
query
)
{
var
q
=
[]
Object
.
keys
(
query
).
forEach
(
function
(
_q
)
{
q
.
push
(
_q
+
'='
+
query
[
_q
])
})
return
q
.
join
(
'&'
)
})(
query
)
if
(
url
.
indexOf
(
'?'
)
!==
-
1
)
{
url
+=
'&'
+
query
}
else
{
url
+=
'?'
+
query
}
return
url
query
=
query
||
{}
query
=
(
function
(
query
)
{
var
q
=
[]
Object
.
keys
(
query
).
forEach
(
function
(
_q
)
{
q
.
push
(
_q
+
'='
+
query
[
_q
])
})
return
q
.
join
(
'&'
)
})(
query
)
if
(
url
.
indexOf
(
'?'
)
!==
-
1
)
{
url
+=
'&'
+
query
}
else
{
url
+=
'?'
+
query
}
return
url
}
...
...
@@ -148,16 +148,16 @@ export function addQuery(url, query) {
* @return {String} 页面path
*/
export
function
getPath
()
{
var
path
=
window
.
location
.
hash
;
path
=
path
||
"#/"
;
path
=
path
===
"#/"
?
"#/index"
:
path
;
path
=
path
.
split
(
"?"
);
return
path
[
0
];
var
path
=
window
.
location
.
hash
;
path
=
path
||
"#/"
;
path
=
path
===
"#/"
?
"#/index"
:
path
;
path
=
path
.
split
(
"?"
);
return
path
[
0
];
}
// 获取 url 参数
export
function
getQuery
(
name
)
{
return
decodeURIComponent
((
new
RegExp
(
'[?|&]'
+
name
+
'='
+
'([^&;]+?)(&|#|;|$)'
).
exec
(
location
.
href
)
||
[,
""
])[
1
].
replace
(
/
\+
/g
,
'%20'
))
||
null
;
return
decodeURIComponent
((
new
RegExp
(
'[?|&]'
+
name
+
'='
+
'([^&;]+?)(&|#|;|$)'
).
exec
(
location
.
href
)
||
[,
""
])[
1
].
replace
(
/
\+
/g
,
'%20'
))
||
null
;
}
/**
...
...
@@ -167,13 +167,13 @@ export function getQuery(name) {
* @param {*} list
*/
export
function
getObjByListKeyValue
(
value
,
key
,
list
)
{
let
result
=
null
;
list
.
forEach
(
element
=>
{
if
(
element
[
key
+
""
]
==
value
)
{
result
=
element
;
}
});
return
result
;
let
result
=
null
;
list
.
forEach
(
element
=>
{
if
(
element
[
key
+
""
]
==
value
)
{
result
=
element
;
}
});
return
result
;
}
/**
...
...
@@ -182,10 +182,15 @@ export function getObjByListKeyValue(value, key, list) {
* 用{{}}会当成字符串把 html渲染出来
*/
export
function
formatBr
(
str
)
{
str
=
str
.
replace
(
/
\n
/g
,
'<br/>'
)
return
str
str
=
str
.
replace
(
/
\n
/g
,
'<br/>'
)
return
str
};
// dd-MM-yyyy转yyyy-MM-dd
export
function
ddMMyyyy2yyyyMMdd
(
str
)
{
return
str
.
replace
(
/-/g
,
''
).
replace
(
/^
(\d{2})(\d{2})(\d{4})
$/
,
"$3-$2-$1"
);
}
/**
* @desc 函数防抖
...
...
@@ -194,25 +199,25 @@ export function formatBr(str) {
* @param immediate true 表立即执行,false 表非立即执行
*/
export
function
debounce
(
func
,
wait
,
immediate
)
{
let
timeout
;
let
timeout
;
return
function
()
{
let
context
=
this
;
let
args
=
arguments
;
return
function
()
{
let
context
=
this
;
let
args
=
arguments
;
if
(
timeout
)
clearTimeout
(
timeout
);
if
(
immediate
)
{
var
callNow
=
!
timeout
;
timeout
=
setTimeout
(()
=>
{
timeout
=
null
;
},
wait
)
if
(
callNow
)
func
.
apply
(
context
,
args
)
}
else
{
timeout
=
setTimeout
(
function
()
{
func
.
apply
(
context
,
args
)
},
wait
);
}
}
if
(
timeout
)
clearTimeout
(
timeout
);
if
(
immediate
)
{
var
callNow
=
!
timeout
;
timeout
=
setTimeout
(()
=>
{
timeout
=
null
;
},
wait
)
if
(
callNow
)
func
.
apply
(
context
,
args
)
}
else
{
timeout
=
setTimeout
(
function
()
{
func
.
apply
(
context
,
args
)
},
wait
);
}
}
}
/**
...
...
@@ -223,62 +228,62 @@ export function debounce(func, wait, immediate) {
* 时间戳版的函数触发是在时间段内开始的时候,而定时器版的函数触发是在时间段内结束的时候。
*/
export
function
throttle
(
func
,
wait
,
type
)
{
if
(
type
===
1
)
{
var
previous
=
0
;
}
else
if
(
type
===
2
)
{
var
timeout
;
}
return
function
()
{
let
context
=
this
;
let
args
=
arguments
;
if
(
type
===
1
)
{
let
now
=
Date
.
now
();
if
(
type
===
1
)
{
var
previous
=
0
;
}
else
if
(
type
===
2
)
{
var
timeout
;
}
return
function
()
{
let
context
=
this
;
let
args
=
arguments
;
if
(
type
===
1
)
{
let
now
=
Date
.
now
();
if
(
now
-
previous
>
wait
)
{
func
.
apply
(
context
,
args
);
previous
=
now
;
}
}
else
if
(
type
===
2
)
{
if
(
!
timeout
)
{
timeout
=
setTimeout
(()
=>
{
timeout
=
null
;
func
.
apply
(
context
,
args
)
},
wait
)
}
}
}
if
(
now
-
previous
>
wait
)
{
func
.
apply
(
context
,
args
);
previous
=
now
;
}
}
else
if
(
type
===
2
)
{
if
(
!
timeout
)
{
timeout
=
setTimeout
(()
=>
{
timeout
=
null
;
func
.
apply
(
context
,
args
)
},
wait
)
}
}
}
}
/**
* 几种常用的校验方式
* @param {string} type
* @param {string} value
* @param {string} type
* @param {string} value
*/
export
function
contactMethodCheck
(
type
,
value
)
{
if
(
type
==
'hkmobile'
)
{
// return /^[5689]{1}\d{7}$/.test(value);
return
/^
(\+)?(
852
)?(\-)?(
5|6|8|9
)\d{7}
$/
.
test
(
value
);
}
if
(
type
==
'hkmobile'
)
{
// return /^[5689]{1}\d{7}$/.test(value);
return
/^
(\+)?(
852
)?(\-)?(
5|6|8|9
)\d{7}
$/
.
test
(
value
);
}
if
(
type
==
'mobile'
)
{
// return /^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(166)|(17[0-9])|(18[0-9])|(19[0-9]))\d{8}$/.test(value);
return
/^1
\d{10}
$/
.
test
(
value
);
}
if
(
type
==
'mobile'
)
{
// return /^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(166)|(17[0-9])|(18[0-9])|(19[0-9]))\d{8}$/.test(value);
return
/^1
\d{10}
$/
.
test
(
value
);
}
if
(
type
==
'email'
)
{
return
/^
(\w
-*
\.
*
)
+@
(\w
-
?)
+
(\.\w{2,})
+$/
.
test
(
value
);
}
return
true
;
if
(
type
==
'email'
)
{
return
/^
(\w
-*
\.
*
)
+@
(\w
-
?)
+
(\.\w{2,})
+$/
.
test
(
value
);
}
return
true
;
}
export
function
policyNumberCheck
(
policyNumber
)
{
return
/^
(
P|p
)(
0001|0002
)\d{11}
$/
.
test
(
policyNumber
);
return
/^
(
P|p
)(
0001|0002
)\d{11}
$/
.
test
(
policyNumber
);
}
export
function
checkVerifyCode
(
verifyCode
)
{
return
/^
\d{6}
$/
.
test
(
verifyCode
)
return
/^
\d{6}
$/
.
test
(
verifyCode
)
}
export
function
checkName
(
name
)
{
return
/^
\D
+$/
.
test
(
name
);
}
\ No newline at end of file
return
/^
\D
+$/
.
test
(
name
);
}
...
...
Please
register
or
sign in
to post a comment