mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-06-12 13:19:31 +08:00
新增:文章版权说明;
新增:文章详情点击标签跳转查询标签下的文章列表; 优化:调整markdown文字大小
This commit is contained in:
@@ -11,14 +11,11 @@
|
||||
<view class="title">{{ result.title }}</view>
|
||||
<view class="detail">
|
||||
<view class="author">
|
||||
<text class="author-name">{{ author.nickname }}</text>
|
||||
<text class="author-time">发布于:{{ { d: result.createTime, f: 'yyyy年MM月dd日 星期w' } | formatTime }}</text>
|
||||
<text class="author-name">博主:{{ author.nickname }}</text>
|
||||
<text class="author-time">时间:{{ { d: result.createTime, f: 'yyyy年MM月dd日 星期w' } | formatTime }}</text>
|
||||
</view>
|
||||
|
||||
<view class="cover" v-if="result.thumbnail"><image class="cover-img" mode="aspectFill" :src="calcUrl(result.thumbnail)"></image></view>
|
||||
<!-- <view class="mt-24">
|
||||
<text class="category-tag" v-for="(item, index) in result.tags" :key="index">{{ item.name }}</text>
|
||||
</view> -->
|
||||
<view class="count" :class="{ 'no-thumbnail': !result.thumbnail }">
|
||||
<view class="count-item">
|
||||
<text class="value">{{ result.visits }}</text>
|
||||
@@ -41,13 +38,21 @@
|
||||
</view>
|
||||
<!-- 分类 -->
|
||||
<view class="category">
|
||||
<view class="">
|
||||
分类:
|
||||
<text class="category-tag" v-for="(item, index) in result.categories" :key="index">{{ item.name }}</text>
|
||||
<view class="category-type">
|
||||
<text class="text-weight-b">分类:</text>
|
||||
<text v-if="result.categories.length == 0" class="category-tag is-empty">未选择分类</text>
|
||||
<block v-else>
|
||||
<text class="category-tag" v-for="(item, index) in result.categories" :key="index" @click="fnToCate(item)">{{ item.name }}</text>
|
||||
</block>
|
||||
</view>
|
||||
<view class="mt-18">
|
||||
标签:
|
||||
<text class="category-tag" v-for="(item, index) in result.tags" :key="index">{{ item.name }}</text>
|
||||
<view class="mt-18 category-type">
|
||||
<text class="text-weight-b">标签:</text>
|
||||
<text v-if="result.tags.length == 0" class="category-tag is-empty">未选择标签</text>
|
||||
<block v-else>
|
||||
<text class="category-tag" :style="{ backgroundColor: item.color }" v-for="(item, index) in result.tags" :key="index" @click="fnToTag(item)">
|
||||
{{ item.name }}
|
||||
</text>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 广告区域 -->
|
||||
@@ -88,10 +93,20 @@
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
|
||||
<!-- 免责声明:todo -->
|
||||
<!-- 版权声明 -->
|
||||
<view v-if="copyright.use" class="copyright-wrap bg-white mt-24 pa-24 round-4">
|
||||
<view class="copyright-title text-weight-b">版权信息</view>
|
||||
<view class="copyright-content mt-12 grey-lighten-5 text-grey-darken-2 round-4 pt-12 pb-12 pl-24 pr-24 ">
|
||||
<view v-if="copyright.author" class="copyright-text text-size-s ">版权归属:{{ copyright.author }}</view>
|
||||
<view v-if="copyright.description" class="copyright-text text-size-s mt-12">版权说明:{{ copyright.description }}</view>
|
||||
<view v-if="copyright.violation" class="copyright-text text-size-s mt-12 text-red">侵权处理:{{ copyright.violation }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 评论展示区域 -->
|
||||
<view class="comment-wrap mt-24 pa-24 round-4"><commentList :postId="result.id" :post="result" @on-comment-detail="fnOnShowCommentDetail"></commentList></view>
|
||||
<view class="comment-wrap bg-white mt-24 pa-24 round-4">
|
||||
<commentList :disallowComment="result.disallowComment" :postId="result.id" :post="result" @on-comment-detail="fnOnShowCommentDetail"></commentList>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 返回顶部 -->
|
||||
@@ -228,6 +243,9 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
copyright() {
|
||||
return getApp().globalData.copyright;
|
||||
},
|
||||
calcUrl() {
|
||||
return url => {
|
||||
if (this.$utils.checkIsUrl(url)) {
|
||||
@@ -304,6 +322,9 @@ export default {
|
||||
},
|
||||
|
||||
fnToComment() {
|
||||
if (this.result.disallowComment) {
|
||||
return uni.$tm.toast('文章已开启禁止评论!');
|
||||
}
|
||||
this.$Router.push({
|
||||
path: '/pagesA/comment/comment',
|
||||
query: {
|
||||
@@ -598,6 +619,16 @@ export default {
|
||||
.catch(err => {
|
||||
this.commentDetail.loading = 'error';
|
||||
});
|
||||
},
|
||||
fnToCate(category) {
|
||||
uni.navigateTo({
|
||||
url: `/pagesA/category-detail/category-detail?slug=${category.slug}&name=${category.name}`
|
||||
});
|
||||
},
|
||||
fnToTag(tag) {
|
||||
uni.navigateTo({
|
||||
url: `/pagesA/tag-detail/tag-detail?id=${tag.id}&slug=${tag.slug}&name=${tag.name}`
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -646,7 +677,7 @@ export default {
|
||||
&-name {
|
||||
}
|
||||
&-time {
|
||||
margin-left: 12rpx;
|
||||
margin-left: 36rpx;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -711,12 +742,18 @@ export default {
|
||||
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
// border: 2rpx solid #f8f8f8;
|
||||
font-size: 28rpx;
|
||||
&-type {
|
||||
line-height: 55rpx;
|
||||
}
|
||||
&-tag {
|
||||
background-color: #5bb8fa;
|
||||
color: #fff;
|
||||
padding: 6rpx 12rpx;
|
||||
border-radius: 6rpx;
|
||||
font-size: 24rpx;
|
||||
&.is-empty {
|
||||
background-color: #607d8b;
|
||||
}
|
||||
}
|
||||
}
|
||||
.category-tag + .category-tag {
|
||||
@@ -725,11 +762,27 @@ export default {
|
||||
.content {
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
.ad-wrap {
|
||||
.evan-markdown,
|
||||
.ad-wrap,
|
||||
.copyright-wrap,
|
||||
.comment-wrap {
|
||||
box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
}
|
||||
.comment-wrap {
|
||||
background-color: #fff;
|
||||
.copyright-title {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
padding-left: 24rpx;
|
||||
font-size: 30rpx;
|
||||
&:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0rpx;
|
||||
top: 8rpx;
|
||||
width: 8rpx;
|
||||
height: 26rpx;
|
||||
background-color: rgb(3, 174, 252);
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
}
|
||||
.poup-head {
|
||||
border-bottom: 2rpx solid #f5f5f5;
|
||||
@@ -754,6 +807,9 @@ export default {
|
||||
min-height: 60vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
.copyright-text {
|
||||
line-height: 1.7;
|
||||
}
|
||||
.poster-loading {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
|
||||
@@ -87,7 +87,7 @@ export default {
|
||||
this.$httpApi
|
||||
.getCategoryPostList(this.slug, this.queryParams)
|
||||
.then(res => {
|
||||
this.fnSetPageTitle(this.pageTitle + ` (共${res.data.total}篇)`);
|
||||
this.fnSetPageTitle(`分类:${this.pageTitle} (共${res.data.total}篇)`);
|
||||
this.result = res.data;
|
||||
if (this.isLoadMore) {
|
||||
this.dataList = this.dataList.concat(res.data.content);
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<view class="app-page">
|
||||
<view v-if="loading != 'success'" class="loading-wrap">
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
</view>
|
||||
<block v-else>
|
||||
<view class="empty" v-if="dataList.length == 0"><tm-empty icon="icon-shiliangzhinengduixiang-" label="该标签下暂无文章"></tm-empty></view>
|
||||
<block v-else>
|
||||
<block v-for="(article, index) in dataList" :key="article.createTime">
|
||||
<!-- 文章卡片 -->
|
||||
<tm-translate animation-name="fadeUp" :wait="(index + 1) * 50"><article-card :article="article" @on-click="fnToArticleDetail"></article-card></tm-translate>
|
||||
</block>
|
||||
<view class="load-text">{{ loadMoreText }}</view>
|
||||
</block>
|
||||
|
||||
<tm-flotbutton @click="fnToTopPage" color="light-blue" size="m" icon="icon-angle-up"></tm-flotbutton>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import ArticleCard from '@/components/article-card/article-card.vue';
|
||||
export default {
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmTranslate,
|
||||
tmFlotbutton,
|
||||
tmEmpty,
|
||||
ArticleCard
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0
|
||||
},
|
||||
slug: '',
|
||||
pageTitle: '加载中...',
|
||||
result: null,
|
||||
dataList: [],
|
||||
isLoadMore: false,
|
||||
loadMoreText: ''
|
||||
};
|
||||
},
|
||||
|
||||
onLoad(e) {
|
||||
this.slug = e.slug;
|
||||
this.pageTitle = e.name;
|
||||
this.fnGetData();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.isLoadMore = false;
|
||||
this.queryParams.page = 0;
|
||||
this.fnGetData();
|
||||
},
|
||||
onReachBottom(e) {
|
||||
if (this.result.hasNext) {
|
||||
this.queryParams.page += 1;
|
||||
this.isLoadMore = true;
|
||||
this.fnGetData();
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '没有更多数据了'
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fnGetData() {
|
||||
uni.showLoading({
|
||||
mask: true,
|
||||
title: '加载中...'
|
||||
});
|
||||
// 设置状态为加载中
|
||||
if (!this.isLoadMore) {
|
||||
this.loading = 'loading';
|
||||
}
|
||||
this.loadMoreText = '加载中...';
|
||||
this.$httpApi
|
||||
.getTagPostsList(this.slug, this.queryParams)
|
||||
.then(res => {
|
||||
this.fnSetPageTitle(`标签:${this.pageTitle} (共${res.data.total}篇)`);
|
||||
this.result = res.data;
|
||||
if (this.isLoadMore) {
|
||||
this.dataList = this.dataList.concat(res.data.content);
|
||||
} else {
|
||||
this.dataList = res.data.content;
|
||||
}
|
||||
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
setTimeout(() => {
|
||||
this.loading = 'success';
|
||||
}, 500);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
}, 500);
|
||||
});
|
||||
},
|
||||
//跳转文章详情
|
||||
fnToArticleDetail(article) {
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
|
||||
animationType: 'slide-in-right'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 24rpx 0;
|
||||
background-color: #fafafd;
|
||||
}
|
||||
.loading-wrap {
|
||||
padding: 0 24rpx;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.empty {
|
||||
height: 60vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,14 @@
|
||||
<template>
|
||||
<view>文章标签页面</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
Reference in New Issue
Block a user