mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2025-05-19 10:00:13 +09:00
新增:文章版权说明;
新增:文章详情点击标签跳转查询标签下的文章列表; 优化:调整markdown文字大小
This commit is contained in:
parent
70c5b34de0
commit
e46c5c2b6f
@ -16,6 +16,7 @@ import archive from './archive.js'
|
|||||||
import article from './article.js'
|
import article from './article.js'
|
||||||
import blogger from './blogger.js'
|
import blogger from './blogger.js'
|
||||||
import category from './category.js'
|
import category from './category.js'
|
||||||
|
import tag from './tag.js'
|
||||||
import comment from './comment.js'
|
import comment from './comment.js'
|
||||||
import journal from './journal.js'
|
import journal from './journal.js'
|
||||||
import link from './link.js'
|
import link from './link.js'
|
||||||
@ -44,6 +45,7 @@ const ApiManager = {
|
|||||||
...article,
|
...article,
|
||||||
...blogger,
|
...blogger,
|
||||||
...category,
|
...category,
|
||||||
|
...tag,
|
||||||
...comment,
|
...comment,
|
||||||
...journal,
|
...journal,
|
||||||
...link,
|
...link,
|
||||||
|
24
api/tag.js
Normal file
24
api/tag.js
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* 标签接口
|
||||||
|
* @see https://api.halo.run/content-api.html#tag/tag-controller
|
||||||
|
*/
|
||||||
|
|
||||||
|
import HttpHandler from '@/common/http/request.js'
|
||||||
|
export default {
|
||||||
|
/**
|
||||||
|
* 查询标签列表
|
||||||
|
* @param {Object} params 查询参数
|
||||||
|
*/
|
||||||
|
getTagList: (params) => {
|
||||||
|
return HttpHandler.Get('/api/content/tags', params)
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询标签下的文章
|
||||||
|
* @param {String} slug 别名
|
||||||
|
* @param {Object} params 查询参数
|
||||||
|
*/
|
||||||
|
getTagPostsList: (slug, params) => {
|
||||||
|
return HttpHandler.Get(`/api/content/tags/${slug}/posts`, params)
|
||||||
|
},
|
||||||
|
}
|
@ -44,47 +44,47 @@ export default {
|
|||||||
color: var(--main);
|
color: var(--main);
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size:1.25em;
|
font-size:1.2em;
|
||||||
`,
|
`,
|
||||||
h2: `
|
h2: `
|
||||||
color: var(--main);
|
color: var(--main);
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: 22px 0 16px;
|
margin: 22px 0 16px;
|
||||||
font-size: 1.2em;
|
font-size: 1.16em;
|
||||||
`,
|
`,
|
||||||
h3: `
|
h3: `
|
||||||
color: var(--main);
|
color: var(--main);
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: 26px 0 18px;
|
margin: 26px 0 18px;
|
||||||
font-size: 1.3em;
|
font-size: 1.14em;
|
||||||
`,
|
`,
|
||||||
h4: `
|
h4: `
|
||||||
color: var(--main);
|
color: var(--main);
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
margin-bottom: 18px;
|
margin-bottom: 18px;
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size: 1.18em;
|
font-size: 1.2em;
|
||||||
`,
|
`,
|
||||||
h5: `
|
h5: `
|
||||||
color: var(--main);
|
color: var(--main);
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size: 1em;
|
font-size: 16px;
|
||||||
`,
|
`,
|
||||||
h6: `
|
h6: `
|
||||||
color: #303133;
|
color: #303133;
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size: 1em;
|
font-size: 14px;
|
||||||
`,
|
`,
|
||||||
p: `
|
p: `
|
||||||
line-height: 1.65;
|
line-height: 1.65;
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
font-size: 15px;
|
font-size: 14px;
|
||||||
`,
|
`,
|
||||||
'code': ` `,
|
'code': ` `,
|
||||||
strong: 'font-weight: 700;color: rgb(248, 57, 41);',
|
strong: 'font-weight: 700;color: rgb(248, 57, 41);',
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="useActions" class="">
|
<view v-if="useActions" class="">
|
||||||
<tm-button size="s" text theme="blue" @click="$emit('on-comment', { type: 'user', comment: comment })">回复</tm-button>
|
<tm-button v-if="!disallowComment" size="s" text theme="blue" @click="$emit('on-comment', { type: 'user', comment: comment })">回复</tm-button>
|
||||||
<tm-button size="s" text theme="grey" @click="$emit('on-copy', comment.content)">复制</tm-button>
|
<tm-button size="s" text theme="grey" @click="$emit('on-copy', comment.content)">复制</tm-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -59,6 +59,10 @@ export default {
|
|||||||
type: Array,
|
type: Array,
|
||||||
default: () => []
|
default: () => []
|
||||||
},
|
},
|
||||||
|
disallowComment: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
useActions: {
|
useActions: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
<!-- <text class="filter-item">全部</text> -->
|
<!-- <text class="filter-item">全部</text> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view v-if="disallowComment" class="disallow-comment"><tm-empty icon="icon-shiliangzhinengduixiang-" label="文章已开启禁止评论"></tm-empty></view> -->
|
|
||||||
<!-- 内容区域 -->
|
<!-- 内容区域 -->
|
||||||
<view class="comment-list_content">
|
<view class="comment-list_content">
|
||||||
<view v-if="loading != 'success'" class="loading-wrap flex">
|
<view v-if="loading != 'success'" class="loading-wrap flex">
|
||||||
@ -27,9 +26,22 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
|
<tm-alerts
|
||||||
|
v-if="disallowComment && dataList.length !== 0"
|
||||||
|
color="red"
|
||||||
|
text
|
||||||
|
:margin="[0, 0]"
|
||||||
|
:shadow="0"
|
||||||
|
label="Ծ‸Ծ博主已设置该文章禁止评论!"
|
||||||
|
:round="3"
|
||||||
|
close
|
||||||
|
></tm-alerts>
|
||||||
<view class="empty pt-50" v-if="dataList.length == 0">
|
<view class="empty pt-50" v-if="dataList.length == 0">
|
||||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无评论">
|
<tm-empty v-if="disallowComment" icon="icon-shiliangzhinengduixiang-" label="暂无评论">
|
||||||
<tm-button theme="bg-gradient-light-blue-accent" size="m" v-if="!disallowComment" @click="fnToComment(null)">抢沙发</tm-button>
|
<text class="text-red text-size-s">- 文章已开启禁止评论 -</text>
|
||||||
|
</tm-empty>
|
||||||
|
<tm-empty v-else icon="icon-shiliangzhinengduixiang-" label="暂无评论">
|
||||||
|
<tm-button theme="bg-gradient-light-blue-accent" size="m" @click="fnToComment(null)">抢沙发</tm-button>
|
||||||
</tm-empty>
|
</tm-empty>
|
||||||
</view>
|
</view>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
@ -40,6 +52,7 @@
|
|||||||
:isChild="false"
|
:isChild="false"
|
||||||
:comment="comment"
|
:comment="comment"
|
||||||
:postId="postId"
|
:postId="postId"
|
||||||
|
:disallowComment="disallowComment"
|
||||||
@on-copy="fnCopyContent"
|
@on-copy="fnCopyContent"
|
||||||
@on-comment="fnToComment"
|
@on-comment="fnToComment"
|
||||||
@on-todo="fnToDo"
|
@on-todo="fnToDo"
|
||||||
@ -54,6 +67,7 @@
|
|||||||
:isChild="true"
|
:isChild="true"
|
||||||
:comment="childComment"
|
:comment="childComment"
|
||||||
:postId="postId"
|
:postId="postId"
|
||||||
|
:disallowComment="disallowComment"
|
||||||
@on-copy="fnCopyContent"
|
@on-copy="fnCopyContent"
|
||||||
@on-comment="fnToComment"
|
@on-comment="fnToComment"
|
||||||
@on-todo="fnToDo"
|
@on-todo="fnToDo"
|
||||||
@ -74,9 +88,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||||
|
import tmAlerts from '@/tm-vuetify/components/tm-alerts/tm-alerts.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'comment-list',
|
name: 'comment-list',
|
||||||
components: { tmEmpty, tmButton },
|
components: { tmEmpty, tmButton, tmAlerts },
|
||||||
props: {
|
props: {
|
||||||
// 是否禁用评论
|
// 是否禁用评论
|
||||||
disallowComment: {
|
disallowComment: {
|
||||||
@ -200,7 +216,7 @@ export default {
|
|||||||
position: relative;
|
position: relative;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding-left: 24rpx;
|
padding-left: 24rpx;
|
||||||
font-size: 34rpx;
|
font-size: 30rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
@ -209,7 +225,7 @@ export default {
|
|||||||
left: 0rpx;
|
left: 0rpx;
|
||||||
top: 8rpx;
|
top: 8rpx;
|
||||||
width: 8rpx;
|
width: 8rpx;
|
||||||
height: 30rpx;
|
height: 26rpx;
|
||||||
background-color: rgb(3, 174, 252);
|
background-color: rgb(3, 174, 252);
|
||||||
border-radius: 6rpx;
|
border-radius: 6rpx;
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,14 @@ export default {
|
|||||||
description: '', // 介绍
|
description: '', // 介绍
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 版权信息(用于文章详情)
|
||||||
|
copyright: {
|
||||||
|
use: true, // 是否使用版权描述
|
||||||
|
author: '', // 版权归属说明
|
||||||
|
description: '', // 版权描述
|
||||||
|
violation: '', // 侵权处理说明
|
||||||
|
},
|
||||||
|
|
||||||
// 社交信息(将会在`/pagesA/contact/contact`页面中展示)
|
// 社交信息(将会在`/pagesA/contact/contact`页面中展示)
|
||||||
// 具体的某个参数值留空则不展示
|
// 具体的某个参数值留空则不展示
|
||||||
social: {
|
social: {
|
||||||
|
18
pages.json
18
pages.json
@ -215,6 +215,24 @@
|
|||||||
"navigationBarTitleText": "设置",
|
"navigationBarTitleText": "设置",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
"path": "tags/tags",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"path": "tag-detail/tag-detail",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "标签详情",
|
||||||
|
"enablePullDownRefresh": true,
|
||||||
|
"app-plus": {
|
||||||
|
"pullToRefresh": {
|
||||||
|
"color": "#03a9f4",
|
||||||
|
"style": "circle"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
<!-- 色彩版本 -->
|
<!-- 色彩版本 -->
|
||||||
<view
|
<view
|
||||||
v-if="!globalAppSettings.links.useSimple"
|
v-if="!globalAppSettings.links.useSimple"
|
||||||
class="info flex pa-36"
|
class="info flex pt-24 pb-24 pl-12 pr-12"
|
||||||
:class="{ 'border-b-1': linkIndex != team.children.length - 1 || index == result.length - 1 }"
|
:class="{ 'border-b-1': linkIndex != team.children.length - 1 || index == result.length - 1 }"
|
||||||
@click="fnOnLinkEvent(link)"
|
@click="fnOnLinkEvent(link)"
|
||||||
>
|
>
|
||||||
|
@ -11,14 +11,11 @@
|
|||||||
<view class="title">{{ result.title }}</view>
|
<view class="title">{{ result.title }}</view>
|
||||||
<view class="detail">
|
<view class="detail">
|
||||||
<view class="author">
|
<view class="author">
|
||||||
<text class="author-name">{{ author.nickname }}</text>
|
<text class="author-name">博主:{{ author.nickname }}</text>
|
||||||
<text class="author-time">发布于:{{ { d: result.createTime, f: 'yyyy年MM月dd日 星期w' } | formatTime }}</text>
|
<text class="author-time">时间:{{ { d: result.createTime, f: 'yyyy年MM月dd日 星期w' } | formatTime }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="cover" v-if="result.thumbnail"><image class="cover-img" mode="aspectFill" :src="calcUrl(result.thumbnail)"></image></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" :class="{ 'no-thumbnail': !result.thumbnail }">
|
||||||
<view class="count-item">
|
<view class="count-item">
|
||||||
<text class="value">{{ result.visits }}</text>
|
<text class="value">{{ result.visits }}</text>
|
||||||
@ -41,13 +38,21 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- 分类 -->
|
<!-- 分类 -->
|
||||||
<view class="category">
|
<view class="category">
|
||||||
<view class="">
|
<view class="category-type">
|
||||||
分类:
|
<text class="text-weight-b">分类:</text>
|
||||||
<text class="category-tag" v-for="(item, index) in result.categories" :key="index">{{ item.name }}</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>
|
||||||
<view class="mt-18">
|
<view class="mt-18 category-type">
|
||||||
标签:
|
<text class="text-weight-b">标签:</text>
|
||||||
<text class="category-tag" v-for="(item, index) in result.tags" :key="index">{{ item.name }}</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>
|
||||||
</view>
|
</view>
|
||||||
<!-- 广告区域 -->
|
<!-- 广告区域 -->
|
||||||
@ -88,10 +93,20 @@
|
|||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
</view>
|
</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>
|
</view>
|
||||||
|
|
||||||
<!-- 返回顶部 -->
|
<!-- 返回顶部 -->
|
||||||
@ -228,6 +243,9 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
copyright() {
|
||||||
|
return getApp().globalData.copyright;
|
||||||
|
},
|
||||||
calcUrl() {
|
calcUrl() {
|
||||||
return url => {
|
return url => {
|
||||||
if (this.$utils.checkIsUrl(url)) {
|
if (this.$utils.checkIsUrl(url)) {
|
||||||
@ -304,6 +322,9 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
fnToComment() {
|
fnToComment() {
|
||||||
|
if (this.result.disallowComment) {
|
||||||
|
return uni.$tm.toast('文章已开启禁止评论!');
|
||||||
|
}
|
||||||
this.$Router.push({
|
this.$Router.push({
|
||||||
path: '/pagesA/comment/comment',
|
path: '/pagesA/comment/comment',
|
||||||
query: {
|
query: {
|
||||||
@ -598,6 +619,16 @@ export default {
|
|||||||
.catch(err => {
|
.catch(err => {
|
||||||
this.commentDetail.loading = 'error';
|
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 {
|
&-name {
|
||||||
}
|
}
|
||||||
&-time {
|
&-time {
|
||||||
margin-left: 12rpx;
|
margin-left: 36rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -711,12 +742,18 @@ export default {
|
|||||||
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.03);
|
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||||
// border: 2rpx solid #f8f8f8;
|
// border: 2rpx solid #f8f8f8;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
|
&-type {
|
||||||
|
line-height: 55rpx;
|
||||||
|
}
|
||||||
&-tag {
|
&-tag {
|
||||||
background-color: #5bb8fa;
|
background-color: #5bb8fa;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
padding: 6rpx 12rpx;
|
padding: 6rpx 12rpx;
|
||||||
border-radius: 6rpx;
|
border-radius: 6rpx;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
|
&.is-empty {
|
||||||
|
background-color: #607d8b;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.category-tag + .category-tag {
|
.category-tag + .category-tag {
|
||||||
@ -725,11 +762,27 @@ export default {
|
|||||||
.content {
|
.content {
|
||||||
margin-top: 24rpx;
|
margin-top: 24rpx;
|
||||||
}
|
}
|
||||||
.ad-wrap {
|
.evan-markdown,
|
||||||
|
.ad-wrap,
|
||||||
|
.copyright-wrap,
|
||||||
|
.comment-wrap {
|
||||||
box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.03);
|
box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||||
}
|
}
|
||||||
.comment-wrap {
|
.copyright-title {
|
||||||
background-color: #fff;
|
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 {
|
.poup-head {
|
||||||
border-bottom: 2rpx solid #f5f5f5;
|
border-bottom: 2rpx solid #f5f5f5;
|
||||||
@ -754,6 +807,9 @@ export default {
|
|||||||
min-height: 60vh;
|
min-height: 60vh;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
.copyright-text {
|
||||||
|
line-height: 1.7;
|
||||||
|
}
|
||||||
.poster-loading {
|
.poster-loading {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -87,7 +87,7 @@ export default {
|
|||||||
this.$httpApi
|
this.$httpApi
|
||||||
.getCategoryPostList(this.slug, this.queryParams)
|
.getCategoryPostList(this.slug, this.queryParams)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.fnSetPageTitle(this.pageTitle + ` (共${res.data.total}篇)`);
|
this.fnSetPageTitle(`分类:${this.pageTitle} (共${res.data.total}篇)`);
|
||||||
this.result = res.data;
|
this.result = res.data;
|
||||||
if (this.isLoadMore) {
|
if (this.isLoadMore) {
|
||||||
this.dataList = this.dataList.concat(res.data.content);
|
this.dataList = this.dataList.concat(res.data.content);
|
||||||
|
144
pagesA/tag-detail/tag-detail.vue
Normal file
144
pagesA/tag-detail/tag-detail.vue
Normal file
@ -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>
|
14
pagesA/tags/tags.vue
Normal file
14
pagesA/tags/tags.vue
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<template>
|
||||||
|
<view>文章标签页面</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
methods: {}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style></style>
|
Loading…
Reference in New Issue
Block a user