Authored by 郭成尧

Merge branch 'feature/family' into 'gray'

family



See merge request !1034
... ... @@ -7,11 +7,12 @@ exports.familyIndex = (req, res, next) => {
let uid = req.user.uid;
let contentCodeOne = '486e6adc7c83001b2e9e83996438fab8';
let contentCodeTwo = 'eebbcc60607ac443922d8fabe44eb222';
let isMarsApp = req.yoho.isMarsApp;
req.ctx(family).familyIndex(uid, contentCodeOne, contentCodeTwo).then(result => {
req.ctx(family).familyIndex(uid, contentCodeOne, contentCodeTwo, isMarsApp).then(result => {
res.render('family/index', {
page: 'family',
title: 'family',
title: 'YOHO!Family',
width750: true,
localCss: true,
familyIndexData: result
... ... @@ -30,7 +31,7 @@ exports.integralCharts = (req, res, next) => {
exports.familyVip = (req, res, next) => {
let udid = req.sessionID || 'yoho';
let uid = req.user.uid;
let yohoApp = req.yoho.isApp && !req.yoho.isMarsApp;
let yohoApp = req.yoho.isYohoApp;
let marsApp = req.yoho.isMarsApp;
req.ctx(family).familyVip(udid, uid, yohoApp, marsApp).then(result => {
... ... @@ -40,13 +41,13 @@ exports.familyVip = (req, res, next) => {
exports.downLoadData = (req, res, next) => {
let codeArr = req.query.codeArr;
let yohoApp = req.yoho.isApp && !req.yoho.isMarsApp;
let isApp = req.yoho.isApp;
if (!codeArr) {
return;
}
req.ctx(family).downLoadData(codeArr, yohoApp).then(result => {
req.ctx(family).downLoadData(codeArr, isApp).then(result => {
res.json(result);
}).catch(next);
};
... ... @@ -68,7 +69,7 @@ exports.coinDetail = (req, res) => {
pageHeader: headerModel.setNav({
navTitle: '积分明细'
}),
title: 'YOHO!积分明细',
title: '积分明细',
width750: true,
localCss: true
};
... ... @@ -99,14 +100,16 @@ exports.userInfo = (req, res, next) => {
pageHeader: headerModel.setNav({
navTitle: '个人信息'
}),
title: 'YOHO!个人信息',
title: '个人信息',
width750: true,
localCss: true
};
let params = {
uid: req.user.uid,
isApp: req.yoho.isApp
isYohoApp: req.yoho.isYohoApp,
isMarsApp: req.yoho.isMarsApp,
isNowApp: req.yoho.isNowApp
};
req.ctx(family).userInfo(params).then(result => {
... ... @@ -149,7 +152,7 @@ exports.coinMall = (req, res, next) => {
pageHeader: headerModel.setNav({
navTitle: '积分商城'
}),
title: 'YOHO!积分商城',
title: '积分商城',
width750: true,
localCss: true
};
... ... @@ -170,7 +173,10 @@ exports.getList = (req, res, next) => {
uid: req.user.uid,
type: req.query.type,
page: req.query.page,
limit: req.query.limit
limit: req.query.limit,
isMarsApp: req.yoho.isMarsApp,
isNowApp: req.yoho.isNowApp,
cityId: req.cookies.app_city_id || 0
};
req.ctx(family).getList(params).then((result) => {
... ...
... ... @@ -116,6 +116,11 @@ class familyModel extends global.yoho.BaseModel {
if (val) {
val.nickname = key;
if (key === 'now') {
val.isNoOpen = true;
val.name = '敬请期待';
}
if (val.login === true) {
loginList.push(val);
} else {
... ... @@ -345,6 +350,20 @@ class familyModel extends global.yoho.BaseModel {
});
}
}
if (val.appName === 'yohobuy') {
singleData = _.assign(singleData, {
loadSrc: 'http://union.yoho.cn/union/app-downloads.html?union_type=100000000000349&openby:yohobuy={"action":"go.h5","params":{"url":"http://union.yoho.cn/union/app-downloads.html?union_type=100000000000349"}}'
});
} else if (val.appName === 'mars') {
singleData = _.assign(singleData, {
loadSrc: 'http://www.yohomars.com/download/index?action=go.index&params:yohomars://yohomars.com/goapp&openby:yohobuy={"action":"go.h5","params":{"url": "http://www.yohomars.com/download/index?action=go.index&params:yohomars://yohomars.com/goapp"}}'
});
} else if (val.appName === 'now') {
singleData = _.assign(singleData, {
loadSrc: 'http://www.yohogirls.com/download/default/index?act=go.news&params=yohoefashion4In1://&openby:yohobuy={"action":"go.h5","params": {"url":"http://www.yohogirls.com/download/default/index?act=go.news&params=yohoefashion4In1://"}}'
});
}
});
return singleData;
... ... @@ -388,13 +407,15 @@ class familyModel extends global.yoho.BaseModel {
return b.proportion - a.proportion;
});
chartsData.total = _.get(result.data, 'total', '');
if (_.get(result.data, 'total', 0)) {
chartsData.total = parseInt(result.data.total, 10) < 99999 ? result.data.total : '99999+';
}
_.forEach(result.data.data, function(data) {
list.push({
value: data.num,
name: data.source,
percent: parseInt(data.proportion, 10) * 100 + '%',
percent: parseFloat(data.proportion).toFixed(2) * 100 + '%',
color: data.colour,
plateType: data.type
});
... ... @@ -412,7 +433,7 @@ class familyModel extends global.yoho.BaseModel {
/**
* family主页
*/
familyIndex(uid, contentCodeOne, contentCodeTwo) {
familyIndex(uid, contentCodeOne, contentCodeTwo, isMarsApp) {
return Promise.all([
this._userData(uid),
this._getCode(uid),
... ... @@ -450,6 +471,12 @@ class familyModel extends global.yoho.BaseModel {
familyIndexData.townContent = result[4];
}
if (isMarsApp) {
familyIndexData.userInfoLink = 'http://m.yohobuy.com/home/family/userInfo?openby:mars={"action":"go.h5","params":{"url":"http://m.yohobuy.com/home/family/userInfo"}}';
} else {
familyIndexData.userInfoLink = 'http://m.yohobuy.com/home/family/userInfo?openby:yohobuy={"action":"go.h5","params":{"url":"http://m.yohobuy.com/home/family/userInfo"}}';
}
return familyIndexData;
});
}
... ... @@ -475,14 +502,14 @@ class familyModel extends global.yoho.BaseModel {
};
let _this = this;
if (_.get(result, 'data.coinlist')) {
_.forEach(result.data.coinlist, function(val) {
if (_.get(result, 'data.data')) {
_.forEach(result.data.data, function(val) {
Object.assign(val, {
typeName: _this.checkType(val.iconType),
minus: parseInt(val.num, 10) < 0
});
});
resu.coinList = result.data.coinlist;
resu.coinList = result.data.data;
}
return resu;
... ... @@ -519,16 +546,16 @@ class familyModel extends global.yoho.BaseModel {
let hideTips = true;
result[0].data.gender = (thisGender === '1' ? '男' : '女');
result[0].data.otherGender = (thisGender === '1' ? '女' : '男');
if (result[0].data.gender === '男') {
result[0].data.gender = (thisGender === '1' ? 'BOY' : 'GIRL');
result[0].data.otherGender = (thisGender === '1' ? 'GIRL' : 'BOY');
if (result[0].data.gender === 'BOY') {
result[0].data.genderId = 1;
result[0].data.otherGenderId = 2;
} else {
result[0].data.genderId = 2;
result[0].data.otherGenderId = 1;
}
if (params.isApp) {
if (params.isYohoApp || params.isNowApp) {
result[0].data.qrcodeLink = `http://m.yohobuy.com?openby:yohobuy={"action":"go.h5","params":{
"url":"http://m.yohobuy.com/home/user/qrcode",
"param": {
... ... @@ -544,6 +571,22 @@ class familyModel extends global.yoho.BaseModel {
"hideTips":"${hideTips}"
}
}}`;
} else if (params.isMarsApp) {
result[0].data.qrcodeLink = `http://m.yohobuy.com?openby:mars={"action":"go.h5","params":{
"url":"http://m.yohobuy.com/home/user/qrcode",
"param": {
"token":"${token}",
"icon":"${icon}",
"uname":"${name}",
"vip":"${vip}"
}
}}`;
result[0].data.trendLink = `http://m.yohobuy.com?openby:mars={"action":"go.h5","params":{
"url":"http://m.yohobuy.com/home/tide-command?hideTips=true",
"param": {
"hideTips":"${hideTips}"
}
}}`;
} else {
result[0].data.qrcodeLink = helpers.urlFormat('/home/user/qrcode', {
token: token,
... ... @@ -613,7 +656,8 @@ class familyModel extends global.yoho.BaseModel {
uid: params.uid,
type: params.type,
page: params.page || 1,
limit: params.limit || 10,
limit: params.limit || 20,
city_id: params.cityId
}, {
code: 200
}).then(result => {
... ... @@ -624,33 +668,56 @@ class familyModel extends global.yoho.BaseModel {
if (_.get(result, 'data.list')) {
resu.list = result.data.list;
}
_.forEach(resu.list, function(val) {
if (params.isMarsApp && params.type === 'mars') {
val.usable = true;
}
if (params.isNowApp && params.type === 'now') {
val.usable = true;
}
if (params.type === 'now') {
val.point = val.point.toString();
if (parseInt(val.stock, 10) === 0) {
val.noStore = true;
}
val.stock = val.stock.toString();
}
if (params.type === 'mars') {
val.points = val.points.toString();
if (parseInt(val.num, 10) === 0) {
val.noStore = true;
}
if (parseInt(val.exchangeEndTime, 10) !== 0 && parseInt(val.exchangeStartTime, 10) !== 0) {
if (parseInt(Date.now(), 10) > parseInt(val.exchangeEndTime, 10) || parseInt(Date.now(), 10) < parseInt(val.exchangeStartTime, 10)) { // eslint-disable-line
val.noStore = true;
}
}
val.num = val.num.toString();
}
});
return resu;
});
}
coinMall(params) {
return family.get('user/getUserCoin', {
return family.get('user/getTotalCoin', {
uid: params.uid
}, {
code: 200
}).then(result => {
let resu = {
coinNum: {},
isMarsApp: params.isMarsApp,
isNowApp: params.isNowApp
};
if (_.get(result, 'data.data')) {
_.forEach(result.data.data, (val) => {
let name = this.checkType(parseInt(val.type, 10));
resu.coinNum[name] = {
num: val.num,
source: val.source
};
});
if (result && result.code === 200) {
return result.data;
} else {
return {};
}
return resu;
});
}
... ...
<div class="coin-mall-c">
<div class="coin{{#if isNowApp}} now{{/if}}">
{{#if isNowApp}}
<span class="coin-pic yohonow"></span>
{{else if isMarsApp}}
<span class="coin-pic mars"></span>
{{else}}
<span class="coin-pic yohobuy"></span>
{{/if}}
<span>
{{#if isNowApp}}
{{coinNum/yohonow/num}}
{{else if isMarsApp}}
{{coinNum/mars/num}}
{{else}}
{{coinNum/yohobuy/num}}
{{/if}}
</span>
<span>{{coinNum}}</span>
</div>
<div class="btn-c">
{{#if isNowApp}}
<a href='//m.yohobuy.com/service/qaDetail?keyword=有货币&sonId=227&openby:yohobuy={"action":"go.h5","params":{"url":"http://m.yohobuy.com/service/qaDetail","param":{"keyword":"有货币","sonId":"227"}}}'>如何获取Yoho!Coins</a>
<a href='//m.yohobuy.com/home/family/coinDetail?plateType=3&openby:yohobuy={"action":"go.h5","params":{"url":"http://m.yohobuy.com/home/family/coinDetail","param":{"plateType":"3"}}}'>Yoho!Coins明细</a>
<a class="acquiring-help">如何获取Yoho!Coins</a>
<a class="detail">Yoho!Coins明细</a>
{{else if isMarsApp}}
<a href='//m.yohobuy.com/service/qaDetail?keyword=有货币&sonId=227&openby:yohobuy={"action":"go.h5","params":{"url":"http://m.yohobuy.com/service/qaDetail","param":{"keyword":"有货币","sonId":"227"}}}'>如何获取mars points</a>
<a href='//m.yohobuy.com/home/family/coinDetail?plateType=2&openby:yohobuy={"action":"go.h5","params":{"url":"http://m.yohobuy.com/home/family/coinDetail","param":{"plateType":"2"}}}'>mars points明细</a>
<a class="acquiring-help">如何获取mars points</a>
<a class="detail">mars points明细</a>
{{else}}
<a href='//m.yohobuy.com/service/qaDetail?keyword=有货币&sonId=227&openby:yohobuy={"action":"go.h5","params":{"url":"http://m.yohobuy.com/service/qaDetail","param":{"keyword":"有货币","sonId":"227"}}}'>如何获取有货币</a>
<a href='//m.yohobuy.com/home/family/coinDetail?plateType=1&openby:yohobuy={"action":"go.h5","params":{"url":"http://m.yohobuy.com/home/family/coinDetail","param":{"plateType":"1"}}}'>有货币明细</a>
... ...
... ... @@ -6,7 +6,7 @@
<span class="headings"></span>
</div>
<div class="person-detail">
<a href='http://m.yohobuy.com/home/family/userInfo?openby:yohobuy={"action":"go.h5","params":{"url":"http://m.yohobuy.com/home/family/userInfo"}}' class="user-avatar" data-avatar="{{image head_ico 80 80}}"></a>
<a href='{{userInfoLink}}' 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>
... ... @@ -23,14 +23,14 @@
<span class="trend-word">{{trendWord}}</span>
</span>
#
{{else}}
{{else if inviteCode}}
{{inviteCode}}
{{else}}
玩转潮流口令
{{/if}}
</span>
<span class="code-set"></span>
{{#unless trendWord}}
<span class="code-tip"></span>
{{/unless}}
</div>
<div class="inviton-set hide">
<textarea maxlength="15" placeholder="请输入你的潮流口令"></textarea>
... ... @@ -41,8 +41,8 @@
<div class="title">会员等级及权益</div>
<div class="grade-content">
{{# appList}}
<div class="content-item" data-login="{{login}}" data-name="{{nickname}}" data-code="{{code}}">
<img class="item-tag" src="{{image iconUrl 140 140}}">
<div class="content-item" data-login="{{login}}" data-name="{{nickname}}" data-code="{{code}}" {{#if isNoOpen}}data-noopen="{{isNoOpen}}"{{/if}}>
<img class="item-tag {{#unless login}}gray{{/unless}}" src="{{image iconUrl 140 140}}">
<span class="name">{{sourceName}}</span>
<span class="level">{{name}}</span>
</div>
... ...
... ... @@ -2,12 +2,14 @@
<div class="info-list">
<div class="list-item user-pic">
<div class="title">头像</div>
<div class="main">
<div class="main" {{#unlessor isYohoApp isMarsApp}}style="padding-right: 0rem"{{/unlessor}}>
<div class="pic user-avatar" data-avatar="{{image headIco 100 100}}"></div>
</div>
{{#ifor isYohoApp isMarsApp}}
<div class="arr">
<span class="iconfont">&#xe604;</span>
</div>
{{/ifor}}
</div>
<div class="list-item">
<div class="title">昵称</div>
... ... @@ -76,7 +78,7 @@
<div class="title">身高</div>
<div class="main">
<label>cm</label>
<input class="inp inp-2 height modify" type="number" value="{{height}}" />
<input class="inp inp-2 height modify bottom-out" type="number" value="{{height}}" />
</div>
<div class="arr">
<span class="iconfont">&#xe604;</span>
... ... @@ -86,7 +88,7 @@
<div class="title">体重</div>
<div class="main">
<label>kg</label>
<input class="inp inp-2 weight modify" type="number" value="{{weight}}" />
<input class="inp inp-2 weight modify bottom-out" type="number" value="{{weight}}" />
</div>
<div class="arr">
<span class="iconfont">&#xe604;</span>
... ...
... ... @@ -9,13 +9,13 @@
{{else}}
<div class="banner-center banner-center-swiper">
<ul class="banner-list swiper-wrapper clearfix">
{{#data.list}}
{{#data}}
<li class="swiper-slide">
<a href="{{url}}" id="{{../template_id}}' name="{{../template_intro}}">
<img src="{{image2 src w=750 h=290 q=60 mode=3}}" alt="">
</a>
</li>
{{/data.list}}
{{/data}}
</ul>
<div class="swiper-pagination" {{#unless singleOne}}style="display:block"{{/unless}}>
<div class="pagination-inner">
... ...
... ... @@ -11,8 +11,8 @@ const isProduction = process.env.NODE_ENV === 'production';
const isTest = process.env.NODE_ENV === 'test';
const domains = {
api: 'http://api.yoho.yohoops.org/',
service: 'http://service.yoho.yohoops.org/',
api: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test3.yohops.com:9999/',
imSocket: 'ws://socket.yohobuy.com:10240',
... ...
... ... @@ -57,8 +57,10 @@ module.exports = () => {
// 判断请求是否来自app
yoho.isNowApp = /yohonow/i.test(req.get('User-Agent') || '');
yoho.isMarsApp = /yohomars/i.test(req.get('User-Agent') || '');
yoho.isYohoApp = /YohoBuy/i.test(req.get('User-Agent') || '');
yoho.isApp = yoho.isMarsApp ||
req.cookies.app_version ||
yoho.isNowApp ||
/YohoBuy/i.test(req.get('User-Agent') || '') ||
(req.query.app_version && req.query.app_version !== 'false') ||
(req.query.appVersion && req.query.appVersion !== 'false');
... ...
... ... @@ -50,7 +50,7 @@ module.exports = () => {
return _.parseInt(req.cookies.app_uid);
},
sessionKey: req.cookies.app_session_key,
appVersion: req.query.app_version || req.cookies.app_version || config.appVersion,
appVersion: req.cookies.app_version || req.query.app_version || config.appVersion,
appSessionType: req.cookies.app_client_type
};
}
... ... @@ -67,7 +67,7 @@ module.exports = () => {
)
) {
let appUid = req.query.uid || req.cookies.app_uid;
let appVersion = req.query.app_version || req.cookies.app_version || config.appVersion;
let appVersion = req.cookies.app_version || req.query.app_version || config.appVersion;
let appSessionType = req.query.client_type || req.cookies.app_client_type;
if (req.query.app_version && req.query.client_type) {
... ...
{
"name": "m-yohobuy-node",
"version": "6.2.5",
"version": "96.2.5",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -7,8 +7,6 @@
{{else}}
<img class="lazy" data-original="{{image2 headPic mode=2 w=750 h=320 q=60}}" />
{{/if}}
<div class="bg"></div>
<div class="title">有效期:10.11~10.21</div>
{{#if level}}
<div class="level">Lv.{{level}}可兑换</div>
{{/if}}
... ... @@ -25,8 +23,7 @@
<div class="remain">仅剩{{#if stock}}{{stock}}{{/if}}{{#if num}}{{num}}{{/if}}</div>
</div>
<div class="right">
<a class="go-btn yohonow" href="yohoefashion4In1://yoho.cn/">兑换</a>
<a class="go-btn mars" href="yohomars://yohomars.com/goapp?openby:mars=">兑换</a>
<span class="go-btn{{#if usable}} usable{{/if}}{{#if noStore}} no-store{{/if}}" data-id="{{id}}" data-level="{{level}}" data-point="{{#if points}}{{points}}{{/if}}{{#if point}}{{point}}{{/if}}" data-type="{{type}}">兑换</span>
</div>
</div>
</div>
... ...
... ... @@ -9,7 +9,11 @@
{{/imgList}}
{{#if winXinCode}}
<a class="code-copy" href='//m.yohobuy.com/?openby:yohobuy={"action":"go.copy","params":{"text":"{{winXinCode}}","message":"复制成功"}}'>复制</a>
<span class="code-copy" data-text="{{winXinCode}}">复制</span>
{{/if}}
{{#if loadSrc}}
<a class="load-src" href="{{loadSrc}}"></a>
{{/if}}
</div>
{{/ downLoadData}}
... ...
... ... @@ -8,7 +8,6 @@
<span class="item-name">{{name}}</span>
<span class="item-color" style="background-color: {{color}}"></span>
<span class="item-val">{{value}}</span>
<span class="item-percent">{{percent}}</span>
</div>
{{/list}}
<div class="instruction">
... ...

1.69 KB | W: | H:

1.8 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

1.8 KB | W: | H:

1.69 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
... ... @@ -3,6 +3,7 @@ import $ from 'yoho-jquery';
import Page from 'yoho-page';
import tip from 'plugin/tip';
import resultRender from 'home/coin-list.hbs';
import yoho from 'yoho-app';
class ScoreDetail extends Page {
constructor() {
... ... @@ -42,6 +43,12 @@ class ScoreDetail extends Page {
this.chosenData();
this.scroll();
this.defaultTab();
if (yoho && yoho.isMarsApp) {
yoho.ready(() => {
yoho.invokeMethod('set.removeTopRightButton');
});
}
}
defaultTab() {
... ...
... ... @@ -4,6 +4,7 @@ import Page from 'yoho-page';
import tip from 'plugin/tip';
import tabRender from 'home/coin-get-list.hbs';
import lazyLoad from 'yoho-jquery-lazyload';
import yoho from 'yoho-app';
class IconMall extends Page {
constructor() {
... ... @@ -15,7 +16,9 @@ class IconMall extends Page {
$coinMallC: $('.coin-mall-c'),
$tabFixed: $('.tab-fixed'),
$yohonowTab: $('#yohonow-tab'),
$marsTab: $('#mars-tab')
$marsTab: $('#mars-tab'),
$acquiringHelp: $('.acquiring-help'),
$detail: $('.detail')
};
this.view = {
... ... @@ -28,6 +31,7 @@ class IconMall extends Page {
this.loading = false;
this.end = false;
this.fixTop = this.selector.$tabFixed.offset().top;
this.beforeScroll = $(window).scrollTop();
this.init();
}
... ... @@ -37,10 +41,27 @@ class IconMall extends Page {
this.defaultChosen();
this.scroll();
this.getList();
this.refreshUserInfo();
if (yoho && yoho.isMarsApp) {
yoho.ready(() => {
yoho.invokeMethod('set.removeTopRightButton');
});
}
}
refreshUserInfo() {
// 提供给app更改完个人信息之后刷新
yoho.ready(function() {
yoho.addNativeMethod('refreshUserInfomation', function() {
location.href = location.href;
});
});
}
scrollHandler() {
if (($(window).scrollTop() + $(window).height() >= $(document).height() * 0.8)) {
if (($(window).scrollTop() + $(window).height() >= $(document).height() * 0.3)) {
this.doMore();
}
}
... ... @@ -54,11 +75,20 @@ class IconMall extends Page {
getList() {
this.loading = true;
if (this.type === 'now') {
this.selector.$yohonowTab.append('<p class="show-more">加载中...</p>');
}
if (this.type === 'mars') {
this.selector.$marsTab.append('<p class="show-more">加载中...</p>');
}
this.ajax({
url: '/home/family/coinMall/getList',
data: {
type: this.type,
page: this.page
},
complete: function() {
$('.show-more').remove();
}
}).then(result => {
if (result && result.list.length > 0) {
... ... @@ -70,11 +100,18 @@ class IconMall extends Page {
if (this.type === 'mars') {
this.selector.$marsTab.append($result);
}
this.loading = false;
lazyLoad($result.find('img.lazy'));
} else {
if (this.type === 'now') {
this.selector.$yohonowTab.append('<p class="no-more">没有更多了...</p>');
}
if (this.type === 'mars') {
this.selector.$marsTab.append('<p class="no-more">没有更多了...</p>');
}
this.end = true;
tip.show('没有更多数据了~~~');
}
}).catch(error => {
console.error(error);
... ... @@ -83,22 +120,35 @@ class IconMall extends Page {
scroll() {
$(window).scroll(() => {
let $scrollTop = $(window).scrollTop();
if ($scrollTop >= this.fixTop) {
this.selector.$tabFixed.find('.tab').addClass('fixed');
} else {
this.selector.$tabFixed.find('.tab').removeClass('fixed');
}
$(window).scroll(() => {
window.requestAnimationFrame(this.scrollHandler.bind(this));
});
setTimeout(() => {
let afterScroll = $(window).scrollTop();
if (afterScroll - this.beforeScroll > 0) {
window.requestAnimationFrame(this.scrollHandler.bind(this));
this.beforeScroll = afterScroll;
} else {
return false;
}
}, 5);
});
}
bindEvents() {
this.selector.$tabItem.on('click', this.tabItem.bind(this));
this.selector.$acquiringHelp.on('click', this.openHelp.bind(this));
this.selector.$detail.on('click', this.openDetail.bind(this));
$(window).on('scroll touchmove touchstart touchend', this.move.bind(this));
$(document).on('click', '.go-btn', this.goConversion.bind(this));
}
move() {
let $scrollTop = $(window).scrollTop();
if ($scrollTop >= this.fixTop) {
this.selector.$tabFixed.find('.tab').addClass('fixed');
} else {
this.selector.$tabFixed.find('.tab').removeClass('fixed');
}
}
defaultChosen() {
... ... @@ -125,8 +175,55 @@ class IconMall extends Page {
this.type = 'mars';
}
this.page = 1;
this.beforeScroll = 0;
this.getList();
}
openHelp() {
if (yoho && yoho.isNowApp) {
yoho.invokeMethod('go.coins_help');
} else if (yoho && yoho.isMarsApp) {
yoho.invokeMethod('go.point_help');
}
}
openDetail() {
yoho.ready(() => {
if (yoho && yoho.isNowApp) {
yoho.invokeMethod('go.coins_detail');
} else if (yoho && yoho.isMarsApp) {
yoho.invokeMethod('go.point_detail');
}
});
}
goConversion(e) {
let $this = $(e.currentTarget);
let type = $this.closest('.tab-item-c').attr('id');
let goodId = $this.data('id');
let goodsLevel = $this.data('level');
let point = $this.data('point');
let goodtype = $this.data('type');
if ($this.hasClass('usable')) {
if (!$this.hasClass('no-store')) {
yoho.ready(() => {
if (yoho && yoho.isMarsApp) {
yoho.invokeMethod('go.mars_point',
{goodId: goodId, goodsLevel: goodsLevel, point: point, goodType: goodtype});
} else if (yoho && yoho.isNowApp) {
yoho.invokeMethod('go.yohoCoins', {goodId: goodId, point: point, goodType: goodtype});
}
});
}
} else {
if (type === 'yohonow-tab') {
tip.show('请到yohonowapp打开');
} else if (type === 'mars-tab') {
tip.show('请到mars打开');
}
}
}
}
$(() => {
... ...
... ... @@ -29,6 +29,7 @@ class UserInfo extends Page {
$cityText: $('.city-text'),
$userPic: $('.user-pic'),
$noDate: $('.inp.modify[type!=date]'),
$bottomOut: $('.bottom-out')
};
this.view = {
... ... @@ -56,6 +57,23 @@ class UserInfo extends Page {
});
this.defaultPic();
this.getCity();
this.refreshUserInfo();
if (yoho && yoho.isMarsApp) {
yoho.ready(() => {
yoho.invokeMethod('set.removeTopRightButton');
});
}
}
refreshUserInfo() {
// 提供给app更改完个人信息之后刷新
yoho.ready(function() {
yoho.addNativeMethod('refreshUserInfomation', function() {
location.href = location.href;
});
});
}
bindEvents() {
... ... @@ -65,6 +83,9 @@ class UserInfo extends Page {
this.selector.$chosenCity.on('DOMNodeInserted', this.modifyInp.bind(this));
this.selector.$userPic.on('click', this.userPic.bind(this));
this.selector.$modifyInp.on('click', this.closeCitySwiper.bind(this));
this.selector.$bottomOut.on('focus', this.keepOut.bind(this));
this.selector.$bottomOut.on('blur', this.restore.bind(this));
if (yoho.isApp) {
this.selector.$modifyInp.on('change', this.modifyInp.bind(this));
} else {
... ... @@ -81,17 +102,44 @@ class UserInfo extends Page {
}
}
keepOut(e) {
let $this = $(e.currentTarget);
$('body').css({
height: $(window).height() + $this.offset().top * 2 / 3
});
$(document).scrollTop($this.offset().top * 2 / 3);
}
restore() {
$('body').css({
height: $(window).height()
});
$(document).scrollTop(0);
}
userPic() {
if (yoho.isApp) {
yoho.ready(() => {
yoho.invokeMethod('go.setAvatar', {}, (data) => {
if (data) {
let reg = /(\w*){mode}(.*){width}(.*){height}(.*)/g;
data = data.replace(reg, '$12$2100$3100$4');
this.selector.$userAvatar.css('background-image', `url(${data})`);
}
});
if (yoho.isYohoApp) {
yoho.invokeMethod('go.setAvatar', {}, (data) => {
if (data) {
let reg = /(\w*){mode}(.*){width}(.*){height}(.*)/g;
data = data.replace(reg, '$12$2100$3100$4');
this.selector.$userAvatar.css('background-image', `url(${data})`);
}
});
} else if (yoho.isMarsApp) {
yoho.invokeMethod('go.modify_user', {}, (data) => {
if (data) {
this.selector.$userAvatar.css('background-image', `url(${data})`);
}
});
}
});
}
}
... ... @@ -138,12 +186,16 @@ class UserInfo extends Page {
},
}).then(result => {
if (result && result.code === 200) {
if (yoho && yoho.isApp) {
yoho.ready(() => {
yoho.invokeMethod('go.refreshUserInfomation');
});
}
location.href = location.href;
} else {
tip.show(result.message);
}
}).catch(error => {
tip.show(error);
});
}
... ...
... ... @@ -58,6 +58,7 @@ class FamilyIndex extends Page {
this.trendWordMarquee();
this.resources();
this.downLoadInfo();
this.refreshUserInfo();
}
bindEvents() {
... ... @@ -70,6 +71,16 @@ class FamilyIndex extends Page {
this.selector.$popover.on('mousewheel touchmove', this.banSliding.bind(this));
}
refreshUserInfo() {
// 提供给app更改完个人信息之后刷新
yoho.ready(function() {
yoho.addNativeMethod('refreshUserInfomation', function() {
location.href = location.href;
});
});
}
// 头像
headIco() {
let myImage = new Image(),
... ... @@ -125,7 +136,7 @@ class FamilyIndex extends Page {
type: 'GET',
url: location.protocol + '//m.yohobuy.com/home/family/integralCharts'
}).then(result => {
if (result) {
if (result && !$.isEmptyObject(result)) {
result.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
this.selector.$integralContent.append(this.view.integral(result));
... ... @@ -136,7 +147,7 @@ class FamilyIndex extends Page {
series: [
{
type: 'pie',
radius: [this.selector.chartWidth * 3 / 10, this.selector.chartWidth * 11 / 25],
radius: [this.selector.chartWidth * 3 / 10, this.selector.chartWidth * 43 / 100],
roseType: 'radius',
center: ['50%', '50%'],
label: {
... ... @@ -146,9 +157,9 @@ class FamilyIndex extends Page {
}
]
});
} else {
$('.integral').hide();
}
}).catch(() => {
tip.show('服务异常,请稍后重试');
});
}
... ... @@ -202,6 +213,8 @@ class FamilyIndex extends Page {
this.selector.$downClose.on('click', this.downClose.bind(this));
this.selector.$popover = $('.popover');
this.selector.$popover.on('mousewheel touchmove', this.banSliding.bind(this));
this.selector.$copyBtn = $('.code-copy');
this.selector.$copyBtn.on('click', this.goCopy.bind(this));
});
}
... ... @@ -257,7 +270,40 @@ class FamilyIndex extends Page {
// 积分图表点击跳转
jump(params) {
yoho.goH5(`${location.protocol}//m.yohobuy.com/home/family/coinDetail?plateType=${params.data.plateType}`);
let href = `${location.protocol}//m.yohobuy.com/home/family/coinDetail?plateType=${params.data.plateType}`;
let $linkJump = $('#link-jump');
if (yoho.isMarsApp || yoho.isNowApp) {
if (!$linkJump.length) {
$('body').append('<a id="link-jump" href="javascript:;" style="display:none !important;"></a>');
$linkJump = $('#link-jump');
}
if (yoho.isMarsApp) {
href = href + '&openby:mars=' + (JSON.stringify({
action: 'go.h5',
params: {
url: href
}
}));
} else {
href = href + '&openby:yohobuy=' + (JSON.stringify({
action: 'go.h5',
params: {
url: href
}
}));
}
$linkJump.attr('href', href);
$linkJump[0].click();
return false;
} else {
yoho.goH5(href);
}
}
// 点击APP图标显示信息
... ... @@ -265,8 +311,9 @@ class FamilyIndex extends Page {
let $this = $(e.currentTarget);
let appType = $this.data('name').toLowerCase();
let isLogin = $this.data('login');
let isNoOpen = $this.data('noopen');
if (isLogin) {
if (isLogin && !isNoOpen) {
if (this.vipInfo[appType]) {
this.selector.$diaC.append(this.view.vipDetailInfo(this.vipInfo[appType]));
} else {
... ... @@ -296,7 +343,12 @@ class FamilyIndex extends Page {
hideVipInfo() {
$('.vip-detail').remove();
$('body,.main').css({
'overflow-y': 'auto'
'overflow-y': 'auto',
position: 'static'
});
$('body').css({
position: 'static'
});
}
... ... @@ -311,7 +363,8 @@ class FamilyIndex extends Page {
downClose() {
this.selector.$downLoadDetail.addClass('hide');
$('body,.main').css({
'overflow-y': 'auto'
'overflow-y': 'auto',
position: 'static'
});
}
... ... @@ -320,9 +373,41 @@ class FamilyIndex extends Page {
$('body,.main').css({
'overflow-y': 'hidden'
});
$('body').css({
position: 'fixed'
});
}
// 复制公众号
goCopy(e) {
let $this = $(e.currentTarget);
if (yoho && yoho.isApp) {
if (yoho.isYohoApp) {
let href = location.protocol + '//m.yohobuy.com/';
yoho.goH5(href, JSON.stringify({
action: 'go.copy',
params: {
text: $this.data('text'),
message: '复制成功'
}
}));
} else {
yoho.invokeMethod('go.copy', {text: $this.data('text'), message: '复制成功'});
}
}
}
}
$(() => {
new FamilyIndex();
// 加载完 调用APP的方法 隐藏头部
if (yoho && yoho.isApp) {
yoho.ready(function() {
yoho.invokeMethod('yohofamily.page_success');
});
}
});
... ...
... ... @@ -2,6 +2,7 @@ import 'home/new-qrcode.page.css';
import $ from 'yoho-jquery';
import Page from 'yoho-page';
import 'yoho-jquery-qrcode';
import yoho from 'yoho-app';
class NewQrcode extends Page {
constructor() {
... ... @@ -24,6 +25,12 @@ class NewQrcode extends Page {
this.autoScroll();
this.bindEvents();
this.autoReload();
if (yoho && yoho.isMarsApp) {
yoho.ready(() => {
yoho.invokeMethod('set.removeTopRightButton');
});
}
}
bindEvents() {
... ...
require('home/tide-command.page.css');
let yoho = require('yoho-app');
let tip = require('plugin/tip');
let trendWord;
... ... @@ -31,13 +33,23 @@ $('.save').click(function() {
success: function(result) {
tip.show(result.message);
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_MYTREND_TREND_SET_C',
param: JSON.stringify({
TREND: trendWord
})
}, true);
if (result.code && result.code === 200) {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_MYTREND_TREND_SET_C',
param: JSON.stringify({
TREND: trendWord
})
}, true);
}
if (yoho && yoho.isApp) {
yoho.invokeMethod('go.refreshUserInfomation');
setTimeout(function() {
yoho.invokeMethod('go.back');
}, 1000);
}
}
}
});
... ... @@ -45,4 +57,13 @@ $('.save').click(function() {
(function() {
$('.world-number').html(15 - $('.command-textarea').val().length);
if (yoho && yoho.isApp) {
if (yoho.isMarsApp) {
yoho.ready(() => {
yoho.invokeMethod('set.removeTopRightButton');
});
}
}
}());
... ...
... ... @@ -39,8 +39,10 @@ yoho = {
*/
isNowApp: /yohonow/i.test(navigator.userAgent || ''),
isMarsApp: /YohoMars/i.test(navigator.userAgent || ''),
isYohoApp: /YohoBuy/i.test(navigator.userAgent || ''),
isApp: /YohoMars/i.test(navigator.userAgent || '') ||
/YohoBuy/i.test(navigator.userAgent || '') ||
/yohonow/i.test(navigator.userAgent || '') ||
qs && qs.app_version || cookie.get('app_version'),
isiOS: /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(navigator.userAgent || ''),
isAndroid: /Android/i.test(navigator.userAgent || ''),
... ...
... ... @@ -120,6 +120,13 @@ html {
.pic {
position: relative;
width: 100%;
height: 300px;
img {
width: 100%;
height: 100%;
}
.bg {
width: 270px;
... ... @@ -220,13 +227,42 @@ html {
text-align: center;
color: #fff;
font-size: 28px;
background-color: #000;
background-color: #b0b0b0;
display: block;
margin-top: 25px;
}
.usable {
background-color: #000;
}
.no-store {
background-color: #b0b0b0;
}
}
}
}
.convert-tip {
position: absolute;
top: 0;
height: 100%;
width: 100%;
}
.no-more {
text-align: center;
margin-bottom: 20px;
line-height: 50px;
height: 50px;
}
.show-more {
text-align: center;
margin-bottom: 20px;
line-height: 50px;
height: 50px;
}
}
#mars {
... ...
... ... @@ -34,17 +34,17 @@ input::-webkit-calendar-picker-indicator {
border-bottom: solid 1px #e0e0e0;
.title {
width: 220px;
width: 200px;
float: left;
font-size: 30px;
}
.main {
width: 450px;
width: 470px;
float: left;
min-height: 90px;
padding: 10px 0;
padding-right: 20px;
padding-right: 30px;
position: relative;
.ewm {
... ... @@ -96,7 +96,7 @@ input::-webkit-calendar-picker-indicator {
.date-c {
position: absolute;
top: 10px;
right: -20px;
right: -5px;
width: 300px;
white-space: nowrap;
overflow: hidden;
... ...
... ... @@ -16,10 +16,10 @@
padding: 34px 30px 0;
.back {
width: 40px;
height: 40px;
width: 60px;
height: 60px;
background-image: resolve("home/family/back.png");
background-size: 50% 100%;
background-size: 40% 70%;
background-repeat: no-repeat;
display: block;
float: left;
... ... @@ -33,7 +33,7 @@
background-image: resolve("home/family/yoho-family.png");
background-size: 100% 100%;
background-repeat: no-repeat;
margin-left: 280px;
margin-left: 250px;
}
}
... ... @@ -65,6 +65,11 @@
height: 55px;
font-weight: bold;
line-height: 55px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
max-width: 360px;
}
.gender {
... ... @@ -86,6 +91,7 @@
font-size: 24px;
margin-left: 160px;
text-align: left;
margin-top: 5px;
}
.birthday {
... ... @@ -93,7 +99,7 @@
}
.invition {
margin-top: 15px;
margin-top: 10px;
font-size: 30px;
}
... ... @@ -105,15 +111,16 @@
background-size: 100%;
background-repeat: no-repeat;
margin-left: 190px;
overflow: hidden;
}
textarea {
width: 460px;
height: 40px;
height: 43px;
border: none;
resize: none;
margin-left: 30px;
line-height: 40px;
line-height: 41px;
color: #807e7e;
font-size: 18px;
}
... ... @@ -164,6 +171,8 @@
height: 36px;
display: inline-block;
margin-left: 13px;
vertical-align: top;
margin-top: 2px;
}
}
}
... ... @@ -202,6 +211,10 @@
overflow: hidden;
}
.gray {
filter: grayscale(100%);
}
.name {
font-size: 28px;
color: #43b938;
... ... @@ -257,7 +270,7 @@
.mark {
width: 350px;
position: absolute;
right: 30px;
right: 20px;
font-size: 24px;
top: 20px;
}
... ... @@ -267,9 +280,10 @@
display: inline-block;
line-height: 40px;
width: 100%;
margin-left: 40px;
.item-name {
margin-right: 14px;
margin-right: 22px;
text-align: right;
width: 120px;
display: inline-block;
... ... @@ -280,7 +294,7 @@
width: 20px;
height: 20px;
border-radius: 10px;
margin-right: 14px;
margin-right: 22px;
}
.item-percent {
... ... @@ -298,7 +312,7 @@
margin-top: 10px;
span {
width: 84%;
width: 83%;
float: right;
}
}
... ... @@ -373,12 +387,6 @@
width: 400px;
}
.name {
color: #000;
font-size: 30px;
line-height: 60px;
}
.level {
font-size: 24px;
line-height: 32px;
... ... @@ -394,6 +402,21 @@
}
}
.name {
color: #000;
font-size: 30px;
margin-bottom: 10px;
span {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
max-width: 300px;
vertical-align: text-bottom;
}
}
.pic {
width: 120px;
height: 120px;
... ...
... ... @@ -38,6 +38,14 @@
border-radius: 10px;
}
.load-src {
display: inline-block;
width: 100%;
height: 300px;
position: relative;
bottom: 300px;
}
.yohobuy,
.now,
.mars {
... ...