Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
梁志锋
9 years ago
Commit
b9e98ccefae7d062a6449ba993996c5787a4b4a9
1 parent
d233c47d
个人中心我的消息
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
122 additions
and
0 deletions
static/js/me/message-detail.js
static/js/me/message.js
static/js/me/message-detail.js
0 → 100644
View file @
b9e98cc
var
$
=
require
(
'jquery'
),
dialog
=
require
(
'./dialog'
);
var
$page
=
$
(
'.massage-page'
);
var
pickBusy
=
false
;
// 领取生日券
$page
.
on
(
'touchstart'
,
'.pick-coupon-btn'
,
function
()
{
if
(
pickBusy
)
{
return
;
}
pickBusy
=
true
;
var
$id
=
$
(
this
).
data
(
'id'
);
$
.
ajax
({
type
:
'POST'
,
url
:
'/home/pickCoupon'
,
data
:
{
id
:
$id
},
success
:
function
(
data
)
{
if
(
data
.
code
===
200
)
{
dialog
.
showDialog
({
dialogText
:
'领取成功'
,
autoHide
:
2000
,
fast
:
true
});
$
(
this
).
removeClass
(
'pick-coupon-btn'
);
}
pickBusy
=
false
;
dialog
.
showDialog
({
dialogText
:
data
.
message
,
autoHide
:
2000
,
fast
:
true
});
}
});
});
...
...
static/js/me/message.js
0 → 100644
View file @
b9e98cc
var
$
=
require
(
'jquery'
),
loading
=
require
(
'../plugin/loading'
),
dialog
=
require
(
'./dialog'
);
var
$page
=
$
(
'.massage-page'
),
page
=
1
,
stopLoading
=
false
;
function
massageAJAX
(
page
)
{
loading
.
showLoadingMask
();
$
.
ajax
({
type
:
'POST'
,
url
:
'/home/ajaxMessage'
,
dataType
:
'html'
,
data
:
{
page
:
page
},
success
:
function
(
data
)
{
if
(
data
===
' '
)
{
stopLoading
=
true
;
if
(
page
===
1
)
{
data
=
'<p style="text-align:center">您没有消息</p>'
;
}
}
$
(
'.massage-page'
).
append
(
data
);
window
.
rePosFooter
();
loading
.
hideLoadingMask
();
}
});
}
function
scrollHandler
()
{
if
(
!
stopLoading
&&
(
$
(
window
).
scrollTop
()
+
$
(
window
).
height
()
>
$
(
'body'
).
height
()
-
100
))
{
page
++
;
massageAJAX
(
page
);
}
}
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
// 删除消息
$page
.
on
(
'touchstart'
,
'.del'
,
function
()
{
var
$good
=
$
(
this
).
closest
(
'.massage-list'
),
$id
=
$good
.
data
(
'id'
);
dialog
.
showDialog
({
dialogText
:
'确定删除这条消息吗?'
,
hasFooter
:
{
leftBtnText
:
'取消'
,
rightBtnText
:
'确定'
}
},
function
()
{
$
.
ajax
({
type
:
'POST'
,
url
:
'/home/ajaxDelMes'
,
data
:
{
id
:
$id
},
success
:
function
(
data
)
{
if
(
data
.
code
===
200
)
{
dialog
.
showDialog
({
dialogText
:
'删除消息成功'
,
autoHide
:
2000
,
fast
:
true
});
setTimeout
(
function
()
{
window
.
history
.
go
(
0
);
},
1200
);
}
}
});
});
});
massageAJAX
(
page
);
...
...
Please
register
or
login
to post a comment