mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2025-05-19 18:10:15 +09:00
update: 优化审核模式,新增审核使用模拟数据
This commit is contained in:
parent
74a5efb596
commit
bf41b08b35
@ -1,5 +1,6 @@
|
|||||||
// 应用设置存储key值
|
// 应用设置存储key值
|
||||||
export const _AppConfigKey = 'APP_GLOBAL_CONFIGS';
|
export const _AppConfigKey = 'APP_GLOBAL_CONFIGS';
|
||||||
|
export const _AppMockJsonKey = 'APP_GLOBAL_MOCK_JSON';
|
||||||
|
|
||||||
// 默认的应用设置
|
// 默认的应用设置
|
||||||
export const DefaultAppConfigs = {
|
export const DefaultAppConfigs = {
|
||||||
@ -8,7 +9,7 @@ export const DefaultAppConfigs = {
|
|||||||
authorConfig: {},
|
authorConfig: {},
|
||||||
appConfig: {},
|
appConfig: {},
|
||||||
pluginConfig: {},
|
pluginConfig: {},
|
||||||
pageConfig:{}
|
pageConfig: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,3 +29,22 @@ export const getAppConfigs = () => {
|
|||||||
export const setAppConfigs = (configs) => {
|
export const setAppConfigs = (configs) => {
|
||||||
uni.setStorageSync(_AppConfigKey, JSON.stringify(configs))
|
uni.setStorageSync(_AppConfigKey, JSON.stringify(configs))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取应用模拟数据
|
||||||
|
*/
|
||||||
|
export const getAppMockJson = () => {
|
||||||
|
let json = uni.getStorageSync(_AppMockJsonKey)
|
||||||
|
if (json) return JSON.parse(json)
|
||||||
|
|
||||||
|
uni.setStorageSync(_AppMockJsonKey, JSON.stringify({}))
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存应用模拟数据
|
||||||
|
*/
|
||||||
|
export const setAppMockJson = (json) => {
|
||||||
|
uni.setStorageSync(_AppMockJsonKey, JSON.stringify(json))
|
||||||
|
}
|
||||||
|
@ -29,6 +29,11 @@
|
|||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
// uni.$tm.vx.commit('setWxShare', res.shareConfig);
|
// uni.$tm.vx.commit('setWxShare', res.shareConfig);
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
// 获取mockjson
|
||||||
|
await uni.$tm.vx.actions('config/fetchMockJson')
|
||||||
|
|
||||||
|
// 进入检查
|
||||||
this.fnCheckShowStarted();
|
this.fnCheckShowStarted();
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
|
@ -190,7 +190,8 @@
|
|||||||
path: '/pagesA/archives/archives',
|
path: '/pagesA/archives/archives',
|
||||||
isAdmin: false,
|
isAdmin: false,
|
||||||
type: 'page',
|
type: 'page',
|
||||||
show: !this.haloConfigs.basicConfig.auditModeEnabled
|
// show: !this.haloConfigs.basicConfig.auditModeEnabled
|
||||||
|
show: true
|
||||||
}, {
|
}, {
|
||||||
key: 'love',
|
key: 'love',
|
||||||
title: '恋爱日记',
|
title: '恋爱日记',
|
||||||
|
@ -1,20 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page">
|
<view class="app-page">
|
||||||
<view class="auditModeEnabled" v-if="haloConfigs.basicConfig.auditModeEnabled">
|
|
||||||
<view>你好呀,很开心认识你!</view>
|
<view v-if="loading !== 'success'" class="loading-wrap">
|
||||||
<view style="margin-top: 36rpx;">
|
|
||||||
{{haloConfigs.appConfig.appInfo.name}}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<block v-else>
|
|
||||||
<view v-if="loading != 'success'" class="loading-wrap">
|
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
</view>
|
</view>
|
||||||
<!-- 内容区域 -->
|
<!-- 内容区域 -->
|
||||||
<view v-else class="app-page-content">
|
<view v-else class="app-page-content">
|
||||||
<view v-if="dataList.length == 0" class="content-empty flex flex-center" style="height: 70vh;">
|
<view v-if="dataList.length === 0" class="content-empty flex flex-center" style="height: 70vh;">
|
||||||
<!-- 空布局 -->
|
<!-- 空布局 -->
|
||||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
|
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
|
||||||
</view>
|
</view>
|
||||||
@ -25,8 +19,11 @@
|
|||||||
<view class="catgory-card" :style="{backgroundImage:`url(${item.spec.cover})`}">
|
<view class="catgory-card" :style="{backgroundImage:`url(${item.spec.cover})`}">
|
||||||
<view class="content" @click="handleToCategory(item)">
|
<view class="content" @click="handleToCategory(item)">
|
||||||
<view style="font-size: 32rpx;color: #ffffff;">{{ item.spec.displayName }}</view>
|
<view style="font-size: 32rpx;color: #ffffff;">{{ item.spec.displayName }}</view>
|
||||||
<view style="font-size: 24rpx;color: #ffffff;margin-top: 6rpx;">共
|
<view v-if="!haloConfigs.basicConfig.auditModeEnabled" style="font-size: 24rpx;color: #ffffff;margin-top: 6rpx;">
|
||||||
{{ item.postCount }} 篇文章
|
共 {{ item.postCount }} 篇文章
|
||||||
|
</view>
|
||||||
|
<view v-else style="font-size: 24rpx;color: #ffffff;margin-top: 6rpx;">
|
||||||
|
共 {{ item.postCount }} 篇内容
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -36,20 +33,20 @@
|
|||||||
<view class="load-text">{{ loadMoreText }}</view>
|
<view class="load-text">{{ loadMoreText }}</view>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||||
|
|
||||||
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
||||||
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
tmSkeleton,
|
tmSkeleton,
|
||||||
tmFlotbutton,
|
tmFlotbutton,
|
||||||
@ -75,6 +72,9 @@
|
|||||||
haloConfigs() {
|
haloConfigs() {
|
||||||
return this.$tm.vx.getters().getConfigs;
|
return this.$tm.vx.getters().getConfigs;
|
||||||
},
|
},
|
||||||
|
mockJson() {
|
||||||
|
return this.$tm.vx.getters().getMockJson;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.fnGetData();
|
this.fnGetData();
|
||||||
@ -86,6 +86,13 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
onReachBottom(e) {
|
onReachBottom(e) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '没有更多数据了'
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
if (this.hasNext) {
|
if (this.hasNext) {
|
||||||
this.queryParams.page += 1;
|
this.queryParams.page += 1;
|
||||||
this.isLoadMore = true;
|
this.isLoadMore = true;
|
||||||
@ -100,9 +107,22 @@
|
|||||||
methods: {
|
methods: {
|
||||||
fnGetData() {
|
fnGetData() {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
uni.setNavigationBarTitle({
|
this.dataList = this.mockJson.category.list.map((item) => {
|
||||||
title: "你好,很高兴认识你!"
|
return {
|
||||||
})
|
metadata: {
|
||||||
|
name: Date.now() * Math.random(),
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
displayName: item.title,
|
||||||
|
cover: this.$utils.checkImageUrl(item.cover)
|
||||||
|
},
|
||||||
|
postCount: 0
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.loading = 'success';
|
||||||
|
this.loadMoreText = '呜呜,没有更多数据啦~';
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
@ -155,43 +175,46 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleToCategory(data) {
|
handleToCategory(data) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pagesA/category-detail/category-detail?name=${data.metadata.name}&title=${data.spec.displayName}`
|
url: `/pagesA/category-detail/category-detail?name=${data.metadata.name}&title=${data.spec.displayName}`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-page {
|
.app-page {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 24rpx 0;
|
padding: 24rpx 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.auditModeEnabled {
|
.auditModeEnabled {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 80vh;
|
height: 80vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading-wrap {
|
.loading-wrap {
|
||||||
padding: 24rpx;
|
padding: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-page-content {
|
.app-page-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
padding: 0 12rpx;
|
padding: 0 12rpx;
|
||||||
gap: 20rpx 0;
|
gap: 20rpx 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.catgory-card {
|
.catgory-card {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 200rpx;
|
height: 200rpx;
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -215,9 +238,9 @@
|
|||||||
background-color: rgba(0, 0, 0, 0.15);
|
background-color: rgba(0, 0, 0, 0.15);
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -226,10 +249,10 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.load-text {
|
.load-text {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -94,6 +94,12 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
galleryConfig() {
|
galleryConfig() {
|
||||||
return this.$tm.vx.getters().getConfigs.pageConfig.galleryConfig;
|
return this.$tm.vx.getters().getConfigs.pageConfig.galleryConfig;
|
||||||
|
},
|
||||||
|
haloConfigs() {
|
||||||
|
return this.$tm.vx.getters().getConfigs;
|
||||||
|
},
|
||||||
|
mockJson() {
|
||||||
|
return this.$tm.vx.getters().getMockJson;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -114,6 +120,13 @@ export default {
|
|||||||
this.fnGetData(true);
|
this.fnGetData(true);
|
||||||
},
|
},
|
||||||
onReachBottom(e) {
|
onReachBottom(e) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '没有更多数据了'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (this.hasNext) {
|
if (this.hasNext) {
|
||||||
this.queryParams.page += 1;
|
this.queryParams.page += 1;
|
||||||
this.isLoadMore = true;
|
this.isLoadMore = true;
|
||||||
@ -135,6 +148,10 @@ export default {
|
|||||||
this.fnGetData(true);
|
this.fnGetData(true);
|
||||||
},
|
},
|
||||||
fnGetCategory() {
|
fnGetCategory() {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
this.fnGetData(true);
|
||||||
|
return
|
||||||
|
}
|
||||||
this.$httpApi.v2.getPhotoGroupList({
|
this.$httpApi.v2.getPhotoGroupList({
|
||||||
page: 1,
|
page: 1,
|
||||||
size: 0
|
size: 0
|
||||||
@ -151,7 +168,37 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fnGetData(isClearWallfull = false) {
|
fnGetData(isClearWaterfall = false) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
this.dataList = this.mockJson.gallery.list.map(item => {
|
||||||
|
return {
|
||||||
|
metadata: {
|
||||||
|
name: Date.now() * Math.random(),
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
url: this.$utils.checkImageUrl(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
this.loading = 'success';
|
||||||
|
|
||||||
|
if (this.galleryConfig.useWaterfall) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (isClearWaterfall) {
|
||||||
|
this.$refs.wafll.clear()
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
this.$refs.wafll.pushData(this.dataList)
|
||||||
|
}, 50)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.loadMoreText = '呜呜,没有更多数据啦~';
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 设置状态为加载中
|
// 设置状态为加载中
|
||||||
if (!this.isLoadMore) {
|
if (!this.isLoadMore) {
|
||||||
this.loading = 'loading';
|
this.loading = 'loading';
|
||||||
@ -174,7 +221,7 @@ export default {
|
|||||||
}
|
}
|
||||||
if (this.galleryConfig.useWaterfall) {
|
if (this.galleryConfig.useWaterfall) {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if(isClearWallfull){
|
if (isClearWaterfall) {
|
||||||
this.$refs.wafll.clear()
|
this.$refs.wafll.clear()
|
||||||
}
|
}
|
||||||
this.$refs.wafll.pushData(_list)
|
this.$refs.wafll.pushData(_list)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<view class="app-page">
|
<view class="app-page">
|
||||||
<tm-menubars iconColor="white" color="white" :flat="true" :showback="false">
|
<tm-menubars iconColor="white" color="white" :flat="true" :showback="false">
|
||||||
<view slot="left">
|
<view slot="left">
|
||||||
<image @click="fnOnLogoToPage" class="logo ml-24 round-24" :src="appInfo.logo" mode="scaleToFill" />
|
<image @click="fnOnLogoToPage" class="logo ml-24 round-24" :src="appInfo.logo" mode="scaleToFill"/>
|
||||||
</view>
|
</view>
|
||||||
<view class="search-input round-12 pt-12 pb-12 flex pl-24" @click="fnToSearch">
|
<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>
|
<text class="search-input_icon iconfont text-size-m icon-search text-grey"></text>
|
||||||
@ -21,15 +21,15 @@
|
|||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
</view>
|
</view>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<view v-if="!haloConfigs.basicConfig.auditModeEnabled" class="bg-white pb-24">
|
<view class="bg-white pb-24">
|
||||||
<view class="banner bg-white ml-24 mr-24 mt-12 round-3" v-if="bannerList.length != 0">
|
<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"
|
<e-swiper :dotPosition="globalAppSettings.banner.dotPosition" :autoplay="true"
|
||||||
:useDot="globalAppSettings.banner.useDot" :list="bannerList"
|
:useDot="globalAppSettings.banner.useDot" :list="bannerList"
|
||||||
@on-click="fnOnBannerClick"></e-swiper>
|
@on-click="fnOnBannerClick"></e-swiper>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 精品分类 -->
|
<!-- 精品分类 -->
|
||||||
<block v-if="haloConfigs.pageConfig.homeConfig.useCategory">
|
<block v-if="calcIsShowCategory">
|
||||||
<view class="flex flex-between mt-16 mb-24 pl-24 pr-24">
|
<view class="flex flex-between mt-16 mb-24 pl-24 pr-24">
|
||||||
<view class="page-item_title text-weight-b ">精品分类</view>
|
<view class="page-item_title text-weight-b ">精品分类</view>
|
||||||
<view class="show-more flex flex-center bg-white round-3" @click="fnToCategoryPage">
|
<view class="show-more flex flex-center bg-white round-3" @click="fnToCategoryPage">
|
||||||
@ -42,7 +42,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<scroll-view class="category" scroll-x="true">
|
<scroll-view class="category" scroll-x="true">
|
||||||
<view v-if="categoryList.length == 0" class="cate-empty round-3 mr-5 flex flex-center text-grey">
|
<view v-if="categoryList.length === 0" class="cate-empty round-3 mr-5 flex flex-center text-grey">
|
||||||
还没有任何分类~
|
还没有任何分类~
|
||||||
</view>
|
</view>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
@ -55,7 +55,7 @@
|
|||||||
</block>
|
</block>
|
||||||
|
|
||||||
<!-- 最新文章 -->
|
<!-- 最新文章 -->
|
||||||
<view v-if="!haloConfigs.basicConfig.auditModeEnabled" class="flex flex-between mt-24 mb-24 pl-24 pr-24">
|
<view class="flex flex-between mt-24 mb-24 pl-24 pr-24">
|
||||||
<view class="page-item_title text-weight-b">最新列表</view>
|
<view class="page-item_title text-weight-b">最新列表</view>
|
||||||
<view class="show-more flex flex-center bg-white round-3" @click="fnToArticlesPage">
|
<view class="show-more flex flex-center bg-white round-3" @click="fnToArticlesPage">
|
||||||
<text class="iconfont icon-angle-right text-size-s text-grey-darken-1"></text>
|
<text class="iconfont icon-angle-right text-size-s text-grey-darken-1"></text>
|
||||||
@ -65,7 +65,7 @@
|
|||||||
<text class="iconfont icon-angle-right text-size-s "></text>
|
<text class="iconfont icon-angle-right text-size-s "></text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="articleList.length == 0" class="article-empty">
|
<view v-if="articleList.length === 0" class="article-empty">
|
||||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有发表任何内容~"></tm-empty>
|
<tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有发表任何内容~"></tm-empty>
|
||||||
</view>
|
</view>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
@ -85,17 +85,17 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import tmMenubars from '@/tm-vuetify/components/tm-menubars/tm-menubars.vue';
|
import tmMenubars from '@/tm-vuetify/components/tm-menubars/tm-menubars.vue';
|
||||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||||
import tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
|
import tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
|
||||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.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';
|
||||||
import qs from 'qs'
|
import qs from 'qs'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
tmMenubars,
|
tmMenubars,
|
||||||
tmSkeleton,
|
tmSkeleton,
|
||||||
@ -136,12 +136,23 @@
|
|||||||
const appInfo = this.haloConfigs.appConfig.appInfo;
|
const appInfo = this.haloConfigs.appConfig.appInfo;
|
||||||
appInfo.logo = this.$utils.checkImageUrl(appInfo.logo)
|
appInfo.logo = this.$utils.checkImageUrl(appInfo.logo)
|
||||||
return appInfo;
|
return appInfo;
|
||||||
|
},
|
||||||
|
mockJson() {
|
||||||
|
return this.$tm.vx.getters().getMockJson;
|
||||||
|
},
|
||||||
|
calcIsShowCategory() {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled && this.categoryList.length !== 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return this.haloConfigs.pageConfig.homeConfig.useCategory
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.fnSetPageTitle();
|
this.fnSetPageTitle();
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.fnQuery();
|
this.fnQuery();
|
||||||
},
|
},
|
||||||
@ -151,6 +162,13 @@
|
|||||||
this.fnQuery();
|
this.fnQuery();
|
||||||
},
|
},
|
||||||
onReachBottom(e) {
|
onReachBottom(e) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '没有更多数据了'
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
if (this.result.hasNext) {
|
if (this.result.hasNext) {
|
||||||
this.queryParams.page += 1;
|
this.queryParams.page += 1;
|
||||||
this.isLoadMore = true;
|
this.isLoadMore = true;
|
||||||
@ -164,15 +182,32 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fnQuery() {
|
fnQuery() {
|
||||||
|
console.log('this.mockJson', this.mockJson)
|
||||||
this.fnGetBanner();
|
this.fnGetBanner();
|
||||||
this.fnGetArticleList();
|
this.fnGetArticleList();
|
||||||
this.fnGetCategoryList();
|
this.fnGetCategoryList();
|
||||||
},
|
},
|
||||||
|
|
||||||
fnGetCategoryList() {
|
fnGetCategoryList() {
|
||||||
if (!this.haloConfigs.pageConfig.homeConfig.useCategory) {
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
this.categoryList = this.mockJson.home.categoryList.map((item) => {
|
||||||
|
return {
|
||||||
|
metadata: {
|
||||||
|
name: Date.now() * Math.random(),
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
displayName: item.title,
|
||||||
|
cover: item.cover
|
||||||
|
},
|
||||||
|
postCount: 0
|
||||||
|
}
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.calcIsShowCategory) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.$httpApi.v2
|
this.$httpApi.v2
|
||||||
.getCategoryList({})
|
.getCategoryList({})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
@ -198,10 +233,23 @@
|
|||||||
// 获取轮播图
|
// 获取轮播图
|
||||||
fnGetBanner() {
|
fnGetBanner() {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
this.bannerList = this.mockJson.home.bannerList.map((item) => {
|
||||||
|
return {
|
||||||
|
mp4: '',
|
||||||
|
id: Date.now() * Math.random(),
|
||||||
|
nickname: this.haloConfigs.authorConfig.blogger.nickname,
|
||||||
|
avatar: this.$utils.checkAvatarUrl(this.haloConfigs.authorConfig.blogger.avatar),
|
||||||
|
address: '',
|
||||||
|
createTime: item.time,
|
||||||
|
title: item.title,
|
||||||
|
src: this.$utils.checkThumbnailUrl(item.cover),
|
||||||
|
image: this.$utils.checkThumbnailUrl(item.cover)
|
||||||
|
}
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const _this = this;
|
const _this = this;
|
||||||
const _format = function(list) {
|
const _format = function (list) {
|
||||||
return list.map((item, index) => {
|
return list.map((item, index) => {
|
||||||
return {
|
return {
|
||||||
mp4: '',
|
mp4: '',
|
||||||
@ -230,7 +278,8 @@
|
|||||||
success: (res) => {
|
success: (res) => {
|
||||||
this.bannerList = _format(res.data.items);
|
this.bannerList = _format(res.data.items);
|
||||||
},
|
},
|
||||||
fail: (err) => {}
|
fail: (err) => {
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -238,7 +287,10 @@
|
|||||||
this.bannerCurrent = e.current;
|
this.bannerCurrent = e.current;
|
||||||
},
|
},
|
||||||
fnOnBannerClick(item) {
|
fnOnBannerClick(item) {
|
||||||
if (item.id == '') return;
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (item.id === '') return;
|
||||||
this.fnToArticleDetail({
|
this.fnToArticleDetail({
|
||||||
metadata: {
|
metadata: {
|
||||||
name: item.id
|
name: item.id
|
||||||
@ -247,6 +299,32 @@
|
|||||||
},
|
},
|
||||||
// 文章列表
|
// 文章列表
|
||||||
fnGetArticleList() {
|
fnGetArticleList() {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
this.articleList = this.mockJson.home.postList.map((item) => {
|
||||||
|
return {
|
||||||
|
metadata: {
|
||||||
|
name: Date.now() * Math.random(),
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
pinned: false,
|
||||||
|
cover: item.cover,
|
||||||
|
title: item.title,
|
||||||
|
publishTime: item.time
|
||||||
|
},
|
||||||
|
status: {
|
||||||
|
excerpt: item.desc
|
||||||
|
},
|
||||||
|
stats: {
|
||||||
|
visit: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.loading = 'success';
|
||||||
|
this.loadMoreText = '呜呜,没有更多数据啦~';
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 设置状态为加载中
|
// 设置状态为加载中
|
||||||
if (!this.isLoadMore) {
|
if (!this.isLoadMore) {
|
||||||
this.loading = 'loading';
|
this.loading = 'loading';
|
||||||
@ -284,9 +362,11 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
//跳转文章详情
|
//跳转文章详情
|
||||||
fnToArticleDetail(article) {
|
fnToArticleDetail(article) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pagesA/article-detail/article-detail?name=' + article.metadata.name,
|
url: '/pagesA/article-detail/article-detail?name=' + article.metadata.name,
|
||||||
animationType: 'slide-in-right'
|
animationType: 'slide-in-right'
|
||||||
@ -322,6 +402,9 @@
|
|||||||
|
|
||||||
// 根据slug查询分类下的文章
|
// 根据slug查询分类下的文章
|
||||||
fnToCategoryBy(category) {
|
fnToCategoryBy(category) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pagesA/category-detail/category-detail?name=${category.metadata.name}&title=${category.spec.displayName}`
|
url: `/pagesA/category-detail/category-detail?name=${category.metadata.name}&title=${category.spec.displayName}`
|
||||||
});
|
});
|
||||||
@ -347,11 +430,11 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-page {
|
.app-page {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -369,36 +452,38 @@
|
|||||||
min-width: initial;
|
min-width: initial;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading-wrap {
|
.loading-wrap {
|
||||||
padding: 24rpx;
|
padding: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-input {
|
.search-input {
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
/* #ifdef MP-WEIXIN */
|
/* #ifdef MP-WEIXIN */
|
||||||
margin-right: 24rpx;
|
margin-right: 24rpx;
|
||||||
|
|
||||||
/* #endif */
|
/* #endif */
|
||||||
&_icon {}
|
&_icon {
|
||||||
|
|
||||||
&_text {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.show-more {
|
&_text {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.show-more {
|
||||||
width: 42rpx;
|
width: 42rpx;
|
||||||
height: 42rpx;
|
height: 42rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.03);
|
box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||||
}
|
}
|
||||||
|
|
||||||
.banner {
|
.banner {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.quick-nav {
|
.quick-nav {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
@ -406,9 +491,9 @@
|
|||||||
.name {
|
.name {
|
||||||
color: var(--main-text-color);
|
color: var(--main-text-color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.category {
|
.category {
|
||||||
width: 94vw;
|
width: 94vw;
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 200rpx;
|
height: 200rpx;
|
||||||
@ -427,9 +512,9 @@
|
|||||||
.cate-empty {
|
.cate-empty {
|
||||||
height: inherit;
|
height: inherit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-item {
|
.page-item {
|
||||||
&_title {
|
&_title {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-left: 24rpx;
|
padding-left: 24rpx;
|
||||||
@ -449,9 +534,9 @@
|
|||||||
z-index: 0;
|
z-index: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.h_row_col2 {
|
.h_row_col2 {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@ -460,5 +545,5 @@
|
|||||||
.ani-item {
|
.ani-item {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page">
|
<view class="app-page">
|
||||||
<view v-if="loading != 'success'" class="loading-wrap">
|
<view v-if="loading !== 'success'" class="loading-wrap">
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
</view>
|
</view>
|
||||||
<!-- 内容区域 -->
|
<!-- 内容区域 -->
|
||||||
<view v-else class="app-page-content">
|
<view v-else class="app-page-content">
|
||||||
<view v-if="dataList.length == 0" class="content-empty flex flex-center" style="min-height: 70vh;">
|
<view v-if="dataList.length === 0" class="content-empty flex flex-center" style="min-height: 70vh;">
|
||||||
<!-- 空布局 -->
|
<!-- 空布局 -->
|
||||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
|
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
|
||||||
</view>
|
</view>
|
||||||
@ -101,6 +101,12 @@ export default {
|
|||||||
let blogger = this.$tm.vx.getters().getConfigs.authorConfig.blogger;
|
let blogger = this.$tm.vx.getters().getConfigs.authorConfig.blogger;
|
||||||
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
|
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
|
||||||
return blogger;
|
return blogger;
|
||||||
|
},
|
||||||
|
haloConfigs() {
|
||||||
|
return this.$tm.vx.getters().getConfigs;
|
||||||
|
},
|
||||||
|
mockJson() {
|
||||||
|
return this.$tm.vx.getters().getMockJson;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -114,6 +120,13 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onReachBottom(e) {
|
onReachBottom(e) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '没有更多数据了'
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
if (this.hasNext) {
|
if (this.hasNext) {
|
||||||
this.queryParams.page += 1;
|
this.queryParams.page += 1;
|
||||||
this.isLoadMore = true;
|
this.isLoadMore = true;
|
||||||
@ -127,6 +140,37 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fnGetData() {
|
fnGetData() {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
this.dataList = this.mockJson.moments.list.map((item) => {
|
||||||
|
return {
|
||||||
|
metadata: {
|
||||||
|
name: Date.now() * Math.random(),
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
user: {
|
||||||
|
displayName: this.bloggerInfo.nickname,
|
||||||
|
avatar: this.$utils.checkAvatarUrl(this.bloggerInfo.avatar),
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
html: item.content
|
||||||
|
},
|
||||||
|
releaseTime: item.time
|
||||||
|
},
|
||||||
|
images: item.images.map((img) => {
|
||||||
|
return {
|
||||||
|
type: "PHOTO",
|
||||||
|
url: this.$utils.checkThumbnailUrl(img),
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
videos: []
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.loading = 'success';
|
||||||
|
this.loadMoreText = '呜呜,没有更多数据啦~';
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
return;
|
||||||
|
}
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
mask: true,
|
mask: true,
|
||||||
title: '加载中...'
|
title: '加载中...'
|
||||||
@ -139,9 +183,6 @@ export default {
|
|||||||
this.$httpApi.v2
|
this.$httpApi.v2
|
||||||
.getMomentList(this.queryParams)
|
.getMomentList(this.queryParams)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('请求结果:');
|
|
||||||
console.log(res);
|
|
||||||
|
|
||||||
this.loading = 'success';
|
this.loading = 'success';
|
||||||
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||||
this.hasNext = res.hasNext;
|
this.hasNext = res.hasNext;
|
||||||
|
@ -1,12 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page">
|
<view class="app-page">
|
||||||
<view class="auditModeEnabled" v-if="haloConfigs.basicConfig.auditModeEnabled">
|
|
||||||
<view>你好呀,很开心认识你!</view>
|
|
||||||
<view style="margin-top: 36rpx;">
|
|
||||||
{{haloConfigs.appConfig.appInfo.name}}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<block v-else>
|
|
||||||
<view class="e-fixed">
|
<view class="e-fixed">
|
||||||
<tm-tabs color="light-blue" v-model="tab.activeIndex" :list="tab.list" align="center"
|
<tm-tabs color="light-blue" v-model="tab.activeIndex" :list="tab.list" align="center"
|
||||||
@change="fnOnTabChange"></tm-tabs>
|
@change="fnOnTabChange"></tm-tabs>
|
||||||
@ -15,7 +9,7 @@
|
|||||||
<view style="width: 100vw;height: 90rpx;"></view>
|
<view style="width: 100vw;height: 90rpx;"></view>
|
||||||
|
|
||||||
<!-- 骨架屏:加载区域 -->
|
<!-- 骨架屏:加载区域 -->
|
||||||
<view v-if="loading != 'success'" class="loading-wrap">
|
<view v-if="loading !== 'success'" class="loading-wrap">
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
@ -23,8 +17,9 @@
|
|||||||
|
|
||||||
<!-- 加载完成区域 -->
|
<!-- 加载完成区域 -->
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<view v-if="dataList.length == 0" class="list-empty flex flex-center">
|
<view v-if="dataList.length === 0" class="list-empty flex flex-center">
|
||||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无归档的文章"></tm-empty>
|
<tm-empty v-if="haloConfigs.basicConfig.auditModeEnabled" icon="icon-shiliangzhinengduixiang-" label="暂无归档的内容"></tm-empty>
|
||||||
|
<tm-empty v-else icon="icon-shiliangzhinengduixiang-" label="暂无归档的文章"></tm-empty>
|
||||||
</view>
|
</view>
|
||||||
<view v-else class="e-timeline tm-timeline mt-24">
|
<view v-else class="e-timeline tm-timeline mt-24">
|
||||||
<block v-for="(item, index) in dataList" :key="index">
|
<block v-for="(item, index) in dataList" :key="index">
|
||||||
@ -41,12 +36,15 @@
|
|||||||
<view class="tm-timeline-item-left">
|
<view class="tm-timeline-item-left">
|
||||||
<view class="flex time text-weight-b mb-24">
|
<view class="flex time text-weight-b mb-24">
|
||||||
<text>{{ item.year }}年</text>
|
<text>{{ item.year }}年</text>
|
||||||
<text v-if="tab.activeIndex == 0">{{ item.month }}月</text>
|
<text v-if="tab.activeIndex === 0">{{ item.month }}月</text>
|
||||||
<view class="text-size-s text-grey-darken-1 ml-12">
|
<view v-if="haloConfigs.basicConfig.auditModeEnabled" class="text-size-s text-grey-darken-1 ml-12">
|
||||||
|
(共 {{ item.posts.length }} 篇内容)
|
||||||
|
</view>
|
||||||
|
<view v-else class="text-size-s text-grey-darken-1 ml-12">
|
||||||
(共 {{ item.posts.length }} 篇文章)
|
(共 {{ item.posts.length }} 篇文章)
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<block v-if="item.posts.length != 0">
|
<block v-if="item.posts.length !== 0">
|
||||||
<block v-for="(post, postIndex) in item.posts" :key="post.metadata.name">
|
<block v-for="(post, postIndex) in item.posts" :key="post.metadata.name">
|
||||||
<view class="flex post shadow-3 pa-24 mb-24"
|
<view class="flex post shadow-3 pa-24 mb-24"
|
||||||
:class="[globalAppSettings.layout.cardType]"
|
:class="[globalAppSettings.layout.cardType]"
|
||||||
@ -81,19 +79,18 @@
|
|||||||
<tm-flotbutton @click="fnToTopPage" size="m" color="bg-gradient-light-blue-accent"
|
<tm-flotbutton @click="fnToTopPage" size="m" color="bg-gradient-light-blue-accent"
|
||||||
icon="icon-angle-up"></tm-flotbutton>
|
icon="icon-angle-up"></tm-flotbutton>
|
||||||
</block>
|
</block>
|
||||||
</block>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||||
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
|
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
|
||||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||||
import qs from 'qs'
|
import qs from 'qs'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
tmSkeleton,
|
tmSkeleton,
|
||||||
tmTranslate,
|
tmTranslate,
|
||||||
@ -120,14 +117,17 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
black_tmeme: function() {
|
black_tmeme: function () {
|
||||||
return this.$tm.vx.state().tmVuetify.black;
|
return this.$tm.vx.state().tmVuetify.black;
|
||||||
},
|
},
|
||||||
color_tmeme: function() {
|
color_tmeme: function () {
|
||||||
return this.$tm.vx.state().tmVuetify.color;
|
return this.$tm.vx.state().tmVuetify.color;
|
||||||
},
|
},
|
||||||
haloConfigs() {
|
haloConfigs() {
|
||||||
return this.$tm.vx.getters().getConfigs;
|
return this.$tm.vx.getters().getConfigs;
|
||||||
|
},
|
||||||
|
mockJson() {
|
||||||
|
return this.$tm.vx.getters().getMockJson;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -139,6 +139,13 @@
|
|||||||
this.fnGetData();
|
this.fnGetData();
|
||||||
},
|
},
|
||||||
onReachBottom(e) {
|
onReachBottom(e) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '没有更多数据了'
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
if (this.result.hasNext) {
|
if (this.result.hasNext) {
|
||||||
this.queryParams.page += 1;
|
this.queryParams.page += 1;
|
||||||
this.isLoadMore = true;
|
this.isLoadMore = true;
|
||||||
@ -159,6 +166,40 @@
|
|||||||
},
|
},
|
||||||
fnGetData() {
|
fnGetData() {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
const dataList = this.mockJson.archives.list.map(item => {
|
||||||
|
const date = new Date(item.time)
|
||||||
|
const year = date.getFullYear()
|
||||||
|
const month = date.getMonth() + 1
|
||||||
|
return {
|
||||||
|
metadata: {
|
||||||
|
name: Date.now() * Math.random(),
|
||||||
|
labels: {
|
||||||
|
"content.halo.run/archive-year": year,
|
||||||
|
"content.halo.run/archive-month": month
|
||||||
|
}
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
pinned: false,
|
||||||
|
cover: item.cover,
|
||||||
|
title: item.title,
|
||||||
|
publishTime: item.time
|
||||||
|
},
|
||||||
|
status: {
|
||||||
|
excerpt: item.desc
|
||||||
|
},
|
||||||
|
stats: {
|
||||||
|
visit: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const posts = this.handleGetPosts(dataList)
|
||||||
|
this.dataList = []
|
||||||
|
this.cacheDataList = dataList;
|
||||||
|
this.dataList = this.handleGetShowDataList(posts)
|
||||||
|
this.loading = 'success';
|
||||||
|
this.loadMoreText = '呜呜,没有更多数据啦~';
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.isLoadMore) {
|
if (this.isLoadMore) {
|
||||||
@ -185,9 +226,8 @@
|
|||||||
const posts = this.handleGetPosts(data.items)
|
const posts = this.handleGetPosts(data.items)
|
||||||
const showDataList = this.handleGetShowDataList(posts)
|
const showDataList = this.handleGetShowDataList(posts)
|
||||||
if (this.isLoadMore) {
|
if (this.isLoadMore) {
|
||||||
this.cacheDataList = this.handleUniqueCacheDatalist([...this.cacheDataList, ...
|
this.cacheDataList = this.handleUniqueCacheDatalist([
|
||||||
data
|
...this.cacheDataList, ...data.items
|
||||||
.items
|
|
||||||
]);
|
]);
|
||||||
this.handleMergeDataList2(showDataList)
|
this.handleMergeDataList2(showDataList)
|
||||||
} else {
|
} else {
|
||||||
@ -218,7 +258,7 @@
|
|||||||
const postLabelMonthKey = "content.halo.run/archive-month"
|
const postLabelMonthKey = "content.halo.run/archive-month"
|
||||||
dataList.forEach(item => {
|
dataList.forEach(item => {
|
||||||
let postItemKey = ""
|
let postItemKey = ""
|
||||||
if (this.tab.activeIndex == 0) {
|
if (this.tab.activeIndex === 0) {
|
||||||
postItemKey =
|
postItemKey =
|
||||||
`${item.metadata.labels[postLabelYearKey]}-${item.metadata.labels[postLabelMonthKey]}`
|
`${item.metadata.labels[postLabelYearKey]}-${item.metadata.labels[postLabelMonthKey]}`
|
||||||
} else {
|
} else {
|
||||||
@ -313,49 +353,52 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
fnToArticleDetail(article) {
|
fnToArticleDetail(article) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pagesA/article-detail/article-detail?name=' + article.metadata.name,
|
url: '/pagesA/article-detail/article-detail?name=' + article.metadata.name,
|
||||||
animationType: 'slide-in-right'
|
animationType: 'slide-in-right'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-page {
|
.app-page {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
background-color: #fafafd;
|
background-color: #fafafd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.auditModeEnabled {
|
.auditModeEnabled {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 80vh;
|
height: 80vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading-wrap {
|
.loading-wrap {
|
||||||
padding: 24rpx;
|
padding: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-empty {
|
.list-empty {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.statistics {
|
.statistics {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.e-timeline {
|
.e-timeline {
|
||||||
::v-deep {
|
::v-deep {
|
||||||
.tm-timeline-item>view:first-child {
|
.tm-timeline-item > view:first-child {
|
||||||
width: 110rpx !important;
|
width: 110rpx !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,9 +407,9 @@
|
|||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tm-timeline {
|
.tm-timeline {
|
||||||
.tm-timeline-item {
|
.tm-timeline-item {
|
||||||
|
|
||||||
.tm-timeline-item-left,
|
.tm-timeline-item-left,
|
||||||
@ -420,14 +463,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.post {
|
.post {
|
||||||
width: 560rpx;
|
width: 560rpx;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
|
|
||||||
&.lr_image_text {}
|
&.lr_image_text {
|
||||||
|
}
|
||||||
|
|
||||||
&.lr_text_image {
|
&.lr_text_image {
|
||||||
.post-thumbnail {
|
.post-thumbnail {
|
||||||
@ -517,15 +561,15 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-thumbnail {
|
.post-thumbnail {
|
||||||
border-radius: 6rpx;
|
border-radius: 6rpx;
|
||||||
width: 200rpx;
|
width: 200rpx;
|
||||||
height: 170rpx;
|
height: 170rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-info {
|
.post-info {
|
||||||
width: 0;
|
width: 0;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
|
||||||
@ -545,9 +589,9 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.time {
|
.time {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -5,25 +5,34 @@
|
|||||||
* 时间:2024年06月22日 12:00:44
|
* 时间:2024年06月22日 12:00:44
|
||||||
* 版本:v0.1.0
|
* 版本:v0.1.0
|
||||||
*/
|
*/
|
||||||
import {DefaultAppConfigs, getAppConfigs, setAppConfigs} from '@/config/index.js'
|
import {DefaultAppConfigs, getAppConfigs, setAppConfigs,setAppMockJson,getAppMockJson} from '@/config/index.js'
|
||||||
import v2Config from '@/api/v2/all.config.js'
|
import v2Config from '@/api/v2/all.config.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: {
|
state: {
|
||||||
configs: getAppConfigs(),
|
configs: getAppConfigs(),
|
||||||
|
mockJson: getAppMockJson(),
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
getConfigs(state) {
|
getConfigs(state) {
|
||||||
if (state.configs) return state.configs;
|
if (state.configs) return state.configs;
|
||||||
return getAppConfigs()
|
return getAppConfigs()
|
||||||
},
|
},
|
||||||
|
getMockJson(state) {
|
||||||
|
if(state.mockJson) return state.mockJson;
|
||||||
|
return getAppMockJson()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
setConfigs(state, data) {
|
setConfigs(state, data) {
|
||||||
state.configs = data;
|
state.configs = data;
|
||||||
setAppConfigs(data)
|
setAppConfigs(data)
|
||||||
},
|
},
|
||||||
|
setMockJson(state, data) {
|
||||||
|
setAppMockJson(data)
|
||||||
|
state.mockJson = data;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
fetchConfigs({commit, dispatch}) {
|
fetchConfigs({commit, dispatch}) {
|
||||||
@ -47,5 +56,30 @@ export default {
|
|||||||
setDefaultAppSettings({commit}) {
|
setDefaultAppSettings({commit}) {
|
||||||
commit('setConfigs', JSON.parse(JSON.stringify(DefaultAppConfigs)))
|
commit('setConfigs', JSON.parse(JSON.stringify(DefaultAppConfigs)))
|
||||||
},
|
},
|
||||||
|
// 请求模拟数据
|
||||||
|
fetchMockJson({state, commit, dispatch}) {
|
||||||
|
return new Promise(async (resolve, reject) => {
|
||||||
|
// const mockJsonUrl = utils.checkUrl(state.configs.basicConfig.auditModeMock)
|
||||||
|
const mockJsonUrl = "https://uni-halo.925i.cn/unihalo.mock.json"
|
||||||
|
uni.request({
|
||||||
|
url: mockJsonUrl,
|
||||||
|
method: "GET",
|
||||||
|
success: (res) => {
|
||||||
|
console.log("mockJson", res.data)
|
||||||
|
commit('setMockJson', res.data)
|
||||||
|
resolve({
|
||||||
|
ok: true,
|
||||||
|
data: res.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
resolve({
|
||||||
|
ok: false,
|
||||||
|
data: err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user