mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-06-12 13:19:31 +08:00
修改:优化列表动画效果
This commit is contained in:
+271
-244
@@ -18,16 +18,8 @@
|
||||
<block v-for="(item, index) in dataList" :key="index">
|
||||
<view class="tm-timeline-item tm-timeline-item--leftDir">
|
||||
<view style="width: 160rpx;">
|
||||
<view
|
||||
:style="{ width: '24rpx', height: '24rpx' }"
|
||||
:class="[black_tmeme ? 'bk' : '']"
|
||||
class="flex-center rounded tm-timeline-jidian border-white-a-2 grey-lighten-2 light-blue shadow-primary-4"
|
||||
></view>
|
||||
<view
|
||||
:style="{ marginTop: '-24rpx' }"
|
||||
:class="[index !== dataList.length - 1 ? 'tm-timeline-item-boder' : '', black_tmeme ? 'bk' : '']"
|
||||
class="grey-lighten-2"
|
||||
></view>
|
||||
<view :style="{ width: '24rpx', height: '24rpx' }" :class="[black_tmeme ? 'bk' : '']" class="flex-center rounded tm-timeline-jidian border-white-a-2 grey-lighten-2 light-blue shadow-primary-4"></view>
|
||||
<view :style="{ marginTop: '-24rpx' }" :class="[index !== dataList.length - 1 ? 'tm-timeline-item-boder' : '', black_tmeme ? 'bk' : '']" class="grey-lighten-2"></view>
|
||||
</view>
|
||||
<view class="tm-timeline-item-content relative">
|
||||
<view class="tm-timeline-item-left">
|
||||
@@ -38,7 +30,7 @@
|
||||
</view>
|
||||
<block v-if="item.posts.length != 0">
|
||||
<block v-for="(post, postIndex) in item.posts" :key="post.id">
|
||||
<tm-translate animation-name="fadeUp" :wait="(postIndex + 1) * 50">
|
||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(postIndex)">
|
||||
<view class="flex post shadow-3 pa-24 mb-24" :class="[globalAppSettings.layout.cardType]" @click="fnToArticleDetail(post)">
|
||||
<image class="post-thumbnail" :src="$utils.checkThumbnailUrl(post.thumbnail)" mode="aspectFill"></image>
|
||||
<view class="post-info pl-20">
|
||||
@@ -67,274 +59,309 @@
|
||||
</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 tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
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 tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmTranslate,
|
||||
tmFlotbutton,
|
||||
tmTabs,
|
||||
tmEmpty
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
tab: {
|
||||
activeIndex: 0,
|
||||
list: ['按月份查看', '按年份查看']
|
||||
},
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0
|
||||
},
|
||||
result: null,
|
||||
dataList: [],
|
||||
api: 'getMonthArchives'
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
black_tmeme: function() {
|
||||
return this.$tm.vx.state().tmVuetify.black;
|
||||
export default {
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmTranslate,
|
||||
tmFlotbutton,
|
||||
tmTabs,
|
||||
tmEmpty
|
||||
},
|
||||
color_tmeme: function() {
|
||||
return this.$tm.vx.state().tmVuetify.color;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fnGetData();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.fnGetData();
|
||||
this.queryParams.page = 0;
|
||||
},
|
||||
|
||||
methods: {
|
||||
fnOnTabChange(index) {
|
||||
// todo:
|
||||
const _api = ['getMonthArchives', 'getYearArchives'];
|
||||
this.api = _api[index];
|
||||
this.queryParams.page = 0;
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
tab: {
|
||||
activeIndex: 0,
|
||||
list: ['按月份查看', '按年份查看']
|
||||
},
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0
|
||||
},
|
||||
result: null,
|
||||
dataList: [],
|
||||
api: 'getMonthArchives'
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
black_tmeme: function() {
|
||||
return this.$tm.vx.state().tmVuetify.black;
|
||||
},
|
||||
color_tmeme: function() {
|
||||
return this.$tm.vx.state().tmVuetify.color;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fnGetData();
|
||||
},
|
||||
fnGetData() {
|
||||
this.loading = 'loading';
|
||||
uni.showLoading({
|
||||
mask: true,
|
||||
title: '加载中...'
|
||||
});
|
||||
this.$httpApi[this.api](this.queryParams)
|
||||
.then(res => {
|
||||
this.result = res.data;
|
||||
this.dataList = res.data;
|
||||
setTimeout(() => {
|
||||
this.loading = 'success';
|
||||
}, 500);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
}, 500);
|
||||
});
|
||||
onPullDownRefresh() {
|
||||
this.fnGetData();
|
||||
this.queryParams.page = 0;
|
||||
},
|
||||
//跳转文章详情
|
||||
fnToArticleDetail(article) {
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
|
||||
animationType: 'slide-in-right'
|
||||
});
|
||||
|
||||
methods: {
|
||||
fnOnTabChange(index) {
|
||||
this.fnResetSetAniWaitIndex();
|
||||
const _api = ['getMonthArchives', 'getYearArchives'];
|
||||
this.api = _api[index];
|
||||
this.queryParams.page = 0;
|
||||
this.fnGetData();
|
||||
},
|
||||
fnGetData() {
|
||||
this.loading = 'loading';
|
||||
uni.showLoading({
|
||||
mask: true,
|
||||
title: '加载中...'
|
||||
});
|
||||
this.$httpApi[this.api](this.queryParams)
|
||||
.then(res => {
|
||||
this.result = res.data;
|
||||
this.dataList = res.data;
|
||||
setTimeout(() => {
|
||||
this.loading = 'success';
|
||||
}, 500);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
})
|
||||
.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" scoped>
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fafafd;
|
||||
}
|
||||
.loading-wrap {
|
||||
padding: 24rpx;
|
||||
}
|
||||
.list-empty {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
}
|
||||
.statistics {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.e-timeline {
|
||||
::v-deep {
|
||||
.tm-timeline-item > view:first-child {
|
||||
width: 110rpx !important;
|
||||
}
|
||||
.tm-timeline-item-left {
|
||||
max-width: 580rpx !important;
|
||||
width: 100% !important;
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fafafd;
|
||||
}
|
||||
|
||||
.loading-wrap {
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.list-empty {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.statistics {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.e-timeline {
|
||||
::v-deep {
|
||||
.tm-timeline-item>view:first-child {
|
||||
width: 110rpx !important;
|
||||
}
|
||||
|
||||
.tm-timeline-item-left {
|
||||
max-width: 580rpx !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tm-timeline {
|
||||
.tm-timeline-item {
|
||||
.tm-timeline-item-left,
|
||||
.tm-timeline-item-right {
|
||||
width: 200rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.tm-timeline {
|
||||
.tm-timeline-item {
|
||||
|
||||
.tm-timeline-item-content {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.tm-timeline-jidian {
|
||||
margin: auto;
|
||||
}
|
||||
&.tm-timeline-item--leftDir {
|
||||
display: flex;
|
||||
flex-flow: row;
|
||||
&.endright {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.tm-timeline-item-left,
|
||||
.tm-timeline-item-right {
|
||||
width: auto;
|
||||
max-width: 400rpx;
|
||||
}
|
||||
.tm-timeline-item-boder {
|
||||
height: 100%;
|
||||
width: 1px;
|
||||
margin: auto;
|
||||
}
|
||||
.tm-timeline-jidian {
|
||||
position: relative;
|
||||
margin: auto;
|
||||
z-index: 2;
|
||||
width: 200rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.tm-timeline-item-content {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
align-content: flex-start;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.post {
|
||||
width: 560rpx;
|
||||
border-radius: 12rpx;
|
||||
background-color: #fff;
|
||||
&.lr_image_text {
|
||||
}
|
||||
&.lr_text_image {
|
||||
.post-thumbnail {
|
||||
order: 2;
|
||||
}
|
||||
.post-info {
|
||||
order: 1;
|
||||
padding-left: 0;
|
||||
padding-right: 24rpx;
|
||||
.tm-timeline-jidian {
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
&.tm-timeline-item--leftDir {
|
||||
display: flex;
|
||||
flex-flow: row;
|
||||
|
||||
&.endright {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.tm-timeline-item-left,
|
||||
.tm-timeline-item-right {
|
||||
width: auto;
|
||||
max-width: 400rpx;
|
||||
}
|
||||
|
||||
.tm-timeline-item-boder {
|
||||
height: 100%;
|
||||
width: 1px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.tm-timeline-jidian {
|
||||
position: relative;
|
||||
margin: auto;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.tm-timeline-item-content {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
align-content: flex-start;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&.tb_image_text {
|
||||
flex-direction: column;
|
||||
.post-thumbnail {
|
||||
width: 100%;
|
||||
height: 220rpx;
|
||||
|
||||
.post {
|
||||
width: 560rpx;
|
||||
border-radius: 12rpx;
|
||||
background-color: #fff;
|
||||
|
||||
&.lr_image_text {}
|
||||
|
||||
&.lr_text_image {
|
||||
.post-thumbnail {
|
||||
order: 2;
|
||||
}
|
||||
|
||||
.post-info {
|
||||
order: 1;
|
||||
padding-left: 0;
|
||||
padding-right: 24rpx;
|
||||
}
|
||||
}
|
||||
.post-info {
|
||||
width: 100%;
|
||||
padding-left: 0;
|
||||
&_title {
|
||||
|
||||
&.tb_image_text {
|
||||
flex-direction: column;
|
||||
|
||||
.post-thumbnail {
|
||||
width: 100%;
|
||||
height: 220rpx;
|
||||
}
|
||||
|
||||
.post-info {
|
||||
width: 100%;
|
||||
padding-left: 0;
|
||||
|
||||
&_title {
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
&_time {
|
||||
.iconfont {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.time-label {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.tb_text_image {
|
||||
flex-direction: column;
|
||||
|
||||
.post-thumbnail {
|
||||
order: 2;
|
||||
width: 100%;
|
||||
height: 220rpx;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
&_time {
|
||||
.iconfont {
|
||||
display: none;
|
||||
}
|
||||
.time-label {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&.tb_text_image {
|
||||
flex-direction: column;
|
||||
.post-thumbnail {
|
||||
order: 2;
|
||||
width: 100%;
|
||||
height: 220rpx;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
.post-info {
|
||||
order: 1;
|
||||
width: 100%;
|
||||
padding-left: 0;
|
||||
|
||||
&_time {
|
||||
.iconfont {
|
||||
display: none;
|
||||
}
|
||||
.time-label {
|
||||
display: inline-block;
|
||||
.post-info {
|
||||
order: 1;
|
||||
width: 100%;
|
||||
padding-left: 0;
|
||||
|
||||
&_time {
|
||||
.iconfont {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.time-label {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&.only_text {
|
||||
.post-info {
|
||||
padding: 6rpx;
|
||||
&_time {
|
||||
margin-top: 20rpx;
|
||||
.iconfont {
|
||||
display: none;
|
||||
}
|
||||
.time-label {
|
||||
display: inline-block;
|
||||
|
||||
&.only_text {
|
||||
.post-info {
|
||||
padding: 6rpx;
|
||||
|
||||
&_time {
|
||||
margin-top: 20rpx;
|
||||
|
||||
.iconfont {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.time-label {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.post-thumbnail {
|
||||
display: none;
|
||||
|
||||
.post-thumbnail {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.post-thumbnail {
|
||||
border-radius: 6rpx;
|
||||
width: 200rpx;
|
||||
height: 170rpx;
|
||||
}
|
||||
.post-info {
|
||||
width: 0;
|
||||
flex-grow: 1;
|
||||
&_title {
|
||||
color: #303133;
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
|
||||
.post-thumbnail {
|
||||
border-radius: 6rpx;
|
||||
width: 200rpx;
|
||||
height: 170rpx;
|
||||
}
|
||||
&_summary {
|
||||
display: -webkit-box;
|
||||
line-height: 1.6;
|
||||
}
|
||||
&_time {
|
||||
.time-label {
|
||||
display: none;
|
||||
|
||||
.post-info {
|
||||
width: 0;
|
||||
flex-grow: 1;
|
||||
|
||||
&_title {
|
||||
color: #303133;
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
&_summary {
|
||||
display: -webkit-box;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
&_time {
|
||||
.time-label {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
+141
-138
@@ -23,7 +23,7 @@
|
||||
<block v-else>
|
||||
<block v-for="(article, index) in dataList" :key="article.id">
|
||||
<!-- 文章卡片 -->
|
||||
<tm-translate animation-name="fadeUp" :wait="(index + 1) * 50">
|
||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||
<article-card :article="article" @on-click="fnToArticleDetail"></article-card>
|
||||
<!-- 广告区域 -->
|
||||
<view v-if="haloAdConfig.articles.use && (index + 1) % haloAdConfig.frequency == 0" class="ad-wrap ma-24">
|
||||
@@ -45,159 +45,162 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmSearch from '@/tm-vuetify/components/tm-search/tm-search.vue';
|
||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmSearch from '@/tm-vuetify/components/tm-search/tm-search.vue';
|
||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmSearch,
|
||||
tmTranslate,
|
||||
tmTabs,
|
||||
tmFlotbutton,
|
||||
tmEmpty
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isBlackTheme: false,
|
||||
loading: 'loading',
|
||||
tab: {
|
||||
activeIndex: 0,
|
||||
list: ['全部', '最新文章', '热门文章', '最近更新', '最多点赞']
|
||||
},
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0,
|
||||
sort: 'topPriority,createTime,desc',
|
||||
keyword: ''
|
||||
},
|
||||
cache: {
|
||||
dataList: [],
|
||||
total: 0
|
||||
},
|
||||
isLoadMore: false,
|
||||
loadMoreText: '加载中...',
|
||||
result: {},
|
||||
dataList: []
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('文章列表');
|
||||
},
|
||||
created() {
|
||||
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: {
|
||||
fnOnTabChange(index) {
|
||||
this.dataList = [];
|
||||
const _sorts = {
|
||||
0: '',
|
||||
1: 'topPriority,createTime,desc',
|
||||
2: 'topPriority,visits,desc',
|
||||
3: 'topPriority,updateTime,desc',
|
||||
4: 'topPriority,likes,desc'
|
||||
export default {
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmSearch,
|
||||
tmTranslate,
|
||||
tmTabs,
|
||||
tmFlotbutton,
|
||||
tmEmpty
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isBlackTheme: false,
|
||||
loading: 'loading',
|
||||
tab: {
|
||||
activeIndex: 0,
|
||||
list: ['全部', '最新文章', '热门文章', '最近更新', '最多点赞']
|
||||
},
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0,
|
||||
sort: 'topPriority,createTime,desc',
|
||||
keyword: ''
|
||||
},
|
||||
cache: {
|
||||
dataList: [],
|
||||
total: 0
|
||||
},
|
||||
isLoadMore: false,
|
||||
loadMoreText: '加载中...',
|
||||
result: {},
|
||||
dataList: []
|
||||
};
|
||||
this.queryParams.sort = _sorts[index];
|
||||
this.queryParams.page = 0;
|
||||
this.dataList = [];
|
||||
this.fnToTopPage();
|
||||
},
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('文章列表');
|
||||
},
|
||||
created() {
|
||||
this.fnGetData();
|
||||
},
|
||||
fnOnSearch() {
|
||||
this.queryParams.page = 0;
|
||||
onPullDownRefresh() {
|
||||
this.isLoadMore = false;
|
||||
this.queryParams.page = 0;
|
||||
this.fnGetData();
|
||||
},
|
||||
fnGetData() {
|
||||
uni.showLoading({
|
||||
mask: true,
|
||||
title: '加载中...'
|
||||
});
|
||||
// 设置状态为加载中
|
||||
if (!this.isLoadMore) {
|
||||
this.loading = 'loading';
|
||||
}
|
||||
this.loadMoreText = '加载中...';
|
||||
this.$httpApi
|
||||
.getPostList(this.queryParams)
|
||||
.then(res => {
|
||||
console.log('请求结果:');
|
||||
console.log(res);
|
||||
|
||||
this.loading = 'success';
|
||||
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
// 处理数据
|
||||
this.result = res.data;
|
||||
if (this.isLoadMore) {
|
||||
this.dataList = this.dataList.concat(res.data.content);
|
||||
} else {
|
||||
this.dataList = res.data.content;
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
}, 800);
|
||||
onReachBottom(e) {
|
||||
if (this.result.hasNext) {
|
||||
this.queryParams.page += 1;
|
||||
this.isLoadMore = true;
|
||||
this.fnGetData();
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '没有更多数据了'
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fnOnTabChange(index) {
|
||||
this.fnResetSetAniWaitIndex();
|
||||
this.dataList = [];
|
||||
const _sorts = {
|
||||
0: '',
|
||||
1: 'topPriority,createTime,desc',
|
||||
2: 'topPriority,visits,desc',
|
||||
3: 'topPriority,updateTime,desc',
|
||||
4: 'topPriority,likes,desc'
|
||||
};
|
||||
this.queryParams.sort = _sorts[index];
|
||||
this.queryParams.page = 0;
|
||||
this.dataList = [];
|
||||
this.fnToTopPage();
|
||||
this.fnGetData();
|
||||
},
|
||||
fnOnSearch() {
|
||||
this.fnResetSetAniWaitIndex();
|
||||
this.queryParams.page = 0;
|
||||
this.isLoadMore = false;
|
||||
this.fnGetData();
|
||||
},
|
||||
fnGetData() {
|
||||
uni.showLoading({
|
||||
mask: true,
|
||||
title: '加载中...'
|
||||
});
|
||||
// 设置状态为加载中
|
||||
if (!this.isLoadMore) {
|
||||
this.loading = 'loading';
|
||||
}
|
||||
this.loadMoreText = '加载中...';
|
||||
this.$httpApi
|
||||
.getPostList(this.queryParams)
|
||||
.then(res => {
|
||||
console.log('请求结果:');
|
||||
console.log(res);
|
||||
|
||||
//跳转文章详情
|
||||
fnToArticleDetail(article) {
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
|
||||
animationType: 'slide-in-right'
|
||||
});
|
||||
this.loading = 'success';
|
||||
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
// 处理数据
|
||||
this.result = res.data;
|
||||
if (this.isLoadMore) {
|
||||
this.dataList = this.dataList.concat(res.data.content);
|
||||
} else {
|
||||
this.dataList = res.data.content;
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
}, 800);
|
||||
});
|
||||
},
|
||||
|
||||
//跳转文章详情
|
||||
fnToArticleDetail(article) {
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
|
||||
animationType: 'slide-in-right'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-bottom: 24rpx;
|
||||
background-color: #fafafd;
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-bottom: 24rpx;
|
||||
background-color: #fafafd;
|
||||
|
||||
&.is-balck {
|
||||
background-color: #212121;
|
||||
&.is-balck {
|
||||
background-color: #212121;
|
||||
}
|
||||
}
|
||||
}
|
||||
.content {
|
||||
padding-top: 24rpx;
|
||||
|
||||
.content-empty {
|
||||
height: 60vh;
|
||||
.content {
|
||||
padding-top: 24rpx;
|
||||
|
||||
.content-empty {
|
||||
height: 60vh;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -11,7 +11,7 @@
|
||||
<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>
|
||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)"><article-card :article="article" @on-click="fnToArticleDetail"></article-card></tm-translate>
|
||||
</block>
|
||||
<view class="load-text">{{ loadMoreText }}</view>
|
||||
</block>
|
||||
@@ -22,123 +22,125 @@
|
||||
</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
|
||||
.getCategoryPostList(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);
|
||||
});
|
||||
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
|
||||
},
|
||||
//跳转文章详情
|
||||
fnToArticleDetail(article) {
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
|
||||
animationType: 'slide-in-right'
|
||||
});
|
||||
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
|
||||
.getCategoryPostList(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>
|
||||
.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>
|
||||
+97
-96
@@ -13,7 +13,7 @@
|
||||
</view>
|
||||
<block v-else>
|
||||
<block v-for="(journal, index) in dataList" :key="index">
|
||||
<tm-translate animation-name="fadeUp" :wait="(index + 1) * 50">
|
||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||
<!-- 日记卡片 -->
|
||||
<journal-card :journal="journal" :useLike="true"></journal-card>
|
||||
</tm-translate>
|
||||
@@ -27,107 +27,108 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
||||
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
||||
import journalCard from '@/components/journal-card/journal-card.vue';
|
||||
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
||||
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
||||
import journalCard from '@/components/journal-card/journal-card.vue';
|
||||
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
|
||||
export default {
|
||||
components: { mpHtml, tmSkeleton, tmEmpty, tmTranslate, tmFlotbutton, journalCard },
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
markdownConfig: MarkdownConfig,
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0
|
||||
},
|
||||
result: null,
|
||||
dataList: [],
|
||||
isLoadMore: false,
|
||||
loadMoreText: '加载中...'
|
||||
};
|
||||
},
|
||||
export default {
|
||||
components: { mpHtml, tmSkeleton, tmEmpty, tmTranslate, tmFlotbutton, journalCard },
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
markdownConfig: MarkdownConfig,
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0
|
||||
},
|
||||
result: null,
|
||||
dataList: [],
|
||||
isLoadMore: false,
|
||||
loadMoreText: '加载中...'
|
||||
};
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('个人日记');
|
||||
},
|
||||
created() {
|
||||
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;
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('个人日记');
|
||||
},
|
||||
created() {
|
||||
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
|
||||
.getJournals(this.queryParams)
|
||||
.then(res => {
|
||||
this.loading = 'success';
|
||||
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
// 处理数据
|
||||
this.result = res.data;
|
||||
if (this.isLoadMore) {
|
||||
this.dataList = this.dataList.concat(res.data.content);
|
||||
} else {
|
||||
this.dataList = res.data.content;
|
||||
}
|
||||
this.loading = 'success';
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
}, 500);
|
||||
},
|
||||
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
|
||||
.getJournals(this.queryParams)
|
||||
.then(res => {
|
||||
this.loading = 'success';
|
||||
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
// 处理数据
|
||||
this.result = res.data;
|
||||
if (this.isLoadMore) {
|
||||
this.dataList = this.dataList.concat(res.data.content);
|
||||
} else {
|
||||
this.dataList = res.data.content;
|
||||
}
|
||||
this.loading = 'success';
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.loading-wrap {
|
||||
}
|
||||
.app-page-content {
|
||||
}
|
||||
.content-empty {
|
||||
height: 60vh;
|
||||
}
|
||||
</style>
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.loading-wrap {}
|
||||
|
||||
.app-page-content {}
|
||||
|
||||
.content-empty {
|
||||
height: 60vh;
|
||||
}
|
||||
</style>
|
||||
+179
-193
@@ -13,18 +13,9 @@
|
||||
</view>
|
||||
<block v-else>
|
||||
<block v-for="(item, index) in dataList" :key="index">
|
||||
<tm-translate animation-name="fadeUp" :wait="(index + 1) * 50">
|
||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||
<!-- 列表项 -->
|
||||
<comment-item
|
||||
class="mb-12"
|
||||
:isChild="false"
|
||||
:comment="item"
|
||||
:postId="sheetId"
|
||||
:useSolid="false"
|
||||
@on-copy="fnCopyContent"
|
||||
@on-comment="fnToComment"
|
||||
@on-detail="fnOnShowCommentDetail"
|
||||
></comment-item>
|
||||
<comment-item class="mb-12" :isChild="false" :comment="item" :postId="sheetId" :useSolid="false" @on-copy="fnCopyContent" @on-comment="fnToComment" @on-detail="fnOnShowCommentDetail"></comment-item>
|
||||
</tm-translate>
|
||||
</block>
|
||||
<tm-flotbutton :offset="[16, 80]" @click="fnToTopPage" size="m" color="light-blue" icon="icon-angle-up"></tm-flotbutton>
|
||||
@@ -59,15 +50,7 @@
|
||||
</view>
|
||||
|
||||
<block v-else>
|
||||
<comment-item
|
||||
v-for="(comment, index) in commentDetail.list"
|
||||
:useSolid="false"
|
||||
:useActions="false"
|
||||
:key="index"
|
||||
:isChild="false"
|
||||
:comment="comment"
|
||||
:postId="sheetId"
|
||||
></comment-item>
|
||||
<comment-item v-for="(comment, index) in commentDetail.list" :useSolid="false" :useActions="false" :key="index" :isChild="false" :comment="comment" :postId="sheetId"></comment-item>
|
||||
</block>
|
||||
</block>
|
||||
</scroll-view>
|
||||
@@ -77,194 +60,197 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AppKeys from '@/config/keys.js';
|
||||
import SheetConfig from '@/config/sheets.config.js';
|
||||
import AppKeys from '@/config/keys.js';
|
||||
import SheetConfig from '@/config/sheets.config.js';
|
||||
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue';
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
import commentItem from '@/components/comment-item/comment-item.vue';
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue';
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
import commentItem from '@/components/comment-item/comment-item.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmFlotbutton,
|
||||
tmTranslate,
|
||||
tmEmpty,
|
||||
tmPoup,
|
||||
tmButton,
|
||||
commentItem
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0
|
||||
},
|
||||
result: null,
|
||||
dataList: [],
|
||||
isLoadMore: false,
|
||||
loadMoreText: '加载中...',
|
||||
sheetId: SheetConfig[AppKeys.SHEET_LEAVING],
|
||||
commentDetail: {
|
||||
export default {
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmFlotbutton,
|
||||
tmTranslate,
|
||||
tmEmpty,
|
||||
tmPoup,
|
||||
tmButton,
|
||||
commentItem
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
show: false,
|
||||
comment: {},
|
||||
postId: undefined,
|
||||
list: []
|
||||
}
|
||||
};
|
||||
},
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0
|
||||
},
|
||||
result: null,
|
||||
dataList: [],
|
||||
isLoadMore: false,
|
||||
loadMoreText: '加载中...',
|
||||
sheetId: SheetConfig[AppKeys.SHEET_LEAVING],
|
||||
commentDetail: {
|
||||
loading: 'loading',
|
||||
show: false,
|
||||
comment: {},
|
||||
postId: undefined,
|
||||
list: []
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('留言板');
|
||||
},
|
||||
created() {
|
||||
this.fnGetData();
|
||||
uni.$on('leaving_refresh', () => {
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('留言板');
|
||||
},
|
||||
created() {
|
||||
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;
|
||||
uni.$on('leaving_refresh', () => {
|
||||
this.fnGetData();
|
||||
});
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.isLoadMore = false;
|
||||
this.queryParams.page = 0;
|
||||
this.fnGetData();
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '没有更多数据了'
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
fnGetData() {
|
||||
uni.showLoading({
|
||||
mask: true,
|
||||
title: '加载中...'
|
||||
});
|
||||
// 设置状态为加载中
|
||||
if (!this.isLoadMore) {
|
||||
this.loading = 'loading';
|
||||
onReachBottom(e) {
|
||||
if (this.result.hasNext) {
|
||||
this.queryParams.page += 1;
|
||||
this.isLoadMore = true;
|
||||
this.fnGetData();
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '没有更多数据了'
|
||||
});
|
||||
}
|
||||
this.loadMoreText = '加载中...';
|
||||
this.$httpApi
|
||||
.getSheetsCommentsTreeBySheetId(this.sheetId, this.queryParams)
|
||||
.then(res => {
|
||||
if (res.status == 200) {
|
||||
this.loading = 'success';
|
||||
// return;
|
||||
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
// 处理数据
|
||||
this.result = res.data;
|
||||
if (this.isLoadMore) {
|
||||
this.dataList = this.dataList.concat(res.data.content);
|
||||
},
|
||||
|
||||
methods: {
|
||||
fnGetData() {
|
||||
uni.showLoading({
|
||||
mask: true,
|
||||
title: '加载中...'
|
||||
});
|
||||
// 设置状态为加载中
|
||||
if (!this.isLoadMore) {
|
||||
this.loading = 'loading';
|
||||
}
|
||||
this.loadMoreText = '加载中...';
|
||||
this.$httpApi
|
||||
.getSheetsCommentsTreeBySheetId(this.sheetId, this.queryParams)
|
||||
.then(res => {
|
||||
if (res.status == 200) {
|
||||
this.loading = 'success';
|
||||
// return;
|
||||
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
// 处理数据
|
||||
this.result = res.data;
|
||||
if (this.isLoadMore) {
|
||||
this.dataList = this.dataList.concat(res.data.content);
|
||||
} else {
|
||||
this.dataList = res.data.content;
|
||||
}
|
||||
} else {
|
||||
this.dataList = res.data.content;
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
}
|
||||
} else {
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
}, 500);
|
||||
});
|
||||
},
|
||||
fnToComment(data) {
|
||||
let _comment = {};
|
||||
if (data) {
|
||||
_comment = {
|
||||
id: this.sheetId,
|
||||
parentId: data.comment.id,
|
||||
title: data.comment.author,
|
||||
from: 'sheets',
|
||||
formPage: 'leaving',
|
||||
type: 'user'
|
||||
};
|
||||
} else {
|
||||
_comment = {
|
||||
id: this.sheetId,
|
||||
parentId: 0,
|
||||
title: '留言板留言',
|
||||
from: 'sheets',
|
||||
formPage: 'leaving',
|
||||
type: 'post'
|
||||
};
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
}, 500);
|
||||
});
|
||||
},
|
||||
fnToComment(data) {
|
||||
let _comment = {};
|
||||
if (data) {
|
||||
_comment = {
|
||||
id: this.sheetId,
|
||||
parentId: data.comment.id,
|
||||
title: data.comment.author,
|
||||
from: 'sheets',
|
||||
formPage: 'leaving',
|
||||
type: 'user'
|
||||
};
|
||||
} else {
|
||||
_comment = {
|
||||
id: this.sheetId,
|
||||
parentId: 0,
|
||||
title: '留言板留言',
|
||||
from: 'sheets',
|
||||
formPage: 'leaving',
|
||||
type: 'post'
|
||||
};
|
||||
}
|
||||
|
||||
uni.$tm.vx.commit('comment/setCommentInfo', _comment);
|
||||
this.$Router.push({
|
||||
path: '/pagesA/comment/comment',
|
||||
query: _comment
|
||||
});
|
||||
},
|
||||
fnCopyContent(content) {
|
||||
uni.$tm.u.setClipboardData(content);
|
||||
uni.$tm.toast('内容已复制成功!');
|
||||
},
|
||||
fnOnShowCommentDetail(comment) {
|
||||
this.commentDetail.comment = comment;
|
||||
this.commentDetail.list = [];
|
||||
this.commentDetail.show = true;
|
||||
this.fnGetChildComments();
|
||||
},
|
||||
fnGetChildComments() {
|
||||
this.commentDetail.loading = 'loading';
|
||||
this.$httpApi
|
||||
.getSheetsChildrenCommentList(this.sheetId, this.commentDetail.comment.id, {})
|
||||
.then(res => {
|
||||
if (res.status == 200) {
|
||||
this.commentDetail.loading = 'success';
|
||||
this.commentDetail.list = res.data;
|
||||
} else {
|
||||
this.commentDetail.loading = 'error';
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.commentDetail.loading = 'error';
|
||||
uni.$tm.vx.commit('comment/setCommentInfo', _comment);
|
||||
this.$Router.push({
|
||||
path: '/pagesA/comment/comment',
|
||||
query: _comment
|
||||
});
|
||||
},
|
||||
fnCopyContent(content) {
|
||||
uni.$tm.u.setClipboardData(content);
|
||||
uni.$tm.toast('内容已复制成功!');
|
||||
},
|
||||
fnOnShowCommentDetail(comment) {
|
||||
this.commentDetail.comment = comment;
|
||||
this.commentDetail.list = [];
|
||||
this.commentDetail.show = true;
|
||||
this.fnGetChildComments();
|
||||
},
|
||||
fnGetChildComments() {
|
||||
this.commentDetail.loading = 'loading';
|
||||
this.$httpApi
|
||||
.getSheetsChildrenCommentList(this.sheetId, this.commentDetail.comment.id, {})
|
||||
.then(res => {
|
||||
if (res.status == 200) {
|
||||
this.commentDetail.loading = 'success';
|
||||
this.commentDetail.list = res.data;
|
||||
} else {
|
||||
this.commentDetail.loading = 'error';
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.commentDetail.loading = 'error';
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fafafd;
|
||||
}
|
||||
.app-page-content {
|
||||
box-sizing: border-box;
|
||||
// box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
.content-empty {
|
||||
width: 100%;
|
||||
height: 60vh;
|
||||
}
|
||||
.loading-wrap {
|
||||
box-sizing: border-box;
|
||||
padding: 24rpx;
|
||||
}
|
||||
</style>
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fafafd;
|
||||
}
|
||||
|
||||
.app-page-content {
|
||||
box-sizing: border-box;
|
||||
// box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.content-empty {
|
||||
width: 100%;
|
||||
height: 60vh;
|
||||
}
|
||||
|
||||
.loading-wrap {
|
||||
box-sizing: border-box;
|
||||
padding: 24rpx;
|
||||
}
|
||||
</style>
|
||||
+118
-116
@@ -11,7 +11,7 @@
|
||||
<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>
|
||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)"><article-card :article="article" @on-click="fnToArticleDetail"></article-card></tm-translate>
|
||||
</block>
|
||||
<view class="load-text">{{ loadMoreText }}</view>
|
||||
</block>
|
||||
@@ -22,123 +22,125 @@
|
||||
</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);
|
||||
});
|
||||
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
|
||||
},
|
||||
//跳转文章详情
|
||||
fnToArticleDetail(article) {
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
|
||||
animationType: 'slide-in-right'
|
||||
});
|
||||
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>
|
||||
.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>
|
||||
Reference in New Issue
Block a user