|
|
<template>
|
|
|
<div class="show-box no-padding no-top-border">
|
|
|
<div class="news-box">
|
|
|
<h1>{{article.articleTitle}}</h1>
|
|
|
<div class="status-bar">
|
|
|
<span class="icon icon-love"></span><span class="label">{{article.publishTime | formatUnixTime 'MM.DD HH:mm'}}</span>
|
|
|
<span class="icon icon-love"></span><span class="label">{{article.pageViews}}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="content-box">
|
|
|
<div v-for="(index, block) in content">
|
|
|
<content-block :block="block"></content-block>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="show-box no-padding" v-if="recommendProducts">
|
|
|
<h2>相关推荐</h2>
|
|
|
|
|
|
<product-list :data="recommendProducts.goods"></product-list>
|
|
|
</div>
|
|
|
|
|
|
<div class="brand-list show-box" v-if="brands">
|
|
|
<h2>相关品牌</h2>
|
|
|
<ul>
|
|
|
<li v-for="item in brands">
|
|
|
<a :href="item.url"><img :src="item.thumb"></a>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
|
|
|
<div class="show-box" v-if="other">
|
|
|
<h2>相关文章</h2>
|
|
|
<div class="other-box" v-for="item in other">
|
|
|
<div>
|
|
|
<div class="image-box">
|
|
|
<a :href="item.url">
|
|
|
<img :src="item.thumb | resize 213 134"/>
|
|
|
</a>
|
|
|
</div>
|
|
|
<h3><a :href="item.url">{{item.title}}</a></h3>
|
|
|
<div class="sub-time">
|
|
|
<span class="icon icon-love"></span><span class="label">{{article.publishTime | formatUnixTime 'MM.DD HH:mm'}}</span>
|
|
|
</div>
|
|
|
<div class="clearfix"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<style class="scss">
|
|
|
$bgcolor: #fff;
|
|
|
|
|
|
.news-page {
|
|
|
background: #f6f6f6;
|
|
|
}
|
|
|
|
|
|
.show-box {
|
|
|
background: $bgcolor;
|
|
|
margin-top: 30px;
|
|
|
border-bottom: 1px solid #eee;
|
|
|
|
|
|
&:not(.no-padding) {
|
|
|
padding: 30px;
|
|
|
}
|
|
|
|
|
|
&:not(.no-top-border) {
|
|
|
border-top: 1px solid #eee;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
h1 {
|
|
|
font-size: 43px;
|
|
|
font-weight: bold;
|
|
|
overflow: hidden;
|
|
|
margin-top: 36px;
|
|
|
margin-bottom: 0;
|
|
|
}
|
|
|
|
|
|
.news-box {
|
|
|
padding: 30px;
|
|
|
background: $bgcolor;
|
|
|
}
|
|
|
|
|
|
.content-box {
|
|
|
background: #fff;
|
|
|
|
|
|
img {
|
|
|
width: 100%;
|
|
|
display: block;
|
|
|
}
|
|
|
|
|
|
p {
|
|
|
font-size: 28px;
|
|
|
}
|
|
|
|
|
|
.text-block {
|
|
|
padding: 30px;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
.other-box {
|
|
|
margin-top: 40px;
|
|
|
|
|
|
.image-box {
|
|
|
float: left;
|
|
|
max-width: 214px;
|
|
|
max-height: 134px;
|
|
|
overflow: hidden;
|
|
|
|
|
|
img {
|
|
|
width: 214px;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
h3 {
|
|
|
margin-top: 16px;
|
|
|
margin-left: 30px;
|
|
|
float: left;
|
|
|
max-width: 420px;
|
|
|
min-height: 90px;
|
|
|
font-size: 32px;
|
|
|
}
|
|
|
|
|
|
.sub-time {
|
|
|
margin-left: 30px;
|
|
|
float: left;
|
|
|
color: #b3b3b3;
|
|
|
|
|
|
.icon {
|
|
|
margin-right: 12px;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
h2 {
|
|
|
text-align: center;
|
|
|
line-height: 100px;
|
|
|
}
|
|
|
|
|
|
.status-bar {
|
|
|
color: #ccc;
|
|
|
font-size: 24px;
|
|
|
margin-top: 30px;
|
|
|
|
|
|
span.icon {
|
|
|
margin-right: 12px;
|
|
|
}
|
|
|
|
|
|
span.label {
|
|
|
margin-right: 78px;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.brand-list {
|
|
|
li {
|
|
|
display: inline-block;
|
|
|
width: 171px;
|
|
|
text-align: center;
|
|
|
|
|
|
img {
|
|
|
max-width: 140px;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
ul {
|
|
|
:not(:last-child) {
|
|
|
border-right: 1px solid #eee;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
</style>
|
|
|
<script>
|
|
|
require('common/vue-filter');
|
|
|
|
|
|
module.exports = {
|
|
|
components: {
|
|
|
'content-block': require('./content-block.vue'),
|
|
|
'product-list': require('component/product/list.vue')
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
article: {},
|
|
|
content: {},
|
|
|
brands: {},
|
|
|
other: {},
|
|
|
recommendProducts: []
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
const newsId = $('#app').data('newsId');
|
|
|
|
|
|
$.get(`/news/news_${newsId}.json`).then(result => {
|
|
|
const article = result[0],
|
|
|
content = result[1],
|
|
|
brands = result[2],
|
|
|
other = result[3];
|
|
|
|
|
|
if (article && article.code === 200 && article.data) {
|
|
|
this.article = article.data;
|
|
|
}
|
|
|
|
|
|
if (content && content.code === 200 && content.data) {
|
|
|
this.content = content.data;
|
|
|
|
|
|
this.recommendProducts = this.content.filter((block)=> {
|
|
|
return block && typeof block.goods === 'object';
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (brands && brands.code === 200 && brands.data) {
|
|
|
this.brands = brands.data;
|
|
|
}
|
|
|
|
|
|
if (other && other.code === 200 && content.data) {
|
|
|
this.other = other.data;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
</script> |
...
|
...
|
|