mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2025-05-19 01:50:15 +09:00
update: 修复首次运行跳转页面非首页问题
This commit is contained in:
parent
90ef890766
commit
f6069cad95
@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<view class="article-card " :class="cardType" @click="fnClickEvent('card')">
|
||||
<view class="left">
|
||||
<cache-image class="thumbnail" radius="6rpx" :url="$utils.checkThumbnailUrl(article.spec.cover)" :fileMd5="$utils.checkThumbnailUrl(article.spec.cover)" mode="aspectFill"></cache-image>
|
||||
<!-- <image class="thumbnail" lazy-load :src="$utils.checkThumbnailUrl(article.thumbnail)" mode="aspectFill"></image> -->
|
||||
<cache-image class="thumbnail" radius="6rpx" :url="$utils.checkThumbnailUrl(article.spec.cover)" :fileMd5="article.spec.cover" mode="aspectFill"></cache-image>
|
||||
<!-- <image class="thumbnail" lazy-load :src="$utils.checkThumbnailUrl(article.spec.cover)" mode="aspectFill"></image> -->
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="title">
|
||||
|
@ -12,19 +12,14 @@
|
||||
fnCheckShowStarted() {
|
||||
if (!getApp().globalData.start.use) {
|
||||
uni.switchTab({
|
||||
// url: '/pages/tabbar/home/home'
|
||||
url: '/pages/tabbar/moments/moments'
|
||||
url: '/pages/tabbar/home/home'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (uni.getStorageSync('APP_HAS_STARTED')) {
|
||||
uni.switchTab({
|
||||
// url: '/pages/tabbar/home/home'
|
||||
url: '/pages/tabbar/moments/moments'
|
||||
url: '/pages/tabbar/home/home'
|
||||
});
|
||||
// uni.navigateTo({
|
||||
// url: '/pagesA/friend-links/friend-links'
|
||||
// });
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
url: '/pagesA/start/start'
|
||||
|
@ -311,17 +311,17 @@
|
||||
// type: 'poup',
|
||||
// show: true
|
||||
// },
|
||||
{
|
||||
key: 'update',
|
||||
title: '版本更新',
|
||||
leftIcon: 'icon-clouddownload',
|
||||
leftIconColor: 'pink',
|
||||
rightText: `当前版本 v${systemInfo.appVersion}`,
|
||||
path: 'update',
|
||||
isAdmin: false,
|
||||
type: 'poup',
|
||||
show: true
|
||||
},
|
||||
// {
|
||||
// key: 'update',
|
||||
// title: '版本更新',
|
||||
// leftIcon: 'icon-clouddownload',
|
||||
// leftIconColor: 'pink',
|
||||
// rightText: `当前版本 v${systemInfo.appVersion}`,
|
||||
// path: 'update',
|
||||
// isAdmin: false,
|
||||
// type: 'poup',
|
||||
// show: true
|
||||
// },
|
||||
{
|
||||
key: 'setting',
|
||||
title: '应用设置',
|
||||
|
@ -54,7 +54,7 @@
|
||||
markdownConfig: MarkdownConfig,
|
||||
loading: 'loading',
|
||||
queryParams: {
|
||||
size: 10,
|
||||
size: 20,
|
||||
page: 1
|
||||
},
|
||||
result: null,
|
||||
|
@ -21,34 +21,16 @@
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有分享图片~"></tm-empty>
|
||||
</view>
|
||||
<block v-else>
|
||||
<tm-flowLayout v-if="globalAppSettings.gallery.useWaterfull" @click="fnOnClick" ref="wafll">
|
||||
<template v-slot:left="{ hdata }">
|
||||
<tm-translate animation-name="fadeUp">
|
||||
<view class="card round-3 overflow white">
|
||||
<tm-images :previmage="false" :src="hdata.item.spec.cover"
|
||||
@click="fnPreview(hdata.item)"></tm-images>
|
||||
</view>
|
||||
</tm-translate>
|
||||
</template>
|
||||
<template v-slot:right="{ hdata }">
|
||||
<tm-translate animation-name="fadeUp">
|
||||
<view class="card round-3 overflow white">
|
||||
<tm-images :previmage="false" :src="hdata.item.spec.cover"
|
||||
@click="fnPreview(hdata.item)"></tm-images>
|
||||
</view>
|
||||
</tm-translate>
|
||||
</template>
|
||||
</tm-flowLayout>
|
||||
<block v-else>
|
||||
<block v-for="(item, index) in dataList" :key="index">
|
||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||
<view class="round-3 shadow-2 overflow white mb-24">
|
||||
<tm-images :previmage="false" :src="item.spec.cover"
|
||||
@click="fnPreview(item)"></tm-images>
|
||||
</view>
|
||||
</tm-translate>
|
||||
</block>
|
||||
<block v-for="(item, index) in dataList" :key="index">
|
||||
<tm-translate style="box-sizing: border-box;padding: 6rpx;width: 50%;height: 250rpx;"
|
||||
animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||
<view style="border-radius: 12rpx;overflow: hidden;width: 100%;height: 250rpx;">
|
||||
<image style="width: 100%;height: 100%;" mode="aspectFill" :src="item.spec.cover"
|
||||
@click="fnPreview(item)" />
|
||||
</view>
|
||||
</tm-translate>
|
||||
</block>
|
||||
|
||||
<tm-flotbutton @click="fnToTopPage" color="light-blue" size="m" icon="icon-angle-up"></tm-flotbutton>
|
||||
<view class="load-text">{{ loadMoreText }}</view>
|
||||
</block>
|
||||
@ -133,6 +115,7 @@
|
||||
methods: {
|
||||
fnOnCategoryChange(index) {
|
||||
this.fnResetSetAniWaitIndex();
|
||||
this.cache.dataList = []
|
||||
this.dataList = [];
|
||||
this.queryParams.group = this.category.list[index].name;
|
||||
this.queryParams.page = 1;
|
||||
@ -175,13 +158,10 @@
|
||||
return item;
|
||||
});
|
||||
this.fnCacheDataList(_list);
|
||||
if (this.globalAppSettings.gallery.useWaterfull) {
|
||||
this.dataList = _list;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.wafll.pushData(_list);
|
||||
});
|
||||
} else {
|
||||
if (this.isLoadMore) {
|
||||
this.dataList = this.dataList.concat(_list);
|
||||
} else {
|
||||
this.dataList = _list;
|
||||
}
|
||||
}
|
||||
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
@ -242,11 +222,15 @@
|
||||
}
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
box-sizing: border-box;
|
||||
padding: 0 24rpx;
|
||||
padding-top: 24rpx;
|
||||
gap: 12rpx 0;
|
||||
|
||||
.content-empty {
|
||||
width: 100%;
|
||||
height: 60vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -262,4 +246,9 @@
|
||||
.card {
|
||||
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
}
|
||||
|
||||
.load-text {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
@ -1,8 +1,7 @@
|
||||
<template>
|
||||
<view class="app-page">
|
||||
<tm-menubars iconColor="white" color="white" :flat="true" :showback="false">
|
||||
<image slot="left" class="logo ml-24 round-24" :src="bloggerInfo.avatar" mode="scaleToFill"
|
||||
@click="$tm.toast('以后会放一个彩蛋~')"></image>
|
||||
<image slot="left" class="logo ml-24 round-24" :src="bloggerInfo.avatar" mode="scaleToFill"></image>
|
||||
<view class="search-input round-12 pt-12 pb-12 flex pl-24" @click="fnToSearch">
|
||||
<text class="search-input_icon iconfont text-size-m icon-search text-grey"></text>
|
||||
<view class="search-input_text pl-12 text-size-m text-grey">搜索文章...</view>
|
||||
@ -11,7 +10,7 @@
|
||||
<view slot="right" class="mr-24 text-size-m text-grey">uni-halo</view>
|
||||
<!-- #endif -->
|
||||
</tm-menubars>
|
||||
<view v-if="loading != 'success'" class="loading-wrap">
|
||||
<view v-if="loading != 'success' && articleList.length===0" class="loading-wrap">
|
||||
<tm-skeleton model="card"></tm-skeleton>
|
||||
<tm-skeleton model="cardActions"></tm-skeleton>
|
||||
<tm-skeleton model="list"></tm-skeleton>
|
||||
@ -26,7 +25,7 @@
|
||||
<e-swiper :dotPosition="globalAppSettings.banner.dotPosition" :autoplay="true"
|
||||
:useDot="globalAppSettings.banner.useDot" :list="bannerList"
|
||||
@on-click="fnOnBannerClick"></e-swiper>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 精品分类 -->
|
||||
<view class="flex flex-between mt-16 mb-24 pl-24 pr-24">
|
||||
@ -65,28 +64,16 @@
|
||||
label="博主还没有发表任何文章~"></tm-empty></view>
|
||||
<block v-else>
|
||||
<view :class="globalAppSettings.layout.home">
|
||||
<block v-for="(article, index) in articleList" :key="article.spec.slug">
|
||||
<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">
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<ad v-if="haloAdConfig.unitId" :unit-id="haloAdConfig.unitId"></ad>
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<ad v-if="haloAdConfig.adpid" :adpid="haloAdConfig.adpid"></ad>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</tm-translate>
|
||||
</block>
|
||||
<tm-translate v-for="(article, index) in articleList" :key="article.metadata.name" class="ani-item"
|
||||
animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||
<article-card from="home" :article="article" @on-click="fnToArticleDetail"></article-card>
|
||||
</tm-translate>
|
||||
</view>
|
||||
<view class="load-text mt-12">{{ loadMoreText }}</view>
|
||||
<tm-flotbutton v-if="articleList.length > 10" color="light-blue" @click="fnToTopPage" size="m"
|
||||
icon="icon-angle-up"></tm-flotbutton>
|
||||
</block>
|
||||
</block>
|
||||
<!-- <tm-flotbutton @click="fnChangeMode" size="m" color="light-blue" :icon="$tm.vx.state().tmVuetify.black ? 'icon-lightbulb' : 'icon-lightbulb-fill'"></tm-flotbutton> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -125,7 +112,7 @@
|
||||
noticeList: [],
|
||||
articleList: [],
|
||||
categoryList: [],
|
||||
|
||||
|
||||
};
|
||||
},
|
||||
|
||||
@ -138,7 +125,7 @@
|
||||
|
||||
},
|
||||
onLoad() {
|
||||
this.fnSetPageTitle();
|
||||
this.fnSetPageTitle();
|
||||
},
|
||||
|
||||
created() {
|
||||
@ -166,14 +153,13 @@
|
||||
fnQuery() {
|
||||
this.fnGetBanner();
|
||||
this.fnGetArticleList();
|
||||
this.fnGetCategoryList();
|
||||
this.fnGetCategoryList();
|
||||
},
|
||||
|
||||
|
||||
fnGetCategoryList() {
|
||||
this.$httpApi.v2
|
||||
.getCategoryList({})
|
||||
.then(res => {
|
||||
console.log('查询分类成功:', res);
|
||||
this.categoryList = res.items.sort((a, b) => {
|
||||
return b.postCount - a.postCount;
|
||||
});
|
||||
@ -271,19 +257,22 @@
|
||||
this.loading = 'loading';
|
||||
}
|
||||
this.loadMoreText = '加载中...';
|
||||
|
||||
|
||||
this.$httpApi.v2
|
||||
.getPostList(this.queryParams)
|
||||
.then(res => {
|
||||
console.log('加载成功', res);
|
||||
setTimeout(() => {
|
||||
this.result = res;
|
||||
if (this.isLoadMore) {
|
||||
this.articleList = this.articleList.concat(res.items);
|
||||
} else {
|
||||
this.articleList = res.items;
|
||||
}
|
||||
}, 200)
|
||||
this.loading = 'success';
|
||||
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
this.result = res;
|
||||
if (this.isLoadMore) {
|
||||
this.articleList = this.articleList.concat(res.items);
|
||||
} else {
|
||||
this.articleList = res.items;
|
||||
}
|
||||
this.loading = 'success';
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = 'error';
|
||||
|
@ -34,7 +34,6 @@ const utils = {
|
||||
|
||||
// 检查封面图
|
||||
checkThumbnailUrl: function(thumbnail, mustRealUrl = false) {
|
||||
console.log("thumbnail",thumbnail)
|
||||
if (!thumbnail && mustRealUrl) {
|
||||
return HaloConfig.defaultStaticThumbnailUrl
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user