Authored by zzzzzzz

Merge branch 'master' of git.yoho.cn:fe/yohobuywap-node into feature/qrcode

... ... @@ -8,9 +8,9 @@
const config = require('./config/common');
// use one apm
// if (config.useOneapm) {
// require('oneapm');
// }
if (config.useOneapm) {
require('oneapm');
}
const express = require('express');
const path = require('path');
... ...
... ... @@ -61,8 +61,7 @@ exports.getCoupon = (req, res, next) => {
// 获取信息成功
couponData.ordercode = ordercode;
}
// console.log(couponData);
console.log(couponData);
res.json({
result: couponData
});
... ... @@ -95,8 +94,7 @@ exports.verify = (req, res, next) => {
// 获取信息成功
couponData.ordercode = ordercode;
}
// console.log(couponData);
console.log(couponData);
res.json({
result: couponData
});
... ...
... ... @@ -29,16 +29,19 @@ exports.index = (req, res, next) => {
exports.main = (req, res, next) => {
const isReplay = /^\/live\/replay\//.test(req.path);
const id = req.params.id;
const goDownload = req.query.no;
res.locals.liveRoom = id;
res.locals.module = 'activity';
res.locals.page = 'live-play';
res.locals.enableFoot = goDownload !== 1;
model.fetchInfo(id, isReplay)
.then(result => {
if (!result.data) {
return next();
}
res.render('live/play', result.data);
})
.catch(next);
... ...
... ... @@ -10,11 +10,10 @@
<section class='s-text'>
<h6>权益1:新品立享9折</h6>
<p>1、学生购买原价新品时,可立即享受9折优惠,与VIP折扣不可同时享受。</p>
<h6>权益2:每1元返1个有货币</h6>
<p>1、学生购买商品时,以商品的实际成交金额计算,每1元返1个有货币;</p>
<p>2、返有货币时间:确认收货7日后,系统将自动将对应数量的有货币返至购买账户;</p>
<p>3、有货币有效期:获得当日至次年12月31日,逾期自动作废;</p>
<p>4、查看有货币:登录后,点击“个人中心”在“我的有货币”中可以查看有货币余额及明细。</p>
<h6>权益2:每满100返100有货币</h6>
<p>1、学生购买商品时,商品金额每满100元即可获得100有货币;</p>
<p>2、有货币有效期:获得当日至次年12月31日,逾期自动作废;</p>
<p>3、查看有货币:登录后,点击“个人中心”在“我的有货币”中可以查看有货币余额及明细</p>
<h6>权益3:免单抽奖</h6>
<p>1、每月将在累计购物金额最高的学校中,抽取3名幸运学生用户,获得免单资格;</p>
<p>2、免单用户名单将在每月第1个工作日公布在有货微信公众号上,可关注【有货YOHOBUY】;</p>
... ...
... ... @@ -13,6 +13,9 @@
<p>加载中</p>
</div>
<div class="live-loading-cover" style="background-image: url('{{pic}}');"></div>
<a href="javascript: history.back();" class="live-btn-close">
<i class="iconfont">&#xe623</i>
</a>
</div>
<div id="live_touch_layer"></div>
... ... @@ -65,9 +68,6 @@
<a href="javascript:;" class="live-btn-share">
<i class="iconfont">&#xe600</i>
</a>
<a href="javascript: history.back();" class="live-btn-close">
<i class="iconfont">&#xe623</i>
</a>
</section>
</div>
{{/canPlay}}
... ... @@ -122,6 +122,7 @@
{{/notBegin}}
{{! footer}}
{{#enableFoot}}
<div class="float-layer" id="float-layer-app">
<div class="float-layer-left">
<span class="yoho-icon iconfont">&#xe60d;</span>
... ... @@ -135,6 +136,7 @@
立即下载
</a>
</div>
{{/enableFoot}}
</div>
<script>
var live_start_time = {{live_start_time}};//该直播开始时间
... ... @@ -142,7 +144,6 @@
var live_room = {{liveRoom}};//房间id,资讯id
var replay_total_likes = {{like_num}};//重播总计点赞数,取的是直播最终点赞数
var replay_user_nums = {{audience_num}};//重播观看人数,取的是直播时最终观看人数
var site_url = '';
var site_domain = 'http://api.live.yoho.cn/';
// share data
... ...
... ... @@ -110,7 +110,7 @@ const _processIndexData = (dataList) => {
let url = `/guang/star/detail?tag=${data.tagName}&openby:yohobuy{"action":"go.h5","params":{"id":"","share":"","shareparam":{},"islogin":"N","type":0,"updateflag":"N","url":"http://m.yohobuy.com/guang/star/detail","param":{"tag":"${data.tagName}"}}}`; // eslint-disable-line
formatData.starAvatar.push({
noLazy: index < 6,
//noLazy: index < 6,
url: url,
cover: data.cover ? (data.cover + '?imageView2/2/w/180/h/180') : data.cover
});
... ...
... ... @@ -463,6 +463,7 @@ const checkVerifyCode = (uid, mobile, code) => {
method: method,
mobile: mobile,
snsCheckCode: code,
codeType: 1, // 授信
debug: 'XYZ'
}, {
timeout: API_TIMEOUT
... ...
... ... @@ -206,7 +206,7 @@ const wechat = {
doPassportCallback(openId, nickname, 'wechat', req, res).catch(next);
})(req, res, next);
} else {
return next('Auth State Mismatch');
return next(new Error('Auth State Mismatch'));
}
}
};
... ...
... ... @@ -16,6 +16,12 @@ const LOGIN_SUCCSS = '登录成功';
const VERIFY_ERROR = '校验失败';
exports.beforeIn = (req, res, next) => {
res.set({
'Cache-Control': 'no-cache, no-store, must-revalidate',
Pragma: 'no-cache',
Expires: 0
});
if (!req.xhr && req.user.uid) {
return res.redirect(req.cookies.refer);
}
... ...
... ... @@ -83,7 +83,7 @@ if (isProduction) {
domains: {
api: 'http://api.yoho.yohoops.org/',
service: 'http://service.yoho.yohoops.org/',
liveApi: 'http://api.live.yoho.cn/'
liveApi: 'http://preapi.live.yoho.cn/' // 'http://api.live.yoho.cn/'
},
memcache: {
master: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'],
... ...
... ... @@ -21,16 +21,10 @@ module.exports = () => {
// 判断请求是否来自app
yoho.isApp = req.query.app_version || req.query.appVersion;
yoho.isWechat = /micromessenger/i.test(req.get('User-Agent') || '');
Object.assign(res.locals, yoho);
Object.assign(req.yoho, yoho);
// App 内请求支持跨域
if (yoho.isApp) {
res.set('Access-Control-Allow-Origin', '*');
}
next();
};
};
... ...
... ... @@ -32,7 +32,7 @@
<link rel="apple-touch-startup-image" sizes="640x920" href="http://static.yohobuy.com/m/v1/img/startup/startup-retina.png" media="screen and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2)">
<link rel="apple-touch-startup-image" sizes="320x460" href="http://static.yohobuy.com/m/v1/img/startup/startup.png" media="screen and (max-device-width: 320)">
</head>
<body class="{{#if width750}}width750{{/if}} {{#if isWechat}}wechat-body{{/if}} {{#if isPassportPage}}passport-body{{/if}} {{#if isStarIndexPage}}star-index-bg{{/if}} {{#if isStarDetailPage}}star-class-body{{/if}} {{#if isInstallmentPage}}installment-body{{/if}}">
<body class="{{#if width750}}width750{{/if}} {{#if isPassportPage}}passport-body{{/if}} {{#if isStarIndexPage}}star-index-bg{{/if}} {{#if isStarDetailPage}}star-class-body{{/if}} {{#if isInstallmentPage}}installment-body{{/if}}">
<div class="main-wrap">
{{#if systemUpdate}}
{{> updata}}
... ...
{{#unless isApp}}
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-W958MG" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>
... ... @@ -12,4 +11,3 @@ function async_load(){
}
window.addEventListener('load', async_load, false);
</script>
{{/unless}}
... ...
... ... @@ -17,6 +17,7 @@ var prefixes = 'webkit moz ms o'.split(' '); //各浏览器前缀
var requestAnimationFrame = window.requestAnimationFrame;
var cancelAnimationFrame = window.cancelAnimationFrame;
var site_url = STATIC_RESOURCE_PATH;
var $btn_play;
var video_width = 375;
var video_height = 667;
... ... @@ -673,7 +674,7 @@ function insert_like(obj) {
}
}
now_like_nums = num;
if (now_like_nums > 100000) {
if (now_like_nums > 10000) {
$('#like_num').text((now_like_nums / 10000).toFixed(1) + '万');
} else {
$('#like_num').text(now_like_nums);
... ...
... ... @@ -78,14 +78,13 @@ function isValidate(rules, datas) {
message = rule.name + '不可为空';
break;
}
// if (rule.regex) {
// reg = $.trim(data).match(rule.regex);
// if (!reg || (reg && !reg.length)) {
// message = rule.msg;
// break;
// }
// }
if (rule.regex) {
reg = $.trim(data).match(rule.regex);
if (!reg || (reg && !reg.length)) {
message = rule.msg;
break;
}
}
if (rule.is !== void (0) && data !== rule.is) {
message = rule.msg;
}
... ... @@ -232,10 +231,10 @@ Filter.prototype = {
var html = [],
name;
// if (this.__select__ && this.__title__ && this.__select__[this.__feild__]) {
// html.push('<h6 class=\'s-title\'>当前地区</h6>');
// html.push('<div class=\'s-item close\'>' + this.__select__[this.__feild__] + '</div>');
// }
if (this.__select__ && this.__title__ && this.__select__[this.__feild__]) {
html.push('<h6 class=\'s-title\'>当前地区</h6>');
html.push('<div class=\'s-item close\'>' + this.__select__[this.__feild__] + '</div>');
}
for (name in data) {
if (data.hasOwnProperty(name)) {
... ... @@ -274,13 +273,9 @@ Filter.prototype = {
province = new Filter('[data-aslider=province]', '当前地区', 'addresseeName');
$.ajax({
url: '/activity/student/province',
cache: true,
success: function(res) {
province.set(res.data);
province.init();
}
$.get('/activity/student/province', function(res) {
province.set(res.data);
province.init();
});
$(document).on('keyup', '#s-search-provinces', function() {
... ... @@ -367,13 +362,9 @@ window.JI_getselectvalue = function(type, value) {
$('.s-blue').click(function() {
localStorage.setItem(STUDENTCOOKIES, JSON.stringify(changeSuccess().data));
});
$(function() {
try {
setFormByCookes(localStorage.getItem(STUDENTCOOKIES));
} catch (e) {
console.log(e);
}
});
setFormByCookes(localStorage.getItem(STUDENTCOOKIES));
// data-aslider-in="education|fade"
$(document).on('click', '#s-education .s-item', function() {
... ... @@ -456,3 +447,8 @@ $(document).on('click', '.s-submit', function() {
$('#tb-is-read').change(function() {
changeSuccess();
});
... ...
... ... @@ -188,8 +188,6 @@ function initAction() {
$avatarWrap = $('.avatar-wrap');
bannerLen = $('.avatar-wrap').find('.swiper-slide').length;
setIndexAction();
// if ($avatarClone) {
// $avatarClone.remove();
// }
... ... @@ -202,6 +200,7 @@ function initAction() {
effect: 'fadeIn'
});
setIndexAction();
}
initAction();
... ... @@ -258,7 +257,8 @@ starIScroll.iScroll.on('scrollStart', function() {
bannerSwiper && bannerSwiper.stopAutoplay();
});
// starIScroll.iScroll.on('scroll', function() {
starIScroll.iScroll.on('scroll', function() {
$window.trigger('scroll');
// var avatarOffsetT;
//
// if (this.directionY !== -1) {
... ... @@ -300,7 +300,7 @@ starIScroll.iScroll.on('scrollStart', function() {
// } else {
// $avatarClone.hide();
// }
// });
});
starIScroll.iScroll.on('scrollEnd', function() {
// $loadingTip.slideUp();
... ...
... ... @@ -43,18 +43,12 @@ var debounceFn = debounce(function(cardNo, formModel) {
var checkCard = function(formModel) {
// 银行卡格式化
$('#cardNo').keyup(function() {
$('#cardNo').on('input', function() {
var value = $(this).val();
var cardNo = $(this).val().replace(/\s/g, '');
$(this).val(value.replace(/[^\d]/g, '').replace(/(\d{4})(?=\d)/g, '$1 ')).trigger('change');
if (cardNo && cardNo.length < 16) {
$('#bank-desc').hide();
}
}).blur(function() {
var cardNo = $(this).val().replace(/\s/g, '');
if (cardNo && cardNo.length >= 16) {
debounceFn(cardNo, formModel);
} else {
... ...
... ... @@ -35,14 +35,15 @@ var validateForm = function() {
checkCard(formData);
// 输入框改变时同时更新模型
$('input').on('input', function() {
var name = $(this).attr('name');
formData[name] = $(this).val();
// 定时更新模型,解决各种浏览器奇葩问题终极办法
setInterval(function() {
$('input').each(function() {
var name = $(this).attr('name');
formData[name] = $(this).val();
});
validateForm();
});
}, 500);
applyButton.on('click', function() {
var self = this;
... ...
... ... @@ -131,8 +131,8 @@ var page = {
})
.done(function(res) {
if (res.code === 200) {
// $nextBtn.off();
location.href = res.redirect;
$nextBtn.off();
return;
}
... ...
... ... @@ -76,7 +76,7 @@ var page = {
})
.done(function(data) {
if (data.code === 200) {
$nextBtn.off();
// $nextBtn.off();
location.href = data.redirect;
} else {
tip.show(data.message);
... ...
... ... @@ -56,7 +56,7 @@ var page = {
})
.done(function(res) {
if (res.code === 200) {
$nextBtn.off();
// $nextBtn.off();
location.href = res.redirect;
return;
}
... ...
... ... @@ -203,8 +203,6 @@
padding-left: 1.75rem;
display: inline-block;
color: #ffffff;
border-radius: 0.3rem;
background-color: rgba(0, 0, 0, 0.32);
font-size: 0.6rem;
}
... ... @@ -224,7 +222,9 @@
font-size: 22px;
font-weight: lighter;
color: rgba(255,255,255,0.8);
background-color: rgba(0, 0, 0, 0.32);
overflow: hidden;
border-radius: 0.3rem;
}
.live-item2_2 {
... ... @@ -234,6 +234,7 @@
line-height: 1.2;
font-weight: normal;
color: #FFFFFF;
border-radius: 0.3rem;
}
.live-item2 img {
... ... @@ -242,7 +243,7 @@
top: 0;
display: inline-block;
width: 2.5rem;
height: 100%;
border-radius: 0.3rem;
}
.live-item2-head {
... ...
... ... @@ -2,4 +2,4 @@
@import "star";
@import "special";
@import "collocation";
/* @import "imageflow"; */
... ...
... ... @@ -435,7 +435,6 @@
display: block;
width: 100%;
height: 100%;
background: resolve("guang/star/lazy-img.jpg");
background-color: #000;
background-repeat: no-repeat;
background-size: contain;
... ...
... ... @@ -62,7 +62,7 @@ a {
text-decoration: none;
font-style: normal;
font-size: 24px;
font-family: 'iconfont' !important;
font-family: "iconfont" !important;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.4px;
-moz-osx-font-smoothing: grayscale;
... ...