Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
schedule
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fengzhaoyu
schedule
Commits
8d22ccd7
Commit
8d22ccd7
authored
Apr 01, 2020
by
xiexiaoqin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix : startTime
parent
fbc467d7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
12 deletions
+28
-12
meetingTimePicker.js
components/meetingTimePicker/meetingTimePicker.js
+4
-2
createMeeting.js
pages/createMeeting/createMeeting.js
+3
-2
utils.js
utils/utils.js
+21
-8
No files found.
components/meetingTimePicker/meetingTimePicker.js
View file @
8d22ccd7
import
{
getInterTime
}
from
'../../utils/utils'
;
const
currentDate
=
new
Date
();
const
currentDate
=
new
Date
();
const
weekList
=
[
'周日'
,
'周一'
,
'周二'
,
'周三'
,
'周四'
,
'周五'
,
'周六'
];
const
weekList
=
[
'周日'
,
'周一'
,
'周二'
,
'周三'
,
'周四'
,
'周五'
,
'周六'
];
const
durationList
=
[{
value
:
60
,
label
:
'1小时'
},
{
value
:
120
,
label
:
'2小时'
},
{
value
:
30
,
label
:
'30分钟'
}];
const
durationList
=
[{
value
:
60
,
label
:
'1小时'
},
{
value
:
120
,
label
:
'2小时'
},
{
value
:
30
,
label
:
'30分钟'
}];
...
@@ -179,9 +180,10 @@ Component({
...
@@ -179,9 +180,10 @@ Component({
methods
:
{
methods
:
{
//设置初始值
//设置初始值
setInitialValue
()
{
setInitialValue
()
{
let
startDate
=
new
Date
();
let
startDate
=
getInterTime
(
new
Date
());
//结束日期默认+ 半小时
//结束日期默认+ 半小时
let
endDate
=
new
Date
(
);
let
endDate
=
getInterTime
(
new
Date
()
);
const
min
=
endDate
.
getMinutes
();
const
min
=
endDate
.
getMinutes
();
endDate
.
setMinutes
(
min
+
30
);
endDate
.
setMinutes
(
min
+
30
);
// 赋值
// 赋值
...
...
pages/createMeeting/createMeeting.js
View file @
8d22ccd7
import
{
addSchedule
,
getUserScheduleInTime
}
from
'../../api/request.js'
import
{
addSchedule
,
getUserScheduleInTime
}
from
'../../api/request.js'
import
{
throttle
}
from
'./../../utils/utils.js'
import
{
throttle
,
getInterTime
}
from
'./../../utils/utils.js'
import
create
from
'dd-store'
import
create
from
'dd-store'
create
.
Page
({
create
.
Page
({
data
:
{
data
:
{
...
@@ -348,12 +348,13 @@ create.Page({
...
@@ -348,12 +348,13 @@ create.Page({
},
},
// 获取时间参数
// 获取时间参数
getTimes
(
time
=
new
Date
())
{
getTimes
(
time
=
new
Date
())
{
let
date
=
new
Date
(
time
)
let
date
=
getInterTime
(
new
Date
(
time
)
)
let
year
=
date
.
getFullYear
()
let
year
=
date
.
getFullYear
()
let
month
=
date
.
getMonth
()
+
1
<
10
?
'0'
+
(
date
.
getMonth
()
+
1
)
:
date
.
getMonth
()
+
1
let
month
=
date
.
getMonth
()
+
1
<
10
?
'0'
+
(
date
.
getMonth
()
+
1
)
:
date
.
getMonth
()
+
1
let
day
=
date
.
getDate
()
<
10
?
'0'
+
date
.
getDate
()
:
date
.
getDate
()
let
day
=
date
.
getDate
()
<
10
?
'0'
+
date
.
getDate
()
:
date
.
getDate
()
let
hour
=
date
.
getHours
()
<
10
?
'0'
+
date
.
getHours
()
:
date
.
getHours
()
let
hour
=
date
.
getHours
()
<
10
?
'0'
+
date
.
getHours
()
:
date
.
getHours
()
let
miunutes
=
date
.
getMinutes
()
<
10
?
'0'
+
date
.
getMinutes
()
:
date
.
getMinutes
()
let
miunutes
=
date
.
getMinutes
()
<
10
?
'0'
+
date
.
getMinutes
()
:
date
.
getMinutes
()
return
`
${
year
}
/
${
month
}
/
${
day
}
${
hour
}
:
${
miunutes
}
:00`
return
`
${
year
}
/
${
month
}
/
${
day
}
${
hour
}
:
${
miunutes
}
:00`
},
},
// 是否跨天
// 是否跨天
...
...
utils/utils.js
View file @
8d22ccd7
...
@@ -4,7 +4,7 @@ export function throttle(fn, gapTime) {
...
@@ -4,7 +4,7 @@ export function throttle(fn, gapTime) {
gapTime
=
1500
;
gapTime
=
1500
;
}
}
let
_lastTime
=
null
;
let
_lastTime
=
null
;
return
function
()
{
return
function
()
{
let
_nowTime
=
new
Date
();
let
_nowTime
=
new
Date
();
if
(
_nowTime
-
_lastTime
>
gapTime
||
!
_lastTime
)
{
if
(
_nowTime
-
_lastTime
>
gapTime
||
!
_lastTime
)
{
fn
.
apply
(
this
,
arguments
);
//将this和参数传给原函数
fn
.
apply
(
this
,
arguments
);
//将this和参数传给原函数
...
@@ -14,13 +14,13 @@ export function throttle(fn, gapTime) {
...
@@ -14,13 +14,13 @@ export function throttle(fn, gapTime) {
}
}
export
function
debounce
(
fn
,
delay
)
{
export
function
debounce
(
fn
,
delay
)
{
let
timeout
=
null
;
let
timeout
=
null
;
return
function
()
{
return
function
()
{
clearTimeout
(
timeout
);
clearTimeout
(
timeout
);
timeout
=
setTimeout
(()
=>
{
timeout
=
setTimeout
(()
=>
{
fn
.
apply
(
this
,
arguments
);
fn
.
apply
(
this
,
arguments
);
},
delay
);
},
delay
);
};
};
}
}
// 判断时间 刚刚 五分钟以内 十分钟以内 正常时间年月日
// 判断时间 刚刚 五分钟以内 十分钟以内 正常时间年月日
...
@@ -141,3 +141,15 @@ export function getCurrentMonthLast(date) {
...
@@ -141,3 +141,15 @@ export function getCurrentMonthLast(date) {
}
}
return
date
.
getFullYear
()
+
"-"
+
month
+
"-"
+
day
;
return
date
.
getFullYear
()
+
"-"
+
month
+
"-"
+
day
;
}
}
//开始时间取整
export
function
getInterTime
(
time
)
{
let
date
=
time
;
if
(
typeof
time
==
'string'
)
{
date
=
new
Date
(
time
)
}
const
min
=
date
.
getMinutes
();
const
addMin
=
Math
.
floor
(
min
/
5
)
*
5
+
5
;
date
.
setMinutes
(
addMin
);
return
date
;
}
\ No newline at end of file
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