Authored by wenjiekong

添加保存基本信息接口

@@ -32,3 +32,26 @@ exports.index = (req, res, next) => { @@ -32,3 +32,26 @@ exports.index = (req, res, next) => {
32 }).catch(next); 32 }).catch(next);
33 33
34 }; 34 };
  35 +
  36 +/**
  37 + * 编辑会员信息
  38 + * @param {[type]} req [description]
  39 + * @param {[type]} res [description]
  40 + * @return {[type]} [description]
  41 + */
  42 +exports.editUserInfo = (req, res, next) => {
  43 + let channel = req.query.channel || req.cookies._Channel || 'boys';
  44 +
  45 + let uid = '8039836';
  46 +
  47 + let responseData = {
  48 + module: 'home',
  49 + page: 'user'
  50 + };
  51 +
  52 + // 真实数据输出
  53 + userService.editUserInfo(req, uid).then(result => {
  54 +
  55 + }).catch(next);
  56 +
  57 +};
@@ -41,12 +41,26 @@ const getUserLikeBrand = (uid) => { @@ -41,12 +41,26 @@ const getUserLikeBrand = (uid) => {
41 }; 41 };
42 42
43 const getTipConfig = (uid) => { 43 const getTipConfig = (uid) => {
44 - return api.get('', { 44 + return api.post('', {
45 method: 'app.resources.config.clientInitConfig', 45 method: 'app.resources.config.clientInitConfig',
46 uid: uid 46 uid: uid
47 }); 47 });
48 }; 48 };
49 49
  50 +const editUserInfo = (userInfo) => {
  51 + return api.get('', {
  52 + method: 'app.passport.modifyBase',
  53 + uid: userInfo.uid,
  54 + nick_name: userInfo.nickname,
  55 + username: userInfo.username,
  56 + gender: userInfo.gender,
  57 + profession: userInfo.profession,
  58 + income: userInfo.income,
  59 + birthday: userInfo.birthday
  60 + });
  61 +};
  62 +
  63 +
50 module.exports = { 64 module.exports = {
51 getUserInfo, 65 getUserInfo,
52 getUserContactInfo, 66 getUserContactInfo,
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 'use strict'; 7 'use strict';
8 const api = global.yoho.API; 8 const api = global.yoho.API;
9 const userApi = require('./user-api'); 9 const userApi = require('./user-api');
  10 +const Images = require('../../../utils/images');
10 const headerModel = require('../../../doraemon/models/header'); 11 const headerModel = require('../../../doraemon/models/header');
11 12
12 const configData = { 13 const configData = {
@@ -133,7 +134,9 @@ const configData = { @@ -133,7 +134,9 @@ const configData = {
133 index: 'dress-7', 134 index: 'dress-7',
134 value: '7', 135 value: '7',
135 text: '另类' 136 text: '另类'
136 - }] 137 + }],
  138 + headDefaultImgIcon: '//img10.static.yhbimg.com/headimg/' +
  139 + '2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100'
137 }; 140 };
138 141
139 const getDays = (year, month) => { 142 const getDays = (year, month) => {
@@ -260,6 +263,9 @@ const getUserInfo = (channel, uid) => { @@ -260,6 +263,9 @@ const getUserInfo = (channel, uid) => {
260 263
261 userInfo = result[1].data || {}; 264 userInfo = result[1].data || {};
262 265
  266 + finalResult.userThumb = userInfo.head_ico === '' ?
  267 + configData.headDefaultImgIcon : Images.getImageUrl(userInfo.head_ico, 100, 100, 2);
  268 +
263 if (userInfo) { 269 if (userInfo) {
264 gender = userInfo.gender || 3; 270 gender = userInfo.gender || 3;
265 birthday = userInfo.birthday || ''; 271 birthday = userInfo.birthday || '';
@@ -477,6 +483,21 @@ const getUserInfo = (channel, uid) => { @@ -477,6 +483,21 @@ const getUserInfo = (channel, uid) => {
477 }); 483 });
478 }; 484 };
479 485
  486 +const editUserInfo = (req, uid) => {
  487 + console.info(req.body);
  488 + console.info(req.body.nickname);
  489 + console.info(req.body.username);
  490 + console.info(req.body.gender);
  491 + console.info(req.body.year);
  492 + console.info(req.body.month);
  493 + console.info(req.body.day);
  494 + console.info(req.body.profession);
  495 + console.info(req.body.income);
  496 +
  497 + return '';
  498 +};
  499 +
480 module.exports = { 500 module.exports = {
481 - getUserInfo 501 + getUserInfo,
  502 + editUserInfo
482 }; 503 };
@@ -151,6 +151,8 @@ router.get('/vip', VipController.index); @@ -151,6 +151,8 @@ router.get('/vip', VipController.index);
151 151
152 router.get('/user', [getCommonHeader, getHomeNav], UserController.index); 152 router.get('/user', [getCommonHeader, getHomeNav], UserController.index);
153 153
  154 +router.post('/user/edituserinfo', UserController.editUserInfo);
  155 +
154 router.get('/favorite', FavoriteController.index); 156 router.get('/favorite', FavoriteController.index);
155 157
156 router.get('/coupons', CouponsController.index); 158 router.get('/coupons', CouponsController.index);
1 <div class="user-me-page me-page yoho-page clearfix"> 1 <div class="user-me-page me-page yoho-page clearfix">
2 - {{# user}} 2 +{{> path}}
  3 +{{> navigation}}
  4 +{{# user}}
3 <div class="me-main"> 5 <div class="me-main">
4 <div class="userinfo-edit block"> 6 <div class="userinfo-edit block">
5 <h2 class="title"></h2> 7 <h2 class="title"></h2>
@@ -16,5 +18,5 @@ @@ -16,5 +18,5 @@
16 </p> 18 </p>
17 {{/if}} 19 {{/if}}
18 </div> 20 </div>
19 - {{/ user}} 21 +{{/ user}}
20 </div> 22 </div>