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
cb85460e
Commit
cb85460e
authored
Feb 28, 2020
by
liang ce
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改二次点击
parent
f9209f50
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
20 deletions
+25
-20
index.axml
pages/index/index.axml
+1
-1
index.js
pages/index/index.js
+10
-9
utils.js
utils/utils.js
+14
-10
No files found.
pages/index/index.axml
View file @
cb85460e
...
...
@@ -87,5 +87,5 @@
</block>
</block>
</scroll-view>
<view class="createSchedule iconfont iconjiahao " onTap="
{{!isClicked?'nextPage':''}}
">
<view class="createSchedule iconfont iconjiahao " onTap="
nextPage
">
</view>
pages/index/index.js
View file @
cb85460e
import
{
getHomeUserSchedule
}
from
'../../api/request.js'
import
{
isClicked
}
from
'./../../utils/utils.js'
import
{
throttle
}
from
'./../../utils/utils.js'
Page
({
data
:
{
AllScheduleList
:
[],
...
...
@@ -40,7 +40,6 @@ Page({
const
today
=
new
Date
()
const
finalDate
=
new
Date
(
today
)
finalDate
.
setDate
(
today
.
getDate
()
-
today
.
getDay
())
console
.
log
(
finalDate
.
toLocaleDateString
())
that
.
setData
({
scheduleList
:
scheduleList
,
todayStr
:
finalDate
.
toLocaleDateString
(),
...
...
@@ -241,15 +240,17 @@ Page({
path
:
'pages/index/index'
,
};
},
nextPage
()
{
isClicked
(
this
)
dd
.
navigateTo
({
url
:
'./../createOrEditSchedule/createOrEditSchedule'
})
},
nextDetail
(
e
)
{
isClicked
(
this
)
// nextPage() {
// isClicked(this)
// dd.navigateTo({ url: './../createOrEditSchedule/createOrEditSchedule' })
// },
nextDetail
:
throttle
(
function
(
e
)
{
let
item
=
e
.
target
.
dataset
.
item
dd
.
navigateTo
({
url
:
`./../scheduleDetail/scheduleDetail?scheduleItem=
${
JSON
.
stringify
(
item
)}
`
})
},
},
1000
),
nextPage
:
throttle
(
function
(
e
)
{
dd
.
navigateTo
({
url
:
'./../createOrEditSchedule/createOrEditSchedule'
})
},
1000
),
lower
()
{
let
year
=
this
.
data
.
maxYear
+
1
let
DateList
=
this
.
returnScheduleList
(
year
)
...
...
utils/utils.js
View file @
cb85460e
// 防止二次点击
export
function
isClicked
(
self
)
{
self
.
setData
({
isClicked
:
true
})
setTimeout
(
function
()
{
self
.
setData
({
isClicked
:
false
})
},
500
)
//防止多次重复点击 (函数节流)
export
function
throttle
(
fn
,
gapTime
)
{
if
(
gapTime
==
null
||
gapTime
==
undefined
)
{
gapTime
=
1500
}
let
_lastTime
=
null
return
function
()
{
let
_nowTime
=
+
new
Date
()
if
(
_nowTime
-
_lastTime
>
gapTime
||
!
_lastTime
)
{
fn
()
_lastTime
=
_nowTime
}
}
}
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