Authored by Rock Zhang

Merge branch 'develop/wap' into beta/wap

... ... @@ -71,44 +71,99 @@ function setEditModeWithSknId(sknId, isThisGoodSelected) {
isSelected = isThisGoodSelected;
}
function preventDefault(event) {
var e = event || window.event;
function preventDefault(e) {
e = e || window.event;
e.preventDefault && e.preventDefault();
e.returnValue = false;
}
var $target = $(e.target);
function stopPropagation(e) {
e = e || window.event;
e.stopPropagation && e.stopPropagation();
e.cancelBubble = false;
}
if (($target.hasClass('.chose-items') || $target.closest('chose-items')) &&
($('.color-list').find('ul').not('.hide').find('li').length > 4 ||
$('.size-list').find('ul').not('.hide').find('li').length > 4)) {
e.stopPropagation();
return false;
}
function innerScroll(e) {
var delta = e.wheelDelta || e.originalEvent.wheelDelta || e.detail || 0,
box = $(this).get(0);
// 阻止冒泡到document
// document上已经preventDefault
stopPropagation(e);
if (e.preventDefault) {
e.preventDefault();
if ($(box).height() + box.scrollTop >= box.scrollHeight) {
if (delta < 0) {
preventDefault(e);
return false;
}
}
if (box.scrollTop === 0) {
if (delta > 0) {
preventDefault(e);
return false;
}
}
e.returnValue = false;
}
function disableScroll(e) {
function disableScroll() {
var startX, startY;
// older FF
if (window.addEventListener) {
window.addEventListener('DOMMouseScroll', preventDefault, false);
}
var $choseArea = $('.chose-panel .main .chose-items');
// 内部可滚
$choseArea.on('mousewheel', innerScroll);
// 移动端touch重写
$choseArea.on('touchstart', function(e) {
startX = e.originalEvent.changedTouches[0].pageX;
startY = e.originalEvent.changedTouches[0].pageY;
});
// 仿innerScroll方法
$choseArea.on('touchmove', function(e) {
var deltaX = e.originalEvent.changedTouches[0].pageX - startX,
deltaY = e.originalEvent.changedTouches[0].pageY - startY;
window.onwheel = preventDefault; // modern standard
window.onmousewheel = document.onmousewheel = preventDefault; // older browsers, IE
window.ontouchmove = preventDefault; // mobile
var box = $(this).get(0);
e.stopPropagation();
// 只能纵向滚
if (Math.abs(deltaY) < Math.abs(deltaX)) {
e.preventDefault();
return false;
}
if ($(box).height() + box.scrollTop >= box.scrollHeight) {
if (deltaY < 0) {
e.preventDefault();
return false;
}
}
if (box.scrollTop === 0) {
if (deltaY > 0) {
e.preventDefault();
return false;
}
}
});
$(document).on('mousewheel', preventDefault);
$(document).on('touchmove', preventDefault);
}
function enableScroll() {
if (window.removeEventListener) {
window.removeEventListener('DOMMouseScroll', preventDefault, false);
}
window.onmousewheel = document.onmousewheel = null;
window.onwheel = null;
window.ontouchmove = null;
document.onkeydown = null;
var $choseArea = $('.chose-panel .main .chose-items');
$choseArea.off('touchstart');
$choseArea.off('touchmove');
$choseArea.off('mousewheel');
$(document).off('mousewheel', preventDefault);
$(document).off('touchmove', preventDefault);
}
//删除面板
... ... @@ -159,10 +214,12 @@ function show(html, cb) {
}
init();
}
$('.chose-panel').show();
$num = $('#good-num');
cbFn = cb;
disableScroll();
}
... ...
... ... @@ -30,9 +30,6 @@ class YuanxiaoController extends HuodongAction
*/
public function indexAction()
{
// 该变量用来控制和显示页面的弹出提示
$showPopupFlag = '0';
$this->_view->display('index', array(
'staticTitle' => '元宵抽签',
'staticFile' => self::STATIC_FILE,
... ... @@ -58,8 +55,11 @@ class YuanxiaoController extends HuodongAction
$birthday = $this->post('birthday', '');
$gender = $this->post('gender', 1);
// 格式化日期以便接口接收
$FormatBirthday = date_format(date_create_from_format('Y年m月d日', $birthday), 'Y-m-d');
// 调用接口
$result = YuanxiaoModel::getChouqianInfo($uid, $nickName, $birthday, $gender);
$result = YuanxiaoModel::getChouqianInfo($uid, $nickName, $FormatBirthday, $gender);
if ($result['code'] === 200) { // 处理成功就跳转到等待页
// 将返回的结果存入cookeie中15分钟
$cookieData = array(
... ... @@ -90,7 +90,7 @@ class YuanxiaoController extends HuodongAction
'staticJS' => array(
'info.js'
),
'birthday' => $userData['birthday'],
'birthday' => date_format(date_create($userData['birthday']), 'Y年m月d日'),
'gender' => $userData['gender'],
'isBoy' => $userData['gender'] == 1 // 性别是否是女标志位
));
... ...