Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ydLife
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sweet Zhang
ydLife
Commits
1504a8dc
Commit
1504a8dc
authored
Mar 12, 2020
by
Sweet Zhang
Browse files
Options
Browse Files
Download
Plain Diff
商机跟进
parents
33b48658
d6113dc8
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
242 additions
and
39 deletions
+242
-39
angular.json
+3
-2
src/app/app.module.ts
+15
-14
src/app/common/toast/toast.component.scss
+1
-4
src/app/my/my-business-detail/my-business-detail.component.html
+20
-16
src/app/my/my-business-detail/my-business-detail.component.ts
+7
-1
src/app/my/my.module.ts
+3
-1
src/app/my/sales-detail/sales-detail.component.ts
+1
-1
src/assets/LCalendar/LCalendar.css
+2
-0
src/assets/LCalendar/LCalendar.js
+182
-0
src/index.html
+3
-0
src/typings.d.ts
+5
-0
No files found.
angular.json
View file @
1504a8dc
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
"src/assets/weui/weui.css"
,
"src/assets/weui/weui.css"
,
"src/styles.scss"
"src/styles.scss"
],
],
"scripts"
:
[],
//
引入全局脚步,构建时会打包进来,常用于第三方库引入的脚本
"scripts"
:
[],
//
引入全局脚步,构建时会打包进来,常用于第三方库引入的脚本
"es5BrowserSupport"
:
true
"es5BrowserSupport"
:
true
},
},
"configurations"
:
{
"configurations"
:
{
...
@@ -187,4 +187,4 @@
...
@@ -187,4 +187,4 @@
}
}
},
},
"defaultProject"
:
"ydLife"
"defaultProject"
:
"ydLife"
}
}
\ No newline at end of file
src/app/app.module.ts
View file @
1504a8dc
import
{
BrowserModule
}
from
'@angular/platform-browser'
;
import
{
BrowserModule
}
from
'@angular/platform-browser'
;
import
{
NgModule
}
from
'@angular/core'
;
import
{
NgModule
}
from
'@angular/core'
;
import
{
AppRoutingModule
}
from
'./app-routing.module'
;
import
{
AppRoutingModule
}
from
'./app-routing.module'
;
import
{
AppComponent
}
from
'./app.component'
;
import
{
AppComponent
}
from
'./app.component'
;
import
{
PageNotFoundComponent
}
from
'./page-not-found/page-not-found.component'
;
import
{
PageNotFoundComponent
}
from
'./page-not-found/page-not-found.component'
;
import
{
MyModule
}
from
'./my/my.module'
;
import
{
MyModule
}
from
'./my/my.module'
;
import
{
Router
}
from
'@angular/router'
;
import
{
Router
}
from
'@angular/router'
;
import
{
AuthModule
}
from
'./auth/auth.module'
;
import
{
AuthModule
}
from
'./auth/auth.module'
;
import
{
HttpClientModule
}
from
'@angular/common/http'
;
import
{
HttpClientModule
}
from
'@angular/common/http'
;
import
{
LifeCommonModule
}
from
'./common/life-common.module'
;
import
{
LifeCommonModule
}
from
'./common/life-common.module'
;
import
{
httpInterceptorProviders
}
from
'./http-interceptors/index'
;
import
{
httpInterceptorProviders
}
from
'./http-interceptors/index'
;
import
{
DatePipe
}
from
"@angular/common"
;
import
{
DatePipe
}
from
"@angular/common"
;
import
{
SafeHtmlPipe
}
from
'./safe-html.pipe'
;
import
{
SafeHtmlPipe
}
from
'./safe-html.pipe'
;
import
{
LocalStorage
}
from
'./domain/local.storage'
;
import
{
LocalStorage
}
from
'./domain/local.storage'
;
@
NgModule
({
@
NgModule
({
declarations
:
[
declarations
:
[
AppComponent
,
AppComponent
,
...
@@ -26,7 +27,7 @@ import {LocalStorage} from './domain/local.storage';
...
@@ -26,7 +27,7 @@ import {LocalStorage} from './domain/local.storage';
HttpClientModule
,
HttpClientModule
,
AppRoutingModule
,
AppRoutingModule
,
],
],
providers
:
[
DatePipe
,
httpInterceptorProviders
,
LocalStorage
],
providers
:
[
DatePipe
,
httpInterceptorProviders
,
LocalStorage
],
bootstrap
:
[
AppComponent
]
bootstrap
:
[
AppComponent
]
})
})
export
class
AppModule
{
export
class
AppModule
{
...
...
src/app/common/toast/toast.component.scss
View file @
1504a8dc
...
@@ -11,11 +11,9 @@
...
@@ -11,11 +11,9 @@
position
:
fixed
;
position
:
fixed
;
z-index
:
5000
;
z-index
:
5000
;
width
:
9
.8em
;
width
:
9
.8em
;
min-height
:
7
.6em
;
height
:
60px
;
padding
:
0
0
.7em
;
padding
:
0
0
.7em
;
top
:
180px
;
left
:
50%
;
left
:
50%
;
margin-left
:
-4
.9em
;
background
:
rgba
(
17
,
17
,
17
,
0
.7
);
background
:
rgba
(
17
,
17
,
17
,
0
.7
);
text-align
:
justify
;
text-align
:
justify
;
border-radius
:
5px
;
border-radius
:
5px
;
...
@@ -25,7 +23,6 @@
...
@@ -25,7 +23,6 @@
justify-content
:
center
;
justify-content
:
center
;
align-items
:
center
;
align-items
:
center
;
.weui-toast__content
{
.weui-toast__content
{
padding
:
0
0
15px
;
width
:
100%
;
width
:
100%
;
word-break
:
break-all
;
word-break
:
break-all
;
text-align
:
justify
;
text-align
:
justify
;
...
...
src/app/my/my-business-detail/my-business-detail.component.html
View file @
1504a8dc
<div
class=
"wrapper"
>
<div
class=
"wrapper"
>
<ul
class=
"tab"
>
<ul
class=
"tab"
>
<li
*
ngFor=
"let titleItem of titleList"
(
click
)="
selectTab
(
titleItem
.
id
)"
<li
*
ngFor=
"let titleItem of titleList"
(
click
)="
selectTab
(
titleItem
.
id
)"
[
ngClass
]="{
selected:selectedId=
==titleItem.id}"
>
[
ngClass
]="{
selected:selectedId=
==titleItem.id}"
>
<div
style=
"position: relative;"
>
<div
style=
"position: relative;"
>
<h3>
{{titleItem.name}}
<h3>
{{titleItem.name}}
</h3>
</h3>
...
@@ -15,59 +15,60 @@
...
@@ -15,59 +15,60 @@
<div
class=
"contentItem"
>
<div
class=
"contentItem"
>
<span>
姓名
</span>
<span>
姓名
</span>
<input
class=
"form-control"
type=
"text"
placeholder=
"姓名"
[(
ngModel
)]="
editBusiness
.
name
"
<input
class=
"form-control"
type=
"text"
placeholder=
"姓名"
[(
ngModel
)]="
editBusiness
.
name
"
[
disabled
]="
readonlyFlag
"
/>
[
disabled
]="
readonlyFlag
"
/>
</div>
</div>
<div
class=
"contentItem"
>
<div
class=
"contentItem"
>
<span>
年龄
</span>
<span>
年龄
</span>
<input
class=
"form-control"
type=
"text"
placeholder=
"年龄"
[(
ngModel
)]="
editBusiness
.
age
"
<input
class=
"form-control"
type=
"text"
placeholder=
"年龄"
[(
ngModel
)]="
editBusiness
.
age
"
[
disabled
]="
readonlyFlag
"
/>
[
disabled
]="
readonlyFlag
"
/>
</div>
</div>
<div
class=
"contentItem"
>
<div
class=
"contentItem"
>
<span>
性别
</span>
<span>
性别
</span>
<div
class=
"sexWrapper"
>
<div
class=
"sexWrapper"
>
<button
class=
"form-control sex"
[
ngClass
]="{'
sexBtn
'
:editBusiness
?.
gender=
='1'}"
<button
class=
"form-control sex"
[
ngClass
]="{'
sexBtn
'
:editBusiness
?.
gender=
='1'}"
(
click
)="
selectedGender
('
1
')"
[
disabled
]="
readonlyFlag
"
>
男
(
click
)="
selectedGender
('
1
')"
[
disabled
]="
readonlyFlag
"
>
男
</button>
</button>
<button
class=
"form-control sex"
[
ngClass
]="{'
sexBtn
'
:editBusiness
?.
gender=
='2'}"
<button
class=
"form-control sex"
[
ngClass
]="{'
sexBtn
'
:editBusiness
?.
gender=
='2'}"
(
click
)="
selectedGender
('
2
')"
[
disabled
]="
readonlyFlag
"
>
女
</button>
(
click
)="
selectedGender
('
2
')"
[
disabled
]="
readonlyFlag
"
>
女
</button>
</div>
</div>
</div>
</div>
<div
class=
"contentItem"
>
<div
class=
"contentItem"
>
<span>
手机
</span>
<span>
手机
</span>
<input
class=
"form-control"
type=
"text"
placeholder=
"手机"
[(
ngModel
)]="
editBusiness
.
mobileNo
"
disabled
/>
<input
class=
"form-control"
type=
"text"
placeholder=
"手机"
[(
ngModel
)]="
editBusiness
.
mobileNo
"
disabled
/>
</div>
</div>
<div
class=
"contentItem"
>
<div
class=
"contentItem"
>
<span>
微信
</span>
<span>
微信
</span>
<input
class=
"form-control"
type=
"text"
placeholder=
"微信"
[(
ngModel
)]="
editBusiness
.
weChat
"
<input
class=
"form-control"
type=
"text"
placeholder=
"微信"
[(
ngModel
)]="
editBusiness
.
weChat
"
[
disabled
]="
readonlyFlag
"
/>
[
disabled
]="
readonlyFlag
"
/>
</div>
</div>
<div
class=
"contentItem"
>
<div
class=
"contentItem"
>
<span>
其他联系
</span>
<span>
其他联系
</span>
<input
class=
"form-control"
type=
"text"
placeholder=
"其他联系"
[(
ngModel
)]="
editBusiness
.
otherContacts
"
<input
class=
"form-control"
type=
"text"
placeholder=
"其他联系"
[(
ngModel
)]="
editBusiness
.
otherContacts
"
[
disabled
]="
readonlyFlag
"
/>
[
disabled
]="
readonlyFlag
"
/>
</div>
</div>
<div
class=
"contentItem"
>
<div
class=
"contentItem"
>
<span>
商机来源
</span>
<span>
商机来源
</span>
<input
class=
"form-control"
type=
"text"
placeholder=
"商机来源"
[(
ngModel
)]="
editBusiness
.
sourceChannel
"
<input
class=
"form-control"
type=
"text"
placeholder=
"商机来源"
[(
ngModel
)]="
editBusiness
.
sourceChannel
"
[
disabled
]="
readonlyFlag
"
/>
[
disabled
]="
readonlyFlag
"
/>
</div>
</div>
<div
class=
"contentItem"
>
<div
class=
"contentItem"
>
<span>
城市
</span>
<span>
城市
</span>
<input
class=
"form-control"
type=
"text"
placeholder=
"城市"
[(
ngModel
)]="
editBusiness
.
address
"
<input
class=
"form-control"
type=
"text"
placeholder=
"城市"
[(
ngModel
)]="
editBusiness
.
address
"
[
disabled
]="
readonlyFlag
"
/>
[
disabled
]="
readonlyFlag
"
/>
</div>
</div>
<div
class=
"contentItem"
>
<div
class=
"contentItem"
>
<span>
商机时间
</span>
<span>
商机时间
</span>
<input
class=
"form-control"
type=
"text"
placeholder=
"商机时间"
[(
ngModel
)]="
editBusiness
.
opportunityDate
"
<input
class=
"form-control"
id=
"time"
type=
"text"
placeholder=
"商机时间"
[(
ngModel
)]="
editBusiness
.
opportunityDate
"
disabled
/>
disabled
/>
</div>
</div>
<div
class=
"contentItem"
>
<div
class=
"contentItem"
>
<span>
商机状态
</span>
<span>
商机状态
</span>
<div>
{{lifeCommonService.checkStr(editBusiness.mdDropOptionId)}}
</div>
<div>
{{lifeCommonService.checkStr(editBusiness.mdDropOptionId)}}
</div>
</div>
</div>
<!-- <div class="contentItem">
<!-- <div class="contentItem">
<span>标签</span>
<span>标签</span>
...
@@ -78,7 +79,7 @@
...
@@ -78,7 +79,7 @@
<div
class=
"tagWrapper"
>
<div
class=
"tagWrapper"
>
<div
style=
"width: 100%;"
>
标签
</div>
<div
style=
"width: 100%;"
>
标签
</div>
<div
class=
"tagContent"
*
ngFor=
"let tagItem of tagList"
(
click
)="
selectTag
(
tagItem
)"
<div
class=
"tagContent"
*
ngFor=
"let tagItem of tagList"
(
click
)="
selectTag
(
tagItem
)"
[
ngClass
]="{
selected:tagItem
.
selected
}"
>
[
ngClass
]="{
selected:tagItem
.
selected
}"
>
{{tagItem.tagName}}
{{tagItem.tagName}}
</div>
</div>
</div>
</div>
...
@@ -91,7 +92,7 @@
...
@@ -91,7 +92,7 @@
</div>
</div>
</div>
</div>
<div
class=
"content"
*
ngIf=
"selected===4"
>
<div
class=
"content"
*
ngIf=
"selected===4"
>
<div>
暂无方案
</div>
<div
*
ngIf=
"isCompletedQuestionnaire!=1"
>
暂无方案
</div>
</div>
</div>
<div
class=
"content"
*
ngIf=
"selectedId===3"
>
<div
class=
"content"
*
ngIf=
"selectedId===3"
>
<!--编辑框-->
<!--编辑框-->
...
@@ -101,7 +102,9 @@
...
@@ -101,7 +102,9 @@
<div>
<div>
<select
name=
"businessStatus"
id=
"businessStatus"
class=
"form-control"
[(
ngModel
)]="
opportunityRecordId
"
>
<select
name=
"businessStatus"
id=
"businessStatus"
class=
"form-control"
[(
ngModel
)]="
opportunityRecordId
"
>
<option
value=
"null"
>
请选择
</option>
<option
value=
"null"
>
请选择
</option>
<option
*
ngFor=
"let businessStatusItem of businessStatusList"
value=
"{{businessStatusItem.id}}"
>
{{businessStatusItem.dropOptionName}}
</option>
<option
*
ngFor=
"let businessStatusItem of businessStatusList"
value=
"{{businessStatusItem.id}}"
>
{{businessStatusItem.dropOptionName}}
</option>
</select>
</select>
</div>
</div>
</div>
</div>
...
@@ -124,6 +127,7 @@
...
@@ -124,6 +127,7 @@
<div
class=
"updatedAt"
>
{{opportunityRecordItem.noticeDate}}
</div>
<div
class=
"updatedAt"
>
{{opportunityRecordItem.noticeDate}}
</div>
</li>
</li>
</ul>
</ul>
<div
class=
"add"
>
+
</div>
</div>
</div>
</div>
</div>
<ydlife-toast
*
ngIf=
"toastDialog"
[
toastInfo
]="
toastInfo
"
></ydlife-toast>
<ydlife-toast
*
ngIf=
"toastDialog"
[
toastInfo
]="
toastInfo
"
></ydlife-toast>
src/app/my/my-business-detail/my-business-detail.component.ts
View file @
1504a8dc
...
@@ -8,7 +8,9 @@ import {LifeCommonService} from '../../common/life-common.service';
...
@@ -8,7 +8,9 @@ import {LifeCommonService} from '../../common/life-common.service';
templateUrl
:
'./my-business-detail.component.html'
,
templateUrl
:
'./my-business-detail.component.html'
,
styleUrls
:
[
'./my-business-detail.component.scss'
]
styleUrls
:
[
'./my-business-detail.component.scss'
]
})
})
export
class
MyBusinessDetailComponent
implements
OnInit
{
export
class
MyBusinessDetailComponent
implements
OnInit
{
titleList
:
Array
<
any
>
;
titleList
:
Array
<
any
>
;
selectedId
:
number
;
selectedId
:
number
;
surveyAnswersList
:
Array
<
any
>
;
surveyAnswersList
:
Array
<
any
>
;
...
@@ -58,6 +60,8 @@ export class MyBusinessDetailComponent implements OnInit {
...
@@ -58,6 +60,8 @@ export class MyBusinessDetailComponent implements OnInit {
this
.
ownOpportunityDetailQuery
();
this
.
ownOpportunityDetailQuery
();
this
.
dropOptionsQuery
();
this
.
dropOptionsQuery
();
}
}
editInfo
()
{
editInfo
()
{
...
@@ -167,7 +171,7 @@ export class MyBusinessDetailComponent implements OnInit {
...
@@ -167,7 +171,7 @@ export class MyBusinessDetailComponent implements OnInit {
this
.
toastInfo
=
{
this
.
toastInfo
=
{
status
:
1
,
status
:
1
,
msg
:
'修改成功!'
,
msg
:
'修改成功!'
,
timeout
:
3000
00
,
timeout
:
3000
,
align
:
'center'
align
:
'center'
};
};
}
}
...
@@ -219,3 +223,5 @@ export class MyBusinessDetailComponent implements OnInit {
...
@@ -219,3 +223,5 @@ export class MyBusinessDetailComponent implements OnInit {
})
})
}
}
}
}
src/app/my/my.module.ts
View file @
1504a8dc
...
@@ -14,12 +14,14 @@ import { MyBusinessComponent } from './my-business/my-business.component';
...
@@ -14,12 +14,14 @@ import { MyBusinessComponent } from './my-business/my-business.component';
import
{
MyBusinessDetailComponent
}
from
'./my-business-detail/my-business-detail.component'
;
import
{
MyBusinessDetailComponent
}
from
'./my-business-detail/my-business-detail.component'
;
import
{
PickerComponent
}
from
'../common/picker/picker.component'
;
import
{
PickerComponent
}
from
'../common/picker/picker.component'
;
import
{
ToastComponent
}
from
'../common/toast/toast.component'
;
import
{
ToastComponent
}
from
'../common/toast/toast.component'
;
@
NgModule
({
@
NgModule
({
declarations
:
[
MyCenterHomeComponent
,
MkMaterialComponent
,
MkMaterialDetailComponent
,
FileUploadComponent
,
ImportantAnnouncementComponent
,
SalesDetailComponent
,
AnnouncementDetailComponent
,
MyBusinessComponent
,
MyBusinessDetailComponent
,
PickerComponent
,
ToastComponent
],
declarations
:
[
MyCenterHomeComponent
,
MkMaterialComponent
,
MkMaterialDetailComponent
,
FileUploadComponent
,
ImportantAnnouncementComponent
,
SalesDetailComponent
,
AnnouncementDetailComponent
,
MyBusinessComponent
,
MyBusinessDetailComponent
,
PickerComponent
,
ToastComponent
],
imports
:
[
imports
:
[
CommonModule
,
CommonModule
,
LifeCommonModule
,
LifeCommonModule
,
MyRoutingModule
MyRoutingModule
,
],
],
providers
:
[
providers
:
[
DatePipe
DatePipe
...
...
src/app/my/sales-detail/sales-detail.component.ts
View file @
1504a8dc
...
@@ -48,7 +48,7 @@ export class SalesDetailComponent implements OnInit {
...
@@ -48,7 +48,7 @@ export class SalesDetailComponent implements OnInit {
jumpToOrderdetail
(
orderNo
)
{
jumpToOrderdetail
(
orderNo
)
{
const
customerId
=
JSON
.
parse
(
localStorage
.
getItem
(
'lifeCustomerInfo'
)).
customerId
;
const
customerId
=
JSON
.
parse
(
localStorage
.
getItem
(
'lifeCustomerInfo'
)).
customerId
;
window
.
location
.
href
=
`https://
${
window
.
location
.
host
}
/mine/orderdetail/
${
orderNo
}
?customerId=
${
customerId
}
&isReferral=true`
;
window
.
location
.
href
=
`https://
${
window
.
location
.
host
}
/mine/orderdetail/
${
orderNo
}
?customerId=
${
customerId
}
&isReferral=true
&paid=true
`
;
// https://mdev.zuihuibi.cn/mine/orderdetail/CP338119110911044108?customerId=41&isReferral=true&paid=true&whichNumber=0&policyHolderType=2
// https://mdev.zuihuibi.cn/mine/orderdetail/CP338119110911044108?customerId=41&isReferral=true&paid=true&whichNumber=0&policyHolderType=2
}
}
}
}
src/assets/LCalendar/LCalendar.css
0 → 100644
View file @
1504a8dc
.gearDate
{
font-family
:
Helvetica
Neue
,
Helvetica
,
Arial
,
sans-serif
;
font-size
:
10px
;
background-color
:
rgba
(
0
,
0
,
0
,
.2
);
display
:
block
;
position
:
fixed
;
top
:
0
;
left
:
0
;
width
:
100%
;
height
:
100%
;
z-index
:
9900
;
overflow
:
hidden
;
-webkit-animation-fill-mode
:
both
;
animation-fill-mode
:
both
}
.date_ctrl
{
vertical-align
:
middle
;
background-color
:
#d5d8df
;
color
:
#000
;
margin
:
0
;
height
:
auto
;
width
:
100%
;
position
:
absolute
;
left
:
0
;
bottom
:
0
;
z-index
:
9901
;
overflow
:
hidden
;
-webkit-transform
:
translate3d
(
0
,
0
,
0
);
transform
:
translate3d
(
0
,
0
,
0
)}
.slideInUp
{
-webkit-animation
:
slideInUp
.3s
;
animation
:
slideInUp
.3s
}
@-webkit-keyframes
slideInUp
{
from
{
-webkit-transform
:
translate3d
(
0
,
100%
,
0
);
transform
:
translate3d
(
0
,
100%
,
0
)}
to
{
-webkit-transform
:
translate3d
(
0
,
0
,
0
);
transform
:
translate3d
(
0
,
0
,
0
)}}
@keyframes
slideInUp
{
from
{
-webkit-transform
:
translate3d
(
0
,
100%
,
0
);
transform
:
translate3d
(
0
,
100%
,
0
)}
to
{
-webkit-transform
:
translate3d
(
0
,
0
,
0
);
transform
:
translate3d
(
0
,
0
,
0
)}}
.ym_roll
,
.date_roll
,
.datetime_roll
,
.time_roll
{
display
:
-webkit-box
;
display
:
-webkit-flex
;
display
:
-ms-flexbox
;
display
:
flex
;
width
:
100%
;
height
:
auto
;
overflow
:
hidden
;
background-color
:
transparent
;
-webkit-mask
:
-webkit-gradient
(
linear
,
0%
50%
,
0%
100%
,
from
(
#debb47
),
to
(
rgba
(
36
,
142
,
36
,
0
)));
-webkit-mask
:
-webkit-linear-gradient
(
top
,
#debb47
50%
,
rgba
(
36
,
142
,
36
,
0
))}
.ym_roll
>
div
,
.date_roll
>
div
,
.datetime_roll
>
div
,
.time_roll
>
div
{
font-size
:
2.3em
;
height
:
10em
;
float
:
left
;
background-color
:
transparent
;
position
:
relative
;
overflow
:
hidden
;
-webkit-box-flex
:
4
;
-webkit-flex
:
4
;
-ms-flex
:
4
;
flex
:
4
}
.ym_roll
>
div
.gear
,
.date_roll
>
div
.gear
,
.datetime_roll
>
div
.gear
,
.time_roll
>
div
.gear
{
width
:
100%
;
float
:
left
;
position
:
absolute
;
z-index
:
9902
;
margin-top
:
-4em
}
.date_roll_mask
{
-webkit-mask
:
-webkit-gradient
(
linear
,
0%
40%
,
0%
0%
,
from
(
#debb47
),
to
(
rgba
(
36
,
142
,
36
,
0
)));
-webkit-mask
:
-webkit-linear-gradient
(
bottom
,
#debb47
50%
,
rgba
(
36
,
142
,
36
,
0
));
padding
:
0
}
.date_roll
>
div
:nth-child
(
2
)
{
-webkit-box-flex
:
2
;
-webkit-flex
:
2
;
-ms-flex
:
2
;
flex
:
2
}
.date_roll
>
div
:nth-child
(
1
),
.datetime_roll
>
div
:nth-child
(
1
)
{
-webkit-box-flex
:
4
;
-webkit-flex
:
4
;
-ms-flex
:
4
;
flex
:
4
}
.datetime_roll
>
div
:first-child
{
-webkit-box-flex
:
6
;
-webkit-flex
:
6
;
-ms-flex
:
6
;
flex
:
6
}
.datetime_roll
>
div
:last-child
{
-webkit-box-flex
:
6
;
-webkit-flex
:
6
;
-ms-flex
:
6
;
flex
:
6
}
.date_grid
{
position
:
relative
;
top
:
4em
;
width
:
100%
;
height
:
2em
;
margin
:
0
;
box-sizing
:
border-box
;
z-index
:
0
;
border-top
:
1px
solid
#abaeb5
;
border-bottom
:
1px
solid
#abaeb5
}
.date_grid
>
div
{
color
:
#000
;
position
:
absolute
;
right
:
0
;
top
:
0
;
font-size
:
.8em
;
line-height
:
2.5em
}
.date_roll
>
div
:nth-child
(
3
)
.date_grid
>
div
{
left
:
42%
}
.datetime_roll
>
div
.date_grid
>
div
{
right
:
0
}
.datetime_roll
>
div
:first-child
.date_grid
>
div
{
left
:
auto
;
right
:
0%
}
.datetime_roll
>
div
:last-child
.date_grid
>
div
{
left
:
50%
}
.time_roll
>
div
:nth-child
(
1
)
.date_grid
>
div
{
right
:
1em
}
.ym_roll
>
div
:nth-child
(
1
)
.date_grid
>
div
{
right
:
.1em
}
.ym_roll
>
div
.date_grid
>
div
,
.time_roll
>
div
.date_grid
>
div
{
right
:
5em
}
.date_btn
{
color
:
#0575f2
;
font-size
:
1.6em
;
line-height
:
1em
;
text-align
:
center
;
padding
:
.8em
1em
}
.date_btn_box
:before
,
.date_btn_box
:after
{
content
:
''
;
position
:
absolute
;
height
:
1px
;
width
:
100%
;
display
:
block
;
background-color
:
#96979b
;
z-index
:
15
;
-webkit-transform
:
scaleY
(
.33
);
transform
:
scaleY
(
.33
)}
.date_btn_box
{
display
:
-webkit-box
;
display
:
-webkit-flex
;
display
:
-ms-flexbox
;
display
:
flex
;
-webkit-box-pack
:
justify
;
-webkit-justify-content
:
space-between
;
-ms-flex-pack
:
justify
;
justify-content
:
space-between
;
-webkit-box-align
:
stretch
;
-webkit-align-items
:
stretch
;
-ms-flex-align
:
stretch
;
align-items
:
stretch
;
background-color
:
#f1f2f4
;
position
:
relative
}
.date_btn_box
:before
{
left
:
0
;
top
:
0
;
-webkit-transform-origin
:
50%
20%
;
transform-origin
:
50%
20%
}
.date_btn_box
:after
{
left
:
0
;
bottom
:
0
;
-webkit-transform-origin
:
50%
70%
;
transform-origin
:
50%
70%
}
.date_roll
>
div
:nth-child
(
1
)
.gear
{
text-indent
:
20%
}
.date_roll
>
div
:nth-child
(
2
)
.gear
{
text-indent
:
-20%
}
.date_roll
>
div
:nth-child
(
3
)
.gear
{
text-indent
:
-55%
}
.datetime_roll
>
div
.gear
{
width
:
100%
;
text-indent
:
-25%
}
.datetime_roll
>
div
:first-child
.gear
{
text-indent
:
-10%
}
.datetime_roll
>
div
:last-child
.gear
{
text-indent
:
-50%
}
.ym_roll
>
div
.gear
,
.time_roll
>
div
.gear
{
width
:
100%
;
text-indent
:
-70%
}
.ym_roll
>
div
:nth-child
(
1
)
.gear
,
.time_roll
>
div
:nth-child
(
1
)
.gear
{
width
:
100%
;
text-indent
:
10%
}
.tooth
{
height
:
2em
;
line-height
:
2em
;
text-align
:
center
}
\ No newline at end of file
src/assets/LCalendar/LCalendar.js
0 → 100644
View file @
1504a8dc
/**
* Created by Sweet on 2020/3/11.
*/
window
.
LCalendar
=
(
function
(){
var
MobileCalendar
=
function
(){
this
.
gearDate
;
this
.
minY
=
1900
;
this
.
minM
=
1
;
this
.
minD
=
1
;
this
.
maxY
=
2099
;
this
.
maxM
=
12
;
this
.
maxD
=
31
;}
MobileCalendar
.
prototype
=
{
init
:
function
(
params
){
this
.
type
=
params
.
type
;
this
.
trigger
=
document
.
querySelector
(
params
.
trigger
);
if
(
this
.
trigger
.
getAttribute
(
"data-lcalendar"
)
!=
null
){
var
arr
=
this
.
trigger
.
getAttribute
(
"data-lcalendar"
).
split
(
','
);
var
minArr
=
arr
[
0
].
split
(
'-'
);
this
.
minY
=~~
minArr
[
0
];
this
.
minM
=~~
minArr
[
1
];
this
.
minD
=~~
minArr
[
2
];
var
maxArr
=
arr
[
1
].
split
(
'-'
);
this
.
maxY
=~~
maxArr
[
0
];
this
.
maxM
=~~
maxArr
[
1
];
this
.
maxD
=~~
maxArr
[
2
];}
if
(
params
.
minDate
){
var
minArr
=
params
.
minDate
.
split
(
'-'
);
this
.
minY
=~~
minArr
[
0
];
this
.
minM
=~~
minArr
[
1
];
this
.
minD
=~~
minArr
[
2
];}
if
(
params
.
maxDate
){
var
maxArr
=
params
.
maxDate
.
split
(
'-'
);
this
.
maxY
=~~
maxArr
[
0
];
this
.
maxM
=~~
maxArr
[
1
];
this
.
maxD
=~~
maxArr
[
2
];}
this
.
bindEvent
(
this
.
type
);},
bindEvent
:
function
(
type
){
var
_self
=
this
;
function
popupDate
(
e
){
_self
.
gearDate
=
document
.
createElement
(
"div"
);
_self
.
gearDate
.
className
=
"gearDate"
;
_self
.
gearDate
.
innerHTML
=
'<div class="date_ctrl slideInUp">'
+
'<div class="date_btn_box">'
+
'<div class="date_btn lcalendar_cancel">取消</div>'
+
'<div class="date_btn lcalendar_finish">确定</div>'
+
'</div>'
+
'<div class="date_roll_mask">'
+
'<div class="date_roll">'
+
'<div>'
+
'<div class="gear date_yy" data-datetype="date_yy"></div>'
+
'<div class="date_grid">'
+
'<div>年</div>'
+
'</div>'
+
'</div>'
+
'<div>'
+
'<div class="gear date_mm" data-datetype="date_mm"></div>'
+
'<div class="date_grid">'
+
'<div>月</div>'
+
'</div>'
+
'</div>'
+
'<div>'
+
'<div class="gear date_dd" data-datetype="date_dd"></div>'
+
'<div class="date_grid">'
+
'<div>日</div>'
+
'</div>'
+
'</div>'
+
'</div>'
+
'</div>'
+
'</div>'
;
document
.
body
.
appendChild
(
_self
.
gearDate
);
dateCtrlInit
();
var
lcalendar_cancel
=
_self
.
gearDate
.
querySelector
(
".lcalendar_cancel"
);
lcalendar_cancel
.
addEventListener
(
'touchstart'
,
closeMobileCalendar
);
var
lcalendar_finish
=
_self
.
gearDate
.
querySelector
(
".lcalendar_finish"
);
lcalendar_finish
.
addEventListener
(
'touchstart'
,
finishMobileDate
);
var
date_yy
=
_self
.
gearDate
.
querySelector
(
".date_yy"
);
var
date_mm
=
_self
.
gearDate
.
querySelector
(
".date_mm"
);
var
date_dd
=
_self
.
gearDate
.
querySelector
(
".date_dd"
);
date_yy
.
addEventListener
(
'touchstart'
,
gearTouchStart
);
date_mm
.
addEventListener
(
'touchstart'
,
gearTouchStart
);
date_dd
.
addEventListener
(
'touchstart'
,
gearTouchStart
);
date_yy
.
addEventListener
(
'touchmove'
,
gearTouchMove
);
date_mm
.
addEventListener
(
'touchmove'
,
gearTouchMove
);
date_dd
.
addEventListener
(
'touchmove'
,
gearTouchMove
);
date_yy
.
addEventListener
(
'touchend'
,
gearTouchEnd
);
date_mm
.
addEventListener
(
'touchend'
,
gearTouchEnd
);
date_dd
.
addEventListener
(
'touchend'
,
gearTouchEnd
);}
function
dateCtrlInit
(){
var
date
=
new
Date
();
var
dateArr
=
{
yy
:
date
.
getFullYear
(),
mm
:
date
.
getMonth
(),
dd
:
date
.
getDate
()
-
1
};
if
(
/^
\d{4}
-
\d{1,2}
-
\d{1,2}
$/
.
test
(
_self
.
trigger
.
value
)){
rs
=
_self
.
trigger
.
value
.
match
(
/
(
^|-
)\d{1,4}
/g
);
dateArr
.
yy
=
rs
[
0
]
-
_self
.
minY
;
dateArr
.
mm
=
rs
[
1
].
replace
(
/-/g
,
""
)
-
1
;
dateArr
.
dd
=
rs
[
2
].
replace
(
/-/g
,
""
)
-
1
;}
else
{
dateArr
.
yy
=
dateArr
.
yy
-
_self
.
minY
;}
_self
.
gearDate
.
querySelector
(
".date_yy"
).
setAttribute
(
"val"
,
dateArr
.
yy
);
_self
.
gearDate
.
querySelector
(
".date_mm"
).
setAttribute
(
"val"
,
dateArr
.
mm
);
_self
.
gearDate
.
querySelector
(
".date_dd"
).
setAttribute
(
"val"
,
dateArr
.
dd
);
setDateGearTooth
();}
function
popupYM
(
e
){
_self
.
gearDate
=
document
.
createElement
(
"div"
);
_self
.
gearDate
.
className
=
"gearDate"
;
_self
.
gearDate
.
innerHTML
=
'<div class="date_ctrl slideInUp">'
+
'<div class="date_btn_box">'
+
'<div class="date_btn lcalendar_cancel">取消</div>'
+
'<div class="date_btn lcalendar_finish">确定</div>'
+
'</div>'
+
'<div class="date_roll_mask">'
+
'<div class="ym_roll">'
+
'<div>'
+
'<div class="gear date_yy" data-datetype="date_yy"></div>'
+
'<div class="date_grid">'
+
'<div>年</div>'
+
'</div>'
+
'</div>'
+
'<div>'
+
'<div class="gear date_mm" data-datetype="date_mm"></div>'
+
'<div class="date_grid">'
+
'<div>月</div>'
+
'</div>'
+
'</div>'
+
'</div>'
+
'</div>'
+
'</div>'
;
document
.
body
.
appendChild
(
_self
.
gearDate
);
ymCtrlInit
();
var
lcalendar_cancel
=
_self
.
gearDate
.
querySelector
(
".lcalendar_cancel"
);
lcalendar_cancel
.
addEventListener
(
'touchstart'
,
closeMobileCalendar
);
var
lcalendar_finish
=
_self
.
gearDate
.
querySelector
(
".lcalendar_finish"
);
lcalendar_finish
.
addEventListener
(
'touchstart'
,
finishMobileYM
);
var
date_yy
=
_self
.
gearDate
.
querySelector
(
".date_yy"
);
var
date_mm
=
_self
.
gearDate
.
querySelector
(
".date_mm"
);
date_yy
.
addEventListener
(
'touchstart'
,
gearTouchStart
);
date_mm
.
addEventListener
(
'touchstart'
,
gearTouchStart
);
date_yy
.
addEventListener
(
'touchmove'
,
gearTouchMove
);
date_mm
.
addEventListener
(
'touchmove'
,
gearTouchMove
);
date_yy
.
addEventListener
(
'touchend'
,
gearTouchEnd
);
date_mm
.
addEventListener
(
'touchend'
,
gearTouchEnd
);}
function
ymCtrlInit
(){
var
date
=
new
Date
();
var
dateArr
=
{
yy
:
date
.
getFullYear
(),
mm
:
date
.
getMonth
()};
if
(
/^
\d{4}
-
\d{1,2}
$/
.
test
(
_self
.
trigger
.
value
)){
rs
=
_self
.
trigger
.
value
.
match
(
/
(
^|-
)\d{1,4}
/g
);
dateArr
.
yy
=
rs
[
0
]
-
_self
.
minY
;
dateArr
.
mm
=
rs
[
1
].
replace
(
/-/g
,
""
)
-
1
;}
else
{
dateArr
.
yy
=
dateArr
.
yy
-
_self
.
minY
;}
_self
.
gearDate
.
querySelector
(
".date_yy"
).
setAttribute
(
"val"
,
dateArr
.
yy
);
_self
.
gearDate
.
querySelector
(
".date_mm"
).
setAttribute
(
"val"
,
dateArr
.
mm
);
setDateGearTooth
();}
function
popupDateTime
(
e
){
_self
.
gearDate
=
document
.
createElement
(
"div"
);
_self
.
gearDate
.
className
=
"gearDatetime"
;
_self
.
gearDate
.
innerHTML
=
'<div class="date_ctrl slideInUp">'
+
'<div class="date_btn_box">'
+
'<div class="date_btn lcalendar_cancel">取消</div>'
+
'<div class="date_btn lcalendar_finish">确定</div>'
+
'</div>'
+
'<div class="date_roll_mask">'
+
'<div class="datetime_roll">'
+
'<div>'
+
'<div class="gear date_yy" data-datetype="date_yy"></div>'
+
'<div class="date_grid">'
+
'<div>年</div>'
+
'</div>'
+
'</div>'
+
'<div>'
+
'<div class="gear date_mm" data-datetype="date_mm"></div>'
+
'<div class="date_grid">'
+
'<div>月</div>'
+
'</div>'
+
'</div>'
+
'<div>'
+
'<div class="gear date_dd" data-datetype="date_dd"></div>'
+
'<div class="date_grid">'
+
'<div>日</div>'
+
'</div>'
+
'</div>'
+
'<div>'
+
'<div class="gear time_hh" data-datetype="time_hh"></div>'
+
'<div class="date_grid">'
+
'<div>时</div>'
+
'</div>'
+
'</div>'
+
'<div>'
+
'<div class="gear time_mm" data-datetype="time_mm"></div>'
+
'<div class="date_grid">'
+
'<div>分</div>'
+
'</div>'
+
'</div>'
+
'</div>'
+
'</div>'
+
'</div>'
;
document
.
body
.
appendChild
(
_self
.
gearDate
);
dateTimeCtrlInit
();
var
lcalendar_cancel
=
_self
.
gearDate
.
querySelector
(
".lcalendar_cancel"
);
lcalendar_cancel
.
addEventListener
(
'touchstart'
,
closeMobileCalendar
);
var
lcalendar_finish
=
_self
.
gearDate
.
querySelector
(
".lcalendar_finish"
);
lcalendar_finish
.
addEventListener
(
'touchstart'
,
finishMobileDateTime
);
var
date_yy
=
_self
.
gearDate
.
querySelector
(
".date_yy"
);
var
date_mm
=
_self
.
gearDate
.
querySelector
(
".date_mm"
);
var
date_dd
=
_self
.
gearDate
.
querySelector
(
".date_dd"
);
var
time_hh
=
_self
.
gearDate
.
querySelector
(
".time_hh"
);
var
time_mm
=
_self
.
gearDate
.
querySelector
(
".time_mm"
);
date_yy
.
addEventListener
(
'touchstart'
,
gearTouchStart
);
date_mm
.
addEventListener
(
'touchstart'
,
gearTouchStart
);
date_dd
.
addEventListener
(
'touchstart'
,
gearTouchStart
);
time_hh
.
addEventListener
(
'touchstart'
,
gearTouchStart
);
time_mm
.
addEventListener
(
'touchstart'
,
gearTouchStart
);
date_yy
.
addEventListener
(
'touchmove'
,
gearTouchMove
);
date_mm
.
addEventListener
(
'touchmove'
,
gearTouchMove
);
date_dd
.
addEventListener
(
'touchmove'
,
gearTouchMove
);
time_hh
.
addEventListener
(
'touchmove'
,
gearTouchMove
);
time_mm
.
addEventListener
(
'touchmove'
,
gearTouchMove
);
date_yy
.
addEventListener
(
'touchend'
,
gearTouchEnd
);
date_mm
.
addEventListener
(
'touchend'
,
gearTouchEnd
);
date_dd
.
addEventListener
(
'touchend'
,
gearTouchEnd
);
time_hh
.
addEventListener
(
'touchend'
,
gearTouchEnd
);
time_mm
.
addEventListener
(
'touchend'
,
gearTouchEnd
);}
function
dateTimeCtrlInit
(){
var
date
=
new
Date
();
var
dateArr
=
{
yy
:
date
.
getFullYear
(),
mm
:
date
.
getMonth
(),
dd
:
date
.
getDate
()
-
1
,
hh
:
date
.
getHours
(),
mi
:
date
.
getMinutes
()};
if
(
/^
\d{4}
-
\d{1,2}
-
\d{1,2}\s\d{2}
:
\d{2}
$/
.
test
(
_self
.
trigger
.
value
)){
rs
=
_self
.
trigger
.
value
.
match
(
/
(
^|-|
\s
|:
)\d{1,4}
/g
);
dateArr
.
yy
=
rs
[
0
]
-
_self
.
minY
;
dateArr
.
mm
=
rs
[
1
].
replace
(
/-/g
,
""
)
-
1
;
dateArr
.
dd
=
rs
[
2
].
replace
(
/-/g
,
""
)
-
1
;
dateArr
.
hh
=
parseInt
(
rs
[
3
].
replace
(
/
\s
0
?
/g
,
""
));
dateArr
.
mi
=
parseInt
(
rs
[
4
].
replace
(
/:0
?
/g
,
""
));}
else
{
dateArr
.
yy
=
dateArr
.
yy
-
_self
.
minY
;}
_self
.
gearDate
.
querySelector
(
".date_yy"
).
setAttribute
(
"val"
,
dateArr
.
yy
);
_self
.
gearDate
.
querySelector
(
".date_mm"
).
setAttribute
(
"val"
,
dateArr
.
mm
);
_self
.
gearDate
.
querySelector
(
".date_dd"
).
setAttribute
(
"val"
,
dateArr
.
dd
);
setDateGearTooth
();
_self
.
gearDate
.
querySelector
(
".time_hh"
).
setAttribute
(
"val"
,
dateArr
.
hh
);
_self
.
gearDate
.
querySelector
(
".time_mm"
).
setAttribute
(
"val"
,
dateArr
.
mi
);
setTimeGearTooth
();}
function
popupTime
(
e
){
_self
.
gearDate
=
document
.
createElement
(
"div"
);
_self
.
gearDate
.
className
=
"gearDate"
;
_self
.
gearDate
.
innerHTML
=
'<div class="date_ctrl slideInUp">'
+
'<div class="date_btn_box">'
+
'<div class="date_btn lcalendar_cancel">取消</div>'
+
'<div class="date_btn lcalendar_finish">确定</div>'
+
'</div>'
+
'<div class="date_roll_mask">'
+
'<div class="time_roll">'
+
'<div>'
+
'<div class="gear time_hh" data-datetype="time_hh"></div>'
+
'<div class="date_grid">'
+
'<div>时</div>'
+
'</div>'
+
'</div>'
+
'<div>'
+
'<div class="gear time_mm" data-datetype="time_mm"></div>'
+
'<div class="date_grid">'
+
'<div>分</div>'
+
'</div>'
+
'</div>'
+
'</div>'
+
'</div>'
+
'</div>'
;
document
.
body
.
appendChild
(
_self
.
gearDate
);
timeCtrlInit
();
var
lcalendar_cancel
=
_self
.
gearDate
.
querySelector
(
".lcalendar_cancel"
);
lcalendar_cancel
.
addEventListener
(
'touchstart'
,
closeMobileCalendar
);
var
lcalendar_finish
=
_self
.
gearDate
.
querySelector
(
".lcalendar_finish"
);
lcalendar_finish
.
addEventListener
(
'touchstart'
,
finishMobileTime
);
var
time_hh
=
_self
.
gearDate
.
querySelector
(
".time_hh"
);
var
time_mm
=
_self
.
gearDate
.
querySelector
(
".time_mm"
);
time_hh
.
addEventListener
(
'touchstart'
,
gearTouchStart
);
time_mm
.
addEventListener
(
'touchstart'
,
gearTouchStart
);
time_hh
.
addEventListener
(
'touchmove'
,
gearTouchMove
);
time_mm
.
addEventListener
(
'touchmove'
,
gearTouchMove
);
time_hh
.
addEventListener
(
'touchend'
,
gearTouchEnd
);
time_mm
.
addEventListener
(
'touchend'
,
gearTouchEnd
);}
function
timeCtrlInit
(){
var
d
=
new
Date
();
var
e
=
{
hh
:
d
.
getHours
(),
mm
:
d
.
getMinutes
()};
if
(
/^
\d{2}
:
\d{2}
$/
.
test
(
_self
.
trigger
.
value
)){
rs
=
_self
.
trigger
.
value
.
match
(
/
(
^|:
)\d{2}
/g
);
e
.
hh
=
parseInt
(
rs
[
0
].
replace
(
/^0
?
/g
,
""
));
e
.
mm
=
parseInt
(
rs
[
1
].
replace
(
/:0
?
/g
,
""
))}
_self
.
gearDate
.
querySelector
(
".time_hh"
).
setAttribute
(
"val"
,
e
.
hh
);
_self
.
gearDate
.
querySelector
(
".time_mm"
).
setAttribute
(
"val"
,
e
.
mm
);
setTimeGearTooth
();}
function
setDateGearTooth
(){
var
passY
=
_self
.
maxY
-
_self
.
minY
+
1
;
var
date_yy
=
_self
.
gearDate
.
querySelector
(
".date_yy"
);
var
itemStr
=
""
;
if
(
date_yy
&&
date_yy
.
getAttribute
(
"val"
)){
var
yyVal
=
parseInt
(
date_yy
.
getAttribute
(
"val"
));
for
(
var
p
=
0
;
p
<=
passY
-
1
;
p
++
){
itemStr
+=
"<div class='tooth'>"
+
(
_self
.
minY
+
p
)
+
"</div>"
;}
date_yy
.
innerHTML
=
itemStr
;
var
top
=
Math
.
floor
(
parseFloat
(
date_yy
.
getAttribute
(
'top'
)));
if
(
!
isNaN
(
top
)){
top
%
2
==
0
?(
top
=
top
):(
top
=
top
+
1
);
top
>
8
&&
(
top
=
8
);
var
minTop
=
8
-
(
passY
-
1
)
*
2
;
top
<
minTop
&&
(
top
=
minTop
);
date_yy
.
style
[
"-webkit-transform"
]
=
'translate3d(0,'
+
top
+
'em,0)'
;
date_yy
.
setAttribute
(
'top'
,
top
+
'em'
);
yyVal
=
Math
.
abs
(
top
-
8
)
/
2
;
date_yy
.
setAttribute
(
"val"
,
yyVal
);}
else
{
date_yy
.
style
[
"-webkit-transform"
]
=
'translate3d(0,'
+
(
8
-
yyVal
*
2
)
+
'em,0)'
;
date_yy
.
setAttribute
(
'top'
,
8
-
yyVal
*
2
+
'em'
);}}
else
{
return
;}
var
date_mm
=
_self
.
gearDate
.
querySelector
(
".date_mm"
);
if
(
date_mm
&&
date_mm
.
getAttribute
(
"val"
)){
itemStr
=
""
;
var
mmVal
=
parseInt
(
date_mm
.
getAttribute
(
"val"
));
var
maxM
=
11
;
var
minM
=
0
;
if
(
yyVal
==
passY
-
1
){
maxM
=
_self
.
maxM
-
1
;}
if
(
yyVal
==
0
){
minM
=
_self
.
minM
-
1
;}
for
(
var
p
=
0
;
p
<
maxM
-
minM
+
1
;
p
++
){
itemStr
+=
"<div class='tooth'>"
+
(
minM
+
p
+
1
)
+
"</div>"
;}
date_mm
.
innerHTML
=
itemStr
;
if
(
mmVal
>
maxM
){
mmVal
=
maxM
;
date_mm
.
setAttribute
(
"val"
,
mmVal
);}
else
if
(
mmVal
<
minM
){
mmVal
=
maxM
;
date_mm
.
setAttribute
(
"val"
,
mmVal
);}
date_mm
.
style
[
"-webkit-transform"
]
=
'translate3d(0,'
+
(
8
-
(
mmVal
-
minM
)
*
2
)
+
'em,0)'
;
date_mm
.
setAttribute
(
'top'
,
8
-
(
mmVal
-
minM
)
*
2
+
'em'
);}
else
{
return
;}
var
date_dd
=
_self
.
gearDate
.
querySelector
(
".date_dd"
);
if
(
date_dd
&&
date_dd
.
getAttribute
(
"val"
)){
itemStr
=
""
;
var
ddVal
=
parseInt
(
date_dd
.
getAttribute
(
"val"
));
var
maxMonthDays
=
calcDays
(
yyVal
,
mmVal
);
var
maxD
=
maxMonthDays
-
1
;
var
minD
=
0
;
if
(
yyVal
==
passY
-
1
&&
_self
.
maxM
==
mmVal
+
1
){
maxD
=
_self
.
maxD
-
1
;}
if
(
yyVal
==
0
&&
_self
.
minM
==
mmVal
+
1
){
minD
=
_self
.
minD
-
1
;}
for
(
var
p
=
0
;
p
<
maxD
-
minD
+
1
;
p
++
){
itemStr
+=
"<div class='tooth'>"
+
(
minD
+
p
+
1
)
+
"</div>"
;}
date_dd
.
innerHTML
=
itemStr
;
if
(
ddVal
>
maxD
){
ddVal
=
maxD
;
date_dd
.
setAttribute
(
"val"
,
ddVal
);}
else
if
(
ddVal
<
minD
){
ddVal
=
minD
;
date_dd
.
setAttribute
(
"val"
,
ddVal
);}
date_dd
.
style
[
"-webkit-transform"
]
=
'translate3d(0,'
+
(
8
-
(
ddVal
-
minD
)
*
2
)
+
'em,0)'
;
date_dd
.
setAttribute
(
'top'
,
8
-
(
ddVal
-
minD
)
*
2
+
'em'
);}
else
{
return
;}}
function
setTimeGearTooth
(){
var
time_hh
=
_self
.
gearDate
.
querySelector
(
".time_hh"
);
if
(
time_hh
&&
time_hh
.
getAttribute
(
"val"
)){
var
i
=
""
;
var
hhVal
=
parseInt
(
time_hh
.
getAttribute
(
"val"
));
for
(
var
g
=
0
;
g
<=
23
;
g
++
){
i
+=
"<div class='tooth'>"
+
g
+
"</div>"
;}
time_hh
.
innerHTML
=
i
;
time_hh
.
style
[
"-webkit-transform"
]
=
'translate3d(0,'
+
(
8
-
hhVal
*
2
)
+
'em,0)'
;
time_hh
.
setAttribute
(
'top'
,
8
-
hhVal
*
2
+
'em'
);}
else
{
return
}
var
time_mm
=
_self
.
gearDate
.
querySelector
(
".time_mm"
);
if
(
time_mm
&&
time_mm
.
getAttribute
(
"val"
)){
var
i
=
""
;
var
mmVal
=
parseInt
(
time_mm
.
getAttribute
(
"val"
));
for
(
var
g
=
0
;
g
<=
59
;
g
++
){
i
+=
"<div class='tooth'>"
+
g
+
"</div>"
;}
time_mm
.
innerHTML
=
i
;
time_mm
.
style
[
"-webkit-transform"
]
=
'translate3d(0,'
+
(
8
-
mmVal
*
2
)
+
'em,0)'
;
time_mm
.
setAttribute
(
'top'
,
8
-
mmVal
*
2
+
'em'
);}
else
{
return
}}
function
calcDays
(
year
,
month
){
if
(
month
==
1
){
year
+=
_self
.
minY
;
if
((
year
%
4
==
0
&&
year
%
100
!=
0
)
||
(
year
%
400
==
0
&&
year
%
4000
!=
0
)){
return
29
;}
else
{
return
28
;}}
else
{
if
(
month
==
3
||
month
==
5
||
month
==
8
||
month
==
10
){
return
30
;}
else
{
return
31
;}}}
function
gearTouchStart
(
e
){
e
.
preventDefault
();
var
target
=
e
.
target
;
while
(
true
){
if
(
!
target
.
classList
.
contains
(
"gear"
)){
target
=
target
.
parentElement
;}
else
{
break
}}
clearInterval
(
target
[
"int_"
+
target
.
id
]);
target
[
"old_"
+
target
.
id
]
=
e
.
targetTouches
[
0
].
screenY
;
target
[
"o_t_"
+
target
.
id
]
=
(
new
Date
()).
getTime
();
var
top
=
target
.
getAttribute
(
'top'
);
if
(
top
){
target
[
"o_d_"
+
target
.
id
]
=
parseFloat
(
top
.
replace
(
/em/g
,
""
));}
else
{
target
[
"o_d_"
+
target
.
id
]
=
0
;}
target
.
style
.
webkitTransitionDuration
=
target
.
style
.
transitionDuration
=
'0ms'
;}
function
gearTouchMove
(
e
){
e
.
preventDefault
();
var
target
=
e
.
target
;
while
(
true
){
if
(
!
target
.
classList
.
contains
(
"gear"
)){
target
=
target
.
parentElement
;}
else
{
break
}}
target
[
"new_"
+
target
.
id
]
=
e
.
targetTouches
[
0
].
screenY
;
target
[
"n_t_"
+
target
.
id
]
=
(
new
Date
()).
getTime
();
var
f
=
(
target
[
"new_"
+
target
.
id
]
-
target
[
"old_"
+
target
.
id
])
*
30
/
window
.
innerHeight
;
target
[
"pos_"
+
target
.
id
]
=
target
[
"o_d_"
+
target
.
id
]
+
f
;
target
.
style
[
"-webkit-transform"
]
=
'translate3d(0,'
+
target
[
"pos_"
+
target
.
id
]
+
'em,0)'
;
target
.
setAttribute
(
'top'
,
target
[
"pos_"
+
target
.
id
]
+
'em'
);
if
(
e
.
targetTouches
[
0
].
screenY
<
1
){
gearTouchEnd
(
e
);};}
function
gearTouchEnd
(
e
){
e
.
preventDefault
();
var
target
=
e
.
target
;
while
(
true
){
if
(
!
target
.
classList
.
contains
(
"gear"
)){
target
=
target
.
parentElement
;}
else
{
break
;}}
var
flag
=
(
target
[
"new_"
+
target
.
id
]
-
target
[
"old_"
+
target
.
id
])
/
(
target
[
"n_t_"
+
target
.
id
]
-
target
[
"o_t_"
+
target
.
id
]);
if
(
Math
.
abs
(
flag
)
<=
0.2
){
target
[
"spd_"
+
target
.
id
]
=
(
flag
<
0
?
-
0.08
:
0.08
);}
else
{
if
(
Math
.
abs
(
flag
)
<=
0.5
){
target
[
"spd_"
+
target
.
id
]
=
(
flag
<
0
?
-
0.16
:
0.16
);}
else
{
target
[
"spd_"
+
target
.
id
]
=
flag
/
2
;}}
if
(
!
target
[
"pos_"
+
target
.
id
]){
target
[
"pos_"
+
target
.
id
]
=
0
;}
rollGear
(
target
);}
function
rollGear
(
target
){
var
d
=
0
;
var
stopGear
=
false
;
function
setDuration
(){
target
.
style
.
webkitTransitionDuration
=
target
.
style
.
transitionDuration
=
'200ms'
;
stopGear
=
true
;}
var
passY
=
_self
.
maxY
-
_self
.
minY
+
1
;
clearInterval
(
target
[
"int_"
+
target
.
id
]);
target
[
"int_"
+
target
.
id
]
=
setInterval
(
function
(){
var
pos
=
target
[
"pos_"
+
target
.
id
];
var
speed
=
target
[
"spd_"
+
target
.
id
]
*
Math
.
exp
(
-
0.03
*
d
);
pos
+=
speed
;
if
(
Math
.
abs
(
speed
)
>
0.1
){}
else
{
var
b
=
Math
.
round
(
pos
/
2
)
*
2
;
pos
=
b
;
setDuration
();}
if
(
pos
>
8
){
pos
=
8
;
setDuration
();}
switch
(
target
.
dataset
.
datetype
){
case
"date_yy"
:
var
minTop
=
8
-
(
passY
-
1
)
*
2
;
if
(
pos
<
minTop
){
pos
=
minTop
;
setDuration
();}
if
(
stopGear
){
var
gearVal
=
Math
.
abs
(
pos
-
8
)
/
2
;
setGear
(
target
,
gearVal
);
clearInterval
(
target
[
"int_"
+
target
.
id
]);}
break
;
case
"date_mm"
:
var
date_yy
=
_self
.
gearDate
.
querySelector
(
".date_yy"
);
var
yyVal
=
parseInt
(
date_yy
.
getAttribute
(
"val"
));
var
maxM
=
11
;
var
minM
=
0
;
if
(
yyVal
==
passY
-
1
){
maxM
=
_self
.
maxM
-
1
;}
if
(
yyVal
==
0
){
minM
=
_self
.
minM
-
1
;}
var
minTop
=
8
-
(
maxM
-
minM
)
*
2
;
if
(
pos
<
minTop
){
pos
=
minTop
;
setDuration
();}
if
(
stopGear
){
var
gearVal
=
Math
.
abs
(
pos
-
8
)
/
2
+
minM
;
setGear
(
target
,
gearVal
);
clearInterval
(
target
[
"int_"
+
target
.
id
]);}
break
;
case
"date_dd"
:
var
date_yy
=
_self
.
gearDate
.
querySelector
(
".date_yy"
);
var
date_mm
=
_self
.
gearDate
.
querySelector
(
".date_mm"
);
var
yyVal
=
parseInt
(
date_yy
.
getAttribute
(
"val"
));
var
mmVal
=
parseInt
(
date_mm
.
getAttribute
(
"val"
));
var
maxMonthDays
=
calcDays
(
yyVal
,
mmVal
);
var
maxD
=
maxMonthDays
-
1
;
var
minD
=
0
;
if
(
yyVal
==
passY
-
1
&&
_self
.
maxM
==
mmVal
+
1
){
maxD
=
_self
.
maxD
-
1
;}
if
(
yyVal
==
0
&&
_self
.
minM
==
mmVal
+
1
){
minD
=
_self
.
minD
-
1
;}
var
minTop
=
8
-
(
maxD
-
minD
)
*
2
;
if
(
pos
<
minTop
){
pos
=
minTop
;
setDuration
();}
if
(
stopGear
){
var
gearVal
=
Math
.
abs
(
pos
-
8
)
/
2
+
minD
;
setGear
(
target
,
gearVal
);
clearInterval
(
target
[
"int_"
+
target
.
id
]);}
break
;
case
"time_hh"
:
if
(
pos
<-
38
){
pos
=-
38
;
setDuration
();}
if
(
stopGear
){
var
gearVal
=
Math
.
abs
(
pos
-
8
)
/
2
;
setGear
(
target
,
gearVal
);
clearInterval
(
target
[
"int_"
+
target
.
id
]);}
break
;
case
"time_mm"
:
if
(
pos
<-
110
){
pos
=-
110
;
setDuration
();}
if
(
stopGear
){
var
gearVal
=
Math
.
abs
(
pos
-
8
)
/
2
;
setGear
(
target
,
gearVal
);
clearInterval
(
target
[
"int_"
+
target
.
id
]);}
break
;
default
:}
target
[
"pos_"
+
target
.
id
]
=
pos
;
target
.
style
[
"-webkit-transform"
]
=
'translate3d(0,'
+
pos
+
'em,0)'
;
target
.
setAttribute
(
'top'
,
pos
+
'em'
);
d
++
;},
30
);}
function
setGear
(
target
,
val
){
val
=
Math
.
round
(
val
);
target
.
setAttribute
(
"val"
,
val
);
if
(
/date/
.
test
(
target
.
dataset
.
datetype
)){
setDateGearTooth
();}
else
{
setTimeGearTooth
();}}
function
closeMobileCalendar
(
e
){
e
.
preventDefault
();
var
evt
;
try
{
evt
=
new
CustomEvent
(
'input'
);}
catch
(
e
){
evt
=
document
.
createEvent
(
'Event'
);
evt
.
initEvent
(
'input'
,
true
,
true
);}
_self
.
trigger
.
dispatchEvent
(
evt
);
document
.
body
.
removeChild
(
_self
.
gearDate
);
_self
.
gearDate
=
null
;}
function
finishMobileDate
(
e
){
var
passY
=
_self
.
maxY
-
_self
.
minY
+
1
;
var
date_yy
=
parseInt
(
Math
.
round
(
_self
.
gearDate
.
querySelector
(
".date_yy"
).
getAttribute
(
"val"
)));
var
date_mm
=
parseInt
(
Math
.
round
(
_self
.
gearDate
.
querySelector
(
".date_mm"
).
getAttribute
(
"val"
)))
+
1
;
date_mm
=
date_mm
>
9
?
date_mm
:
'0'
+
date_mm
;
var
date_dd
=
parseInt
(
Math
.
round
(
_self
.
gearDate
.
querySelector
(
".date_dd"
).
getAttribute
(
"val"
)))
+
1
;
date_dd
=
date_dd
>
9
?
date_dd
:
'0'
+
date_dd
;
_self
.
trigger
.
value
=
(
date_yy
%
passY
+
_self
.
minY
)
+
"-"
+
date_mm
+
"-"
+
date_dd
;
closeMobileCalendar
(
e
);}
function
finishMobileYM
(
e
){
var
passY
=
_self
.
maxY
-
_self
.
minY
+
1
;
var
date_yy
=
parseInt
(
Math
.
round
(
_self
.
gearDate
.
querySelector
(
".date_yy"
).
getAttribute
(
"val"
)));
var
date_mm
=
parseInt
(
Math
.
round
(
_self
.
gearDate
.
querySelector
(
".date_mm"
).
getAttribute
(
"val"
)))
+
1
;
date_mm
=
date_mm
>
9
?
date_mm
:
'0'
+
date_mm
;
_self
.
trigger
.
value
=
(
date_yy
%
passY
+
_self
.
minY
)
+
"-"
+
date_mm
;
closeMobileCalendar
(
e
);}
function
finishMobileDateTime
(
e
){
var
passY
=
_self
.
maxY
-
_self
.
minY
+
1
;
var
date_yy
=
parseInt
(
Math
.
round
(
_self
.
gearDate
.
querySelector
(
".date_yy"
).
getAttribute
(
"val"
)));
var
date_mm
=
parseInt
(
Math
.
round
(
_self
.
gearDate
.
querySelector
(
".date_mm"
).
getAttribute
(
"val"
)))
+
1
;
date_mm
=
date_mm
>
9
?
date_mm
:
'0'
+
date_mm
;
var
date_dd
=
parseInt
(
Math
.
round
(
_self
.
gearDate
.
querySelector
(
".date_dd"
).
getAttribute
(
"val"
)))
+
1
;
date_dd
=
date_dd
>
9
?
date_dd
:
'0'
+
date_dd
;
var
time_hh
=
parseInt
(
Math
.
round
(
_self
.
gearDate
.
querySelector
(
".time_hh"
).
getAttribute
(
"val"
)));
time_hh
=
time_hh
>
9
?
time_hh
:
'0'
+
time_hh
;
var
time_mm
=
parseInt
(
Math
.
round
(
_self
.
gearDate
.
querySelector
(
".time_mm"
).
getAttribute
(
"val"
)));
time_mm
=
time_mm
>
9
?
time_mm
:
'0'
+
time_mm
;
_self
.
trigger
.
value
=
(
date_yy
%
passY
+
_self
.
minY
)
+
"-"
+
date_mm
+
"-"
+
date_dd
+
" "
+
(
time_hh
.
length
<
2
?
"0"
:
""
)
+
time_hh
+
(
time_mm
.
length
<
2
?
":0"
:
":"
)
+
time_mm
;
closeMobileCalendar
(
e
);}
function
finishMobileTime
(
e
){
var
time_hh
=
parseInt
(
Math
.
round
(
_self
.
gearDate
.
querySelector
(
".time_hh"
).
getAttribute
(
"val"
)));
time_hh
=
time_hh
>
9
?
time_hh
:
'0'
+
time_hh
;
var
time_mm
=
parseInt
(
Math
.
round
(
_self
.
gearDate
.
querySelector
(
".time_mm"
).
getAttribute
(
"val"
)));
time_mm
=
time_mm
>
9
?
time_mm
:
'0'
+
time_mm
;
_self
.
trigger
.
value
=
(
time_hh
.
length
<
2
?
"0"
:
""
)
+
time_hh
+
(
time_mm
.
length
<
2
?
":0"
:
":"
)
+
time_mm
;
closeMobileCalendar
(
e
);}
_self
.
trigger
.
addEventListener
(
'click'
,{
"ym"
:
popupYM
,
"date"
:
popupDate
,
"datetime"
:
popupDateTime
,
"time"
:
popupTime
}[
type
]);}}
return
MobileCalendar
;})()
\ No newline at end of file
src/index.html
View file @
1504a8dc
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
<link
rel=
"shortcut icon"
href=
"https://www.ydinsurance.cn/wp-content/uploads/2018/04/favicon.gif"
<link
rel=
"shortcut icon"
href=
"https://www.ydinsurance.cn/wp-content/uploads/2018/04/favicon.gif"
type=
"image/x-icon"
/>
type=
"image/x-icon"
/>
<link
rel=
"stylesheet"
href=
"./assets/bootstrap/dist/css/bootstrap.min.css"
>
<link
rel=
"stylesheet"
href=
"./assets/bootstrap/dist/css/bootstrap.min.css"
>
<link
rel=
"stylesheet"
href=
"./assets/LCalendar/LCalendar.css"
>
</head>
</head>
<body>
<body>
...
@@ -23,6 +24,7 @@
...
@@ -23,6 +24,7 @@
<script
src=
"./assets/js/qrcode.js"
></script>
<script
src=
"./assets/js/qrcode.js"
></script>
<!--<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>-->
<!--<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>-->
<script
src=
"https://res2.wx.qq.com/open/js/jweixin-1.4.0.js"
></script>
<script
src=
"https://res2.wx.qq.com/open/js/jweixin-1.4.0.js"
></script>
<script
src=
"./assets/LCalendar/LCalendar.js"
></script>
</body>
</body>
</html>
</html>
\ No newline at end of file
src/typings.d.ts
0 → 100644
View file @
1504a8dc
/* SystemJS module definition */
declare
var
module
:
NodeModule
;
interface
NodeModule
{
id
:
string
;
}
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