Authored by 徐炜

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	package.json
'use strict';
const serviceApi = global.yoho.ServiceAPI;
const api = global.yoho.API;
const helpers = global.yoho.helpers;
const crypto = global.yoho.crypto;
const queryString = require('querystring');
const Promise = require('bluebird');
const co = Promise.coroutine;
const headerModel = require('../../../doraemon/models/header'); // 头部model
const _ = require('lodash');
const productProcess = require(`${utils}/product-process`);
const userAcquireStatus = (uid, couponIds) => {
if (couponIds != '') {
return api.get('', {
method: 'app.coupons.userAcquireStatus',
uid: uid,
couponIds: couponIds
});
}
};
/**
* 查询商品
* @param id
* @returns {*}
*/
const _getRelatedData = (idList) => {
if (idList != '') {
return api.get('', {
productSkn: idList,
method: 'h5.product.batch'
}).then((result) => {
let goods = [];
if (result && result.data && result.data.product_list && result.code === 200) {
_.forEach(result.data.product_list, function(val) {
if (!val.student_price) {
val.student_price = val.vip2_price;
}
});
goods = productProcess.processProductList(result.data.product_list);
return goods;
} else {
return {};
}
});
}
};
exports.index = (req, res, next) => {
let code = 'c9b9639ce2884b768cfbc5cf9e68a53f';
let uid = req.__USER__.uid;
let options;
let noLoginUrl = helpers.urlFormat('/activity/student/register') + '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student-market"}}}';
return serviceApi.get('operations/api/v5/resource/get', {
content_code: code,
platform: 'iphone'
}).then((result) => {
let coupons = {},
activities,
banner,
icons,
link,
studentGoods,
idList = [],
goodShow,
// url,
// param,
couponids = [];
(result.data || []).forEach((item) => {
switch (item.template_name) {
case 'getCoupon':
coupons = item;
break;
case 'image_list':
activities = item;
break;
case 'focus':
banner = item;
break;
case 'recommend_content_five':
icons = item;
break;
case 'link':
link = item;
break;
case 'goods':
studentGoods = item;
break;
default:
// other = item;
break;
}
});
if (coupons && coupons.data) {
coupons.link = link && link.data ? link.data[0].url + (req.__USER__.isApp ? '&app_version=' + req.__USER__.app_version : '') : '';
coupons.data = (coupons.data || []).map((item) => {
// let url = item.image.url;
couponids.push(item.couponID);
// if (!req.__USER__.isLogin) {
// url = 'http://m.yohobuy.com/activity/student/register?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"http://m.yohobuy.com/activity/student"}}}';
// }
//
// item.image.noLoginUrl=url;
return item;
});
if (coupons.data.length > 2) {
coupons.data = coupons.data.slice(0, 2);
}
}
if (studentGoods && studentGoods.data) {
_.forEach(studentGoods.data, function(obj) {
idList.push(obj.id);
});
}
return Promise.all([userAcquireStatus(uid, couponids.join(',')), _getRelatedData(idList.join(','))]).then(datas => {
coupons.data = _.get(coupons, 'data', []).map((item)=>{
item.status = 1;
(datas[0].data || []).forEach((it) => {
if (+it.couponId === +item.couponID) {
item.hasNum = it.hasNum;
item.status = it.status;
}
});
item.couponID = crypto.encryption('yoho9646abcdefgh', item.couponID);
return item;
});
options = {
isApp: req.__USER__.isApp,
goods: datas[1],
banner: banner,
icons: icons,
coupons: coupons,
activities: activities,
isStudent: req.__USER__.isStudent,
isSupportStudent: req.__USER__.isSupportStudent,
isLogin: req.__USER__.isLogin,
title: '有货学生专享优惠',
http: req.__USER__.http,
uid: req.__USER__.uid,
app_version: req.__USER__.app_version,
isAppNoLogin: req.__USER__.isApp && !req.__USER__.isLogin,
noLoginUrl: noLoginUrl,
page: 'student-market',
showDownloadApp: true
};
if (!req.__USER__.isApp) {
options.pageHeader = headerModel.setNav({
navTitle: options.title,
navBtn: true
});
}
options.loginUrl = '//m.yohobuy.com/activity/student/register';
if (options.isApp) {
if (options.isLogin) {
options.loginUrl = options.loginUrl + '?openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student/register"}}';
} else {
// no login
options.loginUrl = options.loginUrl + '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student/register","antarget":"1"}}}';
}
}
res.render('student-market', options);
}).catch(next);
});
};
... ...
... ... @@ -27,6 +27,8 @@ const shopCollect = require(`${cRoot}/shopCollect`);
const singleDay = require(`${cRoot}/single-day`);
const share = require(`${cRoot}/share`);
const studentMarket = require(`${cRoot}/student-market`);
// routers
router.get('/demo', demo.index);
... ... @@ -120,4 +122,6 @@ router.post('/vip-day1028/isStudent', vipDay1028.beforeIn, vipDay1028.checkIsStu
// 获取活动页传来的参数
router.get('/wechat/1111', wechat.feature);
router.get('/student-market', student.getUser, studentMarket.index);
module.exports = router;
... ...
<div class="mobile-container">
<div class="mobile-wrap yoho-page student student-market">
{{! 头部banner}}
{{#banner}}
{{> resources/banner-top}}
{{/banner}}
{{#icons}}
<section class='s-section clearfix' data-template-id="{{template_id}}">
<h1>学生权益<a class='more s-quan' href='//m.yohobuy.com/activity/student/detail/quanyi?openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"{{../http}}//m.yohobuy.com/activity/student/detail/quanyi"}}'>更多权益</a></h1>
<div class='s-content'>
{{#each data.list}}
<div class='s-section s-dialog'>
<a href="javascript:void(0)">
<img src='{{image src 320 149}}' title="{{title}}">
</a>
</div>
{{/each}}
</div>
</section>
{{/icons}}
<div class='sm-layout'>
快来认证吧,认证通过即可享受专属优惠!
<a class='s-renzhen' href='{{loginUrl}}'>立即认证</a>
</div>
{{#coupons}}
<section class='s-section clearfix' data-template-id="{{template_id}}">
<h1>领券中心
<a class='more iconfont' href="{{link}}">&#xe618;</a>
</h1>
<div class='s-coupon-contain'>
<style type="text/css">
.no-bg{
color: #fff!important;
background-image: none!important;
}
</style>
{{#each data}}
<div class="coupon-floor" coupon-id="{{couponID}}">
<div class="floor-main" style="background-image: url({{image image.src 0 0}});">
<a href='{{image.url}}' class="main-left"></a>
{{#isEqual status 1}}
{{#if @root.isAppNoLogin}}
<a href='{{@root.noLoginUrl}}' class="main-right-use" >
<span class="on-receive on-lingqu no-bg">
<p>点击</p>
<p>领取</p>
</span>
</a>
{{else}}
<div class="main-right-use" href='{{../image.url}}'>
<span class="on-receive on-lingqu no-bg">
<p>点击</p>
<p>领取</p>
</span>
</div>
{{/if}}
{{/isEqual}}
{{#isEqual status 2}}
<a href='{{../image.url}}' class="main-right-use" >
<span class="zero"></span>
</a>
{{/isEqual}}
{{#isEqual status 3}}
<a href='{{../image.url}}' class="main-right-use" >
<span class="received"></span>
</a>
{{/isEqual}}
{{#isEqual status 4}}
<a href='{{../image.url}}' class="main-right-use" >
<span class="on-receive no-bg" >
<p>已经</p>
<p>过期</p>
</span>
</a>
{{/isEqual}}
</div>
</div>
{{/each}}
</div>
</section>
{{/coupons}}
{{#activities}}
<section class='s-section clearfix' data-template-id="{{template_id}}">
<h1>学生专属活动</h1>
{{#each data.list}}
<a class='s-activity' href="{{url}}">
<img src='{{image src 640 200}}' title='{{title}}'>
</a>
{{/each}}
</section>
{{/activities}}
<section class='s-section clearfix'>
<h1>学生专享商品<a class="more iconfont" href="//search.m.yohobuy.com/?students=1&title=学生专享商品&uid={{uid}}{{#isApp}}&app_version={{@root.app_version}}{{/isApp}}?openby:yohobuy={'action':'go.h5','params':{'islogin':'N','url':'{{@root.http}}//search.m.yohobuy.com/','param':{'students':'1','title':'学生专享商品','uid':'{{uid}}'}}}">&#xe618;</a></h1>
<div class='goods-list clearfix'>
{{#each goods}}
<div class="good-info">
<div class="tag-container clearfix">
{{# tags}}
{{# isNew}}
<p class="good-tag new-tag">NEW</p>
{{/ isNew}}
{{# isAdvance}}
<p class="good-tag renew-tag">再到着</p>
{{/ isAdvance}}
{{# isDiscount}}
<p class="good-tag sale-tag">SALE</p>
{{/ isDiscount}}
{{# isYohoood}}
<p class="good-tag running-man-tag">跑男同款</p>
{{/ isYohoood}}
{{# isLimited}}
<p class="good-tag limit-tag">限量</p>
{{/ isLimited}}
{{/ tags}}
</div>
<div class="good-detail-img">
<a class="good-thumb" href="{{url}}">
<img class="lazy" data-original="{{image default_images 235 314}}">
</a>
</div>
<div class="good-detail-text">
<div class="name">
<a href="{{url}}">{{product_name}}</a>
</div>
<div class="price">
<span class="sale-price">¥{{round student_price}} <i class='s-biaoqian'></i></span>
<p class="s-price-block">
<span class="market-price">¥{{round sales_price}}</span>
</p>
</div>
</div>
</div>
{{/each}}
</div>
<a class='s-more' href="//search.m.yohobuy.com/?students=1&title=学生专享商品&uid={{uid}}{{#isApp}}&app_version={{@root.app_version}}{{/isApp}}?openby:yohobuy={'action':'go.h5','params':{'islogin':'N','url':'{{@root.http}}//search.m.yohobuy.com/','param':{'students':'1','title':'学生专享商品','uid':'{{uid}}'}}}">查看更多</a>
</section>
<div class="float-layer" id="float-layer-app">
<div class="float-layer-left">
<span class="yoho-icon iconfont">&#xe60d;</span>
<p>快来下载Yoho!buy有货<br>即刻享受学生购物优惠</p>
</div>
<a href="javascript:void(0);" id="float-layer-close" >
<i class="close-icon iconfont">&#xe623;</i>
<div class="circle-rightbottom"></div>
</a>
<a href="javascript:void(0);" id="float-layer-btn">
立即下载
</a>
</div>
<div class="s-replace"></div>
</div>
</div>
... ...
... ... @@ -31,10 +31,10 @@ module.exports = {
// service: 'http://192.168.102.205:8080/gateway/',
// search: 'http://192.168.102.216:8080/yohosearch/'
api: 'http://api.yoho.yohoops.org/',
service: 'http://service.yoho.yohoops.org/',
liveApi: 'http://api.live.yoho.cn/',
singleApi: 'http://single.yoho.cn/'
// api: 'http://api.yoho.yohoops.org/',
// service: 'http://service.yoho.yohoops.org/',
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/'
// api: 'http://dev-api.yohops.com:9999/',
// service: 'http://dev-service.yohops.com:9999/',
... ...
{
"name": "m-yohobuy-node",
"version": "5.2.7",
"version": "5.2.10",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ... @@ -30,7 +30,6 @@
"feed": "^0.3.0",
"lodash": "^4.16.1",
"md5": "^2.1.0",
"memory-cache": "^0.1.6",
"moment": "^2.15.1",
"oneapm": "^1.2.20",
"passport": "^0.3.2",
... ... @@ -42,7 +41,7 @@
"request-promise": "^3.0.0",
"serve-favicon": "^2.3.0",
"uuid": "^2.0.3",
"yoho-node-lib": "^0.2.0",
"yoho-node-lib": "0.1.30",
"yoho-zookeeper": "^1.0.4"
},
"devDependencies": {
... ... @@ -72,7 +71,6 @@
"postcss-center": "^1.0.0",
"postcss-clearfix": "^1.0.0",
"postcss-crip": "^2.0.1",
"postcss-loader": "^1.1.1",
"postcss-position": "^0.5.0",
"postcss-pxtorem": "^3.3.1",
"postcss-scss": "^0.3.1",
... ... @@ -95,7 +93,7 @@
"yoho-handlebars": "^4.0.5",
"yoho-iscroll": "^5.2.0",
"yoho-jquery": "^2.2.4",
"yoho-jquery-lazyload": "^1.9.8",
"yoho-jquery-lazyload": "^1.9.7",
"yoho-jquery-qrcode": "^0.14.0",
"yoho-mlellipsis": "0.0.3",
"yoho-qs": "^1.0.1",
... ...
var $ = require('yoho-jquery'),
Swiper = require('yoho-swiper'),
lazyLoad = require('yoho-jquery-lazyload'),
fastclick = require('yoho-fastclick'),
tip = require('../plugin/tip'),
dialog = require('../plugin/dialog'),
Hammer = require('yoho-hammer');
var _weChatInterface = '//m.yohobuy.com/life/getSignPackage',
wx = window.wx,
C_ID,
getChannel;
require('../common');
// require('../common/footer');
// 根据ua判断页头
(function uaHeader() {
var UALIST = ['MicroMessenger', 'QQ/', 'Weibo'],
UA = navigator.userAgent,
i;
for (i = 0; i < UALIST.length; i++) {
if (UA.indexOf(UALIST[i]) > -1) {
$('#yoho-header').remove();
return;
}
}
}());
getChannel = function() {
var name = window.cookie('_Channel');
return {
boys: 1,
girls: 2,
kids: 3,
lifestyle: 4
}[name] || 1;
};
C_ID = getChannel();
function uuid() {
var s = [];
var hexDigits = '0123456789abcdef';
var id = '';
var i = 0;
for (i = 0; i < 36; i++) {
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
}
s[14] = '4'; // bits 12-15 of the time_hi_and_version field to 0010
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
s[8] = s[13] = s[18] = s[23] = '-';
id = s.join('');
return id;
}
fastclick.attach(document.body);
lazyLoad($('img.lazy'));
// 头部banner轮播
if ($('.banner-swiper').find('li').size() > 1) {
new Swiper('.banner-swiper', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
loop: true,
autoplay: 3000,
autoplayDisableOnInteraction: false,
paginationClickable: true,
slideElement: 'li',
pagination: '.banner-top .pagination-inner'
});
}
// 获取url中的参数
function getUrlParam(name) {
// 构造一个含有目标参数的正则表达式对象
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
// 匹配目标参数
var r = window.location.search.substr(1).match(reg);
// 返回参数值
if (r !== null) {
return r[2];
}
return null;
}
$('.on-lingqu', 'div.main-right-use').on('click', function() {
var $curDom = $(this),
req = '',
href = '',
a = '';
if (getUrlParam('app_version')) {
req += '&app_version=' + getUrlParam('app_version');
}
if (getUrlParam('uid')) {
req += '&uid=' + getUrlParam('uid');
}
if (!$curDom.hasClass('received')) {
$.ajax({
url: '//m.yohobuy.com/coupon/receiveCoupon?code=a83b7d55324fb65f96c1f85a3387ebd8' + req,
data: {
couponID: $curDom.parents('.coupon-floor').attr('coupon-id')
},
dataType: 'json',
success: function(data) {
var msg = data.msg,
status = data.status,
newUrl = '//m.yohobuy.com/signin.html?refer=' + location.href;
if (data.isApp === true) {
newUrl = data.url;
}
if (data.noLogin === true) {
location.href = newUrl;
} else {
if (status) {
href = $curDom.parent('.main-right-use').attr('href');
$curDom.parent('.main-right-use').wrap('<a class=\'main-right-use\' href=' + href + '></a>');
a = $curDom.parent('.main-right-use').parent('a');
a.html('<span class="received"></span>');
tip.show('领券成功');
} else {
tip.show(msg);
}
}
},
error: function() {
tip.show('网络异常!');
}
});
return false;
}
});
/**
* 微信分享
*/
if (typeof wx !== 'undefined') {
$.getJSON(_weChatInterface + '?pageurl=' +
encodeURIComponent(location.href.split('#')[0]) + '&callback=?',
function(json) {
var _appId,
_timestamp,
_nonceStr,
_signature;
if (json) {
_appId = json.appId.toString();
_timestamp = json.timestamp;
_nonceStr = json.nonceStr.toString();
_signature = json.signature.toString();
wx.config({
debug: false,
appId: _appId,
timestamp: _timestamp,
nonceStr: _nonceStr,
signature: _signature,
jsApiList: [
'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'hideMenuItems',
'showMenuItems',
'hideAllNonBaseMenuItem',
'showAllNonBaseMenuItem',
'translateVoice',
'startRecord',
'stopRecord',
'onRecordEnd',
'playVoice',
'pauseVoice',
'stopVoice',
'uploadVoice',
'downloadVoice',
'chooseImage',
'previewImage',
'uploadImage',
'downloadImage',
'getNetworkType',
'openLocation',
'getLocation',
'hideOptionMenu',
'showOptionMenu',
'closeWindow',
'scanQRCode',
'chooseWXPay',
'openProductSpecificView',
'addCard',
'chooseCard',
'openCard'
]
});
}
});
wx.ready(function() {
var shareData = {
title: 'YOHO!BUY有货【学生】专享福利大派送!4大特权享不停!',
desc: '全球1000+潮流品牌每日上新!一起来YOHO!玩潮流!',
imgUrl: 'http://img12.static.yhbimg.com/brandCertificate/2016/08/10/14/0204d441c737c687fc418b2372d0aba8be.png',
link: 'https://m.yohobuy.com/activity/student'
};
// 分享给朋友
wx.onMenuShareAppMessage(shareData);
// 分享到朋友圈
wx.onMenuShareTimeline(shareData);
// 分享到QQ
wx.onMenuShareQQ(shareData);
// 分享到微博
wx.onMenuShareWeibo(shareData);
});
}
setTimeout(function() {
var len = $('.good-info', '.goods-list').length;
var ids = [];
var check = location.pathname.indexOf('quanyi') === -1;
$('.good-info', '.goods-list').each(function() {
var goodids = $(this).find('.good-thumb').attr('href').match(/"product_skn":([^}]+)/, 'g');
var goodid = goodids && goodids.length === 2 ? goodids[1] : '';
ids.push(goodid);
});
if (check && window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_STUDENT_VIP_GDS_LIST',
param: JSON.stringify({
C_ID: C_ID,
PRD_NUM: len,
PRD_ID: ids.join(','),
ACTION_ID: 0,
SORT_TYPE: 4,
REC_ID: uuid(40) + '0000'
})
}, true);
}
if ($('.s-verify-fail').size()) {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_STUDENT_ATTCT_RESULT',
param: JSON.stringify({
C_ID: C_ID,
SRC_ID: 5,
ATTCT_RES: 2,
FAILURE_CAUSE: $('.s-verify-fail').attr('prompt')
})
}, true);
}
} else if ($('.s-verify-success').size()) {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_STUDENT_ATTCT_RESULT',
param: JSON.stringify({
C_ID: C_ID,
SRC_ID: 5,
ATTCT_RES: 1,
FAILURE_CAUSE: '',
ATTCT_INFO: JSON.parse(localStorage.STUDENTCOOKIES)
})
}, true);
}
} else {
// 埋点 学生营销宣传首页
// if (window._yas && window._yas.sendCustomInfo) {
// window._yas.sendCustomInfo({
// op: 'YB_STUDENT_HOME',
// param: JSON.stringify({
// C_ID: C_ID
// }),
// }, true);
// }
}
}, 3000);
$('.swiper-slide', '.banner-top').click(function() {
var options;
var url = $(this).find('a').attr('href');
var index = $(this).index();
var tid = $(this).parents('.s-section').data('template-id');
options = {
op: 'YB_STUDENT_VIP_FLR',
param: JSON.stringify({
C_ID: C_ID,
F_ID: tid || 1,
F_NAME: '焦点图',
F_URL: encodeURIComponent(url),
F_INDEX: 1,
I_INDEX: index
})
};
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo(options, true);
}
// return false;
});
// 学生活动页楼层埋点
$('.s-activity, .main-left, .s-quan, .iconfont', '.s-section').click(function() {
var options;
var url = $(this).attr('href');
var index = $(this).index();
var tid = $(this).parents('.s-section').data('template-id');
var obj = {
's-activity': {
fname: '学生专属活动',
findex: 4,
iindex: index
},
'more iconfont': {
fname: '领券中心',
findex: 3,
iindex: 0
},
'main-left': {
fname: '领券中心',
findex: 3,
iindex: $(this).parent().parent().index()
},
'more s-quan': {
fname: '学生权益',
findex: 2,
iindex: 0
}
}[$(this).attr('class')];
options = {
op: 'YB_STUDENT_VIP_FLR',
param: JSON.stringify({
C_ID: C_ID,
F_ID: tid,
F_NAME: obj.fname,
F_URL: encodeURIComponent(url),
F_INDEX: obj.findex,
I_INDEX: obj.iindex
})
};
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo(options, true);
}
});
$('.good-info', '.goods-list').click(function() {
var options;
var index = $(this).index();
var goodids = $(this).find('.good-thumb').attr('href').match(/"product_skn":([^}]+)/, 'g');
var goodid = goodids && goodids.length === 2 ? goodids[1] : '';
options = {
op: 'YB_STUDENT_VIP_GDS_LIST',
param: JSON.stringify({
C_ID: C_ID,
PRD_NUM: Number(index) + 1,
PRD_ID: goodid,
ACTION_ID: 1,
REC_ID: uuid(40) + '0000'
})
};
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo(options, true);
}
});
$('.s-renzhen').click(function() {
var options = {
op: 'YB_STUDENT_ATTCT_INFO',
param: JSON.stringify({
C_ID: C_ID,
SRC_ID: 1
})
};
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo(options, true);
}
});
$('.dialog-wrapper').addClass('s-dialog-wrapper');
$('.s-dialog').on('click', function() {
var text = [{
dialogText: '<h2>权益1: 新品立享9折</h2><p>学生购买指定原价新品时,可立即享受9折优惠,与VIP折扣不可同时享受</p>'
}, {
dialogText: '<h2>权益2: 每1元返1个有货币</h2><p>1、学生购买指定商品时,以商品的实际成交金额计算,每1元返1个有货币;</p>' +
'<p>2、返有货币时间:确认收货7日后,系统将自动将对应数量的有货币返至购买账户;</p>' +
'<p>3、有货币有效期:获得当日至次年12月31日,逾期自动作废;</p>' +
'<p>4、查看有货币:登录后,点击“个人中心”在“我的有货币”中可以查看有货币余额及明细。</p>'
}, {
dialogText: '<h2>权益3: 免单抽奖</h2><p>1、每月将在累计购物金额最高的学校中,抽取3名幸运学生用户,获得免单资格;</p>' +
'<p>2、免单用户名单将在每月第1个工作日公布在有货微信公众号上,可关注【有货YOHOBUY】;</p>' +
'<p>3、免单用户将在中奖次日获得与实付金额等额的现金券,使用时间:中奖当月。</p>'
}, {
dialogText: '<h2>权益4: 学生专享活动</h2><p>每月不定期的开展学生专享活动,可打开有货APP推送,及时查收学生专享活动通知。</p>'
}];
var dialogBoxHammer, dialogRightBtn;
dialog.showDialog({
student: true,
dialogText: text[$(this).index()].dialogText,
hasFooter: {
rightBtnText: '我知道了'
}
}, function() {
$('body').css({
overflow: '',
position: ''
});
dialog.hideDialog();
}, undefined, true);
$('.dialog-content').css({
padding: '0 1.5rem 1rem 1.5rem'
});
$('.dialog-box').css({
'border-radius': '0.25rem',
background: '#fff'
});
$('.dialog-right-btn').css({
border: 'none',
color: '#d0021b'
});
$('body').css({
overflow: 'hidden',
position: 'fixed'
});
dialogBoxHammer = new Hammer(document.getElementsByClassName('dialog-box')[0]);
dialogRightBtn = new Hammer(document.getElementsByClassName('dialog-right-btn')[0]);
dialogBoxHammer.on('tap', function(event) {
event.srcEvent.stopPropagation();
});
dialogRightBtn.on('tap', function(event) {
$('body').css({
overflow: '',
position: ''
});
dialog.hideDialog();
event.preventDefault();
event.srcEvent.stopPropagation();
});
$('.dialog-content').addClass('s-dialog-content');
});
$('#float-layer-close').on('touchend', function() {
$('#float-layer-app').hide();
return false;
});
if ($('#float-layer-btn') && $('#float-layer-btn')[0]) {
var floatLayerBtnHammer = new Hammer($('#float-layer-btn')[0]);
var unionType = window.queryString.union_type || 367;
floatLayerBtnHammer.on('tap', function(e) {
window.downLoadApp(unionType);
e.srcEvent.stopPropagation();
});
}
... ...
... ... @@ -11,8 +11,6 @@ var _weChatInterface = '//m.yohobuy.com/life/getSignPackage',
C_ID,
getChannel;
require('../common');
// 根据ua判断页头
... ...
... ... @@ -317,12 +317,12 @@ if ($footer.find('.user-name').text().length === 11) {
}
// 浮层下载APP
function downLoadApp() {
function downLoadApp(unionType) {
var appUrl = 'http://union.yoho.cn/union/downapp.html';
var clickedAt = new Date();
setTimeout(function() {
var mkt = queryString().union_type || cookie('unionTypeYas') || false;
var mkt = unionType || queryString().union_type || cookie('unionTypeYas') || false;
if ((new Date()) - clickedAt < 2000) {
if (mkt) {
... ...
... ... @@ -28,7 +28,7 @@ $('#float-layer-close').on('touchend', function() {
if ($('#float-layer-btn') && $('#float-layer-btn')[0]) {
floatLayerBtnHammer = new Hammer($('#float-layer-btn')[0]);
floatLayerBtnHammer.on('tap', function(e) {
window.downLoadApp('bottom');
window.downLoadApp();
e.srcEvent.stopPropagation();
});
... ...
... ... @@ -5,6 +5,7 @@
@import "market/index";
@import "shop-collect/shop-collect";
@import "single-day";
@import "student-market";
.receive-coupon-page {
* {
... ...
.student-market {
margin-bottom: 30px;
.sm-layout {
height: 80px;
line-height: 80px;
padding: 0 20px 0 25px;
border-bottom: 1px solid #e0e0e0;
.s-renzhen {
font-size: 20px;
width: 110px;
height: 48px;
line-height: 51px;
color: #fff;
background-color: #d10922;
border-radius: 20px;
text-align: center;
vertical-align: middle;
display: block;
float: right;
margin-top: 15px;
}
}
.s-coupon-contain {
background-color: #f0f0f0;
}
.float-layer-left {
p {
font-size: 20px;
line-height: 20PX;
padding: 3PX 0;
}
}
.s-dialog {
img {
height: 152px;
}
}
}
... ...