1
0
mirror of https://github.com/ialley-workshop-open/uni-halo.git synced 2026-07-27 04:20:43 +08:00

16 Commits

Author SHA1 Message Date
小莫唐尼 7c15c84dba update: 调整获取模拟参数请求策略 2024-10-28 18:38:29 +08:00
小莫唐尼 e8edc03526 update: 修改我的页面文章归档的显示策略 2024-10-28 18:28:56 +08:00
小莫唐尼 2b717ad449 update: 修改模拟数据请求地址为动态配置 2024-10-28 18:25:40 +08:00
小莫唐尼 5efc877a89 feat: 添加模拟数据模板 2024-10-28 18:00:19 +08:00
小莫唐尼 75a133415a fix: 修复README内容链接丢失 2024-10-28 17:57:37 +08:00
小莫唐尼 bf41b08b35 update: 优化审核模式,新增审核使用模拟数据 2024-10-28 17:53:43 +08:00
小莫唐尼 74a5efb596 Merge branch 'main' of https://github.com/ialley-workshop-open/uni-halo 2024-10-22 18:26:29 +08:00
小莫唐尼 40dd4f4b7f update: 调整审核模式隐藏部分内容,修复分类显示控制不生效 2024-10-22 18:19:23 +08:00
小莫唐尼 341670adcf fix: 修复恋爱日记图标丢失问题 2024-10-22 18:06:34 +08:00
小莫唐尼 115aea2580 fix: 修复文章分享功能 2024-10-22 17:03:06 +08:00
小莫唐尼 58f1e7f131 fix: 修复文章分享功能 2024-10-22 16:30:30 +08:00
小莫唐尼 26ce84b950 fix: 修复瞬间视频不显示bug 2024-10-17 18:49:28 +08:00
小莫唐尼 32b3bbaa74 fix: 修复文章归档 2024-10-17 18:07:15 +08:00
小莫唐尼 76c00f31f6 update: 恋爱配置导航内图标支持后台配置 2024-10-17 17:29:15 +08:00
小莫唐尼 e28ea6ca08 fix: 修复文章归档功能 2024-10-17 17:19:39 +08:00
小莫唐尼 a98254e6cc fix: 修复编译到app时,启动页按钮样式丢失问题 2024-10-17 11:28:13 +08:00
14 changed files with 2681 additions and 1977 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
<p align="center"> <p align="center">
<a href="https://uni-halo.925i.cn" target="_blank" rel="noopener noreferrer"> <a href="https://uni-halo.925i.cn" target="_blank" rel="noopener noreferrer">
<img width="100" src="https://b.925i.cn/uni_halo/uni_halo_logo.png" alt="uni-halo logo" /> <img width="100" src="https://uni-halo.925i.cn/logo.png" alt="uni-halo logo" />
</a> </a>
</p> </p>
@@ -22,7 +22,7 @@
| 支付宝 | 微信 | QQ | | 支付宝 | 微信 | QQ |
|:----------------------------------------------:|:---------------------------------------------:|:---------------------------------------------:| |:----------------------------------------------:|:---------------------------------------------:|:---------------------------------------------:|
| ![支付宝赞赏](https://b.925i.cn/skm/zf_zfb_skm.png) | ![微信赞赏](https://b.925i.cn/skm/zf_wx_zsm.png) | ![QQ赞赏](https://b.925i.cn/skm/zf_qq_skm.png) | | ![支付宝赞赏](https://blog.925i.cn/upload/zf_zfb_skm.png) | ![微信赞赏](https://blog.925i.cn/upload/zf_wx_zsm.png) | ![QQ赞赏](https://blog.925i.cn/upload/zf_qq_skm.png) |
## 一、项目介绍 ## 一、项目介绍
+20
View File
@@ -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 = {
@@ -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))
}
+177
View File
@@ -0,0 +1,177 @@
{
"home": {
"bannerList": [
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
}
],
"categoryList": [
{
"title": "uni-halo",
"desc": "",
"cover": "/upload/uni_halo_ad_cover.png",
"time": ""
},
{
"title": "uni-halo",
"desc": "",
"cover": "/upload/uni_halo_ad_cover.png",
"time": ""
},
{
"title": "uni-halo",
"desc": "",
"cover": "/upload/uni_halo_ad_cover.png",
"time": ""
},
{
"title": "uni-halo",
"desc": "",
"cover": "/upload/uni_halo_ad_cover.png",
"time": ""
}
],
"postList": [
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
}
]
},
"category": {
"list": [
{
"title": "uni-halo",
"desc": "",
"cover": "/upload/uni_halo_ad_cover.png",
"time": ""
},
{
"title": "uni-halo",
"desc": "",
"cover": "/upload/uni_halo_ad_cover.png",
"time": ""
},
{
"title": "uni-halo",
"desc": "",
"cover": "/upload/uni_halo_ad_cover.png",
"time": ""
},
{
"title": "uni-halo",
"desc": "",
"cover": "/upload/uni_halo_ad_cover.png",
"time": ""
}
]
},
"moments": {
"list": [
{
"content": "你好啊,这是我的一条生活记录",
"time": "2024-05-25 08:59:00",
"images": [
"/upload/uni_halo_ad_cover.png",
"/upload/uni_halo_ad_cover.png",
"/upload/uni_halo_ad_cover.png"
]
}
]
},
"gallery": {
"list": [
"/upload/uni_halo_ad_cover.png",
"/upload/uni_halo_ad_cover.png",
"/upload/uni_halo_ad_cover.png",
"/upload/uni_halo_ad_cover.png"
]
},
"archives": {
"list": [
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
}
]
}
}
+7
View File
@@ -29,6 +29,13 @@ export default {
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
// uni.$tm.vx.commit('setWxShare', res.shareConfig); // uni.$tm.vx.commit('setWxShare', res.shareConfig);
// #endif // #endif
// 获取mockjson
if (res.basicConfig.auditModeEnabled) {
await uni.$tm.vx.actions('config/fetchMockJson')
}
// 进入检查
this.fnCheckShowStarted(); this.fnCheckShowStarted();
}).catch((err) => { }).catch((err) => {
uni.switchTab({ uni.switchTab({
+6 -26
View File
@@ -177,16 +177,17 @@ export default {
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
_isWx = true; _isWx = true;
// #endif // #endif
this.navList = [{ this.navList = [
{
key: 'archives', key: 'archives',
title: '文章归档', title: this.haloConfigs.basicConfig.auditModeEnabled ? '内容归档' : '文章归档',
leftIcon: 'halocoloricon-classify', leftIcon: 'halocoloricon-classify',
leftIconColor: 'red', leftIconColor: 'red',
rightText: '已归档的文章', rightText: this.haloConfigs.basicConfig.auditModeEnabled ? '已归档的内容' : '已归档的文章',
path: '/pagesA/archives/archives', path: '/pagesA/archives/archives',
isAdmin: false, isAdmin: false,
type: 'page', type: 'page',
show: false show: true
}, { }, {
key: 'love', key: 'love',
title: '恋爱日记', title: '恋爱日记',
@@ -287,28 +288,7 @@ export default {
// type: 'poup', // type: 'poup',
// show: true // show: true
// }, // },
// {
// key: 'setting',
// title: '应用设置',
// leftIcon: 'icon-cog',
// leftIconColor: 'indigo',
// rightText: `进入系统常用设置`,
// path: '/pagesA/setting/setting',
// isAdmin: false,
// type: 'page',
// show: false
// },
// {
// key: 'admin',
// title: '后台管理',
// leftIcon: 'icon-lock',
// leftIconColor: 'gray',
// rightText: '博客后台系统入口',
// path: '/pagesB/admin/admin',
// isAdmin: true,
// type: 'page',
// show: false
// }
]; ];
}, },
fnGetData() { fnGetData() {
+49 -5
View File
@@ -1,13 +1,14 @@
<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="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>
@@ -18,16 +19,21 @@
<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>
</tm-translate> </tm-translate>
<tm-flotbutton @click="fnToTopPage" size="m" color="light-blue" icon="icon-angle-up"></tm-flotbutton> <tm-flotbutton @click="fnToTopPage" size="m" color="light-blue"
icon="icon-angle-up"></tm-flotbutton>
<view class="load-text">{{ loadMoreText }}</view> <view class="load-text">{{ loadMoreText }}</view>
</block> </block>
</view> </view>
</view> </view>
</template> </template>
@@ -66,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();
@@ -77,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;
@@ -91,6 +107,22 @@
methods: { methods: {
fnGetData() { fnGetData() {
if (this.haloConfigs.basicConfig.auditModeEnabled) { if (this.haloConfigs.basicConfig.auditModeEnabled) {
this.dataList = this.mockJson.category.list.map((item) => {
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({
@@ -143,6 +175,9 @@
}) })
}, },
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}`
}) })
@@ -159,6 +194,15 @@
padding: 24rpx 0; padding: 24rpx 0;
} }
.auditModeEnabled {
width: 100%;
height: 80vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.loading-wrap { .loading-wrap {
padding: 24rpx; padding: 24rpx;
} }
+49 -2
View File
@@ -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)
+92 -10
View File
@@ -9,7 +9,7 @@
<view class="search-input_text pl-12 text-size-m text-grey">搜索内容...</view> <view class="search-input_text pl-12 text-size-m text-grey">搜索内容...</view>
</view> </view>
<!-- #ifdef APP-PLUS || H5 --> <!-- #ifdef APP-PLUS || H5 -->
<view slot="right" class="mr-24 text-size-m text-grey">{{ appInfo.name }}</view> <view slot="right" class="mr-24 text-size-m text-grey text-overflow">{{ appInfo.name }}</view>
<!-- #endif --> <!-- #endif -->
</tm-menubars> </tm-menubars>
<view v-if="loading !== 'success' && articleList.length===0" class="loading-wrap"> <view v-if="loading !== 'success' && articleList.length===0" class="loading-wrap">
@@ -22,24 +22,27 @@
</view> </view>
<block v-else> <block v-else>
<view 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="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">
<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>
</view> </view>
<view v-if="false" class="flex flex-center text-size-s text-grey-darken-1" @click="fnToCategoryPage"> <view v-if="false" class="flex flex-center text-size-s text-grey-darken-1"
@click="fnToCategoryPage">
<text class=" text-size-m">查看更多</text> <text class=" text-size-m">查看更多</text>
<text class="iconfont icon-angle-right text-size-s "></text> <text class="iconfont icon-angle-right text-size-s "></text>
</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>
@@ -49,6 +52,7 @@
</view> </view>
</block> </block>
</scroll-view> </scroll-view>
</block>
<!-- 最新文章 --> <!-- 最新文章 -->
<view 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">
@@ -61,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>
@@ -132,12 +136,23 @@ export default {
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();
}, },
@@ -146,8 +161,14 @@ export default {
this.queryParams.page = 1; this.queryParams.page = 1;
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;
@@ -161,15 +182,32 @@ export default {
}, },
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.basicConfig.auditModeEnabled) { 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 => {
@@ -195,6 +233,19 @@ export default {
// 获取轮播图 // 获取轮播图
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;
@@ -236,7 +287,10 @@ export default {
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
@@ -246,6 +300,29 @@ export default {
// 文章列表 // 文章列表
fnGetArticleList() { fnGetArticleList() {
if (this.haloConfigs.basicConfig.auditModeEnabled) { 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; return;
} }
// 设置状态为加载中 // 设置状态为加载中
@@ -285,9 +362,11 @@ export default {
} }
}) })
}, },
//跳转文章详情 //跳转文章详情
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'
@@ -323,6 +402,9 @@ export default {
// 根据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}`
}); });
+65 -12
View File
@@ -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>
@@ -37,13 +37,21 @@
:content="moment.spec.content.html" :markdown="true" :showLineNumber="true" :content="moment.spec.content.html" :markdown="true" :showLineNumber="true"
:showLanguageName="true" :copyByLongPress="true"/> :showLanguageName="true" :copyByLongPress="true"/>
</view> </view>
<view v-if="moment.spec.content.medium.length!==0" class="images" <view class="mb-12 mt--12" v-if="moment.videos.length!==0"
:class="['images-'+moment.spec.content.medium.length]"> style="display: flex; flex-direction: column; gap: 12rpx 0;padding: 0 24rpx; ">
<view class="image-item" v-for="(image,mediumIndex) in moment.spec.content.medium" <video
style="width:100%;height: 400rpx;border-radius: 12rpx;"
v-for="(video,index) in moment.videos"
:key="index" :src="video.url"></video>
</view>
<view v-if="moment.images.length!==0" class="images"
:class="['images-'+moment.images.length]">
<view class="image-item"
v-for="(image,mediumIndex) in moment.images"
:key="mediumIndex"> :key="mediumIndex">
<image mode="aspectFill" style="width: 100%;height: 100%;border-radius: 6rpx;" <image mode="aspectFill" style="width: 100%;height: 100%;border-radius: 6rpx;"
:src="image.url" :src="image.url"
@click="handlePreview(mediumIndex,moment.spec.content.medium)"/> @click="handlePreview(mediumIndex,moment.images)"/>
</view> </view>
</view> </view>
</view> </view>
@@ -93,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;
} }
}, },
@@ -106,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;
@@ -119,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: '加载中...'
@@ -131,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;
@@ -143,11 +192,15 @@ export default {
displayName: this.bloggerInfo.nickname, displayName: this.bloggerInfo.nickname,
avatar: this.$utils.checkAvatarUrl(this.bloggerInfo.avatar) avatar: this.$utils.checkAvatarUrl(this.bloggerInfo.avatar)
} }
item.spec.content.medium item.spec.content.medium.map(medium => {
.filter(x => x.type === 'PHOTO')
.map(medium => {
medium.url = this.$utils.checkThumbnailUrl(medium.url, true) medium.url = this.$utils.checkThumbnailUrl(medium.url, true)
}) })
item['images'] = item.spec.content.medium
.filter(x => x.type === 'PHOTO')
item['videos'] = item.spec.content.medium
.filter(x => x.type === 'VIDEO')
return item; return item;
}) })
+269 -51
View File
@@ -1,13 +1,15 @@
<template> <template>
<view class="app-page"> <view class="app-page">
<view class="e-fixed"> <view class="e-fixed">
<tm-tabs color="light-blue" v-model="tab.activeIndex" :list="tab.list" align="center" @change="fnOnTabChange"></tm-tabs> <tm-tabs color="light-blue" v-model="tab.activeIndex" :list="tab.list" align="center"
@change="fnOnTabChange"></tm-tabs>
</view> </view>
<!-- 占位区域 --> <!-- 占位区域 -->
<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>
@@ -15,46 +17,55 @@
<!-- 加载完成区域 --> <!-- 加载完成区域 -->
<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">
<view class="tm-timeline-item tm-timeline-item--leftDir"> <view class="tm-timeline-item tm-timeline-item--leftDir">
<view style="width: 160rpx;"> <view style="width: 160rpx;">
<view :style="{ width: '24rpx', height: '24rpx' }" :class="[black_tmeme ? 'bk' : '']" <view :style="{ width: '24rpx', height: '24rpx' }" :class="[black_tmeme ? 'bk' : '']"
class="flex-center rounded tm-timeline-jidian border-white-a-2 grey-lighten-2 light-blue shadow-primary-4"></view> class="flex-center rounded tm-timeline-jidian border-white-a-2 grey-lighten-2 light-blue shadow-primary-4">
</view>
<view :style="{ marginTop: '-24rpx' }" <view :style="{ marginTop: '-24rpx' }"
:class="[index !== dataList.length - 1 ? 'tm-timeline-item-boder' : '', black_tmeme ? 'bk' : '']" :class="[index !== dataList.length - 1 ? 'tm-timeline-item-boder' : '', black_tmeme ? 'bk' : '']"
class="grey-lighten-2"></view> class="grey-lighten-2"></view>
</view> </view>
<view class="tm-timeline-item-content relative"> <view class="tm-timeline-item-content relative">
<view class="tm-timeline-item-left"> <view class="tm-timeline-item-left">
<view class="time text-weight-b mb-24"> <view class="flex time text-weight-b mb-24">
{{ item.year }} <text>{{ item.year }}</text>
<block v-if="tab.activeIndex == 0">{{ item.month }}</block> <text v-if="tab.activeIndex === 0">{{ item.month }}</text>
<text class="text-size-s text-grey-darken-1 ml-24">共发布 {{ item.posts.length }} 篇文章</text> <view v-if="haloConfigs.basicConfig.auditModeEnabled" class="text-size-s text-grey-darken-1 ml-12">
{{ item.posts.length }} 篇内容
</view> </view>
<block v-if="item.posts.length != 0"> <view v-else class="text-size-s text-grey-darken-1 ml-12">
<block v-for="(post, postIndex) in item.posts" :key="post.id"> {{ item.posts.length }} 篇文章
<tm-translate animation-name="fadeUp" :wait="calcAniWait(postIndex)"> </view>
<view class="flex post shadow-3 pa-24 mb-24" :class="[globalAppSettings.layout.cardType]" </view>
<block v-if="item.posts.length !== 0">
<block v-for="(post, postIndex) in item.posts" :key="post.metadata.name">
<view class="flex post shadow-3 pa-24 mb-24"
:class="[globalAppSettings.layout.cardType]"
@click="fnToArticleDetail(post)"> @click="fnToArticleDetail(post)">
<image class="post-thumbnail" :src="$utils.checkThumbnailUrl(post.thumbnail)" <image class="post-thumbnail"
mode="aspectFill"></image> :src="$utils.checkThumbnailUrl(post.spec.cover)" mode="aspectFill">
</image>
<view class="post-info pl-20"> <view class="post-info pl-20">
<view class="post-info_title text-overflow">{{ post.title }}</view> <view class="post-info_title text-overflow">{{ post.spec.title }}
<view class="post-info_summary text-overflow-2 mt-12 text-size-s text-grey-darken-1"> </view>
{{ post.summary }} <view
class="post-info_summary text-overflow-2 mt-12 text-size-s text-grey-darken-1">
{{ post.status.excerpt }}
</view> </view>
<view class="post-info_time mt-12 text-size-s text-grey-darken-1"> <view class="post-info_time mt-12 text-size-s text-grey-darken-1">
<text class="iconfont icon-clock text-size-s mr-6"></text> <text class="iconfont icon-clock text-size-s mr-6"></text>
<text class="time-label">发布时间</text> <text class="time-label">发布时间</text>
{{ {d: post.createTime, f: 'yyyy年MM月dd日 星期w'} | formatTime }} {{ {d: post.spec.publishTime, f: 'yyyy年MM月dd日 星期w'} | formatTime }}
</view> </view>
</view> </view>
</view> </view>
</tm-translate>
</block> </block>
</block> </block>
<view v-else class="post-empty text-size-m text-grey-darken-1">该日期下暂无归档文章</view> <view v-else class="post-empty text-size-m text-grey-darken-1">该日期下暂无归档文章</view>
@@ -63,8 +74,10 @@
</view> </view>
</block> </block>
</view> </view>
<view class="load-text mt-12">{{ loadMoreText }}</view>
<!-- 返回顶部 --> <!-- 返回顶部 -->
<tm-flotbutton @click="fnToTopPage" size="m" color="bg-gradient-light-blue-accent" icon="icon-angle-up"></tm-flotbutton> <tm-flotbutton @click="fnToTopPage" size="m" color="bg-gradient-light-blue-accent"
icon="icon-angle-up"></tm-flotbutton>
</block> </block>
</view> </view>
</template> </template>
@@ -75,6 +88,7 @@ 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'
export default { export default {
components: { components: {
@@ -93,11 +107,13 @@ export default {
}, },
queryParams: { queryParams: {
size: 10, size: 10,
page: 0 page: 1
}, },
result: null, result: {},
dataList: [], cacheDataList: [], // 所有请求的缓存数据
api: 'getMonthArchives' dataList: [], // 显示的数据
isLoadMore: false,
loadMoreText: "加载中..."
}; };
}, },
computed: { computed: {
@@ -106,53 +122,242 @@ export default {
}, },
color_tmeme: function () { color_tmeme: function () {
return this.$tm.vx.state().tmVuetify.color; return this.$tm.vx.state().tmVuetify.color;
},
haloConfigs() {
return this.$tm.vx.getters().getConfigs;
},
mockJson() {
return this.$tm.vx.getters().getMockJson;
} }
}, },
created() { created() {
this.fnGetData(); this.fnGetData();
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.isLoadMore = false;
this.queryParams.page = 1;
this.fnGetData(); this.fnGetData();
this.queryParams.page = 0;
}, },
onReachBottom(e) {
if (this.haloConfigs.basicConfig.auditModeEnabled) {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
return
}
if (this.result.hasNext) {
this.queryParams.page += 1;
this.isLoadMore = true;
this.fnGetData();
} else {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
},
methods: { methods: {
fnOnTabChange(index) { fnOnTabChange(index) {
this.fnResetSetAniWaitIndex(); this.fnResetSetAniWaitIndex();
const _api = ['getMonthArchives', 'getYearArchives'];
this.api = _api[index];
this.queryParams.page = 0; this.queryParams.page = 0;
this.fnGetData(); this.dataList = this.handleGetShowDataList(this.handleGetPosts(this.cacheDataList))
this.fnToTopPage();
}, },
fnGetData() { fnGetData() {
this.loading = 'loading'; if (this.haloConfigs.basicConfig.auditModeEnabled) {
// uni.showLoading({ const dataList = this.mockJson.archives.list.map(item => {
// mask: true, const date = new Date(item.time)
// title: '加载中...' const year = date.getFullYear()
// }); const month = date.getMonth() + 1
this.$httpApi[this.api](this.queryParams) return {
.then(res => { metadata: {
this.result = res.data; name: Date.now() * Math.random(),
this.dataList = res.data; labels: {
setTimeout(() => { "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.loading = 'success';
}, 500); this.loadMoreText = '呜呜,没有更多数据啦~';
})
.catch(err => {
console.error(err);
this.loading = 'error';
})
.finally(() => {
setTimeout(() => {
uni.hideLoading(); uni.hideLoading();
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
}, 500); return;
}
if (this.isLoadMore) {
uni.showLoading({
title: "加载中..."
})
} else {
this.loading = 'loading';
}
this.loadMoreText = "加载中...";
const paramsStr = qs.stringify(this.queryParams, {
allowDots: true,
encodeValuesOnly: true,
skipNulls: true,
encode: true,
arrayFormat: 'repeat'
})
uni.request({
url: this.$baseApiUrl + '/apis/api.content.halo.run/v1alpha1/posts?' + paramsStr,
method: 'GET',
success: (res) => {
const data = res.data;
this.result = data;
const posts = this.handleGetPosts(data.items)
const showDataList = this.handleGetShowDataList(posts)
if (this.isLoadMore) {
this.cacheDataList = this.handleUniqueCacheDatalist([
...this.cacheDataList, ...data.items
]);
this.handleMergeDataList2(showDataList)
} else {
this.dataList = []
this.cacheDataList = data.items;
this.dataList = showDataList
}
this.loading = 'success';
this.loadMoreText = data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
uni.hideLoading();
uni.stopPullDownRefresh();
},
fail: (err) => {
this.loading = 'error';
this.loadMoreText = '加载失败,请下拉刷新!';
uni.$tm.toast(err.message || '数据加载失败!');
uni.hideLoading();
uni.stopPullDownRefresh();
}
})
},
// 处理数据分类
handleGetPosts(dataList) {
const posts = {}
const postLabelYearKey = "content.halo.run/archive-year"
const postLabelMonthKey = "content.halo.run/archive-month"
dataList.forEach(item => {
let postItemKey = ""
if (this.tab.activeIndex === 0) {
postItemKey =
`${item.metadata.labels[postLabelYearKey]}-${item.metadata.labels[postLabelMonthKey]}`
} else {
postItemKey = `${item.metadata.labels[postLabelYearKey]}`
}
if (posts[postItemKey]) {
posts[postItemKey].push(item)
} else {
posts[postItemKey] = [item]
}
})
return posts;
},
// 根据分类的数据,处理成显示的数据
handleGetShowDataList(posts) {
const dataListResult = []
Object.keys(posts).forEach((key) => {
const postData = {
sort: 0,
key: key,
year: key,
month: "",
posts: posts[key]
}
if (this.tab.activeIndex == 0) {
const splitDate = key.split("-")
postData.year = splitDate[0]
postData.month = splitDate[1]
postData.sort = Number(key.replace("-", ""))
} else {
postData.sort = Number(key)
}
dataListResult.push(postData)
})
dataListResult.sort((a, b) => {
return Number(b.sort) - Number(a.sort)
})
return dataListResult;
},
handleMergeDataList(list1, list2) {
// 将list1转换为以key为键的对象
let merged = list1.reduce((acc, item) => {
acc[item.key] = {
...item
};
return acc;
}, {});
// 遍历list2,合并posts数组或添加新对象
list2.forEach(item => {
if (merged[item.key]) {
// 如果key已存在,合并posts数组
merged[item.key].posts = [...merged[item.key].posts, ...item.posts];
} else {
// 如果key不存在,添加新对象
merged[item.key] = {
...item
};
}
});
// 将对象转换回数组
return Object.values(merged);
},
handleMergeDataList2(list) {
list.forEach((item, index) => {
const find = this.dataList.find(x => x.key == item.key)
if (find) {
item.posts.forEach(post => {
if (!find.posts.find(x => x.metadata.name == post.metadata.name)) {
find.posts.push(post)
}
})
}
})
list.forEach(post => {
if (!this.dataList.find(x => x.key === post.key)) {
this.dataList.push(post)
}
})
this.dataList.sort((a, b) => {
return Number(b.sort) - Number(a.sort)
})
},
handleUniqueCacheDatalist(dataList) {
const seen = new Set();
return dataList.filter(item => {
return seen.has(item.metadata.name) ? false : seen.add(item.metadata.name);
}); });
}, },
//跳转文章详情
fnToArticleDetail(article) { fnToArticleDetail(article) {
if (this.haloConfigs.basicConfig.auditModeEnabled) {
return;
}
uni.navigateTo({ uni.navigateTo({
url: '/pagesA/article-detail/article-detail?articleId=' + article.id, url: '/pagesA/article-detail/article-detail?name=' + article.metadata.name,
animationType: 'slide-in-right' animationType: 'slide-in-right'
}); });
} }
@@ -169,6 +374,15 @@ export default {
background-color: #fafafd; background-color: #fafafd;
} }
.auditModeEnabled {
width: 100%;
height: 80vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.loading-wrap { .loading-wrap {
padding: 24rpx; padding: 24rpx;
} }
@@ -376,4 +590,8 @@ export default {
} }
} }
} }
.time {
align-items: center;
}
</style> </style>
+22 -3
View File
@@ -232,7 +232,9 @@ import commentModal from '@/components/comment-modal/comment-modal.vue';
import rCanvas from '@/components/r-canvas/r-canvas.vue'; import rCanvas from '@/components/r-canvas/r-canvas.vue';
import barrage from '@/components/barrage/barrage.vue'; import barrage from '@/components/barrage/barrage.vue';
import {getAppConfigs} from '@/config/index.js' import {
getAppConfigs
} from '@/config/index.js'
export default { export default {
components: { components: {
@@ -344,6 +346,24 @@ export default {
onPullDownRefresh() { onPullDownRefresh() {
this.fnGetData(); this.fnGetData();
}, },
onShareAppMessage() {
const cover = this.result.spec.cover ? this.calcUrl(this.result.spec.cover) : ""
return {
path: '/pagesA/article-detail/article-detail?name=' + this.result.metadata.name,
title: this.result.spec.title,
imageUrl: cover
}
},
onShareTimeline() {
const cover = this.result.spec.cover ? this.calcUrl(this.result.spec.cover) : ""
return {
title: this.result.spec.title,
query: {
name: this.result.metadata.name
},
imageUrl: cover
}
},
methods: { methods: {
fnGetData() { fnGetData() {
this.loading = 'loading'; this.loading = 'loading';
@@ -997,8 +1017,7 @@ export default {
font-size: 24rpx; font-size: 24rpx;
color: #666; color: #666;
&-name { &-name {}
}
&-time { &-time {
margin-left: 36rpx; margin-left: 36rpx;
+5 -5
View File
@@ -7,7 +7,7 @@
<image class="avatar" :src="$utils.checkAvatarUrl(loveConfig.loveInfo.boyAvatar)" mode="aspectFit"></image> <image class="avatar" :src="$utils.checkAvatarUrl(loveConfig.loveInfo.boyAvatar)" mode="aspectFit"></image>
<view class="name">{{ loveConfig.loveInfo.boyNickname }}</view> <view class="name">{{ loveConfig.loveInfo.boyNickname }}</view>
</view> </view>
<image class="like" :src="$utils.checkImageUrl(loveConfig.loveImageUrl)" mode="scaleToFill"></image> <image class="like" :src="$utils.checkImageUrl(loveConfig.pageImages.heartImageUrl)" mode="scaleToFill"></image>
<view class="girl"> <view class="girl">
<image class="avatar" :src="$utils.checkAvatarUrl(loveConfig.loveInfo.girlAvatar)" mode="aspectFit"></image> <image class="avatar" :src="$utils.checkAvatarUrl(loveConfig.loveInfo.girlAvatar)" mode="aspectFit"></image>
<view class="name">{{ loveConfig.loveInfo.girlNickname }}</view> <view class="name">{{ loveConfig.loveInfo.girlNickname }}</view>
@@ -43,7 +43,7 @@
<block v-for="(nav, index) in navList" :key="index"> <block v-for="(nav, index) in navList" :key="index">
<view v-if="nav.use" class="list-item" @click="fnToPage(nav.key)"> <view v-if="nav.use" class="list-item" @click="fnToPage(nav.key)">
<view class="left"> <view class="left">
<image class="icon" :src="nav.iconImageUrl" mode="aspectFit"></image> <image class="icon" :src="$utils.checkImageUrl(nav.iconImageUrl)" mode="aspectFit"></image>
</view> </view>
<view class="right"> <view class="right">
<view class="name">{{ nav.title }}</view> <view class="name">{{ nav.title }}</view>
@@ -100,21 +100,21 @@ export default {
{ {
key: 'journey', key: 'journey',
use: configs.ourStory.enabled, use: configs.ourStory.enabled,
iconImageUrl: 'https://b.925i.cn/uni_halo_love/diandian.png', iconImageUrl: configs.ourStory.iconUrl,
title: '关于我们', title: '关于我们',
desc: '我们一起度过的那些经历' desc: '我们一起度过的那些经历'
}, },
{ {
key: 'album', key: 'album',
use: configs.lovePhoto.enabled, use: configs.lovePhoto.enabled,
iconImageUrl: 'https://b.925i.cn/uni_halo_love/diandian.png', iconImageUrl: configs.lovePhoto.iconUrl,
title: '恋爱相册', title: '恋爱相册',
desc: '定格了我们的那些小美好' desc: '定格了我们的那些小美好'
}, },
{ {
key: 'list', key: 'list',
use: configs.loveDaily.enabled, use: configs.loveDaily.enabled,
iconImageUrl: 'https://b.925i.cn/uni_halo_love/diandian.png', iconImageUrl: configs.loveDaily.iconUrl,
title: '恋爱清单', title: '恋爱清单',
desc: '你我之间的约定我们都在努力实现' desc: '你我之间的约定我们都在努力实现'
}, },
+32 -9
View File
@@ -40,8 +40,8 @@
</view> </view>
</view> </view>
<video v-else class="video-bg" :object-fit="startConfig.bgVideoFit" :src="startConfig.bgVideo" :loop="true" :autoplay="true" <video v-else class="video-bg" :object-fit="startConfig.bgVideoFit" :src="startConfig.bgVideo" :loop="true"
:muted="true" :controls="false" :show-fullscreen-btn="false" :show-play-btn="false" :autoplay="true" :muted="true" :controls="false" :show-fullscreen-btn="false" :show-play-btn="false"
:show-center-play-btn="false" :show-loading="false" :enable-progress-gesture="false" :show-center-play-btn="false" :show-loading="false" :enable-progress-gesture="false"
:show-progress="false"></video> :show-progress="false"></video>
@@ -59,19 +59,26 @@
</cover-view> </cover-view>
</cover-view> </cover-view>
<cover-view v-if="startConfig.desc1 || startConfig.desc2" class="bottom-container"> <cover-view class="bottom-container">
<cover-view class="text-align-center" :style="startConfig.descStyle" <cover-view class="text-align-center" :style="startConfig.descStyle"
style="color:white;padding: 60vh 0 0 0;"> style="color:white;padding: 60vh 0 0 0;">
<cover-view class="" style="font-size: 44rpx;" v-if="startConfig.desc1">{{ startConfig.desc1 }} <cover-view style="font-size: 44rpx;" v-show="startConfig.desc1">
{{ startConfig.desc1 }}
</cover-view> </cover-view>
<cover-view class="mt-30 text-size-m" v-if="startConfig.desc2">{{ startConfig.desc2 }}</cover-view> <cover-view class="mt-30 text-size-m" v-show="startConfig.desc2">
{{ startConfig.desc2 }}
</cover-view> </cover-view>
</cover-view>
<cover-view class="" style="padding: 120rpx 200rpx;z-index: 999;position: relative;"> <!-- #ifdef APP-PLUS -->
<cover-view class="start-btn-app" :style="[startConfig.btnStyle]" @click="fnStart()">
{{ startConfig.btnText || '开始体验' }}
</cover-view>
<!-- #endif -->
<!-- #ifndef APP-PLUS -->
<cover-view class="start-btn" :class="[startConfig.btnClass]" @click="fnStart()" <cover-view class="start-btn" :class="[startConfig.btnClass]" @click="fnStart()"
:style="startConfig.btnStyle">{{ startConfig.btnText || '开始体验' }} :style="[startConfig.btnStyle]">{{ startConfig.btnText || '开始体验' }}
</cover-view>
</cover-view> </cover-view>
<!-- #endif -->
</cover-view> </cover-view>
<!-- 波浪效果 --> <!-- 波浪效果 -->
<wave v-if="startConfig.useWave"></wave> <wave v-if="startConfig.useWave"></wave>
@@ -147,9 +154,25 @@ export default {
color: #ffffff; color: #ffffff;
text-align: center; text-align: center;
font-size: 28rpx; font-size: 28rpx;
margin-top: 60rpx;
margin-bottom: 120rpx;
}
.start-btn-app {
border-radius: 50rpx;
color: #ffffff;
text-align: center;
font-size: 28rpx;
margin: 60rpx auto 120rpx auto;
width: 40vw;
height: 60rpx;
line-height: 60rpx;
border: 2rpx solid #ffffff;
} }
.bottom-container { .bottom-container {
display: flex;
flex-direction: column;
position: absolute; position: absolute;
bottom: 50rpx; bottom: 50rpx;
left: 50%; left: 50%;
+35 -1
View File
@@ -5,25 +5,35 @@
* 时间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'
import utils from '@/utils/index.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 +57,29 @@ 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.auditModeMockUrl)
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
})
}
})
})
},
} }
}; };