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

46 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
小莫唐尼 82062d9465 fix: 修复首页轮播图不显示问题 2024-08-27 20:41:37 +08:00
小莫唐尼 706cee2240 fix: 修复图库瀑布流模式无数据下,切换其他分类有数据不显示数据bug 2024-08-18 20:41:03 +08:00
liuyiwuqing da60eb2daf 1. 新增小程序审核模式 2024-08-05 19:23:16 +08:00
liuyiwuqing a764c3dbfe Merge remote-tracking branch 'origin/v2.0-beta' into v2.0-beta 2024-08-05 19:17:50 +08:00
小莫唐尼 88fb74a795 fix: 修复Halo最新版本搜索接口字段不存在问题 2024-08-05 19:04:55 +08:00
liuyiwuqing 52d4b7927b 1. 优化密码访问,实现联动插件动态启用关闭;
2. 文章海报分享支持动态小程序码;
3. 支持扫描文章海报跳转指定文章详情;
2024-08-02 15:28:50 +08:00
小莫唐尼 ff31e0d8e8 feat: 首页左上角图标支持跳转到关于页面 2024-07-16 11:20:14 +08:00
小莫唐尼 a65ea2617b update: 调整部分显示的内容,如文章相关文字进行替换 2024-07-16 11:13:52 +08:00
小莫唐尼 bb228c6705 fix: 修复首页分页失败问题,重新添加node依赖 2024-07-16 10:54:55 +08:00
小莫唐尼 62992b2688 fix: 修复loading图片地址异常问题 2024-07-15 18:40:27 +08:00
小莫唐尼 da141ae10a update: README.md 2024-07-15 09:09:17 +08:00
小莫唐尼 d22224e2fc update: 移除node_modules依赖 2024-07-11 11:28:27 +08:00
小莫唐尼 d0b3a42c1d fix: 修复启动页面图片背景不生效问题、取消logo阴影 2024-07-10 23:00:00 +08:00
小莫唐尼 c3349ae070 fix: 修复启动页面视频背景下文字遮挡问题、新增更多参数配置 2024-07-10 17:17:24 +08:00
小莫唐尼 ad6719e201 feat: 启动页面支持视频背景 2024-07-10 11:20:25 +08:00
小莫唐尼 0e342d5fa3 fix: 修复恋爱相册无封面取值问题 2024-07-09 16:11:28 +08:00
小莫唐尼 daf1318a90 update: 更新README文档 2024-07-05 19:04:44 +08:00
小莫唐尼 d4ccc9b7d6 fix: 修复图库瀑布流bug 2024-07-05 17:41:39 +08:00
小莫唐尼 ce60c334ec fix: 修复图库配置不生效问题,取消默认配置 2024-07-04 11:00:25 +08:00
小莫唐尼 ca723bae80 update: 增加图库可进行配置是否使用瀑布流还是列表、调整文章详情和关于页面图片配置 2024-07-04 10:42:32 +08:00
小莫唐尼 c312fab4b1 fix: 修复图库图片下拉和加载更多的时候清空且随机显示问题 2024-07-03 18:31:43 +08:00
小莫唐尼 d9db03959a update: 调整联系博页面,可在后台配置显示隐藏 2024-07-02 18:04:18 +08:00
小莫唐尼 add84f6e4b update: 文章详情广告字段调整 2024-07-02 17:43:18 +08:00
小莫唐尼 850ee73fa2 feat: 图库支持瀑布流 2024-07-02 15:40:43 +08:00
小莫唐尼 77da85f7d4 fix: 修复文章评论回复功能 2024-06-27 00:21:26 +08:00
小莫唐尼 4d0901b650 update: 删除分享配置,使用微信默认的分享机制 2024-06-26 23:41:00 +08:00
小莫唐尼 66a39dd723 fix: 修复文章海报摘要过长,并且显示html标签的问题 2024-06-26 15:52:17 +08:00
小莫唐尼 4cdcbb1958 fix: 修复默认进入文章详情页面自动弹出键盘问题 2024-06-26 14:56:38 +08:00
小莫唐尼 e0569e287f fix: 修复分享混入代码错误问题 2024-06-26 14:43:48 +08:00
小莫唐尼 b42932ddad fix: 修复分享图片失效问题 2024-06-26 11:54:25 +08:00
39 changed files with 3408 additions and 3659 deletions
+48 -54
View File
@@ -1,66 +1,60 @@
<script>
import HaloTokenConfig from '@/config/token.config.js';
import HaloTokenConfig from '@/config/token.config.js';
// app升级检测(搭配:https://ext.dcloud.net.cn/plugin?id=4470 升级中心)
import CheckAppUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
import {
CheckWxUpdate
} from '@/utils/update.js';
export default {
globalData: {
baseApiUrl: HaloTokenConfig.BASE_API
},
onLaunch: function() {
console.log('App Launch');
// app升级检测(搭配:https://ext.dcloud.net.cn/plugin?id=4470 升级中心)
import CheckAppUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
import {CheckWxUpdate} from '@/utils/update.js';
// #ifdef APP-PLUS
CheckAppUpdate();
// #endif
export default {
globalData: {
baseApiUrl: HaloTokenConfig.BASE_API
},
onLaunch: function () {
// #ifdef MP-WEIXIN
CheckWxUpdate();
// #endif
// #ifdef APP-PLUS
CheckAppUpdate();
// #endif
uni.$tm.vx.actions('config/fetchConfigs').then((res) => {
console.log('正常:', res)
// #ifdef MP-WEIXIN
uni.$tm.vx.commit('setWxShare', res.shareConfig);
// #endif
})
// 启动检查app的配置是否已经就绪,若未就绪则设置默认的
uni.$tm.vx.actions('setting/checkAndSetDefaultAppSettings');
},
onShow: function() {
console.log('App Show');
},
onHide: function() {
console.log('App Hide');
}
};
// #ifdef MP-WEIXIN
CheckWxUpdate();
// #endif
uni.$tm.vx.actions('config/fetchConfigs').then((res) => {
})
// 启动检查app的配置是否已经就绪,若未就绪则设置默认的
uni.$tm.vx.actions('setting/checkAndSetDefaultAppSettings');
},
onShow: function () {
console.log('App Show');
},
onHide: function () {
console.log('App Hide');
}
};
</script>
<style lang="scss">
// 基础样式
@import './common/styles/app.theme.scss';
@import './common/styles/app.base.scss';
// 基础样式
@import './common/styles/app.theme.scss';
@import './common/styles/app.base.scss';
// 引入tmUI2.x样式
@import './tm-vuetify/mian.min.css';
// 引入tmUI2.x主题包
@import './tm-vuetify/scss/theme.css';
// 引入tmUI2.x预置图标
@import './tm-vuetify/scss/fonts/fontawesome_base64.css';
// 引入tmUI2.x样式
@import './tm-vuetify/mian.min.css';
// 引入tmUI2.x主题包
@import './tm-vuetify/scss/theme.css';
// 引入tmUI2.x预置图标
@import './tm-vuetify/scss/fonts/fontawesome_base64.css';
// 自定义图标
@import './common/icons/halocoloriconfont.css';
@import './common/icons/haloiconfont.css';
@import './common/icons/mphtmliconfont.css';
// 自定义图标
@import './common/icons/halocoloriconfont.css';
@import './common/icons/haloiconfont.css';
@import './common/icons/mphtmliconfont.css';
/* #ifndef MP-WEIXIN */
@import './common/markdown/markdown.scss';
/* #endif */
/* #ifndef MP-WEIXIN */
@import './common/markdown/markdown.scss';
/* #endif */
page {
background-color: #fafafa;
}
</style>
page {
background-color: #fafafa;
}
</style>
+53 -52
View File
@@ -1,6 +1,6 @@
<p align="center">
<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>
</p>
@@ -10,10 +10,10 @@
<br />
<p align="center">
<a href="https://b.925i.cn">作者博客</a>
<a href="https://uni-halo.925i.cn">文档地址(等待更新v2版本说明)</a>
<a href="https://gitee.com/ialley-workshop-open/uni-halo">Gitee仓库</a>
<a href="https://github.com/ialley-workshop-open/uni-halo">Github仓库</a>
<a href="https://www.xiaoxiaomo.cn">作者主页</a>
<a href="https://uni-halo.925i.cn">官方文档</a>
<a href="https://github.com/ialley-workshop-open/uni-halo">仓库地址</a>
<a href="https://github.com/ialley-workshop-open/plugin-uni-halo">插件仓库</a>
</p>
---
@@ -22,52 +22,27 @@
| 支付宝 | 微信 | 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) |
## 一、项目介绍
基于 Halo 2.x 提供的 API 接口,为微信小程序提供的一套开源的博客应用。
- 完全免费开源,包括程序源码、插件源码
- 页面支持插件配置
- 使用最新流行的技术栈
- 支持特色功能,恋爱日记
- 理论支持编译为 小程序(推荐)、APP
## 🧐 功能介绍
### 在线预览
#### 🍻 基础功能
微信内容扫描下方二维码,即可在线预览小程序。
`重要说明:2.0版本 暂时去掉后台管理功能。`
![QQ交流群](https://blog.925i.cn/upload/xiaochengxu.gif)
- 用户端:文章列表、文章分类、文章详情、图库、友链、瞬间等
<br/>
#### 💞 特色功能
- 恋爱日记:精心为您设计了秀恩爱的模块,秀出关于你们的故事、情侣甜蜜相册、恋爱记录清单,为您的恋爱保驾护航。
<br/>
#### 😘 插件配置
已支持通过插件配置,插件地址 [plugin-uni-halo](https://github.com/ialley-workshop-open/plugin-uni-halo)
<br/>
## 😎 文档源码
- 作者博客:[https://b.925i.cn/](https://b.925i.cn/)
- 官方文档(待更新v2版本说明):[https://uni-halo.925i.cn/](https://uni-halo.925i.cn/)
- Gitee [https://gitee.com/ialley-workshop-open/uni-halo](https://gitee.com/ialley-workshop-open/uni-halo)
- Github [https://github.com/ialley-workshop-open/uni-halo](https://github.com/ialley-workshop-open/uni-halo)
<br/>
## 😏 在线体验
说明:微信扫码、或搜索【小莫唐尼】即可在线体验已上线小程序!!!
![https://img.925i.cn/file/a0c1a95b49b5db7f78248.png](https://img.925i.cn/file/a0c1a95b49b5db7f78248.png)
<br/>
## 😘 界面预览
##### 📱 用户端
说明:以下仅为部分截图
### 部分截图
|首页|分类|图库|
|:--:|:--:|:--:|
@@ -78,25 +53,51 @@
|![瞬间](https://blog.925i.cn/upload/41EE8ADBFAE709A483A6E5F814C6A6E4.jpg)|![我的](https://blog.925i.cn/upload/9AEFE8DA4671A3C7F20F76FF3F9D15C9.jpg)|
##### 📱 恋爱日记
说明:以下仅为部分截图
### 恋爱日记
|主页|恋爱清单|
|:--:|:--:|
|![主页](https://uni-halo.925i.cn/assets/love_001.6bf8b4e9.jpg)|![恋爱清单](https://uni-halo.925i.cn/assets/love_002.a08bd8d6.jpg)|
<br/>
## 🙋 使用交流
### 功能介绍
- 基础功能:文章列表、文章分类、文章详情、个人图库、友情链接、我的瞬间
- 特色功能:恋爱日记,精心为您设计了秀恩爱的模块,秀出关于你们的故事、情侣甜蜜相册、恋爱记录清单,为您的恋爱保驾护航。
## 二、配套插件
### 下载地址
- 代码仓库:[https://github.com/ialley-workshop-open/plugin-uni-halo](https://github.com/ialley-workshop-open/plugin-uni-halo)
- 仓库版本:[https://github.com/ialley-workshop-open/plugin-uni-halo/releases](https://github.com/ialley-workshop-open/plugin-uni-halo/releases)
- 应用市场:[https://www.halo.run/store/apps/app-ryemX](https://www.halo.run/store/apps/app-ryemX)
### 使用方式
直接下载安装插件,在插件市场安装即可,安装完成后,需要配置插件,配置完成后,即可使用插件提供的功能。
## 三、相关文档
- 作者主页:[https://www.xiaoxiaomo.cn/](https://www.xiaoxiaomo.cn/)
- 作者博客:[https://blog.925i.cn/](https://blog.925i.cn/)
- 官方文档:[https://uni-halo.925i.cn/](https://uni-halo.925i.cn/)
- 代码仓库:[https://github.com/ialley-workshop-open/uni-halo](https://github.com/ialley-workshop-open/uni-halo)
- 插件地址:[https://github.com/ialley-workshop-open/plugin-uni-halo](https://github.com/ialley-workshop-open/uni-halo)
- 应用市场:[https://www.halo.run/store/apps/app-ryemX](https://www.halo.run/store/apps/app-ryemX)
## 四、使用交流
- 提交 issues[Github Issues](https://github.com/ialley-workshop-open/uni-halo/issues)
丨 [Gitee Issues](https://gitee.com/ialley-workshop-open/uni-halo/issues)
- 微信交流群:由于微信交流群时效性太短,所以有需要的话可以先加入QQ群,再邀请进微信群
- QQ 交流群:632969367
-
快速加群:[![632969367](https://pub.idqqimg.com/wpa/images/group.png)](https://qm.qq.com/cgi-bin/qm/qr?k=cuam7lhrB_vHuvjw2mzUO1sOKdF9KRyM&jump_from=webapi&authKey=d6bJhNaqupTTfoMDWDIeYUTAs44Ax7p64SsM/5NRtFhXE09YexDO15Izuyth6XAi)
![QQ群号:632969367](https://img.925i.cn/file/b83b9e79695779c4344f3.png)
![QQ交流](https://blog.925i.cn/upload/qun.png)
<br/>
+13 -1
View File
@@ -77,7 +77,7 @@ export default {
},
// 提交回复
addPostCommentReply: (commentName, data) => {
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/comments/${commentName}/replay`, data)
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/comments/${commentName}/reply`, data)
},
/**
@@ -200,5 +200,17 @@ export default {
*/
submitLink(form) {
return HttpHandler.Post(`/apis/linksSubmit.muyin.site/v1alpha1/submit`, form, null)
},
/**
* 获取二维码信息
*/
getQRCodeInfo: (key) => {
return HttpHandler.Get(`/apis/api.uni.uhalo.pro/v1alpha1/plugins/plugin-uni-halo/getQRCodeInfo/${key}`, null,)
},
/**
* 获取二维码图片
*/
getQRCodeImg: (postId) => {
return HttpHandler.Get(`/apis/api.uni.uhalo.pro/v1alpha1/plugins/plugin-uni-halo/getQRCodeImg/${postId}`, null,)
}
}
+27 -27
View File
@@ -2,14 +2,14 @@
* markdown配置
*/
import {
getAppConfigs
} from '@/config/index.js'
import {getAppConfigs} from '@/config/index.js'
import HaloTokenConfig from '@/config/token.config.js'
import utils from '@/utils/index.js'
export default {
domain: HaloTokenConfig.BASE_API,
tagStyle: {
table: `
domain: HaloTokenConfig.BASE_API,
tagStyle: {
table: `
table-layout: fixed;
border-collapse:collapse;
margin-bottom: 18px;
@@ -20,17 +20,17 @@ export default {
border: 1px solid #dcdcdc;
border-radius: 4px;
`,
th: `
th: `
padding: 8px;
border-right: 1px solid var(--classE);
border-bottom: 1px solid var(--classE);
`,
td: `
td: `
padding: 8px;
border-right: 1px solid var(--classE);
border-bottom: 1px solid var(--classE);
`,
blockquote: `
blockquote: `
padding: 8px 15px;
color: #606266;
background: #f2f6fc;
@@ -39,62 +39,62 @@ export default {
line-height: 26px;
margin-bottom: 18px;
`,
ul: 'padding-left: 15px;line-height: 1.85;',
ol: 'padding-left: 15px;line-height: 1.85;',
li: 'margin-bottom: 12px;line-height: 1.85;',
h1: `
ul: 'padding-left: 15px;line-height: 1.85;',
ol: 'padding-left: 15px;line-height: 1.85;',
li: 'margin-bottom: 12px;line-height: 1.85;',
h1: `
margin: 30px 0 20px;
color: var(--main);
line-height: 24px;
position: relative;
font-size:1.2em;
`,
h2: `
h2: `
color: var(--main);
line-height: 24px;
position: relative;
margin: 22px 0 16px;
font-size: 1.16em;
`,
h3: `
h3: `
color: var(--main);
line-height: 24px;
position: relative;
margin: 26px 0 18px;
font-size: 1.14em;
`,
h4: `
h4: `
color: var(--main);
line-height: 24px;
margin-bottom: 18px;
position: relative;
font-size: 1.12em;
`,
h5: `
h5: `
color: var(--main);
line-height: 24px;
margin-bottom: 14px;
position: relative;
font-size: 1.1em;
`,
h6: `
h6: `
color: #303133;
line-height: 24px;
margin-bottom: 14px;
position: relative;
font-size: 14px;
`,
p: `
p: `
line-height: 1.65;
margin-bottom: 14px;
font-size: 14px;
`,
'code': ` `,
strong: 'font-weight: 700;color: rgb(248, 57, 41);',
video: 'width: 100%',
},
containStyle: 'font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;padding:12px;font-size: 14px;color: #606266;word-spacing: 0.8px;letter-spacing: 0.8px;border-radius: 6px;background-color:#FFFFFF;',
'code': ` `,
strong: 'font-weight: 700;color: rgb(248, 57, 41);',
video: 'width: 100%',
},
containStyle: 'font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;padding:12px;font-size: 14px;color: #606266;word-spacing: 0.8px;letter-spacing: 0.8px;border-radius: 6px;background-color:#FFFFFF;',
loadingGif: getAppConfigs().imagesConfig.loadingGifUrl,
emptyGif: getAppConfigs().imagesConfig.loadingEmptyUrl,
}
loadingGif: utils.checkImageUrl(getAppConfigs().imagesConfig.loadingGifUrl),
emptyGif: utils.checkImageUrl(getAppConfigs().imagesConfig.loadingEmptyUrl),
}
+1 -13
View File
@@ -42,18 +42,6 @@ export default {
}
}
},
watch: {
haloConfig: {
deep: true,
immediate: true,
handler(newVal) {
if (!newVal) return;
// #ifdef MP-WEIXIN
uni.$tm.vx.commit('setWxShare', newVal.shareConfig);
// #endif
}
}
},
onLoad() {
this.fnResetSetAniWaitIndex()
},
@@ -72,7 +60,7 @@ export default {
// 设置页面标题
fnSetPageTitle(title) {
uni.setNavigationBarTitle({
title: title || (this.haloConfig && this.haloConfig.startConfig.title) || "uni-halo",
title: title || this.haloConfig?.appConfig?.startConfig?.title || "uni-halo",
})
},
-65
View File
@@ -1,65 +0,0 @@
// 微信分享配置
import HaloTokenConfig from '@/config/token.config.js'
import {jsonToUrlParams2} from '@/utils/url.params.js'
export const haloWxShareMixin = {
computed: {
haloWxShareData() {
const configs = this.$tm.vx.getters().getConfigs;
return configs?.shareConfig || {}
}
},
//#ifdef MP-WEIXIN
onShareAppMessage(res) {
return {
...this.haloWxShareData,
success: res => {
}
}
},
//#endif
/* 分享到微信好友 */
onShareAppMessage(res) {
const promise = new Promise(resolve => {
setTimeout(() => {
resolve({
title: this.haloWxShareData.title,
path: this.haloWxShareData.path,
})
}, 2000)
})
return {
title: this.haloWxShareData.title,
path: '',
promise
}
},
// 分享到朋友圈-这里封装不够,在页面还要声明一次,否则是拿不到参数的,被分享者在朋友圈打开链接是空的
onShareTimeline: function () {
return {
title: this.haloWxShareData.title,
query: {},
imageUrl: this.haloWxShareData.imageUrl,
}
},
methods: {
// 设置分享信息(需要在页面调用)
fnSetWxShareConfig(config = {}) {
let currentRoutes = getCurrentPages(); // 获取当前打开过的页面路由数组
let currentRoute = currentRoutes[currentRoutes.length - 1].route; //获取当前页面路由(分销思路,分享者点开使用的小程序将获取到分享者的id)
let sharePath = currentRoutes
if (config.params) {
const URLParams = config.params ? jsonToUrlParams2(config.params) : {};
sharePath += URLParams
}
let _config = Object.assign({}, {
path: sharePath,
copyLink: HaloTokenConfig.BASE_API,
query: {}
}, config)
uni.$tm.vx.commit('setWxShare', _config);
}
}
}
@@ -1,207 +0,0 @@
<template>
<tm-poup v-model="show" position="bottom" height="auto" @change="fnClose">
<view class="poup-head pa-24 text-align-center text-weight-b ">{{ title }}</view>
<view class="poup-body pa-24 pt-0 pb-0">
<view v-if="loading != 'success'" class="loading-wrap flex flex-center">
<view v-if="loading == 'loading'" class="loading">加载中...</view>
<view v-else class="error" @click="fnGetData()">加载失败点击刷新</view>
</view>
<block v-else>
<view v-if="total == 0" class="empty">无附件</view>
<scroll-view v-else class="poup-content" :enable-flex="true" :scroll-y="true" @touchmove.stop>
<view class="card-content">
<view class="card pa-12" v-for="(file, index) in dataList" :key="index" @click="fnOnSelect(file, index)">
<view class="card-inner round-3" :class="{ 'is-select': selectIndex == index }">
<cache-image v-if="file.isImage" class="cover" height="160rpx" :url="file.thumbPath" :fileMd5="file.thumbPath" mode="aspectFill"></cache-image>
<view v-else class="cover flex pl-46 pr-46 flex-center bg-gradient-blue-grey-accent text-align-center text-size-m">{{ file.mediaType }}</view>
<view class="name text-overflow text-size-m pa-12">{{ file.name }}</view>
</view>
</view>
</view>
</scroll-view>
</block>
</view>
<view class="poup-foot pa-30 pb-12 pt-0">
<!-- 分页 -->
<view v-if="total > queryParams.size" class="mt-36 pl-24 pr-24">
<tm-pagination color="bg-gradient-blue-accent" :page.sync="queryParams.page" :total="total" :totalVisible="5" @change="fnGetPagingData"></tm-pagination>
</view>
<view class=" flex flex-center mt-12">
<tm-button size="m" theme="bg-gradient-blue-accent" @click="fnSava()">确定选用</tm-button>
<tm-button size="m" theme="bg-gradient-orange-accent" @click="fnUpload()">上传</tm-button>
<tm-button size="m" theme="bg-gradient-blue-grey-accent" @click="fnClose(false)"> </tm-button>
</view>
</view>
</tm-poup>
</template>
<script>
import { getAdminAccessToken } from '@/utils/auth.js';
import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue';
import tmPagination from '@/tm-vuetify/components/tm-pagination/tm-pagination.vue';
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
export default {
name: 'attachment-select',
components: { tmPoup, tmPagination, tmButton },
props: {
title: {
type: String,
default: '附件列表'
},
selectType: {
type: String,
default: ''
}
},
data() {
return {
show: true,
loading: 'loading',
total: 0,
queryParams: {
size: 6,
page: 1
},
dataList: [],
select: null,
selectIndex: -1
};
},
created() {
this.fnGetData();
},
methods: {
fnGetData() {
this.queryParams.page = 1;
this.fnGetPagingData(1);
},
fnGetPagingData(page) {
this.loading = 'loading';
const _params = {
...this.queryParams
};
_params.page = page - 1;
this.$httpApi.admin
.getAttachmentsByPage(_params)
.then(res => {
if (res.status == 200) {
this.total = res.data.total;
this.dataList = res.data.content.map(file => {
if (this.$utils.fnCheckIsFileType('image', file) && file.size / 1024 / 1024 > 2) {
file.isImage = false;
file.desc = '图片过大无法显示缩略图';
} else {
file.isImage = this.$utils.fnCheckIsFileType('image', file);
}
file.thumbPath = this.$utils.checkThumbnailUrl(file.thumbPath);
return file;
});
this.loading = 'success';
} else {
uni.$tm.toast('加载失败,请重试!');
this.loading = 'error';
}
})
.catch(err => {
console.error(err);
uni.$tm.toast('加载失败,请重试!');
this.loading = 'error';
});
},
fnOnSelect(file, index) {
this.select = file;
this.selectIndex = index;
},
fnSava() {
if (this.selectType) {
if (this.$utils.fnCheckIsFileType(this.selectType, this.select)) {
this.$emit('on-select', this.select);
} else {
uni.$tm.toast('该附件类型不符合!');
}
} else {
this.$emit('on-select', this.select);
}
},
fnClose(e) {
if (!e) {
this.$emit('on-close');
}
},
fnUpload() {
uni.chooseImage({
count: 1,
success: res => {
uni.uploadFile({
filePath: res.tempFilePaths[0],
header: {
'admin-authorization': getAdminAccessToken()
},
url: this.$baseApiUrl + '/api/admin/attachments/upload',
name: 'file',
success: upladRes => {
const _uploadRes = JSON.parse(upladRes.data);
if (_uploadRes.status == 200) {
uni.$tm.toast('上传成功!');
this.fnGetData(1);
} else {
uni.$tm.toast(_uploadRes.message);
}
},
fail: err => {
uni.$tm.toast(err.message);
}
});
}
});
}
}
};
</script>
<style scoped lang="scss">
.poup-head {
}
.poup-body {
height: 50vh;
}
.loading-wrap {
height: 50vh;
background-color: #fafafa;
}
.poup-content {
height: inherit;
box-sizing: border-box;
.card-content {
height: inherit;
display: flex;
flex-wrap: wrap;
}
}
.card {
width: 50%;
box-sizing: border-box;
&-inner {
box-sizing: border-box;
overflow: hidden;
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.05);
border: 4rpx solid transparent;
&.is-select {
border-color: rgb(13, 141, 242);
}
}
.cover {
width: 100%;
height: 160rpx;
flex-wrap: wrap;
box-sizing: border-box;
}
.name {
color: #303133;
box-sizing: border-box;
text-align: center;
}
}
</style>
@@ -1,194 +0,0 @@
<template>
<view class="bottom-tool-bar">
<tm-translate :auto="true" animation-name="fadeUp">
<view class="content flex">
<view class="input" @click="fnToComment()">
<text class="icon iconfont icon-edit"></text>
<text class="text">(*^^*)说点啥吧~</text>
</view>
<view class="right flex">
<!-- 点赞 -->
<view class="item likes" @click="fnDoLikes()">
<view class="iconfont icon-like"></view>
<view class="text">{{ tempPost.likes }}</view>
</view>
<!-- 评论 -->
<view class="item comment">
<view class="iconfont icon-comment-dots"></view>
<view class="text">{{ tempPost.commentCount }}</view>
</view>
<!-- 分享 -->
<view class="item share" @click="fnOnShare()"><text class="iconfont icon-share1"></text></view>
</view>
</view>
</tm-translate>
<tm-shareSheet @change="fnOnShareChange" :actions="share.list" title="分享文章" v-model="share.show"></tm-shareSheet>
</view>
</template>
<script>
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
import tmShareSheet from '@/tm-vuetify/components/tm-shareSheet/tm-shareSheet.vue';
export default {
name: 'bottom-tool-bar',
components: {
tmTranslate,
tmShareSheet
},
props: {
// 文章数据
post: {
type: Object,
default: () => {}
},
// 其他参数
params: {
type: Object,
default: () => {}
}
},
data() {
return {
share: {
show: false,
list: [
[
{ name: '微信好友', bgcolor: '#07c160', icon: 'icon-weixin', color: 'white' },
{ name: '朋友圈', bgcolor: '#04c887', icon: 'icon-pengyouquan', color: 'white' },
{ name: '生成海报', bgcolor: '#1dc0fd', icon: 'icon-QQ', color: 'white' }
]
]
},
tempPost: {}
};
},
watch: {
post: {
deep: true,
handler(val) {
console.log('watch', val);
this.tempPost = this.$utils.deepClone(val);
}
}
},
created() {
console.log(this.post);
this.tempPost = this.$utils.deepClone(this.post);
console.log(this.tempPost);
},
methods: {
fnToComment() {
this.$Router.push({
path: '/pagesA/comment/comment',
query: {
postId: this.post.id,
parentId: 0,
title: this.post.title,
formPage: 'comment_list',
type: 'post'
}
});
},
fnDoLikes() {
this.$httpApi
.postLikePost(this.post.id)
.then(res => {
if (res.status == 200) {
uni.showToast({
icon: 'none',
title: '点赞成功'
});
this.tempPost.likes += 1;
} else {
uni.showToast({
icon: 'none',
title: res.message
});
}
})
.catch(err => {
console.log(err);
uni.showToast({
icon: 'none',
title: err.message
});
});
},
fnOnShare() {
// this.$emit('on-share');
this.share.show = true;
},
fnOnShareChange(e) {
console.log(e);
}
}
};
</script>
<style scoped lang="scss">
.bottom-tool-bar {
width: 100vw;
position: fixed;
left: 0;
bottom: 0;
z-index: 401;
::v-deep {
.tm-shareSheet-wk .uni-scroll-view-content {
display: flex;
align-items: center;
justify-content: center;
}
}
.content {
width: 100%;
justify-content: space-between;
box-sizing: border-box;
padding: 24rpx;
background-color: #ffffff;
box-shadow: 0rpx -4rpx 24rpx rgba(0, 0, 0, 0.07);
border-radius: 24rpx 24rpx 0 0;
.input {
width: 280rpx;
padding: 12rpx 24rpx;
background-color: #f5f5f5;
border-radius: 60rpx;
font-size: 24rpx;
color: #666;
.icon {
}
.text {
padding-left: 8rpx;
}
}
.right {
width: 0;
flex-grow: 1;
align-items: center;
justify-content: space-between;
padding-left: 24rpx;
.item {
margin-left: 24rpx;
text-align: center;
display: flex;
align-items: center;
&.share {
.iconfont {
font-size: 36rpx;
}
}
.iconfont {
font-size: 36rpx;
color: #333;
}
.text {
padding-left: 6rpx;
font-size: 32rpx;
}
}
}
}
}
</style>
+182 -181
View File
@@ -1,197 +1,198 @@
<template>
<view class="cache-image-wrap">
<view v-if="loadStatus == 'loading'" class="img-loading" :style="[imgStyle, loadStyle]">
<!-- <text class="img-load-icon iconfont icon-loading"></text>
<text class="img-load-text">{{ loadText }}</text> -->
<image :src="loadingImgSrc" :style="[loadingImgStyle]" mode="aspectFit"></image>
</view>
<view v-if="loadStatus == 'error'" class="img-error" :style="[imgStyle, loadErrStyle]">
<!-- <text class="img-err-icon iconfont icon-exclamation-circle"></text>
<text class="img-load-text">{{ loadErrText }}</text> -->
<image class="img-error-img" :src="loadingErrorImageSrc" mode="scaleToFill"></image>
</view>
<image v-show="loadStatus == 'success'" :src="src" @load="fnOnLoad" @error="fnOnError" :lazy-load="lazyLoad"
:style="[imgStyle]" :mode="mode" @click="$emit('on-click', url)"></image>
</view>
<view class="cache-image-wrap">
<view v-if="loadStatus == 'loading'" class="img-loading" :style="[imgStyle, loadStyle]">
<!-- <text class="img-load-icon iconfont icon-loading"></text>
<text class="img-load-text">{{ loadText }}</text> -->
<image :src="loadingImgSrc" :style="[loadingImgStyle]" mode="aspectFit"></image>
</view>
<view v-if="loadStatus == 'error'" class="img-error" :style="[imgStyle, loadErrStyle]">
<!-- <text class="img-err-icon iconfont icon-exclamation-circle"></text>
<text class="img-load-text">{{ loadErrText }}</text> -->
<image class="img-error-img" :src="loadingErrorImageSrc" mode="scaleToFill"></image>
</view>
<image v-show="loadStatus == 'success'" :src="src" @load="fnOnLoad" @error="fnOnError" :lazy-load="lazyLoad"
:style="[imgStyle]" :mode="mode" @click="$emit('on-click', url)"></image>
</view>
</template>
<script>
import imageCache from '@/utils/imageCache.js';
export default {
name: 'cache-image',
props: {
url: {
type: String,
default: ''
},
lazyLoad: {
type: Boolean,
default: true
},
loadStyle: {
type: Object,
default () {
return {
backgroundColor: '#ffffff',
color: '#333'
};
}
},
loadErrStyle: {
type: Object,
default () {
return {
color: 'rgba(244, 67, 54,1)'
// backgroundColor: 'rgba(244, 67, 54,0.2)'
};
}
},
mode: {
type: String,
default: 'aspectFill'
},
loadText: {
type: String,
default: '加载中...'
},
loadErrText: {
type: String,
default: '加载失败'
},
fileMd5: {
type: String,
default: ''
},
styles: {
type: Object,
default () {
return {};
}
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '100%'
},
radius: {
type: String,
default: ''
}
},
data() {
return {
imgStyle: {},
loadingImgStyle: {
width: '120rpx',
},
src: '', // 图片地址
loadStatus: 'loading'
};
},
computed: {
imagesConfig() {
return this.$tm.vx.getters().getConfigs.imagesConfig
},
loadingImgSrc() {
return this.imagesConfig.loadingGifUrl;
},
loadingErrorImageSrc() {
return this.imagesConfig.loadingErrUrl
}
},
watch: {
// 监听图片md5值的变化
fileMd5(val) {
// 查找获取图片缓存
this.fnGetImageCache();
}
},
created() {
this.imgStyle = {
width: this.width,
height: this.height,
borderRadius: this.radius,
...this.styles
};
import imageCache from '@/utils/imageCache.js';
// 查找获取图片缓存
this.fnGetImageCache();
},
methods: {
// 查找获取图片缓存
async fnGetImageCache() {
// #ifdef APP-PLUS
var result = await imageCache.getImageCache(this.url, this.fileMd5);
if (result) {
this.src = result;
} else {
this.src = this.url;
}
// #endif
// #ifndef APP-PLUS
this.src = this.url;
// #endif
},
fnOnLoad() {
this.loadStatus = 'success';
},
fnOnError(e) {
this.loadStatus = 'error';
}
}
};
export default {
name: 'cache-image',
props: {
url: {
type: String,
default: ''
},
lazyLoad: {
type: Boolean,
default: true
},
loadStyle: {
type: Object,
default() {
return {
backgroundColor: '#ffffff',
color: '#333'
};
}
},
loadErrStyle: {
type: Object,
default() {
return {
color: 'rgba(244, 67, 54,1)'
// backgroundColor: 'rgba(244, 67, 54,0.2)'
};
}
},
mode: {
type: String,
default: 'aspectFill'
},
loadText: {
type: String,
default: '加载中...'
},
loadErrText: {
type: String,
default: '加载失败'
},
fileMd5: {
type: String,
default: ''
},
styles: {
type: Object,
default() {
return {};
}
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '100%'
},
radius: {
type: String,
default: ''
}
},
data() {
return {
imgStyle: {},
loadingImgStyle: {
width: '120rpx',
},
src: '', // 图片地址
loadStatus: 'loading'
};
},
computed: {
imagesConfig() {
return this.$tm.vx.getters().getConfigs.imagesConfig
},
loadingImgSrc() {
return this.$utils.checkImageUrl(this.imagesConfig.loadingGifUrl);
},
loadingErrorImageSrc() {
return this.$utils.checkImageUrl(this.imagesConfig.loadingErrUrl)
}
},
watch: {
// 监听图片md5值的变化
fileMd5(val) {
// 查找获取图片缓存
this.fnGetImageCache();
}
},
created() {
this.imgStyle = {
width: this.width,
height: this.height,
borderRadius: this.radius,
...this.styles
};
// 查找获取图片缓存
this.fnGetImageCache();
},
methods: {
// 查找获取图片缓存
async fnGetImageCache() {
// #ifdef APP-PLUS
var result = await imageCache.getImageCache(this.url, this.fileMd5);
if (result) {
this.src = result;
} else {
this.src = this.url;
}
// #endif
// #ifndef APP-PLUS
this.src = this.url;
// #endif
},
fnOnLoad() {
this.loadStatus = 'success';
},
fnOnError(e) {
this.loadStatus = 'error';
}
}
};
</script>
<style scoped lang="scss">
.cache-image-wrap {
width: 100%;
height: 100%;
}
.cache-image-wrap {
width: 100%;
height: 100%;
}
.img-loading,
.img-error {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-sizing: border-box;
background-color: #f2f2f2;
}
.img-loading,
.img-error {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-sizing: border-box;
background-color: #f2f2f2;
}
.img-load-icon {
font-size: 36rpx;
animation: xhRote 0.8s infinite linear;
}
.img-load-icon {
font-size: 36rpx;
animation: xhRote 0.8s infinite linear;
}
.img-load-text {
font-size: 28rpx;
margin-top: 8rpx;
color: inherit;
}
.img-load-text {
font-size: 28rpx;
margin-top: 8rpx;
color: inherit;
}
.img-error {
font-size: 28rpx;
.img-error {
font-size: 28rpx;
&-img {
width: 100%;
border-radius: 12rpx;
}
}
&-img {
width: 100%;
border-radius: 12rpx;
}
}
.img-err-icon {
font-size: 36rpx;
}
.img-err-icon {
font-size: 36rpx;
}
@keyframes xhRote {
0% {
transform: rotate(0deg);
}
@keyframes xhRote {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
100% {
transform: rotate(360deg);
}
}
</style>
+5 -10
View File
@@ -30,8 +30,7 @@
<text class="text-red text-size-s">- 文章已开启禁止评论 -</text>
</tm-empty>
<tm-empty v-else icon="icon-shiliangzhinengduixiang-" label="暂无评论">
<tm-button theme="light-blue" :dense="true" :shadow="0" size="m"
@click="fnToComment(null)">抢沙发
<tm-button theme="light-blue" :dense="true" :shadow="0" size="m" @click="fnToComment(null)">抢沙发
</tm-button>
</tm-empty>
</view>
@@ -146,11 +145,9 @@ export default {
return uni.$tm.toast('文章已禁止评论!');
}
let _comment = {};
console.log('data', data)
if (data) {
let {
type,
comment
} = data;
let {type, comment} = data;
// 来自用户
_comment = {
isComment: false,
@@ -165,16 +162,14 @@ export default {
_comment = {
isComment: true,
postName: this.post.metadata.name,
title: '评论文章:' + this.post.spec.title,
title: '新增评论',
formPage: 'comment_list',
from: 'posts',
type: 'post'
};
}
this.$emit("on-comment", {
_comment
})
this.$emit("on-comment", _comment)
},
fnCopyContent(content) {
uni.$tm.u.setClipboardData(content);
+3 -3
View File
@@ -2,7 +2,7 @@
<tm-poup v-model="isShow" position="bottom" height="71vh" @change="handleOnChange">
<view class="title text-align-center">{{ calcTitle }}</view>
<tm-form @submit="fnOnSubmit">
<tm-input :auto-focus="true" name="content" :vertical="true" required :height="220" input-type="textarea"
<tm-input name="content" :vertical="true" required :height="220" input-type="textarea"
bg-color="grey-lighten-5" :maxlength="200" :borderBottom="false" placeholder="请输入内容,不超过200字符..."
v-model="form.content"></tm-input>
<tm-input name="author" align="right" required title="我的昵称" placeholder="请输入您的昵称..."
@@ -169,7 +169,7 @@ export default {
}
this.$httpApi.v2.addPostComment(commentForm)
.then(res => {
uni.$tm.toast('评论成功!');
uni.$tm.toast('评论成功,可能需要审核');
// 更新评论者信息
this.handleSetVisitor();
this.handleClose(true)
@@ -196,7 +196,7 @@ export default {
}
this.$httpApi.v2.addPostCommentReply(this.form.postName, replyForm)
.then(res => {
uni.$tm.toast('回复成功!');
uni.$tm.toast('回复成功,可能需要审核');
// 更新评论者信息
this.handleSetVisitor();
this.handleClose(true)
-159
View File
@@ -1,159 +0,0 @@
<template>
<view class="journal-card mb-24 round-3 bg-white ">
<view class="head pa-24 pb-0 flex flex-between">
<view class="left flex">
<cache-image class="avatar rounded" radius="50%" width="70rpx" height="70rpx" :url="bloggerInfo.avatar"
:fileMd5="bloggerInfo.avatar" mode="scaleToFill"></cache-image>
<view class="info pl-16 flex flex-col">
<view class="nickname text-weight-b text-grey-darken-4">{{ bloggerInfo.nickname }}</view>
<view class="mt-3 time text-size-m ">
{{ $tm.dayjs(journal.createTime).format('YYYY-MM-DD HH:mm:ss') }}</view>
</view>
</view>
<view class="right">
<tm-button v-if="useLike" :shadow="0" theme="light-blue" size="s"
@click="fnLike(journal)">点赞({{ journal.likes }})</tm-button>
<tm-button v-if="useEdit" :shadow="0" theme="light-blue" size="s"
@click="$emit('on-edit', journal)">编辑</tm-button>
<tm-button v-if="useDel" :shadow="0" theme="red" size="s" @click="fnDel(journal)">删除</tm-button>
</view>
</view>
<tm-more v-if="journal.content.length > 50" :maxHeight="100" label="查看全部内容" open-label="隐藏部分内容">
<mp-html class="evan-markdown" lazy-load :domain="markdownConfig.domain"
:loading-img="markdownConfig.loadingGif" :scroll-table="true" :selectable="true"
:tag-style="markdownConfig.tagStyle" :container-style="markdownConfig.containStyle"
:content="journal.content" :markdown="true" :showLineNumber="true" :showLanguageName="true"
:copyByLongPress="true" />
</tm-more>
<mp-html v-else class="evan-markdown" lazy-load :domain="markdownConfig.domain"
:loading-img="markdownConfig.loadingGif" :scroll-table="true" :selectable="true"
:tag-style="markdownConfig.tagStyle" :container-style="markdownConfig.containStyle"
:content="journal.content" :markdown="true" :showLineNumber="true" :showLanguageName="true"
:copyByLongPress="true" />
</view>
</template>
<script>
import MarkdownConfig from '@/common/markdown/markdown.config.js';
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
import tmMore from '@/tm-vuetify/components/tm-more/tm-more.vue';
export default {
name: 'journal-card',
components: {
mpHtml,
tmButton,
tmMore
},
props: {
isAdmin: {
type: Boolean,
default: false
},
journal: {
type: Object,
default: () => {}
},
useLike: {
type: Boolean,
default: false
},
useEdit: {
type: Boolean,
default: false
},
useDel: {
type: Boolean,
default: false
}
},
data() {
return {
markdownConfig: MarkdownConfig
};
},
computed: {
bloggerInfo() {
let blogger = this.$tm.vx.getters().getConfigs.authorConfig.blogger;
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
return blogger;
},
},
methods: {
fnLike(journal) {
uni.showLoading({
mask: true,
title: '正在点赞中...'
});
this.$httpApi
.postJournalLikes(journal.id)
.then(res => {
if (res.status == 200) {
journal.likes += 1;
uni.$tm.toast('o( ̄▽ ̄)d点赞成功!');
} else {
uni.$tm.toast('Ծ‸Ծ点赞失败了~');
}
})
.catch(err => {
uni.$tm.toast('Ծ‸Ծ点赞失败了~');
});
},
fnDel(journal) {
uni.$eShowModal({
title: '提示',
content: '您确定要删除该日记吗?',
showCancel: true,
cancelText: '否',
cancelColor: '#999999',
confirmText: '是',
confirmColor: '#03a9f4'
})
.then(res => {
this.$httpApi.admin
.deleteJournalsById(journal.id)
.then(res => {
if (res.status == 200) {
this.$emit('on-del', journal);
uni.$tm.toast('删除成功!');
} else {
uni.$tm.toast('Ծ‸Ծ删除失败~');
}
})
.catch(err => {
uni.$tm.toast('Ծ‸Ծ删除失败~');
});
})
.catch(() => {});
}
}
};
</script>
<style scoped lang="scss">
.journal-card {
box-sizing: border-box;
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.05);
overflow: hidden;
.avatar {
width: 70rpx;
height: 70rpx;
border: 6rpx solid #fff;
box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.05);
}
.info {
justify-content: center;
.nickname {
font-size: 30rpx;
}
.time {
font-size: 26rpx;
}
}
}
</style>
+31 -11
View File
@@ -1,30 +1,50 @@
// 应用设置存储key值
export const _AppConfigKey = 'APP_GLOBAL_CONFIGS';
export const _AppMockJsonKey = 'APP_GLOBAL_MOCK_JSON';
// 默认的应用设置
export const DefaultAppConfigs = {
loveConfig: {},
imagesConfig: {},
authorConfig: {},
appConfig: {},
pluginConfig: {},
adConfig: {},
loveConfig: {},
imagesConfig: {},
authorConfig: {},
appConfig: {},
pluginConfig: {},
pageConfig: {}
}
/**
* 获取应用设置
*/
export const getAppConfigs = () => {
let configs = uni.getStorageSync(_AppConfigKey)
if (configs) return JSON.parse(configs)
let configs = uni.getStorageSync(_AppConfigKey)
if (configs) return JSON.parse(configs)
uni.setStorageSync(_AppConfigKey, JSON.stringify(DefaultAppConfigs))
return configs;
uni.setStorageSync(_AppConfigKey, JSON.stringify(DefaultAppConfigs))
return DefaultAppConfigs;
}
/**
* 保存应用设置
*/
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"
}
]
}
}
+1 -12
View File
@@ -1,10 +1,5 @@
import App from "./App";
import Vue from "vue";
import {
router,
RouterMount
} from './router/router.js'
Vue.use(router)
// 挂载全局工具类
import utils from "./utils/index.js";
@@ -75,10 +70,4 @@ const app = new Vue({
...App,
});
// #ifdef H5
RouterMount(app, router, '#app')
// #endif
// #ifndef H5
app.$mount(); //为了兼容小程序及app端必须这样写才有效果
// #endif
app.$mount();
+24 -26
View File
@@ -1,28 +1,26 @@
{
"name": "uni-halo",
"version": "1.0.0",
"description": "<p align=\"center\">\r <img alt=\"logo\" src=\"https://b.925i.cn/uni_halo/uni_halo_logo.png\" width=\"120\" height=\"120\" style=\"margin-bottom: 10px;\">\r </p>\r <h3 align=\"center\" style=\"margin: 30px 0 30px;font-weight: bold;font-size:40px;\">uni-halo</h3>\r <h3 align=\"center\">uni-halo 基于Halo一款现代化的开源博客/CMS系统API开发的可多端编译应用</h3>",
"repository": {
"type": "git",
"url": "git+https://gitee.com/ialley-workshop-open/uni-halo.git"
},
"keywords": [
"uni-halo",
"小莫唐尼",
"巷子工坊"
],
"author": "巷子工坊丨小莫唐尼",
"license": "AGPL-3.0",
"bugs": {
"url": "https://gitee.com/ialley-workshop-open/uni-halo/issues"
},
"homepage": "https://uni-halo.925i.cn",
"devDependencies": {
"vue-i18n": "^9.1.10"
},
"dependencies": {
"qs": "^6.12.1",
"uni-read-pages": "^1.0.5",
"uni-simple-router": "^2.0.8-beta.4"
}
"name": "uni-halo",
"version": "1.0.0",
"description": "<p align=\"center\">\r <img alt=\"logo\" src=\"https://b.925i.cn/uni_halo/uni_halo_logo.png\" width=\"120\" height=\"120\" style=\"margin-bottom: 10px;\">\r </p>\r <h3 align=\"center\" style=\"margin: 30px 0 30px;font-weight: bold;font-size:40px;\">uni-halo</h3>\r <h3 align=\"center\">uni-halo 基于Halo一款现代化的开源博客/CMS系统API开发的可多端编译应用</h3>",
"repository": {
"type": "git",
"url": "git+https://gitee.com/ialley-workshop-open/uni-halo.git"
},
"keywords": [
"uni-halo",
"小莫唐尼",
"巷子工坊"
],
"author": "巷子工坊丨小莫唐尼",
"license": "AGPL-3.0",
"bugs": {
"url": "https://gitee.com/ialley-workshop-open/uni-halo/issues"
},
"homepage": "https://uni-halo.925i.cn",
"devDependencies": {
"vue-i18n": "^9.1.10"
},
"dependencies": {
"qs": "^6.12.1"
}
}
+5 -24
View File
@@ -107,7 +107,7 @@
{
"path": "article-detail/article-detail",
"style": {
"navigationBarTitleText": "文章详情",
"navigationBarTitleText": "内容详情",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
@@ -163,7 +163,7 @@
{
"path": "archives/archives",
"style": {
"navigationBarTitleText": "文章归档",
"navigationBarTitleText": "归档",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
@@ -185,24 +185,11 @@
}
}
}
},
{
"path": "journal/journal",
"style": {
"navigationBarTitleText": "个人日记",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
"color": "#03a9f4",
"style": "circle"
}
}
}
},
},
{
"path": "articles/articles",
"style": {
"navigationBarTitleText": "文章列表",
"navigationBarTitleText": "内容搜索",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
@@ -272,13 +259,7 @@
}
}
}
},
{
"path": "test-page/test-page",
"style": {
"navigationBarTitleText": ""
}
},
},
{
"path": "advertise/advertise",
"style": {
+32 -3
View File
@@ -5,17 +5,37 @@
<script>
const homePagePath = '/pages/tabbar/home/home'
const startPagePath = '/pagesA/start/start'
const articleDetailPath = '/pagesA/article-detail/article-detail';
export default {
computed: {
configs() {
return this.$tm.vx.getters().getConfigs;
}
},
onLoad() {
uni.$tm.vx.actions('config/fetchConfigs').then((res) => {
onLoad: function (options) {
uni.$tm.vx.actions('config/fetchConfigs').then(async (res) => {
if (options.scene) {
if ('' !== options.scene) {
const postId = await this.getPostIdByQRCode(options.scene);
if (postId) {
uni.redirectTo({
url: articleDetailPath + `?name=${postId}`,
animationType: 'slide-in-right'
});
}
}
}
// #ifdef MP-WEIXIN
uni.$tm.vx.commit('setWxShare', res.shareConfig);
// uni.$tm.vx.commit('setWxShare', res.shareConfig);
// #endif
// 获取mockjson
if (res.basicConfig.auditModeEnabled) {
await uni.$tm.vx.actions('config/fetchMockJson')
}
// 进入检查
this.fnCheckShowStarted();
}).catch((err) => {
uni.switchTab({
@@ -51,6 +71,15 @@ export default {
url: startPagePath
});
}
},
async getPostIdByQRCode(key) {
const response = await this.$httpApi.v2.getQRCodeInfo(key);
if (response) {
if (response && response.postId) {
return response.postId;
}
}
return null;
}
}
};
+49 -73
View File
@@ -22,7 +22,7 @@
<tm-flop :startVal="0" :decimals="0" :endVal="statistics.post"
:duration="3000"></tm-flop>
</view>
<view class="mt-6 text-align-center text-size-s text-grey-darken-1">文章总数</view>
<view class="mt-6 text-align-center text-size-s text-grey-darken-1">内容数量</view>
</view>
<view class="item flex-1 text-align-center">
<view class="number text-size-xl text-bg-gradient-green-accent">
@@ -132,43 +132,39 @@ export default {
haloConfigs() {
return this.$tm.vx.getters().getConfigs
},
calcDefaultImageConfig() {
return this.haloConfigs.imagesConfig
pageConfig() {
return this.haloConfigs.pageConfig.aboutConfig;
},
postDetailConfig() {
return this.haloConfigs.basicConfig.postDetailConfig;
},
bloggerInfo() {
return this.haloConfigs.authorConfig.blogger;
},
calcProfileStyle() {
const _imgUrlOr = this.calcDefaultImageConfig.aboutProfileImageUrl;
const _imgUrlOr = this.pageConfig.bgImageUrl;
return {
backgroundImage: `url(${this.$utils.checkImageUrl(_imgUrlOr)})`
}
},
calcWaveUrl() {
return this.$utils.checkImageUrl(this.calcDefaultImageConfig.waveImageUrl);
return this.$utils.checkImageUrl(this.pageConfig.waveImageUrl);
},
copyrightConfig() {
return this.haloConfigs.basicConfig.copyrightConfig;
}
},
watch: {
globalAppSettings: {
deep: true,
handler(val) {
this.statisticsShowMore = val.about.showAllCount;
this.fnGetNavList();
}
},
haloConfigs: {
handler(val) {
if (!val) return;
this.fnGetNavList();
},
deep: true,
immediate: true,
handler(val) {
this.fnGetNavList();
}
}
},
created() {
this.statisticsShowMore = this.globalAppSettings.about.showAllCount;
this.fnGetData();
},
onPullDownRefresh() {
@@ -181,37 +177,38 @@ export default {
// #ifdef MP-WEIXIN
_isWx = true;
// #endif
this.navList = [{
key: 'archives',
title: '文章归档',
leftIcon: 'halocoloricon-classify',
leftIconColor: 'red',
rightText: '已归档的文章',
path: '/pagesA/archives/archives',
isAdmin: false,
type: 'page',
show: false
}, {
key: 'love',
title: '恋爱日记',
leftIcon: 'halocoloricon-attent',
leftIconColor: 'red',
rightText: '甜蜜恋人的专属',
path: '/pagesA/love/love',
isAdmin: false,
type: 'page',
show: this.haloConfigs.loveConfig.loveEnabled
}, {
key: 'disclaimers',
title: '友情链接',
leftIcon: 'icon-lianjie',
leftIconColor: 'blue',
rightText: '看看朋友们吧',
path: '/pagesA/friend-links/friend-links',
isAdmin: false,
type: 'page',
show: true
},
this.navList = [
{
key: 'archives',
title: this.haloConfigs.basicConfig.auditModeEnabled ? '内容归档' : '文章归档',
leftIcon: 'halocoloricon-classify',
leftIconColor: 'red',
rightText: this.haloConfigs.basicConfig.auditModeEnabled ? '已归档的内容' : '已归档的文章',
path: '/pagesA/archives/archives',
isAdmin: false,
type: 'page',
show: true
}, {
key: 'love',
title: '恋爱日记',
leftIcon: 'halocoloricon-attent',
leftIconColor: 'red',
rightText: '甜蜜恋人的专属',
path: '/pagesA/love/love',
isAdmin: false,
type: 'page',
show: this.haloConfigs.loveConfig.loveEnabled
}, {
key: 'disclaimers',
title: '友情链接',
leftIcon: 'icon-lianjie',
leftIconColor: 'blue',
rightText: '看看朋友们吧',
path: '/pagesA/friend-links/friend-links',
isAdmin: false,
type: 'page',
show: true
},
{
key: 'disclaimers',
title: '免责声明',
@@ -232,7 +229,7 @@ export default {
path: '/pagesA/contact/contact',
isAdmin: false,
type: 'page',
show: true
show: this.haloConfigs.authorConfig.social.enabled
},
{
key: 'session',
@@ -291,28 +288,7 @@ export default {
// type: 'poup',
// 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: this.globalAppSettings.about.showAdmin
}
];
},
fnGetData() {
@@ -406,9 +382,9 @@ export default {
break;
}
} else if (type == 'page') {
this.$Router.push({
path: path
});
uni.navigateTo({
url: path
})
}
},
+239 -188
View File
@@ -1,207 +1,258 @@
<template>
<view class="app-page">
<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>
</view>
<!-- 内容区域 -->
<view v-else class="app-page-content">
<view v-if="dataList.length == 0" class="content-empty flex flex-center" style="height: 70vh;">
<!-- 空布局 -->
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
</view>
<block v-else>
<tm-translate v-for="(item, index) in dataList" :key="index"
style="box-sizing: border-box;width: 50%;padding: 0 8rpx;" animation-name="fadeUp"
:wait="calcAniWait(index)">
<view class="catgory-card" :style="{backgroundImage:`url(${item.spec.cover})`}">
<view class="content" @click="handleToCategory(item)">
<view style="font-size: 32rpx;color: #ffffff;">{{ item.spec.displayName }}</view>
<view style="font-size: 24rpx;color: #ffffff;margin-top: 6rpx;">
{{ item.postCount }} 篇文章
</view>
</view>
</view>
</tm-translate>
<tm-flotbutton @click="fnToTopPage" size="m" color="light-blue" icon="icon-angle-up"></tm-flotbutton>
<view class="load-text">{{ loadMoreText }}</view>
</block>
</view>
</view>
<view class="app-page">
<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>
</view>
<!-- 内容区域 -->
<view v-else class="app-page-content">
<view v-if="dataList.length === 0" class="content-empty flex flex-center" style="height: 70vh;">
<!-- 空布局 -->
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
</view>
<block v-else>
<tm-translate v-for="(item, index) in dataList" :key="index"
style="box-sizing: border-box;width: 50%;padding: 0 8rpx;" animation-name="fadeUp"
:wait="calcAniWait(index)">
<view class="catgory-card" :style="{backgroundImage:`url(${item.spec.cover})`}">
<view class="content" @click="handleToCategory(item)">
<view style="font-size: 32rpx;color: #ffffff;">{{ item.spec.displayName }}</view>
<view v-if="!haloConfigs.basicConfig.auditModeEnabled" style="font-size: 24rpx;color: #ffffff;margin-top: 6rpx;">
{{ item.postCount }} 篇文章
</view>
<view v-else style="font-size: 24rpx;color: #ffffff;margin-top: 6rpx;">
{{ item.postCount }} 篇内容
</view>
</view>
</view>
</tm-translate>
<tm-flotbutton @click="fnToTopPage" size="m" color="light-blue"
icon="icon-angle-up"></tm-flotbutton>
<view class="load-text">{{ loadMoreText }}</view>
</block>
</view>
</view>
</template>
<script>
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
import MarkdownConfig from '@/common/markdown/markdown.config.js';
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
import MarkdownConfig from '@/common/markdown/markdown.config.js';
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
export default {
components: {
tmSkeleton,
tmFlotbutton,
tmTranslate,
tmEmpty,
mpHtml
},
data() {
return {
markdownConfig: MarkdownConfig,
loading: 'loading',
queryParams: {
size: 20,
page: 1
},
hasNext: false,
dataList: [],
isLoadMore: false,
loadMoreText: '加载中...'
};
},
export default {
components: {
tmSkeleton,
tmFlotbutton,
tmTranslate,
tmEmpty,
mpHtml
},
data() {
return {
markdownConfig: MarkdownConfig,
loading: 'loading',
queryParams: {
size: 20,
page: 1
},
hasNext: false,
dataList: [],
isLoadMore: false,
loadMoreText: '加载中...'
};
},
computed: {
haloConfigs() {
return this.$tm.vx.getters().getConfigs;
},
mockJson() {
return this.$tm.vx.getters().getMockJson;
}
},
onLoad() {
this.fnGetData();
},
onPullDownRefresh() {
this.isLoadMore = false;
this.queryParams.page = 0;
this.fnGetData();
},
onLoad() {
this.fnGetData();
},
onPullDownRefresh() {
this.isLoadMore = false;
this.queryParams.page = 0;
this.fnGetData();
},
onReachBottom(e) {
if (this.haloConfigs.basicConfig.auditModeEnabled) {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
return
}
if (this.hasNext) {
this.queryParams.page += 1;
this.isLoadMore = true;
this.fnGetData();
} else {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
},
methods: {
fnGetData() {
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;
}
uni.showLoading({
mask: true,
title: '加载中...'
});
// 设置状态为加载中
if (!this.isLoadMore) {
this.loading = 'loading';
}
this.loadMoreText = '加载中...';
this.$httpApi.v2
.getCategoryList(this.queryParams)
.then(res => {
console.log('请求结果:');
console.log(res);
onReachBottom(e) {
if (this.hasNext) {
this.queryParams.page += 1;
this.isLoadMore = true;
this.fnGetData();
} else {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
},
methods: {
fnGetData() {
uni.showLoading({
mask: true,
title: '加载中...'
});
// 设置状态为加载中
if (!this.isLoadMore) {
this.loading = 'loading';
}
this.loadMoreText = '加载中...';
this.$httpApi.v2
.getCategoryList(this.queryParams)
.then(res => {
console.log('请求结果:');
console.log(res);
this.loading = 'success';
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
// 处理数据
this.hasNext = res.hasNext;
this.loading = 'success';
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
// 处理数据
this.hasNext = res.hasNext;
const tempItems = res.items.map(item => {
item.spec.cover = this.$utils.checkThumbnailUrl(item.spec.cover, true)
return item;
})
const tempItems = res.items.map(item => {
item.spec.cover = this.$utils.checkThumbnailUrl(item.spec.cover, true)
return item;
})
if (this.isLoadMore) {
this.dataList = this.dataList.concat(tempItems);
} else {
this.dataList = tempItems;
}
})
.catch(err => {
console.error(err);
this.loading = 'error';
this.loadMoreText = '加载失败,请下拉刷新!';
})
.finally(() => {
setTimeout(() => {
uni.hideLoading();
uni.stopPullDownRefresh();
}, 500);
});
},
handlePreview(index, list) {
uni.previewImage({
current: index,
urls: list.map(item => item.url)
})
},
handleToCategory(data) {
uni.navigateTo({
url: `/pagesA/category-detail/category-detail?name=${data.metadata.name}&title=${data.spec.displayName}`
})
}
}
};
if (this.isLoadMore) {
this.dataList = this.dataList.concat(tempItems);
} else {
this.dataList = tempItems;
}
})
.catch(err => {
console.error(err);
this.loading = 'error';
this.loadMoreText = '加载失败,请下拉刷新!';
})
.finally(() => {
setTimeout(() => {
uni.hideLoading();
uni.stopPullDownRefresh();
}, 500);
});
},
handlePreview(index, list) {
uni.previewImage({
current: index,
urls: list.map(item => item.url)
})
},
handleToCategory(data) {
if (this.haloConfigs.basicConfig.auditModeEnabled) {
return;
}
uni.navigateTo({
url: `/pagesA/category-detail/category-detail?name=${data.metadata.name}&title=${data.spec.displayName}`
})
}
}
};
</script>
<style lang="scss" scoped>
.app-page {
width: 100vw;
display: flex;
flex-direction: column;
padding: 24rpx 0;
}
.app-page {
width: 100vw;
display: flex;
flex-direction: column;
padding: 24rpx 0;
}
.loading-wrap {
padding: 24rpx;
}
.auditModeEnabled {
width: 100%;
height: 80vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.app-page-content {
display: flex;
flex-wrap: wrap;
padding: 0 12rpx;
gap: 20rpx 0;
}
.loading-wrap {
padding: 24rpx;
}
.catgory-card {
width: 100%;
height: 200rpx;
position: relative;
display: flex;
flex-direction: column;
box-sizing: border-box;
border-radius: 12rpx;
background-color: #ffff;
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
overflow: hidden;
background-repeat: no-repeat;
background-size: cover;
.app-page-content {
display: flex;
flex-wrap: wrap;
padding: 0 12rpx;
gap: 20rpx 0;
}
&:before {
content: '';
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.15);
z-index: 1;
}
}
.catgory-card {
width: 100%;
height: 200rpx;
position: relative;
display: flex;
flex-direction: column;
box-sizing: border-box;
border-radius: 12rpx;
background-color: #ffff;
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
overflow: hidden;
background-repeat: no-repeat;
background-size: cover;
.content {
width: 100%;
height: 100%;
position: relative;
z-index: 2;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
&:before {
content: '';
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.15);
z-index: 1;
}
}
.load-text {
width: 100%;
text-align: center;
}
</style>
.content {
width: 100%;
height: 100%;
position: relative;
z-index: 2;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.load-text {
width: 100%;
text-align: center;
}
</style>
+101 -58
View File
@@ -8,7 +8,7 @@
<!-- 占位区域 -->
<view v-if="category.list.length > 0" 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="card"></tm-skeleton>
<tm-skeleton model="card"></tm-skeleton>
<tm-skeleton model="card"></tm-skeleton>
@@ -16,17 +16,23 @@
</view>
<!-- 内容区域 -->
<view class="content" v-else>
<view v-if="dataList.length == 0" class="content-empty">
<view v-if="dataList.length === 0" class="content-empty">
<!-- 空布局 -->
<tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有分享图片~"></tm-empty>
</view>
<block v-else>
<block v-for="(item, index) in dataList" :key="index">
<tm-translate style="box-sizing: border-box;padding: 6rpx;width: 50%;height: 250rpx;"
<block v-if="galleryConfig.useWaterfall">
<!--瀑布流-->
<tm-flowLayout-custom ref="wafll" style="width: 100%;" @click="fnOnFlowClick"></tm-flowLayout-custom>
</block>
<!-- 列表 -->
<block v-else>
<tm-translate v-for="(item, index) in dataList" :key="index"
style="box-sizing: border-box;padding: 6rpx;width: 50%;height: 250rpx;"
animation-name="fadeUp" :wait="calcAniWait(index)">
<view style="border-radius: 12rpx;overflow: hidden;width: 100%;height: 250rpx;">
<image style="width: 100%;height: 100%;" mode="aspectFill" :src="item.spec.cover"
@click="fnPreview(index)"/>
<image style="width: 100%;height: 100%;" mode="aspectFill" :src="item.spec.url"
@click="fnPreview(item)"/>
</view>
</tm-translate>
</block>
@@ -34,6 +40,7 @@
<tm-flotbutton @click="fnToTopPage" color="light-blue" size="m" icon="icon-angle-up"></tm-flotbutton>
<view class="load-text">{{ loadMoreText }}</view>
</block>
</view>
</view>
</template>
@@ -46,10 +53,13 @@ import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
import tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue';
import tmFlowLayout from '@/tm-vuetify/components/tm-flowLayout/tm-flowLayout.vue';
import tmFlowLayoutCustom from '@/tm-vuetify/components/tm-flowLayout-custom/tm-flowLayout-custom.vue';
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
export default {
options: {
multipleSlots: true
},
components: {
tmSkeleton,
tmTranslate,
@@ -58,7 +68,7 @@ export default {
tmEmpty,
tmIcons,
tmImages,
tmFlowLayout,
tmFlowLayoutCustom,
tmTabs
},
data() {
@@ -75,36 +85,52 @@ export default {
page: 1,
group: ""
},
cache: {
dataList: [],
total: 0
},
isLoadMore: false,
loadMoreText: '',
hasNext: false,
dataList: []
};
},
filters: {
filterTakeTime(val) {
return uni.$tm.dayjs(val).format('DD/MM/YYYY');
computed: {
galleryConfig() {
return this.$tm.vx.getters().getConfigs.pageConfig.galleryConfig;
},
haloConfigs() {
return this.$tm.vx.getters().getConfigs;
},
mockJson() {
return this.$tm.vx.getters().getMockJson;
}
},
onLoad() {
this.fnSetPageTitle('个人图库');
this.fnGetCategory();
watch: {
galleryConfig: {
handler(newValue, oldValue) {
if (!newValue) return;
this.fnSetPageTitle(newValue.pageTitle);
this.fnGetCategory();
},
deep: true,
immediate: true
}
},
onPullDownRefresh() {
this.dataList = []
this.isLoadMore = false;
this.queryParams.page = 1;
this.fnGetData();
this.fnGetData(true);
},
onReachBottom(e) {
if (this.haloConfigs.basicConfig.auditModeEnabled) {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
return;
}
if (this.hasNext) {
this.queryParams.page += 1;
this.isLoadMore = true;
this.fnGetData();
this.fnGetData(false);
} else {
uni.showToast({
icon: 'none',
@@ -115,17 +141,20 @@ export default {
methods: {
fnOnCategoryChange(index) {
this.fnResetSetAniWaitIndex();
this.cache.dataList = []
this.dataList = [];
this.queryParams.group = this.category.list[index].name;
this.queryParams.page = 1;
this.fnToTopPage();
this.fnGetData();
this.dataList = [];
this.fnGetData(true);
},
fnGetCategory() {
if (this.haloConfigs.basicConfig.auditModeEnabled) {
this.fnGetData(true);
return
}
this.$httpApi.v2.getPhotoGroupList({
page: 1,
size: 9999
size: 0
}).then(res => {
this.category.list = res.items.map(item => {
return {
@@ -135,12 +164,41 @@ export default {
});
if (this.category.list.length !== 0) {
this.queryParams.group = this.category.list[0].name;
this.fnGetData();
this.fnGetData(true);
}
});
},
fnGetData() {
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) {
this.loading = 'loading';
@@ -149,28 +207,32 @@ export default {
this.$httpApi.v2
.getPhotoListByGroupName(this.queryParams)
.then(res => {
console.log("相册 res", res)
this.hasNext = res.hasNext;
this.loading = 'success';
if (res.items.length != 0) {
if (res.items.length !== 0) {
const _list = res.items.map((item, index) => {
item.spec.cover = this.$utils.checkImageUrl(item.spec.cover);
item.spec.url = this.$utils.checkImageUrl(item.spec.url || item.spec.cover);
return item;
});
this.fnCacheDataList(_list);
if (this.isLoadMore) {
this.dataList = this.dataList.concat(_list);
} else {
this.dataList = _list;
}
if (this.galleryConfig.useWaterfall) {
this.$nextTick(() => {
if (isClearWaterfall) {
this.$refs.wafll.clear()
}
this.$refs.wafll.pushData(_list)
})
}
}
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
})
.catch(err => {
console.error(err);
this.loading = 'error';
this.waterfall.loading = 'finish';
this.loadMoreText = '加载失败,请下拉刷新!';
})
.finally(() => {
@@ -180,24 +242,14 @@ export default {
}, 500);
});
},
// 缓存数据
fnCacheDataList(dataList) {
if (this.queryParams.page == 1) {
this.cache.dataList = dataList;
} else {
this.cache.dataList = [...this.cache.dataList, ...dataList];
}
},
// 瀑布流组件点击事件
fnOnClick(data) {
console.log('点击数据', data);
fnOnFlowClick({item}) {
this.fnPreview(item)
},
// 预览
fnPreview(index) {
fnPreview(data) {
uni.previewImage({
current: index,
urls: this.dataList.map(x => x.spec.cover),
current: this.dataList.findIndex(x => x.metadata.name === data.metadata.name),
urls: this.dataList.map(x => x.spec.url),
indicator: 'number',
loop: true
});
@@ -214,18 +266,13 @@ export default {
flex-direction: column;
padding-bottom: 24rpx;
background-color: #fafafa;
&.is-balck {
background-color: #212121;
}
}
.content {
display: flex;
flex-wrap: wrap;
box-sizing: border-box;
padding: 0 24rpx;
padding-top: 24rpx;
padding: 24rpx 24rpx 0;
gap: 12rpx 0;
.content-empty {
@@ -242,10 +289,6 @@ export default {
padding: 24rpx;
}
.card {
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.03);
}
.load-text {
width: 100%;
text-align: center;
+131 -42
View File
@@ -2,14 +2,14 @@
<view class="app-page">
<tm-menubars iconColor="white" color="white" :flat="true" :showback="false">
<view slot="left">
<image 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 class="search-input round-12 pt-12 pb-12 flex pl-24" @click="fnToSearch">
<text class="search-input_icon iconfont text-size-m icon-search text-grey"></text>
<view class="search-input_text pl-12 text-size-m text-grey">搜索文章...</view>
<view class="search-input_text pl-12 text-size-m text-grey">搜索内容...</view>
</view>
<!-- #ifdef APP-PLUS || H5 -->
<view slot="right" class="mr-24 text-size-m text-grey">uni-halo</view>
<view slot="right" class="mr-24 text-size-m text-grey text-overflow">{{ appInfo.name }}</view>
<!-- #endif -->
</tm-menubars>
<view v-if="loading !== 'success' && articleList.length===0" class="loading-wrap">
@@ -22,37 +22,41 @@
</view>
<block v-else>
<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"
:useDot="globalAppSettings.banner.useDot" :list="bannerList"
@on-click="fnOnBannerClick"></e-swiper>
</view>
</view>
<view class="flex flex-between mt-16 mb-24 pl-24 pr-24">
<view class="page-item_title text-weight-b ">精品分类</view>
<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>
</view>
<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="iconfont icon-angle-right text-size-s "></text>
</view>
</view>
<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>
<block v-else>
<view class="content" v-for="(category, index) in categoryList" :key="category.metadata.name"
@click="fnToCategoryBy(category)">
<category-mini-card :category="category"></category-mini-card>
<!-- 精品分类 -->
<block v-if="calcIsShowCategory">
<view class="flex flex-between mt-16 mb-24 pl-24 pr-24">
<view class="page-item_title text-weight-b ">精品分类</view>
<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>
</view>
</block>
</scroll-view>
<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="iconfont icon-angle-right text-size-s "></text>
</view>
</view>
<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>
<block v-else>
<view class="content" v-for="(category, index) in categoryList" :key="category.metadata.name"
@click="fnToCategoryBy(category)">
<category-mini-card :category="category"></category-mini-card>
</view>
</block>
</scroll-view>
</block>
<!-- 最新文章 -->
<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">
<text class="iconfont icon-angle-right text-size-s text-grey-darken-1"></text>
</view>
@@ -61,9 +65,8 @@
<text class="iconfont icon-angle-right text-size-s "></text>
</view>
</view>
<view v-if="articleList.length == 0" class="article-empty">
<tm-empty icon="icon-shiliangzhinengduixiang-"
label="博主还没有发表任何文章~"></tm-empty>
<view v-if="articleList.length === 0" class="article-empty">
<tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有发表任何内容~"></tm-empty>
</view>
<block v-else>
<view :class="globalAppSettings.layout.home">
@@ -133,12 +136,23 @@ export default {
const appInfo = this.haloConfigs.appConfig.appInfo;
appInfo.logo = this.$utils.checkImageUrl(appInfo.logo)
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() {
this.fnSetPageTitle();
},
created() {
this.fnQuery();
},
@@ -147,8 +161,14 @@ export default {
this.queryParams.page = 1;
this.fnQuery();
},
onReachBottom(e) {
if (this.haloConfigs.basicConfig.auditModeEnabled) {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
return
}
if (this.result.hasNext) {
this.queryParams.page += 1;
this.isLoadMore = true;
@@ -162,12 +182,32 @@ export default {
},
methods: {
fnQuery() {
console.log('this.mockJson', this.mockJson)
this.fnGetBanner();
this.fnGetArticleList();
this.fnGetCategoryList();
},
fnGetCategoryList() {
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;
}
if (!this.calcIsShowCategory) {
return;
}
this.$httpApi.v2
.getCategoryList({})
.then(res => {
@@ -192,6 +232,22 @@ export default {
},
// 获取轮播图
fnGetBanner() {
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;
}
const _this = this;
const _format = function (list) {
return list.map((item, index) => {
@@ -199,12 +255,12 @@ export default {
mp4: '',
id: item.metadata.name,
nickname: item.owner.displayName,
avatar: _this.$utils.checkImageUrl(item.owner.avatar),
avatar: _this.$utils.checkAvatarUrl(item.owner.avatar),
address: '',
createTime: uni.$tm.dayjs(item.spec.publishTime).fromNow(),
title: item.spec.title,
src: _this.$utils.checkImageUrl(item.spec.cover),
image: _this.$utils.checkImageUrl(item.spec.cover)
src: _this.$utils.checkThumbnailUrl(item.spec.cover),
image: _this.$utils.checkThumbnailUrl(item.spec.cover)
};
});
};
@@ -219,7 +275,6 @@ export default {
uni.request({
url: this.$baseApiUrl + '/apis/api.content.halo.run/v1alpha1/posts?' + paramsStr,
method: 'GET',
params: this.queryParams,
success: (res) => {
this.bannerList = _format(res.data.items);
},
@@ -232,7 +287,10 @@ export default {
this.bannerCurrent = e.current;
},
fnOnBannerClick(item) {
if (item.id == '') return;
if (this.haloConfigs.basicConfig.auditModeEnabled) {
return;
}
if (item.id === '') return;
this.fnToArticleDetail({
metadata: {
name: item.id
@@ -241,10 +299,32 @@ export default {
},
// 文章列表
fnGetArticleList() {
// uni.showLoading({
// mask: true,
// title: '加载中...'
// });
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) {
this.loading = 'loading';
@@ -261,7 +341,6 @@ export default {
uni.request({
url: this.$baseApiUrl + '/apis/api.content.halo.run/v1alpha1/posts?' + paramsStr,
method: 'GET',
params: this.queryParams,
success: (res) => {
const data = res.data;
this.result.hasNext = data.hasNext;
@@ -283,9 +362,11 @@ export default {
}
})
},
//跳转文章详情
fnToArticleDetail(article) {
if (this.haloConfigs.basicConfig.auditModeEnabled) {
return;
}
uni.navigateTo({
url: '/pagesA/article-detail/article-detail?name=' + article.metadata.name,
animationType: 'slide-in-right'
@@ -321,6 +402,9 @@ export default {
// 根据slug查询分类下的文章
fnToCategoryBy(category) {
if (this.haloConfigs.basicConfig.auditModeEnabled) {
return;
}
uni.navigateTo({
url: `/pagesA/category-detail/category-detail?name=${category.metadata.name}&title=${category.spec.displayName}`
});
@@ -339,6 +423,11 @@ export default {
uni.navigateTo({
url: '/pagesA/articles/articles'
});
},
fnOnLogoToPage() {
uni.switchTab({
url: '/pages/tabbar/about/about'
})
}
}
};
+66 -13
View File
@@ -1,13 +1,13 @@
<template>
<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>
</view>
<!-- 内容区域 -->
<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>
</view>
@@ -37,13 +37,21 @@
:content="moment.spec.content.html" :markdown="true" :showLineNumber="true"
:showLanguageName="true" :copyByLongPress="true"/>
</view>
<view v-if="moment.spec.content.medium.length!==0" class="images"
:class="['images-'+moment.spec.content.medium.length]">
<view class="image-item" v-for="(image,mediumIndex) in moment.spec.content.medium"
<view class="mb-12 mt--12" v-if="moment.videos.length!==0"
style="display: flex; flex-direction: column; gap: 12rpx 0;padding: 0 24rpx; ">
<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">
<image mode="aspectFill" style="width: 100%;height: 100%;border-radius: 6rpx;"
:src="image.url"
@click="handlePreview(mediumIndex,moment.spec.content.medium)"/>
@click="handlePreview(mediumIndex,moment.images)"/>
</view>
</view>
</view>
@@ -93,6 +101,12 @@ export default {
let blogger = this.$tm.vx.getters().getConfigs.authorConfig.blogger;
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
return blogger;
},
haloConfigs() {
return this.$tm.vx.getters().getConfigs;
},
mockJson() {
return this.$tm.vx.getters().getMockJson;
}
},
@@ -106,6 +120,13 @@ export default {
},
onReachBottom(e) {
if (this.haloConfigs.basicConfig.auditModeEnabled) {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
return
}
if (this.hasNext) {
this.queryParams.page += 1;
this.isLoadMore = true;
@@ -119,6 +140,37 @@ export default {
},
methods: {
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({
mask: true,
title: '加载中...'
@@ -131,9 +183,6 @@ export default {
this.$httpApi.v2
.getMomentList(this.queryParams)
.then(res => {
console.log('请求结果:');
console.log(res);
this.loading = 'success';
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
this.hasNext = res.hasNext;
@@ -143,11 +192,15 @@ export default {
displayName: this.bloggerInfo.nickname,
avatar: this.$utils.checkAvatarUrl(this.bloggerInfo.avatar)
}
item.spec.content.medium
item.spec.content.medium.map(medium => {
medium.url = this.$utils.checkThumbnailUrl(medium.url, true)
})
item['images'] = item.spec.content.medium
.filter(x => x.type === 'PHOTO')
.map(medium => {
medium.url = this.$utils.checkThumbnailUrl(medium.url, true)
})
item['videos'] = item.spec.content.medium
.filter(x => x.type === 'VIDEO')
return item;
})
-135
View File
@@ -1,135 +0,0 @@
<template>
<view class="app-page">
<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>
</view>
<!-- 内容区域 -->
<view v-else class="app-page-content">
<view v-if="dataList.length == 0" class="content-empty flex flex-center">
<!-- 空布局 -->
<tm-empty icon="icon-shiliangzhinengduixiang-" label="该分类下暂无数据"></tm-empty>
</view>
<block v-else>
<block v-for="(item, index) in dataList" :key="index">
<!-- 卡片 -->
<tm-translate animation-name="fadeUp" :wait="(index + 1) * 50">
<!-- 列表项 -->
{{ item }}
</tm-translate>
</block>
<tm-flotbutton @click="fnToTopPage" size="m" color="light-blue" icon="icon-angle-up"></tm-flotbutton>
<view class="load-text">{{ loadMoreText }}</view>
</block>
</view>
</view>
</template>
<script>
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
export default {
components: {
tmSkeleton,
tmFlotbutton,
tmTranslate,
tmEmpty
},
data() {
return {
loading: 'loading',
queryParams: {
size: 10,
page: 0
},
result: null,
dataList: [],
hasNext:false,
isLoadMore: false,
loadMoreText: '加载中...'
};
},
onLoad() {
this.fnSetPageTitle();
},
created() {
this.fnGetData();
},
onPullDownRefresh() {
this.isLoadMore = false;
this.queryParams.page = 0;
this.fnGetData();
},
onReachBottom(e) {
if (this.result.hasNext) {
this.queryParams.page += 1;
this.isLoadMore = true;
this.fnGetData();
} else {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
},
methods: {
fnGetData() {
return;
uni.showLoading({
mask: true,
title: '加载中...'
});
// 设置状态为加载中
if (!this.isLoadMore) {
this.loading = 'loading';
}
this.loadMoreText = '加载中...';
this.$httpApi
.getXXX(this.queryParams)
.then(res => {
console.log('请求结果:');
console.log(res);
this.loading = 'success';
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
// 处理数据
this.result = res.data;
if (this.isLoadMore) {
this.dataList = this.dataList.concat(res.data.content);
} else {
this.dataList = res.data.content;
}
})
.catch(err => {
console.error(err);
this.loading = 'error';
this.loadMoreText = '加载失败,请下拉刷新!';
})
.finally(() => {
setTimeout(() => {
uni.hideLoading();
uni.stopPullDownRefresh();
}, 500);
});
}
}
};
</script>
<style lang="scss" scoped>
.app-page {
width: 100vw;
display: flex;
flex-direction: column;
padding: 24rpx 0;
padding-bottom: 144rpx;
}
.loading-wrap {
padding: 24rpx;
}
</style>
+4 -4
View File
@@ -55,8 +55,8 @@ export default {
}
},
computed: {
adConfigs() {
return this.$tm.vx.getters().getConfigs.adConfig;
toolsPluginConfigs() {
return this.$tm.vx.getters().getConfigs?.pluginConfig?.toolsPlugin || {};
}
},
onLoad(options) {
@@ -76,7 +76,7 @@ export default {
adLoad() {
if (wx.createRewardedVideoAd) {
videoAd = wx.createRewardedVideoAd({
adUnitId: this.adConfigs.rewardedVideoAdId //你的广告key
adUnitId: this.toolsPluginConfigs.rewardedVideoAdId //你的广告key
})
videoAd.onError(err => {
})
@@ -91,7 +91,7 @@ export default {
}
},
openVideoAd: function () {
if (videoAd && this.adConfigs.rewardedVideoAdId != '') {
if (videoAd && this.toolsPluginConfigs.rewardedVideoAdId !== '') {
videoAd.show().catch(err => {
// 失败重试
console.log("广告拉取失败")
+279 -61
View File
@@ -1,13 +1,15 @@
<template>
<view class="app-page">
<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 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>
@@ -15,46 +17,55 @@
<!-- 加载完成区域 -->
<block v-else>
<view v-if="dataList.length == 0" class="list-empty flex flex-center">
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无归档的文章"></tm-empty>
<view v-if="dataList.length === 0" class="list-empty flex flex-center">
<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 v-else class="e-timeline tm-timeline mt-24">
<block v-for="(item, index) in dataList" :key="index">
<view class="tm-timeline-item tm-timeline-item--leftDir">
<view style="width: 160rpx;">
<view :style="{ width: '24rpx', height: '24rpx' }" :class="[black_tmeme ? 'bk' : '']"
class="flex-center rounded tm-timeline-jidian border-white-a-2 grey-lighten-2 light-blue shadow-primary-4"></view>
class="flex-center rounded tm-timeline-jidian border-white-a-2 grey-lighten-2 light-blue shadow-primary-4">
</view>
<view :style="{ marginTop: '-24rpx' }"
:class="[index !== dataList.length - 1 ? 'tm-timeline-item-boder' : '', black_tmeme ? 'bk' : '']"
class="grey-lighten-2"></view>
</view>
<view class="tm-timeline-item-content relative">
<view class="tm-timeline-item-left">
<view class="time text-weight-b mb-24">
{{ item.year }}
<block v-if="tab.activeIndex == 0">{{ item.month }}</block>
<text class="text-size-s text-grey-darken-1 ml-24">共发布 {{ item.posts.length }} 篇文章</text>
<view class="flex time text-weight-b mb-24">
<text>{{ item.year }}</text>
<text v-if="tab.activeIndex === 0">{{ item.month }}</text>
<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 }} 篇文章
</view>
</view>
<block v-if="item.posts.length != 0">
<block v-for="(post, postIndex) in item.posts" :key="post.id">
<tm-translate animation-name="fadeUp" :wait="calcAniWait(postIndex)">
<view class="flex post shadow-3 pa-24 mb-24" :class="[globalAppSettings.layout.cardType]"
@click="fnToArticleDetail(post)">
<image class="post-thumbnail" :src="$utils.checkThumbnailUrl(post.thumbnail)"
mode="aspectFill"></image>
<view class="post-info pl-20">
<view class="post-info_title text-overflow">{{ post.title }}</view>
<view class="post-info_summary text-overflow-2 mt-12 text-size-s text-grey-darken-1">
{{ post.summary }}
</view>
<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="time-label">发布时间</text>
{{ {d: post.createTime, f: 'yyyy年MM月dd日 星期w'} | formatTime }}
</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)">
<image class="post-thumbnail"
:src="$utils.checkThumbnailUrl(post.spec.cover)" mode="aspectFill">
</image>
<view class="post-info pl-20">
<view class="post-info_title text-overflow">{{ post.spec.title }}
</view>
<view
class="post-info_summary text-overflow-2 mt-12 text-size-s text-grey-darken-1">
{{ post.status.excerpt }}
</view>
<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="time-label">发布时间</text>
{{ {d: post.spec.publishTime, f: 'yyyy年MM月dd日 星期w'} | formatTime }}
</view>
</view>
</tm-translate>
</view>
</block>
</block>
<view v-else class="post-empty text-size-m text-grey-darken-1">该日期下暂无归档文章</view>
@@ -63,8 +74,10 @@
</view>
</block>
</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>
</view>
</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 tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
import qs from 'qs'
export default {
components: {
@@ -93,11 +107,13 @@ export default {
},
queryParams: {
size: 10,
page: 0
page: 1
},
result: null,
dataList: [],
api: 'getMonthArchives'
result: {},
cacheDataList: [], // 所有请求的缓存数据
dataList: [], // 显示的数据
isLoadMore: false,
loadMoreText: "加载中..."
};
},
computed: {
@@ -106,53 +122,242 @@ export default {
},
color_tmeme: function () {
return this.$tm.vx.state().tmVuetify.color;
},
haloConfigs() {
return this.$tm.vx.getters().getConfigs;
},
mockJson() {
return this.$tm.vx.getters().getMockJson;
}
},
created() {
this.fnGetData();
},
onPullDownRefresh() {
this.isLoadMore = false;
this.queryParams.page = 1;
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: {
fnOnTabChange(index) {
this.fnResetSetAniWaitIndex();
const _api = ['getMonthArchives', 'getYearArchives'];
this.api = _api[index];
this.queryParams.page = 0;
this.fnGetData();
this.dataList = this.handleGetShowDataList(this.handleGetPosts(this.cacheDataList))
this.fnToTopPage();
},
fnGetData() {
this.loading = 'loading';
// uni.showLoading({
// mask: true,
// title: '加载中...'
// });
this.$httpApi[this.api](this.queryParams)
.then(res => {
this.result = res.data;
this.dataList = res.data;
setTimeout(() => {
this.loading = 'success';
}, 500);
})
.catch(err => {
console.error(err);
this.loading = 'error';
})
.finally(() => {
setTimeout(() => {
uni.hideLoading();
uni.stopPullDownRefresh();
}, 500);
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;
}
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) {
if (this.haloConfigs.basicConfig.auditModeEnabled) {
return;
}
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'
});
}
@@ -169,6 +374,15 @@ export default {
background-color: #fafafd;
}
.auditModeEnabled {
width: 100%;
height: 80vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.loading-wrap {
padding: 24rpx;
}
@@ -376,4 +590,8 @@ export default {
}
}
}
.time {
align-items: center;
}
</style>
File diff suppressed because it is too large Load Diff
+17 -30
View File
@@ -22,11 +22,11 @@
<!-- 空布局 -->
<tm-empty v-if="!queryParams.keyword" icon="icon-shiliangzhinengduixiang-" label="请输入关键词搜索"></tm-empty>
<tm-empty v-else icon="icon-shiliangzhinengduixiang-"
:label="`未搜到 ${queryParams.keyword} 相关文章`"></tm-empty>
:label="`未搜到 ${queryParams.keyword} 相关内容`"></tm-empty>
</view>
<block v-else>
<!-- 文章卡片 -->
<tm-translate v-for="(article, index) in dataList" :key="article.name" animation-name="fadeUp"
<tm-translate v-for="(article, index) in dataList" :key="article.metadataName" animation-name="fadeUp"
:wait="calcAniWait(index)">
<view class="article-card" @click="fnToArticleDetail(article)">
<rich-text style="font-size: 32rpx;font-weight: bold;color: #333;"
@@ -34,13 +34,13 @@
<rich-text style="font-size: 28rpx;margin-top: 16rpx;color: #555;"
:nodes="article.content"></rich-text>
<text style="font-size: 24rpx;margin-top: 24rpx;color:#888">
发布日期{{ {d: article.publishTimestamp, f: 'yyyy年MM月dd日'} | formatTime }}
最近更新{{ {d: article.updateTimestamp, f: 'yyyy年MM月dd日 HH点mm分ss秒'} | formatTime }}
</text>
</view>
</tm-translate>
<tm-flotbutton @click="fnToTopPage" size="m" color="light-blue" icon="icon-angle-up"></tm-flotbutton>
<view class="load-text">{{ loadMoreText }}</view>
</block>
</view>
</view>
@@ -81,14 +81,16 @@ export default {
dataList: [],
total: 0
},
hasNext: false,
isLoadMore: false,
loadMoreText: '加载中...',
dataList: []
};
},
computed: {
haloConfigs() {
return this.$tm.vx.getters().getConfigs;
},
},
onLoad() {
this.fnSetPageTitle('文章列表');
this.fnSetPageTitle('内容搜索');
},
created() {
if (!this.queryParams.keyword) {
@@ -99,7 +101,6 @@ export default {
},
onPullDownRefresh() {
this.fnResetSetAniWaitIndex();
this.isLoadMore = false;
this.fnGetData();
},
@@ -121,7 +122,7 @@ export default {
},
fnOnSearch() {
this.fnResetSetAniWaitIndex();
this.isLoadMore = false;
if (!this.queryParams.keyword) {
this.dataList = []
} else {
@@ -129,34 +130,20 @@ export default {
}
},
fnGetData() {
// uni.showLoading({
// mask: true,
// title: '加载中...'
// });
// 设置状态为加载中
if (!this.isLoadMore) {
this.loading = 'loading';
if (this.haloConfigs.basicConfig.auditModeEnabled) {
return;
}
this.loadMoreText = '加载中...';
// 设置状态为加载中
this.loading = 'loading';
this.$httpApi.v2
.getPostListByKeyword(this.queryParams)
.then(res => {
console.log('请求结果:');
console.log(res);
this.loading = 'success';
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
this.hasNext = res.hasNext;
if (this.isLoadMore) {
this.dataList = this.dataList.concat(res.hits);
} else {
this.dataList = res.hits;
}
this.dataList = res.hits;
})
.catch(err => {
console.error(err);
this.loading = 'error';
this.loadMoreText = '加载失败,请下拉刷新!';
})
.finally(() => {
setTimeout(() => {
@@ -169,7 +156,7 @@ export default {
//跳转文章详情
fnToArticleDetail(article) {
uni.navigateTo({
url: '/pagesA/article-detail/article-detail?name=' + article.name,
url: '/pagesA/article-detail/article-detail?name=' + article.metadataName,
animationType: 'slide-in-right'
});
}
+29 -19
View File
@@ -26,7 +26,6 @@
<!-- 社交联系方式列表 -->
<view class="contact ma-50 mt-0 pt-12">
<block v-if="calcIsNotEmpty">
<block v-for="(item, index) in result" :key="index">
<view v-if="item.value" class="item mt-24 flex" @click="fnOnClick(item)">
<view class="left">
@@ -37,9 +36,9 @@
</view>
</block>
</block>
<view v-else class="mt-12 pt-12">
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无联系方式"/>
</view>
<view v-else class="mt-12 pt-12">
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无联系方式"/>
</view>
</view>
</view>
</template>
@@ -137,36 +136,47 @@ export default {
return blogger;
},
socialConfig() {
return this.authorConfig.social
return this.authorConfig.social;
},
calcIsNotEmpty() {
return this.result.some((item) => item.value !== "");
}
},
watch: {
socialConfig: {
handler(newVal) {
if (!newVal) return;
this.fnGetData();
},
deep: true,
immediate: true
}
},
onLoad() {
this.fnSetPageTitle('联系博主');
},
created() {
this.fnGetData();
},
methods: {
fnGetData() {
for (let key in this.socialConfig) {
if (key === 'enabled') {
continue;
}
this.result.find(x => x.key === key).value = this.socialConfig[key];
}
},
fnOnClick(item) {
if (this.globalAppSettings.contact.isLinkCopy && this.$utils.checkIsUrl(item.value)) {
uni.navigateTo({
url: '/pagesC/website/website?data=' +
JSON.stringify({
title: item.name,
url: item.value
})
});
} else {
this.$utils.copyText(item.value, item.name + ' 已复制!');
}
this.$utils.copyText(item.value, item.name + ' 已复制!');
// if (this.globalAppSettings.contact.isLinkCopy && this.$utils.checkIsUrl(item.value)) {
// uni.navigateTo({
// url: '/pagesC/website/website?data=' +
// JSON.stringify({
// title: item.name,
// url: item.value
// })
// });
// } else {
// this.$utils.copyText(item.value, item.name + ' 已复制!');
// }
}
}
};
+9 -3
View File
@@ -152,6 +152,9 @@ export default {
};
},
computed: {
haloConfigs() {
return this.$tm.vx.getters().getConfigs;
},
haloPluginConfigs() {
return this.$tm.vx.getters().getConfigs.pluginConfig;
},
@@ -207,6 +210,9 @@ export default {
return this.linkGroupList.find(item => item.metadata.name === groupName)?.spec?.displayName || groupName || "未分组"
},
fnGetData() {
if (this.haloConfigs.basicConfig.auditModeEnabled) {
return;
}
if (!this.isLoadMore) {
this.loading = 'loading';
}
@@ -290,9 +296,9 @@ export default {
});
},
toSubmitLinkPage() {
this.$Router.push({
path: '/pagesA/submit-link/submit-link'
});
uni.navigateTo({
url: '/pagesA/submit-link/submit-link'
})
}
}
};
-137
View File
@@ -1,137 +0,0 @@
<template>
<view class="app-page">
<view v-if="loading != 'success'" class="loading-wrap pa-24">
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
</view>
<!-- 内容区域 -->
<view v-else class="app-page-content pa-24">
<view v-if="dataList.length == 0" class="content-empty flex flex-center">
<!-- 空布局 -->
<tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有写任何日记"></tm-empty>
</view>
<block v-else>
<block v-for="(journal, index) in dataList" :key="index">
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)">
<!-- 日记卡片 -->
<journal-card :journal="journal" :useLike="true"></journal-card>
</tm-translate>
</block>
<tm-flotbutton @click="fnToTopPage" color="light-blue" size="m" icon="icon-angle-up"></tm-flotbutton>
<view class="load-text">{{ loadMoreText }}</view>
</block>
</view>
</view>
</template>
<script>
import MarkdownConfig from '@/common/markdown/markdown.config.js';
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
import journalCard from '@/components/journal-card/journal-card.vue';
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
export default {
components: {mpHtml, tmSkeleton, tmEmpty, tmTranslate, tmFlotbutton, journalCard},
data() {
return {
loading: 'loading',
markdownConfig: MarkdownConfig,
queryParams: {
size: 10,
page: 0
},
dataList: [],
hasNext: false,
isLoadMore: false,
loadMoreText: '加载中...'
};
},
onLoad() {
this.fnSetPageTitle('个人日记');
},
created() {
this.fnGetData();
},
onPullDownRefresh() {
this.isLoadMore = false;
this.queryParams.page = 0;
this.fnGetData();
},
onReachBottom(e) {
if (this.hasNext) {
this.queryParams.page += 1;
this.isLoadMore = true;
this.fnGetData();
} else {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
},
methods: {
fnGetData() {
// uni.showLoading({
// mask: true,
// title: '加载中...'
// });
// 设置状态为加载中
if (!this.isLoadMore) {
this.loading = 'loading';
}
this.loadMoreText = '加载中...';
this.$httpApi
.getJournals(this.queryParams)
.then(res => {
this.loading = 'success';
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
// 处理数据
this.result = res.data;
if (this.isLoadMore) {
this.dataList = this.dataList.concat(res.data.content);
} else {
this.dataList = res.data.content;
}
this.loading = 'success';
})
.catch(err => {
console.error(err);
this.loading = 'error';
this.loadMoreText = '加载失败,请下拉刷新!';
})
.finally(() => {
setTimeout(() => {
uni.hideLoading();
uni.stopPullDownRefresh();
}, 500);
});
}
}
};
</script>
<style lang="scss" scoped>
.app-page {
width: 100vw;
display: flex;
flex-direction: column;
}
.loading-wrap {
}
.app-page-content {
}
.content-empty {
height: 60vh;
}
</style>
+3 -4
View File
@@ -123,14 +123,13 @@ export default {
fnGetData() {
this.loading = 'loading';
this.queryParams.group = this.loveConfig.lovePhoto.groupName
console.log('this.loveConfig------------',this.loveConfig)
this.$httpApi.v2
.getPhotoListByGroupName(this.queryParams)
.then(res => {
console.log("相册 res", res)
this.loading = 'success';
this.dataList = res.items.map((item, index) => {
item['image'] = this.$utils.checkImageUrl(item.spec.cover);
item['image'] = this.$utils.checkImageUrl(item.spec.cover || item.spec.url);
item['takeTime'] = this.$tm.dayjs(item.metadata.creationTimestamp).format(
'DD/MM/YYYY');
return item;
@@ -161,13 +160,13 @@ export default {
fnChange(isNext) {
throttle(() => {
if (isNext) {
if (this.swiperIndex == this.dataList.length - 1) {
if (this.swiperIndex === this.dataList.length - 1) {
this.swiperIndex = 0;
} else {
this.swiperIndex += 1;
}
} else {
if (this.swiperIndex == 0) {
if (this.swiperIndex === 0) {
this.swiperIndex = this.dataList.length - 1;
} else {
this.swiperIndex -= 1;
+5 -5
View File
@@ -7,7 +7,7 @@
<image class="avatar" :src="$utils.checkAvatarUrl(loveConfig.loveInfo.boyAvatar)" mode="aspectFit"></image>
<view class="name">{{ loveConfig.loveInfo.boyNickname }}</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">
<image class="avatar" :src="$utils.checkAvatarUrl(loveConfig.loveInfo.girlAvatar)" mode="aspectFit"></image>
<view class="name">{{ loveConfig.loveInfo.girlNickname }}</view>
@@ -43,7 +43,7 @@
<block v-for="(nav, index) in navList" :key="index">
<view v-if="nav.use" class="list-item" @click="fnToPage(nav.key)">
<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 class="right">
<view class="name">{{ nav.title }}</view>
@@ -100,21 +100,21 @@ export default {
{
key: 'journey',
use: configs.ourStory.enabled,
iconImageUrl: 'https://b.925i.cn/uni_halo_love/diandian.png',
iconImageUrl: configs.ourStory.iconUrl,
title: '关于我们',
desc: '我们一起度过的那些经历'
},
{
key: 'album',
use: configs.lovePhoto.enabled,
iconImageUrl: 'https://b.925i.cn/uni_halo_love/diandian.png',
iconImageUrl: configs.lovePhoto.iconUrl,
title: '恋爱相册',
desc: '定格了我们的那些小美好'
},
{
key: 'list',
use: configs.loveDaily.enabled,
iconImageUrl: 'https://b.925i.cn/uni_halo_love/diandian.png',
iconImageUrl: configs.loveDaily.iconUrl,
title: '恋爱清单',
desc: '你我之间的约定我们都在努力实现'
},
+467 -379
View File
@@ -1,443 +1,531 @@
<template>
<view class="app-page bg-gradient-blue-lighten-b" :style="pageStyle">
<view class="tn-satr">
<view class="sky"></view>
<view class="stars">
<view class="falling-stars">
<view class="star-fall"></view>
<view class="star-fall"></view>
<view class="star-fall"></view>
<view class="star-fall"></view>
</view>
<view class="small-stars">
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
</view>
<view class="medium-stars">
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
</view>
</view>
</view>
<view class="app-page bg-gradient-blue-lighten-b" :class="calcPageClass" :style="[calcPageStyle]">
<view v-if="calcBackgroundType!=='video'" class="tn-satr">
<view class="sky"></view>
<view class="stars">
<view class="falling-stars">
<view class="star-fall"></view>
<view class="star-fall"></view>
<view class="star-fall"></view>
<view class="star-fall"></view>
</view>
<view class="small-stars">
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
</view>
<view class="medium-stars">
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
<view class="star"></view>
</view>
</view>
</view>
<view class="user-info__container flex flex-col flex-center">
<image class="user-info__avatar" :src="$utils.checkImageUrl(startConfig.logo)" mode="aspectFill"></image>
<view class="user-info__nick-name"> {{ startConfig.title }} </view>
</view>
<video v-else class="video-bg" :object-fit="startConfig.bgVideoFit" :src="startConfig.bgVideo" :loop="true"
: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-progress="false"></video>
<view class="text-align-center text-white" style="padding: 60vh 0 0 0;">
<view class="" style="font-size: 44rpx;" v-if="startConfig.desc1">{{ startConfig.desc1 }}</view>
<view class="mt-30 text-size-m" v-if="startConfig.desc2">{{ startConfig.desc2 }}</view>
</view>
<cover-view v-if="startConfig.title || startConfig.logo" class="title-container">
<view class="" style="padding: 120rpx 200rpx;z-index: 999;position: relative;">
<view class="start-btn" @click="fnStart()">{{ startConfig.btnText || '开始体验' }}</view>
</view>
<cover-view v-if="startConfig.logo" class="app-logo">
<cover-view class="app-logo-border">
<cover-image class="app-logo-image" :src="$utils.checkImageUrl(startConfig.logo)"
mode="aspectFill"></cover-image>
</cover-view>
</cover-view>
<!-- 波浪效果 -->
<wave></wave>
</view>
<cover-view v-if="startConfig.title" class="app-title" :style="startConfig.titleStyle">
{{ startConfig.title }}
</cover-view>
</cover-view>
<cover-view class="bottom-container">
<cover-view class="text-align-center" :style="startConfig.descStyle"
style="color:white;padding: 60vh 0 0 0;">
<cover-view style="font-size: 44rpx;" v-show="startConfig.desc1">
{{ startConfig.desc1 }}
</cover-view>
<cover-view class="mt-30 text-size-m" v-show="startConfig.desc2">
{{ startConfig.desc2 }}
</cover-view>
</cover-view>
<!-- #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()"
:style="[startConfig.btnStyle]">{{ startConfig.btnText || '开始体验' }}
</cover-view>
<!-- #endif -->
</cover-view>
<!-- 波浪效果 -->
<wave v-if="startConfig.useWave"></wave>
</view>
</template>
<script>
import wave from '@/components/wave/wave.vue';
import wave from '@/components/wave/wave.vue';
export default {
components: {
wave
},
computed: {
startConfig() {
return this.$tm.vx.getters().getConfigs.appConfig.startConfig;
},
pageStyle() {
if (this.startConfig.bg) {
const _bg = this.$utils.checkIsUrl(this.startConfig.bg) ? `url(${this.$utils.checkImageUrl(this.startConfig.bg)})` : this
.startConfig.bg;
return {
background: _bg + '!important'
};
}
return {};
}
},
methods: {
fnStart() {
uni.switchTab({
url: '/pages/tabbar/home/home',
success: () => {
uni.setStorageSync('APP_HAS_STARTED', true);
}
});
}
}
};
export default {
components: {
wave
},
computed: {
startConfig() {
return this.$tm.vx.getters().getConfigs.appConfig.startConfig;
},
calcBackgroundType() {
return this.startConfig.backgroundType;
},
calcPageClass() {
if (this.calcBackgroundType === 'color') {
return [this.startConfig.bg]
}
return []
},
calcPageStyle() {
if (this.calcBackgroundType === 'color') {
return {}
}
if (this.calcBackgroundType === 'image') {
return {
backgroundImage: `url(${this.$utils.checkImageUrl(this.startConfig.bgImage)})!important`,
backgroundSize: this.startConfig.bgImageFit
}
}
if (this.calcBackgroundType === 'video') {
return {
background: '#ffffff'
}
}
return {};
}
},
methods: {
fnStart() {
uni.switchTab({
url: '/pages/tabbar/home/home',
success: () => {
uni.setStorageSync('APP_HAS_STARTED', true);
}
});
}
}
};
</script>
<style lang="scss" scoped>
.app-page {
width: 100vw;
height: 100vh;
}
.app-page {
position: relative;
width: 100vw;
height: 100vh;
background-size: cover;
background-repeat: no-repeat;
}
.start-btn {
box-sizing: border-box;
background-color: transparent;
padding: 16rpx 50rpx;
border-radius: 50rpx;
border: 2rpx solid #ffffff;
color: #ffffff;
text-align: center;
font-size: 28rpx;
}
.start-btn {
box-sizing: border-box;
background-color: transparent;
padding: 16rpx 50rpx;
border-radius: 50rpx;
border: 2rpx solid #ffffff;
color: #ffffff;
text-align: center;
font-size: 28rpx;
margin-top: 60rpx;
margin-bottom: 120rpx;
}
/* 用户信息 start */
.user-info {
&__container {
position: absolute;
top: 25vh;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.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;
}
&__avatar {
width: 200rpx;
height: 200rpx;
border: 8rpx solid rgba(255, 255, 255, 0.05);
border-radius: 50%;
overflow: hidden;
box-shadow: 0rpx 0rpx 80rpx 0rpx rgba(0, 0, 0, 0.15);
}
.bottom-container {
display: flex;
flex-direction: column;
position: absolute;
bottom: 50rpx;
left: 50%;
transform: translateX(-50%);
z-index: 999;
}
&__nick-name {
color: #ffffff;
margin-top: 26rpx;
font-size: 36rpx;
font-weight: 600;
text-align: center;
}
}
.video-bg {
position: absolute;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
z-index: 0;
}
/* 用户信息 end */
.title-container {
width: 100vw;
position: absolute;
top: 20vh;
left: 0;
z-index: 999;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
/* 流星*/
.tn-satr {
position: fixed;
width: 100%;
height: 600px;
overflow: hidden;
flex-shrink: 0;
z-index: 998;
}
.app-logo {
width: 200rpx;
height: 200rpx;
.stars {
position: absolute;
z-index: 1;
width: 100%;
height: 400px;
}
&-border {
width: 100%;
height: 100%;
box-sizing: border-box;
border: 8rpx solid rgba(255, 255, 255, 0.35);
border-radius: 50%;
overflow: hidden;
}
.star {
border-radius: 50%;
background: #ffffff;
box-shadow: 0px 0px 6px 0px rgba(255, 255, 255, 0.8);
}
&-image {
width: 100%;
height: 100%;
border-radius: 50%;
}
}
.small-stars .star {
position: absolute;
width: 3px;
height: 3px;
}
.app-title {
color: #ffffff;
margin-top: 26rpx;
font-size: 36rpx;
font-weight: 600;
text-align: center;
}
.small-stars .star:nth-child(2n) {
opacity: 0;
-webkit-animation: star-blink 1.2s linear infinite alternate;
animation: star-blink 1.2s linear infinite alternate;
}
.small-stars .star:nth-child(1) {
left: 40px;
bottom: 50px;
}
.tn-satr {
position: fixed;
width: 100%;
height: 600px;
overflow: hidden;
flex-shrink: 0;
z-index: 998;
}
.small-stars .star:nth-child(2) {
left: 200px;
bottom: 40px;
}
.stars {
position: absolute;
z-index: 1;
width: 100%;
height: 400px;
}
.small-stars .star:nth-child(3) {
left: 60px;
bottom: 120px;
}
.star {
border-radius: 50%;
background: #ffffff;
box-shadow: 0 0 6px 0 rgba(255, 255, 255, 0.8);
}
.small-stars .star:nth-child(4) {
left: 140px;
bottom: 250px;
}
.small-stars .star {
position: absolute;
width: 3px;
height: 3px;
}
.small-stars .star:nth-child(5) {
left: 400px;
bottom: 300px;
}
.small-stars .star:nth-child(2n) {
opacity: 0;
-webkit-animation: star-blink 1.2s linear infinite alternate;
animation: star-blink 1.2s linear infinite alternate;
}
.small-stars .star:nth-child(6) {
left: 170px;
bottom: 80px;
}
.small-stars .star:nth-child(1) {
left: 40px;
bottom: 50px;
}
.small-stars .star:nth-child(7) {
left: 200px;
bottom: 360px;
-webkit-animation-delay: 0.2s;
animation-delay: 0.2s;
}
.small-stars .star:nth-child(2) {
left: 200px;
bottom: 40px;
}
.small-stars .star:nth-child(8) {
left: 250px;
bottom: 320px;
}
.small-stars .star:nth-child(3) {
left: 60px;
bottom: 120px;
}
.small-stars .star:nth-child(9) {
left: 300px;
bottom: 340px;
}
.small-stars .star:nth-child(4) {
left: 140px;
bottom: 250px;
}
.small-stars .star:nth-child(10) {
left: 130px;
bottom: 320px;
-webkit-animation-delay: 0.5s;
animation-delay: 0.5s;
}
.small-stars .star:nth-child(5) {
left: 400px;
bottom: 300px;
}
.small-stars .star:nth-child(11) {
left: 230px;
bottom: 330px;
-webkit-animation-delay: 7s;
animation-delay: 7s;
}
.small-stars .star:nth-child(6) {
left: 170px;
bottom: 80px;
}
.small-stars .star:nth-child(12) {
left: 300px;
bottom: 360px;
-webkit-animation-delay: 0.3s;
animation-delay: 0.3s;
}
.small-stars .star:nth-child(7) {
left: 200px;
bottom: 360px;
-webkit-animation-delay: 0.2s;
animation-delay: 0.2s;
}
@-webkit-keyframes star-blink {
50% {
width: 3px;
height: 3px;
opacity: 1;
}
}
.small-stars .star:nth-child(8) {
left: 250px;
bottom: 320px;
}
@keyframes star-blink {
50% {
width: 3px;
height: 3px;
opacity: 1;
}
}
.small-stars .star:nth-child(9) {
left: 300px;
bottom: 340px;
}
.medium-stars .star {
position: absolute;
width: 3px;
height: 3px;
opacity: 0;
-webkit-animation: star-blink 1.2s ease-in infinite alternate;
animation: star-blink 1.2s ease-in infinite alternate;
}
.small-stars .star:nth-child(10) {
left: 130px;
bottom: 320px;
-webkit-animation-delay: 0.5s;
animation-delay: 0.5s;
}
.medium-stars .star:nth-child(1) {
left: 300px;
bottom: 50px;
}
.small-stars .star:nth-child(11) {
left: 230px;
bottom: 330px;
-webkit-animation-delay: 7s;
animation-delay: 7s;
}
.medium-stars .star:nth-child(2) {
left: 400px;
bottom: 40px;
-webkit-animation-delay: 0.4s;
animation-delay: 0.4s;
}
.small-stars .star:nth-child(12) {
left: 300px;
bottom: 360px;
-webkit-animation-delay: 0.3s;
animation-delay: 0.3s;
}
.medium-stars .star:nth-child(3) {
left: 330px;
bottom: 300px;
-webkit-animation-delay: 0.2s;
animation-delay: 0.2s;
}
@-webkit-keyframes star-blink {
50% {
width: 3px;
height: 3px;
opacity: 1;
}
}
.medium-stars .star:nth-child(4) {
left: 460px;
bottom: 300px;
-webkit-animation-delay: 0.9s;
animation-delay: 0.9s;
}
@keyframes star-blink {
50% {
width: 3px;
height: 3px;
opacity: 1;
}
}
.medium-stars .star:nth-child(5) {
left: 300px;
bottom: 150px;
-webkit-animation-delay: 1.2s;
animation-delay: 1.2s;
}
.medium-stars .star {
position: absolute;
width: 3px;
height: 3px;
opacity: 0;
-webkit-animation: star-blink 1.2s ease-in infinite alternate;
animation: star-blink 1.2s ease-in infinite alternate;
}
.medium-stars .star:nth-child(6) {
left: 440px;
bottom: 120px;
-webkit-animation-delay: 1s;
animation-delay: 1s;
}
.medium-stars .star:nth-child(1) {
left: 300px;
bottom: 50px;
}
.medium-stars .star:nth-child(7) {
left: 200px;
bottom: 140px;
-webkit-animation-delay: 0.8s;
animation-delay: 0.8s;
}
.medium-stars .star:nth-child(2) {
left: 400px;
bottom: 40px;
-webkit-animation-delay: 0.4s;
animation-delay: 0.4s;
}
.medium-stars .star:nth-child(8) {
left: 30px;
bottom: 480px;
-webkit-animation-delay: 0.3s;
animation-delay: 0.3s;
}
.medium-stars .star:nth-child(3) {
left: 330px;
bottom: 300px;
-webkit-animation-delay: 0.2s;
animation-delay: 0.2s;
}
.medium-stars .star:nth-child(9) {
left: 460px;
bottom: 400px;
-webkit-animation-delay: 1.2s;
animation-delay: 1.2s;
}
.medium-stars .star:nth-child(4) {
left: 460px;
bottom: 300px;
-webkit-animation-delay: 0.9s;
animation-delay: 0.9s;
}
.medium-stars .star:nth-child(10) {
left: 150px;
bottom: 10px;
-webkit-animation-delay: 1s;
animation-delay: 1s;
}
.medium-stars .star:nth-child(5) {
left: 300px;
bottom: 150px;
-webkit-animation-delay: 1.2s;
animation-delay: 1.2s;
}
.medium-stars .star:nth-child(11) {
left: 420px;
bottom: 450px;
-webkit-animation-delay: 1.2s;
animation-delay: 1.2s;
}
.medium-stars .star:nth-child(6) {
left: 440px;
bottom: 120px;
-webkit-animation-delay: 1s;
animation-delay: 1s;
}
.medium-stars .star:nth-child(12) {
left: 340px;
bottom: 180px;
-webkit-animation-delay: 1.1s;
animation-delay: 1.1s;
}
.medium-stars .star:nth-child(7) {
left: 200px;
bottom: 140px;
-webkit-animation-delay: 0.8s;
animation-delay: 0.8s;
}
@keyframes star-blink {
50% {
width: 4px;
height: 4px;
opacity: 1;
}
}
.medium-stars .star:nth-child(8) {
left: 30px;
bottom: 480px;
-webkit-animation-delay: 0.3s;
animation-delay: 0.3s;
}
.star-fall {
position: relative;
border-radius: 2px;
width: 80px;
height: 2px;
overflow: hidden;
-webkit-transform: rotate(-20deg);
transform: rotate(-20deg);
}
.medium-stars .star:nth-child(9) {
left: 460px;
bottom: 400px;
-webkit-animation-delay: 1.2s;
animation-delay: 1.2s;
}
.star-fall:after {
content: '';
position: absolute;
width: 50px;
height: 2px;
background: -webkit-gradient(linear, right top, left top, from(rgba(0, 0, 0, 0)), to(rgba(255, 255, 255, 0.4)));
background: linear-gradient(to left, rgba(0, 0, 0, 0) 0%, rgba(255, 255, 255, 0.4) 100%);
left: 100%;
-webkit-animation: star-fall 3.6s linear infinite;
animation: star-fall 3.6s linear infinite;
}
.medium-stars .star:nth-child(10) {
left: 150px;
bottom: 10px;
-webkit-animation-delay: 1s;
animation-delay: 1s;
}
.star-fall:nth-child(1) {
left: 80px;
bottom: -100px;
}
.medium-stars .star:nth-child(11) {
left: 420px;
bottom: 450px;
-webkit-animation-delay: 1.2s;
animation-delay: 1.2s;
}
.star-fall:nth-child(1):after {
-webkit-animation-delay: 2.4s;
animation-delay: 2.4s;
}
.medium-stars .star:nth-child(12) {
left: 340px;
bottom: 180px;
-webkit-animation-delay: 1.1s;
animation-delay: 1.1s;
}
.star-fall:nth-child(2) {
left: 200px;
bottom: -200px;
}
@keyframes star-blink {
50% {
width: 4px;
height: 4px;
opacity: 1;
}
}
.star-fall:nth-child(2):after {
-webkit-animation-delay: 2s;
animation-delay: 2s;
}
.star-fall {
position: relative;
border-radius: 2px;
width: 80px;
height: 2px;
overflow: hidden;
-webkit-transform: rotate(-20deg);
transform: rotate(-20deg);
}
.star-fall:nth-child(3) {
left: 430px;
bottom: -50px;
}
.star-fall:after {
content: '';
position: absolute;
width: 50px;
height: 2px;
background: -webkit-gradient(linear, right top, left top, from(rgba(0, 0, 0, 0)), to(rgba(255, 255, 255, 0.4)));
background: linear-gradient(to left, rgba(0, 0, 0, 0) 0%, rgba(255, 255, 255, 0.4) 100%);
left: 100%;
-webkit-animation: star-fall 3.6s linear infinite;
animation: star-fall 3.6s linear infinite;
}
.star-fall:nth-child(3):after {
-webkit-animation-delay: 3.6s;
animation-delay: 3.6s;
}
.star-fall:nth-child(1) {
left: 80px;
bottom: -100px;
}
.star-fall:nth-child(4) {
left: 400px;
bottom: 100px;
}
.star-fall:nth-child(1):after {
-webkit-animation-delay: 2.4s;
animation-delay: 2.4s;
}
.star-fall:nth-child(4):after {
-webkit-animation-delay: 0.2s;
animation-delay: 0.2s;
}
.star-fall:nth-child(2) {
left: 200px;
bottom: -200px;
}
@-webkit-keyframes star-fall {
20% {
left: -100%;
}
.star-fall:nth-child(2):after {
-webkit-animation-delay: 2s;
animation-delay: 2s;
}
100% {
left: -100%;
}
}
.star-fall:nth-child(3) {
left: 430px;
bottom: -50px;
}
@keyframes star-fall {
20% {
left: -100%;
}
.star-fall:nth-child(3):after {
-webkit-animation-delay: 3.6s;
animation-delay: 3.6s;
}
100% {
left: -100%;
}
}
</style>
.star-fall:nth-child(4) {
left: 400px;
bottom: 100px;
}
.star-fall:nth-child(4):after {
-webkit-animation-delay: 0.2s;
animation-delay: 0.2s;
}
@-webkit-keyframes star-fall {
20% {
left: -100%;
}
100% {
left: -100%;
}
}
@keyframes star-fall {
20% {
left: -100%;
}
100% {
left: -100%;
}
}
</style>
-289
View File
@@ -1,289 +0,0 @@
<template>
<view class="app-page">
<view v-if="loading != 'success' && articleList.length===0" class="loading-wrap">
加载中
</view>
<block v-else>
<view v-if="articleList.length == 0" class="article-empty"><tm-empty icon="icon-shiliangzhinengduixiang-"
label="博主还没有发表任何文章~"></tm-empty></view>
<block v-else>
<view style="width: 100%;text-align: center;display: flex;flex-direction: column;align-items: center;"
v-for="(article, index) in articleList" :key="index">
<image style="width: 100%;height: 250rpx;" :src="article.cover"></image>
<view style="margin-top: 12rpx;">{{article.title}}</view>
</view>
<view class="load-text mt-12">{{ loadMoreText }}</view>
</block>
</block>
</view>
</template>
<script>
export default {
components: {
},
data() {
return {
loading: 'loading',
queryParams: {
size: 30,
page: 1
},
result: {},
isLoadMore: false,
loadMoreText: '加载中...',
bannerCurrent: 0,
bannerList: [],
noticeList: [],
articleList: [],
categoryList: [],
};
},
onLoad() {
this.fnQuery();
},
onPullDownRefresh() {
this.isLoadMore = false;
this.queryParams.page = 1;
this.fnQuery();
},
onReachBottom(e) {
if (this.result.hasNext) {
this.queryParams.page += 1;
this.isLoadMore = true;
this.fnGetArticleList();
} else {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
},
methods: {
fnQuery() {
this.fnGetArticleList();
},
fnOnBannerChange(e) {
this.bannerCurrent = e.current;
},
fnOnBannerClick(item) {
if (item.id == '') return;
this.fnToArticleDetail({
metadata: {
name: item.id
}
});
},
fnGetArticleList() {
// 设置状态为加载中
if (!this.isLoadMore) {
this.loading = 'loading';
}
this.loadMoreText = '加载中...';
const list = new Array(30).fill(10).map(item => {
return {
title: '红红火火恍恍惚惚哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈发放',
cover: 'https://blog.925i.cn/upload/房间%20少女%20蓝色眼睛%20夏天的裙子%20室内绿色植物%20动漫壁纸_彼岸壁纸.webp'
}
})
setTimeout(() => {
setTimeout(() => {
this.result = {
hasNext: true
};
if (this.isLoadMore) {
this.articleList = this.articleList.concat(list);
} else {
this.articleList = list;
}
}, 200)
this.loading = 'success';
this.loadMoreText = this.result ? '上拉加载更多' : '呜呜,没有更多数据啦~';
uni.hideLoading();
uni.stopPullDownRefresh();
}, 300)
},
//跳转文章详情
fnToArticleDetail(article) {
uni.navigateTo({
url: '/pagesA/article-detail/article-detail?name=' + article.metadata.name,
animationType: 'slide-in-right'
});
},
// 快捷导航页面跳转
fnToNavPage(item) {
switch (item.type) {
case 'tabbar':
uni.switchTab({
url: item.path
});
break;
case 'page':
uni.navigateTo({
url: item.path
});
break;
}
},
// 分类页面
fnToCategoryPage() {
uni.switchTab({
url: '/pages/tabbar/category/category'
});
},
// 所有的文章列表页面
fnToArticlesPage() {
uni.navigateTo({
url: '/pagesA/articles/articles'
});
},
// 根据slug查询分类下的文章
fnToCategoryBy(category) {
uni.navigateTo({
url: `/pagesA/category-detail/category-detail?name=${category.metadata.name}&title=${category.spec.displayName}`
});
},
fnChangeMode() {
const isBlackTheme = this.$tm.vx.state().tmVuetify.black;
this.$tm.theme.setBlack(!isBlackTheme);
uni.setNavigationBarColor({
backgroundColor: !isBlackTheme ? '#0a0a0a' : '#ffffff',
frontColor: !isBlackTheme ? '#ffffff' : '#0a0a0a'
});
},
fnToSearch() {
uni.navigateTo({
url: '/pagesA/articles/articles'
});
}
}
};
</script>
<style lang="scss" scoped>
.app-page {
width: 100vw;
min-height: 100vh;
display: flex;
flex-direction: column;
// background-color: #ffffff;
.logo {
width: 60rpx;
height: 60rpx;
box-sizing: border-box;
}
::v-deep {
.tm-menubars .body .body_wk .left {
min-width: initial;
}
}
}
.loading-wrap {
padding: 24rpx;
}
.search-input {
background-color: #f5f5f5;
align-items: center;
/* #ifdef MP-WEIXIN */
margin-right: 24rpx;
/* #endif */
&_icon {}
&_text {}
}
.show-more {
width: 42rpx;
height: 42rpx;
box-sizing: border-box;
box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.03);
}
.banner {
overflow: hidden;
}
.quick-nav {
background-color: #fff;
box-sizing: border-box;
// box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
.name {
color: var(--main-text-color);
}
}
.category {
width: 94vw;
display: flex;
height: 200rpx;
white-space: nowrap;
margin: 0 24rpx;
.content {
display: inline-block;
padding-left: 24rpx;
&:first-child {
padding-left: 0;
}
}
.cate-empty {
height: inherit;
}
}
.page-item {
&_title {
position: relative;
padding-left: 24rpx;
font-size: 32rpx;
z-index: 1;
color: var(--main-text-color);
&:before {
content: '';
position: absolute;
left: 0rpx;
top: 8rpx;
width: 8rpx;
height: 30rpx;
background-color: rgba(33, 150, 243, 1);
border-radius: 6rpx;
z-index: 0;
}
}
}
.h_row_col2 {
display: flex;
flex-wrap: wrap;
box-sizing: border-box;
padding: 0 12rpx;
.ani-item {
width: 50%;
}
}
</style>
-24
View File
@@ -1,24 +0,0 @@
// router.js
import {
RouterMount,
createRouter
} from 'uni-simple-router';
const router = createRouter({
platform: process.env.VUE_APP_PLATFORM,
routes: [...ROUTES]
});
//全局路由前置守卫
router.beforeEach((to, from, next) => {
next();
});
// 全局路由后置守卫
router.afterEach((to, from) => {
console.log('跳转结束')
})
export {
router,
RouterMount
}
+35 -1
View File
@@ -5,25 +5,35 @@
* 时间:2024年06月22日 12:00:44
* 版本: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 utils from '@/utils/index.js'
export default {
namespaced: true,
state: {
configs: getAppConfigs(),
mockJson: getAppMockJson(),
},
getters: {
getConfigs(state) {
if (state.configs) return state.configs;
return getAppConfigs()
},
getMockJson(state) {
if(state.mockJson) return state.mockJson;
return getAppMockJson()
}
},
mutations: {
setConfigs(state, data) {
state.configs = data;
setAppConfigs(data)
},
setMockJson(state, data) {
setAppMockJson(data)
state.mockJson = data;
}
},
actions: {
fetchConfigs({commit, dispatch}) {
@@ -47,5 +57,29 @@ export default {
setDefaultAppSettings({commit}) {
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
})
}
})
})
},
}
};
@@ -0,0 +1,219 @@
<template>
<view class="tm-flowLayout relative">
<view class="tm-flowLayout-hidden absolute fulled">
<view v-for="(item, index) in list2" :key="index" style="width: 350rpx;" :class="'tm-flowLayout-hidden-'+index">
<tm-images @error="loadimg($event,false,index)" @load="loadimg($event,true,index)" :src="item.spec.url"></tm-images>
</view>
</view>
<view class="tm-flowLayout-cm flex-between">
<view class="tm-flowLayout-left" style="width: 48.6%;">
<block v-for="(item, index) in dataList[0]" :key="index">
<view @click.stop="onclick(index,0)" class="tm-flowLayout-item mb-20 fulled" :class="['tm-flowLayout-item_'+index]">
<tm-translate animation-name="fadeUp">
<view class="card round-3 overflow white">
<tm-images :previmage="false" :src="item.spec.url"></tm-images>
</view>
</tm-translate>
</view>
</block>
</view>
<view class="tm-flowLayout-right" style="width: 48.6%;">
<block v-for="(item, index) in dataList[1]" :key="index">
<view @click.stop="onclick(index,1)" class="tm-flowLayout-item mb-20 fulled" :class="['tm-flowLayout-item_'+index]">
<tm-translate animation-name="fadeUp">
<view class="card round-3 overflow white">
<tm-images :previmage="false" :src="item.spec.url"></tm-images>
</view>
</tm-translate>
</view>
</block>
</view>
</view>
<view v-if="isLoading" class="flex-shrink fulled">
<tm-loadding></tm-loadding>
</view>
</view>
</template>
<script>
/**
* 瀑布流组件
* @property {Function} click 点击项目时触发
* @property {Function} load 当前列表加载完成发出的事件。
* @property {String} model = [rank|desc] desc下正时排序,所有加载完成再进行显示,rank随机,哪个先加载哪个先排前面。
*/
import tmImages from "@/tm-vuetify/components/tm-images/tm-images.vue"
import tmLoadding from "@/tm-vuetify/components/tm-loadding/tm-loadding.vue"
import tmIcons from "@/tm-vuetify/components/tm-icons/tm-icons.vue"
import tmTranslate from "@/tm-vuetify/components/tm-translate/tm-translate.vue"
export default {
components: {tmImages, tmLoadding, tmIcons, tmTranslate},
name: 'tm-flowLayout',
props: {
model: {
type: String,
default: 'rank' //desc下正时排序,所有加载完成再进行显示,rank随机,哪个先加载哪个先排前面。
}
},
data() {
return {
list2: [],
dataList: [
[], []
],
colHeight: [0, 0],
minWidth: 0,
isLoading: true,
};
},
async mounted() {
let p = await this.$Querey('.tm-flowLayout-left').catch(e => {
});
this.minWidth = p[0].width;
},
methods: {
onclick(index, dirIndex) {
this.$emit('click',
{
childrenIndex: index,
dirIndex: dirIndex,
item: this.dataList[dirIndex][index]
});
},
//修改或者替换列表数据
changeItemData(dirIndex, childrenIndex, item) {
this.dataList[dirIndex].splice(childrenIndex, 1, item);
},
//删除一项列表数据
delItemData(dirIndex, childrenIndex) {
this.colHeight.splice(dirIndex, 1, this.colHeight[dirIndex] - this.dataList[dirIndex][childrenIndex].height)
this.dataList[dirIndex].splice(childrenIndex, 1);
this.list2.splice(this.dataList[dirIndex][childrenIndex].index, 1);
this.$nextTick(function () {
this.sucessRank();
})
},
//向列表添加数据
pushData(list) {
console.log('添加图片数据----------',list)
let prIdx_i = this.list2.length;
if (!Array.isArray(list) || typeof list == 'undefined') {
return false;
}
for (let i = 0; i < list.length; i++) {
this.list2.push({
index: i + prIdx_i,
isLoad: false,
image: "",
width: 0,
height: 0,
...list[i]
})
}
},
//获取内部列表数据
getDataList() {
return this.dataList;
},
async loadimg(event, isLoad, index) {
console.log('图片加载事件----------',event)
this.isLoading = true;
let ps = this.list2[index];
ps.isLoad = true;
if (isLoad == false) {
ps.width = this.minWidth;
ps.height = this.minWidth;
} else {
ps.width = this.minWidth;
ps.height = ps.height + event.height;
}
if (this.list2.length == 0 && this.dataList[0].length == 0 && this.dataList[1].length == 0) {
this.isLoading = false;
return;
}
this.list2.splice(index, 1, ps);
if (this.model == 'desc') {
this.sucessRank();
} else if (this.model == 'rank') {
let indexCol = this.colHeight[0] <= this.colHeight[1] ? 0 : 1;
this.dataList[indexCol].push(this.list2[index]);
this.colHeight.splice(indexCol, 1, this.colHeight[indexCol] + this.list2[index].height);
if (this.isAllLoading() === false) return;
this.isLoading = false;
}
},
isAllLoading() {
let isAllload = true;
for (let i = 0; i < this.list2.length; i++) {
if (this.list2[i].isLoad === false) {
isAllload = false;
break;
}
}
if (isAllload === true) {
// 当前列表加载完成发出的事件。
this.$emit('load', this.dataList)
}
return isAllload;
},
sucessRank() {
if (this.isAllLoading() === false) return;
this.isLoading = false;
for (let i = 0; i < this.list2.length; i++) {
// let p = await this.getLeftRightHeight();
let index = this.colHeight[0] <= this.colHeight[1] ? 0 : 1;
this.dataList[index].push(this.list2[i]);
this.colHeight.splice(index, 1, this.colHeight[index] + this.list2[i].height)
}
},
//清空瀑布流数据 。
clear() {
this.list2 = [];
this.dataList = [[], []];
this.isLoading = false;
},
getLeftRightHeight(index) {
let t = this;
return new Promise((resolve, rejecvt) => {
let q = uni.createSelectorQuery().in(t);
q.select(".tm-flowLayout-left").boundingClientRect();
q.select(".tm-flowLayout-right").boundingClientRect();
q.exec((res) => {
resolve([res[0].height, res[1].height])
})
})
}
},
};
</script>
<style lang="scss">
.tm-flowLayout {
.tm-flowLayout-hidden {
width: 100%;
height: 100px;
overflow-y: auto;
left: -300%;
top: 0;
}
.tm-flowLayout-cm {
align-items: flex-start;
}
.card {
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.03);
}
}
</style>
+1 -17
View File
@@ -1,8 +1,4 @@
//vue.config.js
const TransformPages = require('uni-read-pages')
const {
webpack
} = new TransformPages()
module.exports = {
devServer: {
disableHostCheck: true,
@@ -16,17 +12,5 @@ module.exports = {
}
}
}
},
configureWebpack: {
plugins: [
new webpack.DefinePlugin({
ROUTES: webpack.DefinePlugin.runtimeValue(() => {
const tfPages = new TransformPages({
includes: ['path', 'name', 'aliasPath', "meta"]
});
return JSON.stringify(tfPages.routes)
}, true)
})
]
}
}
}