Authored by wenjiekong

添加保存基本信息接口

... ... @@ -32,3 +32,26 @@ exports.index = (req, res, next) => {
}).catch(next);
};
/**
* 编辑会员信息
* @param {[type]} req [description]
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.editUserInfo = (req, res, next) => {
let channel = req.query.channel || req.cookies._Channel || 'boys';
let uid = '8039836';
let responseData = {
module: 'home',
page: 'user'
};
// 真实数据输出
userService.editUserInfo(req, uid).then(result => {
}).catch(next);
};
... ...
... ... @@ -41,12 +41,26 @@ const getUserLikeBrand = (uid) => {
};
const getTipConfig = (uid) => {
return api.get('', {
return api.post('', {
method: 'app.resources.config.clientInitConfig',
uid: uid
});
};
const editUserInfo = (userInfo) => {
return api.get('', {
method: 'app.passport.modifyBase',
uid: userInfo.uid,
nick_name: userInfo.nickname,
username: userInfo.username,
gender: userInfo.gender,
profession: userInfo.profession,
income: userInfo.income,
birthday: userInfo.birthday
});
};
module.exports = {
getUserInfo,
getUserContactInfo,
... ...
... ... @@ -7,6 +7,7 @@
'use strict';
const api = global.yoho.API;
const userApi = require('./user-api');
const Images = require('../../../utils/images');
const headerModel = require('../../../doraemon/models/header');
const configData = {
... ... @@ -71,18 +72,18 @@ const configData = {
value: '1',
text: '目的型购物'
},
{
type: 'radio',
key: 'shopping',
value: '2',
text: '冲动型购物'
},
{
type: 'radio',
key: 'shopping',
value: '3',
text: '保守型购物'
}],
{
type: 'radio',
key: 'shopping',
value: '2',
text: '冲动型购物'
},
{
type: 'radio',
key: 'shopping',
value: '3',
text: '保守型购物'
}],
// 着装习惯
dressHabits: [{
... ... @@ -92,48 +93,50 @@ const configData = {
value: '1',
text: '正装'
},
{
type: 'checkbox',
key: 'dress[]',
index: 'dress-2',
value: '2',
text: '商务'
},
{
type: 'checkbox',
key: 'dress[]',
index: 'dress-3',
value: '3',
text: '街头流行'
},
{
type: 'checkbox',
key: 'dress[]',
index: 'dress-4',
value: '4',
text: '运动休闲'
},
{
type: 'checkbox',
key: 'dress[]',
index: 'dress-5',
value: '5',
text: '文艺气质'
},
{
type: 'checkbox',
key: 'dress[]',
index: 'dress-6',
value: '6',
text: '甜美可爱'
},
{
type: 'checkbox',
key: 'dress[]',
index: 'dress-7',
value: '7',
text: '另类'
}]
{
type: 'checkbox',
key: 'dress[]',
index: 'dress-2',
value: '2',
text: '商务'
},
{
type: 'checkbox',
key: 'dress[]',
index: 'dress-3',
value: '3',
text: '街头流行'
},
{
type: 'checkbox',
key: 'dress[]',
index: 'dress-4',
value: '4',
text: '运动休闲'
},
{
type: 'checkbox',
key: 'dress[]',
index: 'dress-5',
value: '5',
text: '文艺气质'
},
{
type: 'checkbox',
key: 'dress[]',
index: 'dress-6',
value: '6',
text: '甜美可爱'
},
{
type: 'checkbox',
key: 'dress[]',
index: 'dress-7',
value: '7',
text: '另类'
}],
headDefaultImgIcon: '//img10.static.yhbimg.com/headimg/' +
'2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100'
};
const getDays = (year, month) => {
... ... @@ -260,6 +263,9 @@ const getUserInfo = (channel, uid) => {
userInfo = result[1].data || {};
finalResult.userThumb = userInfo.head_ico === '' ?
configData.headDefaultImgIcon : Images.getImageUrl(userInfo.head_ico, 100, 100, 2);
if (userInfo) {
gender = userInfo.gender || 3;
birthday = userInfo.birthday || '';
... ... @@ -477,6 +483,21 @@ const getUserInfo = (channel, uid) => {
});
};
const editUserInfo = (req, uid) => {
console.info(req.body);
console.info(req.body.nickname);
console.info(req.body.username);
console.info(req.body.gender);
console.info(req.body.year);
console.info(req.body.month);
console.info(req.body.day);
console.info(req.body.profession);
console.info(req.body.income);
return '';
};
module.exports = {
getUserInfo
getUserInfo,
editUserInfo
};
... ...
... ... @@ -151,6 +151,8 @@ router.get('/vip', VipController.index);
router.get('/user', [getCommonHeader, getHomeNav], UserController.index);
router.post('/user/edituserinfo', UserController.editUserInfo);
router.get('/favorite', FavoriteController.index);
router.get('/coupons', CouponsController.index);
... ...
<div class="user-me-page me-page yoho-page clearfix">
{{# user}}
<div class="me-main">
<div class="userinfo-edit block">
<h2 class="title"></h2>
<div class="edit-box">
{{> home/edit/basicinfo}}
{{> home/edit/contactinfo}}
{{> home/edit/habbit}}
{{> home/edit/favorite}}
</div>
{{> path}}
{{> navigation}}
{{# user}}
<div class="me-main">
<div class="userinfo-edit block">
<h2 class="title"></h2>
<div class="edit-box">
{{> home/edit/basicinfo}}
{{> home/edit/contactinfo}}
{{> home/edit/habbit}}
{{> home/edit/favorite}}
</div>
{{#if isShowTip}}
<p class="help-us">
如果你还使用了我们的其他产品(Yoho!Now和mars)修改个人信息时将同步
</p>
{{/if}}
</div>
{{/ user}}
{{#if isShowTip}}
<p class="help-us">
如果你还使用了我们的其他产品(Yoho!Now和mars)修改个人信息时将同步
</p>
{{/if}}
</div>
{{/ user}}
</div>
\ No newline at end of file
... ...