1
0
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:
小莫唐尼
2023-06-08 21:23:21 +08:00
parent 21d723d260
commit f838da43d8
21 changed files with 4725 additions and 4865 deletions
+189 -199
View File
@@ -12,23 +12,7 @@
</view>
<block v-else>
<tm-sliderNav :list="categoryList" bg-color="white" color="light-blue" rang-key="name" @change="fnOnCategoryChange"></tm-sliderNav>
<scroll-view
class="right-content pt-12 pb-12"
:scroll-y="true"
:scroll-top="scrollTop"
:scroll-with-animation="true"
:refresher-enabled="true"
:refresher-triggered="triggered"
:refresher-threshold="60"
refresher-background="#fafafa"
@refresherrefresh="fnGetData(true)"
@scrolltolower="fnGetData(false)"
@scroll="fnOnScroll"
@touchmove.stop
@touchstart="fnOnTouchStart"
@touchend="fnOnTouchEnd"
@touchcancel="fnOnTouchEnd"
>
<scroll-view class="right-content pt-12 pb-12" :scroll-y="true" :scroll-top="scrollTop" :scroll-with-animation="true" :refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="60" refresher-background="#fafafa" @refresherrefresh="fnGetData(true)" @scrolltolower="fnGetData(false)" @scroll="fnOnScroll" @touchmove.stop @touchstart="fnOnTouchStart" @touchend="fnOnTouchEnd" @touchcancel="fnOnTouchEnd">
<view v-if="dataList.length == 0" class="article-empty flex flex-center">
<tm-empty icon="icon-shiliangzhinengduixiang-" label="该分类下暂无文章~"></tm-empty>
</view>
@@ -36,7 +20,7 @@
<block v-else>
<block v-for="(article, index) in dataList" :key="article.createTime">
<!-- 文章卡片 -->
<tm-translate animation-name="fadeUp" :wait="(index + 1) * 50">
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)">
<article-min-card :article="article" @on-click="fnToArticleDetail"></article-min-card>
</tm-translate>
</block>
@@ -50,195 +34,201 @@
</template>
<script>
import throttle from '@/utils/throttle.js';
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 tmFlowLayout from '@/tm-vuetify/components/tm-flowLayout/tm-flowLayout.vue';
import tmSliderNav from '@/tm-vuetify/components/tm-sliderNav/tm-sliderNav.vue';
import throttle from '@/utils/throttle.js';
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 tmFlowLayout from '@/tm-vuetify/components/tm-flowLayout/tm-flowLayout.vue';
import tmSliderNav from '@/tm-vuetify/components/tm-sliderNav/tm-sliderNav.vue';
import ArticleMinCard from '@/components/article-min-card/article-min-card.vue';
export default {
components: {
tmSkeleton,
tmTranslate,
tmFlotbutton,
tmEmpty,
tmFlowLayout,
tmSliderNav,
ArticleMinCard
},
data() {
return {
loading: 'loading',
queryParams: {
size: 10,
page: 0,
slug: ''
},
categoryList: [],
result: null,
dataList: [],
isLoadMore: false,
loadMoreText: '',
scrollTop: 0,
tempScrollTop: 0,
scrollTimeout: null,
triggered: false
};
},
import ArticleMinCard from '@/components/article-min-card/article-min-card.vue';
export default {
components: {
tmSkeleton,
tmTranslate,
tmFlotbutton,
tmEmpty,
tmFlowLayout,
tmSliderNav,
ArticleMinCard
},
data() {
return {
loading: 'loading',
queryParams: {
size: 10,
page: 0,
slug: ''
},
categoryList: [],
result: null,
dataList: [],
isLoadMore: false,
loadMoreText: '',
scrollTop: 0,
tempScrollTop: 0,
scrollTimeout: null,
triggered: false
};
},
onLoad() {
this.fnSetPageTitle('文章分类');
this.fnGetAllCategory();
},
onPullDownRefresh() {
this.queryParams.page = 0;
this.isLoadMore = false;
this.fnGetData();
},
onReachBottom(e) {
if (this.result.hasNext) {
this.queryParams.page += 1;
this.isLoadMore = true;
this.fnGetData(false);
} else {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
},
methods: {
fnOnCategoryChange(e) {
this.queryParams.slug = this.categoryList[e].slug;
this.fnToTopScroll();
this.dataList = [];
onLoad() {
this.fnSetPageTitle('文章分类');
this.fnGetAllCategory();
},
onPullDownRefresh() {
this.queryParams.page = 0;
this.isLoadMore = false;
this.fnGetData();
},
fnGetAllCategory() {
this.loading = 'loading';
uni.showLoading({
mask: true,
title: '加载中...'
});
this.$httpApi
.getCategoryList({ more: true })
.then(res => {
this.categoryList = res.data;
if (res.data.length != 0) {
this.queryParams.slug = res.data[0].slug;
this.triggered = false;
this.loading = 'success';
this.fnGetData(true, false);
}
})
.catch(err => {
console.error(err);
this.loading = 'error';
})
.finally(() => {
uni.hideLoading();
uni.stopPullDownRefresh();
});
},
fnGetData(isPulldownRefresh = true, triggered = true) {
if (!isPulldownRefresh) {
if (this.result.hasNext) {
this.queryParams.page += 1;
} else {
return uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
onReachBottom(e) {
if (this.result.hasNext) {
this.queryParams.page += 1;
this.isLoadMore = true;
this.fnGetData(false);
} else {
this.queryParams.page = 0;
if (triggered) {
this.triggered = true;
}
}
this.$httpApi
.getCategoryPostList(this.queryParams.slug, this.queryParams)
.then(res => {
this.result = res.data;
if (!isPulldownRefresh) {
this.dataList = this.dataList.concat(res.data.content);
} else {
this.dataList = res.data.content;
}
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
})
.catch(err => {
this.loadMoreText = '加载失败!';
})
.finally(() => {
this.triggered = false;
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
},
//跳转文章详情
fnToArticleDetail(article) {
uni.navigateTo({
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
animationType: 'slide-in-right'
});
},
fnOnScroll(e) {
this.tempScrollTop = e.detail.scrollTop;
},
fnToTopScroll() {
uni.pageScrollTo({
scrollTop: 0,
duration: 500
});
this.scrollTop = 0;
this.tempScrollTop = 0;
},
fnOnTouchStart() {
clearTimeout(this.scrollTimeout);
},
fnOnTouchEnd() {
this.scrollTimeout = setTimeout(() => {
this.scrollTop = this.tempScrollTop;
}, 500);
methods: {
fnOnCategoryChange(e) {
this.fnResetSetAniWaitIndex();
this.queryParams.slug = this.categoryList[e].slug;
this.fnToTopScroll();
this.dataList = [];
this.fnGetData();
},
fnGetAllCategory() {
this.loading = 'loading';
uni.showLoading({
mask: true,
title: '加载中...'
});
this.$httpApi
.getCategoryList({ more: true })
.then(res => {
this.categoryList = res.data;
if (res.data.length != 0) {
this.queryParams.slug = res.data[0].slug;
this.triggered = false;
this.loading = 'success';
this.fnGetData(true, false);
}
})
.catch(err => {
console.error(err);
this.loading = 'error';
})
.finally(() => {
uni.hideLoading();
uni.stopPullDownRefresh();
});
},
fnGetData(isPulldownRefresh = true, triggered = true) {
if (!isPulldownRefresh) {
if (this.result.hasNext) {
this.queryParams.page += 1;
} else {
return uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
} else {
this.queryParams.page = 0;
if (triggered) {
this.triggered = true;
}
}
this.$httpApi
.getCategoryPostList(this.queryParams.slug, this.queryParams)
.then(res => {
this.result = res.data;
if (!isPulldownRefresh) {
this.dataList = this.dataList.concat(res.data.content);
} else {
this.dataList = res.data.content;
}
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
})
.catch(err => {
this.loadMoreText = '加载失败!';
})
.finally(() => {
this.triggered = false;
});
},
//跳转文章详情
fnToArticleDetail(article) {
uni.navigateTo({
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
animationType: 'slide-in-right'
});
},
fnOnScroll(e) {
this.tempScrollTop = e.detail.scrollTop;
},
fnToTopScroll() {
uni.pageScrollTo({
scrollTop: 0,
duration: 500
});
this.scrollTop = 0;
this.tempScrollTop = 0;
},
fnOnTouchStart() {
clearTimeout(this.scrollTimeout);
},
fnOnTouchEnd() {
this.scrollTimeout = setTimeout(() => {
this.scrollTop = this.tempScrollTop;
}, 500);
}
}
}
};
};
</script>
<style lang="scss" scoped>
.app-page {
width: 100vw;
min-height: 100vh;
display: flex;
flex-direction: column;
background-color: #fff;
}
.content {
height: 100vh;
background-color: #fafafa;
}
.category-empty {
width: 100%;
height: 70vh;
}
.article-empty {
width: 100%;
height: 70vh;
}
.right-content {
// width: calc(100vw - 144rpx);
width: calc(100vw - 190rpx);
height: 100vh;
background-color: #fff;
white-space: nowrap;
background-color: #fafafa;
}
.loading-wrap {
padding: 24rpx;
}
</style>
.app-page {
width: 100vw;
min-height: 100vh;
display: flex;
flex-direction: column;
background-color: #fff;
}
.content {
height: 100vh;
background-color: #fafafa;
}
.category-empty {
width: 100%;
height: 70vh;
}
.article-empty {
width: 100%;
height: 70vh;
}
.right-content {
// width: calc(100vw - 144rpx);
width: calc(100vw - 190rpx);
height: 100vh;
background-color: #fff;
white-space: nowrap;
background-color: #fafafa;
}
.loading-wrap {
padding: 24rpx;
}
</style>
+204 -200
View File
@@ -74,7 +74,7 @@
</tm-flowLayout>
<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)">
<view class="round-3 shadow-2 overflow white mb-24">
<tm-images :previmage="false" :src="item.image" @click="fnPreview(item)"></tm-images>
<view class="pa-24 text-size-m">
@@ -107,221 +107,225 @@
</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 tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
import tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue';
import tmFlowLayout from '@/tm-vuetify/components/tm-flowLayout/tm-flowLayout.vue';
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.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 tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
import tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue';
import tmFlowLayout from '@/tm-vuetify/components/tm-flowLayout/tm-flowLayout.vue';
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
export default {
components: {
tmSkeleton,
tmTranslate,
tmFlotbutton,
tmTags,
tmEmpty,
tmIcons,
tmImages,
tmFlowLayout,
tmTabs
},
data() {
return {
isBlackTheme: false,
loading: 'loading',
category: {
activeIndex: 0,
activeValue: '',
list: []
},
queryParams: {
size: 10,
page: 0,
team: null,
keyword: ''
},
cache: {
dataList: [],
total: 0
},
isLoadMore: false,
loadMoreText: '',
result: {},
dataList: []
};
},
filters: {
filterTakeTime(val) {
return uni.$tm.dayjs(val).format('DD/MM/YYYY');
}
},
watch: {
globalAppSettings: {
deep: true,
handler() {
// this.isLoadMore = false;
// this.queryParams.page = 0;
// this.dataList = [];
// this.cache.list = [];
// this.cache.total = 0;
export default {
components: {
tmSkeleton,
tmTranslate,
tmFlotbutton,
tmTags,
tmEmpty,
tmIcons,
tmImages,
tmFlowLayout,
tmTabs
},
data() {
return {
isBlackTheme: false,
loading: 'loading',
category: {
activeIndex: 0,
activeValue: '',
list: []
},
queryParams: {
size: 10,
page: 0,
team: null,
keyword: ''
},
cache: {
dataList: [],
total: 0
},
isLoadMore: false,
loadMoreText: '',
result: {},
dataList: []
};
},
filters: {
filterTakeTime(val) {
return uni.$tm.dayjs(val).format('DD/MM/YYYY');
}
}
},
onLoad() {
this.fnSetPageTitle('个人图库');
this.fnGetCategory();
},
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;
},
watch: {
globalAppSettings: {
deep: true,
handler() {
// this.isLoadMore = false;
// this.queryParams.page = 0;
// this.dataList = [];
// this.cache.list = [];
// this.cache.total = 0;
}
}
},
onLoad() {
this.fnSetPageTitle('个人图库');
this.fnGetCategory();
},
created() {
this.fnGetData();
} else {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
},
methods: {
fnOnCategoryChange(index) {
this.dataList = [];
if (index == 0) {
this.queryParams.team = null;
} else {
this.queryParams.team = this.category.list[index];
}
},
onPullDownRefresh() {
this.isLoadMore = false;
this.queryParams.page = 0;
this.fnToTopPage();
this.fnGetData();
},
fnGetCategory() {
this.$httpApi.getPhotoTeams().then(res => {
this.category.list = ['全部', ...res.data];
});
},
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
.getPhotoListByPage(this.queryParams)
.then(res => {
if (res.status == 200) {
this.loading = 'success';
this.result = res.data;
if (res.data.content.length != 0) {
const _list = res.data.content.map((item, index) => {
item['image'] = this.$utils.checkImageUrl(item.thumbnail);
item['model'] = 'text';
item['takeTime'] = this.$tm.dayjs(item['takeTime']).format('DD/MM/YYYY');
return item;
});
this.fnCacheDataList(_list);
if (this.globalAppSettings.gallery.useWaterfull) {
this.dataList = _list;
this.$nextTick(() => {
this.$refs.wafll.pushData(_list);
},
methods: {
fnOnCategoryChange(index) {
this.fnResetSetAniWaitIndex();
this.dataList = [];
if (index == 0) {
this.queryParams.team = null;
} else {
this.queryParams.team = this.category.list[index];
}
this.queryParams.page = 0;
this.fnToTopPage();
this.fnGetData();
},
fnGetCategory() {
this.$httpApi.getPhotoTeams().then(res => {
this.category.list = ['全部', ...res.data];
});
},
fnGetData() {
uni.showLoading({
mask: true,
title: '加载中...'
});
// 设置状态为加载中
if (!this.isLoadMore) {
this.loading = 'loading';
}
this.loadMoreText = '';
this.$httpApi
.getPhotoListByPage(this.queryParams)
.then(res => {
if (res.status == 200) {
this.loading = 'success';
this.result = res.data;
if (res.data.content.length != 0) {
const _list = res.data.content.map((item, index) => {
item['image'] = this.$utils.checkImageUrl(item.thumbnail);
item['model'] = 'text';
item['takeTime'] = this.$tm.dayjs(item['takeTime']).format('DD/MM/YYYY');
return item;
});
} else {
this.dataList = this.dataList.concat(_list);
this.fnCacheDataList(_list);
if (this.globalAppSettings.gallery.useWaterfull) {
this.dataList = _list;
this.$nextTick(() => {
this.$refs.wafll.pushData(_list);
});
} else {
this.dataList = this.dataList.concat(_list);
}
}
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
} else {
this.loading = 'error';
this.waterfall.loading = 'finish';
this.loadMoreText = '';
}
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
} else {
})
.catch(err => {
console.error(err);
this.loading = 'error';
this.waterfall.loading = 'finish';
this.loadMoreText = '';
}
})
.catch(err => {
console.error(err);
this.loading = 'error';
this.waterfall.loading = 'finish';
this.loadMoreText = '加载失败,请下拉刷新!';
})
.finally(() => {
setTimeout(() => {
uni.hideLoading();
uni.stopPullDownRefresh();
}, 500);
});
},
// 缓存数据
fnCacheDataList(dataList) {
if (this.queryParams.page == 0) {
this.cache.dataList = dataList;
} else {
this.cache.dataList = [...this.cache.dataList, ...dataList];
}
},
this.loadMoreText = '加载失败,请下拉刷新!';
})
.finally(() => {
setTimeout(() => {
uni.hideLoading();
uni.stopPullDownRefresh();
}, 500);
});
},
// 缓存数据
fnCacheDataList(dataList) {
if (this.queryParams.page == 0) {
this.cache.dataList = dataList;
} else {
this.cache.dataList = [...this.cache.dataList, ...dataList];
}
},
// 瀑布流组件点击事件
fnOnClick(data) {
console.log('点击数据', data);
},
// 预览
fnPreview(item) {
const index = this.cache.dataList.findIndex(x => x.id == item.id);
uni.previewImage({
current: index,
urls: this.cache.dataList.map(x => x.image),
indicator: 'number',
loop: true
});
// 瀑布流组件点击事件
fnOnClick(data) {
console.log('点击数据', data);
},
// 预览
fnPreview(item) {
const index = this.cache.dataList.findIndex(x => x.id == item.id);
uni.previewImage({
current: index,
urls: this.cache.dataList.map(x => x.image),
indicator: 'number',
loop: true
});
}
}
}
};
};
</script>
<style lang="scss" scoped>
.app-page {
width: 100vw;
min-height: 100vh;
display: flex;
flex-direction: column;
padding-bottom: 24rpx;
background-color: #fafafa;
&.is-balck {
background-color: #212121;
}
}
.content {
box-sizing: border-box;
padding: 0 24rpx;
padding-top: 24rpx;
.content-empty {
height: 60vh;
.app-page {
width: 100vw;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
padding-bottom: 24rpx;
background-color: #fafafa;
&.is-balck {
background-color: #212121;
}
}
}
.loading-wrap {
box-sizing: border-box;
padding: 24rpx;
}
.card {
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.03);
}
</style>
.content {
box-sizing: border-box;
padding: 0 24rpx;
padding-top: 24rpx;
.content-empty {
height: 60vh;
display: flex;
align-items: center;
justify-content: center;
}
}
.loading-wrap {
box-sizing: border-box;
padding: 24rpx;
}
.card {
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.03);
}
</style>
+356 -349
View File
@@ -22,13 +22,7 @@
<view class="bg-white pb-24">
<!-- 轮播图+广告 -->
<view class="banner bg-white ml-24 mr-24 mt-12 round-3" v-if="bannerList.length != 0">
<e-swiper
:dotPosition="globalAppSettings.banner.dotPosition"
:autoplay="true"
:useDot="globalAppSettings.banner.useDot"
:list="bannerList"
@on-click="fnOnBannerClick"
></e-swiper>
<e-swiper :dotPosition="globalAppSettings.banner.dotPosition" :autoplay="true" :useDot="globalAppSettings.banner.useDot" :list="bannerList" @on-click="fnOnBannerClick"></e-swiper>
</view>
<!-- 快捷导航 -->
<!-- <view v-if="useQuickNav" class="quick-nav flex-between round-3 flex mt-12 ml-12 mr-12 pa-24">
@@ -73,7 +67,7 @@
<block v-else>
<view :class="globalAppSettings.layout.home">
<block v-for="(article, index) in articleList" :key="article.createTime">
<tm-translate class="ani-item" animation-name="fadeUp" :wait="(index + 1) * 50">
<tm-translate class="ani-item" animation-name="fadeUp" :wait="calcAniWait(index)">
<article-card from="home" :article="article" @on-click="fnToArticleDetail"></article-card>
<!-- 广告区域 -->
<view v-if="haloAdConfig.home.use && (index + 1) % haloAdConfig.frequency == 0" class="ad-wrap ma-24">
@@ -96,367 +90,380 @@
</template>
<script>
import tmMenubars from '@/tm-vuetify/components/tm-menubars/tm-menubars.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 tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
import tmMenubars from '@/tm-vuetify/components/tm-menubars/tm-menubars.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 tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
import eSwiper from '@/components/e-swiper/e-swiper.vue';
import eSwiper from '@/components/e-swiper/e-swiper.vue';
export default {
components: {
tmMenubars,
tmSkeleton,
tmTranslate,
tmFlotbutton,
tmIcons,
tmEmpty,
eSwiper
},
data() {
return {
loading: 'loading',
queryParams: {
size: 10,
page: 0
},
result: {},
isLoadMore: false,
loadMoreText: '加载中...',
bannerCurrent: 0,
bannerList: [],
noticeList: [],
articleList: [],
categoryList: [],
useQuickNav: false,
quickNavList: []
};
},
computed: {
bloggerInfo() {
let blogger = this.$tm.vx.getters().getBlogger;
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
return blogger;
}
},
onLoad() {
this.fnSetPageTitle();
this.useQuickNav = this.$haloConfig.quickNav.use;
},
created() {
this.fnQuery();
},
onPullDownRefresh() {
this.isLoadMore = false;
this.queryParams.page = 0;
this.fnQuery();
},
onReachBottom(e) {
if (this.result.hasNext) {
this.queryParams.page += 1;
this.isLoadMore = true;
this.fnGetArticleList();
} else {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
},
methods: {
fnQuery() {
this.fnGetBanner();
this.fnGetArticleList();
this.fnGetCategoryList();
this.fnGetQuickNavList();
export default {
components: {
tmMenubars,
tmSkeleton,
tmTranslate,
tmFlotbutton,
tmIcons,
tmEmpty,
eSwiper
},
fnGetQuickNavList() {
this.useQuickNav = this.$haloConfig.quickNav.use;
if (!this.$haloConfig.quickNav.use) return;
const _quickNavList = this.$haloConfig.quickNav.list;
this.quickNavList = _quickNavList.map(item => {
return item;
});
},
fnGetCategoryList() {
this.$httpApi
.getCategoryList({ more: true })
.then(res => {
this.categoryList = res.data.sort((a, b) => {
return b.postCount - a.postCount;
});
setTimeout(() => {
this.loading = 'success';
}, 500);
})
.catch(err => {
console.error(err);
this.loading = 'error';
})
.finally(() => {
setTimeout(() => {
uni.hideLoading();
uni.stopPullDownRefresh();
}, 500);
});
},
// 获取轮播图
fnGetBanner() {
const _this = this;
const _format = function(list, type) {
return list.map((item, index) => {
switch (type) {
case 'list':
return {
id: index,
nickname: _this.bloggerInfo.nickname,
avatar: _this.bloggerInfo.avatar,
address: item.href || '',
title: item.title,
image: _this.$utils.checkImageUrl(item.thumbnail)
};
case 'article':
return {
mp4: '',
id: item.id,
nickname: _this.bloggerInfo.nickname,
avatar: _this.bloggerInfo.avatar,
address: '',
createTime: uni.$tm.dayjs(item.createTime).fromNow(),
title: item.title,
src: _this.$utils.checkImageUrl(item.thumbnail),
image: _this.$utils.checkImageUrl(item.thumbnail)
};
case 'banner':
return {
id: '',
src: item
};
}
});
data() {
return {
loading: 'loading',
queryParams: {
size: 10,
page: 0
},
result: {},
isLoadMore: false,
loadMoreText: '加载中...',
bannerCurrent: 0,
bannerList: [],
noticeList: [],
articleList: [],
categoryList: [],
useQuickNav: false,
quickNavList: []
};
switch (this.$haloConfig.banner.type) {
case 'list': // 手动配置的banner
this.bannerList = _format(this.$haloConfig.banner.list, 'list');
break;
case 'article': // 来自热门文章的封面
this.$httpApi.getPostList({ page: 0, size: 6, sort: 'topPriority,visits,desc' }).then(res => {
this.bannerList = _format(res.data.content, 'article');
if (this.bannerList.length == 0) {
this.bannerList = _format(this.$haloConfig.banner.list, 'list');
},
computed: {
bloggerInfo() {
let blogger = this.$tm.vx.getters().getBlogger;
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
return blogger;
},
},
onLoad() {
this.fnSetPageTitle();
this.useQuickNav = this.$haloConfig.quickNav.use;
},
created() {
this.fnQuery();
},
onPullDownRefresh() {
this.isLoadMore = false;
this.queryParams.page = 0;
this.fnQuery();
},
onReachBottom(e) {
if (this.result.hasNext) {
this.queryParams.page += 1;
this.isLoadMore = true;
this.fnGetArticleList();
} else {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
},
methods: {
fnQuery() {
this.fnGetBanner();
this.fnGetArticleList();
this.fnGetCategoryList();
this.fnGetQuickNavList();
},
fnGetQuickNavList() {
this.useQuickNav = this.$haloConfig.quickNav.use;
if (!this.$haloConfig.quickNav.use) return;
const _quickNavList = this.$haloConfig.quickNav.list;
this.quickNavList = _quickNavList.map(item => {
return item;
});
},
fnGetCategoryList() {
this.$httpApi
.getCategoryList({ more: true })
.then(res => {
this.categoryList = res.data.sort((a, b) => {
return b.postCount - a.postCount;
});
setTimeout(() => {
this.loading = 'success';
}, 500);
})
.catch(err => {
console.error(err);
this.loading = 'error';
})
.finally(() => {
setTimeout(() => {
uni.hideLoading();
uni.stopPullDownRefresh();
}, 500);
});
},
// 获取轮播图
fnGetBanner() {
const _this = this;
const _format = function(list, type) {
return list.map((item, index) => {
switch (type) {
case 'list':
return {
id: index,
nickname: _this.bloggerInfo.nickname,
avatar: _this.bloggerInfo.avatar,
address: item.href || '',
title: item.title,
image: _this.$utils.checkImageUrl(item.thumbnail)
};
case 'article':
return {
mp4: '',
id: item.id,
nickname: _this.bloggerInfo.nickname,
avatar: _this.bloggerInfo.avatar,
address: '',
createTime: uni.$tm.dayjs(item.createTime).fromNow(),
title: item.title,
src: _this.$utils.checkImageUrl(item.thumbnail),
image: _this.$utils.checkImageUrl(item.thumbnail)
};
case 'banner':
return {
id: '',
src: item
};
}
});
break;
case 'banner': // 来自后台配置的banner(暂未开放)
this.bannerList = _format([], 'banner');
break;
}
},
fnOnBannerChange(e) {
this.bannerCurrent = e.current;
},
fnOnBannerClick(item) {
if (item.id == '') return;
this.fnToArticleDetail(item);
},
// 文章列表
fnGetArticleList() {
uni.showLoading({
mask: true,
title: '加载中...'
});
// 设置状态为加载中
if (!this.isLoadMore) {
this.loading = 'loading';
}
this.loadMoreText = '加载中...';
this.$httpApi
.getPostList(this.queryParams)
.then(res => {
this.loading = 'success';
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
this.result = res.data;
if (this.isLoadMore) {
this.articleList = this.articleList.concat(res.data.content);
} else {
this.articleList = res.data.content;
}
this.loading = 'success';
})
.catch(err => {
this.loading = 'error';
this.loadMoreText = '加载失败,请下拉刷新!';
uni.$tm.toast(err.message || '数据加载失败!');
})
.finally(() => {
uni.hideLoading();
uni.stopPullDownRefresh();
};
switch (this.$haloConfig.banner.type) {
case 'list': // 手动配置的banner
this.bannerList = _format(this.$haloConfig.banner.list, 'list');
break;
case 'article': // 来自热门文章的封面
this.$httpApi.getPostList({ page: 0, size: 6, sort: 'topPriority,visits,desc' }).then(res => {
this.bannerList = _format(res.data.content, 'article');
if (this.bannerList.length == 0) {
this.bannerList = _format(this.$haloConfig.banner.list, 'list');
}
});
break;
case 'banner': // 来自后台配置的banner(暂未开放)
this.bannerList = _format([], 'banner');
break;
}
},
fnOnBannerChange(e) {
this.bannerCurrent = e.current;
},
fnOnBannerClick(item) {
if (item.id == '') return;
this.fnToArticleDetail(item);
},
// 文章列表
fnGetArticleList() {
uni.showLoading({
mask: true,
title: '加载中...'
});
},
// 设置状态为加载中
if (!this.isLoadMore) {
this.loading = 'loading';
}
this.loadMoreText = '加载中...';
this.$httpApi
.getPostList(this.queryParams)
.then(res => {
this.loading = 'success';
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
this.result = res.data;
if (this.isLoadMore) {
this.articleList = this.articleList.concat(res.data.content);
} else {
this.articleList = res.data.content;
}
this.loading = 'success';
})
.catch(err => {
this.loading = 'error';
this.loadMoreText = '加载失败,请下拉刷新!';
uni.$tm.toast(err.message || '数据加载失败!');
})
.finally(() => {
uni.hideLoading();
uni.stopPullDownRefresh();
});
},
//跳转文章详情
fnToArticleDetail(article) {
uni.navigateTo({
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
animationType: 'slide-in-right'
});
},
// 快捷导航页面跳转
fnToNavPage(item) {
switch (item.type) {
case 'tabbar':
uni.switchTab({
url: item.path
});
break;
case 'page':
uni.navigateTo({
url: item.path
});
break;
//跳转文章详情
fnToArticleDetail(article) {
uni.navigateTo({
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
animationType: 'slide-in-right'
});
},
// 快捷导航页面跳转
fnToNavPage(item) {
switch (item.type) {
case 'tabbar':
uni.switchTab({
url: item.path
});
break;
case 'page':
uni.navigateTo({
url: item.path
});
break;
}
},
// 分类页面
fnToCategoryPage() {
uni.switchTab({
url: '/pages/tabbar/category/category'
});
},
// 所有的文章列表页面
fnToArticlesPage() {
uni.navigateTo({
url: '/pagesA/articles/articles'
});
},
// 根据slug查询分类下的文章
fnToCategoryBy(category) {
uni.navigateTo({
url: `/pagesA/category-detail/category-detail?slug=${category.slug}&name=${category.name}`
});
},
fnChangeMode() {
const isBlackTheme = this.$tm.vx.state().tmVuetify.black;
this.$tm.theme.setBlack(!isBlackTheme);
uni.setNavigationBarColor({
backgroundColor: !isBlackTheme ? '#0a0a0a' : '#ffffff',
frontColor: !isBlackTheme ? '#ffffff' : '#0a0a0a'
});
},
fnToSearch() {
uni.navigateTo({
url: '/pagesA/articles/articles'
});
}
},
// 分类页面
fnToCategoryPage() {
uni.switchTab({
url: '/pages/tabbar/category/category'
});
},
// 所有的文章列表页面
fnToArticlesPage() {
uni.navigateTo({
url: '/pagesA/articles/articles'
});
},
// 根据slug查询分类下的文章
fnToCategoryBy(category) {
uni.navigateTo({
url: `/pagesA/category-detail/category-detail?slug=${category.slug}&name=${category.name}`
});
},
fnChangeMode() {
const isBlackTheme = this.$tm.vx.state().tmVuetify.black;
this.$tm.theme.setBlack(!isBlackTheme);
uni.setNavigationBarColor({
backgroundColor: !isBlackTheme ? '#0a0a0a' : '#ffffff',
frontColor: !isBlackTheme ? '#ffffff' : '#0a0a0a'
});
},
fnToSearch() {
uni.navigateTo({
url: '/pagesA/articles/articles'
});
}
}
};
};
</script>
<style lang="scss" scoped>
.app-page {
width: 100vw;
min-height: 100vh;
display: flex;
flex-direction: column;
// background-color: #ffffff;
.app-page {
width: 100vw;
min-height: 100vh;
display: flex;
flex-direction: column;
// background-color: #ffffff;
.logo {
width: 60rpx;
height: 60rpx;
.logo {
width: 60rpx;
height: 60rpx;
box-sizing: border-box;
}
::v-deep {
.tm-menubars .body .body_wk .left {
min-width: initial;
}
}
}
.loading-wrap {
padding: 24rpx;
}
.search-input {
background-color: #f5f5f5;
align-items: center;
/* #ifdef MP-WEIXIN */
margin-right: 24rpx;
/* #endif */
&_icon {}
&_text {}
}
.show-more {
width: 42rpx;
height: 42rpx;
box-sizing: border-box;
box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.03);
}
::v-deep {
.tm-menubars .body .body_wk .left {
min-width: initial;
}
.banner {
overflow: hidden;
}
}
.loading-wrap {
padding: 24rpx;
}
.search-input {
background-color: #f5f5f5;
align-items: center;
/* #ifdef MP-WEIXIN */
margin-right: 24rpx;
/* #endif */
&_icon {
}
&_text {
}
}
.show-more {
width: 42rpx;
height: 42rpx;
box-sizing: border-box;
box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.03);
}
.banner {
overflow: hidden;
}
.quick-nav {
background-color: #fff;
box-sizing: border-box;
// box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
.name {
color: var(--main-text-color);
}
}
.category {
width: 94vw;
display: flex;
height: 200rpx;
white-space: nowrap;
margin: 0 24rpx;
.content {
display: inline-block;
padding-left: 24rpx;
&:first-child {
padding-left: 0;
}
}
.cate-empty {
height: inherit;
}
}
.page-item {
&_title {
position: relative;
padding-left: 24rpx;
font-size: 32rpx;
z-index: 1;
color: var(--main-text-color);
&:before {
content: '';
position: absolute;
left: 0rpx;
top: 8rpx;
width: 8rpx;
height: 30rpx;
background-color: rgba(33, 150, 243, 1);
border-radius: 6rpx;
z-index: 0;
.quick-nav {
background-color: #fff;
box-sizing: border-box;
// box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
.name {
color: var(--main-text-color);
}
}
}
.h_row_col2 {
display: flex;
flex-wrap: wrap;
box-sizing: border-box;
padding: 0 12rpx;
.ani-item {
width: 50%;
.category {
width: 94vw;
display: flex;
height: 200rpx;
white-space: nowrap;
margin: 0 24rpx;
.content {
display: inline-block;
padding-left: 24rpx;
&:first-child {
padding-left: 0;
}
}
.cate-empty {
height: inherit;
}
}
}
</style>
.page-item {
&_title {
position: relative;
padding-left: 24rpx;
font-size: 32rpx;
z-index: 1;
color: var(--main-text-color);
&:before {
content: '';
position: absolute;
left: 0rpx;
top: 8rpx;
width: 8rpx;
height: 30rpx;
background-color: rgba(33, 150, 243, 1);
border-radius: 6rpx;
z-index: 0;
}
}
}
.h_row_col2 {
display: flex;
flex-wrap: wrap;
box-sizing: border-box;
padding: 0 12rpx;
.ani-item {
width: 50%;
}
}
</style>
+249 -275
View File
@@ -16,22 +16,11 @@
<!-- 如果只有一个分组使用列表的形式 result.length == 1 -->
<view v-else-if="result.length == 1" class="flex flex-col pb-24">
<block v-for="(link, index) in result[0].children" :key="index">
<tm-translate animation-name="fadeUp" :wait="(index + 1) * 50">
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)">
<!-- 色彩版本 -->
<view
v-if="!globalAppSettings.links.useSimple"
class="info flex pt-24 pb-24 pl-12 pr-12"
:class="{ 'border-b-1': index != result[0].children.length - 1 }"
@click="fnOnLinkEvent(link)"
>
<view v-if="!globalAppSettings.links.useSimple" class="info flex pt-24 pb-24 pl-12 pr-12" :class="{ 'border-b-1': index != result[0].children.length - 1 }" @click="fnOnLinkEvent(link)">
<view class="link-logo">
<cache-image
class="link-logo_img"
radius="12rpx"
:url="link.logo"
:fileMd5="link.logo"
mode="aspectFill"
></cache-image>
<cache-image class="link-logo_img" radius="12rpx" :url="link.logo" :fileMd5="link.logo" mode="aspectFill"></cache-image>
</view>
<view class="flex flex-col pl-30 info-detail">
<view class="link-card_name text-size-l text-weight-b text-red">{{ link.name }}</view>
@@ -67,28 +56,17 @@
<!-- 如果大于一个分组使用联系人的索引形式 result.length > 1 -->
<block v-else>
<block v-for="(team, index) in result" :key="index">
<tm-translate animation-name="fadeUp" :wait="(index + 1) * 50">
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)">
<view class="grey-lighten-4 text text-size-s text-weight-b px-32 py-12">{{ team.title }}</view>
<block v-for="(link, linkIndex) in team.children" :key="link.id">
<tm-translate animation-name="fadeUp" :wait="(linkIndex + 1) * 50">
<tm-translate animation-name="fadeUp" :wait="calcAniWait(linkIndex)">
<!-- 色彩版本 -->
<view
v-if="!globalAppSettings.links.useSimple"
class="info flex pt-24 pb-24 pl-12 pr-12"
:class="{
<view v-if="!globalAppSettings.links.useSimple" class="info flex pt-24 pb-24 pl-12 pr-12" :class="{
'border-b-1':
linkIndex != team.children.length - 1 || index == result.length - 1
}"
@click="fnOnLinkEvent(link)"
>
}" @click="fnOnLinkEvent(link)">
<view class="link-logo">
<cache-image
class="link-logo_img"
radius="12rpx"
:url="link.logo"
:fileMd5="link.logo"
mode="aspectFill"
></cache-image>
<cache-image class="link-logo_img" radius="12rpx" :url="link.logo" :fileMd5="link.logo" mode="aspectFill"></cache-image>
</view>
<view class="flex flex-col pl-30 info-detail">
<view class="link-card_name text-size-l text-weight-b text-red">
@@ -98,12 +76,7 @@
<tm-tags color="bg-gradient-amber-accent" :shadow="0" size="s" model="fill">
ID{{ link.id }}
</tm-tags>
<tm-tags
color=" bg-gradient-light-blue-lighten"
:shadow="0"
size="s"
model="fill"
>
<tm-tags color=" bg-gradient-light-blue-lighten" :shadow="0" size="s" model="fill">
{{ link.team || '暂未分组' }}
</tm-tags>
</view>
@@ -113,11 +86,7 @@
</view>
</view>
<!-- 简洁版本 -->
<view
v-else
class="link-card flex ml-24 mr-24 pt-24 pb-24"
@click="fnOnLinkEvent(link)"
>
<view v-else class="link-card flex ml-24 mr-24 pt-24 pb-24" @click="fnOnLinkEvent(link)">
<image class="logo shadow-6" :src="link.logo" mode="aspectFill"></image>
<view class="info pl-24">
<view class="name text-size-g">{{ link.name }}</view>
@@ -137,13 +106,7 @@
</block>
<!-- 返回顶部 -->
<tm-flotbutton
v-if="linkTotal > 10"
color="light-blue"
@click="fnToTopPage"
size="m"
icon="icon-angle-up"
></tm-flotbutton>
<tm-flotbutton v-if="linkTotal > 10" color="light-blue" @click="fnToTopPage" size="m" icon="icon-angle-up"></tm-flotbutton>
<!-- 详情弹窗 -->
<tm-poup v-model="detail.show" :width="640" height="auto" position="center" :round="6">
@@ -175,12 +138,7 @@
<!-- 博客预览图 -->
<view class="mt-24">
<tm-images
:width="568"
:round="2"
:src="caclSiteThumbnail(detail.data.url)"
mode="aspectFill"
></tm-images>
<tm-images :width="568" :round="2" :src="caclSiteThumbnail(detail.data.url)" mode="aspectFill"></tm-images>
</view>
</view>
</tm-poup>
@@ -189,243 +147,259 @@
</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 tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue';
import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.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 tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue';
import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue';
import { GetRandomNumberByRange } from '@/utils/random.js';
export default {
components: {
tmSkeleton,
tmTranslate,
tmFlotbutton,
tmTags,
tmEmpty,
tmImages,
tmPoup
},
data() {
return {
loading: 'loading',
queryParams: {
size: 10,
page: 0,
sort: ''
},
result: [],
detail: {
show: false,
data: {}
},
linkTotal: 0
};
},
computed: {
caclSiteThumbnail(val) {
return val => {
if (!val) return '';
if (val.charAt(val.length - 1) != '/') {
val = val + '/';
}
return 'https://image.thum.io/get/width/1000/crop/800/' + val;
};
}
},
onLoad() {
this.fnSetPageTitle('朋友圈');
},
created() {
this.fnGetData();
},
onPullDownRefresh() {
this.fnGetData();
},
methods: {
fnRandomColor() {
const _r = GetRandomNumberByRange(0, this.$haloConfig.colors.length - 1);
return this.$haloConfig.colors[_r];
import { GetRandomNumberByRange } from '@/utils/random.js';
export default {
components: {
tmSkeleton,
tmTranslate,
tmFlotbutton,
tmTags,
tmEmpty,
tmImages,
tmPoup
},
fnGetData() {
this.linkTotal = 0;
this.loading = 'loading';
uni.showLoading({
mask: true,
title: '加载中...'
});
this.$httpApi
.getLinkListByTeam()
.then(res => {
if (res.status == 200) {
console.log('请求结果:');
console.log(res);
// 处理数据
const _result = res.data.map(item => {
const _team = item.team || '未分组';
const _links = item.links.map(link => {
this.linkTotal += 1;
link.logo = this.$utils.checkAvatarUrl(link.logo);
return link;
});
return {
title: _team,
children: _links
};
});
this.result = _result.reverse();
setTimeout(() => {
this.loading = 'success';
}, 500);
} else {
this.loading = 'error';
}
})
.catch(err => {
console.error(err);
this.loading = 'error';
})
.finally(() => {
setTimeout(() => {
uni.hideLoading();
uni.stopPullDownRefresh();
}, 500);
});
},
fnOnLinkEvent(link) {
this.detail.data = link;
this.detail.show = true;
},
fnCopyLink(link) {
uni.setClipboardData({
data: `${link.name}:${link.url}`,
showToast: false,
success: () => {
uni.showToast({
icon: 'none',
title: '链接复制成功!'
});
data() {
return {
loading: 'loading',
queryParams: {
size: 10,
page: 0,
sort: ''
},
fail: () => {
uni.showToast({
icon: 'none',
title: '复制失败!'
result: [],
detail: {
show: false,
data: {}
},
linkTotal: 0
};
},
computed: {
caclSiteThumbnail(val) {
return val => {
if (!val) return '';
if (val.charAt(val.length - 1) != '/') {
val = val + '/';
}
return 'https://image.thum.io/get/width/1000/crop/800/' + val;
};
}
},
onLoad() {
this.fnSetPageTitle('朋友圈');
},
created() {
this.fnGetData();
},
onPullDownRefresh() {
this.fnGetData();
},
methods: {
fnRandomColor() {
const _r = GetRandomNumberByRange(0, this.$haloConfig.colors.length - 1);
return this.$haloConfig.colors[_r];
},
fnGetData() {
this.linkTotal = 0;
this.loading = 'loading';
uni.showLoading({
mask: true,
title: '加载中...'
});
this.$httpApi
.getLinkListByTeam()
.then(res => {
if (res.status == 200) {
console.log('请求结果:');
console.log(res);
// 处理数据
const _result = res.data.map(item => {
const _team = item.team || '未分组';
const _links = item.links.map(link => {
this.linkTotal += 1;
link.logo = this.$utils.checkAvatarUrl(link.logo);
return link;
});
return {
title: _team,
children: _links
};
});
this.result = _result.reverse();
setTimeout(() => {
this.loading = 'success';
}, 500);
} else {
this.loading = 'error';
}
})
.catch(err => {
console.error(err);
this.loading = 'error';
})
.finally(() => {
setTimeout(() => {
uni.hideLoading();
uni.stopPullDownRefresh();
}, 500);
});
}
});
},
fnOnLinkEvent(link) {
this.detail.data = link;
this.detail.show = true;
},
fnCopyLink(link) {
uni.setClipboardData({
data: `${link.name}:${link.url}`,
showToast: false,
success: () => {
uni.showToast({
icon: 'none',
title: '链接复制成功!'
});
},
fail: () => {
uni.showToast({
icon: 'none',
title: '复制失败!'
});
}
});
}
}
}
};
};
</script>
<style lang="scss" scoped>
.app-page {
width: 100vw;
min-height: 100vh;
display: flex;
flex-direction: column;
background-color: #fafafd;
}
.loading-wrap {
padding: 24rpx;
min-height: 100vh;
}
.content {
padding: 0 24rpx;
padding-top: 24rpx;
.content-empty {
height: 60vh;
.app-page {
width: 100vw;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
background-color: #fafafd;
}
}
.link-card {
border-bottom: 2rpx solid #f5f5f5;
background-color: #ffffff;
&.one {
border: 0;
box-shadow: 0rpx 2rpx 24rpx 0rpx rgba(0, 0, 0, 0.03);
.logo {
box-shadow: 0rpx 2rpx 12rpx rgba(0, 0, 0, 0.1);
.loading-wrap {
padding: 24rpx;
min-height: 100vh;
}
.content {
padding: 0 24rpx;
padding-top: 24rpx;
.content-empty {
height: 60vh;
display: flex;
align-items: center;
justify-content: center;
}
}
.logo {
// width: 126rpx;
// height: 126rpx;
width: 80rpx;
height: 80rpx;
border-radius: 12rpx;
border: 6rpx solid #ffffff;
box-shadow: none;
.link-card {
border-bottom: 2rpx solid #f5f5f5;
background-color: #ffffff;
&.one {
border: 0;
box-shadow: 0rpx 2rpx 24rpx 0rpx rgba(0, 0, 0, 0.03);
.logo {
box-shadow: 0rpx 2rpx 12rpx rgba(0, 0, 0, 0.1);
}
}
.logo {
// width: 126rpx;
// height: 126rpx;
width: 80rpx;
height: 80rpx;
border-radius: 12rpx;
border: 6rpx solid #ffffff;
box-shadow: none;
}
.info {
width: 0;
flex-grow: 1;
.name {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #303133;
font-size: 30rpx;
font-weight: bold;
}
.desc {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #303133;
font-size: 28rpx;
}
}
}
.info {
.link-card_name {
// color: #303133;
// color: #0080fe;
}
.link-card_desc {
font-size: 24rpx;
line-height: 1.6;
color: #303133;
}
.link-logo {
width: 140rpx;
height: 140rpx;
&_img {
width: 100%;
height: 100%;
}
}
.poup-logo {
width: 140rpx;
height: 140rpx;
border-radius: 50%;
&_img {
width: 100%;
height: 100%;
border-radius: 50%;
}
}
.info-detail {
width: 0;
flex-grow: 1;
.name {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #303133;
font-size: 30rpx;
font-weight: bold;
}
.desc {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #303133;
font-size: 28rpx;
}
justify-content: center;
}
}
.link-card_name {
// color: #303133;
// color: #0080fe;
}
.link-card_desc {
font-size: 24rpx;
line-height: 1.6;
color: #303133;
}
.link-logo {
width: 140rpx;
height: 140rpx;
&_img {
.poup-desc {
font-size: 28rpx;
line-height: 1.6;
color: #555 !important;
}
.preview-site {
width: 100%;
height: 100%;
height: 300rpx;
}
}
.poup-logo {
width: 140rpx;
height: 140rpx;
border-radius: 50%;
&_img {
width: 100%;
height: 100%;
border-radius: 50%;
}
}
.info-detail {
width: 0;
flex-grow: 1;
justify-content: center;
}
.poup-desc {
font-size: 28rpx;
line-height: 1.6;
color: #555 !important;
}
.preview-site {
width: 100%;
height: 300rpx;
}
</style>
</style>