Authored by 李靖

个人中心修改

... ... @@ -74,7 +74,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) => {
... ...
... ... @@ -4,6 +4,8 @@ const _ = require('lodash');
const moment = require('moment');
const camelCase = global.yoho.camelCase;
const api = global.yoho.API;
const helpers = global.yoho.helpers;
const crypto = global.yoho.crypto;
class familyModel extends global.yoho.BaseModel {
constructor(ctx) {
... ... @@ -197,32 +199,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;
});
... ... @@ -235,7 +242,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
... ... @@ -243,6 +252,7 @@ class familyModel extends global.yoho.BaseModel {
};
return this.get(options).then(result => {
console.log(result);
return result;
});
}
... ...
... ... @@ -180,6 +180,6 @@ router.get('/tide-command', auth, tideCommand.tideCommand); // 设置潮流口
router.get('/family', auth, family.familyIndex); // family首页
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;
... ...
... ... @@ -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>
... ...
... ... @@ -11,15 +11,17 @@ 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://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
// 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 = {
... ...
This diff could not be displayed because it is too large.
... ... @@ -37,6 +37,10 @@ class ScoreDetail extends Page {
this.setHeight();
this.bindEvents();
this.chosenData();
this.scroll();
}
scroll() {
$(window).scroll(() => {
window.requestAnimationFrame(this.scrollHandler.bind(this));
});
... ... @@ -131,11 +135,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;
}
}
... ...