Authored by 李靖

恢复个人中心修改

... ... @@ -232,16 +232,3 @@ exports.preferential = (req, res, next) => {
}).catch(next);
};
exports.modify = (req, res, next) => {
let params = {
uid: req.user.uid,
nickName: req.query.nickName,
gender: req.query.gender,
birthday: req.query.birthday
};
indexModel.modify(params).then((result) => {
res.json(result);
}).catch(next);
};
... ...
... ... @@ -509,18 +509,6 @@ const getPreferential = (params) => {
});
};
const modify = (params) => {
return api.get('', {
method: 'app.passport.modifyBase',
uid: params.uid,
nick_name: params.nickName,
gender: params.gender,
birthday: params.birthday
}).then((result) => {
return result;
});
};
module.exports = {
index,
myDetails,
... ... @@ -528,6 +516,5 @@ module.exports = {
delRecord,
getGrade,
getPreferential,
getGradeGrade,
modify
getGradeGrade
};
... ...
... ... @@ -67,7 +67,6 @@ router.post('/orders/sure', auth, orderController.sure); // 确认收货
router.get('/', homeController.index); // 个人中心首页
router.get('/mydetails', auth, homeController.myDetails); // 个人基本资料页面
router.get('/mydetails/modify', homeController.modify); // 个人基本资料修改
// router.get('/grade', auth, homeController.grade); // 会员等级页
router.get('/privilege', homeController.preferential); // 会员特权列表页
... ...
<div class="personal-details yoho-page">
<ul>
<li><span>头像</span><span><i class="head-portrait user-avatar" data-avatar="{{image head_ico 128 128}}"></i></span></li>
<li><span>昵称</span><span><input type="text" class="modify nick-name" value="{{ nickname }}" /></span></li>
<li><span>性别</span>
<span>
<select class="modify gender">
<option value="{{genderId}}">{{ gender }}</option>
<option value="{{otherGenderId}}">{{ otherGender }}</option>
</select>
</span>
</li>
<li><span>生日</span><span><input type="date" class="modify birthday" value="{{ birthday }}" /></span></li>
<li><span>昵称</span><span>{{ nickname }}</span></li>
<li><span>性别</span><span>{{ gender }}</span></li>
<li><span>生日</span><span>{{ birthday }}</span></li>
<li class="tap-hightlight"><span>会员等级</span>
<span>
<a href="grade" class="grade">
... ...
... ... @@ -9,68 +9,16 @@
* @author: bikai<kai.bi@yoho.cn>
* @date: 2015/11/19
*/
import $ from 'yoho-jquery';
import Page from 'yoho-page';
import tip from 'plugin/tip';
let $ = require('yoho-jquery');
let $userAvatar = $('.user-avatar');
let myImage = new Image(),
avatar;
require('common');
class PersonDetail extends Page {
constructor() {
super();
this.selector = {
$modifyInp: $('.modify'),
$nickName: $('.nick-name'),
$gender: $('.gender'),
$birthday: $('.birthday'),
};
this.init();
}
init() {
this.bindEvents();
// 部分老用户没有头像,显示默认头像
avatar = $userAvatar.data('avatar');
myImage.src = avatar;
myImage.onload = function() {
$userAvatar.css('background-image', 'url(' + avatar + ')');
};
}
bindEvents() {
this.selector.$modifyInp.on('blur', this.modifyInp.bind(this));
}
modifyInp() {
if (!this.selector.$nickName.val()) {
tip.show('请输入昵称');
return false;
}
this.ajax({
url: '/home/mydetails/modify',
data: {
nickName: this.selector.$nickName.val(),
gender: this.selector.$gender.val(),
birthday: this.selector.$birthday.val()
},
}).then(result => {
if (result && result.code === 200) {
location.href = location.href;
} else {
tip.show(result.message);
}
}).catch(error => {
tip.show(error);
});
}
}
$(() => {
new PersonDetail();
});
// 部分老用户没有头像,显示默认头像
avatar = $userAvatar.data('avatar');
myImage.src = avatar;
myImage.onload = function() {
$userAvatar.css('background-image', 'url(' + avatar + ')');
};
... ...
... ... @@ -6,14 +6,6 @@
background-color: #fff;
border-bottom: 1px solid #e0e0e0;
input::-webkit-clear-button {
display: none;
}
input::-webkit-calendar-picker-indicator {
display: none;
}
ul {
width: 95%;
height: auto;
... ... @@ -101,22 +93,6 @@
}
}
.modify {
width: auto;
border: 0;
background: none;
color: #b0b0b0;
text-align: right;
}
select {
direction: rtl;
}
.modify.nick-name {
width: 100%;
}
.tip {
background: url("/home/index/xwf.png");
background-size: 100%;
... ...