Authored by 李靖

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

... ... @@ -20,9 +20,25 @@ exports.familyIndex = (req, res, next) => {
};
exports.familyVip = (req, res, next) => {
// let uid = req.user.uid;
let udid = req.sessionID || 'yoho';
let uid = req.user.uid;
req.ctx(family).familyVip(udid, uid).then(result => {
res.json(result);
}).catch(next);
};
exports.downLoadData = (req, res, next) => {
let params = {
yohoCode: '940a47540078396366bcb8b64b1ed0e7',
nowCode: 'ac12681cc68993fcfd20e40536a2aed2',
marsCode: '9f48cba22034cda2df8493ec9187797e',
coffeeCode: '357cae962a4e1a99d8f156850ad5dc78',
littleCode: 'ab1cbfb5b33d4e174ddb7ec49f734968',
greenCode: 'c2778fe64439251b67ffd1338fe982fb',
};
req.ctx(family).familyVip().then(result => {
req.ctx(family).downLoadData(params).then(result => {
res.json(result);
}).catch(next);
};
... ...
... ... @@ -95,35 +95,35 @@ class familyModel extends global.yoho.BaseModel {
iconUrl: 'http://img13.static.yhbimg.com/article/2017/08/23/10/0222be3d6a9d8a1617b89fcf35357a3593.png?imageView/{mode}/w/{width}/h/{height}',
sourceName: 'now',
source: 2,
login: false
login: true
},
{
uid: null,
iconUrl: 'http://img12.static.yhbimg.com/article/2017/08/23/10/02fe755abdc5d390252cf6df25c01dffae.png?imageView/{mode}/w/{width}/h/{height}',
sourceName: 'mars',
source: 3,
login: false
login: true
},
{
uid: null,
iconUrl: 'http://img11.static.yhbimg.com/article/2017/08/23/10/0112f200ab5ae424173fa2df7a490c80bf.png?imageView/{mode}/w/{width}/h/{height}',
sourceName: 'green',
source: 4,
login: false
login: true
},
{
uid: null,
iconUrl: 'http://img12.static.yhbimg.com/article/2017/08/23/10/022279d464ee6bd9ef86089c60e2832210.png?imageView/{mode}/w/{width}/h/{height}',
sourceName: 'coffee',
source: 5,
login: false
login: true
},
{
uid: null,
iconUrl: 'http://img10.static.yhbimg.com/article/2017/08/23/10/01a1704bc87316008d769443a8ae50ad7e.png?imageView/{mode}/w/{width}/h/{height}',
sourceName: 'life',
sourceName: 'little',
source: 6,
login: false
login: true
}
]
};
... ... @@ -151,230 +151,422 @@ class familyModel extends global.yoho.BaseModel {
/**
*查询各个体系成长等级信息及等级特权
*/
_getVipInfo() {
let result = {
code: 200,
data: {
mars: {
vipLevelList: [
{
growthValue: 100,
level: 0,
levelImg: "http://img01.yohomars.com/mars/2017/01/24/d1f9cb68a1e7aae4a1a6c4eeca7b1b0e.png?imageView/{mode}/w/{width}/h/{height}",
marsPointDiscount: 100
},
{
growthValue: 400,
level: 1,
levelImg: "http://img01.yohomars.com/mars/2017/01/24/5336ef84190a715bd221fca50a9e9e3d.png?imageView/{mode}/w/{width}/h/{height}",
marsPointDiscount: 100
},
{
growthValue: 1000,
level: 2,
levelImg: "http://img01.yohomars.com/mars/2017/01/24/1027321fcaf5311ab21963f925ecb0dd.png?imageView/{mode}/w/{width}/h/{height}",
marsPointDiscount: 95,
privilege: "mars points 9.5折兑换"
},
{
growthValue: 2000,
level: 3,
levelImg: "http://img01.yohomars.com/mars/2017/01/24/e4512e2c5e78140170bf4967c4368645.png?imageView/{mode}/w/{width}/h/{height}",
marsPointDiscount: 90,
privilege: "mars points 9折兑换"
},
{
growthValue: 5000,
level: 4,
levelImg: "http://img01.yohomars.com/mars/2017/01/24/312d0b334370eb8a9711065d489451ca.png?imageView/{mode}/w/{width}/h/{height}",
marsPointDiscount: 85,
privilege: "mars points 8.5折兑换"
},
{
growthVaue: 10000,
level: 5,
levelImg: "http://img01.yohomars.com/mars/2017/01/24/148be1f69f64ebc1872c43b5b4b7e620.png?imageView/{mode}/w/{width}/h/{height}",
marsPointDiscount: 80,
privilege: "mars points 8折兑换"
}
]
},
yohobuy: {
privilegeList: [
{
description: "在原折扣基础上享受VIP折上折",
id: 1,
pic: "http://static.yohobuy.com/images/app/icon_2x_zhekou.png",
title: "银卡会员购物9.5折"
},
{
description: "在原折扣基础上享受VIP折上折",
id: 2,
pic: "http://static.yohobuy.com/images/app/icon_2x_zhekou.png",
title: "金卡会员购物9.0折"
},
{
description: "在原折扣基础上享受VIP折上折",
id: 3,
pic: "http://static.yohobuy.com/images/app/icon_2x_zhekou.png",
title: "白金卡会员购物8.8折"
},
{
description: "年度级的sale促销活动中,VIP会员可以享受优先购买权",
id: 4,
pic: "http://static.yohobuy.com/images/app/icon_2x_niandu.png",
title: "年度活动优惠"
},
{
description: "白金卡会员的订单将采用最快速度进行免费配送,金卡会员的订单免费配送",
id: 5,
pic: "http://static.yohobuy.com/images/app/icon_2x_kssd.png",
title: "快速送达"
},
{
description: "浏览《YOHO!潮流志》、《YOHO!GIRL》电子版,最新最权威的潮流资讯尽在掌握!",
id: 6,
pic: "http://static.yohobuy.com/images/app/icon_2x_zzzy.png",
title: "电子杂志赠阅"
},
{
description: "赠送生日优惠券",
id: 8,
pic: "http://static.yohobuy.com/images/app/icon_2x_sryh.png",
title: "生日特惠"
},
{
description: "获取大量潮流新品及优惠活动的信息",
id: 9,
pic: "http://static.yohobuy.com/images/app/icon_2x_yhxx.png",
title: "优惠信息"
},
{
description: "参加\"VIP会员限定\"活动",
id: 10,
pic: "http://static.yohobuy.com/images/app/icon_2x_vip.png",
title: "VIP活动优惠"
}
],
vipLevelLis: [
{
growthValue: 0,
level: 0,
name: "普通会员",
privilege: ""
},
{
growthValue: 600,
level: 1,
name: "银卡会员",
privilege: "1,4,10,6,8,9"
},
{
growthValue: 2000,
level: 2,
name: "金卡会员",
privilege: "2,4,10,5,6,8,9"
},
{
growthValue: 5000,
level: 3,
name: "白金会员",
privilege: "3,4,10,5,6,8,9"
}
]
}
_getVipInfo(udid) {
return api.get('/yoho-family/vip/getVipInfo.json', {
udid: udid
}, {
code: 200
}).then((result) => {
// result = {
// code: 200,
// data: {
// mars: {
// vipLevelList: [
// {
// growthValue: 100,
// level: 0,
// levelImg: "http://img01.yohomars.com/mars/2017/01/24/d1f9cb68a1e7aae4a1a6c4eeca7b1b0e.png?imageView/{mode}/w/{width}/h/{height}",
// marsPointDiscount: 100
// },
// {
// growthValue: 400,
// level: 1,
// levelImg: "http://img01.yohomars.com/mars/2017/01/24/5336ef84190a715bd221fca50a9e9e3d.png?imageView/{mode}/w/{width}/h/{height}",
// marsPointDiscount: 100
// },
// {
// growthValue: 1000,
// level: 2,
// levelImg: "http://img01.yohomars.com/mars/2017/01/24/1027321fcaf5311ab21963f925ecb0dd.png?imageView/{mode}/w/{width}/h/{height}",
// marsPointDiscount: 95,
// privilege: "mars points 9.5折兑换"
// },
// {
// growthValue: 2000,
// level: 3,
// levelImg: "http://img01.yohomars.com/mars/2017/01/24/e4512e2c5e78140170bf4967c4368645.png?imageView/{mode}/w/{width}/h/{height}",
// marsPointDiscount: 90,
// privilege: "mars points 9折兑换"
// },
// {
// growthValue: 5000,
// level: 4,
// levelImg: "http://img01.yohomars.com/mars/2017/01/24/312d0b334370eb8a9711065d489451ca.png?imageView/{mode}/w/{width}/h/{height}",
// marsPointDiscount: 85,
// privilege: "mars points 8.5折兑换"
// },
// {
// growthVaue: 10000,
// level: 5,
// levelImg: "http://img01.yohomars.com/mars/2017/01/24/148be1f69f64ebc1872c43b5b4b7e620.png?imageView/{mode}/w/{width}/h/{height}",
// marsPointDiscount: 80,
// privilege: "mars points 8折兑换"
// }
// ]
// },
// yohobuy: {
// privilegeList: [
// {
// description: "在原折扣基础上享受VIP折上折",
// id: 1,
// pic: "http://static.yohobuy.com/images/app/icon_2x_zhekou.png",
// title: "银卡会员购物9.5折"
// },
// {
// description: "在原折扣基础上享受VIP折上折",
// id: 2,
// pic: "http://static.yohobuy.com/images/app/icon_2x_zhekou.png",
// title: "金卡会员购物9.0折"
// },
// {
// description: "在原折扣基础上享受VIP折上折",
// id: 3,
// pic: "http://static.yohobuy.com/images/app/icon_2x_zhekou.png",
// title: "白金卡会员购物8.8折"
// },
// {
// description: "年度级的sale促销活动中,VIP会员可以享受优先购买权",
// id: 4,
// pic: "http://static.yohobuy.com/images/app/icon_2x_niandu.png",
// title: "年度活动优惠"
// },
// {
// description: "白金卡会员的订单将采用最快速度进行免费配送,金卡会员的订单免费配送",
// id: 5,
// pic: "http://static.yohobuy.com/images/app/icon_2x_kssd.png",
// title: "快速送达"
// },
// {
// description: "浏览《YOHO!潮流志》、《YOHO!GIRL》电子版,最新最权威的潮流资讯尽在掌握!",
// id: 6,
// pic: "http://static.yohobuy.com/images/app/icon_2x_zzzy.png",
// title: "电子杂志赠阅"
// },
// {
// description: "赠送生日优惠券",
// id: 8,
// pic: "http://static.yohobuy.com/images/app/icon_2x_sryh.png",
// title: "生日特惠"
// },
// {
// description: "获取大量潮流新品及优惠活动的信息",
// id: 9,
// pic: "http://static.yohobuy.com/images/app/icon_2x_yhxx.png",
// title: "优惠信息"
// },
// {
// description: "参加\"VIP会员限定\"活动",
// id: 10,
// pic: "http://static.yohobuy.com/images/app/icon_2x_vip.png",
// title: "VIP活动优惠"
// }
// ],
// vipLevelLis: [
// {
// growthValue: 0,
// level: 0,
// name: "普通会员",
// privilege: ""
// },
// {
// growthValue: 600,
// level: 1,
// name: "银卡会员",
// privilege: "1,4,10,6,8,9"
// },
// {
// growthValue: 2000,
// level: 2,
// name: "金卡会员",
// privilege: "2,4,10,5,6,8,9"
// },
// {
// growthValue: 5000,
// level: 3,
// name: "白金会员",
// privilege: "3,4,10,5,6,8,9"
// }
// ]
// }
// }
// };
if (result.data.mars && result.data.mars.vipLevelList.length > 0) {
_.forEach(result.data.mars.vipLevelList, function(val) {
val.name = 'Lv.' + val.level;
});
}
};
return result.data;
return result.data;
});
}
/**
*查询当前用户各个体系成长等级信息及等级特权
*/
_getUserVipInfo() {
let result = {
data: {
mars: {
growthValue: 2000,
level: 4,
nextLevel: 5,
privilege: "mars points 8.5折兑换",
valueToNextLevel: 3000
},
yohobuy: {
growthValue: 1500,
level: 1,
name: "银卡会员",
nextLevel: 2,
valueToNextLevel: 500,
privilege: [
{
description: "在原折扣基础上享受VIP折上折",
id: 1,
pic: "http://static.yohobuy.com/images/app/icon_2x_zhekou.png",
title: "银卡会员购物9.5折"
},
{
description: "年度级的sale促销活动中,VIP会员可以享受优先购买权",
id: 4,
pic: "http://static.yohobuy.com/images/app/icon_2x_niandu.png",
title: "年度活动优惠"
},
{
description: "浏览《YOHO!潮流志》、《YOHO!GIRL》电子版,最新最权威的潮流资讯尽在掌握!",
id: 6,
pic: "http://static.yohobuy.com/images/app/icon_2x_zzzy.png",
title: "电子杂志赠阅"
},
{
description: "赠送生日优惠券",
id: 8,
pic: "http://static.yohobuy.com/images/app/icon_2x_sryh.png",
title: "生日特惠"
},
{
description: "获取大量潮流新品及优惠活动的信息",
id: 9,
pic: "http://static.yohobuy.com/images/app/icon_2x_yhxx.png",
title: "优惠信息"
},
{
description: "参加\"VIP会员限定\"活动",
id: 10,
pic: "http://static.yohobuy.com/images/app/icon_2x_vip.png",
title: "VIP活动优惠"
}
]
}
}
};
return result.data;
_getUserVipInfo(udid, uid) {
return api.get('/yoho-family/vip/getUserVipInfo.json', {
udid: udid,
uid: uid
}, {
code: 200
}).then((result) => {
// result = {
// data: {
// mars: {
// growthValue: 2000,
// level: 4,
// nextLevel: 5,
// privilege: "mars points 8.5折兑换",
// valueToNextLevel: 3000
// },
// yohobuy: {
// growthValue: 1500,
// level: 1,
// name: "银卡会员",
// nextLevel: 2,
// valueToNextLevel: 500,
// privilege: [
// {
// description: "在原折扣基础上享受VIP折上折",
// id: 1,
// pic: "http://static.yohobuy.com/images/app/icon_2x_zhekou.png",
// title: "银卡会员购物9.5折"
// },
// {
// description: "年度级的sale促销活动中,VIP会员可以享受优先购买权",
// id: 4,
// pic: "http://static.yohobuy.com/images/app/icon_2x_niandu.png",
// title: "年度活动优惠"
// },
// {
// description: "浏览《YOHO!潮流志》、《YOHO!GIRL》电子版,最新最权威的潮流资讯尽在掌握!",
// id: 6,
// pic: "http://static.yohobuy.com/images/app/icon_2x_zzzy.png",
// title: "电子杂志赠阅"
// },
// {
// description: "赠送生日优惠券",
// id: 8,
// pic: "http://static.yohobuy.com/images/app/icon_2x_sryh.png",
// title: "生日特惠"
// },
// {
// description: "获取大量潮流新品及优惠活动的信息",
// id: 9,
// pic: "http://static.yohobuy.com/images/app/icon_2x_yhxx.png",
// title: "优惠信息"
// },
// {
// description: "参加\"VIP会员限定\"活动",
// id: 10,
// pic: "http://static.yohobuy.com/images/app/icon_2x_vip.png",
// title: "VIP活动优惠"
// }
// ]
// }
// }
// };
return result.data;
});
}
/**
*各个app的会员信息
*/
familyVip() {
familyVip(udid, uid) {
return Promise.all([
this._getVipInfo(),
this._getUserVipInfo()
this._getVipInfo(udid),
this._getUserVipInfo(udid, uid)
]).then((result) => {
_.forEach(result[1], function(val, key) {
_.forEach(result[0], function(data, index) {
if (index === key) {
val = _.assign(val, {
vipLevelLis: data.vipLevelLis
vipLevelLis: data.vipLevelList
});
}
});
});
if (key === 'yohobuy') {
if (val.growthValue <= 0) {
val.percent = 0;
} else if (val.growthValue > 0 && val.growthValue < 800) {
val.percent = 17;
} else if (val.growthValue === 800) {
val.valpercent = 33;
} else if (val.growthValue > 800 && val.growthValue < 3000) {
val.percent = 50;
} else if (val.growthValue === 3000) {
val.percent = 67;
} else if (val.growthValue > 3000 && val.growthValue < 7000) {
val.percent = 83;
} else {
val.percent = 100;
}
}
if (key === 'mars') {
if (val.growthValue <= 100) {
val.percent = 0;
} else if (val.growthValue > 100 && val.growthValue < 400) {
val.percent = 10;
} else if (val.growthValue === 400) {
val.valpercent = 20;
} else if (val.growthValue > 400 && val.growthValue < 1000) {
val.percent = 30;
} else if (val.growthValue === 1000) {
val.percent = 40;
} else if (val.growthValue > 1000 && val.growthValue < 2000) {
val.percent = 50;
} else if (val.growthValue === 2000) {
val.percent = 60;
} else if (val.growthValue > 2000 && val.growthValue < 5000) {
val.percent = 70;
} else if (val.growthValue === 5000) {
val.percent = 80;
} else if (val.growthValue > 5000 && val.growthValue < 10000) {
val.percent = 90;
} else {
val.percent = 100;
}
}
if (key === 'green') {
if (val.growthValue <= 0) {
val.percent = 0;
} else if (val.growthValue > 0 && val.growthValue < 1000) {
val.percent = 17;
} else if (val.growthValue === 1000) {
val.valpercent = 33;
} else if (val.growthValue > 1000 && val.growthValue < 3000) {
val.percent = 50;
} else if (val.growthValue === 3000) {
val.percent = 67;
} else if (val.growthValue > 3000 && val.growthValue < 5000) {
val.percent = 83;
} else {
val.percent = 100;
}
}
if (key === 'green') {
if (val.growthValue <= 0) {
val.percent = 0;
} else if (val.growthValue > 0 && val.growthValue < 1000) {
val.percent = 17;
} else if (val.growthValue === 1000) {
val.valpercent = 33;
} else if (val.growthValue > 1000 && val.growthValue < 3000) {
val.percent = 50;
} else if (val.growthValue === 3000) {
val.percent = 67;
} else if (val.growthValue > 3000 && val.growthValue < 5000) {
val.percent = 83;
} else {
val.percent = 100;
}
}
if (key === 'coffee') {
if (val.growthValue <= 0) {
val.percent = 0;
} else if (val.growthValue > 0 && val.growthValue < 800) {
val.percent = 25;
} else if (val.growthValue === 800) {
val.valpercent = 50;
} else if (val.growthValue > 800 && val.growthValue < 2000) {
val.percent = 75;
} else {
val.percent = 100;
}
}
if (key === 'little') {
if (val.growthValue <= 0) {
val.percent = 0;
} else if (val.growthValue > 0 && val.growthValue < 5000) {
val.percent = 25;
} else if (val.growthValue === 5000) {
val.valpercent = 50;
} else if (val.growthValue > 5000 && val.growthValue < 10000) {
val.percent = 75;
} else {
val.percent = 100;
}
}
});
return result[1];
});
}
/**
* 下载弹窗数据处理
*/
_downLoadProce(data, name) {
let singleData;
_.forEach(data, function(val) {
singleData = _.assign(singleData, {
appName: name,
imgList: val.data
});
});
return singleData;
}
/**
* 下载弹窗信息
*/
downLoadData(params) {
return Promise.all([
this._getTrendPop(params.yohoCode),
this._getTrendPop(params.nowCode),
this._getTrendPop(params.marsCode),
this._getTrendPop(params.coffeeCode),
this._getTrendPop(params.littleCode),
this._getTrendPop(params.greenCode)
]).then((result) => {
let finData = {
downLoadData: []
};
if (result[0]) {
finData.downLoadData.push(this._downLoadProce(result[0], 'yohobuy'));
}
if (result[1]) {
finData.downLoadData.push(this._downLoadProce(result[1], 'now'));
}
if (result[2]) {
finData.downLoadData.push(this._downLoadProce(result[2], 'mars'));
}
if (result[3]) {
finData.downLoadData.push(this._downLoadProce(result[3], 'coffee'));
}
if (result[4]) {
finData.downLoadData.push(this._downLoadProce(result[4], 'little'));
}
if (result[5]) {
finData.downLoadData.push(this._downLoadProce(result[5], 'green'));
}
return finData;
});
}
/**
* family主页
*/
familyIndex(uid, contentCodeOne, contentCodeTwo) {
return Promise.all([
this._userData(uid),
... ...
... ... @@ -177,8 +177,9 @@ router.post('/return/exchange/cancel-apply', auth, exchange.cancelApply); // AJA
router.get('/tide-command', auth, tideCommand.tideCommand); // 设置潮流口令
router.get('/family', auth, family.familyIndex); // family首页
router.get('/family', auth, disableBFCache, family.familyIndex); // family首页
router.get('/family/vipDetailData', auth, family.familyVip); // 获取VIP信息
router.get('/family/downLoadData', family.downLoadData); // 下载弹窗
router.get('/family/coinDetail', auth, family.coinDetail); // 积分详情页
router.get('/family/coinDetail/getCoinData', auth, family.getCoinData); // 筛选积分详情
router.get('/family/userInfo', auth, disableBFCache, family.userInfo); // family个人信息页
... ...
... ... @@ -6,7 +6,7 @@
<span class="headings"></span>
</div>
<div class="person-detail">
<a href="/home/family/userInfo" class="user-avatar" data-avatar="{{head_ico}}"></a>
<a href="/home/family/userInfo" class="user-avatar" data-avatar="{{image head_ico 80 80}}"></a>
<div class="basic-info">
<span class="user-name">{{nickname}}</span>
<span class="gender {{#isEqualOr gender 1}}boy{{/isEqualOr}}{{#isEqualOr gender 2}}girl{{/isEqualOr}}"></span>
... ... @@ -52,7 +52,7 @@
<div class="integral">
<div class="title">积分乐园</div>
<div class="integral-content">
<div class="charts" id="charts" style="width: 8rem; height: 8rem;"></div>
<div class="charts" id="charts" style="width: 8.5rem; height: 8.5rem;"></div>
</div>
</div>
... ... @@ -74,10 +74,3 @@
<div class="dia-c"></div>
{{/ familyIndexData}}
</div>
<!-- <div class="down-load-detail yohobuy">
<div class="close"></div>
<div class="back"></div>
<div class="detail-content">
</div>
</div> -->
\ No newline at end of file
... ...
... ... @@ -11,15 +11,20 @@ const isProduction = process.env.NODE_ENV === 'production';
const isTest = process.env.NODE_ENV === 'test';
const domains = {
api: 'http://api.yoho.cn/',
service: 'http://service.yoho.cn/',
singleApi: 'http://api-test3.yohops.com:9999/',
global: 'http://global-test-soa.yohops.com:9999',
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test3.yohops.com:9999/',
api: 'http://192.168.102.202:8026/yoho-family',
service: 'http://192.168.102.202:8026/yoho-family',
// api: 'http://api-test3.yohops.com:9999/',
// service: 'http://service-test3.yohops.com:9999/',
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/',
imSocket: 'ws://socket.yohobuy.com:10240',
imCs: 'http://im.yohobuy.com/api',
platformApi: 'http://192.168.102.48:8088/',
store: 'http://192.168.102.47:8080/portal-gateway/wechat/'
global: 'http://api-global.yohobuy.com',
store: 'http://192.168.102.47:8080/portal-gateway/'
};
module.exports = {
... ...
<div class="down-load-detail hide">
<div class="down-close"></div>
<div class="back"></div>
<div class="detail-content">
{{# downLoadData}}
<div class="{{appName}} hide">
{{#imgList}}
<img src="{{image src 640 1049}}">
{{/imgList}}
</div>
{{/ downLoadData}}
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -43,7 +43,7 @@
当前可享受特权
<a class="more">更多</a>
</div>
{{# privilege}}
{{# privilegeList}}
<a class="privilege-item">
<img class="icon" src="{{pic}}">
<p>
... ... @@ -51,11 +51,11 @@
<span>{{description}}</span>
</p>
</a>
{{/ privilege}}
{{/ privilegeList}}
{{# privilegeCro}}
<div class="level-item">
<img class="item-ico" src="{{image iconUrl 125 125}}">
<span class="le-name">{{sourceName}}发的我客来福侧那我可掉入了</span>
<span class="le-name">{{sourceName}}</span>
<span class="state">已开启</span>
</div>
{{/ privilegeCro}}
... ...
... ... @@ -5,6 +5,7 @@ import tip from 'plugin/tip';
import yoho from 'yoho-app';
import integral from 'home/integral-paradise.hbs';
import vipDetailInfo from 'home/vip-detail.hbs';
import downLoadInfo from 'home/down-load-detail.hbs';
const Swiper = require('yoho-swiper2');
const echarts = require('echarts/lib/echarts');
... ... @@ -30,12 +31,14 @@ class FamilyIndex extends Page {
$userName: $('.user-name'),
$trendWord: $('.trend-word'),
$wordOuter: $('.word-outer'),
$bannerCenterSwiper: $('.banner-center-swiper')
$bannerCenterSwiper: $('.banner-center-swiper'),
$back: $('.back')
};
this.view = {
integral,
vipDetailInfo
vipDetailInfo,
downLoadInfo
};
this.vipInfo;
... ... @@ -51,14 +54,16 @@ class FamilyIndex extends Page {
this.initTrend();
this.trendWordMarquee();
this.resources();
this.downLoadInfo();
}
bindEvents() {
this.selector.$codeSet.on('click', this.setTrendPop.bind(this));
this.selector.$textarea.on('blur', this.saveTrendWord.bind(this));
this.selector.integralCh.on('click', this.jump.bind(this));
this.selector.$contentItem.on('click', this.showVipInfo.bind(this));
this.selector.$contentItem.on('click', this.showInfo.bind(this));
this.selector.$diaC.on('click', this.selector.$close, this.hideVipInfo.bind(this));
this.selector.$back.on('click', this.goBack.bind(this));
}
// 头像
... ... @@ -79,6 +84,7 @@ class FamilyIndex extends Page {
}
}
// 潮流口令初始化判断
initTrend() {
if (this.selector.$trendWord.eq(0).width() > parseInt(this.selector.$wordOuter.css('max-width'), 10)) {
... ... @@ -110,12 +116,12 @@ class FamilyIndex extends Page {
total: 18922,
totalHref: location.protocol + '//m.yohobuy.com/home/family/coinDetail?openby:yohobuy={"action":"go.h5","params":{"url":"' + location.protocol + '//m.yohobuy.com/home/family/coinDetail"}}', // eslint-disable-line
data: [
{value: 40, name: 'rose2', color: '#000', percent: '20%', plateType: 1},
{value: 50, name: 'rose2', color: '#000', percent: '20%', plateType: 1},
{value: 35, name: 'rose3', plateType: 2},
{value: 30, name: 'rose4', plateType: 3},
{value: 25, name: 'rose5'},
{value: 20, name: 'rose6'},
{value: 15, name: 'rose7'},
{value: 15, name: 'yoho!Bowb'},
]
};
... ... @@ -127,9 +133,9 @@ class FamilyIndex extends Page {
series: [
{
type: 'pie',
radius: [this.selector.chartWidth / 3, this.selector.chartWidth / 2],
radius: [this.selector.chartWidth * 3 / 10, this.selector.chartWidth * 23 / 50],
roseType: 'radius',
center: ['50%', '50%'],
center: ['48%', '50%'],
label: {
normal: false
},
... ... @@ -164,6 +170,20 @@ class FamilyIndex extends Page {
});
}
// 下载弹窗初始页面渲染
downLoadInfo() {
this.ajax({
type: 'GET',
url: location.protocol + '//m.yohobuy.com/home/family/downLoadData'
}).then(result => {
$('.yoho-family-page').append(this.view.downLoadInfo(result));
this.selector.$downLoadDetail = $('.down-load-detail');
this.selector.$downClose = $('.down-close');
this.selector.$downClose.on('click', this.downClose.bind(this));
});
}
// 设置潮流口令
setTrendPop() {
this.selector.$invition.hide();
... ... @@ -208,8 +228,8 @@ class FamilyIndex extends Page {
yoho.goH5(`${location.protocol}//m.yohobuy.com/home/family/coinDetail?plateType=${params.data.plateType}`);
}
// 点击APP图标显示会员信息
showVipInfo(e) {
// 点击APP图标显示信息
showInfo(e) {
let $this = $(e.currentTarget);
let appType = $this.data('name').toLowerCase();
let isLogin = $this.data('login');
... ... @@ -232,6 +252,11 @@ class FamilyIndex extends Page {
if (this.selector.$userName.text() !== '') {
$('.intro .name span').text($('.user-name').text() + ',');
}
} else {
this.selector.$downLoadDetail.removeClass('hide');
this.selector.$downLoadDetail.find('.detail-content .' + appType).removeClass('hide');
this.selector.$downLoadDetail.find('.detail-content .' + appType).siblings().addClass('hide');
}
}
... ... @@ -239,6 +264,18 @@ class FamilyIndex extends Page {
hideVipInfo() {
$('.vip-detail').remove();
}
// 返回上一页
goBack() {
if (yoho.isApp) {
yoho.invokeMethod('go.back');
}
}
downClose() {
this.selector.$downLoadDetail.addClass('hide');
}
}
$(() => {
... ...
@import "layout/swiper";
@import "family/down-load";
.yoho-family-page {
background-color: #f0f0f0;
... ... @@ -15,10 +16,10 @@
padding: 34px 30px 0;
.back {
width: 20px;
width: 40px;
height: 40px;
background-image: resolve("home/family/back.png");
background-size: 100% 100%;
background-size: 50% 100%;
background-repeat: no-repeat;
display: block;
float: left;
... ... @@ -232,10 +233,10 @@
}
.integral-total {
width: 200px;
width: 180px;
position: relative;
top: 104px;
left: -260px;
top: 110px;
left: -264px;
text-align: center;
overflow: hidden;
border-radius: 39px;
... ... @@ -611,21 +612,97 @@
background-repeat: no-repeat;
background-size: 100%;
}
.user-info {
.level-process {
.line-c {
width: 530px;
}
.point {
width: 540px;
}
.point-item {
margin-right: 80px;
}
}
}
}
.yocoffee {
.coffee {
.banner {
background-image: resolve("home/family/vip-detail/yocoffee.jpg");
background-repeat: no-repeat;
background-size: 100%;
}
.user-info {
.level-process {
.line-c {
width: 530px;
}
.point {
width: 540px;
}
.point-item {
margin-right: 232px;
}
}
}
}
.yogreen {
.green {
.banner {
background-image: resolve("home/family/vip-detail/yogreen.jpg");
background-repeat: no-repeat;
background-size: 100%;
}
.user-info {
.level-process {
.line-c {
width: 520px;
}
.point {
width: 540px;
}
.point-item {
margin-right: 146px;
}
}
}
}
.little {
.banner {
background-image: resolve("home/family/vip-detail/yolittle.jpg");
background-repeat: no-repeat;
background-size: 100%;
}
.user-info {
.level-process {
.line-c {
width: 530px;
}
.point {
width: 540px;
}
.point-item {
margin-right: 232px;
}
}
}
}
}
... ...
... ... @@ -5,7 +5,7 @@
height: 100%;
z-index: 5;
.close {
.down-close {
height: 50px;
width: 50px;
background-image: resolve("home/family/close.png");
... ... @@ -30,121 +30,29 @@
}
.detail-content {
width: 630px;
height: auto;
margin-top: 109px;
position: fixed;
top: 0;
left: 50%;
margin-left: -315px;
border-radius: 10px;
.banner-title {
margin: 0 auto;
}
.code {
width: 180px;
height: 180px;
margin: 0 auto;
}
}
.yohobuy {
background-color: red;
.detail-banner {
width: auto;
height: auto;
margin-top: 50px;
margin-bottom: 80px;
.banner-title {
background-image: resolve("home/family/down-load/yohobuy.png");
background-size: 100%;
background-repeat: no-repeat;
width: 380px;
height: 100px;
}
.bannner-subtitle {
border: 1px solid;
width: 330px;
height: 45px;
margin: 10px auto;
}
}
.main-description {
background-image: resolve("home/family/down-load/words.png");
background-size: 100%;
background-repeat: no-repeat;
width: 570px;
height: 360px;
margin: 0 auto;
}
.code {
background-image: resolve("home/family/down-load/erweima_yohobuy.png");
background-size: 100%;
background-repeat: no-repeat;
margin-bottom: 50px;
}
}
.yohobuy,
.now,
.mars {
background-image: resolve("home/family/down-load/mars-bg.png");
background-size: 100%;
background-repeat: no-repeat;
.detail-banner {
margin: 90px auto;
.banner-title {
background-image: resolve("home/family/down-load/mars-title.png");
background-size: 100%;
background-repeat: no-repeat;
width: 270px;
height: 110px;
}
}
.code {
background-image: resolve("home/family/down-load/erweima_mars.png");
background-size: 100%;
background-repeat: no-repeat;
margin-bottom: 90px;
}
}
.coffee {
width: 630px;
height: 600px;
background-color: #fff;
border: 1px solid;
.main-description {
margin-top: 50px;
.showcasing {
width: 670px;
height: 300px;
overflow: hidden;
position: relative;
left: -20px;
margin-left: -315px;
}
.showcasing-item {
margin-right: 20px;
width: 210px;
height: 300px;
border: 1px solid red;
float: left;
}
.coffee,
.little,
.green {
width: 670px;
margin-left: -340px;
}
.showcasing-item:last-child {
margin-right: 0;
}
}
}
.hide {
display: none;
}
}
\ No newline at end of file
... ...