mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-07-27 04:20:43 +08:00
Compare commits
46 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7c15c84dba | |||
| e8edc03526 | |||
| 2b717ad449 | |||
| 5efc877a89 | |||
| 75a133415a | |||
| bf41b08b35 | |||
| 74a5efb596 | |||
| 40dd4f4b7f | |||
| 341670adcf | |||
| 115aea2580 | |||
| 58f1e7f131 | |||
| 26ce84b950 | |||
| 32b3bbaa74 | |||
| 76c00f31f6 | |||
| e28ea6ca08 | |||
| a98254e6cc | |||
| 82062d9465 | |||
| 706cee2240 | |||
| da60eb2daf | |||
| a764c3dbfe | |||
| 88fb74a795 | |||
| 52d4b7927b | |||
| ff31e0d8e8 | |||
| a65ea2617b | |||
| bb228c6705 | |||
| 62992b2688 | |||
| da141ae10a | |||
| d22224e2fc | |||
| d0b3a42c1d | |||
| c3349ae070 | |||
| ad6719e201 | |||
| 0e342d5fa3 | |||
| daf1318a90 | |||
| d4ccc9b7d6 | |||
| ce60c334ec | |||
| ca723bae80 | |||
| c312fab4b1 | |||
| d9db03959a | |||
| add84f6e4b | |||
| 850ee73fa2 | |||
| 77da85f7d4 | |||
| 4d0901b650 | |||
| 66a39dd723 | |||
| 4cdcbb1958 | |||
| e0569e287f | |||
| b42932ddad |
@@ -1,66 +1,60 @@
|
|||||||
<script>
|
<script>
|
||||||
import HaloTokenConfig from '@/config/token.config.js';
|
import HaloTokenConfig from '@/config/token.config.js';
|
||||||
|
|
||||||
// app升级检测(搭配:https://ext.dcloud.net.cn/plugin?id=4470 升级中心)
|
// app升级检测(搭配:https://ext.dcloud.net.cn/plugin?id=4470 升级中心)
|
||||||
import CheckAppUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
|
import CheckAppUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
|
||||||
import {
|
import {CheckWxUpdate} from '@/utils/update.js';
|
||||||
CheckWxUpdate
|
|
||||||
} from '@/utils/update.js';
|
|
||||||
export default {
|
|
||||||
globalData: {
|
|
||||||
baseApiUrl: HaloTokenConfig.BASE_API
|
|
||||||
},
|
|
||||||
onLaunch: function() {
|
|
||||||
console.log('App Launch');
|
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
export default {
|
||||||
CheckAppUpdate();
|
globalData: {
|
||||||
// #endif
|
baseApiUrl: HaloTokenConfig.BASE_API
|
||||||
|
},
|
||||||
|
onLaunch: function () {
|
||||||
|
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef APP-PLUS
|
||||||
CheckWxUpdate();
|
CheckAppUpdate();
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
uni.$tm.vx.actions('config/fetchConfigs').then((res) => {
|
// #ifdef MP-WEIXIN
|
||||||
console.log('正常:', res)
|
CheckWxUpdate();
|
||||||
// #ifdef MP-WEIXIN
|
// #endif
|
||||||
uni.$tm.vx.commit('setWxShare', res.shareConfig);
|
|
||||||
// #endif
|
uni.$tm.vx.actions('config/fetchConfigs').then((res) => {
|
||||||
})
|
})
|
||||||
// 启动检查app的配置是否已经就绪,若未就绪则设置默认的
|
// 启动检查app的配置是否已经就绪,若未就绪则设置默认的
|
||||||
uni.$tm.vx.actions('setting/checkAndSetDefaultAppSettings');
|
uni.$tm.vx.actions('setting/checkAndSetDefaultAppSettings');
|
||||||
},
|
},
|
||||||
onShow: function() {
|
onShow: function () {
|
||||||
console.log('App Show');
|
console.log('App Show');
|
||||||
},
|
},
|
||||||
onHide: function() {
|
onHide: function () {
|
||||||
console.log('App Hide');
|
console.log('App Hide');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
// 基础样式
|
// 基础样式
|
||||||
@import './common/styles/app.theme.scss';
|
@import './common/styles/app.theme.scss';
|
||||||
@import './common/styles/app.base.scss';
|
@import './common/styles/app.base.scss';
|
||||||
|
|
||||||
// 引入tmUI2.x样式
|
// 引入tmUI2.x样式
|
||||||
@import './tm-vuetify/mian.min.css';
|
@import './tm-vuetify/mian.min.css';
|
||||||
// 引入tmUI2.x主题包
|
// 引入tmUI2.x主题包
|
||||||
@import './tm-vuetify/scss/theme.css';
|
@import './tm-vuetify/scss/theme.css';
|
||||||
// 引入tmUI2.x预置图标
|
// 引入tmUI2.x预置图标
|
||||||
@import './tm-vuetify/scss/fonts/fontawesome_base64.css';
|
@import './tm-vuetify/scss/fonts/fontawesome_base64.css';
|
||||||
|
|
||||||
// 自定义图标
|
// 自定义图标
|
||||||
@import './common/icons/halocoloriconfont.css';
|
@import './common/icons/halocoloriconfont.css';
|
||||||
@import './common/icons/haloiconfont.css';
|
@import './common/icons/haloiconfont.css';
|
||||||
@import './common/icons/mphtmliconfont.css';
|
@import './common/icons/mphtmliconfont.css';
|
||||||
|
|
||||||
/* #ifndef MP-WEIXIN */
|
/* #ifndef MP-WEIXIN */
|
||||||
@import './common/markdown/markdown.scss';
|
@import './common/markdown/markdown.scss';
|
||||||
/* #endif */
|
/* #endif */
|
||||||
|
|
||||||
page {
|
page {
|
||||||
background-color: #fafafa;
|
background-color: #fafafa;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://uni-halo.925i.cn" target="_blank" rel="noopener noreferrer">
|
<a href="https://uni-halo.925i.cn" target="_blank" rel="noopener noreferrer">
|
||||||
<img width="100" src="https://b.925i.cn/uni_halo/uni_halo_logo.png" alt="uni-halo logo" />
|
<img width="100" src="https://uni-halo.925i.cn/logo.png" alt="uni-halo logo" />
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@@ -10,10 +10,10 @@
|
|||||||
|
|
||||||
<br />
|
<br />
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://b.925i.cn">作者博客</a>
|
<a href="https://www.xiaoxiaomo.cn">作者主页</a>
|
||||||
<a href="https://uni-halo.925i.cn">文档地址(等待更新v2版本说明)</a>
|
<a href="https://uni-halo.925i.cn">官方文档</a>
|
||||||
<a href="https://gitee.com/ialley-workshop-open/uni-halo">Gitee仓库</a>
|
<a href="https://github.com/ialley-workshop-open/uni-halo">仓库地址</a>
|
||||||
<a href="https://github.com/ialley-workshop-open/uni-halo">Github仓库</a>
|
<a href="https://github.com/ialley-workshop-open/plugin-uni-halo">插件仓库</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -22,52 +22,27 @@
|
|||||||
|
|
||||||
| 支付宝 | 微信 | QQ |
|
| 支付宝 | 微信 | QQ |
|
||||||
|:----------------------------------------------:|:---------------------------------------------:|:---------------------------------------------:|
|
|:----------------------------------------------:|:---------------------------------------------:|:---------------------------------------------:|
|
||||||
|  |  |  |
|
|  |  |  |
|
||||||
|
|
||||||
|
## 一、项目介绍
|
||||||
|
|
||||||
|
基于 Halo 2.x 提供的 API 接口,为微信小程序提供的一套开源的博客应用。
|
||||||
|
|
||||||
|
- 完全免费开源,包括程序源码、插件源码
|
||||||
|
- 页面支持插件配置
|
||||||
|
- 使用最新流行的技术栈
|
||||||
|
- 支持特色功能,恋爱日记
|
||||||
|
- 理论支持编译为 小程序(推荐)、APP
|
||||||
|
|
||||||
|
|
||||||
## 🧐 功能介绍
|
### 在线预览
|
||||||
|
|
||||||
#### 🍻 基础功能
|
微信内容扫描下方二维码,即可在线预览小程序。
|
||||||
|
|
||||||
`重要说明:2.0版本 暂时去掉后台管理功能。`
|

|
||||||
|
|
||||||
- 用户端:文章列表、文章分类、文章详情、图库、友链、瞬间等
|
|
||||||
|
|
||||||
<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/>
|
|
||||||
|
|
||||||
## 😏 在线体验
|
|
||||||
|
|
||||||
说明:微信扫码、或搜索【小莫唐尼】即可在线体验已上线小程序!!!
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
<br/>
|
|
||||||
## 😘 界面预览
|
|
||||||
|
|
||||||
##### 📱 用户端
|
|
||||||
|
|
||||||
说明:以下仅为部分截图
|
|
||||||
|
|
||||||
|首页|分类|图库|
|
|首页|分类|图库|
|
||||||
|:--:|:--:|:--:|
|
|:--:|:--:|:--:|
|
||||||
@@ -78,25 +53,51 @@
|
|||||||
|||
|
|||
|
||||||
|
|
||||||
|
|
||||||
##### 📱 恋爱日记
|
### 恋爱日记
|
||||||
|
|
||||||
说明:以下仅为部分截图
|
|
||||||
|
|
||||||
|主页|恋爱清单|
|
|主页|恋爱清单|
|
||||||
|:--:|:--:|
|
|:--:|:--:|
|
||||||
|||
|
|||
|
||||||
<br/>
|
<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)
|
- 提交 issues:[Github Issues](https://github.com/ialley-workshop-open/uni-halo/issues)
|
||||||
丨 [Gitee Issues](https://gitee.com/ialley-workshop-open/uni-halo/issues)
|
丨 [Gitee Issues](https://gitee.com/ialley-workshop-open/uni-halo/issues)
|
||||||
- 微信交流群:由于微信交流群时效性太短,所以有需要的话可以先加入QQ群,再邀请进微信群
|
- 微信交流群:由于微信交流群时效性太短,所以有需要的话可以先加入QQ群,再邀请进微信群
|
||||||
- QQ 交流群:632969367
|
- QQ 交流群:632969367
|
||||||
-
|
|
||||||
快速加群:[](https://qm.qq.com/cgi-bin/qm/qr?k=cuam7lhrB_vHuvjw2mzUO1sOKdF9KRyM&jump_from=webapi&authKey=d6bJhNaqupTTfoMDWDIeYUTAs44Ax7p64SsM/5NRtFhXE09YexDO15Izuyth6XAi)
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
|||||||
+13
-1
@@ -77,7 +77,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 提交回复
|
// 提交回复
|
||||||
addPostCommentReply: (commentName, data) => {
|
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) {
|
submitLink(form) {
|
||||||
return HttpHandler.Post(`/apis/linksSubmit.muyin.site/v1alpha1/submit`, form, null)
|
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,)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
* markdown配置
|
* markdown配置
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {getAppConfigs} from '@/config/index.js'
|
||||||
getAppConfigs
|
|
||||||
} from '@/config/index.js'
|
|
||||||
import HaloTokenConfig from '@/config/token.config.js'
|
import HaloTokenConfig from '@/config/token.config.js'
|
||||||
|
import utils from '@/utils/index.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
domain: HaloTokenConfig.BASE_API,
|
domain: HaloTokenConfig.BASE_API,
|
||||||
tagStyle: {
|
tagStyle: {
|
||||||
table: `
|
table: `
|
||||||
table-layout: fixed;
|
table-layout: fixed;
|
||||||
border-collapse:collapse;
|
border-collapse:collapse;
|
||||||
margin-bottom: 18px;
|
margin-bottom: 18px;
|
||||||
@@ -20,17 +20,17 @@ export default {
|
|||||||
border: 1px solid #dcdcdc;
|
border: 1px solid #dcdcdc;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
`,
|
`,
|
||||||
th: `
|
th: `
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
border-right: 1px solid var(--classE);
|
border-right: 1px solid var(--classE);
|
||||||
border-bottom: 1px solid var(--classE);
|
border-bottom: 1px solid var(--classE);
|
||||||
`,
|
`,
|
||||||
td: `
|
td: `
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
border-right: 1px solid var(--classE);
|
border-right: 1px solid var(--classE);
|
||||||
border-bottom: 1px solid var(--classE);
|
border-bottom: 1px solid var(--classE);
|
||||||
`,
|
`,
|
||||||
blockquote: `
|
blockquote: `
|
||||||
padding: 8px 15px;
|
padding: 8px 15px;
|
||||||
color: #606266;
|
color: #606266;
|
||||||
background: #f2f6fc;
|
background: #f2f6fc;
|
||||||
@@ -39,62 +39,62 @@ export default {
|
|||||||
line-height: 26px;
|
line-height: 26px;
|
||||||
margin-bottom: 18px;
|
margin-bottom: 18px;
|
||||||
`,
|
`,
|
||||||
ul: 'padding-left: 15px;line-height: 1.85;',
|
ul: 'padding-left: 15px;line-height: 1.85;',
|
||||||
ol: 'padding-left: 15px;line-height: 1.85;',
|
ol: 'padding-left: 15px;line-height: 1.85;',
|
||||||
li: 'margin-bottom: 12px;line-height: 1.85;',
|
li: 'margin-bottom: 12px;line-height: 1.85;',
|
||||||
h1: `
|
h1: `
|
||||||
margin: 30px 0 20px;
|
margin: 30px 0 20px;
|
||||||
color: var(--main);
|
color: var(--main);
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size:1.2em;
|
font-size:1.2em;
|
||||||
`,
|
`,
|
||||||
h2: `
|
h2: `
|
||||||
color: var(--main);
|
color: var(--main);
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: 22px 0 16px;
|
margin: 22px 0 16px;
|
||||||
font-size: 1.16em;
|
font-size: 1.16em;
|
||||||
`,
|
`,
|
||||||
h3: `
|
h3: `
|
||||||
color: var(--main);
|
color: var(--main);
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: 26px 0 18px;
|
margin: 26px 0 18px;
|
||||||
font-size: 1.14em;
|
font-size: 1.14em;
|
||||||
`,
|
`,
|
||||||
h4: `
|
h4: `
|
||||||
color: var(--main);
|
color: var(--main);
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
margin-bottom: 18px;
|
margin-bottom: 18px;
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size: 1.12em;
|
font-size: 1.12em;
|
||||||
`,
|
`,
|
||||||
h5: `
|
h5: `
|
||||||
color: var(--main);
|
color: var(--main);
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size: 1.1em;
|
font-size: 1.1em;
|
||||||
`,
|
`,
|
||||||
h6: `
|
h6: `
|
||||||
color: #303133;
|
color: #303133;
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
`,
|
`,
|
||||||
p: `
|
p: `
|
||||||
line-height: 1.65;
|
line-height: 1.65;
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
`,
|
`,
|
||||||
'code': ` `,
|
'code': ` `,
|
||||||
strong: 'font-weight: 700;color: rgb(248, 57, 41);',
|
strong: 'font-weight: 700;color: rgb(248, 57, 41);',
|
||||||
video: 'width: 100%',
|
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;',
|
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,
|
loadingGif: utils.checkImageUrl(getAppConfigs().imagesConfig.loadingGifUrl),
|
||||||
emptyGif: getAppConfigs().imagesConfig.loadingEmptyUrl,
|
emptyGif: utils.checkImageUrl(getAppConfigs().imagesConfig.loadingEmptyUrl),
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-13
@@ -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() {
|
onLoad() {
|
||||||
this.fnResetSetAniWaitIndex()
|
this.fnResetSetAniWaitIndex()
|
||||||
},
|
},
|
||||||
@@ -72,7 +60,7 @@ export default {
|
|||||||
// 设置页面标题
|
// 设置页面标题
|
||||||
fnSetPageTitle(title) {
|
fnSetPageTitle(title) {
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: title || (this.haloConfig && this.haloConfig.startConfig.title) || "uni-halo",
|
title: title || this.haloConfig?.appConfig?.startConfig?.title || "uni-halo",
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
|
||||||
@@ -1,197 +1,198 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="cache-image-wrap">
|
<view class="cache-image-wrap">
|
||||||
<view v-if="loadStatus == 'loading'" class="img-loading" :style="[imgStyle, loadStyle]">
|
<view v-if="loadStatus == 'loading'" class="img-loading" :style="[imgStyle, loadStyle]">
|
||||||
<!-- <text class="img-load-icon iconfont icon-loading"></text>
|
<!-- <text class="img-load-icon iconfont icon-loading"></text>
|
||||||
<text class="img-load-text">{{ loadText }}</text> -->
|
<text class="img-load-text">{{ loadText }}</text> -->
|
||||||
<image :src="loadingImgSrc" :style="[loadingImgStyle]" mode="aspectFit"></image>
|
<image :src="loadingImgSrc" :style="[loadingImgStyle]" mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="loadStatus == 'error'" class="img-error" :style="[imgStyle, loadErrStyle]">
|
<view v-if="loadStatus == 'error'" class="img-error" :style="[imgStyle, loadErrStyle]">
|
||||||
<!-- <text class="img-err-icon iconfont icon-exclamation-circle"></text>
|
<!-- <text class="img-err-icon iconfont icon-exclamation-circle"></text>
|
||||||
<text class="img-load-text">{{ loadErrText }}</text> -->
|
<text class="img-load-text">{{ loadErrText }}</text> -->
|
||||||
<image class="img-error-img" :src="loadingErrorImageSrc" mode="scaleToFill"></image>
|
<image class="img-error-img" :src="loadingErrorImageSrc" mode="scaleToFill"></image>
|
||||||
</view>
|
</view>
|
||||||
<image v-show="loadStatus == 'success'" :src="src" @load="fnOnLoad" @error="fnOnError" :lazy-load="lazyLoad"
|
<image v-show="loadStatus == 'success'" :src="src" @load="fnOnLoad" @error="fnOnError" :lazy-load="lazyLoad"
|
||||||
:style="[imgStyle]" :mode="mode" @click="$emit('on-click', url)"></image>
|
:style="[imgStyle]" :mode="mode" @click="$emit('on-click', url)"></image>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import imageCache from '@/utils/imageCache.js';
|
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
|
|
||||||
};
|
|
||||||
|
|
||||||
// 查找获取图片缓存
|
export default {
|
||||||
this.fnGetImageCache();
|
name: 'cache-image',
|
||||||
},
|
props: {
|
||||||
methods: {
|
url: {
|
||||||
// 查找获取图片缓存
|
type: String,
|
||||||
async fnGetImageCache() {
|
default: ''
|
||||||
// #ifdef APP-PLUS
|
},
|
||||||
var result = await imageCache.getImageCache(this.url, this.fileMd5);
|
lazyLoad: {
|
||||||
if (result) {
|
type: Boolean,
|
||||||
this.src = result;
|
default: true
|
||||||
} else {
|
},
|
||||||
this.src = this.url;
|
loadStyle: {
|
||||||
}
|
type: Object,
|
||||||
// #endif
|
default() {
|
||||||
// #ifndef APP-PLUS
|
return {
|
||||||
this.src = this.url;
|
backgroundColor: '#ffffff',
|
||||||
// #endif
|
color: '#333'
|
||||||
},
|
};
|
||||||
fnOnLoad() {
|
}
|
||||||
this.loadStatus = 'success';
|
},
|
||||||
},
|
loadErrStyle: {
|
||||||
fnOnError(e) {
|
type: Object,
|
||||||
this.loadStatus = 'error';
|
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>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.cache-image-wrap {
|
.cache-image-wrap {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.img-loading,
|
.img-loading,
|
||||||
.img-error {
|
.img-error {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background-color: #f2f2f2;
|
background-color: #f2f2f2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.img-load-icon {
|
.img-load-icon {
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
animation: xhRote 0.8s infinite linear;
|
animation: xhRote 0.8s infinite linear;
|
||||||
}
|
}
|
||||||
|
|
||||||
.img-load-text {
|
.img-load-text {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
margin-top: 8rpx;
|
margin-top: 8rpx;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.img-error {
|
.img-error {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
|
|
||||||
&-img {
|
&-img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.img-err-icon {
|
.img-err-icon {
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes xhRote {
|
@keyframes xhRote {
|
||||||
0% {
|
0% {
|
||||||
transform: rotate(0deg);
|
transform: rotate(0deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
100% {
|
100% {
|
||||||
transform: rotate(360deg);
|
transform: rotate(360deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -30,8 +30,7 @@
|
|||||||
<text class="text-red text-size-s">- 文章已开启禁止评论 -</text>
|
<text class="text-red text-size-s">- 文章已开启禁止评论 -</text>
|
||||||
</tm-empty>
|
</tm-empty>
|
||||||
<tm-empty v-else icon="icon-shiliangzhinengduixiang-" label="暂无评论">
|
<tm-empty v-else icon="icon-shiliangzhinengduixiang-" label="暂无评论">
|
||||||
<tm-button theme="light-blue" :dense="true" :shadow="0" size="m"
|
<tm-button theme="light-blue" :dense="true" :shadow="0" size="m" @click="fnToComment(null)">抢沙发
|
||||||
@click="fnToComment(null)">抢沙发
|
|
||||||
</tm-button>
|
</tm-button>
|
||||||
</tm-empty>
|
</tm-empty>
|
||||||
</view>
|
</view>
|
||||||
@@ -146,11 +145,9 @@ export default {
|
|||||||
return uni.$tm.toast('文章已禁止评论!');
|
return uni.$tm.toast('文章已禁止评论!');
|
||||||
}
|
}
|
||||||
let _comment = {};
|
let _comment = {};
|
||||||
|
console.log('data', data)
|
||||||
if (data) {
|
if (data) {
|
||||||
let {
|
let {type, comment} = data;
|
||||||
type,
|
|
||||||
comment
|
|
||||||
} = data;
|
|
||||||
// 来自用户
|
// 来自用户
|
||||||
_comment = {
|
_comment = {
|
||||||
isComment: false,
|
isComment: false,
|
||||||
@@ -165,16 +162,14 @@ export default {
|
|||||||
_comment = {
|
_comment = {
|
||||||
isComment: true,
|
isComment: true,
|
||||||
postName: this.post.metadata.name,
|
postName: this.post.metadata.name,
|
||||||
title: '评论文章:' + this.post.spec.title,
|
title: '新增评论',
|
||||||
formPage: 'comment_list',
|
formPage: 'comment_list',
|
||||||
from: 'posts',
|
from: 'posts',
|
||||||
type: 'post'
|
type: 'post'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$emit("on-comment", {
|
this.$emit("on-comment", _comment)
|
||||||
_comment
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
fnCopyContent(content) {
|
fnCopyContent(content) {
|
||||||
uni.$tm.u.setClipboardData(content);
|
uni.$tm.u.setClipboardData(content);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<tm-poup v-model="isShow" position="bottom" height="71vh" @change="handleOnChange">
|
<tm-poup v-model="isShow" position="bottom" height="71vh" @change="handleOnChange">
|
||||||
<view class="title text-align-center">{{ calcTitle }}</view>
|
<view class="title text-align-center">{{ calcTitle }}</view>
|
||||||
<tm-form @submit="fnOnSubmit">
|
<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字符..."
|
bg-color="grey-lighten-5" :maxlength="200" :borderBottom="false" placeholder="请输入内容,不超过200字符..."
|
||||||
v-model="form.content"></tm-input>
|
v-model="form.content"></tm-input>
|
||||||
<tm-input name="author" align="right" required title="我的昵称" placeholder="请输入您的昵称..."
|
<tm-input name="author" align="right" required title="我的昵称" placeholder="请输入您的昵称..."
|
||||||
@@ -169,7 +169,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.$httpApi.v2.addPostComment(commentForm)
|
this.$httpApi.v2.addPostComment(commentForm)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
uni.$tm.toast('评论成功!');
|
uni.$tm.toast('评论成功,可能需要审核!');
|
||||||
// 更新评论者信息
|
// 更新评论者信息
|
||||||
this.handleSetVisitor();
|
this.handleSetVisitor();
|
||||||
this.handleClose(true)
|
this.handleClose(true)
|
||||||
@@ -196,7 +196,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.$httpApi.v2.addPostCommentReply(this.form.postName, replyForm)
|
this.$httpApi.v2.addPostCommentReply(this.form.postName, replyForm)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
uni.$tm.toast('回复成功!');
|
uni.$tm.toast('回复成功,可能需要审核!');
|
||||||
// 更新评论者信息
|
// 更新评论者信息
|
||||||
this.handleSetVisitor();
|
this.handleSetVisitor();
|
||||||
this.handleClose(true)
|
this.handleClose(true)
|
||||||
|
|||||||
@@ -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
@@ -1,30 +1,50 @@
|
|||||||
// 应用设置存储key值
|
// 应用设置存储key值
|
||||||
export const _AppConfigKey = 'APP_GLOBAL_CONFIGS';
|
export const _AppConfigKey = 'APP_GLOBAL_CONFIGS';
|
||||||
|
export const _AppMockJsonKey = 'APP_GLOBAL_MOCK_JSON';
|
||||||
|
|
||||||
// 默认的应用设置
|
// 默认的应用设置
|
||||||
export const DefaultAppConfigs = {
|
export const DefaultAppConfigs = {
|
||||||
loveConfig: {},
|
loveConfig: {},
|
||||||
imagesConfig: {},
|
imagesConfig: {},
|
||||||
authorConfig: {},
|
authorConfig: {},
|
||||||
appConfig: {},
|
appConfig: {},
|
||||||
pluginConfig: {},
|
pluginConfig: {},
|
||||||
adConfig: {},
|
pageConfig: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取应用设置
|
* 获取应用设置
|
||||||
*/
|
*/
|
||||||
export const getAppConfigs = () => {
|
export const getAppConfigs = () => {
|
||||||
let configs = uni.getStorageSync(_AppConfigKey)
|
let configs = uni.getStorageSync(_AppConfigKey)
|
||||||
if (configs) return JSON.parse(configs)
|
if (configs) return JSON.parse(configs)
|
||||||
|
|
||||||
uni.setStorageSync(_AppConfigKey, JSON.stringify(DefaultAppConfigs))
|
uni.setStorageSync(_AppConfigKey, JSON.stringify(DefaultAppConfigs))
|
||||||
return configs;
|
return DefaultAppConfigs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存应用设置
|
* 保存应用设置
|
||||||
*/
|
*/
|
||||||
export const setAppConfigs = (configs) => {
|
export const setAppConfigs = (configs) => {
|
||||||
uni.setStorageSync(_AppConfigKey, JSON.stringify(configs))
|
uni.setStorageSync(_AppConfigKey, JSON.stringify(configs))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取应用模拟数据
|
||||||
|
*/
|
||||||
|
export const getAppMockJson = () => {
|
||||||
|
let json = uni.getStorageSync(_AppMockJsonKey)
|
||||||
|
if (json) return JSON.parse(json)
|
||||||
|
|
||||||
|
uni.setStorageSync(_AppMockJsonKey, JSON.stringify({}))
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存应用模拟数据
|
||||||
|
*/
|
||||||
|
export const setAppMockJson = (json) => {
|
||||||
|
uni.setStorageSync(_AppMockJsonKey, JSON.stringify(json))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,177 @@
|
|||||||
|
{
|
||||||
|
"home": {
|
||||||
|
"bannerList": [
|
||||||
|
{
|
||||||
|
"title": "uni-halo(2.0)开源啦!!!",
|
||||||
|
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
|
||||||
|
"cover": "/upload/uni_halo_ad_cover.png",
|
||||||
|
"time": "2024-05-25 08:59:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "uni-halo(2.0)开源啦!!!",
|
||||||
|
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
|
||||||
|
"cover": "/upload/uni_halo_ad_cover.png",
|
||||||
|
"time": "2024-05-25 08:59:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "uni-halo(2.0)开源啦!!!",
|
||||||
|
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
|
||||||
|
"cover": "/upload/uni_halo_ad_cover.png",
|
||||||
|
"time": "2024-05-25 08:59:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "uni-halo(2.0)开源啦!!!",
|
||||||
|
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
|
||||||
|
"cover": "/upload/uni_halo_ad_cover.png",
|
||||||
|
"time": "2024-05-25 08:59:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "uni-halo(2.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-halo(2.0)开源啦!!!",
|
||||||
|
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
|
||||||
|
"cover": "/upload/uni_halo_ad_cover.png",
|
||||||
|
"time": "2024-05-25 08:59:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "uni-halo(2.0)开源啦!!!",
|
||||||
|
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
|
||||||
|
"cover": "/upload/uni_halo_ad_cover.png",
|
||||||
|
"time": "2024-05-25 08:59:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "uni-halo(2.0)开源啦!!!",
|
||||||
|
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
|
||||||
|
"cover": "/upload/uni_halo_ad_cover.png",
|
||||||
|
"time": "2024-05-25 08:59:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "uni-halo(2.0)开源啦!!!",
|
||||||
|
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
|
||||||
|
"cover": "/upload/uni_halo_ad_cover.png",
|
||||||
|
"time": "2024-05-25 08:59:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "uni-halo(2.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-halo(2.0)开源啦!!!",
|
||||||
|
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
|
||||||
|
"cover": "/upload/uni_halo_ad_cover.png",
|
||||||
|
"time": "2024-05-25 08:59:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "uni-halo(2.0)开源啦!!!",
|
||||||
|
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
|
||||||
|
"cover": "/upload/uni_halo_ad_cover.png",
|
||||||
|
"time": "2024-05-25 08:59:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "uni-halo(2.0)开源啦!!!",
|
||||||
|
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
|
||||||
|
"cover": "/upload/uni_halo_ad_cover.png",
|
||||||
|
"time": "2024-05-25 08:59:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "uni-halo(2.0)开源啦!!!",
|
||||||
|
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
|
||||||
|
"cover": "/upload/uni_halo_ad_cover.png",
|
||||||
|
"time": "2024-05-25 08:59:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "uni-halo(2.0)开源啦!!!",
|
||||||
|
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
|
||||||
|
"cover": "/upload/uni_halo_ad_cover.png",
|
||||||
|
"time": "2024-05-25 08:59:00"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,5 @@
|
|||||||
import App from "./App";
|
import App from "./App";
|
||||||
import Vue from "vue";
|
import Vue from "vue";
|
||||||
import {
|
|
||||||
router,
|
|
||||||
RouterMount
|
|
||||||
} from './router/router.js'
|
|
||||||
Vue.use(router)
|
|
||||||
|
|
||||||
// 挂载全局工具类
|
// 挂载全局工具类
|
||||||
import utils from "./utils/index.js";
|
import utils from "./utils/index.js";
|
||||||
@@ -75,10 +70,4 @@ const app = new Vue({
|
|||||||
...App,
|
...App,
|
||||||
});
|
});
|
||||||
|
|
||||||
// #ifdef H5
|
app.$mount();
|
||||||
RouterMount(app, router, '#app')
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// #ifndef H5
|
|
||||||
app.$mount(); //为了兼容小程序及app端必须这样写才有效果
|
|
||||||
// #endif
|
|
||||||
|
|||||||
+24
-26
@@ -1,28 +1,26 @@
|
|||||||
{
|
{
|
||||||
"name": "uni-halo",
|
"name": "uni-halo",
|
||||||
"version": "1.0.0",
|
"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>",
|
"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": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://gitee.com/ialley-workshop-open/uni-halo.git"
|
"url": "git+https://gitee.com/ialley-workshop-open/uni-halo.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uni-halo",
|
"uni-halo",
|
||||||
"小莫唐尼",
|
"小莫唐尼",
|
||||||
"巷子工坊"
|
"巷子工坊"
|
||||||
],
|
],
|
||||||
"author": "巷子工坊丨小莫唐尼",
|
"author": "巷子工坊丨小莫唐尼",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://gitee.com/ialley-workshop-open/uni-halo/issues"
|
"url": "https://gitee.com/ialley-workshop-open/uni-halo/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://uni-halo.925i.cn",
|
"homepage": "https://uni-halo.925i.cn",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vue-i18n": "^9.1.10"
|
"vue-i18n": "^9.1.10"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"qs": "^6.12.1",
|
"qs": "^6.12.1"
|
||||||
"uni-read-pages": "^1.0.5",
|
}
|
||||||
"uni-simple-router": "^2.0.8-beta.4"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-24
@@ -107,7 +107,7 @@
|
|||||||
{
|
{
|
||||||
"path": "article-detail/article-detail",
|
"path": "article-detail/article-detail",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "文章详情",
|
"navigationBarTitleText": "内容详情",
|
||||||
"enablePullDownRefresh": true,
|
"enablePullDownRefresh": true,
|
||||||
"app-plus": {
|
"app-plus": {
|
||||||
"pullToRefresh": {
|
"pullToRefresh": {
|
||||||
@@ -163,7 +163,7 @@
|
|||||||
{
|
{
|
||||||
"path": "archives/archives",
|
"path": "archives/archives",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "文章归档",
|
"navigationBarTitleText": "归档",
|
||||||
"enablePullDownRefresh": true,
|
"enablePullDownRefresh": true,
|
||||||
"app-plus": {
|
"app-plus": {
|
||||||
"pullToRefresh": {
|
"pullToRefresh": {
|
||||||
@@ -185,24 +185,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"path": "journal/journal",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "个人日记",
|
|
||||||
"enablePullDownRefresh": true,
|
|
||||||
"app-plus": {
|
|
||||||
"pullToRefresh": {
|
|
||||||
"color": "#03a9f4",
|
|
||||||
"style": "circle"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"path": "articles/articles",
|
"path": "articles/articles",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "文章列表",
|
"navigationBarTitleText": "内容搜索",
|
||||||
"enablePullDownRefresh": true,
|
"enablePullDownRefresh": true,
|
||||||
"app-plus": {
|
"app-plus": {
|
||||||
"pullToRefresh": {
|
"pullToRefresh": {
|
||||||
@@ -272,13 +259,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"path": "test-page/test-page",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"path": "advertise/advertise",
|
"path": "advertise/advertise",
|
||||||
"style": {
|
"style": {
|
||||||
|
|||||||
+32
-3
@@ -5,17 +5,37 @@
|
|||||||
<script>
|
<script>
|
||||||
const homePagePath = '/pages/tabbar/home/home'
|
const homePagePath = '/pages/tabbar/home/home'
|
||||||
const startPagePath = '/pagesA/start/start'
|
const startPagePath = '/pagesA/start/start'
|
||||||
|
const articleDetailPath = '/pagesA/article-detail/article-detail';
|
||||||
export default {
|
export default {
|
||||||
computed: {
|
computed: {
|
||||||
configs() {
|
configs() {
|
||||||
return this.$tm.vx.getters().getConfigs;
|
return this.$tm.vx.getters().getConfigs;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad: function (options) {
|
||||||
uni.$tm.vx.actions('config/fetchConfigs').then((res) => {
|
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
|
// #ifdef MP-WEIXIN
|
||||||
uni.$tm.vx.commit('setWxShare', res.shareConfig);
|
// uni.$tm.vx.commit('setWxShare', res.shareConfig);
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
// 获取mockjson
|
||||||
|
if (res.basicConfig.auditModeEnabled) {
|
||||||
|
await uni.$tm.vx.actions('config/fetchMockJson')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 进入检查
|
||||||
this.fnCheckShowStarted();
|
this.fnCheckShowStarted();
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
@@ -51,6 +71,15 @@ export default {
|
|||||||
url: startPagePath
|
url: startPagePath
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
async getPostIdByQRCode(key) {
|
||||||
|
const response = await this.$httpApi.v2.getQRCodeInfo(key);
|
||||||
|
if (response) {
|
||||||
|
if (response && response.postId) {
|
||||||
|
return response.postId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
<tm-flop :startVal="0" :decimals="0" :endVal="statistics.post"
|
<tm-flop :startVal="0" :decimals="0" :endVal="statistics.post"
|
||||||
:duration="3000"></tm-flop>
|
:duration="3000"></tm-flop>
|
||||||
</view>
|
</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>
|
||||||
<view class="item flex-1 text-align-center">
|
<view class="item flex-1 text-align-center">
|
||||||
<view class="number text-size-xl text-bg-gradient-green-accent">
|
<view class="number text-size-xl text-bg-gradient-green-accent">
|
||||||
@@ -132,43 +132,39 @@ export default {
|
|||||||
haloConfigs() {
|
haloConfigs() {
|
||||||
return this.$tm.vx.getters().getConfigs
|
return this.$tm.vx.getters().getConfigs
|
||||||
},
|
},
|
||||||
calcDefaultImageConfig() {
|
pageConfig() {
|
||||||
return this.haloConfigs.imagesConfig
|
return this.haloConfigs.pageConfig.aboutConfig;
|
||||||
|
},
|
||||||
|
postDetailConfig() {
|
||||||
|
return this.haloConfigs.basicConfig.postDetailConfig;
|
||||||
},
|
},
|
||||||
bloggerInfo() {
|
bloggerInfo() {
|
||||||
return this.haloConfigs.authorConfig.blogger;
|
return this.haloConfigs.authorConfig.blogger;
|
||||||
},
|
},
|
||||||
calcProfileStyle() {
|
calcProfileStyle() {
|
||||||
const _imgUrlOr = this.calcDefaultImageConfig.aboutProfileImageUrl;
|
const _imgUrlOr = this.pageConfig.bgImageUrl;
|
||||||
return {
|
return {
|
||||||
backgroundImage: `url(${this.$utils.checkImageUrl(_imgUrlOr)})`
|
backgroundImage: `url(${this.$utils.checkImageUrl(_imgUrlOr)})`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
calcWaveUrl() {
|
calcWaveUrl() {
|
||||||
return this.$utils.checkImageUrl(this.calcDefaultImageConfig.waveImageUrl);
|
return this.$utils.checkImageUrl(this.pageConfig.waveImageUrl);
|
||||||
},
|
},
|
||||||
copyrightConfig() {
|
copyrightConfig() {
|
||||||
return this.haloConfigs.basicConfig.copyrightConfig;
|
return this.haloConfigs.basicConfig.copyrightConfig;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
globalAppSettings: {
|
|
||||||
deep: true,
|
|
||||||
handler(val) {
|
|
||||||
this.statisticsShowMore = val.about.showAllCount;
|
|
||||||
this.fnGetNavList();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
haloConfigs: {
|
haloConfigs: {
|
||||||
|
handler(val) {
|
||||||
|
if (!val) return;
|
||||||
|
this.fnGetNavList();
|
||||||
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler(val) {
|
|
||||||
this.fnGetNavList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.statisticsShowMore = this.globalAppSettings.about.showAllCount;
|
|
||||||
this.fnGetData();
|
this.fnGetData();
|
||||||
},
|
},
|
||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
@@ -181,37 +177,38 @@ export default {
|
|||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
_isWx = true;
|
_isWx = true;
|
||||||
// #endif
|
// #endif
|
||||||
this.navList = [{
|
this.navList = [
|
||||||
key: 'archives',
|
{
|
||||||
title: '文章归档',
|
key: 'archives',
|
||||||
leftIcon: 'halocoloricon-classify',
|
title: this.haloConfigs.basicConfig.auditModeEnabled ? '内容归档' : '文章归档',
|
||||||
leftIconColor: 'red',
|
leftIcon: 'halocoloricon-classify',
|
||||||
rightText: '已归档的文章',
|
leftIconColor: 'red',
|
||||||
path: '/pagesA/archives/archives',
|
rightText: this.haloConfigs.basicConfig.auditModeEnabled ? '已归档的内容' : '已归档的文章',
|
||||||
isAdmin: false,
|
path: '/pagesA/archives/archives',
|
||||||
type: 'page',
|
isAdmin: false,
|
||||||
show: false
|
type: 'page',
|
||||||
}, {
|
show: true
|
||||||
key: 'love',
|
}, {
|
||||||
title: '恋爱日记',
|
key: 'love',
|
||||||
leftIcon: 'halocoloricon-attent',
|
title: '恋爱日记',
|
||||||
leftIconColor: 'red',
|
leftIcon: 'halocoloricon-attent',
|
||||||
rightText: '甜蜜恋人的专属',
|
leftIconColor: 'red',
|
||||||
path: '/pagesA/love/love',
|
rightText: '甜蜜恋人的专属',
|
||||||
isAdmin: false,
|
path: '/pagesA/love/love',
|
||||||
type: 'page',
|
isAdmin: false,
|
||||||
show: this.haloConfigs.loveConfig.loveEnabled
|
type: 'page',
|
||||||
}, {
|
show: this.haloConfigs.loveConfig.loveEnabled
|
||||||
key: 'disclaimers',
|
}, {
|
||||||
title: '友情链接',
|
key: 'disclaimers',
|
||||||
leftIcon: 'icon-lianjie',
|
title: '友情链接',
|
||||||
leftIconColor: 'blue',
|
leftIcon: 'icon-lianjie',
|
||||||
rightText: '看看朋友们吧',
|
leftIconColor: 'blue',
|
||||||
path: '/pagesA/friend-links/friend-links',
|
rightText: '看看朋友们吧',
|
||||||
isAdmin: false,
|
path: '/pagesA/friend-links/friend-links',
|
||||||
type: 'page',
|
isAdmin: false,
|
||||||
show: true
|
type: 'page',
|
||||||
},
|
show: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: 'disclaimers',
|
key: 'disclaimers',
|
||||||
title: '免责声明',
|
title: '免责声明',
|
||||||
@@ -232,7 +229,7 @@ export default {
|
|||||||
path: '/pagesA/contact/contact',
|
path: '/pagesA/contact/contact',
|
||||||
isAdmin: false,
|
isAdmin: false,
|
||||||
type: 'page',
|
type: 'page',
|
||||||
show: true
|
show: this.haloConfigs.authorConfig.social.enabled
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'session',
|
key: 'session',
|
||||||
@@ -291,28 +288,7 @@ export default {
|
|||||||
// type: 'poup',
|
// type: 'poup',
|
||||||
// show: true
|
// show: true
|
||||||
// },
|
// },
|
||||||
{
|
|
||||||
key: 'setting',
|
|
||||||
title: '应用设置',
|
|
||||||
leftIcon: 'icon-cog',
|
|
||||||
leftIconColor: 'indigo',
|
|
||||||
rightText: `进入系统常用设置`,
|
|
||||||
path: '/pagesA/setting/setting',
|
|
||||||
isAdmin: false,
|
|
||||||
type: 'page',
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'admin',
|
|
||||||
title: '后台管理',
|
|
||||||
leftIcon: 'icon-lock',
|
|
||||||
leftIconColor: 'gray',
|
|
||||||
rightText: '博客后台系统入口',
|
|
||||||
path: '/pagesB/admin/admin',
|
|
||||||
isAdmin: true,
|
|
||||||
type: 'page',
|
|
||||||
show: this.globalAppSettings.about.showAdmin
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
fnGetData() {
|
fnGetData() {
|
||||||
@@ -406,9 +382,9 @@ export default {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (type == 'page') {
|
} else if (type == 'page') {
|
||||||
this.$Router.push({
|
uni.navigateTo({
|
||||||
path: path
|
url: path
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
+239
-188
@@ -1,207 +1,258 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page">
|
<view class="app-page">
|
||||||
<view v-if="loading != 'success'" class="loading-wrap">
|
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<view v-if="loading !== 'success'" class="loading-wrap">
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
</view>
|
<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;">
|
<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>
|
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
|
||||||
<block v-else>
|
</view>
|
||||||
<tm-translate v-for="(item, index) in dataList" :key="index"
|
<block v-else>
|
||||||
style="box-sizing: border-box;width: 50%;padding: 0 8rpx;" animation-name="fadeUp"
|
<tm-translate v-for="(item, index) in dataList" :key="index"
|
||||||
:wait="calcAniWait(index)">
|
style="box-sizing: border-box;width: 50%;padding: 0 8rpx;" animation-name="fadeUp"
|
||||||
<view class="catgory-card" :style="{backgroundImage:`url(${item.spec.cover})`}">
|
:wait="calcAniWait(index)">
|
||||||
<view class="content" @click="handleToCategory(item)">
|
<view class="catgory-card" :style="{backgroundImage:`url(${item.spec.cover})`}">
|
||||||
<view style="font-size: 32rpx;color: #ffffff;">{{ item.spec.displayName }}</view>
|
<view class="content" @click="handleToCategory(item)">
|
||||||
<view style="font-size: 24rpx;color: #ffffff;margin-top: 6rpx;">共
|
<view style="font-size: 32rpx;color: #ffffff;">{{ item.spec.displayName }}</view>
|
||||||
{{ item.postCount }} 篇文章
|
<view v-if="!haloConfigs.basicConfig.auditModeEnabled" style="font-size: 24rpx;color: #ffffff;margin-top: 6rpx;">
|
||||||
</view>
|
共 {{ item.postCount }} 篇文章
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view v-else style="font-size: 24rpx;color: #ffffff;margin-top: 6rpx;">
|
||||||
</tm-translate>
|
共 {{ item.postCount }} 篇内容
|
||||||
<tm-flotbutton @click="fnToTopPage" size="m" color="light-blue" icon="icon-angle-up"></tm-flotbutton>
|
</view>
|
||||||
<view class="load-text">{{ loadMoreText }}</view>
|
</view>
|
||||||
</block>
|
</view>
|
||||||
</view>
|
</tm-translate>
|
||||||
</view>
|
<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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||||
|
|
||||||
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
||||||
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
tmSkeleton,
|
tmSkeleton,
|
||||||
tmFlotbutton,
|
tmFlotbutton,
|
||||||
tmTranslate,
|
tmTranslate,
|
||||||
tmEmpty,
|
tmEmpty,
|
||||||
mpHtml
|
mpHtml
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
markdownConfig: MarkdownConfig,
|
markdownConfig: MarkdownConfig,
|
||||||
loading: 'loading',
|
loading: 'loading',
|
||||||
queryParams: {
|
queryParams: {
|
||||||
size: 20,
|
size: 20,
|
||||||
page: 1
|
page: 1
|
||||||
},
|
},
|
||||||
hasNext: false,
|
hasNext: false,
|
||||||
dataList: [],
|
dataList: [],
|
||||||
isLoadMore: false,
|
isLoadMore: false,
|
||||||
loadMoreText: '加载中...'
|
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() {
|
onReachBottom(e) {
|
||||||
this.fnGetData();
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
},
|
uni.showToast({
|
||||||
onPullDownRefresh() {
|
icon: 'none',
|
||||||
this.isLoadMore = false;
|
title: '没有更多数据了'
|
||||||
this.queryParams.page = 0;
|
});
|
||||||
this.fnGetData();
|
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) {
|
this.loading = 'success';
|
||||||
if (this.hasNext) {
|
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||||
this.queryParams.page += 1;
|
// 处理数据
|
||||||
this.isLoadMore = true;
|
this.hasNext = res.hasNext;
|
||||||
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';
|
const tempItems = res.items.map(item => {
|
||||||
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
item.spec.cover = this.$utils.checkThumbnailUrl(item.spec.cover, true)
|
||||||
// 处理数据
|
return item;
|
||||||
this.hasNext = res.hasNext;
|
})
|
||||||
|
|
||||||
const tempItems = res.items.map(item => {
|
if (this.isLoadMore) {
|
||||||
item.spec.cover = this.$utils.checkThumbnailUrl(item.spec.cover, true)
|
this.dataList = this.dataList.concat(tempItems);
|
||||||
return item;
|
} else {
|
||||||
})
|
this.dataList = tempItems;
|
||||||
|
}
|
||||||
if (this.isLoadMore) {
|
})
|
||||||
this.dataList = this.dataList.concat(tempItems);
|
.catch(err => {
|
||||||
} else {
|
console.error(err);
|
||||||
this.dataList = tempItems;
|
this.loading = 'error';
|
||||||
}
|
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.finally(() => {
|
||||||
console.error(err);
|
setTimeout(() => {
|
||||||
this.loading = 'error';
|
uni.hideLoading();
|
||||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
uni.stopPullDownRefresh();
|
||||||
})
|
}, 500);
|
||||||
.finally(() => {
|
});
|
||||||
setTimeout(() => {
|
},
|
||||||
uni.hideLoading();
|
handlePreview(index, list) {
|
||||||
uni.stopPullDownRefresh();
|
uni.previewImage({
|
||||||
}, 500);
|
current: index,
|
||||||
});
|
urls: list.map(item => item.url)
|
||||||
},
|
})
|
||||||
handlePreview(index, list) {
|
},
|
||||||
uni.previewImage({
|
handleToCategory(data) {
|
||||||
current: index,
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
urls: list.map(item => item.url)
|
return;
|
||||||
})
|
}
|
||||||
},
|
uni.navigateTo({
|
||||||
handleToCategory(data) {
|
url: `/pagesA/category-detail/category-detail?name=${data.metadata.name}&title=${data.spec.displayName}`
|
||||||
uni.navigateTo({
|
})
|
||||||
url: `/pagesA/category-detail/category-detail?name=${data.metadata.name}&title=${data.spec.displayName}`
|
}
|
||||||
})
|
}
|
||||||
}
|
};
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-page {
|
.app-page {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 24rpx 0;
|
padding: 24rpx 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading-wrap {
|
.auditModeEnabled {
|
||||||
padding: 24rpx;
|
width: 100%;
|
||||||
}
|
height: 80vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
.app-page-content {
|
.loading-wrap {
|
||||||
display: flex;
|
padding: 24rpx;
|
||||||
flex-wrap: wrap;
|
}
|
||||||
padding: 0 12rpx;
|
|
||||||
gap: 20rpx 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.catgory-card {
|
.app-page-content {
|
||||||
width: 100%;
|
display: flex;
|
||||||
height: 200rpx;
|
flex-wrap: wrap;
|
||||||
position: relative;
|
padding: 0 12rpx;
|
||||||
display: flex;
|
gap: 20rpx 0;
|
||||||
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;
|
|
||||||
|
|
||||||
&:before {
|
.catgory-card {
|
||||||
content: '';
|
width: 100%;
|
||||||
position: absolute;
|
height: 200rpx;
|
||||||
left: 0;
|
position: relative;
|
||||||
top: 0;
|
display: flex;
|
||||||
right: 0;
|
flex-direction: column;
|
||||||
bottom: 0;
|
box-sizing: border-box;
|
||||||
background-color: rgba(0, 0, 0, 0.15);
|
border-radius: 12rpx;
|
||||||
z-index: 1;
|
background-color: #ffff;
|
||||||
}
|
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||||
}
|
overflow: hidden;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: cover;
|
||||||
|
|
||||||
.content {
|
&:before {
|
||||||
width: 100%;
|
content: '';
|
||||||
height: 100%;
|
position: absolute;
|
||||||
position: relative;
|
left: 0;
|
||||||
z-index: 2;
|
top: 0;
|
||||||
display: flex;
|
right: 0;
|
||||||
flex-direction: column;
|
bottom: 0;
|
||||||
align-items: center;
|
background-color: rgba(0, 0, 0, 0.15);
|
||||||
justify-content: center;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.load-text {
|
.content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
height: 100%;
|
||||||
}
|
position: relative;
|
||||||
</style>
|
z-index: 2;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.load-text {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<!-- 占位区域 -->
|
<!-- 占位区域 -->
|
||||||
<view v-if="category.list.length > 0" style="width: 100vw;height: 90rpx;"></view>
|
<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>
|
<tm-skeleton model="card"></tm-skeleton>
|
||||||
<tm-skeleton model="card"></tm-skeleton>
|
<tm-skeleton model="card"></tm-skeleton>
|
||||||
@@ -16,17 +16,23 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- 内容区域 -->
|
<!-- 内容区域 -->
|
||||||
<view class="content" v-else>
|
<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>
|
<tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有分享图片~"></tm-empty>
|
||||||
</view>
|
</view>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<block v-for="(item, index) in dataList" :key="index">
|
<block v-if="galleryConfig.useWaterfall">
|
||||||
<tm-translate style="box-sizing: border-box;padding: 6rpx;width: 50%;height: 250rpx;"
|
<!--瀑布流-->
|
||||||
|
<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)">
|
animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||||
<view style="border-radius: 12rpx;overflow: hidden;width: 100%;height: 250rpx;">
|
<view style="border-radius: 12rpx;overflow: hidden;width: 100%;height: 250rpx;">
|
||||||
<image style="width: 100%;height: 100%;" mode="aspectFill" :src="item.spec.cover"
|
<image style="width: 100%;height: 100%;" mode="aspectFill" :src="item.spec.url"
|
||||||
@click="fnPreview(index)"/>
|
@click="fnPreview(item)"/>
|
||||||
</view>
|
</view>
|
||||||
</tm-translate>
|
</tm-translate>
|
||||||
</block>
|
</block>
|
||||||
@@ -34,6 +40,7 @@
|
|||||||
<tm-flotbutton @click="fnToTopPage" color="light-blue" size="m" icon="icon-angle-up"></tm-flotbutton>
|
<tm-flotbutton @click="fnToTopPage" color="light-blue" size="m" icon="icon-angle-up"></tm-flotbutton>
|
||||||
<view class="load-text">{{ loadMoreText }}</view>
|
<view class="load-text">{{ loadMoreText }}</view>
|
||||||
</block>
|
</block>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -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 tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||||
import tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
|
import tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
|
||||||
import tmImages from '@/tm-vuetify/components/tm-images/tm-images.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';
|
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
options: {
|
||||||
|
multipleSlots: true
|
||||||
|
},
|
||||||
components: {
|
components: {
|
||||||
tmSkeleton,
|
tmSkeleton,
|
||||||
tmTranslate,
|
tmTranslate,
|
||||||
@@ -58,7 +68,7 @@ export default {
|
|||||||
tmEmpty,
|
tmEmpty,
|
||||||
tmIcons,
|
tmIcons,
|
||||||
tmImages,
|
tmImages,
|
||||||
tmFlowLayout,
|
tmFlowLayoutCustom,
|
||||||
tmTabs
|
tmTabs
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -75,36 +85,52 @@ export default {
|
|||||||
page: 1,
|
page: 1,
|
||||||
group: ""
|
group: ""
|
||||||
},
|
},
|
||||||
cache: {
|
|
||||||
dataList: [],
|
|
||||||
total: 0
|
|
||||||
},
|
|
||||||
isLoadMore: false,
|
isLoadMore: false,
|
||||||
loadMoreText: '',
|
loadMoreText: '',
|
||||||
hasNext: false,
|
hasNext: false,
|
||||||
dataList: []
|
dataList: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
filters: {
|
computed: {
|
||||||
filterTakeTime(val) {
|
galleryConfig() {
|
||||||
return uni.$tm.dayjs(val).format('DD/MM/YYYY');
|
return this.$tm.vx.getters().getConfigs.pageConfig.galleryConfig;
|
||||||
|
},
|
||||||
|
haloConfigs() {
|
||||||
|
return this.$tm.vx.getters().getConfigs;
|
||||||
|
},
|
||||||
|
mockJson() {
|
||||||
|
return this.$tm.vx.getters().getMockJson;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
watch: {
|
||||||
this.fnSetPageTitle('个人图库');
|
galleryConfig: {
|
||||||
this.fnGetCategory();
|
handler(newValue, oldValue) {
|
||||||
|
if (!newValue) return;
|
||||||
|
this.fnSetPageTitle(newValue.pageTitle);
|
||||||
|
this.fnGetCategory();
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
this.dataList = []
|
this.dataList = []
|
||||||
this.isLoadMore = false;
|
this.isLoadMore = false;
|
||||||
this.queryParams.page = 1;
|
this.queryParams.page = 1;
|
||||||
this.fnGetData();
|
this.fnGetData(true);
|
||||||
},
|
},
|
||||||
onReachBottom(e) {
|
onReachBottom(e) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '没有更多数据了'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (this.hasNext) {
|
if (this.hasNext) {
|
||||||
this.queryParams.page += 1;
|
this.queryParams.page += 1;
|
||||||
this.isLoadMore = true;
|
this.isLoadMore = true;
|
||||||
this.fnGetData();
|
this.fnGetData(false);
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@@ -115,17 +141,20 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
fnOnCategoryChange(index) {
|
fnOnCategoryChange(index) {
|
||||||
this.fnResetSetAniWaitIndex();
|
this.fnResetSetAniWaitIndex();
|
||||||
this.cache.dataList = []
|
|
||||||
this.dataList = [];
|
|
||||||
this.queryParams.group = this.category.list[index].name;
|
this.queryParams.group = this.category.list[index].name;
|
||||||
this.queryParams.page = 1;
|
this.queryParams.page = 1;
|
||||||
this.fnToTopPage();
|
this.fnToTopPage();
|
||||||
this.fnGetData();
|
this.dataList = [];
|
||||||
|
this.fnGetData(true);
|
||||||
},
|
},
|
||||||
fnGetCategory() {
|
fnGetCategory() {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
this.fnGetData(true);
|
||||||
|
return
|
||||||
|
}
|
||||||
this.$httpApi.v2.getPhotoGroupList({
|
this.$httpApi.v2.getPhotoGroupList({
|
||||||
page: 1,
|
page: 1,
|
||||||
size: 9999
|
size: 0
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.category.list = res.items.map(item => {
|
this.category.list = res.items.map(item => {
|
||||||
return {
|
return {
|
||||||
@@ -135,12 +164,41 @@ export default {
|
|||||||
});
|
});
|
||||||
if (this.category.list.length !== 0) {
|
if (this.category.list.length !== 0) {
|
||||||
this.queryParams.group = this.category.list[0].name;
|
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) {
|
if (!this.isLoadMore) {
|
||||||
this.loading = 'loading';
|
this.loading = 'loading';
|
||||||
@@ -149,28 +207,32 @@ export default {
|
|||||||
this.$httpApi.v2
|
this.$httpApi.v2
|
||||||
.getPhotoListByGroupName(this.queryParams)
|
.getPhotoListByGroupName(this.queryParams)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log("相册 res", res)
|
|
||||||
this.hasNext = res.hasNext;
|
this.hasNext = res.hasNext;
|
||||||
this.loading = 'success';
|
this.loading = 'success';
|
||||||
if (res.items.length != 0) {
|
if (res.items.length !== 0) {
|
||||||
const _list = res.items.map((item, index) => {
|
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;
|
return item;
|
||||||
});
|
});
|
||||||
this.fnCacheDataList(_list);
|
|
||||||
if (this.isLoadMore) {
|
if (this.isLoadMore) {
|
||||||
this.dataList = this.dataList.concat(_list);
|
this.dataList = this.dataList.concat(_list);
|
||||||
} else {
|
} else {
|
||||||
this.dataList = _list;
|
this.dataList = _list;
|
||||||
}
|
}
|
||||||
|
if (this.galleryConfig.useWaterfall) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (isClearWaterfall) {
|
||||||
|
this.$refs.wafll.clear()
|
||||||
|
}
|
||||||
|
this.$refs.wafll.pushData(_list)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
this.loading = 'error';
|
this.loading = 'error';
|
||||||
this.waterfall.loading = 'finish';
|
|
||||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
@@ -180,24 +242,14 @@ export default {
|
|||||||
}, 500);
|
}, 500);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 缓存数据
|
fnOnFlowClick({item}) {
|
||||||
fnCacheDataList(dataList) {
|
this.fnPreview(item)
|
||||||
if (this.queryParams.page == 1) {
|
|
||||||
this.cache.dataList = dataList;
|
|
||||||
} else {
|
|
||||||
this.cache.dataList = [...this.cache.dataList, ...dataList];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 瀑布流组件点击事件
|
|
||||||
fnOnClick(data) {
|
|
||||||
console.log('点击数据', data);
|
|
||||||
},
|
},
|
||||||
// 预览
|
// 预览
|
||||||
fnPreview(index) {
|
fnPreview(data) {
|
||||||
uni.previewImage({
|
uni.previewImage({
|
||||||
current: index,
|
current: this.dataList.findIndex(x => x.metadata.name === data.metadata.name),
|
||||||
urls: this.dataList.map(x => x.spec.cover),
|
urls: this.dataList.map(x => x.spec.url),
|
||||||
indicator: 'number',
|
indicator: 'number',
|
||||||
loop: true
|
loop: true
|
||||||
});
|
});
|
||||||
@@ -214,18 +266,13 @@ export default {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding-bottom: 24rpx;
|
padding-bottom: 24rpx;
|
||||||
background-color: #fafafa;
|
background-color: #fafafa;
|
||||||
|
|
||||||
&.is-balck {
|
|
||||||
background-color: #212121;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 0 24rpx;
|
padding: 24rpx 24rpx 0;
|
||||||
padding-top: 24rpx;
|
|
||||||
gap: 12rpx 0;
|
gap: 12rpx 0;
|
||||||
|
|
||||||
.content-empty {
|
.content-empty {
|
||||||
@@ -242,10 +289,6 @@ export default {
|
|||||||
padding: 24rpx;
|
padding: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
|
||||||
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.03);
|
|
||||||
}
|
|
||||||
|
|
||||||
.load-text {
|
.load-text {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
+131
-42
@@ -2,14 +2,14 @@
|
|||||||
<view class="app-page">
|
<view class="app-page">
|
||||||
<tm-menubars iconColor="white" color="white" :flat="true" :showback="false">
|
<tm-menubars iconColor="white" color="white" :flat="true" :showback="false">
|
||||||
<view slot="left">
|
<view slot="left">
|
||||||
<image class="logo ml-24 round-24" :src="appInfo.logo" mode="scaleToFill"/>
|
<image @click="fnOnLogoToPage" class="logo ml-24 round-24" :src="appInfo.logo" mode="scaleToFill"/>
|
||||||
</view>
|
</view>
|
||||||
<view class="search-input round-12 pt-12 pb-12 flex pl-24" @click="fnToSearch">
|
<view class="search-input round-12 pt-12 pb-12 flex pl-24" @click="fnToSearch">
|
||||||
<text class="search-input_icon iconfont text-size-m icon-search text-grey"></text>
|
<text class="search-input_icon iconfont text-size-m icon-search text-grey"></text>
|
||||||
<view class="search-input_text pl-12 text-size-m text-grey">搜索文章...</view>
|
<view class="search-input_text pl-12 text-size-m text-grey">搜索内容...</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- #ifdef APP-PLUS || H5 -->
|
<!-- #ifdef APP-PLUS || H5 -->
|
||||||
<view slot="right" class="mr-24 text-size-m text-grey">uni-halo</view>
|
<view slot="right" class="mr-24 text-size-m text-grey text-overflow">{{ appInfo.name }}</view>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
</tm-menubars>
|
</tm-menubars>
|
||||||
<view v-if="loading !== 'success' && articleList.length===0" class="loading-wrap">
|
<view v-if="loading !== 'success' && articleList.length===0" class="loading-wrap">
|
||||||
@@ -22,37 +22,41 @@
|
|||||||
</view>
|
</view>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<view class="bg-white pb-24">
|
<view class="bg-white pb-24">
|
||||||
<view class="banner bg-white ml-24 mr-24 mt-12 round-3" v-if="bannerList.length != 0">
|
<view class="banner bg-white ml-24 mr-24 mt-12 round-3" v-if="bannerList.length !== 0">
|
||||||
<e-swiper :dotPosition="globalAppSettings.banner.dotPosition" :autoplay="true"
|
<e-swiper :dotPosition="globalAppSettings.banner.dotPosition" :autoplay="true"
|
||||||
:useDot="globalAppSettings.banner.useDot" :list="bannerList"
|
:useDot="globalAppSettings.banner.useDot" :list="bannerList"
|
||||||
@on-click="fnOnBannerClick"></e-swiper>
|
@on-click="fnOnBannerClick"></e-swiper>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex flex-between mt-16 mb-24 pl-24 pr-24">
|
<!-- 精品分类 -->
|
||||||
<view class="page-item_title text-weight-b ">精品分类</view>
|
<block v-if="calcIsShowCategory">
|
||||||
<view class="show-more flex flex-center bg-white round-3" @click="fnToCategoryPage">
|
<view class="flex flex-between mt-16 mb-24 pl-24 pr-24">
|
||||||
<text class="iconfont icon-angle-right text-size-s text-grey-darken-1"></text>
|
<view class="page-item_title text-weight-b ">精品分类</view>
|
||||||
</view>
|
<view class="show-more flex flex-center bg-white round-3" @click="fnToCategoryPage">
|
||||||
<view v-if="false" class="flex flex-center text-size-s text-grey-darken-1" @click="fnToCategoryPage">
|
<text class="iconfont icon-angle-right text-size-s text-grey-darken-1"></text>
|
||||||
<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>
|
</view>
|
||||||
</block>
|
<view v-if="false" class="flex flex-center text-size-s text-grey-darken-1"
|
||||||
</scroll-view>
|
@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="flex flex-between mt-24 mb-24 pl-24 pr-24">
|
||||||
<view class="page-item_title text-weight-b">文章列表</view>
|
<view class="page-item_title text-weight-b">最新列表</view>
|
||||||
<view class="show-more flex flex-center bg-white round-3" @click="fnToArticlesPage">
|
<view class="show-more flex flex-center bg-white round-3" @click="fnToArticlesPage">
|
||||||
<text class="iconfont icon-angle-right text-size-s text-grey-darken-1"></text>
|
<text class="iconfont icon-angle-right text-size-s text-grey-darken-1"></text>
|
||||||
</view>
|
</view>
|
||||||
@@ -61,9 +65,8 @@
|
|||||||
<text class="iconfont icon-angle-right text-size-s "></text>
|
<text class="iconfont icon-angle-right text-size-s "></text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="articleList.length == 0" class="article-empty">
|
<view v-if="articleList.length === 0" class="article-empty">
|
||||||
<tm-empty icon="icon-shiliangzhinengduixiang-"
|
<tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有发表任何内容~"></tm-empty>
|
||||||
label="博主还没有发表任何文章~"></tm-empty>
|
|
||||||
</view>
|
</view>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<view :class="globalAppSettings.layout.home">
|
<view :class="globalAppSettings.layout.home">
|
||||||
@@ -133,12 +136,23 @@ export default {
|
|||||||
const appInfo = this.haloConfigs.appConfig.appInfo;
|
const appInfo = this.haloConfigs.appConfig.appInfo;
|
||||||
appInfo.logo = this.$utils.checkImageUrl(appInfo.logo)
|
appInfo.logo = this.$utils.checkImageUrl(appInfo.logo)
|
||||||
return appInfo;
|
return appInfo;
|
||||||
|
},
|
||||||
|
mockJson() {
|
||||||
|
return this.$tm.vx.getters().getMockJson;
|
||||||
|
},
|
||||||
|
calcIsShowCategory() {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled && this.categoryList.length !== 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return this.haloConfigs.pageConfig.homeConfig.useCategory
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.fnSetPageTitle();
|
this.fnSetPageTitle();
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.fnQuery();
|
this.fnQuery();
|
||||||
},
|
},
|
||||||
@@ -147,8 +161,14 @@ export default {
|
|||||||
this.queryParams.page = 1;
|
this.queryParams.page = 1;
|
||||||
this.fnQuery();
|
this.fnQuery();
|
||||||
},
|
},
|
||||||
|
|
||||||
onReachBottom(e) {
|
onReachBottom(e) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '没有更多数据了'
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
if (this.result.hasNext) {
|
if (this.result.hasNext) {
|
||||||
this.queryParams.page += 1;
|
this.queryParams.page += 1;
|
||||||
this.isLoadMore = true;
|
this.isLoadMore = true;
|
||||||
@@ -162,12 +182,32 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fnQuery() {
|
fnQuery() {
|
||||||
|
console.log('this.mockJson', this.mockJson)
|
||||||
this.fnGetBanner();
|
this.fnGetBanner();
|
||||||
this.fnGetArticleList();
|
this.fnGetArticleList();
|
||||||
this.fnGetCategoryList();
|
this.fnGetCategoryList();
|
||||||
},
|
},
|
||||||
|
|
||||||
fnGetCategoryList() {
|
fnGetCategoryList() {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
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
|
this.$httpApi.v2
|
||||||
.getCategoryList({})
|
.getCategoryList({})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
@@ -192,6 +232,22 @@ export default {
|
|||||||
},
|
},
|
||||||
// 获取轮播图
|
// 获取轮播图
|
||||||
fnGetBanner() {
|
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 _this = this;
|
||||||
const _format = function (list) {
|
const _format = function (list) {
|
||||||
return list.map((item, index) => {
|
return list.map((item, index) => {
|
||||||
@@ -199,12 +255,12 @@ export default {
|
|||||||
mp4: '',
|
mp4: '',
|
||||||
id: item.metadata.name,
|
id: item.metadata.name,
|
||||||
nickname: item.owner.displayName,
|
nickname: item.owner.displayName,
|
||||||
avatar: _this.$utils.checkImageUrl(item.owner.avatar),
|
avatar: _this.$utils.checkAvatarUrl(item.owner.avatar),
|
||||||
address: '',
|
address: '',
|
||||||
createTime: uni.$tm.dayjs(item.spec.publishTime).fromNow(),
|
createTime: uni.$tm.dayjs(item.spec.publishTime).fromNow(),
|
||||||
title: item.spec.title,
|
title: item.spec.title,
|
||||||
src: _this.$utils.checkImageUrl(item.spec.cover),
|
src: _this.$utils.checkThumbnailUrl(item.spec.cover),
|
||||||
image: _this.$utils.checkImageUrl(item.spec.cover)
|
image: _this.$utils.checkThumbnailUrl(item.spec.cover)
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -219,7 +275,6 @@ export default {
|
|||||||
uni.request({
|
uni.request({
|
||||||
url: this.$baseApiUrl + '/apis/api.content.halo.run/v1alpha1/posts?' + paramsStr,
|
url: this.$baseApiUrl + '/apis/api.content.halo.run/v1alpha1/posts?' + paramsStr,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params: this.queryParams,
|
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
this.bannerList = _format(res.data.items);
|
this.bannerList = _format(res.data.items);
|
||||||
},
|
},
|
||||||
@@ -232,7 +287,10 @@ export default {
|
|||||||
this.bannerCurrent = e.current;
|
this.bannerCurrent = e.current;
|
||||||
},
|
},
|
||||||
fnOnBannerClick(item) {
|
fnOnBannerClick(item) {
|
||||||
if (item.id == '') return;
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (item.id === '') return;
|
||||||
this.fnToArticleDetail({
|
this.fnToArticleDetail({
|
||||||
metadata: {
|
metadata: {
|
||||||
name: item.id
|
name: item.id
|
||||||
@@ -241,10 +299,32 @@ export default {
|
|||||||
},
|
},
|
||||||
// 文章列表
|
// 文章列表
|
||||||
fnGetArticleList() {
|
fnGetArticleList() {
|
||||||
// uni.showLoading({
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
// mask: true,
|
this.articleList = this.mockJson.home.postList.map((item) => {
|
||||||
// title: '加载中...'
|
return {
|
||||||
// });
|
metadata: {
|
||||||
|
name: Date.now() * Math.random(),
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
pinned: false,
|
||||||
|
cover: item.cover,
|
||||||
|
title: item.title,
|
||||||
|
publishTime: item.time
|
||||||
|
},
|
||||||
|
status: {
|
||||||
|
excerpt: item.desc
|
||||||
|
},
|
||||||
|
stats: {
|
||||||
|
visit: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.loading = 'success';
|
||||||
|
this.loadMoreText = '呜呜,没有更多数据啦~';
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 设置状态为加载中
|
// 设置状态为加载中
|
||||||
if (!this.isLoadMore) {
|
if (!this.isLoadMore) {
|
||||||
this.loading = 'loading';
|
this.loading = 'loading';
|
||||||
@@ -261,7 +341,6 @@ export default {
|
|||||||
uni.request({
|
uni.request({
|
||||||
url: this.$baseApiUrl + '/apis/api.content.halo.run/v1alpha1/posts?' + paramsStr,
|
url: this.$baseApiUrl + '/apis/api.content.halo.run/v1alpha1/posts?' + paramsStr,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params: this.queryParams,
|
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
const data = res.data;
|
const data = res.data;
|
||||||
this.result.hasNext = data.hasNext;
|
this.result.hasNext = data.hasNext;
|
||||||
@@ -283,9 +362,11 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
//跳转文章详情
|
//跳转文章详情
|
||||||
fnToArticleDetail(article) {
|
fnToArticleDetail(article) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pagesA/article-detail/article-detail?name=' + article.metadata.name,
|
url: '/pagesA/article-detail/article-detail?name=' + article.metadata.name,
|
||||||
animationType: 'slide-in-right'
|
animationType: 'slide-in-right'
|
||||||
@@ -321,6 +402,9 @@ export default {
|
|||||||
|
|
||||||
// 根据slug查询分类下的文章
|
// 根据slug查询分类下的文章
|
||||||
fnToCategoryBy(category) {
|
fnToCategoryBy(category) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pagesA/category-detail/category-detail?name=${category.metadata.name}&title=${category.spec.displayName}`
|
url: `/pagesA/category-detail/category-detail?name=${category.metadata.name}&title=${category.spec.displayName}`
|
||||||
});
|
});
|
||||||
@@ -339,6 +423,11 @@ export default {
|
|||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pagesA/articles/articles'
|
url: '/pagesA/articles/articles'
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
fnOnLogoToPage() {
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/tabbar/about/about'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page">
|
<view class="app-page">
|
||||||
<view v-if="loading != 'success'" class="loading-wrap">
|
<view v-if="loading !== 'success'" class="loading-wrap">
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
</view>
|
</view>
|
||||||
<!-- 内容区域 -->
|
<!-- 内容区域 -->
|
||||||
<view v-else class="app-page-content">
|
<view v-else class="app-page-content">
|
||||||
<view v-if="dataList.length == 0" class="content-empty flex flex-center" style="min-height: 70vh;">
|
<view v-if="dataList.length === 0" class="content-empty flex flex-center" style="min-height: 70vh;">
|
||||||
<!-- 空布局 -->
|
<!-- 空布局 -->
|
||||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
|
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
|
||||||
</view>
|
</view>
|
||||||
@@ -37,13 +37,21 @@
|
|||||||
:content="moment.spec.content.html" :markdown="true" :showLineNumber="true"
|
:content="moment.spec.content.html" :markdown="true" :showLineNumber="true"
|
||||||
:showLanguageName="true" :copyByLongPress="true"/>
|
:showLanguageName="true" :copyByLongPress="true"/>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="moment.spec.content.medium.length!==0" class="images"
|
<view class="mb-12 mt--12" v-if="moment.videos.length!==0"
|
||||||
:class="['images-'+moment.spec.content.medium.length]">
|
style="display: flex; flex-direction: column; gap: 12rpx 0;padding: 0 24rpx; ">
|
||||||
<view class="image-item" v-for="(image,mediumIndex) in moment.spec.content.medium"
|
<video
|
||||||
|
style="width:100%;height: 400rpx;border-radius: 12rpx;"
|
||||||
|
v-for="(video,index) in moment.videos"
|
||||||
|
:key="index" :src="video.url"></video>
|
||||||
|
</view>
|
||||||
|
<view v-if="moment.images.length!==0" class="images"
|
||||||
|
:class="['images-'+moment.images.length]">
|
||||||
|
<view class="image-item"
|
||||||
|
v-for="(image,mediumIndex) in moment.images"
|
||||||
:key="mediumIndex">
|
:key="mediumIndex">
|
||||||
<image mode="aspectFill" style="width: 100%;height: 100%;border-radius: 6rpx;"
|
<image mode="aspectFill" style="width: 100%;height: 100%;border-radius: 6rpx;"
|
||||||
:src="image.url"
|
:src="image.url"
|
||||||
@click="handlePreview(mediumIndex,moment.spec.content.medium)"/>
|
@click="handlePreview(mediumIndex,moment.images)"/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -93,6 +101,12 @@ export default {
|
|||||||
let blogger = this.$tm.vx.getters().getConfigs.authorConfig.blogger;
|
let blogger = this.$tm.vx.getters().getConfigs.authorConfig.blogger;
|
||||||
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
|
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
|
||||||
return blogger;
|
return blogger;
|
||||||
|
},
|
||||||
|
haloConfigs() {
|
||||||
|
return this.$tm.vx.getters().getConfigs;
|
||||||
|
},
|
||||||
|
mockJson() {
|
||||||
|
return this.$tm.vx.getters().getMockJson;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -106,6 +120,13 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onReachBottom(e) {
|
onReachBottom(e) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '没有更多数据了'
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
if (this.hasNext) {
|
if (this.hasNext) {
|
||||||
this.queryParams.page += 1;
|
this.queryParams.page += 1;
|
||||||
this.isLoadMore = true;
|
this.isLoadMore = true;
|
||||||
@@ -119,6 +140,37 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fnGetData() {
|
fnGetData() {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
this.dataList = this.mockJson.moments.list.map((item) => {
|
||||||
|
return {
|
||||||
|
metadata: {
|
||||||
|
name: Date.now() * Math.random(),
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
user: {
|
||||||
|
displayName: this.bloggerInfo.nickname,
|
||||||
|
avatar: this.$utils.checkAvatarUrl(this.bloggerInfo.avatar),
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
html: item.content
|
||||||
|
},
|
||||||
|
releaseTime: item.time
|
||||||
|
},
|
||||||
|
images: item.images.map((img) => {
|
||||||
|
return {
|
||||||
|
type: "PHOTO",
|
||||||
|
url: this.$utils.checkThumbnailUrl(img),
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
videos: []
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.loading = 'success';
|
||||||
|
this.loadMoreText = '呜呜,没有更多数据啦~';
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
return;
|
||||||
|
}
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
mask: true,
|
mask: true,
|
||||||
title: '加载中...'
|
title: '加载中...'
|
||||||
@@ -131,9 +183,6 @@ export default {
|
|||||||
this.$httpApi.v2
|
this.$httpApi.v2
|
||||||
.getMomentList(this.queryParams)
|
.getMomentList(this.queryParams)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('请求结果:');
|
|
||||||
console.log(res);
|
|
||||||
|
|
||||||
this.loading = 'success';
|
this.loading = 'success';
|
||||||
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||||
this.hasNext = res.hasNext;
|
this.hasNext = res.hasNext;
|
||||||
@@ -143,11 +192,15 @@ export default {
|
|||||||
displayName: this.bloggerInfo.nickname,
|
displayName: this.bloggerInfo.nickname,
|
||||||
avatar: this.$utils.checkAvatarUrl(this.bloggerInfo.avatar)
|
avatar: this.$utils.checkAvatarUrl(this.bloggerInfo.avatar)
|
||||||
}
|
}
|
||||||
item.spec.content.medium
|
item.spec.content.medium.map(medium => {
|
||||||
|
medium.url = this.$utils.checkThumbnailUrl(medium.url, true)
|
||||||
|
})
|
||||||
|
|
||||||
|
item['images'] = item.spec.content.medium
|
||||||
.filter(x => x.type === 'PHOTO')
|
.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;
|
return item;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
|
||||||
@@ -55,8 +55,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
adConfigs() {
|
toolsPluginConfigs() {
|
||||||
return this.$tm.vx.getters().getConfigs.adConfig;
|
return this.$tm.vx.getters().getConfigs?.pluginConfig?.toolsPlugin || {};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
@@ -76,7 +76,7 @@ export default {
|
|||||||
adLoad() {
|
adLoad() {
|
||||||
if (wx.createRewardedVideoAd) {
|
if (wx.createRewardedVideoAd) {
|
||||||
videoAd = wx.createRewardedVideoAd({
|
videoAd = wx.createRewardedVideoAd({
|
||||||
adUnitId: this.adConfigs.rewardedVideoAdId //你的广告key
|
adUnitId: this.toolsPluginConfigs.rewardedVideoAdId //你的广告key
|
||||||
})
|
})
|
||||||
videoAd.onError(err => {
|
videoAd.onError(err => {
|
||||||
})
|
})
|
||||||
@@ -91,7 +91,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
openVideoAd: function () {
|
openVideoAd: function () {
|
||||||
if (videoAd && this.adConfigs.rewardedVideoAdId != '') {
|
if (videoAd && this.toolsPluginConfigs.rewardedVideoAdId !== '') {
|
||||||
videoAd.show().catch(err => {
|
videoAd.show().catch(err => {
|
||||||
// 失败重试
|
// 失败重试
|
||||||
console.log("广告拉取失败")
|
console.log("广告拉取失败")
|
||||||
|
|||||||
+279
-61
@@ -1,13 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page">
|
<view class="app-page">
|
||||||
|
|
||||||
<view class="e-fixed">
|
<view class="e-fixed">
|
||||||
<tm-tabs color="light-blue" v-model="tab.activeIndex" :list="tab.list" align="center" @change="fnOnTabChange"></tm-tabs>
|
<tm-tabs color="light-blue" v-model="tab.activeIndex" :list="tab.list" align="center"
|
||||||
|
@change="fnOnTabChange"></tm-tabs>
|
||||||
</view>
|
</view>
|
||||||
<!-- 占位区域 -->
|
<!-- 占位区域 -->
|
||||||
<view style="width: 100vw;height: 90rpx;"></view>
|
<view style="width: 100vw;height: 90rpx;"></view>
|
||||||
|
|
||||||
<!-- 骨架屏:加载区域 -->
|
<!-- 骨架屏:加载区域 -->
|
||||||
<view v-if="loading != 'success'" class="loading-wrap">
|
<view v-if="loading !== 'success'" class="loading-wrap">
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
@@ -15,46 +17,55 @@
|
|||||||
|
|
||||||
<!-- 加载完成区域 -->
|
<!-- 加载完成区域 -->
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<view v-if="dataList.length == 0" class="list-empty flex flex-center">
|
<view v-if="dataList.length === 0" class="list-empty flex flex-center">
|
||||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无归档的文章"></tm-empty>
|
<tm-empty v-if="haloConfigs.basicConfig.auditModeEnabled" icon="icon-shiliangzhinengduixiang-" label="暂无归档的内容"></tm-empty>
|
||||||
|
<tm-empty v-else icon="icon-shiliangzhinengduixiang-" label="暂无归档的文章"></tm-empty>
|
||||||
</view>
|
</view>
|
||||||
<view v-else class="e-timeline tm-timeline mt-24">
|
<view v-else class="e-timeline tm-timeline mt-24">
|
||||||
<block v-for="(item, index) in dataList" :key="index">
|
<block v-for="(item, index) in dataList" :key="index">
|
||||||
<view class="tm-timeline-item tm-timeline-item--leftDir">
|
<view class="tm-timeline-item tm-timeline-item--leftDir">
|
||||||
<view style="width: 160rpx;">
|
<view style="width: 160rpx;">
|
||||||
<view :style="{ width: '24rpx', height: '24rpx' }" :class="[black_tmeme ? 'bk' : '']"
|
<view :style="{ width: '24rpx', height: '24rpx' }" :class="[black_tmeme ? 'bk' : '']"
|
||||||
class="flex-center rounded tm-timeline-jidian border-white-a-2 grey-lighten-2 light-blue shadow-primary-4"></view>
|
class="flex-center rounded tm-timeline-jidian border-white-a-2 grey-lighten-2 light-blue shadow-primary-4">
|
||||||
|
</view>
|
||||||
<view :style="{ marginTop: '-24rpx' }"
|
<view :style="{ marginTop: '-24rpx' }"
|
||||||
:class="[index !== dataList.length - 1 ? 'tm-timeline-item-boder' : '', black_tmeme ? 'bk' : '']"
|
:class="[index !== dataList.length - 1 ? 'tm-timeline-item-boder' : '', black_tmeme ? 'bk' : '']"
|
||||||
class="grey-lighten-2"></view>
|
class="grey-lighten-2"></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="tm-timeline-item-content relative">
|
<view class="tm-timeline-item-content relative">
|
||||||
<view class="tm-timeline-item-left">
|
<view class="tm-timeline-item-left">
|
||||||
<view class="time text-weight-b mb-24">
|
<view class="flex time text-weight-b mb-24">
|
||||||
{{ item.year }}年
|
<text>{{ item.year }}年</text>
|
||||||
<block v-if="tab.activeIndex == 0">{{ item.month }}月</block>
|
<text v-if="tab.activeIndex === 0">{{ item.month }}月</text>
|
||||||
<text class="text-size-s text-grey-darken-1 ml-24">(共发布 {{ item.posts.length }} 篇文章)</text>
|
<view v-if="haloConfigs.basicConfig.auditModeEnabled" class="text-size-s text-grey-darken-1 ml-12">
|
||||||
|
(共 {{ item.posts.length }} 篇内容)
|
||||||
|
</view>
|
||||||
|
<view v-else class="text-size-s text-grey-darken-1 ml-12">
|
||||||
|
(共 {{ item.posts.length }} 篇文章)
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<block v-if="item.posts.length != 0">
|
<block v-if="item.posts.length !== 0">
|
||||||
<block v-for="(post, postIndex) in item.posts" :key="post.id">
|
<block v-for="(post, postIndex) in item.posts" :key="post.metadata.name">
|
||||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(postIndex)">
|
<view class="flex post shadow-3 pa-24 mb-24"
|
||||||
<view class="flex post shadow-3 pa-24 mb-24" :class="[globalAppSettings.layout.cardType]"
|
:class="[globalAppSettings.layout.cardType]"
|
||||||
@click="fnToArticleDetail(post)">
|
@click="fnToArticleDetail(post)">
|
||||||
<image class="post-thumbnail" :src="$utils.checkThumbnailUrl(post.thumbnail)"
|
<image class="post-thumbnail"
|
||||||
mode="aspectFill"></image>
|
:src="$utils.checkThumbnailUrl(post.spec.cover)" mode="aspectFill">
|
||||||
<view class="post-info pl-20">
|
</image>
|
||||||
<view class="post-info_title text-overflow">{{ post.title }}</view>
|
<view class="post-info pl-20">
|
||||||
<view class="post-info_summary text-overflow-2 mt-12 text-size-s text-grey-darken-1">
|
<view class="post-info_title text-overflow">{{ post.spec.title }}
|
||||||
{{ post.summary }}
|
</view>
|
||||||
</view>
|
<view
|
||||||
<view class="post-info_time mt-12 text-size-s text-grey-darken-1">
|
class="post-info_summary text-overflow-2 mt-12 text-size-s text-grey-darken-1">
|
||||||
<text class="iconfont icon-clock text-size-s mr-6"></text>
|
{{ post.status.excerpt }}
|
||||||
<text class="time-label">发布时间:</text>
|
</view>
|
||||||
{{ {d: post.createTime, f: 'yyyy年MM月dd日 星期w'} | formatTime }}
|
<view class="post-info_time mt-12 text-size-s text-grey-darken-1">
|
||||||
</view>
|
<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>
|
||||||
</view>
|
</view>
|
||||||
</tm-translate>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
</block>
|
</block>
|
||||||
<view v-else class="post-empty text-size-m text-grey-darken-1">该日期下暂无归档文章!</view>
|
<view v-else class="post-empty text-size-m text-grey-darken-1">该日期下暂无归档文章!</view>
|
||||||
@@ -63,8 +74,10 @@
|
|||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="load-text mt-12">{{ loadMoreText }}</view>
|
||||||
<!-- 返回顶部 -->
|
<!-- 返回顶部 -->
|
||||||
<tm-flotbutton @click="fnToTopPage" size="m" color="bg-gradient-light-blue-accent" icon="icon-angle-up"></tm-flotbutton>
|
<tm-flotbutton @click="fnToTopPage" size="m" color="bg-gradient-light-blue-accent"
|
||||||
|
icon="icon-angle-up"></tm-flotbutton>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -75,6 +88,7 @@ import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
|||||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||||
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
|
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
|
||||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||||
|
import qs from 'qs'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -93,11 +107,13 @@ export default {
|
|||||||
},
|
},
|
||||||
queryParams: {
|
queryParams: {
|
||||||
size: 10,
|
size: 10,
|
||||||
page: 0
|
page: 1
|
||||||
},
|
},
|
||||||
result: null,
|
result: {},
|
||||||
dataList: [],
|
cacheDataList: [], // 所有请求的缓存数据
|
||||||
api: 'getMonthArchives'
|
dataList: [], // 显示的数据
|
||||||
|
isLoadMore: false,
|
||||||
|
loadMoreText: "加载中..."
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -106,53 +122,242 @@ export default {
|
|||||||
},
|
},
|
||||||
color_tmeme: function () {
|
color_tmeme: function () {
|
||||||
return this.$tm.vx.state().tmVuetify.color;
|
return this.$tm.vx.state().tmVuetify.color;
|
||||||
|
},
|
||||||
|
haloConfigs() {
|
||||||
|
return this.$tm.vx.getters().getConfigs;
|
||||||
|
},
|
||||||
|
mockJson() {
|
||||||
|
return this.$tm.vx.getters().getMockJson;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.fnGetData();
|
this.fnGetData();
|
||||||
},
|
},
|
||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
|
this.isLoadMore = false;
|
||||||
|
this.queryParams.page = 1;
|
||||||
this.fnGetData();
|
this.fnGetData();
|
||||||
this.queryParams.page = 0;
|
|
||||||
},
|
},
|
||||||
|
onReachBottom(e) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '没有更多数据了'
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.result.hasNext) {
|
||||||
|
this.queryParams.page += 1;
|
||||||
|
this.isLoadMore = true;
|
||||||
|
this.fnGetData();
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '没有更多数据了'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fnOnTabChange(index) {
|
fnOnTabChange(index) {
|
||||||
this.fnResetSetAniWaitIndex();
|
this.fnResetSetAniWaitIndex();
|
||||||
const _api = ['getMonthArchives', 'getYearArchives'];
|
|
||||||
this.api = _api[index];
|
|
||||||
this.queryParams.page = 0;
|
this.queryParams.page = 0;
|
||||||
this.fnGetData();
|
this.dataList = this.handleGetShowDataList(this.handleGetPosts(this.cacheDataList))
|
||||||
|
this.fnToTopPage();
|
||||||
},
|
},
|
||||||
fnGetData() {
|
fnGetData() {
|
||||||
this.loading = 'loading';
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
// uni.showLoading({
|
const dataList = this.mockJson.archives.list.map(item => {
|
||||||
// mask: true,
|
const date = new Date(item.time)
|
||||||
// title: '加载中...'
|
const year = date.getFullYear()
|
||||||
// });
|
const month = date.getMonth() + 1
|
||||||
this.$httpApi[this.api](this.queryParams)
|
return {
|
||||||
.then(res => {
|
metadata: {
|
||||||
this.result = res.data;
|
name: Date.now() * Math.random(),
|
||||||
this.dataList = res.data;
|
labels: {
|
||||||
setTimeout(() => {
|
"content.halo.run/archive-year": year,
|
||||||
this.loading = 'success';
|
"content.halo.run/archive-month": month
|
||||||
}, 500);
|
}
|
||||||
})
|
},
|
||||||
.catch(err => {
|
spec: {
|
||||||
console.error(err);
|
pinned: false,
|
||||||
this.loading = 'error';
|
cover: item.cover,
|
||||||
})
|
title: item.title,
|
||||||
.finally(() => {
|
publishTime: item.time
|
||||||
setTimeout(() => {
|
},
|
||||||
uni.hideLoading();
|
status: {
|
||||||
uni.stopPullDownRefresh();
|
excerpt: item.desc
|
||||||
}, 500);
|
},
|
||||||
|
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) {
|
fnToArticleDetail(article) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
|
url: '/pagesA/article-detail/article-detail?name=' + article.metadata.name,
|
||||||
animationType: 'slide-in-right'
|
animationType: 'slide-in-right'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -169,6 +374,15 @@ export default {
|
|||||||
background-color: #fafafd;
|
background-color: #fafafd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.auditModeEnabled {
|
||||||
|
width: 100%;
|
||||||
|
height: 80vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
.loading-wrap {
|
.loading-wrap {
|
||||||
padding: 24rpx;
|
padding: 24rpx;
|
||||||
}
|
}
|
||||||
@@ -376,4 +590,8 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.time {
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
+1152
-1135
File diff suppressed because it is too large
Load Diff
@@ -22,11 +22,11 @@
|
|||||||
<!-- 空布局 -->
|
<!-- 空布局 -->
|
||||||
<tm-empty v-if="!queryParams.keyword" icon="icon-shiliangzhinengduixiang-" label="请输入关键词搜索"></tm-empty>
|
<tm-empty v-if="!queryParams.keyword" icon="icon-shiliangzhinengduixiang-" label="请输入关键词搜索"></tm-empty>
|
||||||
<tm-empty v-else icon="icon-shiliangzhinengduixiang-"
|
<tm-empty v-else icon="icon-shiliangzhinengduixiang-"
|
||||||
:label="`未搜到 ${queryParams.keyword} 相关文章`"></tm-empty>
|
:label="`未搜到 ${queryParams.keyword} 相关内容`"></tm-empty>
|
||||||
</view>
|
</view>
|
||||||
<block v-else>
|
<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)">
|
:wait="calcAniWait(index)">
|
||||||
<view class="article-card" @click="fnToArticleDetail(article)">
|
<view class="article-card" @click="fnToArticleDetail(article)">
|
||||||
<rich-text style="font-size: 32rpx;font-weight: bold;color: #333;"
|
<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;"
|
<rich-text style="font-size: 28rpx;margin-top: 16rpx;color: #555;"
|
||||||
:nodes="article.content"></rich-text>
|
:nodes="article.content"></rich-text>
|
||||||
<text style="font-size: 24rpx;margin-top: 24rpx;color:#888">
|
<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>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
</tm-translate>
|
</tm-translate>
|
||||||
|
|
||||||
<tm-flotbutton @click="fnToTopPage" size="m" color="light-blue" icon="icon-angle-up"></tm-flotbutton>
|
<tm-flotbutton @click="fnToTopPage" size="m" color="light-blue" icon="icon-angle-up"></tm-flotbutton>
|
||||||
<view class="load-text">{{ loadMoreText }}</view>
|
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -81,14 +81,16 @@ export default {
|
|||||||
dataList: [],
|
dataList: [],
|
||||||
total: 0
|
total: 0
|
||||||
},
|
},
|
||||||
hasNext: false,
|
|
||||||
isLoadMore: false,
|
|
||||||
loadMoreText: '加载中...',
|
|
||||||
dataList: []
|
dataList: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
haloConfigs() {
|
||||||
|
return this.$tm.vx.getters().getConfigs;
|
||||||
|
},
|
||||||
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.fnSetPageTitle('文章列表');
|
this.fnSetPageTitle('内容搜索');
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
if (!this.queryParams.keyword) {
|
if (!this.queryParams.keyword) {
|
||||||
@@ -99,7 +101,6 @@ export default {
|
|||||||
},
|
},
|
||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
this.fnResetSetAniWaitIndex();
|
this.fnResetSetAniWaitIndex();
|
||||||
this.isLoadMore = false;
|
|
||||||
this.fnGetData();
|
this.fnGetData();
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -121,7 +122,7 @@ export default {
|
|||||||
},
|
},
|
||||||
fnOnSearch() {
|
fnOnSearch() {
|
||||||
this.fnResetSetAniWaitIndex();
|
this.fnResetSetAniWaitIndex();
|
||||||
this.isLoadMore = false;
|
|
||||||
if (!this.queryParams.keyword) {
|
if (!this.queryParams.keyword) {
|
||||||
this.dataList = []
|
this.dataList = []
|
||||||
} else {
|
} else {
|
||||||
@@ -129,34 +130,20 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
fnGetData() {
|
fnGetData() {
|
||||||
// uni.showLoading({
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
// mask: true,
|
return;
|
||||||
// title: '加载中...'
|
|
||||||
// });
|
|
||||||
// 设置状态为加载中
|
|
||||||
if (!this.isLoadMore) {
|
|
||||||
this.loading = 'loading';
|
|
||||||
}
|
}
|
||||||
this.loadMoreText = '加载中...';
|
// 设置状态为加载中
|
||||||
|
this.loading = 'loading';
|
||||||
this.$httpApi.v2
|
this.$httpApi.v2
|
||||||
.getPostListByKeyword(this.queryParams)
|
.getPostListByKeyword(this.queryParams)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('请求结果:');
|
|
||||||
console.log(res);
|
|
||||||
|
|
||||||
this.loading = 'success';
|
this.loading = 'success';
|
||||||
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
this.dataList = res.hits;
|
||||||
this.hasNext = res.hasNext;
|
|
||||||
if (this.isLoadMore) {
|
|
||||||
this.dataList = this.dataList.concat(res.hits);
|
|
||||||
} else {
|
|
||||||
this.dataList = res.hits;
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
this.loading = 'error';
|
this.loading = 'error';
|
||||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -169,7 +156,7 @@ export default {
|
|||||||
//跳转文章详情
|
//跳转文章详情
|
||||||
fnToArticleDetail(article) {
|
fnToArticleDetail(article) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pagesA/article-detail/article-detail?name=' + article.name,
|
url: '/pagesA/article-detail/article-detail?name=' + article.metadataName,
|
||||||
animationType: 'slide-in-right'
|
animationType: 'slide-in-right'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+29
-19
@@ -26,7 +26,6 @@
|
|||||||
<!-- 社交联系方式列表 -->
|
<!-- 社交联系方式列表 -->
|
||||||
<view class="contact ma-50 mt-0 pt-12">
|
<view class="contact ma-50 mt-0 pt-12">
|
||||||
<block v-if="calcIsNotEmpty">
|
<block v-if="calcIsNotEmpty">
|
||||||
|
|
||||||
<block v-for="(item, index) in result" :key="index">
|
<block v-for="(item, index) in result" :key="index">
|
||||||
<view v-if="item.value" class="item mt-24 flex" @click="fnOnClick(item)">
|
<view v-if="item.value" class="item mt-24 flex" @click="fnOnClick(item)">
|
||||||
<view class="left">
|
<view class="left">
|
||||||
@@ -37,9 +36,9 @@
|
|||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
</block>
|
</block>
|
||||||
<view v-else class="mt-12 pt-12">
|
<view v-else class="mt-12 pt-12">
|
||||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无联系方式"/>
|
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无联系方式"/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -137,36 +136,47 @@ export default {
|
|||||||
return blogger;
|
return blogger;
|
||||||
},
|
},
|
||||||
socialConfig() {
|
socialConfig() {
|
||||||
return this.authorConfig.social
|
return this.authorConfig.social;
|
||||||
},
|
},
|
||||||
calcIsNotEmpty() {
|
calcIsNotEmpty() {
|
||||||
return this.result.some((item) => item.value !== "");
|
return this.result.some((item) => item.value !== "");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
socialConfig: {
|
||||||
|
handler(newVal) {
|
||||||
|
if (!newVal) return;
|
||||||
|
this.fnGetData();
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.fnSetPageTitle('联系博主');
|
this.fnSetPageTitle('联系博主');
|
||||||
},
|
},
|
||||||
created() {
|
|
||||||
this.fnGetData();
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
fnGetData() {
|
fnGetData() {
|
||||||
for (let key in this.socialConfig) {
|
for (let key in this.socialConfig) {
|
||||||
|
if (key === 'enabled') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
this.result.find(x => x.key === key).value = this.socialConfig[key];
|
this.result.find(x => x.key === key).value = this.socialConfig[key];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fnOnClick(item) {
|
fnOnClick(item) {
|
||||||
if (this.globalAppSettings.contact.isLinkCopy && this.$utils.checkIsUrl(item.value)) {
|
this.$utils.copyText(item.value, item.name + ' 已复制!');
|
||||||
uni.navigateTo({
|
// if (this.globalAppSettings.contact.isLinkCopy && this.$utils.checkIsUrl(item.value)) {
|
||||||
url: '/pagesC/website/website?data=' +
|
// uni.navigateTo({
|
||||||
JSON.stringify({
|
// url: '/pagesC/website/website?data=' +
|
||||||
title: item.name,
|
// JSON.stringify({
|
||||||
url: item.value
|
// title: item.name,
|
||||||
})
|
// url: item.value
|
||||||
});
|
// })
|
||||||
} else {
|
// });
|
||||||
this.$utils.copyText(item.value, item.name + ' 已复制!');
|
// } else {
|
||||||
}
|
// this.$utils.copyText(item.value, item.name + ' 已复制!');
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -152,6 +152,9 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
haloConfigs() {
|
||||||
|
return this.$tm.vx.getters().getConfigs;
|
||||||
|
},
|
||||||
haloPluginConfigs() {
|
haloPluginConfigs() {
|
||||||
return this.$tm.vx.getters().getConfigs.pluginConfig;
|
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 || "未分组"
|
return this.linkGroupList.find(item => item.metadata.name === groupName)?.spec?.displayName || groupName || "未分组"
|
||||||
},
|
},
|
||||||
fnGetData() {
|
fnGetData() {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!this.isLoadMore) {
|
if (!this.isLoadMore) {
|
||||||
this.loading = 'loading';
|
this.loading = 'loading';
|
||||||
}
|
}
|
||||||
@@ -290,9 +296,9 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
toSubmitLinkPage() {
|
toSubmitLinkPage() {
|
||||||
this.$Router.push({
|
uni.navigateTo({
|
||||||
path: '/pagesA/submit-link/submit-link'
|
url: '/pagesA/submit-link/submit-link'
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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>
|
|
||||||
@@ -123,14 +123,13 @@ export default {
|
|||||||
fnGetData() {
|
fnGetData() {
|
||||||
this.loading = 'loading';
|
this.loading = 'loading';
|
||||||
this.queryParams.group = this.loveConfig.lovePhoto.groupName
|
this.queryParams.group = this.loveConfig.lovePhoto.groupName
|
||||||
console.log('this.loveConfig------------',this.loveConfig)
|
|
||||||
this.$httpApi.v2
|
this.$httpApi.v2
|
||||||
.getPhotoListByGroupName(this.queryParams)
|
.getPhotoListByGroupName(this.queryParams)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log("相册 res", res)
|
console.log("相册 res", res)
|
||||||
this.loading = 'success';
|
this.loading = 'success';
|
||||||
this.dataList = res.items.map((item, index) => {
|
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(
|
item['takeTime'] = this.$tm.dayjs(item.metadata.creationTimestamp).format(
|
||||||
'DD/MM/YYYY');
|
'DD/MM/YYYY');
|
||||||
return item;
|
return item;
|
||||||
@@ -161,13 +160,13 @@ export default {
|
|||||||
fnChange(isNext) {
|
fnChange(isNext) {
|
||||||
throttle(() => {
|
throttle(() => {
|
||||||
if (isNext) {
|
if (isNext) {
|
||||||
if (this.swiperIndex == this.dataList.length - 1) {
|
if (this.swiperIndex === this.dataList.length - 1) {
|
||||||
this.swiperIndex = 0;
|
this.swiperIndex = 0;
|
||||||
} else {
|
} else {
|
||||||
this.swiperIndex += 1;
|
this.swiperIndex += 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.swiperIndex == 0) {
|
if (this.swiperIndex === 0) {
|
||||||
this.swiperIndex = this.dataList.length - 1;
|
this.swiperIndex = this.dataList.length - 1;
|
||||||
} else {
|
} else {
|
||||||
this.swiperIndex -= 1;
|
this.swiperIndex -= 1;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<image class="avatar" :src="$utils.checkAvatarUrl(loveConfig.loveInfo.boyAvatar)" mode="aspectFit"></image>
|
<image class="avatar" :src="$utils.checkAvatarUrl(loveConfig.loveInfo.boyAvatar)" mode="aspectFit"></image>
|
||||||
<view class="name">{{ loveConfig.loveInfo.boyNickname }}</view>
|
<view class="name">{{ loveConfig.loveInfo.boyNickname }}</view>
|
||||||
</view>
|
</view>
|
||||||
<image class="like" :src="$utils.checkImageUrl(loveConfig.loveImageUrl)" mode="scaleToFill"></image>
|
<image class="like" :src="$utils.checkImageUrl(loveConfig.pageImages.heartImageUrl)" mode="scaleToFill"></image>
|
||||||
<view class="girl">
|
<view class="girl">
|
||||||
<image class="avatar" :src="$utils.checkAvatarUrl(loveConfig.loveInfo.girlAvatar)" mode="aspectFit"></image>
|
<image class="avatar" :src="$utils.checkAvatarUrl(loveConfig.loveInfo.girlAvatar)" mode="aspectFit"></image>
|
||||||
<view class="name">{{ loveConfig.loveInfo.girlNickname }}</view>
|
<view class="name">{{ loveConfig.loveInfo.girlNickname }}</view>
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
<block v-for="(nav, index) in navList" :key="index">
|
<block v-for="(nav, index) in navList" :key="index">
|
||||||
<view v-if="nav.use" class="list-item" @click="fnToPage(nav.key)">
|
<view v-if="nav.use" class="list-item" @click="fnToPage(nav.key)">
|
||||||
<view class="left">
|
<view class="left">
|
||||||
<image class="icon" :src="nav.iconImageUrl" mode="aspectFit"></image>
|
<image class="icon" :src="$utils.checkImageUrl(nav.iconImageUrl)" mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<view class="name">{{ nav.title }}</view>
|
<view class="name">{{ nav.title }}</view>
|
||||||
@@ -100,21 +100,21 @@ export default {
|
|||||||
{
|
{
|
||||||
key: 'journey',
|
key: 'journey',
|
||||||
use: configs.ourStory.enabled,
|
use: configs.ourStory.enabled,
|
||||||
iconImageUrl: 'https://b.925i.cn/uni_halo_love/diandian.png',
|
iconImageUrl: configs.ourStory.iconUrl,
|
||||||
title: '关于我们',
|
title: '关于我们',
|
||||||
desc: '我们一起度过的那些经历'
|
desc: '我们一起度过的那些经历'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'album',
|
key: 'album',
|
||||||
use: configs.lovePhoto.enabled,
|
use: configs.lovePhoto.enabled,
|
||||||
iconImageUrl: 'https://b.925i.cn/uni_halo_love/diandian.png',
|
iconImageUrl: configs.lovePhoto.iconUrl,
|
||||||
title: '恋爱相册',
|
title: '恋爱相册',
|
||||||
desc: '定格了我们的那些小美好'
|
desc: '定格了我们的那些小美好'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'list',
|
key: 'list',
|
||||||
use: configs.loveDaily.enabled,
|
use: configs.loveDaily.enabled,
|
||||||
iconImageUrl: 'https://b.925i.cn/uni_halo_love/diandian.png',
|
iconImageUrl: configs.loveDaily.iconUrl,
|
||||||
title: '恋爱清单',
|
title: '恋爱清单',
|
||||||
desc: '你我之间的约定我们都在努力实现'
|
desc: '你我之间的约定我们都在努力实现'
|
||||||
},
|
},
|
||||||
|
|||||||
+467
-379
@@ -1,443 +1,531 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page bg-gradient-blue-lighten-b" :style="pageStyle">
|
<view class="app-page bg-gradient-blue-lighten-b" :class="calcPageClass" :style="[calcPageStyle]">
|
||||||
<view class="tn-satr">
|
<view v-if="calcBackgroundType!=='video'" class="tn-satr">
|
||||||
<view class="sky"></view>
|
<view class="sky"></view>
|
||||||
<view class="stars">
|
<view class="stars">
|
||||||
<view class="falling-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 class="star-fall"></view>
|
<view class="star-fall"></view>
|
||||||
<view class="star-fall"></view>
|
<view class="star-fall"></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="small-stars">
|
<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 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 class="medium-stars">
|
<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 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>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="user-info__container flex flex-col flex-center">
|
<video v-else class="video-bg" :object-fit="startConfig.bgVideoFit" :src="startConfig.bgVideo" :loop="true"
|
||||||
<image class="user-info__avatar" :src="$utils.checkImageUrl(startConfig.logo)" mode="aspectFill"></image>
|
:autoplay="true" :muted="true" :controls="false" :show-fullscreen-btn="false" :show-play-btn="false"
|
||||||
<view class="user-info__nick-name">「 {{ startConfig.title }} 」</view>
|
:show-center-play-btn="false" :show-loading="false" :enable-progress-gesture="false"
|
||||||
</view>
|
:show-progress="false"></video>
|
||||||
|
|
||||||
<view class="text-align-center text-white" style="padding: 60vh 0 0 0;">
|
<cover-view v-if="startConfig.title || startConfig.logo" class="title-container">
|
||||||
<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>
|
|
||||||
|
|
||||||
<view class="" style="padding: 120rpx 200rpx;z-index: 999;position: relative;">
|
<cover-view v-if="startConfig.logo" class="app-logo">
|
||||||
<view class="start-btn" @click="fnStart()">{{ startConfig.btnText || '开始体验' }}</view>
|
<cover-view class="app-logo-border">
|
||||||
</view>
|
<cover-image class="app-logo-image" :src="$utils.checkImageUrl(startConfig.logo)"
|
||||||
|
mode="aspectFill"></cover-image>
|
||||||
|
</cover-view>
|
||||||
|
</cover-view>
|
||||||
|
|
||||||
<!-- 波浪效果 -->
|
<cover-view v-if="startConfig.title" class="app-title" :style="startConfig.titleStyle">
|
||||||
<wave></wave>
|
「 {{ startConfig.title }} 」
|
||||||
</view>
|
</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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import wave from '@/components/wave/wave.vue';
|
import wave from '@/components/wave/wave.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
wave
|
wave
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
startConfig() {
|
startConfig() {
|
||||||
return this.$tm.vx.getters().getConfigs.appConfig.startConfig;
|
return this.$tm.vx.getters().getConfigs.appConfig.startConfig;
|
||||||
},
|
},
|
||||||
pageStyle() {
|
calcBackgroundType() {
|
||||||
if (this.startConfig.bg) {
|
return this.startConfig.backgroundType;
|
||||||
const _bg = this.$utils.checkIsUrl(this.startConfig.bg) ? `url(${this.$utils.checkImageUrl(this.startConfig.bg)})` : this
|
},
|
||||||
.startConfig.bg;
|
calcPageClass() {
|
||||||
return {
|
if (this.calcBackgroundType === 'color') {
|
||||||
background: _bg + '!important'
|
return [this.startConfig.bg]
|
||||||
};
|
}
|
||||||
}
|
return []
|
||||||
return {};
|
},
|
||||||
}
|
calcPageStyle() {
|
||||||
},
|
if (this.calcBackgroundType === 'color') {
|
||||||
methods: {
|
return {}
|
||||||
fnStart() {
|
}
|
||||||
uni.switchTab({
|
if (this.calcBackgroundType === 'image') {
|
||||||
url: '/pages/tabbar/home/home',
|
return {
|
||||||
success: () => {
|
backgroundImage: `url(${this.$utils.checkImageUrl(this.startConfig.bgImage)})!important`,
|
||||||
uni.setStorageSync('APP_HAS_STARTED', true);
|
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>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-page {
|
.app-page {
|
||||||
width: 100vw;
|
position: relative;
|
||||||
height: 100vh;
|
width: 100vw;
|
||||||
}
|
height: 100vh;
|
||||||
|
background-size: cover;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
.start-btn {
|
.start-btn {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
padding: 16rpx 50rpx;
|
padding: 16rpx 50rpx;
|
||||||
border-radius: 50rpx;
|
border-radius: 50rpx;
|
||||||
border: 2rpx solid #ffffff;
|
border: 2rpx solid #ffffff;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
}
|
margin-top: 60rpx;
|
||||||
|
margin-bottom: 120rpx;
|
||||||
|
}
|
||||||
|
|
||||||
/* 用户信息 start */
|
.start-btn-app {
|
||||||
.user-info {
|
border-radius: 50rpx;
|
||||||
&__container {
|
color: #ffffff;
|
||||||
position: absolute;
|
text-align: center;
|
||||||
top: 25vh;
|
font-size: 28rpx;
|
||||||
left: 50%;
|
margin: 60rpx auto 120rpx auto;
|
||||||
-webkit-transform: translate(-50%, -50%);
|
width: 40vw;
|
||||||
transform: translate(-50%, -50%);
|
height: 60rpx;
|
||||||
}
|
line-height: 60rpx;
|
||||||
|
border: 2rpx solid #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
&__avatar {
|
.bottom-container {
|
||||||
width: 200rpx;
|
display: flex;
|
||||||
height: 200rpx;
|
flex-direction: column;
|
||||||
border: 8rpx solid rgba(255, 255, 255, 0.05);
|
position: absolute;
|
||||||
border-radius: 50%;
|
bottom: 50rpx;
|
||||||
overflow: hidden;
|
left: 50%;
|
||||||
box-shadow: 0rpx 0rpx 80rpx 0rpx rgba(0, 0, 0, 0.15);
|
transform: translateX(-50%);
|
||||||
}
|
z-index: 999;
|
||||||
|
}
|
||||||
|
|
||||||
&__nick-name {
|
.video-bg {
|
||||||
color: #ffffff;
|
position: absolute;
|
||||||
margin-top: 26rpx;
|
left: 0;
|
||||||
font-size: 36rpx;
|
top: 0;
|
||||||
font-weight: 600;
|
width: 100vw;
|
||||||
text-align: center;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/* 流星*/
|
.app-logo {
|
||||||
.tn-satr {
|
width: 200rpx;
|
||||||
position: fixed;
|
height: 200rpx;
|
||||||
width: 100%;
|
|
||||||
height: 600px;
|
|
||||||
overflow: hidden;
|
|
||||||
flex-shrink: 0;
|
|
||||||
z-index: 998;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stars {
|
&-border {
|
||||||
position: absolute;
|
width: 100%;
|
||||||
z-index: 1;
|
height: 100%;
|
||||||
width: 100%;
|
box-sizing: border-box;
|
||||||
height: 400px;
|
border: 8rpx solid rgba(255, 255, 255, 0.35);
|
||||||
}
|
border-radius: 50%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
.star {
|
&-image {
|
||||||
border-radius: 50%;
|
width: 100%;
|
||||||
background: #ffffff;
|
height: 100%;
|
||||||
box-shadow: 0px 0px 6px 0px rgba(255, 255, 255, 0.8);
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.small-stars .star {
|
.app-title {
|
||||||
position: absolute;
|
color: #ffffff;
|
||||||
width: 3px;
|
margin-top: 26rpx;
|
||||||
height: 3px;
|
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) {
|
.tn-satr {
|
||||||
left: 40px;
|
position: fixed;
|
||||||
bottom: 50px;
|
width: 100%;
|
||||||
}
|
height: 600px;
|
||||||
|
overflow: hidden;
|
||||||
|
flex-shrink: 0;
|
||||||
|
z-index: 998;
|
||||||
|
}
|
||||||
|
|
||||||
.small-stars .star:nth-child(2) {
|
.stars {
|
||||||
left: 200px;
|
position: absolute;
|
||||||
bottom: 40px;
|
z-index: 1;
|
||||||
}
|
width: 100%;
|
||||||
|
height: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
.small-stars .star:nth-child(3) {
|
.star {
|
||||||
left: 60px;
|
border-radius: 50%;
|
||||||
bottom: 120px;
|
background: #ffffff;
|
||||||
}
|
box-shadow: 0 0 6px 0 rgba(255, 255, 255, 0.8);
|
||||||
|
}
|
||||||
|
|
||||||
.small-stars .star:nth-child(4) {
|
.small-stars .star {
|
||||||
left: 140px;
|
position: absolute;
|
||||||
bottom: 250px;
|
width: 3px;
|
||||||
}
|
height: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
.small-stars .star:nth-child(5) {
|
.small-stars .star:nth-child(2n) {
|
||||||
left: 400px;
|
opacity: 0;
|
||||||
bottom: 300px;
|
-webkit-animation: star-blink 1.2s linear infinite alternate;
|
||||||
}
|
animation: star-blink 1.2s linear infinite alternate;
|
||||||
|
}
|
||||||
|
|
||||||
.small-stars .star:nth-child(6) {
|
.small-stars .star:nth-child(1) {
|
||||||
left: 170px;
|
left: 40px;
|
||||||
bottom: 80px;
|
bottom: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.small-stars .star:nth-child(7) {
|
.small-stars .star:nth-child(2) {
|
||||||
left: 200px;
|
left: 200px;
|
||||||
bottom: 360px;
|
bottom: 40px;
|
||||||
-webkit-animation-delay: 0.2s;
|
}
|
||||||
animation-delay: 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.small-stars .star:nth-child(8) {
|
.small-stars .star:nth-child(3) {
|
||||||
left: 250px;
|
left: 60px;
|
||||||
bottom: 320px;
|
bottom: 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.small-stars .star:nth-child(9) {
|
.small-stars .star:nth-child(4) {
|
||||||
left: 300px;
|
left: 140px;
|
||||||
bottom: 340px;
|
bottom: 250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.small-stars .star:nth-child(10) {
|
.small-stars .star:nth-child(5) {
|
||||||
left: 130px;
|
left: 400px;
|
||||||
bottom: 320px;
|
bottom: 300px;
|
||||||
-webkit-animation-delay: 0.5s;
|
}
|
||||||
animation-delay: 0.5s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.small-stars .star:nth-child(11) {
|
.small-stars .star:nth-child(6) {
|
||||||
left: 230px;
|
left: 170px;
|
||||||
bottom: 330px;
|
bottom: 80px;
|
||||||
-webkit-animation-delay: 7s;
|
}
|
||||||
animation-delay: 7s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.small-stars .star:nth-child(12) {
|
.small-stars .star:nth-child(7) {
|
||||||
left: 300px;
|
left: 200px;
|
||||||
bottom: 360px;
|
bottom: 360px;
|
||||||
-webkit-animation-delay: 0.3s;
|
-webkit-animation-delay: 0.2s;
|
||||||
animation-delay: 0.3s;
|
animation-delay: 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@-webkit-keyframes star-blink {
|
.small-stars .star:nth-child(8) {
|
||||||
50% {
|
left: 250px;
|
||||||
width: 3px;
|
bottom: 320px;
|
||||||
height: 3px;
|
}
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes star-blink {
|
.small-stars .star:nth-child(9) {
|
||||||
50% {
|
left: 300px;
|
||||||
width: 3px;
|
bottom: 340px;
|
||||||
height: 3px;
|
}
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.medium-stars .star {
|
.small-stars .star:nth-child(10) {
|
||||||
position: absolute;
|
left: 130px;
|
||||||
width: 3px;
|
bottom: 320px;
|
||||||
height: 3px;
|
-webkit-animation-delay: 0.5s;
|
||||||
opacity: 0;
|
animation-delay: 0.5s;
|
||||||
-webkit-animation: star-blink 1.2s ease-in infinite alternate;
|
}
|
||||||
animation: star-blink 1.2s ease-in infinite alternate;
|
|
||||||
}
|
|
||||||
|
|
||||||
.medium-stars .star:nth-child(1) {
|
.small-stars .star:nth-child(11) {
|
||||||
left: 300px;
|
left: 230px;
|
||||||
bottom: 50px;
|
bottom: 330px;
|
||||||
}
|
-webkit-animation-delay: 7s;
|
||||||
|
animation-delay: 7s;
|
||||||
|
}
|
||||||
|
|
||||||
.medium-stars .star:nth-child(2) {
|
.small-stars .star:nth-child(12) {
|
||||||
left: 400px;
|
left: 300px;
|
||||||
bottom: 40px;
|
bottom: 360px;
|
||||||
-webkit-animation-delay: 0.4s;
|
-webkit-animation-delay: 0.3s;
|
||||||
animation-delay: 0.4s;
|
animation-delay: 0.3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.medium-stars .star:nth-child(3) {
|
@-webkit-keyframes star-blink {
|
||||||
left: 330px;
|
50% {
|
||||||
bottom: 300px;
|
width: 3px;
|
||||||
-webkit-animation-delay: 0.2s;
|
height: 3px;
|
||||||
animation-delay: 0.2s;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.medium-stars .star:nth-child(4) {
|
@keyframes star-blink {
|
||||||
left: 460px;
|
50% {
|
||||||
bottom: 300px;
|
width: 3px;
|
||||||
-webkit-animation-delay: 0.9s;
|
height: 3px;
|
||||||
animation-delay: 0.9s;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.medium-stars .star:nth-child(5) {
|
.medium-stars .star {
|
||||||
left: 300px;
|
position: absolute;
|
||||||
bottom: 150px;
|
width: 3px;
|
||||||
-webkit-animation-delay: 1.2s;
|
height: 3px;
|
||||||
animation-delay: 1.2s;
|
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) {
|
.medium-stars .star:nth-child(1) {
|
||||||
left: 440px;
|
left: 300px;
|
||||||
bottom: 120px;
|
bottom: 50px;
|
||||||
-webkit-animation-delay: 1s;
|
}
|
||||||
animation-delay: 1s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.medium-stars .star:nth-child(7) {
|
.medium-stars .star:nth-child(2) {
|
||||||
left: 200px;
|
left: 400px;
|
||||||
bottom: 140px;
|
bottom: 40px;
|
||||||
-webkit-animation-delay: 0.8s;
|
-webkit-animation-delay: 0.4s;
|
||||||
animation-delay: 0.8s;
|
animation-delay: 0.4s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.medium-stars .star:nth-child(8) {
|
.medium-stars .star:nth-child(3) {
|
||||||
left: 30px;
|
left: 330px;
|
||||||
bottom: 480px;
|
bottom: 300px;
|
||||||
-webkit-animation-delay: 0.3s;
|
-webkit-animation-delay: 0.2s;
|
||||||
animation-delay: 0.3s;
|
animation-delay: 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.medium-stars .star:nth-child(9) {
|
.medium-stars .star:nth-child(4) {
|
||||||
left: 460px;
|
left: 460px;
|
||||||
bottom: 400px;
|
bottom: 300px;
|
||||||
-webkit-animation-delay: 1.2s;
|
-webkit-animation-delay: 0.9s;
|
||||||
animation-delay: 1.2s;
|
animation-delay: 0.9s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.medium-stars .star:nth-child(10) {
|
.medium-stars .star:nth-child(5) {
|
||||||
left: 150px;
|
left: 300px;
|
||||||
bottom: 10px;
|
bottom: 150px;
|
||||||
-webkit-animation-delay: 1s;
|
-webkit-animation-delay: 1.2s;
|
||||||
animation-delay: 1s;
|
animation-delay: 1.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.medium-stars .star:nth-child(11) {
|
.medium-stars .star:nth-child(6) {
|
||||||
left: 420px;
|
left: 440px;
|
||||||
bottom: 450px;
|
bottom: 120px;
|
||||||
-webkit-animation-delay: 1.2s;
|
-webkit-animation-delay: 1s;
|
||||||
animation-delay: 1.2s;
|
animation-delay: 1s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.medium-stars .star:nth-child(12) {
|
.medium-stars .star:nth-child(7) {
|
||||||
left: 340px;
|
left: 200px;
|
||||||
bottom: 180px;
|
bottom: 140px;
|
||||||
-webkit-animation-delay: 1.1s;
|
-webkit-animation-delay: 0.8s;
|
||||||
animation-delay: 1.1s;
|
animation-delay: 0.8s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes star-blink {
|
.medium-stars .star:nth-child(8) {
|
||||||
50% {
|
left: 30px;
|
||||||
width: 4px;
|
bottom: 480px;
|
||||||
height: 4px;
|
-webkit-animation-delay: 0.3s;
|
||||||
opacity: 1;
|
animation-delay: 0.3s;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.star-fall {
|
.medium-stars .star:nth-child(9) {
|
||||||
position: relative;
|
left: 460px;
|
||||||
border-radius: 2px;
|
bottom: 400px;
|
||||||
width: 80px;
|
-webkit-animation-delay: 1.2s;
|
||||||
height: 2px;
|
animation-delay: 1.2s;
|
||||||
overflow: hidden;
|
}
|
||||||
-webkit-transform: rotate(-20deg);
|
|
||||||
transform: rotate(-20deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.star-fall:after {
|
.medium-stars .star:nth-child(10) {
|
||||||
content: '';
|
left: 150px;
|
||||||
position: absolute;
|
bottom: 10px;
|
||||||
width: 50px;
|
-webkit-animation-delay: 1s;
|
||||||
height: 2px;
|
animation-delay: 1s;
|
||||||
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(1) {
|
.medium-stars .star:nth-child(11) {
|
||||||
left: 80px;
|
left: 420px;
|
||||||
bottom: -100px;
|
bottom: 450px;
|
||||||
}
|
-webkit-animation-delay: 1.2s;
|
||||||
|
animation-delay: 1.2s;
|
||||||
|
}
|
||||||
|
|
||||||
.star-fall:nth-child(1):after {
|
.medium-stars .star:nth-child(12) {
|
||||||
-webkit-animation-delay: 2.4s;
|
left: 340px;
|
||||||
animation-delay: 2.4s;
|
bottom: 180px;
|
||||||
}
|
-webkit-animation-delay: 1.1s;
|
||||||
|
animation-delay: 1.1s;
|
||||||
|
}
|
||||||
|
|
||||||
.star-fall:nth-child(2) {
|
@keyframes star-blink {
|
||||||
left: 200px;
|
50% {
|
||||||
bottom: -200px;
|
width: 4px;
|
||||||
}
|
height: 4px;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.star-fall:nth-child(2):after {
|
.star-fall {
|
||||||
-webkit-animation-delay: 2s;
|
position: relative;
|
||||||
animation-delay: 2s;
|
border-radius: 2px;
|
||||||
}
|
width: 80px;
|
||||||
|
height: 2px;
|
||||||
|
overflow: hidden;
|
||||||
|
-webkit-transform: rotate(-20deg);
|
||||||
|
transform: rotate(-20deg);
|
||||||
|
}
|
||||||
|
|
||||||
.star-fall:nth-child(3) {
|
.star-fall:after {
|
||||||
left: 430px;
|
content: '';
|
||||||
bottom: -50px;
|
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 {
|
.star-fall:nth-child(1) {
|
||||||
-webkit-animation-delay: 3.6s;
|
left: 80px;
|
||||||
animation-delay: 3.6s;
|
bottom: -100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.star-fall:nth-child(4) {
|
.star-fall:nth-child(1):after {
|
||||||
left: 400px;
|
-webkit-animation-delay: 2.4s;
|
||||||
bottom: 100px;
|
animation-delay: 2.4s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.star-fall:nth-child(4):after {
|
.star-fall:nth-child(2) {
|
||||||
-webkit-animation-delay: 0.2s;
|
left: 200px;
|
||||||
animation-delay: 0.2s;
|
bottom: -200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@-webkit-keyframes star-fall {
|
.star-fall:nth-child(2):after {
|
||||||
20% {
|
-webkit-animation-delay: 2s;
|
||||||
left: -100%;
|
animation-delay: 2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
100% {
|
.star-fall:nth-child(3) {
|
||||||
left: -100%;
|
left: 430px;
|
||||||
}
|
bottom: -50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes star-fall {
|
.star-fall:nth-child(3):after {
|
||||||
20% {
|
-webkit-animation-delay: 3.6s;
|
||||||
left: -100%;
|
animation-delay: 3.6s;
|
||||||
}
|
}
|
||||||
|
|
||||||
100% {
|
.star-fall:nth-child(4) {
|
||||||
left: -100%;
|
left: 400px;
|
||||||
}
|
bottom: 100px;
|
||||||
}
|
}
|
||||||
</style>
|
|
||||||
|
.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>
|
||||||
@@ -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>
|
|
||||||
@@ -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
@@ -5,25 +5,35 @@
|
|||||||
* 时间:2024年06月22日 12:00:44
|
* 时间:2024年06月22日 12:00:44
|
||||||
* 版本:v0.1.0
|
* 版本:v0.1.0
|
||||||
*/
|
*/
|
||||||
import {DefaultAppConfigs, getAppConfigs, setAppConfigs} from '@/config/index.js'
|
import {DefaultAppConfigs, getAppConfigs, setAppConfigs,setAppMockJson,getAppMockJson} from '@/config/index.js'
|
||||||
import v2Config from '@/api/v2/all.config.js'
|
import v2Config from '@/api/v2/all.config.js'
|
||||||
|
import utils from '@/utils/index.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: {
|
state: {
|
||||||
configs: getAppConfigs(),
|
configs: getAppConfigs(),
|
||||||
|
mockJson: getAppMockJson(),
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
getConfigs(state) {
|
getConfigs(state) {
|
||||||
if (state.configs) return state.configs;
|
if (state.configs) return state.configs;
|
||||||
return getAppConfigs()
|
return getAppConfigs()
|
||||||
},
|
},
|
||||||
|
getMockJson(state) {
|
||||||
|
if(state.mockJson) return state.mockJson;
|
||||||
|
return getAppMockJson()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
setConfigs(state, data) {
|
setConfigs(state, data) {
|
||||||
state.configs = data;
|
state.configs = data;
|
||||||
setAppConfigs(data)
|
setAppConfigs(data)
|
||||||
},
|
},
|
||||||
|
setMockJson(state, data) {
|
||||||
|
setAppMockJson(data)
|
||||||
|
state.mockJson = data;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
fetchConfigs({commit, dispatch}) {
|
fetchConfigs({commit, dispatch}) {
|
||||||
@@ -47,5 +57,29 @@ export default {
|
|||||||
setDefaultAppSettings({commit}) {
|
setDefaultAppSettings({commit}) {
|
||||||
commit('setConfigs', JSON.parse(JSON.stringify(DefaultAppConfigs)))
|
commit('setConfigs', JSON.parse(JSON.stringify(DefaultAppConfigs)))
|
||||||
},
|
},
|
||||||
|
// 请求模拟数据
|
||||||
|
fetchMockJson({state, commit, dispatch}) {
|
||||||
|
return new Promise(async (resolve, reject) => {
|
||||||
|
const mockJsonUrl = utils.checkUrl(state.configs.basicConfig.auditModeMockUrl)
|
||||||
|
uni.request({
|
||||||
|
url: mockJsonUrl,
|
||||||
|
method: "GET",
|
||||||
|
success: (res) => {
|
||||||
|
console.log("mockJson", res.data)
|
||||||
|
commit('setMockJson', res.data)
|
||||||
|
resolve({
|
||||||
|
ok: true,
|
||||||
|
data: res.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
resolve({
|
||||||
|
ok: false,
|
||||||
|
data: err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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
@@ -1,8 +1,4 @@
|
|||||||
//vue.config.js
|
//vue.config.js
|
||||||
const TransformPages = require('uni-read-pages')
|
|
||||||
const {
|
|
||||||
webpack
|
|
||||||
} = new TransformPages()
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
devServer: {
|
devServer: {
|
||||||
disableHostCheck: true,
|
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)
|
|
||||||
})
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user