Authored by biao

Merge branch 'develop' of http://git.yoho.cn/fe/yoho-blk into develop

... ... @@ -86,7 +86,7 @@ try {
const seo = require(`${global.middleware}/seo`);
const setYohoData = require(`${global.middleware}/set-yoho-data`);
// const errorHanlder = require(`${global.middleware}/error-handler`);
const errorHanlder = require(`${global.middleware}/error-handler`);
const setPageInfo = require(`${global.middleware}/set-pageinfo`);
const display = require(`${global.middleware}/display`);
... ... @@ -100,10 +100,10 @@ try {
require('./dispatch')(app);
// app.all('*', errorHanlder.notFound()); // 404
app.all('*', errorHanlder.notFound()); // 404
// YOHO 后置中间件
// app.use(errorHanlder.serverError());
app.use(errorHanlder.serverError());
} catch (err) {
logger.error(err);
}
... ...
... ... @@ -36,21 +36,25 @@ const index = (req, res) => {
{
typeId: '0',
isActive: true,
href: '#',
type: '最新'
},
{
typeId: '1',
isActive: false,
href: '#',
type: '话题'
},
{
typeId: '2',
isActive: false,
href: '#',
type: '搭配'
},
{
typeId: '3',
isActive: false,
href: '#',
type: '潮人'
},
{
... ... @@ -61,6 +65,7 @@ const index = (req, res) => {
],
msg: [
{
id: '1',
msgLeft: '潮品',
msgTitle: '很到位和范围的恢复文件和的减肥了晚餐费',
img: '',
... ... @@ -70,6 +75,7 @@ const index = (req, res) => {
like: '8'
},
{
id: '2',
msgLeft: '潮品',
msgTitle: '很到位和范围的恢复文件和的减肥了晚餐费',
img: '',
... ... @@ -93,6 +99,70 @@ const index = (req, res) => {
});
};
const list = (req, res) => {
var pageNum = req.query.page || 1;
res.display('list', {
module: 'editorial',
page: 'list',
title: '资讯列表',
editorialList: {
nav: [
{
link: '//guang.yohobuy.com/index/index?type=0',
pathTitle: '首页',
name: 'MEN首页'
},
{
link: '/',
pathTitle: '资讯',
name: '咨询'
},
{
link: '/',
pathTitle: '资讯',
name: '咨询'
}
],
pathTitle: '户外',
msg: [
{
id: '1',
msgLeft: '潮品',
msgTitle: '很到位和范围的恢复文件和的减肥了晚餐费',
img: '',
msgContent: '鞋款定价回复即可老地方了服务',
time: '2016/05/25 19:36',
liked: true,
like: '8'
},
{
id: '2',
msgLeft: '潮品',
msgTitle: '很到位和范围的恢复文件和的减肥了晚餐费',
img: '',
msgContent: '鞋款定价回复即可老地方了服务',
time: '2016/05/25 19:36',
liked: true,
like: '8'
}
],
paginationOpts: {
page: pageNum, // current page: http://host/?page=2
limit: 10, // per_page records' number
totalRows: 100 // total page number
}
},
helpers: {
// import component, path depends on your project
pagination: require('../../../doraemon/components/pagination/pagination').createPagination
}
});
};
module.exports = {
index // 组件demo页
index, // 组件demo页
list
};
... ...
... ... @@ -11,6 +11,6 @@ const cRoot = './controllers';
const editorial = require(cRoot + '/editorial');
router.get('/', editorial.index); // 咨询首页
// router.get('/list', editorial.list); // 咨询列表页
router.get('/list', editorial.list); // 咨询列表页
module.exports = router;
... ...
<div class="editorial-index-page">
<div class="editorial-index-page center-content">
{{# editorial}}
{{> path-nav}}
... ... @@ -6,7 +6,7 @@
<ul class="msg-nav">
{{# msgTypes}}
<li data-type="{{typeId}}" {{#if isActive}}class="active"{{/if}}>
<a class="pjax-link" href="{{navUrl}}">{{type}}</a>
<a class="pjax-link" href="{{href}}">{{type}}</a>
</li>
{{/ msgTypes}}
</ul>
... ...
<div class="editorial-list-page center-content">
{{# editorialList}}
{{> path-nav}}
<div class="list-content">
<span class="nav-title inline-block"><b>{{pathTitle}}</b>关联的文章</span>
<div id="msg-list" class="msg-list">
{{# msg}}
{{> msg}}
{{/ msg}}
</div>
<div class="paging">
{{{ pagination paginationOpts }}}
</div>
</div>
{{/ editorialList}}
</div>
\ No newline at end of file
... ...
<div class="content-msg clearfix" data-id="{{id}}">
<div class="msg-left">{{msgLeft}}</div>
<div class="msg-right">
<a class="msg-title">{{msgTitle}}</a>
<img class="lazy" data-original="{{img}}">
<a class="msg-title" href="{{url}}" target="_blank">{{msgTitle}}</a>
<a href="{{url}}" target="_blank">
<img class="lazy" data-original="{{img}}">
</a>
<div class="content">{{msgContent}}</div>
<div class="msg-app">
<span class="time">
... ...
... ... @@ -46,17 +46,17 @@ const index = (req, res) => {
navPath: {
nav: [
{
link: '',
link: '#',
pathTitle: '',
name: 'MEN首页'
},
{
link: '',
link: '#',
pathTitle: '',
name: '咨询'
},
{
link: '',
link: '#',
pathTitle: '',
name: '咨询'
}
... ...
... ... @@ -14,7 +14,5 @@ module.exports = app => {
app.use('/', require('./apps/channel')); // 频道页
app.use('/me', require('./apps/me')); // 个人中心
// 资讯
app.use('/editorial', require('./apps/editorial'));
app.use('/editorial', require('./apps/editorial')); // 资讯
};
... ...
... ... @@ -33,7 +33,7 @@ exports.createPagination = function(pagination, options) {
queryParams = '', // paginate with query parameter
page = parseInt(pagination.page, 10), // current page number
leftText = '<i class="iconfont">&#xe607;</i>', // prev
rightText = '<i class="iconfont">&#xe606;</i>', // next
rightText = '<i class="iconfont">&#xe61e;</i>', // next
paginationClass = 'blk-pagination'; // pagination <ul> default class
var pageCount,
... ...
<span class="iconfont">&#xe61b;</span>
\ No newline at end of file
<span class="iconfont">&#xe606;</span>
\ No newline at end of file
... ...
No preview for this file type
... ... @@ -2,7 +2,7 @@
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>
Created by FontForge 20120731 at Mon Jul 4 15:42:03 2016
Created by FontForge 20120731 at Wed Jul 6 11:07:02 2016
By admin
</metadata>
<defs>
... ... @@ -19,7 +19,7 @@ Created by FontForge 20120731 at Mon Jul 4 15:42:03 2016
bbox="0 -212 1303 896.303"
underline-thickness="50"
underline-position="-100"
unicode-range="U+0078-E61C"
unicode-range="U+0078-E620"
/>
<missing-glyph horiz-adv-x="374"
d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" />
... ... @@ -50,9 +50,10 @@ t-186.5 186.5t-257 68.5z" />
d="M968 -37l-163 164q69 108 69 234q0 119 -57.5 219t-157 158.5t-216 58.5t-216 -58.5t-157 -158.5t-57.5 -218.5t57.5 -219t157 -158.5t216.5 -58q124 0 231 69l163 -164q27 -28 65 -28t65 27.5t27 66t-27 66.5zM443.5 50q-127.5 0 -217.5 91.5t-90 220t90 219.5t217.5 91
t217.5 -91t90 -219.5t-90 -220t-217.5 -91.5z" />
<glyph glyph-name="uniE606" unicode="&#xe606;"
d="M387 158l45 -46l272 272l-272 272l-45 -46l226 -226z" />
d="M512 841q-94 0 -179.5 -37t-147.5 -99t-98.5 -147.5t-36.5 -179.5t36.5 -179.5t98.5 -147.5t147.5 -98.5t179.5 -36.5t179.5 36.5t147.5 98.5t98.5 147.5t36.5 179.5t-36.5 179.5t-98.5 147.5t-147.5 99t-179.5 37zM512 -33q-112 0 -206.5 55t-150 150t-55.5 206.5
t55.5 206.5t150 150t206.5 55t206.5 -55t150 -150t55.5 -206.5t-55.5 -206.5t-150 -150t-206.5 -55zM522 680h-51v-352h5l296 -120l19 47l-269 109v316z" />
<glyph glyph-name="uniE607" unicode="&#xe607;"
d="M704 665l-41 39l-343 -320l343 -320l41 39l-301 281z" />
d="M770 83l-49 -49l-337 335l337 335l49 -50l-284 -285z" />
<glyph glyph-name="uniE608" unicode="&#xe608;"
d="M959 -62l-85 -85l-362 362l-362 -362l-85 85l362 362l-362 362l85 85l362 -362l362 362l85 -85l-362 -362z" />
<glyph glyph-name="uniE609" unicode="&#xe609;"
... ... @@ -105,10 +106,16 @@ d="M1303 538l-161 242h-304v-443h233q19 0 32.5 14t13.5 33t-13.5 33t-32.5 14h-140v
q0 56 -31 105h363q-30 -49 -30 -105q0 -82 58 -140t140 -58t140 58t58 140q0 56 -31 105h77v363zM93 803h582v-535h-582v535zM465 70q0 -43 -30.5 -74t-74 -31t-74 31t-30.5 74t30.5 74t74 31t74 -31t30.5 -74zM1164 70q0 -43 -31 -74t-74 -31t-74 31t-31 74t31 74t74 31
t74 -31t31 -74z" />
<glyph glyph-name="uniE61B" unicode="&#xe61b;"
d="M512 -212q-104 0 -199 40.5t-163.5 109t-109 163.5t-40.5 199t40.5 199t109 163.5t163.5 109t199 40.5t199 -40.5t163.5 -109t109 -163.5t40.5 -199t-40.5 -199t-109 -163.5t-163.5 -109t-199 -40.5zM512 747q-91 0 -173.5 -35.5t-142.5 -95.5t-95.5 -142.5t-35.5 -173.5
t35.5 -173.5t95.5 -142.5t142.5 -95.5t173.5 -35.5t173.5 35.5t142.5 95.5t95.5 142.5t35.5 173.5t-35.5 173.5t-95.5 142.5t-142.5 95.5t-173.5 35.5zM482 267l-1 351h63v-319l198 -166l-39 -55z" />
d="M0 -128v1024h1024v-1024h-1024zM512 704q-133 0 -226.5 -93.5t-93.5 -226.5t93.5 -226.5t226.5 -93.5t226.5 93.5t93.5 226.5t-93.5 226.5t-226.5 93.5z" />
<glyph glyph-name="uniE61C" unicode="&#xe61c;" horiz-adv-x="1093"
d="M1092 225v171q0 101 -39.5 193.5t-106.5 159.5t-160 107t-194 40h-92q-101 0 -193.5 -40t-159.5 -107t-107 -159.5t-40 -193.5v-173v-317q0 -14 10 -24t24 -10h175q15 0 24.5 10t9.5 24v317q0 15 -9.5 24.5t-24.5 9.5h-128v116q0 88 34 168t92 137.5t138 92t168 34.5h67
q87 0 167 -34.5t138 -92t92 -137.5t34 -168v-113h-129q-15 0 -24.5 -10t-9.5 -25v-317q0 -14 9.5 -24t24.5 -10h175q14 0 24 10t10 24z" />
<glyph glyph-name="uniE61D" unicode="&#xe61d;"
d="M783 526l-45 45l-226 -226l-226 226l-45 -45l226 -226l-226 -226l45 -46l226 227l226 -227l45 46l-226 226z" />
<glyph glyph-name="uniE61E" unicode="&#xe61e;"
d="M384 570l48 50l338 -335l-338 -335l-48 49l284 286z" />
<glyph glyph-name="uniE620" unicode="&#xe620;"
d="M512 886q-102 0 -195 -39.5t-160.5 -107t-107 -160.5t-39.5 -195t39.5 -195t107 -160.5t160.5 -107t195 -39.5t195 39.5t160.5 107t107 160.5t39.5 195t-39.5 195t-107 160.5t-160.5 107t-195 39.5zM512 -79q-94 0 -180 36.5t-148 98.5t-98.5 148t-36.5 180t36.5 180
t98.5 148t148 98.5t180 36.5t180 -36.5t148 -98.5t98.5 -148t36.5 -180t-36.5 -180t-98.5 -148t-148 -98.5t-180 -36.5z" />
</font>
</defs></svg>
... ...
No preview for this file type
No preview for this file type
... ... @@ -4,7 +4,63 @@
* @date: 2016/07/05
*/
// var $ = require('yoho-jquery'),
// lazyLoad = require('yoho-jquery-lazyload');
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload');
// lazyLoad($('#msg-list img.lazy'));
var prising;
lazyLoad($('#msg-list img.lazy'));
$('.msg-nav li').on('click', function() {
var activeTab = $(this).attr('data-type'),
href = $(this).find('a').attr('href');
$('.msg-nav li').removeClass('active');
$(this).addClass('active');
console.log(activeTab);
console.log(href);
});
$('.editorial-index-page').on('click', '.like-icon', function() {
var $this = $(this),
msgId = $this.closest('.content-msg').data().id;
// url;
// 同一资讯多次点击归一处理
if (prising === msgId) {
return;
}
prising = msgId;
$this.toggleClass('liked');
// 点赞或取消点赞
// if ($this.hasClass('liked')) {
// url = '/guang/info/praise';
// } else {
// url = '/guang/info/cancelPraise';
// }
// $.ajax({
// type: 'GET',
// url: url,
// data: {
// id: msgId,
// time: new Date().getTime()
// }
// }).then(function(data) {
// if (data.code === 200) {
// if (data.data * 1 === 0) {
// $this.next('b').addClass('num-0').children('.num').html('0'); //隐藏数字显示
// } else {
// $this.next('b').removeClass('num-0').children('.num').html(data.data);
// }
// }
// prising = false;
// });
});
... ...
... ... @@ -2,15 +2,16 @@
font-size: 14px;
height: 50px;
line-height: 50px;
color: #666;
a {
color: #666;
text-decoration: none;
}
}
.last {
font-weight: 700;
color: #1b1b1b;
}
.icon {
... ...
.editorial-index-page {
width: 1150px;
margin: 0 auto;
.index-content {
width: 1150px;
margin: 0 auto;
}
.msg-nav {
height: 35px;
height: 40px;
border-bottom: 1px solid #eee;
padding-left: 300px;
padding-bottom: 5px;
... ... @@ -17,7 +10,7 @@
float: left;
height: 30px;
width: 120px;
line-height: 35px;
line-height: 40px;
text-align: center;
font-size: 14px;
display: list-item;
... ... @@ -48,3 +41,4 @@
}
@import "msg";
@import "list";
... ...
.editorial-list-page {
.list-content {
margin-top: 30px;
}
.nav-title {
font-size: 14px;
font-weight: 700;
border-bottom: 1px solid #eee;
width: 100%;
height: 30px;
b {
font-size: 18px;
margin-right: 5px;
}
}
.paging {
margin: 20px auto;
width: 300px;
height: 40px;
}
}
... ...
.content-msg {
margin-top: 40px;
margin-left: 110px;
}
.msg-left {
position: relative;
float: left;
width: 200px;
height: 30px;
margin-right: 80px;
line-height: 30px;
text-align: center;
border-bottom: 1px solid #bbb;
}
.msg-left {
position: relative;
float: left;
width: 200px;
height: 30px;
margin-right: 80px;
line-height: 30px;
text-align: center;
border-bottom: 1px solid #bbb;
}
.msg-right {
float: left;
width: 643px;
border-bottom: 1px solid #eee;
margin-top: 2px;
padding-bottom: 5px;
}
.msg-right {
float: left;
width: 643px;
border-bottom: 1px solid #eee;
margin-top: 2px;
padding-bottom: 5px;
}
.msg-title {
font-size: 20px;
color: #333;
line-height: 30px;
max-height: 64px;
word-wrap: break-word;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.lazy {
width: 640px;
height: 430px;
margin-top: 15px;
}
.msg-title {
font-size: 20px;
color: #333;
line-height: 30px;
max-height: 64px;
word-wrap: break-word;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.content {
display: block;
font-size: 14px;
line-height: 24px;
word-wrap: break-word;
margin-top: 10px;
overflow: hidden;
word-wrap: break-word;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.msg-title:hover {
color: #ff1414;
}
.msg-app {
height: 45px;
line-height: 45px;
font-size: 14px;
}
.lazy {
width: 640px;
height: 430px;
margin-top: 15px;
}
.time {
color: #a6a6a6;
margin-left: 3px;
}
.content {
display: block;
font-size: 14px;
line-height: 24px;
word-wrap: break-word;
margin-top: 10px;
overflow: hidden;
word-wrap: break-word;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.iconfont {
font-size: 14px;
margin-top: 0;
}
.msg-app {
height: 45px;
line-height: 45px;
font-size: 14px;
}
.time-word {
font-weight: normal;
}
.time {
color: #a6a6a6;
margin-left: 3px;
}
.like-comment {
margin-left: 40px;
color: #a6a6a6;
cursor: pointer;
font-size: 14px;
.iconfont {
font-size: 14px;
margin-top: 0;
}
.time-word {
font-weight: normal;
}
.like-icon {
.like-comment {
margin-left: 40px;
color: #a6a6a6;
cursor: pointer;
font-size: 14px;
&.liked {
color: #000;
.like-icon {
cursor: pointer;
&.liked {
color: #000;
}
}
}
}
.like-num {
font-weight: normal;
.like-num {
font-weight: normal;
}
}
... ...