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 = {
@@ -71,18 +72,18 @@ const configData = { @@ -71,18 +72,18 @@ const configData = {
71 value: '1', 72 value: '1',
72 text: '目的型购物' 73 text: '目的型购物'
73 }, 74 },
74 - {  
75 - type: 'radio',  
76 - key: 'shopping',  
77 - value: '2',  
78 - text: '冲动型购物'  
79 - },  
80 - {  
81 - type: 'radio',  
82 - key: 'shopping',  
83 - value: '3',  
84 - text: '保守型购物'  
85 - }], 75 + {
  76 + type: 'radio',
  77 + key: 'shopping',
  78 + value: '2',
  79 + text: '冲动型购物'
  80 + },
  81 + {
  82 + type: 'radio',
  83 + key: 'shopping',
  84 + value: '3',
  85 + text: '保守型购物'
  86 + }],
86 87
87 // 着装习惯 88 // 着装习惯
88 dressHabits: [{ 89 dressHabits: [{
@@ -92,48 +93,50 @@ const configData = { @@ -92,48 +93,50 @@ const configData = {
92 value: '1', 93 value: '1',
93 text: '正装' 94 text: '正装'
94 }, 95 },
95 - {  
96 - type: 'checkbox',  
97 - key: 'dress[]',  
98 - index: 'dress-2',  
99 - value: '2',  
100 - text: '商务'  
101 - },  
102 - {  
103 - type: 'checkbox',  
104 - key: 'dress[]',  
105 - index: 'dress-3',  
106 - value: '3',  
107 - text: '街头流行'  
108 - },  
109 - {  
110 - type: 'checkbox',  
111 - key: 'dress[]',  
112 - index: 'dress-4',  
113 - value: '4',  
114 - text: '运动休闲'  
115 - },  
116 - {  
117 - type: 'checkbox',  
118 - key: 'dress[]',  
119 - index: 'dress-5',  
120 - value: '5',  
121 - text: '文艺气质'  
122 - },  
123 - {  
124 - type: 'checkbox',  
125 - key: 'dress[]',  
126 - index: 'dress-6',  
127 - value: '6',  
128 - text: '甜美可爱'  
129 - },  
130 - {  
131 - type: 'checkbox',  
132 - key: 'dress[]',  
133 - index: 'dress-7',  
134 - value: '7',  
135 - text: '另类'  
136 - }] 96 + {
  97 + type: 'checkbox',
  98 + key: 'dress[]',
  99 + index: 'dress-2',
  100 + value: '2',
  101 + text: '商务'
  102 + },
  103 + {
  104 + type: 'checkbox',
  105 + key: 'dress[]',
  106 + index: 'dress-3',
  107 + value: '3',
  108 + text: '街头流行'
  109 + },
  110 + {
  111 + type: 'checkbox',
  112 + key: 'dress[]',
  113 + index: 'dress-4',
  114 + value: '4',
  115 + text: '运动休闲'
  116 + },
  117 + {
  118 + type: 'checkbox',
  119 + key: 'dress[]',
  120 + index: 'dress-5',
  121 + value: '5',
  122 + text: '文艺气质'
  123 + },
  124 + {
  125 + type: 'checkbox',
  126 + key: 'dress[]',
  127 + index: 'dress-6',
  128 + value: '6',
  129 + text: '甜美可爱'
  130 + },
  131 + {
  132 + type: 'checkbox',
  133 + key: 'dress[]',
  134 + index: 'dress-7',
  135 + value: '7',
  136 + text: '另类'
  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}}  
3 - <div class="me-main">  
4 - <div class="userinfo-edit block">  
5 - <h2 class="title"></h2>  
6 - <div class="edit-box">  
7 - {{> home/edit/basicinfo}}  
8 - {{> home/edit/contactinfo}}  
9 - {{> home/edit/habbit}}  
10 - {{> home/edit/favorite}}  
11 - </div> 2 +{{> path}}
  3 +{{> navigation}}
  4 +{{# user}}
  5 + <div class="me-main">
  6 + <div class="userinfo-edit block">
  7 + <h2 class="title"></h2>
  8 + <div class="edit-box">
  9 + {{> home/edit/basicinfo}}
  10 + {{> home/edit/contactinfo}}
  11 + {{> home/edit/habbit}}
  12 + {{> home/edit/favorite}}
12 </div> 13 </div>
13 - {{#if isShowTip}}  
14 - <p class="help-us">  
15 - 如果你还使用了我们的其他产品(Yoho!Now和mars)修改个人信息时将同步  
16 - </p>  
17 - {{/if}}  
18 </div> 14 </div>
19 - {{/ user}} 15 + {{#if isShowTip}}
  16 + <p class="help-us">
  17 + 如果你还使用了我们的其他产品(Yoho!Now和mars)修改个人信息时将同步
  18 + </p>
  19 + {{/if}}
  20 + </div>
  21 +{{/ user}}
20 </div> 22 </div>