Authored by zhangxiaoru

修改

... ... @@ -4,8 +4,8 @@ const shareBuyModel = require('../models/share-buy'),
headerModel = require('../../../doraemon/models/header');
exports.index = (req, res, next) => {
let activityId = req.query.activity_id,
isApp = req.yoho.isApp;
let activityId = req.query.activity_id || 2023,
isApp = req.query.app_version;
req.ctx(shareBuyModel).shareIndex(activityId, isApp).then(data => {
res.render('share-buy/share-buy', {
... ... @@ -19,7 +19,8 @@ exports.index = (req, res, next) => {
userCouponBoList: data.userCouponBoList,
newsFlash: data.newsFlash,
rebeatUrl: data.rebeatUrl,
strategyUrl: data.strategyUrl
strategyUrl: data.strategyUrl,
banner: data.banner
});
}).catch(next);
... ... @@ -33,7 +34,14 @@ exports.detail = (req, res, next) => {
detailDes: req.query.detailDes,
couponId: req.query.couponId
},
isApp = req.yoho.isApp;
isApp = req.query.app_version,
registerUrl;
if (isApp) {
registerUrl = 'http://m.yohobuy.com/activity/student/register?sharebuy=openbuy:yohobuy={"action":"go.h5","params":{"islogin":"N","type":"13","url":"http://m.yohobuy.com/activity/student/register"}}';
} else {
registerUrl = 'http://m.yohobuy.com/activity/student/register';
}
req.ctx(shareBuyModel).shareDetail(uid, param, isApp).then(data => {
... ... @@ -46,7 +54,8 @@ exports.detail = (req, res, next) => {
width750: true,
title: '分享购',
page: 'share-detail',
detailData: data
detailData: data,
registerUrl: registerUrl
});
}).catch(next);
};
... ...
const api = global.yoho.API;
const _ = require('lodash');
const helpers = global.yoho.helpers;
const service = global.yoho.ServiceAPI;
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
... ... @@ -12,7 +13,7 @@ module.exports = class extends global.yoho.BaseModel {
*/
shareIndex(activityId, isApp) {
return api.all([this._CouponInfo(activityId), this._redeatList()]).then(result => {
return api.all([this._CouponInfo(activityId), this._redeatList(), this._banner()]).then(result => {
const indexData = {
newsFlash: []
};
... ... @@ -64,6 +65,10 @@ module.exports = class extends global.yoho.BaseModel {
});
}
if (result[2]) {
indexData.banner = result[2].data[0].src;
}
indexData.rebeatUrl = isApp ? rebeatUrl +
'?openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"http:' + rebeatUrl + '"}}' : rebeatUrl;
... ... @@ -75,6 +80,24 @@ module.exports = class extends global.yoho.BaseModel {
}
/**
* 首页资源位
*/
_banner() {
return service.get('operations/api/v5/resource/get', {
content_code: 'a4ceb2d742c55008ac7be30bca43e03f',
platform: 'iphone'
}, {
cache: true,
code: 200
}).then((result) => {
if (result && result.data) {
return result.data[0];
}
});
}
/**
* 首页获取优惠券信息
*/
_CouponInfo(activityId) {
... ... @@ -120,6 +143,10 @@ module.exports = class extends global.yoho.BaseModel {
});
}
if (!finalData.isStudent) {
finalData.couponCode = '*******';
}
return finalData;
});
}
... ...
<div class="share-buy-page yoho-page">
<div class="share-title"></div>
<div class="share-title">
<img src="{{image banner 750 366}}"><img>
</div>
<div class="coupon-list">
{{# userCouponBoList}}
... ...
... ... @@ -62,3 +62,11 @@
</div>
{{/ detailData}}
</div>
{{#unless detailData.isStudent}}
<div class="share-dialog-tip">
<div class="tip-box">
<div class="tip-center">完成学生认证即可参与活动哦~</div>
<a class="tip-btn" href="{{registerUrl}}">去认证</a>
</div>
</div>
{{/unless}}
... ...
... ... @@ -2,14 +2,11 @@
require('activity/share-detail.page.css');
let $ = require('yoho-jquery'),
yoho = require('yoho-app'),
dialog = require('plugin/dialog');
yoho = require('yoho-app');
let $activityTime = $('.activity-time'),
endTime = $activityTime ? $activityTime.data('time-s') : '',
$container = $('.goods-container'),
isStudent = $('.coupon-detail').data('student'),
isApp = $('.coupon-detail').data('app');
$container = $('.goods-container');
let winH = $(window).height(),
page = 1,
... ... @@ -39,7 +36,9 @@ let couponId = $('.coupon-info').data('id');
require('common/share')(shareData);
require('common');
yoho.invokeMethod('set.shareInfo', shareData);
if (yoho.isApp) {
yoho.invokeMethod('set.shareInfo', shareData);
}
appVersion = window.queryString.app_version;
... ... @@ -149,27 +148,16 @@ function scrollHandler() {
}
}
if (isStudent === false) {
dialog.showDialog({
dialogText: '完成学生认证即可参与活动哦~',
fast: true,
hasFooter: {
rightBtnText: '去认证'
}
}, function() {
if (isApp) {
location.href = 'http://m.yohobuy.com/activity/student/register?refer=' +
'openbuy:yohobuy={"action":"go.h5","params":{"islogin":"N","type":"13","url":"http://m.yohobuy.com/activity/student/register"}}';
} else {
location.href = '//m.yohobuy.com/activity/student/register?refer=' + location.href;
}
}, null, true);
}
$(window).scroll(function() {
window.requestAnimationFrame(scrollHandler);
});
if ($('.share-dialog-tip')) {
// window.setCookie('refer', window.location.href);
window.setCookie('share', '1', { path: '/' });
}
$(function() {
productData();
});
... ...
... ... @@ -485,7 +485,7 @@ $('.s-dialog').on('click', function() {
$('.dialog-content').addClass('s-dialog-content');
});
// 邀请同学
// 邀请同学、分享购
$(
function() {
if (window.queryString.refer) {
... ... @@ -493,8 +493,19 @@ $(
let refer = window.queryString.refer;
refer = decodeURIComponent(refer);
window.location.replace(refer);
}, 3000);
}
// 分享购
if (window.cookie('share') && parseInt(window.cookie('share'), 10) === 1) {
setTimeout(function() {
window.setCookie('share', '0', { path: '/' });
window.location.replace(decodeURIComponent(window.cookie('refer')));
}, 3000);
}
}
);
... ...
... ... @@ -3,12 +3,11 @@
height: 100%;
background-image: resolve("activity/share-buy/back.png");
background-size: 100%;
padding: 110px 0 145px;
padding-bottom: 145px;
.share-title {
background-image: resolve("activity/share-buy/body.png");
width: 580px;
height: 197px;
width: 100%;
height: 100%;
background-size: 100%;
margin: auto;
}
... ... @@ -16,7 +15,7 @@
.coupon-list {
background-color: #d0021b;
margin: 115px 30px 0;
padding: 30px 0;
padding: 10px 0 30px;
}
.coupon-group {
... ... @@ -64,6 +63,10 @@
font-size: 22px;
color: #b0b0b0;
line-height: 40px;
max-width: 260px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
a {
... ...
... ... @@ -132,3 +132,40 @@
}
}
}
.share-dialog-tip {
background: hsla(0, 0%, 0%, 0.5);
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 10;
.tip-box {
width: 540px;
border-radius: 20px;
background: hsla(100, 100%, 100%, 0.84);
position: absolute;
left: 50%;
top: 30%;
margin-left: -270px;
font-size: 30px;
text-align: center;
color: #000;
.tip-center {
padding: 60px 74px;
font-size: 32px;
}
.tip-btn {
height: 2.2rem;
line-height: 2.2rem;
width: 100%;
color: #d0021b;
border-top: 1px solid #e0e0e0;
display: block;
}
}
}
... ...