Merge branch 'feature/channel' into develop
Showing
6 changed files
with
118 additions
and
0 deletions
@@ -23,5 +23,16 @@ module.exports = { | @@ -23,5 +23,16 @@ module.exports = { | ||
23 | channelModel.getResourcesData(req.query).then(result => { | 23 | channelModel.getResourcesData(req.query).then(result => { |
24 | return res.json(result); | 24 | return res.json(result); |
25 | }).catch(next); | 25 | }).catch(next); |
26 | + }, | ||
27 | + sidebar(req, res, next) { | ||
28 | + if (!req.xhr) { | ||
29 | + return res.render('sidebar', { | ||
30 | + module: 'channel', | ||
31 | + page: 'sidebar' | ||
32 | + }); | ||
33 | + } | ||
34 | + channelModel.getSidebarData(req.query).then(result => { | ||
35 | + return res.json(result); | ||
36 | + }).catch(next); | ||
26 | } | 37 | } |
27 | }; | 38 | }; |
@@ -15,6 +15,14 @@ let channel = { | @@ -15,6 +15,14 @@ let channel = { | ||
15 | }).then(result => { | 15 | }).then(result => { |
16 | return resourcesProcess(result.data); | 16 | return resourcesProcess(result.data); |
17 | }); | 17 | }); |
18 | + }, | ||
19 | + getSidebarData() { | ||
20 | + return api.get('operations/api/v6/category/getCategory', { | ||
21 | + parent_id: 1155 | ||
22 | + }, { | ||
23 | + cache: true, | ||
24 | + code: 200 | ||
25 | + }).then(global.yoho.camelCase); | ||
18 | } | 26 | } |
19 | }; | 27 | }; |
20 | 28 |
@@ -15,4 +15,6 @@ const router = expressRouter(); | @@ -15,4 +15,6 @@ const router = expressRouter(); | ||
15 | router.get('/', channel.index); // 首页 | 15 | router.get('/', channel.index); // 首页 |
16 | router.get('/resources', channel.resources); // 资源位接口 | 16 | router.get('/resources', channel.resources); // 资源位接口 |
17 | 17 | ||
18 | +router.get('/sidebar', channel.sidebar); // 资源位接口 | ||
19 | + | ||
18 | module.exports = router; | 20 | module.exports = router; |
apps/channel/views/action/sidebar.hbs
0 → 100644
public/js/channel/sidebar.page.js
0 → 100644
public/vue/channel/sidebar.vue
0 → 100644
1 | +<template> | ||
2 | + <div class="sidebar"> | ||
3 | + <template v-for="item in list"> | ||
4 | + <a class="item" href="{{item.sortUrl}}"> | ||
5 | + {{item.sortNameEn}}{{item.sortName}} | ||
6 | + </a> | ||
7 | + <template v-if="item.separativeSign === 'Y'"> | ||
8 | + <div class="sep"> | ||
9 | + <!-- 分割线 --> | ||
10 | + </div> | ||
11 | + </template> | ||
12 | + </template> | ||
13 | + </div> | ||
14 | +</template> | ||
15 | + | ||
16 | +<script> | ||
17 | + // const tab = require('channel/tab.vue'); | ||
18 | + // const resources = require('component/resources/index.vue'); | ||
19 | + | ||
20 | + module.exports = { | ||
21 | + data() { | ||
22 | + return { | ||
23 | + list: [] | ||
24 | + }; | ||
25 | + }, | ||
26 | + components: { | ||
27 | + }, | ||
28 | + created() { | ||
29 | + $.ajax({ | ||
30 | + url: '/sidebar' | ||
31 | + }).then((res) => { | ||
32 | + this.list = res.data; | ||
33 | + }); | ||
34 | + } | ||
35 | + }; | ||
36 | +</script> | ||
37 | + | ||
38 | +<style> | ||
39 | + @import "../../scss/common/color"; | ||
40 | + | ||
41 | + .sidebar { | ||
42 | + width: 100%; | ||
43 | + background: $white; | ||
44 | + overflow-x: hidden; | ||
45 | + | ||
46 | + .item { | ||
47 | + position: relative; | ||
48 | + display: block; | ||
49 | + padding: 0 30px; | ||
50 | + width: 100%; | ||
51 | + height: 126px; | ||
52 | + line-height: 126px; | ||
53 | + font-size: 30px; | ||
54 | + font-weight: bold; | ||
55 | + | ||
56 | + &:after { | ||
57 | + content: ""; | ||
58 | + position: absolute; | ||
59 | + left: 30px; | ||
60 | + bottom: -1px; | ||
61 | + width: 100%; | ||
62 | + height: 0; | ||
63 | + border-top: 1px solid #eee; | ||
64 | + } | ||
65 | + | ||
66 | + &:last-child:after { | ||
67 | + content: none; | ||
68 | + } | ||
69 | + } | ||
70 | + | ||
71 | + .sep { | ||
72 | + width: 100%; | ||
73 | + height: 22px; | ||
74 | + background: #f6f6f6; | ||
75 | + border-top: 1px solid #eee; | ||
76 | + border-bottom: 1px solid #eee; | ||
77 | + } | ||
78 | + } | ||
79 | +</style> |
-
Please register or login to post a comment