Authored by 王水玲

年度账单

... ... @@ -6,68 +6,100 @@
'use strict';
const helpers = global.yoho.helpers;
const annualAccountModel = require('../models/annual-account');
const title = 'YOHO!BUY有货年度潮流账单——快来看看你的潮流形象!速戳>>';
const index = (req, res, next) => {
let uid = 2;
let isApp = req.query.app_version || req.query.appVersion ? true : false;
let url = '';
let curUrl = 'http://m.yohobuy.com/activity/annual-account';
let shareUrl = false;
let uid = +req.query.uid || +req.user.uid || 35;
let curUrl = 'http://m.yohobuy.com/activity/annual-account';
if (parseInt(uid, 10)) {
annualAccountModel.getAccountData({
uid: uid,
year: '2016'
}).then(result => {
let data = result.data;
if (isApp) {
let sUrl = 'http://m.yohobuy.com/activity/annual-account/share?name=' + data.nickname+ '&score=' + data.score + '&beat=' + data.beat + '&n=' + data.title; //eslint-disable-line
shareUrl = helpers.appUrlFormat(sUrl, 'go.share', {
pic: 'https://feature.yoho.cn/300x300.png',
title: 'YOHO!BUY有货年度潮流账单——快来看看你的潮流形象!速戳>>',
url: sUrl,
content: 'YOHO!2016潮流轨迹'
});
}
annualAccountModel.getAccountData({
uid: uid,
year: '2016'
}).then(result => {
let data = result.data || {};
let sUrl = 'http://m.yohobuy.com/activity/annual-account/share?name=' + data.nickname+ '&score=' + data.score + '&beat=' + data.beat + '&n=' + data.title; //eslint-disable-line
res.render('annual-account/index', {
module: 'activity',
page: 'annual-account',
localCss: true,
title: 'YOHO!BUY有货年度潮流账单——快来看看你的潮流形象!速戳>>',
accountData: Object.assign({
shareUrl: shareUrl
}, data)
});
}).catch(next);
} else {
if (isApp) {
url = helpers.appUrlFormat(curUrl, 'go.weblogin', {
jumpurl: {
url: curUrl,
antarget: 1
}
});
} else {
url = helpers.urlFormat('/signin.html', {
refer: '//m.yohobuy.com/activity/annual-account'
shareUrl = helpers.appUrlFormat(curUrl, 'go.share', {
pic: 'https://feature.yoho.cn/300x300.png',
title: title,
url: sUrl,
content: 'YOHO!2016潮流轨迹'
});
}
res.redirect(url);
}
res.render('annual-account/index', {
module: 'activity',
page: 'annual-account',
localCss: true,
title: title,
data: Object.assign({
shareUrl: shareUrl,
sUrl: sUrl
}, data)
});
}).catch(next);
};
// const getData = (req, res, next) => {
// let isApp = req.query.app_version || req.query.appVersion ? true : false;
// let shareUrl = false;
// let uid = req.query.uid || req.user.uid;
// let curUrl = 'http://m.yohobuy.com/activity/annual-account';
// let loginUrl = helpers.urlFormat('/signin.html', {
// refer: '//m.yohobuy.com/activity/annual-account'
// });
//
// if (isApp) {
// loginUrl = helpers.appUrlFormat(curUrl, 'go.weblogin', {
// jumpurl: {
// url: curUrl
// }
// });
// }
//
// if (parseInt(uid, 10)) {
// annualAccountModel.getAccountData({
// uid: uid,
// year: '2016'
// }).then(result => {
// let data = result.data || {};
// let sUrl = 'http://m.yohobuy.com/activity/annual-account/share?name=' + data.nickname+ '&score=' + data.score + '&beat=' + data.beat + '&n=' + data.title; //eslint-disable-line
//
// if (isApp) {
// shareUrl = helpers.appUrlFormat(curUrl, 'go.share', {
// pic: 'https://feature.yoho.cn/300x300.png',
// title: title,
// url: sUrl,
// content: 'YOHO!2016潮流轨迹'
// });
// }
//
// res.json(Object.assign({
// shareUrl: shareUrl,
// sUrl: sUrl
// }, data));
// }).catch(next);
// } else {
// res.json({
// loginUrl: loginUrl
// });
// }
// };
const share = (req, res) => {
let q = req.query;
res.render('annual-account/share', {
module: 'activity',
page: 'annual-account',
title: 'YOHO!BUY有货年度潮流账单——快来看看你的潮流形象!速戳>>',
title: title,
localCss: true,
data: q
data: Object.assign({
sUrl: req.originalUrl
}, q)
});
};
... ...
... ... @@ -8,7 +8,7 @@
const router = require('express').Router(); // eslint-disable-line
const cRoot = './controllers';
const auth = require('../../doraemon/middleware/auth');
const demo = require(`${cRoot}/demo`);
const coupon = require(`${cRoot}/coupon`);
const wechat = require(`${cRoot}/wechat`);
... ... @@ -138,7 +138,7 @@ router.get('/redbag/2017', redbag.index);
router.get('/individuation', individuation.productLst);
// 2016 年度账单
router.get('/annual-account', annualAccount.index);
router.get('/annual-account', auth, annualAccount.index);
router.get('/annual-account/share', annualAccount.share);
module.exports = router;
... ...
{{# accountData}}
<div class="annual-account-page ch">
{{#data}}
<div class="annual-account-page ch" data-login="{{loginUrl}}" data-is-app="{{isApp}}">
<div class="annual-bg ch"></div>
<audio src="https://feature.yoho.cn/20160118171021/yohood_170118.mp3" id="audio">
您的浏览器不支持 audio 标签。
</audio>
<audio loop="loop" autoplay="autoplay" src="https://feature.yoho.cn/20160118171021/yohood_170118.mp3">
<input type="hidden" value="{{sUrl}}" id="s-url">
<div class="audio-btn"></div>
<audio loop="loop" autoplay="autoplay" src="http://feature.yoho.cn/20160118171021/170119.mp3" id="audio">
Your browser does not support the audio element.
</audio>
<div class="swiper-container">
<div class="swiper-container ch">
<div class="swiper-wrapper">
<div class="swiper-slide nav-1">
<div class="start-btn"></div>
... ... @@ -46,8 +45,8 @@
<div class="arrow"></div>
<div class="lamp"></div>
<div class="stage"></div>
<div class="purdah-left"></div>
<div class="purdah-right"></div>
<div class="purdah-open-left"></div>
<div class="purdah-open-right"></div>
<div class="run-men"></div>
</div>
</div>
... ... @@ -57,10 +56,10 @@
<div class="arrow"></div>
<div class="lamp"></div>
<div class="stage"></div>
<div class="purdah-left"></div>
<div class="purdah-right"></div>
<div class="purdah-open-left"></div>
<div class="purdah-open-right"></div>
<div class="video">
<video src="https://feature.yoho.cn/20160118171021/yohood_170118.mp4">
<video src="https://feature.yoho.cn/20160118171021/yohood_170118.mp4" id="video" preload="auto" webkit-playsinline playsinline controls="controls">
您的浏览器不支持 video 标签。
</video>
</div>
... ... @@ -72,9 +71,13 @@
<div class="arrow"></div>
<div class="lamp"></div>
<div class="stage"></div>
<div class="purdah-left"></div>
<div class="purdah-right"></div>
<div class="hand"></div>
<div class="purdah-open-left"></div>
<div class="purdah-open-right"></div>
<div class="date"></div>
<div class="spokesman"></div>
<div class="txt-black"></div>
<div class="txt-white"></div>
</div>
</div>
... ... @@ -102,13 +105,13 @@
{{#if hasBill}}
<div class="score2">
<p>综合这一年的潮流之旅</p>
<p>你的潮流分为<span class="red-color">XX</span><br>击败了<span class="red-color">XX %</span>的潮人<br>获得</p>
<p>你的潮流分为<span class="red-color">{{score}}</span><br>击败了<span class="red-color">{{beat}} %</span>的潮人<br>获得</p>
</div>
{{else}}
<div class="score">2016年你的潮流分为<span class="red-color">{{score}}</span><br>击败了<span class="red-color">{{beat}}%</span>的潮人<br>获得</div>
{{/if}}
<div class="portrait-{{title}}"></div>
<div class="score-txt">称号</div>
<div class="score-txt">称号</div>
</div>
{{#shareUrl}}
<a href="{{.}}" class="share-btn"></a>
... ... @@ -117,4 +120,4 @@
</div>
</div>
</div>
{{/ accountData}}
{{/data}}
... ...
{{# data}}
<div class="annual-account-page ch account-share-page">
<input type="hidden" value="{{sUrl}}" id="s-url">
<div class="account-bg3">
<div class="share-txt">
<span class="name">{{name}}</span><br>的潮流分为<span class="red-color">{{score}}</span><br>击败了<span class="red-color">{{beat}}%</span>的潮人<br>获得
</div>
<div class="portrait-{{n}}"></div>
<div class="share-txt">称号</div>
<div class="share-txt">称号</div>
<a class="create-btn" href="/activity/annual-account"></a>
</div>
</div>
... ...
{{#data}}
<div class="annual-bg ch"></div>
<input type="hidden" value="{{sUrl}}" id="s-url">
<div class="audio-btn"></div>
<audio loop="loop" autoplay="autoplay" src="http://feature.yoho.cn/20160118171021/170119.mp3" id="audio">
Your browser does not support the audio element.
</audio>
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide nav-1">
<div class="start-btn"></div>
</div>
<div class="swiper-slide">
<div class="nav-2">
<div class="nav2-img ch"></div>
</div>
<div class="purdah1 ch">
<div class="arrow"></div>
</div>
</div>
<div class="swiper-slide">
<div class="purdah-area ch black-bg">
<div class="arrow"></div>
<div class="lamp"></div>
<div class="stage"></div>
<div class="purdah-left"></div>
<div class="purdah-right"></div>
<div class="purdah2">
<div class="month-4"></div>
<div class="month-list">
<ul>
<li class="month-5"></li>
<li class="month-8"></li>
<li class="month-10"></li>
<li class="month-12"></li>
</ul>
</div>
</div>
</div>
</div>
<div class="swiper-slide">
<div class="purdah-area ch black-bg purdah3">
<div class="arrow"></div>
<div class="lamp"></div>
<div class="stage"></div>
<div class="purdah-open-left"></div>
<div class="purdah-open-right"></div>
<div class="run-men"></div>
</div>
</div>
<div class="swiper-slide">
<div class="purdah-area ch black-bg purdah4">
<div class="arrow"></div>
<div class="lamp"></div>
<div class="stage"></div>
<div class="purdah-open-left"></div>
<div class="purdah-open-right"></div>
<div class="video">
<video src="https://feature.yoho.cn/20160118171021/yohood_170118.mp4" id="video" preload="auto" webkit-playsinline playsinline controls="controls">
您的浏览器不支持 video 标签。
</video>
</div>
</div>
</div>
<div class="swiper-slide">
<div class="purdah-area ch black-bg purdah5">
<div class="arrow"></div>
<div class="lamp"></div>
<div class="stage"></div>
<div class="hand"></div>
<div class="purdah-open-left"></div>
<div class="purdah-open-right"></div>
<div class="date"></div>
<div class="spokesman"></div>
<div class="txt-black"></div>
<div class="txt-white"></div>
</div>
</div>
<div class="swiper-slide account-bg">
<div class="account-1"></div>
<div class="arrow"></div>
</div>
<div class="swiper-slide account-bg2">
{{#if hasBill}}
<div class="account-2-consume">
<div class="chop-hand"></div>
<div class="text-center consume-text">
2016年<br>剁手<span class="red-color">{{orderNum}}</span><br>带走<span class="red-color">{{buyNum}}</span>件潮流单品<br>累积消费<span class="red-color">{{orderAmount}}</span><br>有货跋山涉水<span class="red-color">{{kilo}}</span>公里<br>只为您的潮流之旅
</div>
</div>
{{else}}
<div class="account-2-not"></div>
{{/if}}
<div class="arrow"></div>
</div>
<div class="swiper-slide">
<div class="account-bg3">
{{#if hasBill}}
<div class="score2">
<p>综合这一年的潮流之旅</p>
<p>你的潮流分为<span class="red-color">{{score}}</span><br>击败了<span class="red-color">{{beat}} %</span>的潮人<br>获得</p>
</div>
{{else}}
<div class="score">2016年你的潮流分为<span class="red-color">{{score}}</span><br>击败了<span class="red-color">{{beat}}%</span>的潮人<br>获得</div>
{{/if}}
<div class="portrait-{{title}}"></div>
<div class="score-txt">称号</div>
</div>
{{#shareUrl}}
<a href="{{.}}" class="share-btn"></a>
{{/shareUrl}}
</div>
</div>
</div>
{{/data}}
... ...

141 KB | W: | H:

126 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

315 KB | W: | H:

307 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
... ... @@ -3,44 +3,157 @@
* @author: wsl<shuiling.wang@yoho.cn>
* @date: 2017/01/17
*/
require('activity/annual-account.page.css');
var Swiper = require('yoho-swiper');
var share = require('../common/share');
var $ = require('yoho-jquery');
var $commonH = $('.ch'),
$nav2Img = $('.nav2-img'),
$audio = $('#audio');
var $audio = $('#audio');
var $video = $('#video');
var audioStatus = true;
var mySwiper;
$(function() {
$commonH.css({height: $(window).height()});
// 音频时间
function audioAction() {
document.addEventListener('WeixinJSBridgeReady', function() {
$audio[0].play();
}, false);
$('.audio-btn').on('click', function() {
if ($(this).hasClass('audio-f')) {
$(this).removeClass('audio-f');
$audio[0].play();
audioStatus = true;
} else {
$(this).addClass('audio-f');
$audio[0].pause();
audioStatus = false;
}
});
}
// 监听视频
function listenVideo() {
$video[0].addEventListener('playing', function() {
$audio[0].pause();
});
$video[0].addEventListener('pause', function() {
if (audioStatus) {
$audio[0].play();
}
});
$video[0].addEventListener('ended', function() {
if (audioStatus) {
$audio[0].play();
}
});
}
$(function() {
var $purdah1 = $('.purdah1'),
$nav2Img = $('.nav2-img'),
$purdahLeft = $('.purdah-left'),
$purdahRight = $('.purdah-right'),
$runMen = $('.run-men'),
$videoBox = $('.video'),
$spokesman = $('.spokesman'),
$tB = $('.txt-black'),
$tW = $('.txt-white'),
$hand = $('.hand'),
$commonH = $('.ch');
$commonH.css({height: $(window).height()});
audioAction();
listenVideo();
share({
imgUrl: 'https://feature.yoho.cn/300x300.png',
title: 'YOHO!BUY有货年度潮流账单——快来看看你的潮流形象!速戳>>',
link: $('#s-url').val(),
desc: 'YOHO!2016潮流轨迹'
});
mySwiper = new Swiper('.swiper-container', {
direction: 'vertical',
noSwiping: true,
noSwipingClass: 'stop-swiping',
onSlideChangeEnd: function(swiper) {
if (swiper.activeIndex === 1) {
var aIndex = swiper.activeIndex;
if (aIndex === 1) {
setTimeout(function() {
$nav2Img.addClass('n2-img-animation');
$('.purdah1').addClass('purdah1-animation');
$purdah1.addClass('purdah1-animation');
}, 300);
}
if (aIndex === 2) {
$purdahLeft.addClass('purdah-l-animation');
$purdahRight.addClass('purdah-r-animation');
}
if (aIndex === 3) {
$runMen.fadeIn(1000);
}
if (aIndex !== 4) {
$video[0].pause();
if (audioStatus) {
$audio[0].play();
}
}
if (aIndex === 4) {
$videoBox.css({
opacity: 1
}).addClass('video-animation');
}
if (aIndex === 5) {
$spokesman.addClass('spokesman-animation');
setTimeout(function() {
$tB.addClass('txt-animation');
}, 500);
setTimeout(function() {
$hand.addClass('hand-animation');
}, 1000);
setTimeout(function() {
$tW.addClass('txt-animation');
}, 1500);
}
},
onSlideChangeStart: function(swiper) {
if (swiper.activeIndex === 2 || swiper.previousIndex === 2) {
$('.purdah-left').addClass('purdah-l-animation');
$('.purdah-right').addClass('purdah-r-animation');
var aIndex = swiper.activeIndex;
if (aIndex === 1 || aIndex === 3) {
$purdahLeft.removeClass('purdah-l-animation');
$purdahRight.removeClass('purdah-r-animation');
}
if (aIndex === 0 || aIndex === 2) {
$nav2Img.removeClass('n2-img-animation');
$purdah1.removeClass('purdah1-animation');
}
if (swiper.activeIndex === 3) {
$('.run-men').fadeIn(1000);
if (aIndex === 2 || aIndex === 4) {
$runMen.hide();
}
if (aIndex === 3 || aIndex === 5) {
$videoBox.css({
opacity: 0
}).removeClass('video-animation');
}
if (aIndex === 4 || aIndex === 6) {
$spokesman.removeClass('spokesman-animation');
$tB.removeClass('txt-animation');
$hand.removeClass('hand-animation');
$tW.removeClass('txt-animation');
}
}
});
... ... @@ -49,34 +162,4 @@ $(function() {
$('.start-btn').on('click', function() {
mySwiper.slideTo(1, 1000, true);
});
// $('.purdah1').on('touchstart', function() {
// if (parseFloat($nav2Img.css('opacity')) > 0.2) {
// return false;
// }
//
// $('.purdah-left').addClass('purdah-l-animation');
// $('.purdah-right').addClass('purdah-r-animation');
// $('.font-img').addClass('font-img-animation');
// $('.hand').addClass('hand-animation');
// $('.purdah-area').addClass('black-bg');
// $(this).fadeOut(800);
//
// $('.purdah2').fadeIn(500);
// });
//
// $('.purdah2').on('touchstart', function() {
// $(this).fadeOut(800);
// $('.purdah3').fadeIn(500);
// });
//
// $('.purdah3').on('touchstart', function() {
// $('.purdah4').css({
// transition: 'all 1s',
// top: 0,
// opacity: 1,
// zIndex: 6,
// display: 'block'
// });
// });
});
... ...
... ... @@ -2,6 +2,22 @@
width: 640px;
overflow: hidden;
.audio-btn {
width: 49px;
height: 49px;
background: resolve("activity/annual-account/audio-o.png") no-repeat;
background-size: contain;
position: fixed;
top: 30px;
right: 30px;
z-index: 99;
}
.audio-f {
background: resolve("activity/annual-account/audio-f.png") no-repeat;
background-size: contain;
}
.annual-bg {
width: 100%;
background-image: resolve("activity/annual-account/bg.gif");
... ... @@ -125,6 +141,28 @@
z-index: 2;
}
.purdah-open-left {
width: 48px;
height: 806px;
background: resolve("activity/annual-account/open-l.png") no-repeat;
background-size: contain;
position: absolute;
top: 0;
left: 0;
z-index: 2;
}
.purdah-open-right {
width: 48px;
height: 812px;
background: resolve("activity/annual-account/open-r.png") no-repeat;
background-size: contain;
position: absolute;
top: 0;
right: 0;
z-index: 2;
}
.purdah-l-animation {
transition: all 1.5s;
transform: translate(-85%, 0);
... ... @@ -154,18 +192,21 @@
.hand {
width: 100%;
height: 379px;
height: 320px;
background: resolve("activity/annual-account/hand.png") no-repeat;
background-size: contain;
position: absolute;
bottom: 0;
bottom: -320px;
left: 0;
z-index: 5;
z-index: -3;
opacity: 0;
}
.hand-animation {
transition: all 1s;
opacity: 0;
transition: all 0.5s;
bottom: 0;
opacity: 1;
z-index: 3;
}
.stage {
... ... @@ -189,7 +230,7 @@
}
&.purdah2-animation {
transition: all 1.5s;
transition: all 1s;
transform: translate(0, -200%);
opacity: 0;
}
... ... @@ -267,33 +308,85 @@
.video {
width: 526px;
height: 779px;
height: 775px;
background: resolve("activity/annual-account/video.png") no-repeat;
background-size: contain;
transition: all 1s;
position: absolute;
z-index: 6;
top: 0;
left: 50px;
z-index: -6;
top: -775px;
left: 60px;
opacity: 0;
video {
#video {
width: 472px;
height: 254px;
height: 244px;
position: absolute;
top: 483px;
left: 25px;
}
}
.spokesman {
width: 499px;
height: 715px;
background: resolve("activity/annual-account/spokesman.png") no-repeat;
background-size: contain;
position: absolute;
.video-animation {
transition: all 1s;
top: 0;
z-index: 6;
top: 90px;
left: 70px;
}
&.purdah5 {
.date {
width: 242px;
height: 54px;
background: resolve("activity/annual-account/date.png") no-repeat;
background-size: contain;
margin: 90px auto 0;
}
.spokesman {
width: 0;
height: 0;
background: resolve("activity/annual-account/men.png") no-repeat;
background-size: contain;
position: absolute;
left: 117px;
top: 122px;
z-index: 1;
}
.spokesman-animation {
transition: all 0.5s;
width: 404px;
height: 592px;
transform: rotate(360deg) scale(1);
}
.txt-black {
width: 499px;
height: 238px;
background: resolve("activity/annual-account/text-b.png") no-repeat;
background-size: contain;
position: absolute;
top: 498px;
left: 70px;
z-index: 3;
opacity: 0;
}
.txt-white {
width: 482px;
height: 105px;
background: resolve("activity/annual-account/text-w.png") no-repeat;
background-size: contain;
position: absolute;
left: 72px;
top: 704px;
z-index: 4;
opacity: 0;
}
.txt-animation {
transition: all 0.8s;
opacity: 1;
}
}
}
... ... @@ -317,7 +410,7 @@
background: resolve("activity/annual-account/account-1.png") no-repeat;
background-size: contain;
position: absolute;
left: 100px;
left: 70px;
top: 48px;
}
... ... @@ -333,7 +426,7 @@
.account-2-consume {
position: absolute;
left: 120px;
left: 70px;
top: 100px;
.chop-hand {
... ...