Showing
8 changed files
with
269 additions
and
13 deletions
1 | /** | 1 | /** |
2 | * 主页 | 2 | * 主页 |
3 | - * @author: Bi Kai<kai.bi@yoho.cn> | ||
4 | - * @date: 2016/05/09 | 3 | + * @author: shenzm<zhimin.shen@yoho.cn> |
4 | + * @date: 2016/07/18 | ||
5 | */ | 5 | */ |
6 | 'use strict'; | 6 | 'use strict'; |
7 | const _ = require('lodash'); | 7 | const _ = require('lodash'); |
8 | const helpers = global.yoho.helpers; | 8 | const helpers = global.yoho.helpers; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | - * 频道选择页 | 11 | + * 个人中心主页 |
12 | */ | 12 | */ |
13 | const component = { | 13 | const component = { |
14 | index: (req, res, next) => { | 14 | index: (req, res, next) => { |
15 | - res.render('index', { | ||
16 | - module: 'example', | ||
17 | - page: 'home' | ||
18 | - }); | 15 | + var testData = { |
16 | + isLogin: false, | ||
17 | + head_ico: "", | ||
18 | + profile_name: "XXX", | ||
19 | + signinUrl: "/home", | ||
20 | + wait_pay_num: 1, | ||
21 | + wait_cargo_num: 2, | ||
22 | + send_cargo_num: 3 | ||
23 | + } | ||
24 | + res.render('index', _.merge({ | ||
25 | + module: 'home', | ||
26 | + page: 'index' | ||
27 | + }, testData)); | ||
19 | } | 28 | } |
20 | }; | 29 | }; |
21 | 30 |
@@ -4,14 +4,14 @@ | @@ -4,14 +4,14 @@ | ||
4 | * @date: 2016/07/18 | 4 | * @date: 2016/07/18 |
5 | */ | 5 | */ |
6 | 6 | ||
7 | -var express = require('express'), | ||
8 | - path = require('path'), | ||
9 | - hbs = require('express-handlebars'); | 7 | +const express = require('express'); |
8 | +const path = require('path'); | ||
9 | +const hbs = require('express-handlebars'); | ||
10 | 10 | ||
11 | -var app = express(); | 11 | +const app = express(); |
12 | 12 | ||
13 | // set view engin | 13 | // set view engin |
14 | -var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root | 14 | +const doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root |
15 | 15 | ||
16 | app.on('mount', function(parent) { | 16 | app.on('mount', function(parent) { |
17 | delete parent.locals.settings; // 不继承父 App 的设置 | 17 | delete parent.locals.settings; // 不继承父 App 的设置 |
@@ -8,7 +8,9 @@ | @@ -8,7 +8,9 @@ | ||
8 | 8 | ||
9 | const router = require('express').Router(); | 9 | const router = require('express').Router(); |
10 | const cRoot = './controllers'; | 10 | const cRoot = './controllers'; |
11 | +const home = require(cRoot); | ||
11 | 12 | ||
12 | // Your controller here | 13 | // Your controller here |
14 | +router.get('/', home.index); // 个人中心主页 | ||
13 | 15 | ||
14 | module.exports = router; | 16 | module.exports = router; |
1 | -<h1>test</h1> | ||
1 | +<div class="my-page yoho-page"> | ||
2 | + <div class="my-header"> | ||
3 | + {{#isLogin}} | ||
4 | + <a class="user-info" href="/home/mydetails"> | ||
5 | + <span class="user-avatar" data-avatar="{{head_ico}}"></span> | ||
6 | + <br><span class="username">{{profile_name}}</span> | ||
7 | + </a> | ||
8 | + {{/isLogin}} | ||
9 | + {{^isLogin}} | ||
10 | + <div class="user-info"> | ||
11 | + <a class="login-btn" href="{{signinUrl}}"> | ||
12 | + 登录/注册 | ||
13 | + </a> | ||
14 | + </div> | ||
15 | + {{/isLogin}} | ||
16 | + </div> | ||
17 | + <div class="my-order"> | ||
18 | + <a class="order-title" href="/home/orders"> | ||
19 | + 我的订单 | ||
20 | + <span> | ||
21 | + 查看全部订单 <span class="icon icon-right"></span> | ||
22 | + </span> | ||
23 | + </a> | ||
24 | + <div class="order-type clearfix"> | ||
25 | + <a class="type-item" href="/home/orders?type=2"> | ||
26 | + <span></span> | ||
27 | + <br>待付款 | ||
28 | + {{#if wait_pay_num}} | ||
29 | + <span class="num">{{wait_pay_num}}</span> | ||
30 | + {{/if}} | ||
31 | + </a> | ||
32 | + <a class="type-item" href="/home/orders?type=3"> | ||
33 | + <span></span> | ||
34 | + <br>待发货 | ||
35 | + {{#if wait_cargo_num}} | ||
36 | + <span class="num">{{wait_cargo_num}}</span> | ||
37 | + {{/if}} | ||
38 | + </a> | ||
39 | + <a class="type-item" href="/home/orders?type=4"> | ||
40 | + <span></span> | ||
41 | + <br>待收货 | ||
42 | + {{#if send_cargo_num}} | ||
43 | + <span class="num">{{send_cargo_num}}</span> | ||
44 | + {{/if}} | ||
45 | + </a> | ||
46 | + <a class="type-item" href="/home/orders?type=5"> | ||
47 | + <span></span> | ||
48 | + <br>退换货 | ||
49 | + {{#if send_cargo_num}} | ||
50 | + <span class="num">{{send_cargo_num}}</span> | ||
51 | + {{/if}} | ||
52 | + </a> | ||
53 | + </div> | ||
54 | + </div> | ||
55 | + <div class="group-list"> | ||
56 | + <a class="list-item" href="/home/address"> | ||
57 | + 地址管理 | ||
58 | + <span class="num">3 <span class="icon icon-right"></span></span> | ||
59 | + </a> | ||
60 | + </div> | ||
61 | + <div class="group-list"> | ||
62 | + <a class="list-item" href="/home/favorite"> | ||
63 | + 收藏的商品 | ||
64 | + <span class="num">120 <span class="icon icon-right"></span></span> | ||
65 | + </a> | ||
66 | + <a class="list-item" href="/home/favorite?tab=brand"> | ||
67 | + 收藏的品牌 | ||
68 | + <span class="num">100 <span class="icon icon-right"></span></span> | ||
69 | + </a> | ||
70 | + </div> | ||
71 | + <div class="group-list"> | ||
72 | + <a class="list-item" href="/home/mycurrency"> | ||
73 | + YOHO 币 | ||
74 | + <span class="num">100 <span class="icon icon-right"></span></span> | ||
75 | + </a> | ||
76 | + </div> | ||
77 | + <div class="group-list"> | ||
78 | + <a class="list-item" href="/home/help"> | ||
79 | + 帮助中心 | ||
80 | + <span class="num"><span class="icon icon-right"></span></span> | ||
81 | + </a> | ||
82 | + <a class="list-item" href="/home/onlineService"> | ||
83 | + 在线客服 | ||
84 | + <span class="num"><span class="icon icon-right"></span></span> | ||
85 | + </a> | ||
86 | + </div> | ||
87 | +</div> |
@@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
6 | 6 | ||
7 | module.exports = app => { | 7 | module.exports = app => { |
8 | app.use('/', require('./apps/channel')); | 8 | app.use('/', require('./apps/channel')); |
9 | + app.use('/home', require('./apps/home')); | ||
9 | 10 | ||
10 | // 组件示例 | 11 | // 组件示例 |
11 | if (app.locals.devEnv) { | 12 | if (app.locals.devEnv) { |
public/js/home/index.page.js
0 → 100644
1 | +console.log("test"); |
public/scss/home/_index.css
0 → 100644
1 | +.my-page { | ||
2 | + color: #444; | ||
3 | + background: #f0f0f0; | ||
4 | + | ||
5 | + a { | ||
6 | + color: #444; | ||
7 | + } | ||
8 | + | ||
9 | + .user-info { | ||
10 | + display: block; | ||
11 | + position: relative; | ||
12 | + padding: 0 30px; | ||
13 | + color: #fff; | ||
14 | + font-size: 34px; | ||
15 | + line-height: 138px; | ||
16 | + height: 449px; | ||
17 | + background-size: cover; | ||
18 | + background: #444; | ||
19 | + /*background: resolve("home/header-bg.jpg"); */ | ||
20 | + text-align: center; | ||
21 | + | ||
22 | + .user-avatar { | ||
23 | + display: inline-block; | ||
24 | + position: relative; | ||
25 | + top: 88px; | ||
26 | + width: 200px; | ||
27 | + height: 200px; | ||
28 | + border-radius: 50%; | ||
29 | + border: 6px solid #a7a8a9; | ||
30 | + background: #a7a8a9; | ||
31 | + background-size: 100%; | ||
32 | + } | ||
33 | + | ||
34 | + .username { | ||
35 | + display: inline-block; | ||
36 | + padding: 0 16px; | ||
37 | + text-overflow: ellipsis; | ||
38 | + overflow: hidden; | ||
39 | + white-space: nowrap; | ||
40 | + max-width: 260px; | ||
41 | + } | ||
42 | + } | ||
43 | + | ||
44 | + .login-btn { | ||
45 | + display: inline-block; | ||
46 | + top: 40px; | ||
47 | + left: 194px; | ||
48 | + width: 244px; | ||
49 | + height: 82px; | ||
50 | + line-height: 82px; | ||
51 | + color: #fff; | ||
52 | + border: 4px solid #fff; | ||
53 | + margin: 120px auto; | ||
54 | + } | ||
55 | + | ||
56 | + .my-order { | ||
57 | + margin-bottom: 30px; | ||
58 | + border-top: 1px solid #e0e0e0; | ||
59 | + border-bottom: 1px solid #e0e0e0; | ||
60 | + background: #fff; | ||
61 | + | ||
62 | + .order-title { | ||
63 | + display: block; | ||
64 | + padding: 0 30px; | ||
65 | + font-size: 16PX; | ||
66 | + line-height: 88px; | ||
67 | + | ||
68 | + span { | ||
69 | + color: #e0e0e0; | ||
70 | + float: right; | ||
71 | + } | ||
72 | + | ||
73 | + &.highlight { | ||
74 | + background: #eee; | ||
75 | + } | ||
76 | + } | ||
77 | + | ||
78 | + .order-type { | ||
79 | + padding: 20px 30px; | ||
80 | + text-align: center; | ||
81 | + border-top: 1px solid #e0e0e0; | ||
82 | + | ||
83 | + .type-item { | ||
84 | + position: relative; | ||
85 | + float: left; | ||
86 | + color: #444; | ||
87 | + font-size: 14PX; | ||
88 | + line-height: 1.5; | ||
89 | + width: 170px; | ||
90 | + | ||
91 | + &.highlight { | ||
92 | + background: #eee; | ||
93 | + } | ||
94 | + | ||
95 | + .num { | ||
96 | + position: absolute; | ||
97 | + top: -24px; | ||
98 | + right: 36px; | ||
99 | + width: 72px; | ||
100 | + height: 72px; | ||
101 | + font-size: 40px; | ||
102 | + line-height: 72px; | ||
103 | + color: #fff; | ||
104 | + background: #f03d35; | ||
105 | + text-align: center; | ||
106 | + border-radius: 50%; | ||
107 | + transform: scale(0.5); | ||
108 | + } | ||
109 | + } | ||
110 | + } | ||
111 | + } | ||
112 | + | ||
113 | + .group-list { | ||
114 | + margin-bottom: 30px; | ||
115 | + border-top: 1px solid #e0e0e0; | ||
116 | + border-bottom: 1px solid #e0e0e0; | ||
117 | + background: #fff; | ||
118 | + | ||
119 | + .list-item { | ||
120 | + display: block; | ||
121 | + position: relative; | ||
122 | + padding: 0 30px; | ||
123 | + font-size: 16PX; | ||
124 | + line-height: 90px; | ||
125 | + | ||
126 | + &.highlight { | ||
127 | + background: #eee; | ||
128 | + } | ||
129 | + | ||
130 | + &:after { | ||
131 | + content: ''; | ||
132 | + position: absolute; | ||
133 | + right: 0; | ||
134 | + bottom: 0; | ||
135 | + width: 100%; | ||
136 | + height: 0; | ||
137 | + border-top: 1px solid #f0f0f0; | ||
138 | + } | ||
139 | + | ||
140 | + &:last-child:after { | ||
141 | + content: none; | ||
142 | + } | ||
143 | + } | ||
144 | + | ||
145 | + .icon { | ||
146 | + margin-right: 5px; | ||
147 | + font-size: 30px; | ||
148 | + vertical-align: top; | ||
149 | + } | ||
150 | + | ||
151 | + .num { | ||
152 | + color: #e0e0e0; | ||
153 | + float: right; | ||
154 | + } | ||
155 | + } | ||
156 | +} |
-
Please register or login to post a comment