...
|
...
|
@@ -5,6 +5,7 @@ |
|
|
*/
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
const mcHandler = require('../models/menu-crumb-handler');
|
|
|
const helpers = global.yoho.helpers;
|
|
|
const settingModel = require('../models/setting');
|
...
|
...
|
@@ -81,26 +82,27 @@ const index = (req, res, next) => { |
|
|
|
|
|
Promise.all([settingModel.getUserInfo(uid), mcHandler.getMeThumb()]).then(result => {
|
|
|
const thumb = result[1];
|
|
|
let user = result[0];
|
|
|
|
|
|
result[0].info.gender ? result[0].genders[result[0].info.gender - 1].checked = true :
|
|
|
result[0].genders[2].checked = true;
|
|
|
result[0].info.head_ico = result[0].info.head_ico ? helpers.image(result[0].info.head_ico, 400, 300, 2) : '';
|
|
|
result[0].info.mobile = result[0].info.mobile ? result[0].info.mobile.replace(regMobile, '$1****$2') : '';
|
|
|
result[0].stepUrl = '/me/setting/step1';
|
|
|
if (result[0].info.birthday) {
|
|
|
let a = result[0].info.birthday.split('-');
|
|
|
user.info.gender ? user.genders[user.info.gender - 1].checked = true :
|
|
|
user.genders[2].checked = true;
|
|
|
user.info.head_ico = user.info.head_ico ? helpers.image(user.info.head_ico, 400, 300, 2) : '';
|
|
|
user.info.mobile = user.info.mobile ? user.info.mobile.replace(regMobile, '$1****$2') : '';
|
|
|
user.stepUrl = '/me/setting/step1';
|
|
|
if (user.info.birthday) {
|
|
|
let a = user.info.birthday.split('-');
|
|
|
|
|
|
_.forEach(result[0].date.selectYear, function(x) {
|
|
|
_.forEach(user.date.selectYear, function(x) {
|
|
|
if (x.value === a[0]) {
|
|
|
x.isSelected = 'selected';
|
|
|
}
|
|
|
});
|
|
|
_.forEach(result[0].date.selectMonth, function(x) {
|
|
|
_.forEach(user.date.selectMonth, function(x) {
|
|
|
if (parseInt(x.value, 10) === parseInt(a[1], 10)) {
|
|
|
x.isSelected = 'selected';
|
|
|
}
|
|
|
});
|
|
|
_.forEach(result[0].date.selectDay, function(x) {
|
|
|
_.forEach(user.date.selectDay, function(x) {
|
|
|
if (parseInt(x.value, 10) === parseInt(a[2], 10)) {
|
|
|
x.isSelected = 'selected';
|
|
|
}
|
...
|
...
|
@@ -117,7 +119,8 @@ const index = (req, res, next) => { |
|
|
banner: thumb,
|
|
|
setting: true,
|
|
|
title: '个人设置',
|
|
|
userInfo: result[0]
|
|
|
userInfo: user,
|
|
|
_token: req.csrfToken()
|
|
|
}
|
|
|
});
|
|
|
}).catch(next);
|
...
|
...
|
|