Authored by 郭成尧

Merge branch 'feature/raffle' into 'release/5.4'

测试bug

1.验证微信端,才能点击抽奖按钮
2.uid在node端获取
3.修改title

See merge request !139
... ... @@ -15,7 +15,7 @@ exports.activity = (req, res, next) => {
uid: req.user.uid
}).then((result) => {
res.render('raffle/activity', Object.assign(result, {
title: 'Yoho!Buy 有货',
title: '免单抽奖',
width750: true,
localCss: true
}));
... ... @@ -98,7 +98,7 @@ exports.enter = (req, res) => {
exports.lucky = (req, res, next) => {
raffleModel.lucky({
lotteryId: req.body.lotteryId,
userId: req.body.userId,
userId: req.user.uid,
orderCode: req.body.orderCode
}).then(result => {
res.json(result);
... ...
... ... @@ -3,7 +3,7 @@
<div class="logo"></div>
<div class="title">
{{# lottery}}
<p>{{name}}</p>
<p>{{{name}}}</p>
{{/ lottery}}
</div>
<div class="kind"></div>
... ... @@ -19,7 +19,7 @@
<div class="rule-list-c">
<ul>
{{# lottery}}
<li>{{remark}}</li>
<li>{{{remark}}}</li>
{{/ lottery}}
</ul>
</div>
... ...
... ... @@ -202,6 +202,7 @@ orderHammer.on('tap', function(e) {
$reaMask.data('orderId', id);
if ($cur.closest('.raffle-btn').length > 0) {
if (isWeiXin()) {
userId = $cur.closest('.raffle-btn').attr('data-uid');
orderCode = $cur.closest('.raffle-btn').attr('data-code');
$.ajax({
... ... @@ -209,7 +210,6 @@ orderHammer.on('tap', function(e) {
url: '/activity/raffle/lucky',
data: {
lotteryId: 20,
userId: userId,
orderCode: orderCode
},
success: function(data) {
... ... @@ -255,6 +255,10 @@ orderHammer.on('tap', function(e) {
tip.show(data.message);
}
});
} else {
tip.show('请在微信端打开,才能参加抽奖');
}
}
if ($cur.closest('.del').length > 0) {
... ... @@ -448,3 +452,13 @@ $('.dia-c .close').on('click', function() {
$('.dia-main a').on('click', function () {
window.location.href = '//m.yohobuy.com/activity/raffle/orders'
});
// 判断是否是微信
function isWeiXin(){
var ua = window.navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i) == 'micromessenger'){
return true;
} else {
return false;
}
}
\ No newline at end of file
... ...