Authored by 郭成尧

'merge-master'

... ... @@ -201,7 +201,7 @@ exports.index = (req, res, next) => {
}
return userAcquireStatus(uid, couponids.join(',')).then((cous) => {
coupons.data = (coupons.data || []).map((item)=>{
coupons.data = _.get(coupons, 'data', []).map((item)=>{
item.status = 1;
(cous.data || []).forEach((it) => {
... ...
... ... @@ -14,7 +14,7 @@
</section>
{{else}}
<section class='s-section clearfix'>
<div class='s-verify-img s-verify-fail'></div>
<div class='s-verify-img s-verify-fail' prompt='{{./prompt}}'></div>
<p class='s-verify-title'>太遗憾了,{{./prompt}}</p>
<p class='s-verify-txt'>您可以<a class='red' href='//m.yohobuy.com/activity/student/register'>重新验证 ></a></p>
</section>
... ...
... ... @@ -239,8 +239,9 @@ let getChannelSwitchData = () => {
*/
let getChannelData = (params) => {
var channelData = {};
let navGender = _.cloneDeep(params.gender);
return Promise.all([_getChannelResource(params), _getLeftNav(params.gender)]).then((data) => {
return Promise.all([_getChannelResource(params), _getLeftNav(navGender)]).then((data) => {
channelData.content = data[0]; // 资源位数据
channelData.sideNav = data[1]; // 侧边栏数据
... ...
... ... @@ -10,6 +10,7 @@ const favoriteModel = require('../models/favorite');
const headerModel = require('../../../doraemon/models/header'); // 头部model
const favorite = (req, res) => {
let tab = req.query.tab || '';
res.render('favorite', {
module: 'home',
... ... @@ -21,13 +22,14 @@ const favorite = (req, res) => {
pageFooter: true,
favorite: {
productUrl: '//m.yohobuy.com/product/new',
brandUrl: '//m.yohobuy.com/product/new'
brandUrl: '//m.yohobuy.com/product/new',
brandTab: tab === 'brand' ? true : false // 是否为品牌收藏页
}
});
};
let favProduct = (req, res, next) => {
let uid = req.user.uid;
let uid = req.user.uid || 12696231;
let page = req.query.page || 1;
let limit = 10;
... ... @@ -44,7 +46,7 @@ let favProduct = (req, res, next) => {
};
let favfavBrand = (req, res, next) => {
let uid = req.user.uid;
let uid = req.user.uid || 12696231;
let page = req.query.page || 1;
let limit = 10;
... ... @@ -63,7 +65,7 @@ let favfavBrand = (req, res, next) => {
};
let favoriteDelete = (req, res, next) => {
let uid = req.user.uid;
let uid = req.user.uid || 12696231;
let type = 'product';
let favId = req.body.id;
... ...
... ... @@ -17,20 +17,14 @@ const indexModel = require('../models/index');
*/
exports.index = (req, res, next) => {
let params = {
uid: req.user.uid
uid: req.user.uid,
channel: req.query.channel || 1,
udid: require('md5')(req.ip)
};
let refer = req.get('Referer') || `${global.yoho.config.siteUrl}/${req.cookies._Channel || ''}`;
let reqPath = req.baseUrl + req.path;
let backUrl = refer.indexOf(reqPath) === -1 ? refer : '';
backUrl && res.cookie('saleRefer', backUrl, {
domain: 'm.yohobuy.com'
});
backUrl = backUrl || req.cookies.saleRefer;
let headerData = headerModel.setNav({
navTitle: '个人中心',
backUrl: backUrl,
backUrl: '//m.yohobuy.com/?go=1',
});
indexModel.index(params).then(result => {
... ...
... ... @@ -48,7 +48,6 @@ const readdData = (req, res, next) => {
let uid = req.user.uid;
orderDetailModel.readdData(orderCode, uid).then((result) => {
console.log(result);
res.json(result);
}).catch(next);
};
... ...
'use strict';
const mRoot = '../models';
const recommendForYouModel = require(`${mRoot}/recommend-for-you`); // 领取优惠券 model
exports.userCenter = (req, res, next) => {
var udid = req.sessionID,
uid = req.user.uid || 0,
yhChannel = req.query.yh_channel || '1',
limit = 30;
recommendForYouModel.getPreference({
yh_channel: yhChannel,
udid: udid,
limit: limit,
rec_pos: '100004',
uid: uid
}).then((preferenceData) => {
if (preferenceData.code === 200) {
// 获取信息成功
}
res.render('recommend-for-you/index', {
layout: false,
result: preferenceData,
module: 'product',
page: 'recommend'
});
}).catch(next);
};
exports.cart = (req, res, next) => {
var udid = req.sessionID,
uid = req.user.uid || 0,
yhChannel = req.query.yh_channel || '1',
limit = 30;
recommendForYouModel.getPreference({
yh_channel: yhChannel,
udid: udid,
limit: limit,
rec_pos: '100003',
uid: uid
}).then((preferenceData) => {
if (preferenceData.code === 200) {
// 获取信息成功
}
res.render('recommend-for-you/index', {
layout: false,
result: preferenceData,
module: 'product',
page: 'recommend'
});
}).catch(next);
};
... ...
... ... @@ -73,13 +73,13 @@ const favProduct = (uid, page, limit) => {
if (val.marketPrice - val.salesPrice > 0) {
obj = _.assign(obj, {
discountPrice: val.salesPrice
discountPrice: '¥' + Number(val.salesPrice).toFixed(2),
});
}
if (val.priceDown > 0) {
obj = _.assign(obj, {
savePrice: '¥' + val.priceDown
savePrice: '¥' + Number(val.priceDown).toFixed(2),
});
} else {
obj = _.assign(obj, {
... ... @@ -96,7 +96,7 @@ const favProduct = (uid, page, limit) => {
obj = _.assign(obj, {
favId: val.productId,
title: val.productName,
price: '¥' + val.marketPrice,
price: '¥' + Number(val.marketPrice).toFixed(2),
invalidGoods: val.status === 0
});
... ... @@ -175,8 +175,8 @@ const favfavBrand = (uid, page, limit) => {
link: '/product/pro_' + data.productId + '_' +
data.goods[0].id + '/' + data.cnAlphabet + '.html',
imgUrl: data.defaultImages,
price: '¥' + data.marketPrice,
discount: data.marketPrice > data.salesPrice ? '¥' + data.salesPrice : false,
price: '¥' + Number(data.marketPrice).toFixed(2),
discount: data.marketPrice > data.salesPrice ? '¥' + Number(data.salesPrice).toFixed(2) : false,
});
});
... ...
... ... @@ -76,6 +76,21 @@ const _infoNum = (params) => {
};
/**
* 从接口获取地址列表
* @param params
*/
const _getAddressData = (params) => {
if (params.uid) {
return api.get('', {
method: 'app.address.gethidden',
uid: params.uid
}, {code: 200});
} else {
return false;
}
};
/**
* 个人中心首页
* @param params
* @returns {function()}
... ... @@ -91,20 +106,23 @@ const index = (params) => {
cartUrl: helpers.urlFormat('/cart/index/index'),
signinUrl: helpers.urlFormat('/signin.html', {
refer: helpers.urlFormat('/home')
})
}),
verifyUrl: helpers.urlFormat('/activity/student/register')
};
return api.all([
_userData(params),
_noticeData(),
_favoriteData(params),
_infoNum(params)
_infoNum(params),
_getAddressData(params)
]).then(result => {
if (result[0] && result[0].data) {
Object.assign(finalResult, {
profileName: result[0].data.profile_name,
headIco: result[0].data.head_ico,
vipInfo: result[0].data.vip_info
vipInfo: result[0].data.vip_info,
students: _.get(result[0].data, 'vip_info.is_student', 0) === 1
});
}
... ... @@ -114,6 +132,12 @@ const index = (params) => {
});
}
if (result[2] && result[2].data) {
Object.assign(finalResult, {
productFavoriteTotal: result[2].data.product_favorite_total
});
}
if (result[3] && result[3].data) {
Object.assign(finalResult, {
sendCargoNum: result[3].data.send_cargo_num,
... ... @@ -122,12 +146,16 @@ const index = (params) => {
yohoCoinNum: result[3].data.yoho_coin_num,
inboxTotal: result[3].data.inbox_total,
couponNum: result[3].data.coupon_num,
productFavoriteTotal: result[3].data.product_favorite_total,
brandFavoriteTotal: result[3].data.brand_favorite_total,
productBrowse: result[3].data.product_browse
});
}
if (result[4] && result[4].data) {
Object.assign(finalResult, {
addressNum: result[4].data.length
});
}
return finalResult;
});
... ...
... ... @@ -14,12 +14,9 @@ const closeReasons = () => {
return api.get('', {
method: 'app.SpaceOrders.closeReasons'
}).then((result) => {
// console.log(result)
if (result && result.code === 200) {
// console.log(result)
return result.data;
} else {
// console.log('bushi 200');
return {};
}
});
... ... @@ -164,7 +161,7 @@ const orderDetailData = (uid, orderCode) => {
uid: uid,
order_code: orderCode
}).then((result) => {
// console.log(result)
if (result && result.code === 200) {
let orderDetail = camelCase(result.data);
let goods = [];
... ... @@ -197,7 +194,7 @@ const orderDetailData = (uid, orderCode) => {
}
_.forEach(orderDetail.orderGoods, function(data) {
// console.log(data);
let obj = {};
let count = +data.buyNumber;
... ... @@ -289,7 +286,6 @@ const orderDetailData = (uid, orderCode) => {
cancelReason: resons
});
// console.log(orderDetail);
return orderDetail;
});
... ...
'use strict';
var api = global.yoho.API;
const camelCase = global.yoho.camelCase;
const helpers = global.yoho.helpers;
const _ = require('lodash');
/**
* 分享页面基础参数
* @param {object} sizeInfo [接口原始数据]
* @return {object} [description]
*/
const getPreferenceData = (data) => {
var dest = {};
let list = data.data || {};
list = camelCase(list);
let distGoods = [];
_.forEach(list.productList, function(value) {
if (!value.productSkn || !value.goodsList || !value.goodsList.length) {
return;
}
value.goodsId = value.goodsList[0].goodsId;
let goods = value;
goods.url = helpers.urlFormat(`/product/pro_${value.productId}_${value.goodsId}/${value.cnAlphabet}.html`);
if (_.get(goods, 'tags[0]', null)) {
goods.tags = [];
if (goods.isNew === 'Y') {
goods.tags.push({isNew: true});
} else if (goods.isAdvance === 'Y') {
goods.tags.push({isAdvance: true});
} else if (goods.isDiscount === 'Y') {
goods.tags.push({isDiscount: true});
} else if (goods.isYohoood === 'Y') {
goods.tags.push({isYohoood: true});
} else if (goods.isLimited === 'Y') {
goods.tags.push({isLimited: true});
}
}
distGoods.push(goods);
});
dest.code = list.code;
dest.goods = distGoods;
dest.rec_id = list.recId;
dest.message = list.message;
// 清空变量,释放内存
data = {};
return dest;
};
/**
* 获取为你优选数据
*/
exports.getPreference = (data) => {
var defaultParam = {
method: 'app.home.newPreference'
},
infoData = Object.assign(defaultParam, data); // 处理完成后,发给后端
return api.get('', infoData).then(result => {
return getPreferenceData(result);
}); // 所有数据返回一个 Promise,方便 Promise.all 调用
};
... ...
... ... @@ -28,6 +28,9 @@ const suggest = require(`${cRoot}/suggest`);
const message = require(`${cRoot}/message`);
const onlineService = require(`${cRoot}/onlineService`);
// recommend-for-you controller
const recommendForYou = require(`${cRoot}/recommend-for-you`);
// const myDetail = require(`${cRoot}/myDetail);
... ... @@ -128,4 +131,6 @@ router.get('/installment/agreement', installment.agreement);// æœåŠ¡åè®®é™æ€
router.get('/installment/server-crash', installment.serverCrash); // 服务器崩溃
router.get('/installment/bank-card', installment.bankCard); // 银行卡列表
router.get('/recommend-for-you/userCenter', recommendForYou.userCenter);// 为你优选
module.exports = router;
... ...
... ... @@ -8,7 +8,7 @@
<h2>{{title}}</h2>
<div class="fav-price">
{{# discountPrice}}
<span class="new-price">{{.}}</span>
<span class="new-price">{{.}}</span>
{{/ discountPrice}}
<span class="fav-price {{# discountPrice}}price-underline{{/ discountPrice}}">{{price}}</span>
</div>
... ...
<div class="my-page yoho-page">
<div class="my-header">
{{#isLogin}}
<a class="user-info" href="/home/mydetails">
<span class="user-avatar" data-avatar="{{image headIco 128 128}}"></span>
<span class="username">{{profileName}}</span>
{{#vipInfo}}
<span class="vip-icon vip-{{cur_level}}"></span>
{{/vipInfo}}
<div class="iconfont more-icon tap-hightlight">&#xe604;</div>
</a>
{{/isLogin}}
{{^isLogin}}
<div class="user-info">
<a class="login-btn" href="{{signinUrl}}">
登录/注册
<a class="user-info" href="/home/mydetails">
<span class="user-avatar" data-avatar="{{image headIco 128 128}}"></span>
<span class="username">{{profileName}}</span>
{{#vipInfo}}
<span class="vip-icon vip-{{cur_level}}"></span>
{{/vipInfo}}
{{#if students}}
<span class="vip-icon students"></span>
{{/if}}
<div class="iconfont more-icon tap-hightlight">&#xe604;</div>
</a>
</div>
{{#unless students}}
<a class="students-entry" href="{{verifyUrl}}">学生认证</a>
{{/unless}}
{{^}}
<div class="user-info">
<a class="login-btn" href="{{signinUrl}}">
登录/注册
</a>
<a class="students-entry" href="{{verifyUrl}}">学生认证</a>
</div>
{{/isLogin}}
</div>
<div class="my-link clearfix {{^isLogin}}no-login{{/isLogin}}">
... ... @@ -32,18 +39,16 @@
<p>浏览记录</p>
</a>
</div>
<div class="notice" data-time="{{notice.time}}">
{{#notice}}
<a class="notice-item item-{{@index}}" href="{{url}}">
<span class="notice-icon"></span>
{{title}}
</a>
{{/notice}}
</div>
<!-- {{#if notice.open}}
{{/if}}-->
{{#if notice.open}}
<div class="notice" data-time="{{notice.time}}">
{{#notice}}
<a class="notice-item item-{{@index}}" href="{{url}}">
<span class="notice-icon"></span>
{{title}}
</a>
{{/notice}}
</div>
{{/if}}
<div class="my-order">
<a class="order-title" href="/home/orders">
我的订单
... ... @@ -79,7 +84,7 @@
<a class="list-item" href="/home/address">
<span class="iconfont icon">&#xe637;</span>
地址管理
<span class="iconfont num">{{address_num}} &#xe604;</span>
<span class="iconfont num">{{addressNum}} &#xe604;</span>
</a>
</div>
<div class="group-list">
... ... @@ -125,5 +130,5 @@
{{> common/suspend-cart}}
</div>
{{> download_app}}
{{> download-app}}
... ...
{{# result}}
<div id="goods-container" class="goods-container">
<p class="title">
<span>为你优选新品</span>
</p>
<div class="new-goods container clearfix">
{{# goods}}
{{> common/goods}}
{{/ goods}}
</div>
</div>
{{/result}}
... ...
... ... @@ -639,7 +639,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
vipList.push({
level: levelList[value.caption],
text: value.price,
currentLevel: (value.vipLevel === vipLevel)
currentLevel: (levelList[value.caption] === parseInt(vipLevel, 10))
});
});
... ...
... ... @@ -28,7 +28,6 @@ const formatProduct = (list) => {
isAdvance: val.isAdvance === 'Y'
});
_.forEach(tag, function(data) {
if (data.isDiscount === true && val.isSoonSoldOut === true) {
... ... @@ -56,20 +55,24 @@ const mayLike = (uid, page, limit, gender, udid, recPos, channel) => {
limit: limit,
udid: udid,
rec_pos: recPos,
yh_channel: channel
yh_channel: channel,
gender: gender
}).then((result) => {
if (result && result.code === 200) {
if (page > result.data.page_total) {
return;
}
if (result.data.page_total && page <= result.data.page_total) {
if (result.data.product_list) {
if (result.data.product_list) {
return formatProduct(result.data.product_list);
return formatProduct(result.data.product_list);
} else {
return false;
}
} else {
return false;
}
} else {
logger.error('mayLike cood 不是 200');
}
... ...
... ... @@ -54,7 +54,6 @@ router.get('/detail/comments', detail.comments); // 商品评价
router.post('/detail/consultsubmit', auth, detail.consultsubmit); // 商品咨询提交接口
router.get('/recom/maylike', recom.mayLike);// 你可能喜欢
router.get('/recom/maylikekids', recom.mayLikeKids); // 潮童你可能喜欢
// router.get('/recom/maylikelife', recom.mayLikeLifestyle); // 创意生活你可能喜欢
router.post('/detail/consultupvote', detail.consultUpvoteOrUseful); // 商品咨询提交接口
router.post('/detail/consultuseful', detail.consultUpvoteOrUseful); // 商品咨询提交接口
... ...
{{#showDownloadApp}}
<div class="float-layer hide" id="float-layer-app">
<div class="float-layer" id="float-layer-app">
<div class="float-layer-left">
<span class="yoho-icon iconfont">&#xe60d;</span>
<p>新用户送惊喜礼包</p>
... ... @@ -8,7 +8,7 @@
<i class="close-icon iconfont">&#xe623;</i>
<div class="circle-rightbottom"></div>
</a>
<a href="javascript:void(0);" id="float-layer-btn">
<a href="http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho" id="float-layer-btn">
立即下载
</a>
</div>
... ...
{{#showDownloadApp}}
<div class="float-layer hide" id="float-layer-app">
<div class="float-layer-left">
<span class="yoho-icon iconfont">&#xe60d;</span>
<p>新用户送惊喜礼包</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>
{{/showDownloadApp}}
\ No newline at end of file
{
"name": "m-yohobuy-node",
"version": "4.9.28",
"version": "5.0.0",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -7,7 +7,7 @@ var STUDENTCOOKIES = 'STUDENTCOOKIES';
var C_ID,
getChannel,
asideSlider = new AsideSlider();//eslint-disable-line
asideSlider = new AsideSlider(); //eslint-disable-line
var province,
school,
... ... @@ -86,7 +86,7 @@ function isValidate(rules, datas) {
// break;
// }
// }
if (rule.is !== void (0) && data !== rule.is) {
if (rule.is !== void(0) && data !== rule.is) {
message = rule.msg;
}
} else {
... ... @@ -127,6 +127,20 @@ function changeSuccess() {
};
}
/**
* 身份信息过滤
*/
function filter(data) {
return {
college_name: data.college_name,
college_province: data.provinceName,
education_degree: data.education_degree,
enrollment_year: data.enrollment_year,
sex: (Number(data.cert_no[16]) % 2 === 0) ? 2 : 1,
birth: data.cert_no.substr(6, 8),
};
}
function setFormByCookes(item) {
var msg;
... ... @@ -243,7 +257,7 @@ Filter.prototype = {
if (data[name].length > 0) {
data[name].forEach(function(item) {
html.push('<div class=\'s-item close\' data-obj=\'' +
JSON.stringify(item) + '\'>' + item[that.__feild__] + '</div>');
JSON.stringify(item) + '\'>' + item[that.__feild__] + '</div>');
});
}
}
... ... @@ -346,7 +360,7 @@ window.JI_bilibili = function($el) {
} else {
// $("[data-aslider-in='school|fade']").attr("aslider-isshow","false")
// $("[data-aslider-in='school|fade']").attr("aslider-isshow","false")
}
}
};
... ... @@ -365,7 +379,7 @@ window.JI_getselectvalue = function(type, value) {
};
$('.s-blue').click(function() {
localStorage.setItem(STUDENTCOOKIES, JSON.stringify(changeSuccess().data));
localStorage.setItem(STUDENTCOOKIES, JSON.stringify(filter(changeSuccess().data)));
});
$(function() {
try {
... ... @@ -407,13 +421,12 @@ $(document).on('click', '.s-submit', function() {
var $that = $(this);
// 存cookie 记录状态
localStorage.setItem(STUDENTCOOKIES, JSON.stringify(obj.data));
localStorage.setItem(STUDENTCOOKIES, JSON.stringify(filter(obj.data)));
if ($that.data('isClick') === false) {
return;
}
$that.data('isClick', false);
if (!obj.msg) {
$.ajax({
url: '/activity/student/join',
... ... @@ -424,15 +437,26 @@ $(document).on('click', '.s-submit', function() {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_STUDENT_ATTCT_SUBMIT',
param: {
param: JSON.stringify({
C_ID: C_ID,
SRC_ID: 5,
SUBMIT_RES: 1
}
}),
}, true);
}
location.href = data.data;
} else {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_STUDENT_ATTCT_SUBMIT',
param: JSON.stringify({
C_ID: C_ID,
SRC_ID: 5,
SUBMIT_RES: 2,
FAILURE_CAUSE: 3,
}),
}, true);
}
$that.data('isClick', true);
tip.show(data.message);
}
... ... @@ -450,12 +474,12 @@ $(document).on('click', '.s-submit', function() {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_STUDENT_ATTCT_SUBMIT',
param: {
param: JSON.stringify({
C_ID: C_ID,
SRC_ID: 5,
SUBMIT_RES: 2,
FAILURE_CAUSE: FAILURE_CAUSE
}
}),
}, true);
}
... ...
... ... @@ -34,8 +34,8 @@ function uuid() {
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[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('');
... ... @@ -64,13 +64,13 @@ if ($('.banner-swiper').find('li').size() > 1) {
// 获取url中的参数
function getUrlParam(name) {
// 构造一个含有目标参数的正则表达式对象
// 构造一个含有目标参数的正则表达式对象
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
// 匹配目标参数
// 匹配目标参数
var r = window.location.search.substr(1).match(reg);
// 返回参数值
// 返回参数值
if (r !== null) {
return r[2];
}
... ... @@ -141,64 +141,64 @@ $('.on-lingqu', 'div.main-right-use').on('click', function() {
*/
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'
]
});
}
});
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 = {
... ... @@ -208,16 +208,16 @@ if (typeof wx !== 'undefined') {
link: 'https://m.yohobuy.com/activity/student'
};
// 分享给朋友
// 分享给朋友
wx.onMenuShareAppMessage(shareData);
// 分享到朋友圈
// 分享到朋友圈
wx.onMenuShareTimeline(shareData);
// 分享到QQ
// 分享到QQ
wx.onMenuShareQQ(shareData);
// 分享到微博
// 分享到微博
wx.onMenuShareWeibo(shareData);
});
}
... ... @@ -225,6 +225,7 @@ if (typeof wx !== 'undefined') {
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');
... ... @@ -233,41 +234,55 @@ setTimeout(function() {
ids.push(goodid);
});
if (window._yas && window._yas.sendCustomInfo) {
if (check && window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_STUDENT_VIP_GDS_LIST',
param: {
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: {
param: JSON.stringify({
C_ID: C_ID,
SRC_ID: 5,
ATTCT_RES: 1,
FAILURE_CAUSE: ''
}
ATTCT_RES: 2,
FAILURE_CAUSE: $('.s-verify-fail').attr('prompt'),
}),
}, true);
}
} else {
// 埋点 学生营销宣传首页
} else if ($('.s-verify-success').size()) {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_STUDENT_HOME',
param: {
C_ID: C_ID
}
op: 'YB_STUDENT_ATTCT_RESULT',
param: JSON.stringify({
C_ID: C_ID,
SRC_ID: 5,
ATTCT_RES: 1,
FAILURE_CAUSE: '',
ATTCT_INFO: '{{info}}',
}).replace('{{info}}', 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);
... ... @@ -284,14 +299,14 @@ $('.swiper-slide', '.banner-top').click(function() {
options = {
op: 'YB_STUDENT_VIP_FLR',
param: {
param: JSON.stringify({
C_ID: C_ID,
F_ID: tid || 1,
F_NAME: '焦点图',
F_URL: url,
F_URL: encodeURIComponent(url),
F_INDEX: 1,
I_INDEX: index
}
}),
};
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo(options, true);
... ... @@ -299,24 +314,47 @@ $('.swiper-slide', '.banner-top').click(function() {
// return false;
});
$('.s-activity', '.s-section').click(function() {
// 学生活动页楼层埋点
$('.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: {
param: JSON.stringify({
C_ID: C_ID,
F_ID: tid,
F_NAME: '学生专属活动',
F_URL: url,
F_INDEX: 3,
I_INDEX: index
}
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);
}
... ... @@ -330,14 +368,13 @@ $('.good-info', '.goods-list').click(function() {
options = {
op: 'YB_STUDENT_VIP_GDS_LIST',
param: {
param: JSON.stringify({
C_ID: C_ID,
PRD_NUM: index,
PRD_NUM: Number(index) + 1,
PRD_ID: goodid,
ACTION_ID: 1,
SORT_TYPE: 4,
REC_ID: uuid(40) + '0000'
}
}),
};
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo(options, true);
... ... @@ -345,16 +382,14 @@ $('.good-info', '.goods-list').click(function() {
});
$('.s-renzhen').click(function() {
var options = {
op: 'YB_STUDENT_ATTCT_SUBMIT',
param: {
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);
}
});
... ...
... ... @@ -125,8 +125,10 @@ module.exports = function(specificGender) {
page: page + 1
},
success: function(data) {
// console.log(data)
var PRDID = [];
if (data === ' ') {
console.log(data);
searching = false;
loading.hideLoadingMask();
... ...
require('./recommend-for-you-user-center');
/**
* 个人中心首页
* @author: bikai<kai.bi@yoho.cn>
... ... @@ -11,11 +8,14 @@ var $ = require('yoho-jquery'),
var $userAvatar = $('.user-avatar'),
$listItem = $('.list-item');
var myImage = new Image(),
avatar;
require('../common');
require('./recommend-for-you-user-center');
require('../product/suspend-cart.js');
require('../common/footer');
// 部分老用户没有头像,显示默认头像
avatar = $userAvatar.data('avatar');
... ...
... ... @@ -12,7 +12,6 @@ var $recommendForYou = $('.recommend-for-you');
$.get('/product/recommend-for-you/userCenter').then(function(html) {
var PRDID = [];
var $recommendSonLen = $recommendForYou.find('.good-info').length;
$recommendForYou.html(html);
... ... @@ -24,6 +23,7 @@ $.get('/product/recommend-for-you/userCenter').then(function(html) {
PRDID.push($(this).data('id'));
});
let $recommendSonLen = $recommendForYou.find('.good-info').length;
if ($recommendSonLen === 0) {
$recommendForYou.hide();
... ...
... ... @@ -101,10 +101,6 @@ function search() {
searching = false;
end = true;
loading.hideLoadingMask();
if ($('#productDesc').hasClass('limit')) {
$('#productDesc').find('.service').removeClass('service').addClass('limit-service');
}
},
error: function() {
tip.show('网络断开连接了~');
... ...
... ... @@ -55,91 +55,74 @@
}
.float-layer {
height: 64PX;
background: rgba(68, 68, 68, 0.95);
position: fixed;
width: 100%;
bottom: 0;
left: 0;
z-index: 9999;
padding: 10PX 0;
.float-layer-left {
padding-left: 22PX;
overflow: hidden;
float: left;
img {
height: 44PX;
float: left;
margin-right: 10PX;
}
p {
float: left;
font-size: 16PX;
height: 44PX;
line-height: 44PX;
color: white;
}
.yoho-icon {
float: left;
margin-right: 10PX;
font-size: 22PX;
line-height: 44PX;
width: 44PX;
height: 44PX;
text-align: center;
color: #fff;
border-radius: 10PX;
background-image: linear-gradient(#323232, #0f0f0f);
}
height: 128px;
background: rgba(68, 68, 68, 0.95);
position: fixed;
width: 100%;
bottom: 0;
left: 0;
z-index: 9999;
padding: 20px 0;
.float-layer-left {
padding-left: 44px;
overflow: hidden;
float: left;
img {
height: 44px;
float: left;
margin-right: 20px;
}
p {
float: left;
font-size: 32px;
height: 88px;
line-height: 88px;
color: white;
}
.yoho-icon {
float: left;
margin-right: 10px;
font-size: 44px;
line-height: 88px;
width: 88px;
height: 88px;
text-align: center;
color: #fff;
border-radius: 20px;
background-image: linear-gradient(#323232, #0f0f0f);
}
}
}
#float-layer-close {
position: absolute;
left: 0;
top: 0;
width: 100px;
height: 100px;
.close-icon {
position: absolute;
left: 0;
top: 0;
width: 50PX;
height: 50PX;
.close-icon {
position: absolute;
left: 0;
top: 0;
color: #c0c0c0;
z-index: 2;
}
color: #C0C0C0;
z-index: 2;
}
}
#float-layer-btn {
position: absolute;
top: 50%;
right: 15PX;
font-size: 16PX;
padding: 0 10PX;
height: 27PX;
line-height: 27PX;
background: white;
border-radius: 5PX;
margin-top: -13PX;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0.5);
&:link,
&:visited,
&:hover,
&:active {
color: #000;
}
}
.circle-rightbottom {
position: absolute;
width: 25PX;
height: 0;
border: 0 solid #323232;
border-bottom: 25PX solid #323232;
border-radius: 0 0 25PX;
}
position: absolute;
top: 50%;
right: 15px;
font-size: 32px;
padding: 0 10px;
height: 54px;
line-height: 54px;
background: white;
border-radius: 5px;
margin-top: -26px;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0.5);
&:link,
&:visited,
&:hover,
&:actived {
color: #000;
}
}
\ No newline at end of file
... ...
... ... @@ -6,6 +6,26 @@
color: #444;
}
.my-header {
position: relative;
.students-entry {
display: block;
width: 120px;
height: 40px;
line-height: 40px;
border-top-left-radius: 40px;
border-bottom-left-radius: 40px;
background: #d0021b;
color: #fff;
padding-left: 20px;
position: absolute;
top: 20px;
right: 0;
font-size: 24px;
}
}
.user-info {
display: block;
position: relative;
... ... @@ -67,7 +87,7 @@
text-align: center;
&.highlight {
background: rgba(200, 200, 200, 0.1)!important;
background: rgba(200, 200, 200, 0.1) !important;
}
}
}
... ... @@ -107,13 +127,13 @@
}
&:after {
content: '';
content: "";
position: absolute;
right: 0;
top: 24px;
width: 0;
height: 44px;
border-right: 1px solid #fff;
border-right: 4px solid #fff;
}
&:last-of-type:after {
... ... @@ -250,7 +270,7 @@
}
&:after {
content: '';
content: "";
position: absolute;
right: 0;
bottom: 0;
... ...
... ... @@ -14,12 +14,6 @@
}
}
.limit-service {
height: 28px;
background: resolve('product/limit.png') no-repeat;
background-size: cover;
}
.detail {
margin-bottom: 1px;
}
... ...