...
|
...
|
@@ -4,6 +4,8 @@ |
|
|
*/
|
|
|
'use strict';
|
|
|
require('plugin/modal');
|
|
|
require('../common.js');
|
|
|
var yoho = require('../yoho-app');
|
|
|
var tip = require('plugin/tip');
|
|
|
window.tip = tip;
|
|
|
|
...
|
...
|
@@ -20,6 +22,7 @@ var $punchModal; |
|
|
|
|
|
var page = {
|
|
|
init: function() {
|
|
|
yoho.checkLogin();
|
|
|
this.domInit();
|
|
|
this.bindEvents();
|
|
|
|
...
|
...
|
@@ -40,18 +43,15 @@ var page = { |
|
|
$punch.on('click', $.proxy(this.punchFuli, this));
|
|
|
$msgModal
|
|
|
.on('shown.yoho.modal', function() {
|
|
|
yoho.checkLogin();
|
|
|
$msg.focus();
|
|
|
})
|
|
|
.on('keydown', '.msg-text', function(event) {
|
|
|
event.preventDefault();
|
|
|
if (event.which !== KEY_CODE.ENTER) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var textArea = event.target;
|
|
|
var content = $.trim(textArea.value);
|
|
|
|
|
|
if (content.length) {
|
|
|
if (content.length && event.which === KEY_CODE.ENTER) {
|
|
|
event.preventDefault();
|
|
|
self.leaveMsg(content);
|
|
|
}
|
|
|
})
|
...
|
...
|
@@ -62,14 +62,15 @@ var page = { |
|
|
|
|
|
// 签到福利
|
|
|
punchFuli: function() {
|
|
|
yoho.checkLogin();
|
|
|
$.post('/activity/vip-day/signin.json').done(function(res) {
|
|
|
if (res.code !== 200) {
|
|
|
tip.show(res.message || '签到失败');
|
|
|
return;
|
|
|
}
|
|
|
if (res.code !== 200) {
|
|
|
tip.show(res.message || '签到失败');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$punchModal.yModal('show');
|
|
|
})
|
|
|
$punchModal.yModal('show');
|
|
|
})
|
|
|
.fail(function() {
|
|
|
tip.show('签到失败 >_<');
|
|
|
});
|
...
|
...
|
@@ -77,8 +78,8 @@ var page = { |
|
|
|
|
|
leaveMsg: function(content) {
|
|
|
$.post('/activity/vip-day/msg/save.json', {
|
|
|
content: content
|
|
|
})
|
|
|
content: content
|
|
|
})
|
|
|
.done(function(res) {
|
|
|
if (res.code !== 200) {
|
|
|
tip.show('留言失败~稍后再试');
|
...
|
...
|
@@ -110,7 +111,8 @@ var page = { |
|
|
return;
|
|
|
}
|
|
|
|
|
|
var $frag = $('<ul></ul>'), $fragClone;
|
|
|
var $frag = $('<ul></ul>'),
|
|
|
$fragClone;
|
|
|
|
|
|
$.each(res.data, function(index, msg) {
|
|
|
var li = document.createElement('li');
|
...
|
...
|
@@ -133,6 +135,7 @@ var page = { |
|
|
onePageH = $fragClone[0].offsetTop;
|
|
|
|
|
|
console.log(oneMsgH)
|
|
|
|
|
|
function rolling() {
|
|
|
|
|
|
$msgRoll.animate({
|
...
|
...
|
@@ -159,5 +162,4 @@ var page = { |
|
|
window.$ = $;
|
|
|
$(function() {
|
|
|
page.init();
|
|
|
});
|
|
|
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|