Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohoblk-wap
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
zhangxiaoru
8 years ago
Commit
7aa240b4c701034cf2ce804209b44fb736ad6696
1 parent
87ea3a04
特权列表页
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
93 additions
and
19 deletions
apps/channel/controllers/channel.js
apps/me/controllers/index.js
apps/me/models/index.js
apps/me/router.js
apps/me/views/action/privilege.hbs
public/scss/me/_index.css
public/scss/me/_vip-grade.css
public/vue/me/home.vue
public/vue/me/mydetails.vue
public/vue/me/vip-grade.vue
apps/channel/controllers/channel.js
View file @
7aa240b
...
...
@@ -33,7 +33,7 @@ module.exports = {
res
.
locals
.
resources
=
resources
;
res
.
render
(
'index'
,
{
res
.
render
(
'
c
index'
,
{
module
:
'channel'
,
page
:
'home'
,
channel
:
channel
...
...
apps/me/controllers/index.js
View file @
7aa240b
...
...
@@ -8,6 +8,11 @@ const homeModel = require('../models/index');
const
helpers
=
global
.
yoho
.
helpers
;
const
_
=
require
(
'lodash'
);
let
channels
=
{
men
:
1
,
women
:
2
};
/**
* 个人中心主页
*/
...
...
@@ -19,7 +24,7 @@ const component = {
});
},
userdata
:
(
req
,
res
,
next
)
=>
{
const
uid
=
req
.
user
.
uid
;
// 8039759;
const
uid
=
req
.
user
.
uid
;
homeModel
.
getUserHomeData
(
uid
).
then
(
data
=>
{
const
proData
=
data
[
0
];
...
...
@@ -34,7 +39,7 @@ const component = {
}).
catch
(
next
);
},
mydetails
:
(
req
,
res
,
next
)
=>
{
const
uid
=
req
.
user
.
uid
;
// 8039759;
const
uid
=
req
.
user
.
uid
;
homeModel
.
getUserProfileData
(
uid
).
then
(
data
=>
{
var
gender
=
''
;
...
...
@@ -266,12 +271,30 @@ const component = {
});
},
gradeData
(
req
,
res
,
next
)
{
let
uid
=
11151547
;
// req.user.uid ;
let
channel
=
req
.
query
.
channel
||
1
;
let
uid
=
req
.
user
.
uid
;
let
channel
=
req
.
cookies
.
_Channel
&&
channels
[
req
.
cookies
.
_Channel
]
||
1
;
homeModel
.
getGrade
(
uid
,
channel
).
then
(
result
=>
{
res
.
json
(
result
);
}).
catch
(
next
);
},
preferential
(
req
,
res
,
next
)
{
let
responseData
=
{
module
:
'me'
,
page
:
'grade'
,
title
:
'会员特权详情'
};
let
param
=
{
uid
:
req
.
user
.
uid
,
channel
:
req
.
cookies
.
_Channel
&&
channels
[
req
.
cookies
.
_Channel
]
||
1
};
homeModel
.
getPreferential
(
param
).
then
((
result
)
=>
{
res
.
render
(
'privilege'
,
Object
.
assign
(
result
,
responseData
));
}).
catch
(
next
);
}
};
...
...
apps/me/models/index.js
View file @
7aa240b
...
...
@@ -324,13 +324,13 @@ exports.getGrade = (uid, channel) => {
_
.
forEach
(
result
[
0
].
data
.
enjoy_preferential
,
function
(
val
)
{
if
(
val
.
id
===
7
||
val
.
id
===
8
)
{
if
(
parseInt
(
val
.
id
,
10
)
===
7
||
parseInt
(
val
.
id
,
10
)
===
8
)
{
return
true
;
}
obj
.
privilege
.
push
({
description
:
val
.
description
,
pic
:
iconId
(
parseInt
(
val
.
id
)),
pic
:
iconId
(
parseInt
(
val
.
id
,
10
)),
title
:
val
.
title
});
...
...
@@ -339,7 +339,7 @@ exports.getGrade = (uid, channel) => {
switch
(
result
[
0
].
data
.
current_vip_level
)
{
case
'0'
:
// 普通会员
obj
=
_
.
assign
(
obj
,
{
vip
1
:
true
vip
0
:
true
});
break
;
case
'1'
:
// 银卡会员
...
...
@@ -366,7 +366,7 @@ exports.getGrade = (uid, channel) => {
obj
=
_
.
assign
(
obj
,
{
costOfThisYear
:
result
[
0
].
data
.
current_year_cost
,
sumCost
:
result
[
0
].
data
.
current_total_cost
,
allUrl
:
helpers
.
urlFormat
(
'/
ho
me/privilege'
),
allUrl
:
helpers
.
urlFormat
(
'/me/privilege'
),
costGap
:
upg
});
...
...
@@ -401,3 +401,38 @@ exports.getGrade = (uid, channel) => {
}
};
exports
.
getPreferential
=
(
params
)
=>
{
return
api
.
get
(
''
,
{
method
:
'app.passport.getPrivilege'
,
uid
:
params
.
uid
,
channel
:
params
.
channel
||
1
},
{
code
:
200
}).
then
((
result
)
=>
{
let
obj
=
{};
let
resu
=
{
privilege
:
[]
};
_
.
forEach
(
result
.
data
,
function
(
val
)
{
if
(
parseInt
(
val
.
id
,
10
)
===
7
||
parseInt
(
val
.
id
,
10
)
===
8
)
{
return
true
;
}
resu
.
privilege
.
push
({
description
:
val
.
description
,
pic
:
iconId
(
parseInt
(
val
.
id
,
10
)),
title
:
val
.
title
});
});
return
resu
;
});
};
...
...
apps/me/router.js
View file @
7aa240b
...
...
@@ -92,7 +92,8 @@ router.get('/me/prefer', require(cRoot + '/prefer').index);
router
.
get
(
'/me/preferlist'
,
require
(
cRoot
+
'/prefer'
).
list
);
// 会员等级
router
.
get
(
'/me/grade'
,
home
.
grade
);
router
.
get
(
'/me/gradeData'
,
home
.
gradeData
);
router
.
get
(
'/me/grade'
,
auth
,
home
.
grade
);
router
.
get
(
'/me/gradeData'
,
auth
,
home
.
gradeData
);
router
.
get
(
'/me/privilege'
,
auth
,
home
.
preferential
);
module
.
exports
=
router
;
...
...
apps/me/views/action/privilege.hbs
0 → 100644
View file @
7aa240b
<div
class=
"vip-privilege-page yoho-page"
>
<ul
class=
"privilege-list"
>
{{#
each
privilege
}}
<li>
<span
class=
"icon
{{
pic
}}
"
></span>
<p>
{{
title
}}
<span>
{{
description
}}
</span>
</p>
</li>
{{/
each
}}
</ul>
</div>
\ No newline at end of file
...
...
public/scss/me/_index.css
View file @
7aa240b
@import
"help"
;
@import
"feedback"
;
@import
"about-us"
;
@import
"vip-grade"
;
...
...
public/scss/me/_vip-grade.css
View file @
7aa240b
...
...
@@ -40,7 +40,7 @@
height
:
32px
;
line-height
:
36px
;
}
.grade-desc
{
margin-top
:
20px
;
font-size
:
22px
;
...
...
@@ -143,9 +143,10 @@
font-size
:
30px
;
margin-bottom
:
0
;
.iconfont
{
span
{
float
:
right
;
color
:
#e0e0e0
;
line-height
:
90px
;
}
}
}
...
...
public/vue/me/home.vue
View file @
7aa240b
...
...
@@ -6,7 +6,7 @@
<a class="user-info auth" id="user-info" href='/me/mydetails'>
<img class="user-avatar" :src="headIco" @error="setEmptyimg">
</a>
<a class="vip-level level-{{data.vipLevel}}" v-if="data.vipLevel"></a>
<a class="vip-level level-{{data.vipLevel}}" v-if="data.vipLevel"
href='/me/grade'
></a>
<span class="username">{{ data.nickName }}</span>
</div>
<div class="my-order">
...
...
public/vue/me/mydetails.vue
View file @
7aa240b
...
...
@@ -29,7 +29,7 @@
</li>
<li>
<label>会员等级
<a class="grade">
<a class="grade"
href="/me/grade"
>
<span class="icon icon-right"></span>
</a>
</label>
...
...
public/vue/me/vip-grade.vue
View file @
7aa240b
...
...
@@ -92,7 +92,7 @@
</li>
</ul>
<div class="privilege block" v-if="
vipGrade.vip2
">
<div class="privilege block" v-if="
!vipGrade.vip0
">
<h3 class="title">当前可享受的特权</h3>
<ul class="privilege-list">
<li v-for="pri in vipGrade.privilege">
...
...
@@ -107,7 +107,7 @@
<a class="all-privilege block tap-hightlight" href="{{vipGrade.allUrl}}">
查看全部VIP特权
<span class="icon
font">
</span>
<span class="icon
icon-right">
</span>
</a>
</template>
...
...
@@ -128,12 +128,12 @@
}).then(result => {
this.vipGrade = result || {};
});
}
}
},
ready() {
this.reload();
}
}
}
;
</script>
<style>
...
...
Please
register
or
login
to post a comment