Authored by zhangxiaoru

首页资源位 潮流口令滚动

... ... @@ -84,7 +84,9 @@ exports.modify = (req, res, next) => {
uid: req.user.uid,
nickName: req.query.nickName,
gender: req.query.gender,
birthday: req.query.birthday
birthday: req.query.birthday,
height: req.query.height,
weight: req.query.weight
};
req.ctx(family).modify(params).then((result) => {
... ...
... ... @@ -5,7 +5,9 @@ const moment = require('moment');
const camelCase = global.yoho.camelCase;
const api = global.yoho.API;
const service = global.yoho.ServiceAPI;
const resourcesProcess = require(`${utils}/resources-process`);
const resourcesProcess = require(`${global.utils}/resources-process`);
const helpers = global.yoho.helpers;
const crypto = global.yoho.crypto;
class familyModel extends global.yoho.BaseModel {
constructor(ctx) {
... ... @@ -454,32 +456,37 @@ class familyModel extends global.yoho.BaseModel {
}
userInfo(params) {
let options = {
data: {
method: 'app.passport.profile',
uid: params.uid
},
param: {
code: 200
}
};
return this.get(options).then(result => {
return Promise.all([
this._userData(params.uid),
this._getCode(params.uid)
]).then(result => {
let resu = {};
if (_.get(result, 'data')) {
let thisGender = result.data.gender;
if (_.get(result, '[0].data')) {
let thisGender = result[0].data.gender;
result.data.gender = (thisGender === '1' ? '男' : '女');
result.data.otherGender = (thisGender === '1' ? '女' : '男');
if (result.data.gender === '男') {
result.data.genderId = 1;
result.data.otherGenderId = 2;
result[0].data.gender = (thisGender === '1' ? '男' : '女');
result[0].data.otherGender = (thisGender === '1' ? '女' : '男');
if (result[0].data.gender === '男') {
result[0].data.genderId = 1;
result[0].data.otherGenderId = 2;
} else {
result.data.genderId = 2;
result.data.otherGenderId = 1;
result[0].data.genderId = 2;
result[0].data.otherGenderId = 1;
}
resu = camelCase(result.data);
result[0].data.qrcodeLink = helpers.urlFormat('/home/user/qrcode', {
token: _.get(result[0], 'data.uid', null) ?
crypto.encryption('yoho9646yoho9646', _.get(result, 'data.uid', null) + '') : '',
icon: _.get(result[0], 'data.head_ico', ''),
uname: _.get(result[0], 'data.nickname', ''),
vip: _.get(result[0], 'data.vip_info.cur_level')
});
resu = camelCase(result[0].data);
}
if (_.get(result, '[1].data')) {
Object.assign(resu, {
trendWord: result[1].data.trendWord
});
}
return resu;
});
... ... @@ -492,7 +499,9 @@ class familyModel extends global.yoho.BaseModel {
uid: params.uid,
nick_name: params.nickName,
gender: params.gender,
birthday: params.birthday
birthday: params.birthday,
height: params.height,
weight: params.weight
},
param: {
code: 200
... ... @@ -500,6 +509,7 @@ class familyModel extends global.yoho.BaseModel {
};
return this.get(options).then(result => {
console.log(result);
return result;
});
}
... ...
... ... @@ -181,6 +181,6 @@ router.get('/family', auth, family.familyIndex); // family首页
router.get('/family/vipDetailData', auth, family.familyVip); // 获取VIP信息
router.get('/family/coinDetail', auth, family.coinDetail); // 积分详情页
router.get('/family/coinDetail/getCoinData', auth, family.getCoinData); // 筛选积分详情
router.get('/family/userInfo', auth, family.userInfo); // family个人信息页
router.get('/family/userInfo', auth, disableBFCache, family.userInfo); // family个人信息页
router.get('/family/modify', auth, family.modify); // family修改个人信息页
module.exports = router;
... ...
<div class="yoho-family-page yoho-page">
<div class="score-detail-c">
<div class="tab">
<div id="source" class="tab-item">版块
<div id="source" class="tab-item">
<span class="name">版块</span>
<span class="iconfont down">&#xe613;</span>
<span class="iconfont up">&#xe612;</span>
<ul class="list">
<li data-source="0">
全部
<li data-source="-1">
<span class="title">全部</span>
<span class="tick"></span>
</li>
<li data-source="1">
Yoho!Buy
<span class="title">Yoho!Buy</span>
<span class="tick"></span>
</li>
<li data-source="3">
Yoho!Now
<span class="title">Yoho!Now</span>
<span class="tick"></span>
</li>
<li data-source="2">
Mars
<span class="title">Mars</span>
<span class="tick"></span>
</li>
<li data-source="6">
Yo!Coffee
<span class="title">Yo!Coffee</span>
<span class="tick"></span>
</li>
<li data-source="5">
Yo!Green
<span class="title">Yo!Green</span>
<span class="tick"></span>
</li>
<li data-source="7">
Yo!Little
<span class="title">Yo!Little</span>
<span class="tick"></span>
</li>
</ul>
</div>
<div id="queryType" class="tab-item">积分明细
<div id="queryType" class="tab-item">
<span class="name">积分明细</span>
<span class="iconfont down">&#xe613;</span>
<span class="iconfont up">&#xe612;</span>
<ul class="list">
<li data-type="0">
全部
<span class="title">全部</span>
<span class="tick"></span>
</li>
<li data-type="1">
收入
<span class="title">收入</span>
<span class="tick"></span>
</li>
<li data-type="2">
支出
<span class="title">支出</span>
<span class="tick"></span>
</li>
</ul>
</div>
<div id="time" class="tab-item">最近三月
<div id="time" class="tab-item">
<span class="name">最近一年</span>
<span class="iconfont down">&#xe613;</span>
<span class="iconfont up">&#xe612;</span>
<ul class="list">
<li data-begin="0">
全部
<span class="title">全部</span>
<span class="tick"></span></li>
<li data-begin="7776000000">
最近三月
<span class="title">最近三月</span>
<span class="tick"></span>
</li>
<li data-begin="15552000000">
最近六月
<span class="title">最近六月</span>
<span class="tick"></span>
</li>
<li data-begin="31104000000">
最近一年
<span class="title">最近一年</span>
<span class="tick"></span>
</li>
</ul>
... ...
... ... @@ -3,7 +3,7 @@
<div class="list-item user-pic">
<div class="title">头像</div>
<div class="main">
<img class="pic" src="http://img2.imgtn.bdimg.com/it/u=523024675,1399288021&fm=26&gp=0.jpg" />
<div class="pic user-avatar" data-avatar="{{image headIco 100 100}}"></div>
</div>
<div class="arr">
<span class="iconfont">&#xe604;</span>
... ... @@ -50,30 +50,31 @@
<span class="iconfont">&#xe604;</span>
</div>
</div>
<div class="list-item">
<a class="list-item" href="//m.yohobuy.com/home/tide-command?hideTips=true">
<div class="title">我的潮流口令</div>
<div class="main">
<input class="inp" type="text" value="#谁比我更潮谁比我更潮!#" />
<span class="inp" type="text">#{{trendWord}}#</span>
</div>
<div class="arr">
<span class="iconfont">&#xe604;</span>
</div>
</div>
<div class="list-item">
</a>
<a class="list-item" href="{{qrcodeLink}}">
<div class="title">我的二维码</div>
<div class="main">
<input class="inp" type="text" value="177****4699" />
<div class="ewm"></div>
</div>
<div class="arr">
<span class="iconfont">&#xe604;</span>
</div>
</div>
</a>
</div>
<div class="info-list">
<div class="list-item">
<div class="title">身高</div>
<div class="main">
<input class="inp" type="text" value="163cm" />
<label>cm</label>
<input class="inp inp-2 height modify" type="number" value="{{height}}" />
</div>
<div class="arr">
<span class="iconfont">&#xe604;</span>
... ... @@ -82,14 +83,15 @@
<div class="list-item">
<div class="title">体重</div>
<div class="main">
<input class="inp" type="text" value="体重" />
<label>kg</label>
<input class="inp inp-2 weight modify" type="number" value="{{weight}}" />
</div>
<div class="arr">
<span class="iconfont">&#xe604;</span>
</div>
</div>
</div>
<div class="info-list">
<div class="info-list hide">
<div class="list-item">
<div class="title">账号安全</div>
<div class="main">
... ... @@ -100,6 +102,10 @@
</div>
</div>
</div>
<div id="yoho-footer" class="foot-tip yoho-footer">
<div class="pic"></div>
<p>如果你还使用了我们的其他产品(Yoho!Buy有货、Yoho!Now和 mars)修改个人信息时将同步。</p>
</div>
<div class="city-swiper">
<div class="swiper-header">
<div class="cancel">取消</div>
... ...
This diff could not be displayed because it is too large.
... ... @@ -14,17 +14,21 @@ class ScoreDetail extends Page {
$scoreDetailC: $('.score-detail-c'),
$chosen: $('.tab-item .list').find('li'),
$defaultChosen: $('.tab-item .list').find('li:first'),
$result: $('.result')
$defaultChosenTime: $('#time .list').find('li:last'),
$result: $('.result'),
$source: $('#source').find('.name'),
$queryType: $('#queryType').find('.name'),
$time: $('#time').find('.name')
};
this.view = {
resultRender
};
this.source = -1;
this.source = window.queryString.plateType || -1;
this.queryType = 0;
this.beginTime = '';
this.endTime = '';
this.endTime = Date.parse(new Date());
this.beginTime = parseInt(this.endTime, 10) - parseInt(31104000000, 10); // 默认显示一年内
this.page = 1;
this.loading = false;
this.end = false;
... ... @@ -33,10 +37,25 @@ class ScoreDetail extends Page {
}
init() {
this.selector.$defaultChosen.addClass('chosen');
this.setHeight();
this.bindEvents();
this.chosenData();
this.scroll();
this.defaultTab();
}
defaultTab() {
this.selector.$defaultChosen.addClass('chosen');
this.selector.$defaultChosenTime.addClass('chosen').siblings('li').removeClass('chosen');
if (window.queryString.plateType) {
let $defaultSource = $('#source').find(`li[data-source=${window.queryString.plateType}]`);
$defaultSource.addClass('chosen').siblings('li').removeClass('chosen');
this.selector.$source.text($defaultSource.find('.title').text());
}
}
scroll() {
$(window).scroll(() => {
window.requestAnimationFrame(this.scrollHandler.bind(this));
});
... ... @@ -69,16 +88,22 @@ class ScoreDetail extends Page {
switch ($parensId) {
case 'source':
this.source = $this.data('source');
this.selector.$source.text($this.find('.title').text());
break;
case 'queryType':
this.queryType = $this.data('type');
this.selector.$queryType.text($this.find('.title').text());
break;
case 'time':
if ($this.data('begin')) {
this.beginTime = $this.data('begin');
this.endTime = Date.parse(new Date());
this.beginTime = parseInt(this.endTime, 10) - parseInt(this.beginTime, 10);
} else {
this.beginTime = '';
this.endTime = '';
}
this.selector.$time.text($this.find('.title').text());
break;
default:
tip.show('请稍后再试~~');
... ... @@ -131,11 +156,12 @@ class ScoreDetail extends Page {
if (result && result.coinList.length > 0) {
this.selector.$result.append(this.view.resultRender(result));
this.loading = false;
this.selector.$tabItem.removeClass('active');
this.selector.$scoreDetailC.removeClass('active');
} else {
this.end = true;
tip.show('没有更多数据了~~~');
}
this.selector.$tabItem.removeClass('active');
this.selector.$scoreDetailC.removeClass('active');
}).catch(error => {
console.error(error);
});
... ...
... ... @@ -16,6 +16,9 @@ class UserInfo extends Page {
$nickName: $('.inp.nick-name'),
$gender: $('.inp.gender'),
$birthday: $('.inp.birthday'),
$height: $('.inp.height'),
$weight: $('.inp.weight'),
$userAvatar: $('.user-avatar')
};
this.init();
... ... @@ -26,6 +29,7 @@ class UserInfo extends Page {
this.on('citySwiperCb', (event, data) => { // 返回选中的slide对象
console.log(data);
});
this.defaultPic();
}
bindEvents() {
... ... @@ -33,13 +37,26 @@ class UserInfo extends Page {
this.selector.$modifyInp.on('blur', this.modifyInp.bind(this));
}
defaultPic() {
let myImage = new Image(),
avatar;
avatar = this.selector.$userAvatar.data('avatar');
myImage.src = avatar;
myImage.onload = () => {
this.selector.$userAvatar.css('background-image', 'url(' + avatar + ')');
};
}
modifyInp() {
this.ajax({
url: '/home/family/modify',
data: {
nickName: this.selector.$nickName.val(),
gender: this.selector.$gender.val(),
birthday: this.selector.$birthday.val()
birthday: this.selector.$birthday.val(),
height: this.selector.$height.val(),
weight: this.selector.$weight.val()
},
}).then(result => {
if (result && result.code === 200) {
... ...
... ... @@ -24,6 +24,7 @@ select {
margin-bottom: 20px;
.list-item {
display: block;
height: 90px;
line-height: 90px;
padding-right: 30px;
... ... @@ -42,6 +43,14 @@ select {
padding: 10px 0;
padding-right: 20px;
position: relative;
.ewm {
width: 43px;
height: 43px;
background-image: url("/home/family/person-ewm.png");
float: right;
margin-top: 12px;
}
}
.arr {
... ... @@ -56,7 +65,7 @@ select {
}
.inp {
width: 100%;
width: 430px;
height: 70px;
line-height: 70px;
font-size: 30px;
... ... @@ -66,6 +75,20 @@ select {
padding: 0;
}
.inp-2 {
float: right;
width: 400px;
padding-right: 3%;
}
label {
width: 30px;
float: right;
line-height: 70px;
font-size: 30px;
color: #b0b0b0;
}
.date-c {
position: absolute;
top: 10px;
... ... @@ -81,6 +104,9 @@ select {
height: 100px;
border-radius: 50%;
overflow: hidden;
background-size: contain;
background-position: center center;
background-image: resolve("home/index/user-avatar.png");
}
&.user-pic {
... ... @@ -98,4 +124,22 @@ select {
border-bottom: 0;
}
}
.foot-tip {
background-color: #f0f0f0 !important;
.pic {
background-image: resolve("home/family/foot.png");
width: 140px;
height: 80px;
background-size: 100% 100%;
margin: 0 auto 15px;
}
width: 750px;
padding: 30px;
font-size: 24px;
color: #b0b0b0;
line-height: 38px;
}
}
... ...