|
|
<template>
|
|
|
<div class="top-nav">
|
|
|
<navbar>
|
|
|
<a slot="left" href="javascript:alert('TODO');">
|
|
|
<span class="icon icon-left"></span>
|
|
|
</a>
|
|
|
|
|
|
<template slot="right">
|
|
|
<a class="right-button" href="javascript:alert('TODO');">
|
|
|
<a class="right-button" href="javascript:void(0);" @click="like()">
|
|
|
<span class="icon icon-check"></span>
|
|
|
{{likeCount}}
|
|
|
</a>
|
|
|
|
|
|
<a class="right-button" href="javascript:alert('TODO');">
|
|
|
<span class="icon icon-love"></span>
|
|
|
<a class="right-button" href="javascript:void(0);" @click="favorite()">
|
|
|
<span class="icon" :class="{ 'icon-love': !isFavorite, 'icon-love-solid': isFavorite}"></span>
|
|
|
</a>
|
|
|
|
|
|
<a class="right-button" href="javascript:alert('TODO');">
|
|
|
<a class="right-button" href="javascript:void(0);" @click="share()">
|
|
|
<span class="icon icon-share"></span>
|
|
|
</a>
|
|
|
</template>
|
...
|
...
|
@@ -35,16 +31,56 @@ |
|
|
require('common/vue-filter');
|
|
|
|
|
|
module.exports = {
|
|
|
props: {
|
|
|
id: Number,
|
|
|
article: Object
|
|
|
},
|
|
|
components: {
|
|
|
navbar: require('component/header.vue')
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
isApp: yoho.isApp,
|
|
|
likeCount: 9,
|
|
|
likeCount: this.article.praise,
|
|
|
isFavorite: false
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
watch: {
|
|
|
article: function() {
|
|
|
this.likeCount = this.article.praise;
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
like: function() {
|
|
|
$.get(`/news/like_${this.article.id}.json`, (result)=> {
|
|
|
if (result.code === 200) {
|
|
|
this.likeCount = result.data;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
favorite: function() {
|
|
|
$.get(`/news/favorite_${this.article.id}.json`, (result)=> {
|
|
|
if (result.code === 200) {
|
|
|
//this.
|
|
|
// TODO:
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
share: function() {
|
|
|
yoho.goShare({
|
|
|
title: this.article.articleTitle,
|
|
|
des: '优质精选,BLK潮流资讯为你呈现',
|
|
|
img: this.article.coverImage.replace(/(\{width}|\{height}|\{mode})/g, function($0) {
|
|
|
const dict = {
|
|
|
'{width}': 300,
|
|
|
'{height}': 300,
|
|
|
'{mode}': 2
|
|
|
};
|
|
|
|
|
|
return dict[$0];
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
</script> |
...
|
...
|
|