Authored by zhangxiaoru

detail

... ... @@ -9,6 +9,12 @@
const headerModel = require('../../../doraemon/models/header'); // 头部model
const indexModel = require('../models/index');
/**
* 用户中心首页
* @param req
* @param res
* @param next
*/
exports.index = (req, res, next) => {
let params = {
uid: req.user.uid
... ... @@ -32,3 +38,29 @@ exports.index = (req, res, next) => {
}).catch(next);
};
/**
* 个人基本资料页面
* @param req
* @param res
* @param next
*/
exports.myDetails = (req, res, next) => {
let headerData = headerModel.setNav({
navTitle: '基本资料'
});
let responseData = {
pageHeader: headerData,
module: 'home',
page: 'personal-details',
title: '基本资料',
pageFooter: true
};
indexModel.myDetails({
}).then(result => {
res.render('personal-details', Object.assign(responseData, result));
}).catch(next);
};
... ...
... ... @@ -115,6 +115,33 @@ const index = (params) => {
});
};
/**
* 个人基本资料
* @param params
*/
const myDetails = (params) => {
return api.get('', {
method: 'app.passport.profile',
uid: params.uid
}, {code: 200}).then((result) => {
result = camelCase(result);
if (result.data) {
return result.data;
// {
// nickname: result.data.nickname,
// gender: result.data.gender,
// birthday: result.data.birthday,
// headIco: result.data.headIco,
// vipInfo: {
// curLevel: result.data.vipInfo.curLevel
// }
// }
}
// return finalResult;
});
};
module.exports = {
index
index,
myDetails
};
... ...
... ... @@ -16,7 +16,7 @@ const orderDetail = (uid, orderCode) => {
order_code: orderCode
}).then((result) => {
let orderDetail = camelCase(result.data);
console.log(result);
//console.log(result);
// if(orderDetail.virtualType && orderDetail.virtualType === 3) {
// orderDetail = _.assign(orderDetail, {
... ...
... ... @@ -21,6 +21,8 @@ const orderDetailController = require(`${cRoot}/orderDetail`);
// 查看二维码
router.get('/QRcode/:id', personalController.QRcode);
/* 个人中心地址管理相关路由 */
router.get('/address', auth, addressController.address); // 地址管理页面
router.get('/addressAct', auth, addressController.addressAct); // 地址添加页面
router.get('/addressAct/:id', addressController.addressAct); // 地址添加修改页面
... ... @@ -28,12 +30,15 @@ router.post('/saveAddress', addressController.saveAddress); // 新增或者保
router.post('/defaultAddress', addressController.defaultAddress); // 设置默认地址
router.post('/delAddress', addressController.delAddress); // 删除地址
router.get('/locationList', addressController.locationList); // 异步获取三级地址数据
router.get('/orders', orderController.order);
router.get('/getOrders', orderController.getOrders);
router.get('/orderDetail', orderDetailController.orderDetail);
// 个人中心
router.get('/', homeController.index);
/* 个人中心订单相关路由 */
router.get('/orders', orderController.order); // 订单列表
router.get('/getOrders', orderController.getOrders); // 获取订单列表数据
router.get('/orderDetail', orderDetailController.orderDetail); // 订单详情页
router.get('/', homeController.index); // 个人中心首页
router.get('/mydetails', homeController.myDetails); // 个人基本资料页面
// 我的收藏
router.get('/favorite', favorite.favorite);
... ...
<div class="personal-details yoho-page">
<ul>
<li><span>头像</span><span><i class="head-portrait user-avatar" data-avatar="{{head_ico}}"></i></span></li>
<li><span>头像</span><span><i class="head-portrait user-avatar" data-avatar="{{image headIco 128 128}}"></i></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">
{{# vip_info}}
<i class="vip-icon vip-{{ cur_level}}"></i>
{{/ vip_info}}
{{# vipInfo}}
<i class="vip-icon vip-{{ curLevel}}"></i>
{{/ vipInfo}}
<span class="iconfont">&#xe604;</span>
</a>
</span>
</li>
</ul>
</div>
\ No newline at end of file
</div>
... ...
/**
* Created by PhpStorm.
* User: Targaryen
* Date: 2016/8/22
* Time: 18:05
*/
/**
* 个人信息
* @author: bikai<kai.bi@yoho.cn>
* @date: 2015/11/19
*/
var $ = require('yoho-jquery');
var $userAvatar = $('.user-avatar');
var myImage = new Image(),
avatar;
// 部分老用户没有头像,显示默认头像
avatar = $userAvatar.data('avatar');
myImage.src = avatar;
myImage.onload = function() {
$userAvatar.css('background-image', 'url(' + avatar + ')');
};
... ...
... ... @@ -4,16 +4,12 @@
padding-bottom: 20px;
.service {
/*margin-left: 50px;
width: 494px;*/
height: 28px;
background: resolve('product/service.png') no-repeat;
background-size: cover;
}
.limit-service {
/*margin-left: 50px;
width: 494px;*/
height: 28px;
background: resolve('product/limit.png') no-repeat;
background-size: cover;
... ...