mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-07-27 04:20:43 +08:00
Compare commits
133 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a8bd121deb | |||
| 476a1ec48e | |||
| 31ade9908a | |||
| 5606e8c59f | |||
| 61d3b22fdb | |||
| c05aa5253c | |||
| 0b599dcced | |||
| 623e3fa59a | |||
| 1075f588fa | |||
| c0d8cb2c3b | |||
| 9c6a054b12 | |||
| 6a05f664ba | |||
| 9c4d2242ae | |||
| eac027c116 | |||
| 3a08008192 | |||
| 7daf93d51f | |||
| 409be28deb | |||
| 97e358e41f | |||
| c17e668afe | |||
| 4611932ad8 | |||
| 452d021816 | |||
| d71022c224 | |||
| d521a641de | |||
| 4246d8cdcb | |||
| 6989fd8ddc | |||
| 742b51a23e | |||
| bc541a3ef6 | |||
| 67fc682164 | |||
| b43dd7e5a7 | |||
| e29ccf65c5 | |||
| 91553fc053 | |||
| 22f57b7860 | |||
| 2a25727c0b | |||
| eb69ae4af6 | |||
| 2fd83a7814 | |||
| 8963ba1921 | |||
| 051c72b584 | |||
| 552827eaac | |||
| e8d13c674f | |||
| 256bc0e00f | |||
| 9aa0e310f2 | |||
| 6a0bb0e07f | |||
| 044f737016 | |||
| 27b3d31828 | |||
| 64c9a15d51 | |||
| df4c58d3e4 | |||
| 93f23696ef | |||
| 2ed7e1a260 | |||
| e19b107ed0 | |||
| 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 | |||
| cc05b64dec | |||
| aec54e8c5b | |||
| 15e95a2f3e | |||
| 74e5c9c3cf | |||
| 85227a8aa4 | |||
| e7a00c5b69 | |||
| 85e558f1a0 | |||
| fade65397d | |||
| a2bd2cc8ba | |||
| bdaeb98432 | |||
| ccefbcee02 | |||
| e5590c0a22 | |||
| a85131308c | |||
| e17edade28 | |||
| 959acab9c7 | |||
| 0b59f69fa0 | |||
| ab755a8623 | |||
| a67ad88c3f | |||
| 6684f80f02 | |||
| 620354b77a | |||
| 19c4e12a5b | |||
| 3b0ef59ca7 | |||
| 0386c66b70 | |||
| 9721932c34 | |||
| f9fce7d0ed | |||
| 4747d593be | |||
| 7d8e4ad559 | |||
| 3d02b8cc44 | |||
| 595c2d7cb7 | |||
| 2154daea57 | |||
| 85f166e7d0 | |||
| 0d618e21ce | |||
| 8d610473b3 | |||
| 512a4013b9 | |||
| f6069cad95 | |||
| 90ef890766 | |||
| 5727efa820 | |||
| 057a7cf6f0 |
+3
-5
@@ -1,6 +1,4 @@
|
||||
node_modules/
|
||||
unpackage/
|
||||
config/halo.config.js
|
||||
config/ad.config.js
|
||||
config/love.config.js
|
||||
package-lock.json
|
||||
unpackage/
|
||||
package-lock.json
|
||||
.idea
|
||||
|
||||
+27
-26
@@ -1,28 +1,29 @@
|
||||
{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
|
||||
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
|
||||
"version": "0.0",
|
||||
"configurations": [{
|
||||
"app-plus" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"default" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"h5" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"mp-qq" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"mp-weixin" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"type" : "uniCloud"
|
||||
}
|
||||
{
|
||||
// launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
|
||||
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
|
||||
"version" : "0.0",
|
||||
"configurations" : [
|
||||
{
|
||||
"app-plus" : {
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"default" : {
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"h5" : {
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"mp-qq" : {
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"mp-weixin" : {
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"type" : "uniCloud"
|
||||
},
|
||||
{
|
||||
"playground" : "standard",
|
||||
"type" : "uni-app:app-android"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,48 +1,35 @@
|
||||
<script>
|
||||
import HaloConfig from '@/config/halo.config.js';
|
||||
import HaloAdConfig from '@/config/ad.config.js';
|
||||
import HaloTokenConfig from '@/config/uhalo.config.js';
|
||||
|
||||
// app升级检测(搭配:https://ext.dcloud.net.cn/plugin?id=4470 升级中心)
|
||||
import CheckAppUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
|
||||
import { CheckWxUpdate } from '@/utils/update.js';
|
||||
import {CheckWxUpdate} from '@/utils/update.js';
|
||||
|
||||
export default {
|
||||
globalData: {
|
||||
baseApiUrl: HaloConfig.apiUrl,
|
||||
...HaloConfig,
|
||||
haloAdConfig: HaloAdConfig
|
||||
},
|
||||
onLaunch: function() {
|
||||
console.log('App Launch');
|
||||
globalData: {
|
||||
baseApiUrl: HaloTokenConfig.BASE_API
|
||||
},
|
||||
onLaunch: function () {
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
CheckAppUpdate();
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
CheckAppUpdate();
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
CheckWxUpdate();
|
||||
uni.$tm.vx.commit('setWxShare', HaloConfig.wxShareConfig);
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
CheckWxUpdate();
|
||||
// #endif
|
||||
|
||||
// 监听中间按钮(暂时没有使用)
|
||||
uni.onTabBarMidButtonTap(() => {
|
||||
console.log('点击中间按钮');
|
||||
});
|
||||
|
||||
// 初始化博主信息
|
||||
uni.$tm.vx.actions('blogger/fnGetBlogger');
|
||||
|
||||
// 临时:检查是否有用户,没有的话添加一个默认的用户
|
||||
uni.$tm.vx.actions('user/checkAndSetDefaultUser');
|
||||
|
||||
// 启动检查app的配置是否已经就绪,若未就绪则设置默认的
|
||||
uni.$tm.vx.actions('setting/checkAndSetDefaultAppSettings');
|
||||
},
|
||||
onShow: function() {
|
||||
console.log('App Show');
|
||||
},
|
||||
onHide: function() {
|
||||
console.log('App Hide');
|
||||
}
|
||||
uni.$tm.vx.actions('config/fetchConfigs').then((res) => {
|
||||
})
|
||||
// 启动检查app的配置是否已经就绪,若未就绪则设置默认的
|
||||
uni.$tm.vx.actions('setting/checkAndSetDefaultAppSettings');
|
||||
},
|
||||
onShow: function () {
|
||||
console.log('App Show');
|
||||
},
|
||||
onHide: function () {
|
||||
console.log('App Hide');
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -68,6 +55,6 @@ export default {
|
||||
/* #endif */
|
||||
|
||||
page {
|
||||
background-color: #fafafa;
|
||||
background-color: #fafafa;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,101 +1,101 @@
|
||||
<p align="center">
|
||||
<a href="https://uni-halo.925i.cn" target="_blank" rel="noopener noreferrer">
|
||||
<img width="100" src="https://b.925i.cn/uni_halo/uni_halo_logo.png" alt="uni-halo logo" />
|
||||
<img width="100" src="https://uni-halo.925i.cn/logo.png" alt="uni-halo logo" />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center"><b>【uni-halo】</b> 基于 uniapp + Halo API 开发的多端项目,值得一试。</p>
|
||||
|
||||
<p align="center"><b>【uni-halo v2.0】</b> 基于 Halo2.X API 多端项目,值得一试。</p>
|
||||
|
||||
<p align="center"><b style="font-size: 20px;color: #10B5FB">正式支持 Halo2.X 版本,免费开源</b></p>
|
||||
|
||||
<br />
|
||||
<p align="center">
|
||||
<a href="https://b.925i.cn">作者博客</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">Github仓库</a>
|
||||
<a href="https://www.xiaoxiaomo.cn">作者主页</a>
|
||||
<a href="https://uni-halo.925i.cn">官方文档</a>
|
||||
<a href="https://github.com/ialley-workshop-open/uni-halo">仓库地址</a>
|
||||
<a href="https://github.com/ialley-workshop-open/plugin-uni-halo">插件仓库</a>
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
如果您觉得这个项目对您有帮助,可以帮作者买杯饮料鼓励鼓励,同时为了项目能够持续发展,可以根据您的喜好支持一下本项目哦,非常感谢您的支持,作者也会更有动力持续维护和更新新的功能哦~
|
||||
|
||||
|支付宝 |微信 |QQ |
|
||||
|:--: |:--: |:--: |
|
||||
|| | |
|
||||
| 支付宝 | 微信 | QQ |
|
||||
|:----------------------------------------------:|:---------------------------------------------:|:---------------------------------------------:|
|
||||
|  |  |  |
|
||||
|
||||
## 🧐 功能介绍
|
||||
## 一、项目介绍
|
||||
|
||||
#### 🍻 基础功能
|
||||
基于 Halo 2.x 提供的 API 接口,为微信小程序提供的一套开源的博客应用。
|
||||
|
||||
几乎实现PC端后台的全功能,让您在手机端也可以管理您的博客。
|
||||
- 完全免费开源,包括程序源码、插件源码
|
||||
- 页面支持插件配置
|
||||
- 使用最新流行的技术栈
|
||||
- 支持特色功能,恋爱日记
|
||||
- 理论支持编译为 小程序(推荐)、APP
|
||||
|
||||
- 用户端:文章列表、文章分类、文章详情、图库、留言板、友链、个人日记等
|
||||
- 管理端:资料修改、密码修改、日记管理、文章管理、分类管理、标签管理、附件管理、友链管理、评论管理、日志管理等
|
||||
|
||||
<br/>
|
||||
### 在线预览(小莫唐尼)
|
||||
|
||||
#### 💞 特色功能
|
||||
微信内容扫描下方二维码,即可在线预览小程序。
|
||||
|
||||
- 恋爱日记:精心为您设计了秀恩爱的模块,秀出关于你们的故事、情侣甜蜜相册、恋爱记录清单,为您的恋爱保驾护航。
|
||||

|
||||
|
||||
<br/>
|
||||
|
||||
## 😎 文档源码
|
||||
### 部分截图
|
||||
|
||||
- 作者博客:[https://b.925i.cn/](https://b.925i.cn/)
|
||||
- 官方文档:[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/>
|
||||
|
||||
## 😘 界面预览
|
||||
|
||||
##### 📱 用户端
|
||||
|
||||
说明:以下仅为部分截图
|
||||
|
||||
|首页|分类|图库|友链|
|
||||
|:--:|:--:|:--:|:--:|
|
||||
|||||
|
||||
|
||||
|我的|归档|详情|留言板|
|
||||
|:--:|:--:|:--:|:--:|
|
||||
|||||
|
||||
|
||||
##### 💻 管理端
|
||||
|
||||
说明:以下仅为部分截图
|
||||
|
||||
|后台首页|文章管理|
|
||||
|瞬间|我的|
|
||||
|:--:|:--:|
|
||||
|||
|
||||
|||
|
||||
|
||||
##### 📱 恋爱日记
|
||||
|
||||
说明:以下仅为部分截图
|
||||
### 恋爱日记
|
||||
|
||||
|主页 |恋爱相册 |恋爱清单 |
|
||||
|:--: |:--: |-- |
|
||||
| | | |
|
||||
- 在 uni-halo 中,我们为您准备了一个恋爱日记的模块,您可以在其中记录您的恋爱故事,分享给您的朋友们,请扫示例小程序,在线体验恋爱日记的功能。
|
||||
|
||||
<br/>
|
||||
|
||||
## 🙋 使用交流
|
||||
|
||||
- 提交 issues:[Github Issues](https://github.com/ialley-workshop-open/uni-halo/issues) 丨 [Gitee Issues](https://gitee.com/ialley-workshop-open/uni-halo/issues)
|
||||
### 功能介绍
|
||||
|
||||
- 基础功能:文章列表、文章分类、文章详情、个人图库、友情链接、我的瞬间
|
||||
|
||||
- 特色功能:恋爱日记,精心为您设计了秀恩爱的模块,秀出关于你们的故事、情侣甜蜜相册、恋爱记录清单,为您的恋爱保驾护航。
|
||||
|
||||
|
||||
## 二、配套插件
|
||||
|
||||
### 下载地址
|
||||
- 代码仓库:[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.xiaoxiaomo.cn/](https://blog.xiaoxiaomo.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)
|
||||
- QQ 交流群:632969367
|
||||
- 微信交流群:由于微信交流群时效性太短,所以有需要的话可以先加入QQ群,再邀请进微信群
|
||||
- QQ 交流群:632969367
|
||||
- 快速加群:[](https://qm.qq.com/cgi-bin/qm/qr?k=cuam7lhrB_vHuvjw2mzUO1sOKdF9KRyM&jump_from=webapi&authKey=d6bJhNaqupTTfoMDWDIeYUTAs44Ax7p64SsM/5NRtFhXE09YexDO15Izuyth6XAi)
|
||||
|
||||

|
||||

|
||||
|
||||
<br/>
|
||||
|
||||
@@ -106,7 +106,17 @@ uni-halo 还在持续更新中,本项目欢迎您的参与,共同维护,
|
||||
如果你想加入我们,可以多提供一些好的建议或者提交 pr,我们将会非常乐意接受您的建议和意见。
|
||||
|
||||
<br/>
|
||||
|
||||
|
||||
## 💪 贡献者们
|
||||
|
||||
感谢以下所有给 uni-halo 贡献过代码的 [开发者](https://github.com/ialley-workshop-open/uni-halo/graphs/contributors)。
|
||||
|
||||
<a href="https://github.com/ialley-workshop-open/uni-halo/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=ialley-workshop-open/uni-halo" />
|
||||
</a>
|
||||
|
||||
<br/>
|
||||
|
||||
## 🔍 开源许可
|
||||
|
||||
uni-halo 使用 AGPL-3.0 协议开源,请遵守开源协议。
|
||||
@@ -114,9 +124,10 @@ uni-halo 使用 AGPL-3.0 协议开源,请遵守开源协议。
|
||||
<br/>
|
||||
|
||||
## 🙋 致谢
|
||||
|
||||
uni-halo 得益于以下优秀的技术支撑,我只是站在巨人的肩膀上捡了几根头发丝,但是非常感谢这些优秀的项目,带给了我们其他开发者和用户非常友好的体验!
|
||||
|
||||
- [Halo:一款好用又强大的开源建站工具](https://halo.run/)
|
||||
- [uni-app:是一个使用 Vue.js 开发所有前端应用的框架,开发者编写一套代码可编译到多个平台](https://uniapp.dcloud.net.cn/)
|
||||
- [tm-vuetify:是一个为 uni-app 平台定制的颜值也非常高的 UI 框架](https://www.jx2d.cn/)
|
||||
- [mp-html:一个强大的小程序富文本组件](https://jin-yufeng.gitee.io/mp-html/#/)
|
||||
- [mp-html:一个强大的小程序富文本组件](https://jin-yufeng.gitee.io/mp-html/#/)
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
/**
|
||||
* 附件管理
|
||||
* @see https://api.halo.run/admin-api.html#tag/attachment-controller
|
||||
*/
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 分页获取附件列表
|
||||
* {
|
||||
* "attachmentType": "ALIOSS" "BAIDUBOS" "HUAWEIOBS" "LOCAL" "MINIO" "QINIUOSS" "SMMS" "TENCENTCOS" "UPOSS",
|
||||
* "keyword": "string"
|
||||
* "mediaType": "string"
|
||||
* "page": "string"
|
||||
* "size": "string"
|
||||
* "sort": "string"
|
||||
* }
|
||||
*/
|
||||
getAttachmentsByPage: (params) => {
|
||||
return HttpHandler.Get('/api/admin/attachments', params, {})
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取所有的附件类型
|
||||
*/
|
||||
getAttachmentsMediaTypes: () => {
|
||||
return HttpHandler.Get('/api/admin/attachments/media_types')
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据附件类型获取所有的附件列表
|
||||
*/
|
||||
getAttachmentsTypes: () => {
|
||||
return HttpHandler.Get('/api/admin/attachments/types')
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据附件Id获取附件详情
|
||||
*/
|
||||
getAttachmentsById: (attachmentId) => {
|
||||
return HttpHandler.Get(`/api/admin/attachments/${attachmentId}`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 上传附件-单文件(file)
|
||||
* {
|
||||
* file:文件对象
|
||||
* }
|
||||
*/
|
||||
uploadAttachment: (data) => {
|
||||
return HttpHandler.Upload(`/api/admin/attachments/upload`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 上传附件-多文件(files)
|
||||
* {
|
||||
* files:文件对象集合
|
||||
* }
|
||||
*/
|
||||
uploadAttachments: (data) => {
|
||||
return HttpHandler.Upload(`/api/admin/attachments/uploads`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改一个附件信息
|
||||
*/
|
||||
updateAttachmentById: (attachmentId, name) => {
|
||||
return HttpHandler.Put(`/api/admin/attachments/${attachmentId}`, {
|
||||
name: name
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 批量删除附件(id集合)
|
||||
*/
|
||||
deleteAttachmentByIds: (attachmentIds = []) => {
|
||||
return HttpHandler.Delete(`/api/admin/attachments`, attachmentIds)
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除单个附件
|
||||
*/
|
||||
deleteAttachmentById: (attachmentId) => {
|
||||
return HttpHandler.Delete(`/api/admin/attachments/${attachmentId}`)
|
||||
},
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/**
|
||||
* 文章分类管理
|
||||
* @see https://api.halo.run/admin-api.html#tag/category-controller
|
||||
*/
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 查询所有的文章分类
|
||||
* {
|
||||
* "sort": ["",""], // 排序
|
||||
* "more": "Boolean" ,// 更多参数(回调)
|
||||
* }
|
||||
*/
|
||||
getCategoryList: (params) => {
|
||||
return HttpHandler.Get('/api/admin/categories', params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询所有的文章分类(树形数据)
|
||||
* {
|
||||
* "sort": ["",""], // 排序
|
||||
* }
|
||||
*/
|
||||
getCategoryListTree: (params) => {
|
||||
return HttpHandler.Get('/api/admin/categories/tree_view', params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询文章分类详情
|
||||
* @param {Number} categoryId 分类ID
|
||||
*/
|
||||
getCategoryDetail: (categoryId) => {
|
||||
return HttpHandler.Get(`/api/admin/categories/${categoryId}`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 新增文章分类
|
||||
* {
|
||||
* "description": "string",
|
||||
* "id": 0,
|
||||
* "name": "string",
|
||||
* "parentId": 0,
|
||||
* "password": "string",
|
||||
* "priority": 0,
|
||||
* "slug": "string",
|
||||
* "thumbnail": "string"
|
||||
* }
|
||||
*/
|
||||
createCategory: (data) => {
|
||||
return HttpHandler.Post(`/api/admin/categories`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改文章分类信息
|
||||
* @param {Number} categoryId 分类id
|
||||
* @param {Object} data 同新增
|
||||
*/
|
||||
updateCategoryById: (categoryId, data) => {
|
||||
return HttpHandler.Put(`/api/admin/categories/${categoryId}`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除单个文章分类
|
||||
* @param {Number} categoryId 文章分类id
|
||||
*/
|
||||
deleteCategoryById: (categoryId) => {
|
||||
return HttpHandler.Delete(`/api/admin/categories/${categoryId}`)
|
||||
},
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
/**
|
||||
* 文章评论管理
|
||||
* @see https://api.halo.run/admin-api.html#tag/journal-controller
|
||||
*/
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 查询文章评论
|
||||
* {
|
||||
* "keyword":"", // 关键字
|
||||
* "page": 0, // 分页索引
|
||||
* "size": 10, // 分页大小
|
||||
* "sort": ["",""], // 排序
|
||||
* "status": "" , // 类型 "AUDITING" "PUBLISHED" "RECYCLE"
|
||||
* }
|
||||
*/
|
||||
getPostsComments: (params) => {
|
||||
return HttpHandler.Get('/api/admin/posts/comments', params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 回复文章评论
|
||||
* {
|
||||
* "allowNotification": true,
|
||||
* "author": "string",
|
||||
* "authorUrl": "string",
|
||||
* "content": "string",
|
||||
* "email": "string",
|
||||
* "parentId": 0,
|
||||
* "postId": 0
|
||||
* }
|
||||
*/
|
||||
postPostsComments: (data) => {
|
||||
return HttpHandler.Post('/api/admin/posts/comments', data)
|
||||
},
|
||||
/**
|
||||
* 更新文章评论状态
|
||||
* @param {Number} commentId id
|
||||
* @param {String} status "AUDITING" "PUBLISHED" "RECYCLE"
|
||||
*/
|
||||
updatePostsCommentsStatus: (commentId, status) => {
|
||||
return HttpHandler.Put(`/api/admin/posts/comments/${commentId}/status/${status}`)
|
||||
},
|
||||
/**
|
||||
* 删除文章评论
|
||||
* @param {Number} commentId id
|
||||
*/
|
||||
deletePostsCommentsById: (commentId) => {
|
||||
return HttpHandler.Delete(`/api/admin/posts/comments/${commentId}`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询页面评论
|
||||
* {
|
||||
* "keyword":"", // 关键字
|
||||
* "page": 0, // 分页索引
|
||||
* "size": 10, // 分页大小
|
||||
* "sort": ["",""], // 排序
|
||||
* "status": "" , // 类型 "AUDITING" "PUBLISHED" "RECYCLE"
|
||||
* }
|
||||
*/
|
||||
getSheetsComments: (params) => {
|
||||
return HttpHandler.Get('/api/admin/sheets/comments', params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 回复页面评论
|
||||
* {
|
||||
* "allowNotification": true,
|
||||
* "author": "string",
|
||||
* "authorUrl": "string",
|
||||
* "content": "string",
|
||||
* "email": "string",
|
||||
* "parentId": 0,
|
||||
* "postId": 0
|
||||
* }
|
||||
*/
|
||||
postSheetsComments: (data) => {
|
||||
return HttpHandler.Post('/api/admin/sheets/comments', data)
|
||||
},
|
||||
/**
|
||||
* 更新页面评论状态
|
||||
* @param {Number} commentId id
|
||||
* @param {String} status "AUDITING" "PUBLISHED" "RECYCLE"
|
||||
*/
|
||||
updateSheetsCommentsStatus: (commentId, status) => {
|
||||
return HttpHandler.Put(`/api/admin/sheets/comments/${commentId}/status/${status}`)
|
||||
},
|
||||
/**
|
||||
* 删除页面评论
|
||||
* @param {Number} commentId id
|
||||
*/
|
||||
deleteSheetsCommentsById: (commentId) => {
|
||||
return HttpHandler.Delete(`/api/admin/sheets/comments/${commentId}`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询日记评论
|
||||
* {
|
||||
* "keyword":"", // 关键字
|
||||
* "page": 0, // 分页索引
|
||||
* "size": 10, // 分页大小
|
||||
* "sort": ["",""], // 排序
|
||||
* "status": "" , // 类型 "AUDITING" "PUBLISHED" "RECYCLE"
|
||||
* }
|
||||
*/
|
||||
getJournalsComments: (params) => {
|
||||
return HttpHandler.Get('/api/admin/journals/comments', params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 回复日记评论
|
||||
* {
|
||||
* "allowNotification": true,
|
||||
* "author": "string",
|
||||
* "authorUrl": "string",
|
||||
* "content": "string",
|
||||
* "email": "string",
|
||||
* "parentId": 0,
|
||||
* "postId": 0
|
||||
* }
|
||||
*/
|
||||
postJournalsComments: (data) => {
|
||||
return HttpHandler.Post('/api/admin/journals/comments', data)
|
||||
},
|
||||
/**
|
||||
* 更新日记评论状态
|
||||
* @param {Number} commentId id
|
||||
* @param {String} status "AUDITING" "PUBLISHED" "RECYCLE"
|
||||
*/
|
||||
updateJournalsCommentsStatus: (commentId, status) => {
|
||||
return HttpHandler.Put(`/api/admin/journals/comments/${commentId}/status/${status}`)
|
||||
},
|
||||
/**
|
||||
* 删除日记评论
|
||||
* @param {Number} commentId id
|
||||
*/
|
||||
deleteJournalsCommentsById: (commentId) => {
|
||||
return HttpHandler.Delete(`/api/admin/journals/comments/${commentId}`)
|
||||
},
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/**
|
||||
* 个人日记管理
|
||||
* @see https://api.halo.run/admin-api.html#tag/journal-controller
|
||||
*/
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 查询所有的日记列表
|
||||
* {
|
||||
* "keyword":"", // 关键字
|
||||
* "page": 0, // 分页索引
|
||||
* "size": 10, // 分页大小
|
||||
* "sort": ["",""], // 排序
|
||||
* "type": "" , // 类型 "INTIMATE" "PUBLIC"
|
||||
* }
|
||||
*/
|
||||
getJournals: (params) => {
|
||||
return HttpHandler.Get('/api/admin/journals', params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询最近的所有的日记列表
|
||||
* {
|
||||
* "top":number, // 数量
|
||||
* }
|
||||
*/
|
||||
getLatestJournals: (params) => {
|
||||
return HttpHandler.Get('/api/admin/journals/latest', params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 新增个人日记
|
||||
* {
|
||||
* "content": "string",
|
||||
* "keepRaw": true,
|
||||
* "sourceContent": "string",
|
||||
* "type": "INTIMATE",
|
||||
* }
|
||||
*/
|
||||
createJournals: (data) => {
|
||||
return HttpHandler.Post(`/api/admin/journals`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改个人日记信息
|
||||
* @param {Number} journalsId id
|
||||
* @param {Object} data 同新增
|
||||
*/
|
||||
updateJournalsById: (journalsId, data) => {
|
||||
return HttpHandler.Put(`/api/admin/journals/${journalsId}`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除个人日记
|
||||
* @param {Number} journalsId id
|
||||
*/
|
||||
deleteJournalsById: (journalsId) => {
|
||||
return HttpHandler.Delete(`/api/admin/journals/${journalsId}`)
|
||||
},
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/**
|
||||
* 友链管理
|
||||
* @see https://api.halo.run/admin-api.html#tag/link-controller
|
||||
*/
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
// 获取友链列表
|
||||
getLinkList: () => {
|
||||
return HttpHandler.Get('/api/admin/links')
|
||||
},
|
||||
/**
|
||||
* 获取友链详情
|
||||
* @params { Number } linkId 友链Id
|
||||
*/
|
||||
getLinkDetail: (linkId) => {
|
||||
return HttpHandler.Get(`/api/admin/links/${linkId}`)
|
||||
},
|
||||
/**
|
||||
* 新增友链
|
||||
* {
|
||||
* "description": "string",
|
||||
* "logo": "string",
|
||||
* "name": "string",
|
||||
* "priority": 0,
|
||||
* "team": "string",
|
||||
* "url": "string"
|
||||
* }
|
||||
*/
|
||||
addLink: (data) => {
|
||||
return HttpHandler.Post('/api/admin/links', data, {})
|
||||
},
|
||||
/**
|
||||
* 修改友链
|
||||
* {
|
||||
* "description": "string",
|
||||
* "logo": "string",
|
||||
* "name": "string",
|
||||
* "priority": 0,
|
||||
* "team": "string",
|
||||
* "url": "string"
|
||||
* }
|
||||
*/
|
||||
updateLink: (linkId, data) => {
|
||||
return HttpHandler.Put(`/api/admin/links/${linkId}`, data, {})
|
||||
},
|
||||
/**
|
||||
* 删除友链
|
||||
* @params { Number } linkId 友链Id
|
||||
*/
|
||||
deleteLink: (linkId) => {
|
||||
return HttpHandler.Delete(`/api/admin/links/${linkId}`)
|
||||
},
|
||||
|
||||
// 获取友链分组
|
||||
getLinkTeamList: (data) => {
|
||||
return HttpHandler.Get('/api/admin/links/teams')
|
||||
},
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/**
|
||||
* 日志管理
|
||||
* @see https://api.halo.run/admin-api.html#tag/link-controller
|
||||
*/
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 获取日志列表列表
|
||||
* params:{ top: Number}
|
||||
*/
|
||||
getLogsLatestList: (params) => {
|
||||
return HttpHandler.Get('/api/admin/logs/latest', params)
|
||||
},
|
||||
/**
|
||||
* 获取日志列表列表
|
||||
* params:{ page:Number,size:Number, sort:String }
|
||||
*/
|
||||
getLogsListByPage: (params) => {
|
||||
return HttpHandler.Get('/api/admin/logs', params)
|
||||
},
|
||||
/**
|
||||
* 清空日志
|
||||
*/
|
||||
deleteAllLogs: () => {
|
||||
return HttpHandler.Get(`/api/admin/logs/clear`)
|
||||
},
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
/**
|
||||
* 图库管理
|
||||
* @see https://api.halo.run/admin-api.html#tag/photo-controller
|
||||
*/
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 查询图片列表
|
||||
* {
|
||||
* "sort": ["",""], // 排序
|
||||
* "more": "Boolean" ,// 更多参数(回调)
|
||||
* }
|
||||
*/
|
||||
getPhotos: (params) => {
|
||||
return HttpHandler.Get('/api/admin/photos', params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询最近的图库列表(树形数据)
|
||||
* {
|
||||
* "sort": ["",""], // 排序
|
||||
* }
|
||||
*/
|
||||
getLatestPhotos: (params) => {
|
||||
return HttpHandler.Get('/api/admin/photos/latest', params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询所有的图片分组
|
||||
*/
|
||||
getPhotosTeams: () => {
|
||||
return HttpHandler.Get('/api/admin/photos/teams')
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询图片详情
|
||||
* @param {Number} photoId id
|
||||
*/
|
||||
getPhotosDetail: (photoId) => {
|
||||
return HttpHandler.Get(`/api/admin/photos/${photoId}`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 新增图片(单图)
|
||||
*{
|
||||
* "description": "string",
|
||||
* "id": 0,
|
||||
* "location": "string",
|
||||
* "name": "string",
|
||||
* "takeTime": "2019-08-24T14:15:22Z",
|
||||
* "team": "string",
|
||||
* "thumbnail": "string",
|
||||
* "url": "string"
|
||||
*}
|
||||
*/
|
||||
createPhotos: (data) => {
|
||||
return HttpHandler.Post(`/api/admin/photos`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 新增图片(批量)
|
||||
* {
|
||||
* "description": "string",
|
||||
* "id": 0,
|
||||
* "location": "string",
|
||||
* "name": "string",
|
||||
* "takeTime": "2019-08-24T14:15:22Z",
|
||||
* "team": "string",
|
||||
* "thumbnail": "string",
|
||||
* "url": "string"
|
||||
* }
|
||||
*/
|
||||
createPhotosBatch: (data) => {
|
||||
return HttpHandler.Post(`/api/admin/photos/batch`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改图片信息
|
||||
* @param {Number} photoId id
|
||||
* @param {Object} data 同新增
|
||||
*/
|
||||
updatePhotosById: (photoId, data) => {
|
||||
return HttpHandler.Put(`/api/admin/photos/${photoId}`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除单张图片
|
||||
* @param {Number} photoId id
|
||||
*/
|
||||
deletePhotosById: (photoId) => {
|
||||
return HttpHandler.Delete(`/api/admin/photos/${photoId}`)
|
||||
},
|
||||
/**
|
||||
* 批量删除图片
|
||||
* @param {Number} photoIds id数组
|
||||
*/
|
||||
deletePhotosBatchById: (photoIds) => {
|
||||
return HttpHandler.Delete(`/api/admin/photos/batch`, photoIds)
|
||||
},
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
/**
|
||||
* 文章管理
|
||||
* @see https://api.halo.run/admin-api.html#tag/post-controller
|
||||
*/
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
/**
|
||||
* 新建和编辑文章字段
|
||||
*/
|
||||
const createOrEditModel = {
|
||||
"categoryIds": [
|
||||
0
|
||||
],
|
||||
"content": "string",
|
||||
"createTime": "2019-08-24T14:15:22Z",
|
||||
"disallowComment": true,
|
||||
"editorType": "MARKDOWN",
|
||||
"keepRaw": true,
|
||||
"metaDescription": "string",
|
||||
"metaKeywords": "string",
|
||||
"metas": [{
|
||||
"key": "string",
|
||||
"postId": 0,
|
||||
"value": "string"
|
||||
}],
|
||||
"originalContent": "string",
|
||||
"formatContent": "",
|
||||
"password": "string",
|
||||
"slug": "string",
|
||||
"status": "DRAFT",
|
||||
"summary": "string",
|
||||
"tagIds": [
|
||||
0
|
||||
],
|
||||
"template": "string",
|
||||
"thumbnail": "string",
|
||||
"title": "string",
|
||||
"topPriority": 0
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 查询文章列表
|
||||
* @param {Object} params {
|
||||
* categoryId,keyword,page,size,sort,
|
||||
* status:"DRAFT" "INTIMATE" "PUBLISHED" "RECYCLE",statuses,more
|
||||
* }
|
||||
*/
|
||||
getPostsByPage: (params) => {
|
||||
return HttpHandler.Get('/api/admin/posts', params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询最近的文章列表
|
||||
* @param {Object} params {top:Number}
|
||||
*/
|
||||
getLatestPosts: (params) => {
|
||||
return HttpHandler.Get('/api/admin/posts/latest', params)
|
||||
},
|
||||
/**
|
||||
* 根据状态查询文章列表
|
||||
* @param {String} status:"DRAFT" "INTIMATE" "PUBLISHED" "RECYCLE"
|
||||
* @param {Object} params:{ page,size,sort,more }
|
||||
*/
|
||||
getPostsPageByStatus: (status, params) => {
|
||||
return HttpHandler.Get(`/api/admin/posts/status/${status}`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据文章id获取文章
|
||||
* @param {Number} postsId 文章id
|
||||
*/
|
||||
getPostsById: (postsId) => {
|
||||
return HttpHandler.Get(`/api/admin/posts/${postsId}`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 新增文章
|
||||
* @param {Object} data 同新增
|
||||
* @param {Boolean} isAutoSave 是否来源于自动保存
|
||||
*/
|
||||
createPosts: (data, isAutoSave = false) => {
|
||||
return HttpHandler.Post(`/api/admin/posts?autoSave=${isAutoSave}`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改文章
|
||||
* @param {Number} postsId id
|
||||
* @param {Object} data 同新增
|
||||
* @param {Boolean} isAutoSave 是否来源于自动保存
|
||||
*/
|
||||
updatePostsById: (postsId, data, isAutoSave = false) => {
|
||||
return HttpHandler.Put(`/api/admin/posts/${postsId}?autoSave=${isAutoSave}`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改文章(草稿)
|
||||
* @param {Number} postsId id
|
||||
* @param {Object} data { content,keepRaw,originalContent }
|
||||
*/
|
||||
updatePostsDraftById: (postsId, data) => {
|
||||
return HttpHandler.Put(`/api/admin/posts/${postsId}/status/draft/content`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改文章状态
|
||||
* @param {Number} postsId id
|
||||
* @param {String} status "DRAFT" "INTIMATE" "PUBLISHED" "RECYCLE"
|
||||
*/
|
||||
updatePostsDraftById: (postsId, status) => {
|
||||
return HttpHandler.Put(`/api/admin/posts/${postsId}/status/${status}`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除文章(批量)
|
||||
* @param {Array} postsIds ids
|
||||
*/
|
||||
deletePostsByIds: (postsIds) => {
|
||||
return HttpHandler.Delete(`/api/admin/posts`, postsIds)
|
||||
},
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/**
|
||||
* 标签管理
|
||||
* @see https://api.halo.run/admin-api.html#tag/tag-controller
|
||||
*/
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 查询文章标签列表
|
||||
* {
|
||||
* "sort": ["",""], // 排序
|
||||
* "more": "Boolean" ,// 更多参数(回调)
|
||||
* }
|
||||
*/
|
||||
getTagsList: (params) => {
|
||||
return HttpHandler.Get('/api/admin/tags', params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询文章标签详情
|
||||
* @param {Number} tagId id
|
||||
*/
|
||||
getTagsDetail: (tagId) => {
|
||||
return HttpHandler.Get(`/api/admin/tags/${tagId}`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 新增文章标签
|
||||
* {
|
||||
* "color": "#e23d66", // 颜色选择器
|
||||
* "name": "string",
|
||||
* "slug": "string",
|
||||
* "thumbnail": "string"
|
||||
* }
|
||||
*/
|
||||
createTags: (data) => {
|
||||
return HttpHandler.Post(`/api/admin/tags`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改文章标签信息
|
||||
* @param {Number} tagId id
|
||||
* @param {Object} data 同新增
|
||||
*/
|
||||
updateTagsById: (tagId, data) => {
|
||||
return HttpHandler.Put(`/api/admin/tags/${tagId}`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除文章标签
|
||||
* @param {Number} tagId id
|
||||
*/
|
||||
deleteTagsById: (tagId) => {
|
||||
return HttpHandler.Delete(`/api/admin/tags/${tagId}`)
|
||||
},
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
/**
|
||||
* 登录管理
|
||||
* @see https://api.halo.run/admin-api.html#tag/admin-controller
|
||||
*/
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
// 登录前检查
|
||||
loginPreCheck: (data) => {
|
||||
return HttpHandler.Post('/api/admin/login/precheck', data, {})
|
||||
},
|
||||
// 登录
|
||||
login: (data) => {
|
||||
return HttpHandler.Post('/api/admin/login', data, {})
|
||||
},
|
||||
// 刷新token
|
||||
refreshToken: (refreshToken) => {
|
||||
return HttpHandler.Post($`/api/admin/refresh/${refreshToken}`, {}, {})
|
||||
},
|
||||
|
||||
// 退出登录
|
||||
logout: () => {
|
||||
return HttpHandler.Post('/api/admin/logout')
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取修改密码的验证码
|
||||
* {
|
||||
* "email": "string",
|
||||
* "username": "string"
|
||||
* }
|
||||
*/
|
||||
getResetPasswordCode: () => {
|
||||
return HttpHandler.Post('/api/admin/password/code')
|
||||
},
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
* {
|
||||
* "code": "string",
|
||||
* "email": "string",
|
||||
* "password": "stringst",
|
||||
* "username": "string"
|
||||
* }
|
||||
*/
|
||||
resetPasswordByCode: (data) => {
|
||||
return HttpHandler.Put('/api/admin/password/reset', data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取个人信息(当前登录的管理员)
|
||||
*/
|
||||
getAdminProfile: () => {
|
||||
return HttpHandler.Get('/api/admin/users/profiles')
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改个人信息(当前登录的管理员)
|
||||
* {
|
||||
* "avatar": "string",
|
||||
* "description": "string",
|
||||
* "email": "string",
|
||||
* "nickname": "string",
|
||||
* "password": "stringst",
|
||||
* "username": "string"
|
||||
* }
|
||||
*/
|
||||
updateAdminProfile: (data) => {
|
||||
return HttpHandler.Put('/api/admin/users/profiles', data)
|
||||
},
|
||||
/**
|
||||
* 修改密码
|
||||
* {
|
||||
* "confirmPassword": "string",
|
||||
* "newPassword": "string",
|
||||
* "oldPassword": "strings"
|
||||
* }
|
||||
*/
|
||||
modifyAdminPassword: (data) => {
|
||||
return HttpHandler.Put('/api/admin/users/profiles/password', data)
|
||||
},
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
/**
|
||||
* 归档接口
|
||||
* @see https://api.halo.run/content-api.html#tag/archive-controlle
|
||||
*/
|
||||
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 获取归档列表(按月)
|
||||
*/
|
||||
getMonthArchives: () => {
|
||||
return HttpHandler.Get(`/api/content/archives/months`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取归档列表(按年)
|
||||
*/
|
||||
getYearArchives: () => {
|
||||
return HttpHandler.Get(`/api/content/archives/years`)
|
||||
},
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/**
|
||||
* 文章接口
|
||||
*/
|
||||
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
export default {
|
||||
/**
|
||||
* 获取文章列表
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getArticleList: (params) => {
|
||||
return HttpHandler.Get('/api/content/posts', params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取文章详情
|
||||
* @param {String} articleId 文章id
|
||||
*/
|
||||
getArticleDetail: (articleId) => {
|
||||
return HttpHandler.Get(`/api/content/posts/${articleId}`, {
|
||||
formatDisabled: false,
|
||||
sourceDisabled: true
|
||||
})
|
||||
},
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
/**
|
||||
* 博主信息
|
||||
* @see https://api.halo.run/content-api.html#tag/user-controller
|
||||
*/
|
||||
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 获取博主信息
|
||||
*/
|
||||
getBloggerInfo: () => {
|
||||
return HttpHandler.Get(`/api/content/users/profile`)
|
||||
},
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* 分类接口
|
||||
* @see https://api.halo.run/content-api.html#tag/category-controller
|
||||
*/
|
||||
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
import { getCache } from '@/utils/storage.js'
|
||||
export default {
|
||||
/**
|
||||
* 查询分类列表
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getCategoryList: (params) => {
|
||||
return HttpHandler.Get('/api/content/categories', params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询分类下的文章
|
||||
* @param {String} slug 分类名称
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getCategoryPostList: (slug, params) => {
|
||||
// 从缓存中根据分类获取密码,如果获取到了说明本分类需要密码,避免多个分类需要密码在输入密码后刷新页面点错了分类
|
||||
params.password = getCache('APP_CATEGORY_PWD_' + slug)
|
||||
return HttpHandler.Get(`/api/content/categories/${slug}/posts`, params)
|
||||
},
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
* 评论接口
|
||||
* @see https://api.halo.run/content-api.html#tag/post-controller
|
||||
*/
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 获取评论列表接口(树形数据)
|
||||
* @param {String} postId 文章id
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getPostCommentTree: (postId, params) => {
|
||||
return HttpHandler.Get(`/api/content/posts/${postId}/comments/tree_view`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取评论列表接口(列表数据)
|
||||
* @param {String} postId 文章id
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getPostCommentList: (postId, params) => {
|
||||
return HttpHandler.Get(`/api/content/posts/${postId}/comments/list_view`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取置顶评论
|
||||
* @param {String} postId 文章id
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getPostTopCommentList: (postId, params) => {
|
||||
return HttpHandler.Get(`/api/content/posts/${postId}/comments/top_view`, params)
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取评论的子评论列表
|
||||
* @param {String} postId 文章id
|
||||
* @param {String} commentParentId 要获取的评论id
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getPostChildrenCommentList: (postId, commentParentId, params) => {
|
||||
return HttpHandler.Get(`/api/content/posts/${postId}/comments/${commentParentId}/children`, params)
|
||||
},
|
||||
}
|
||||
+7
-58
@@ -10,70 +10,19 @@
|
||||
* 修改时间:
|
||||
*/
|
||||
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
import archive from './archive.js'
|
||||
import article from './article.js'
|
||||
import blogger from './blogger.js'
|
||||
import category from './category.js'
|
||||
import tag from './tag.js'
|
||||
import comment from './comment.js'
|
||||
import journal from './journal.js'
|
||||
import link from './link.js'
|
||||
import menu from './menu.js'
|
||||
import option from './option.js'
|
||||
import photo from './photo.js'
|
||||
import post from './post.js'
|
||||
import sheet from './sheet.js'
|
||||
import statistics from './statistics.js'
|
||||
import theme from './theme.js'
|
||||
|
||||
// 管理端
|
||||
import admin_login from './admin/user.js'
|
||||
import admin_links from './admin/links.js'
|
||||
import admin_attachment from './admin/attachment.js'
|
||||
import admin_category from './admin/category.js'
|
||||
import admin_journal from './admin/journal.js'
|
||||
import admin_photos from './admin/photos.js'
|
||||
import admin_tags from './admin/tags.js'
|
||||
import admin_comments from './admin/comments.js'
|
||||
import admin_posts from './admin/posts.js'
|
||||
import admin_logs from './admin/logs.js'
|
||||
// 2.0接口
|
||||
import v2 from './v2/all.api.js'
|
||||
import v2Config from './v2/all.config.js'
|
||||
|
||||
const ApiManager = {
|
||||
...archive,
|
||||
...article,
|
||||
...blogger,
|
||||
...category,
|
||||
...tag,
|
||||
...comment,
|
||||
...journal,
|
||||
...link,
|
||||
...option,
|
||||
...photo,
|
||||
...post,
|
||||
...sheet,
|
||||
...statistics,
|
||||
...theme,
|
||||
// 管理端的api
|
||||
admin: {
|
||||
...admin_login,
|
||||
...admin_links,
|
||||
...admin_attachment,
|
||||
...admin_category,
|
||||
...admin_journal,
|
||||
...admin_photos,
|
||||
...admin_tags,
|
||||
...admin_comments,
|
||||
...admin_posts,
|
||||
...admin_logs
|
||||
}
|
||||
v2,
|
||||
v2Config,
|
||||
};
|
||||
|
||||
const install = (Vue) => {
|
||||
Vue.prototype.$httpApi = ApiManager
|
||||
Vue.prototype.$httpApi = ApiManager
|
||||
}
|
||||
|
||||
export default {
|
||||
install
|
||||
install
|
||||
}
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/**
|
||||
* 日记接口
|
||||
* @see https://api.halo.run/content-api.html#tag/journal-controller
|
||||
*/
|
||||
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 获取日记列表
|
||||
* @param {String} journalId 日记id
|
||||
*/
|
||||
getJournals: () => {
|
||||
return HttpHandler.Get(`/api/content/journals`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取日记详情
|
||||
* @param {String} journalId 日记id
|
||||
*/
|
||||
getJournalDetail: (journalId) => {
|
||||
return HttpHandler.Get(`/api/content/journals/${journalId}`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取日记置顶评论列表
|
||||
* @param {String} journalId 日记id
|
||||
*/
|
||||
getJournalTopComments: (journalId) => {
|
||||
return HttpHandler.Get(`/api/content/journals/${journalId}/comments/top_view`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取日记评论列表(列表形式)
|
||||
* @param {String} journalId 日记id
|
||||
*/
|
||||
getJournalCommentList: (journalId) => {
|
||||
return HttpHandler.Get(`/api/content/journals/${journalId}/comments/list_view`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取日记评论列表(树形式)
|
||||
* @param {String} journalId 日记id
|
||||
*/
|
||||
getJournalCommentTree: (journalId) => {
|
||||
return HttpHandler.Get(`/api/content/journals/${journalId}/comments/tree_view`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取日记评论列表(树形式)
|
||||
* @param {String} journalId 日记id
|
||||
* @param {String} commentParentId 评论id
|
||||
*/
|
||||
getJournalCommentChildren: (journalId, commentParentId) => {
|
||||
return HttpHandler.Get(
|
||||
`/api/content/journals/${journalId}/comments/${commentParentId}/children`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 发表日记评论
|
||||
* @param {Object} data 评论数据
|
||||
*/
|
||||
postJournalComments: (data) => {
|
||||
return HttpHandler.Post(`/api/content/journals/comments`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 给日记点赞
|
||||
* @param {String} journalId 日记id
|
||||
*/
|
||||
postJournalLikes: (journalId) => {
|
||||
return HttpHandler.Post(`/api/content/journals/${journalId}/likes`)
|
||||
},
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
/**
|
||||
* 友链接口
|
||||
* @see https://api.halo.run/content-api.html#tag/link-controller
|
||||
*/
|
||||
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 获取友链列表
|
||||
* @param {Object} params 参数
|
||||
*/
|
||||
getLinkList: (params) => {
|
||||
return HttpHandler.Get(`/api/content/links`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取分组的友链列表
|
||||
* @param {Object} params 参数
|
||||
*/
|
||||
getLinkListByTeam: (params) => {
|
||||
return HttpHandler.Get(`/api/content/links/team_view`, params)
|
||||
},
|
||||
}
|
||||
-112
@@ -1,112 +0,0 @@
|
||||
/**
|
||||
* 普通用户登录
|
||||
*/
|
||||
|
||||
// 获取用户信息
|
||||
export function getUserInfo() {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.getUserProfile({
|
||||
lang: 'zh_CN',
|
||||
desc: '用户登录', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,
|
||||
success: (res) => {
|
||||
console.log(res, 'resss')
|
||||
resolve(res.userInfo)
|
||||
},
|
||||
fail: (err) => {
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export function getLogin() {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.login({
|
||||
success(res) {
|
||||
console.log('----------getLogin ---------')
|
||||
console.log(res)
|
||||
resolve(res)
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err, 'logoer')
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export function wxLogin() {
|
||||
uni.getProvider({
|
||||
service: 'oauth',
|
||||
success: function(res) {
|
||||
//支持微信、qq和微博等
|
||||
if (~res.provider.indexOf('weixin')) {
|
||||
console.log(res, 'ress')
|
||||
let _userInfo = getUserInfo();
|
||||
let _loginRes = getLogin();
|
||||
Promise.all([_userInfo, _loginRes]).then((res) => {
|
||||
let userInfo = res[0];
|
||||
let loginRes = res[1];
|
||||
if (loginRes.errMsg == 'login:ok') {
|
||||
uni.$tm.vx.commit('user/setWxLoginInfo', {
|
||||
avatarUrl: userInfo.avatarUrl,
|
||||
nickName: userInfo.nickName,
|
||||
email: '',
|
||||
url: ''
|
||||
});
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '登录成功!'
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '登录失败,请重试!'
|
||||
})
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '登录失败,请重试!'
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: function(err) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '登录失败,请重试!'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function appWxLogin() {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: function(loginRes) {
|
||||
// 获取用户信息
|
||||
uni.getUserInfo({
|
||||
provider: 'weixin',
|
||||
success: function(infoRes) {
|
||||
uni.$tm.vx.commit('user/setWxLoginInfo', {
|
||||
avatarUrl: infoRes.userInfo.avatarUrl,
|
||||
nickName: infoRes.userInfo.nickName,
|
||||
email: '',
|
||||
url: ''
|
||||
});
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '登录成功!'
|
||||
})
|
||||
},
|
||||
fail: function(err) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '登录失败,请重试!'
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
/**
|
||||
* 菜单接口
|
||||
* @see https://api.halo.run/content-api.html#tag/menu-controller
|
||||
*/
|
||||
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 获取菜单列表(列表)
|
||||
* @param {Object} params 参数
|
||||
*/
|
||||
getMenuList: (params) => {
|
||||
return HttpHandler.Get(`/api/content/menus`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取菜单列表(树形)
|
||||
* @param {Object} params 参数
|
||||
*/
|
||||
getMenuTree: (params) => {
|
||||
return HttpHandler.Get(`/api/content/menus/tree_view`, params)
|
||||
},
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* 配置接口
|
||||
* @see https://api.halo.run/content-api.html#tag/option-controller
|
||||
*/
|
||||
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 根据key获取配置
|
||||
* @param {String} key 配置的key
|
||||
*/
|
||||
getOptionByKey: (key) => {
|
||||
return HttpHandler.Get(`/api/content/options/keys/${key}`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取配置列表(列表)
|
||||
*/
|
||||
getOptionList: () => {
|
||||
return HttpHandler.Get(`/api/content/options/list_view`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取配置列表(键值对)
|
||||
*/
|
||||
getOptionMap: () => {
|
||||
return HttpHandler.Get(`/api/content/options/map_view`)
|
||||
},
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* 图库接口
|
||||
* @see https://api.halo.run/content-api.html#tag/photo-controller
|
||||
*/
|
||||
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 获取图库列表(分页查询)
|
||||
* @param {Object} params 参数
|
||||
*/
|
||||
getPhotoListByPage: (params) => {
|
||||
return HttpHandler.Get(`/api/content/photos`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取图库列表(最新)
|
||||
* @param {Object} params 参数
|
||||
*/
|
||||
getPhotoList: (params) => {
|
||||
return HttpHandler.Get(`/api/content/photos/latest`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取图库分组
|
||||
*/
|
||||
getPhotoTeams: () => {
|
||||
return HttpHandler.Get(`/api/content/photos/teams`)
|
||||
},
|
||||
}
|
||||
-82
@@ -1,82 +0,0 @@
|
||||
/**
|
||||
* 文章接口
|
||||
* @see https://api.halo.run/content-api.html#tag/post-controller
|
||||
*/
|
||||
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 获取文章列表
|
||||
* @param {Object} params 参数
|
||||
*/
|
||||
getPostList: (params) => {
|
||||
return HttpHandler.Get(`/api/content/posts`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 评论文章
|
||||
* @param {Object} data 数据
|
||||
* {
|
||||
* "allowNotification": true,
|
||||
* "author": "string",
|
||||
* "authorUrl": "string",
|
||||
* "content": "string",
|
||||
* "email": "string",
|
||||
* "parentId": 0,
|
||||
* "postId": 0
|
||||
* }
|
||||
*/
|
||||
postCommentPost: (data) => {
|
||||
return HttpHandler.Post(`/api/content/posts/comments`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 搜索文章
|
||||
* @param {Object} data 数据
|
||||
*/
|
||||
getPostListByKeyword: (data) => {
|
||||
return HttpHandler.Post(`/api/content/posts/search`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据分类获取文章
|
||||
* @param {Object} params 参数
|
||||
*/
|
||||
getPostDetailBySlug: (params) => {
|
||||
return HttpHandler.Get(`/api/content/posts/slug`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据文章id获取文章
|
||||
* @param {Object} params 参数
|
||||
*/
|
||||
getPostDetailByPostId: (postId, params) => {
|
||||
return HttpHandler.Get(`/api/content/posts/${postId}`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 给文章点赞
|
||||
* @param {Object} postId 文章id
|
||||
*/
|
||||
postLikePost: (postId) => {
|
||||
return HttpHandler.Post(`/api/content/posts/${postId}/likes`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据当前文章id获取前一篇文章
|
||||
* @param {Object} postId 文章id
|
||||
*/
|
||||
getPrevByCurrentPostId: (postId) => {
|
||||
return HttpHandler.Get(`/api/content/posts/${postId}/prev`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据当前文章id获取下一篇文章
|
||||
* @param {Object} postId 文章id
|
||||
*/
|
||||
getNextByCurrentPostId: (postId) => {
|
||||
return HttpHandler.Get(`/api/content/posts/${postId}/next`)
|
||||
},
|
||||
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/**
|
||||
* 自定义页面模板
|
||||
* @see https://api.halo.run/content-api.html#tag/sheet-controller
|
||||
*/
|
||||
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 获取页面列表
|
||||
* {
|
||||
* page:
|
||||
* size:
|
||||
* sort:
|
||||
* }
|
||||
*/
|
||||
getSheetsList: (params) => {
|
||||
return HttpHandler.Get(`/api/content/sheets`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据分类获取页面数据
|
||||
*/
|
||||
getSheetsListBySlug: (params) => {
|
||||
return HttpHandler.Get(`/api/content/sheets/slug`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取页面评论(列表)
|
||||
*/
|
||||
getSheetsCommentsListBySheetId: (sheetId, params) => {
|
||||
return HttpHandler.Get(`/api/content/sheets/${sheetId}/comments/list_view`, params)
|
||||
},
|
||||
/**
|
||||
* 获取页面评论(树形)
|
||||
*/
|
||||
getSheetsCommentsTreeBySheetId: (sheetId, params) => {
|
||||
return HttpHandler.Get(`/api/content/sheets/${sheetId}/comments/tree_view`, params)
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取评论的子评论列表
|
||||
* @param {String} sheetId 页面id
|
||||
* @param {String} commentParentId 要获取的评论id
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getSheetsChildrenCommentList: (sheetId, commentParentId, params) => {
|
||||
return HttpHandler.Get(`/api/content/sheets/${sheetId}/comments/${commentParentId}/children`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 给页面添加一个评论
|
||||
* {
|
||||
* "allowNotification": true,
|
||||
* "author": "string",
|
||||
* "authorUrl": "string",
|
||||
* "content": "string",
|
||||
* "email": "string",
|
||||
* "parentId": 0,
|
||||
* "postId": 0
|
||||
* }
|
||||
*/
|
||||
postSheetsComments: (data) => {
|
||||
return HttpHandler.Post(`/api/content/sheets/comments`, data)
|
||||
},
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
/**
|
||||
* 博客统计信息
|
||||
* @see https://api.halo.run/content-api.html#tag/statistic-controller
|
||||
*/
|
||||
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 获取博客统计信息
|
||||
*/
|
||||
getBlogStatistics: () => {
|
||||
return HttpHandler.Get(`/api/content/statistics`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取博客统计信息和用户信息
|
||||
*/
|
||||
getBlogStatisticsWithUser: () => {
|
||||
return HttpHandler.Get(`/api/content/statistics/user`)
|
||||
},
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
/**
|
||||
* 标签接口
|
||||
* @see https://api.halo.run/content-api.html#tag/tag-controller
|
||||
*/
|
||||
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
export default {
|
||||
/**
|
||||
* 查询标签列表
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getTagList: (params) => {
|
||||
return HttpHandler.Get('/api/content/tags', params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询标签下的文章
|
||||
* @param {String} slug 别名
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getTagPostsList: (slug, params) => {
|
||||
return HttpHandler.Get(`/api/content/tags/${slug}/posts`, params)
|
||||
},
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* 主题设置
|
||||
* @see https://api.halo.run/content-api.html#tag/theme-controller
|
||||
*/
|
||||
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 获取激活主题的信息
|
||||
* @param {Object} params 参数
|
||||
*/
|
||||
geActivationThemeList: (params) => {
|
||||
return HttpHandler.Get(`/api/content/themes/activation`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取激活的主题设置
|
||||
* @param {Object} params 参数
|
||||
*/
|
||||
getActivationThemeSettings: (params) => {
|
||||
return HttpHandler.Get(`/api/content/themes/activation/settings`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据主题ID列出主题设置
|
||||
* @param {Object} params 参数
|
||||
*/
|
||||
getThemeSettingsByThemeId: (themeId) => {
|
||||
return HttpHandler.Get(`/api/content/themes/${themeId}/settings`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 通过主题ID获取主题属性
|
||||
* @param {Object} params 参数
|
||||
*/
|
||||
getThemePropertyByThemeId: (themeId) => {
|
||||
return HttpHandler.Get(`/api/content/themes/${themeId}`)
|
||||
},
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -0,0 +1,291 @@
|
||||
/**
|
||||
* 所有的接口
|
||||
*/
|
||||
import {
|
||||
getPersonalToken
|
||||
} from '@/utils/token.js'
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
import qs from 'qs'
|
||||
|
||||
import {
|
||||
getAppConfigs
|
||||
} from '@/config/index.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 获取文章列表
|
||||
* @param {Object} params 参数
|
||||
*/
|
||||
getPostList: (params) => {
|
||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/posts`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据名称获取文章
|
||||
* @param {String} name 分类名称
|
||||
*/
|
||||
getPostByName: (name) => {
|
||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/posts/${name}`, {}, {
|
||||
header: {
|
||||
'Wechat-Session-Id': uni.getStorageSync('openid'),
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 搜索文章
|
||||
* @param {Object} params 数据
|
||||
*/
|
||||
getPostListByKeyword: (params) => {
|
||||
// return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/indices/post`, params)
|
||||
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/indices/-/search`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询分类列表
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getCategoryList: (params) => {
|
||||
const param = qs.stringify(params, {
|
||||
allowDots: true,
|
||||
encodeValuesOnly: true,
|
||||
skipNulls: true,
|
||||
encode: false,
|
||||
arrayFormat: 'repeat'
|
||||
})
|
||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/categories?${param}`, {})
|
||||
},
|
||||
/**
|
||||
* 查询分类下的文章
|
||||
* @param {String} name 分类名称
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getCategoryPostList: (name, params) => {
|
||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/categories/${name}/posts`, params)
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取评论列表接口(列表数据)
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getPostCommentList: (params) => {
|
||||
return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/comments`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取回复列表
|
||||
* @param {String} commentName 名称
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getPostCommentReplyList: (commentName, params) => {
|
||||
return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/comments/${commentName}/reply`, params)
|
||||
},
|
||||
|
||||
// 提交评论
|
||||
addPostComment: (data) => {
|
||||
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/comments`, data)
|
||||
},
|
||||
// 提交回复
|
||||
addPostCommentReply: (commentName, data) => {
|
||||
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/comments/${commentName}/reply`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取标签列表
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getTagList: (params) => {
|
||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/tags`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据标签获取文章列表
|
||||
* @param {String} tagName 参数
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getPostByTagName: (tagName, params) => {
|
||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/tags/${tagName}/posts`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取瞬间列表
|
||||
*/
|
||||
getMomentList: (params) => {
|
||||
return HttpHandler.Get(`/apis/moment.halo.run/v1alpha1/moments`, params, {
|
||||
custom: {
|
||||
personalToken: getPersonalToken()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取瞬间详情
|
||||
* @param {String} name 瞬间id
|
||||
*/
|
||||
getMomentByName: (name) => {
|
||||
return HttpHandler.Get(`/apis/moment.halo.run/v1alpha1/moments/${name}`, {}, {
|
||||
custom: {
|
||||
personalToken: getPersonalToken()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询站点统计信息
|
||||
*/
|
||||
getBlogStatistics: () => {
|
||||
return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/stats/-`, {})
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取相册分组
|
||||
*/
|
||||
getPhotoGroupList: (params) => {
|
||||
return HttpHandler.Get(`/apis/core.halo.run/v1alpha1/photogroups`, params, {
|
||||
custom: {
|
||||
personalToken: getPersonalToken()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 根据分组获取相册
|
||||
*/
|
||||
getPhotoListByGroupName: (params) => {
|
||||
return HttpHandler.Get(`/apis/console.api.photo.halo.run/v1alpha1/photos`, params, {
|
||||
custom: {
|
||||
personalToken: getPersonalToken()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取友链分组
|
||||
*/
|
||||
getFriendLinkGroupList: (params) => {
|
||||
return HttpHandler.Get(`/apis/core.halo.run/v1alpha1/linkgroups`, params, {
|
||||
custom: {
|
||||
personalToken: getPersonalToken()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取友链
|
||||
*/
|
||||
getFriendLinkList: (params) => {
|
||||
return HttpHandler.Get(`/apis/api.plugin.halo.run/v1alpha1/plugins/PluginLinks/links`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 限制阅读校验
|
||||
* @param restrictType
|
||||
* @param code
|
||||
* @param keyId
|
||||
* @returns {HttpPromise<any>}
|
||||
*/
|
||||
requestRestrictReadCheck: (restrictType, code, keyId) => {
|
||||
const params = {
|
||||
code: code,
|
||||
templateType: 'post',
|
||||
restrictType: restrictType,
|
||||
keyId: keyId
|
||||
}
|
||||
return HttpHandler.Post(`/apis/tools.muyin.site/v1alpha1/restrict-read/check`, params, {
|
||||
header: {
|
||||
'Authorization': getAppConfigs().pluginConfig.toolsPlugin?.Authorization,
|
||||
'Wechat-Session-Id': uni.getStorageSync('openid'),
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取文章验证码
|
||||
*/
|
||||
createVerificationCode: () => {
|
||||
return HttpHandler.Get(`/apis/tools.muyin.site/v1alpha1/restrict-read/create`, null, {
|
||||
header: {
|
||||
'Authorization': getAppConfigs().pluginConfig.toolsPlugin?.Authorization,
|
||||
'Wechat-Session-Id': uni.getStorageSync('openid'),
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 提交友情链接
|
||||
*/
|
||||
submitLink(form) {
|
||||
return HttpHandler.Post(`/apis/linksSubmit.muyin.site/v1alpha1/submit`, form, {
|
||||
header: {
|
||||
'Authorization': getAppConfigs().pluginConfig.linksSubmitPlugin?.Authorization,
|
||||
'Wechat-Session-Id': uni.getStorageSync('openid'),
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 获取二维码信息
|
||||
*/
|
||||
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, {})
|
||||
},
|
||||
/**
|
||||
* 点赞
|
||||
* @param {*} data ={group, plural, name}
|
||||
*/
|
||||
submitUpvote(data) {
|
||||
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/trackers/upvote`, data, {})
|
||||
},
|
||||
|
||||
//----------- 投票 -----------------
|
||||
/**
|
||||
* 获取投票列表
|
||||
*/
|
||||
getVoteList: (params) => {
|
||||
return HttpHandler.Get(`/apis/api.vote.kunkunyu.com/v1alpha1/votes`, params)
|
||||
},
|
||||
/**
|
||||
* 获取投票详情
|
||||
* @param {String} name id
|
||||
*/
|
||||
getVoteDetail: (name) => {
|
||||
return HttpHandler.Get(`/apis/api.vote.kunkunyu.com/v1alpha1/votes/${name}/detail`, {})
|
||||
},
|
||||
/**
|
||||
* 获取投票用户列表
|
||||
* @param {String} name id
|
||||
*/
|
||||
getVoteUserList: (name) => {
|
||||
return HttpHandler.Get(`/apis/api.vote.kunkunyu.com/v1alpha1/votes/${name}/user-list`, {})
|
||||
},
|
||||
/**
|
||||
* 提交投票
|
||||
* @param {String} name id
|
||||
* @param {Object} { voteData:["选项ID"] } 提交的数据
|
||||
* @param {Boolean} canAnonymously 是否匿名 默认匿名
|
||||
*/
|
||||
submitVote: (name, data, canAnonymously = true) => {
|
||||
return HttpHandler.Post(`/apis/api.vote.kunkunyu.com/v1alpha1/votes/${name}/submit`, data, {
|
||||
custom: {
|
||||
personalToken: canAnonymously ? undefined : getPersonalToken()
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 检查是否安装启用插件
|
||||
* @param {String} name 插件id
|
||||
*/
|
||||
checkPluginAvailable: (name) => {
|
||||
return HttpHandler.Get(`/apis/api.plugin.halo.run/v1alpha1/plugins/${name}/available`, {})
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 获取应用基本配置
|
||||
*/
|
||||
getAppConfigs: () => {
|
||||
return HttpHandler.Get(`/apis/api.uni.uhalo.pro/v1alpha1/plugins/plugin-uni-halo/getConfigs`, {})
|
||||
},
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* 功能:请求工具
|
||||
* 功能:请求工具
|
||||
* 作者:小莫唐尼
|
||||
* 邮箱:studio@925i.cn
|
||||
* 时间:2022年07月21日 18:58:03
|
||||
@@ -10,7 +10,7 @@
|
||||
* 修改时间:
|
||||
*/
|
||||
|
||||
import HaloConfig from '@/config/halo.config.js'
|
||||
import HaloTokenConfig from '@/config/uhalo.config.js'
|
||||
import {
|
||||
setInterceptors
|
||||
} from "./interceptors.js";
|
||||
@@ -21,16 +21,16 @@ const http = new Request()
|
||||
http.setConfig((config) => {
|
||||
|
||||
// 如果是在外部浏览器调试或者编译为h5,请注释该行代码
|
||||
config.baseURL = HaloConfig.apiUrl;
|
||||
config.baseURL = HaloTokenConfig.BASE_API;
|
||||
|
||||
config.header = {
|
||||
...config.header,
|
||||
'api-authorization': HaloConfig.apiAuthorization,
|
||||
ContentType: 'application/json',
|
||||
dataType: 'json'
|
||||
}
|
||||
return config
|
||||
})
|
||||
|
||||
setInterceptors(http)
|
||||
|
||||
export {
|
||||
|
||||
+120
-132
@@ -9,145 +9,133 @@
|
||||
* 修改人员:
|
||||
* 修改时间:
|
||||
*/
|
||||
import {
|
||||
getAdminAccessToken
|
||||
} from "@/utils/auth.js";
|
||||
import {
|
||||
delCache,
|
||||
setCache
|
||||
} from "@/utils/storage";
|
||||
import {delCache, setCache} from "@/utils/storage";
|
||||
|
||||
const getCategoryNameByUrl = (url) => {
|
||||
const reg = '(?<=/api/content/categories/).+(?=/posts)'
|
||||
return url.match(reg)[0] || '无分类名'
|
||||
const reg = '(?<=/api/content/categories/).+(?=/posts)'
|
||||
return url.match(reg)[0] || '无分类名'
|
||||
}
|
||||
const showCategoryInputPasswordModal = (response, category) => {
|
||||
uni.showModal({
|
||||
title: `[ ${category} ] 分类已加密`, // TODO 这里应该获取分类的名字,可以在弹窗之前请求后台拿到所有分类根据分类code拿到名称,但是不会在这之前发送请求
|
||||
content: '',
|
||||
editable: true,
|
||||
placeholderText: '请输入分类密码后访问',
|
||||
confirmText: '验证密码',
|
||||
cancelText: '暂不访问',
|
||||
showCancel: true,
|
||||
cancelColor: '#999999',
|
||||
confirmColor: '#03a9f4',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
// TODO 这里如果没有输入密码点击确认应该阻止窗口关闭,但是没找到方法
|
||||
if (!res.content) {
|
||||
uni.showToast({
|
||||
title: '提示:请输入密码',
|
||||
icon: 'none',
|
||||
success: () => {
|
||||
setTimeout(() => {
|
||||
showCategoryInputPasswordModal(response, category);
|
||||
}, 800)
|
||||
}
|
||||
})
|
||||
return;
|
||||
}
|
||||
// 根据请求URL正则匹配分类code,然后把输入的密码根据分类code放入缓存,然后在category.getCategoryPostList中获取,解决多个分类加密输入密码后点错的问题
|
||||
// 目前存在一个问题,比如前两个都需要密码,如果先输入第二个的密码之后,重新进来默认打开第一个还会弹窗,所以想在弹窗标题上增加分类名字
|
||||
// 另外有以下两种方式科技解决
|
||||
// TODO 1.其实这里获取到密码之后可以直接发送一个请求追加上password参数,因为后台会缓存权限,后续不输入密码也可以访问,可惜不会
|
||||
// TODO 2.另外也可以拿到密码之后,直接选中该分类追加password参数,重新请求,可惜也不会
|
||||
setCache('APP_CATEGORY_PWD_' + category, res.content)
|
||||
uni.reLaunch({
|
||||
url: '/pages/tabbar/category/category'
|
||||
});
|
||||
} else if (res.cancel) {}
|
||||
},
|
||||
})
|
||||
uni.showModal({
|
||||
title: `[ ${category} ] 分类已加密`, // TODO 这里应该获取分类的名字,可以在弹窗之前请求后台拿到所有分类根据分类code拿到名称,但是不会在这之前发送请求
|
||||
content: '',
|
||||
editable: true,
|
||||
placeholderText: '请输入分类密码后访问',
|
||||
confirmText: '验证密码',
|
||||
cancelText: '暂不访问',
|
||||
showCancel: true,
|
||||
cancelColor: '#999999',
|
||||
confirmColor: '#03a9f4',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
// TODO 这里如果没有输入密码点击确认应该阻止窗口关闭,但是没找到方法
|
||||
if (!res.content) {
|
||||
uni.showToast({
|
||||
title: '提示:请输入密码', icon: 'none', success: () => {
|
||||
setTimeout(() => {
|
||||
showCategoryInputPasswordModal(response, category);
|
||||
}, 800)
|
||||
}
|
||||
})
|
||||
return;
|
||||
}
|
||||
// 根据请求URL正则匹配分类code,然后把输入的密码根据分类code放入缓存,然后在category.getCategoryPostList中获取,解决多个分类加密输入密码后点错的问题
|
||||
// 目前存在一个问题,比如前两个都需要密码,如果先输入第二个的密码之后,重新进来默认打开第一个还会弹窗,所以想在弹窗标题上增加分类名字
|
||||
// 另外有以下两种方式科技解决
|
||||
// TODO 1.其实这里获取到密码之后可以直接发送一个请求追加上password参数,因为后台会缓存权限,后续不输入密码也可以访问,可惜不会
|
||||
// TODO 2.另外也可以拿到密码之后,直接选中该分类追加password参数,重新请求,可惜也不会
|
||||
setCache('APP_CATEGORY_PWD_' + category, res.content)
|
||||
uni.reLaunch({
|
||||
url: '/pages/tabbar/category/category'
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export const setInterceptors = (http) => {
|
||||
http.interceptors.request.use(
|
||||
(config) => {
|
||||
// 可使用async await 做异步操作
|
||||
config.header = {
|
||||
...config.header
|
||||
// ... 可以直接加参数
|
||||
};
|
||||
if (getAdminAccessToken()) {
|
||||
config.header['admin-authorization'] = getAdminAccessToken()
|
||||
}
|
||||
return config;
|
||||
},
|
||||
(config) => {
|
||||
// 可使用async await 做异步操作
|
||||
return Promise.reject(config);
|
||||
}
|
||||
);
|
||||
http.interceptors.request.use((config) => {
|
||||
console.log("config", config)
|
||||
|
||||
http.interceptors.response.use(
|
||||
(response) => {
|
||||
/* 对响应成功做点什么 可使用async await 做异步操作*/
|
||||
// if (response.data.code !== 200) { // 服务端返回的状态码不等于200,则reject()
|
||||
// return Promise.reject(response) // return Promise.reject 可使promise状态进入catch
|
||||
// if (response.config.custom.verification) { // 演示自定义参数的作用
|
||||
// return response.data
|
||||
// }
|
||||
// 可使用async await 做异步操作
|
||||
config.header = {
|
||||
...config.header
|
||||
// ... 可以直接加参数
|
||||
};
|
||||
if (config.custom.personalToken) {
|
||||
config.header['Authorization'] = `Bearer ${config.custom.personalToken}`
|
||||
}
|
||||
return config;
|
||||
}, (config) => {
|
||||
// 可使用async await 做异步操作
|
||||
return Promise.reject(config);
|
||||
});
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
return response.data;
|
||||
} else {
|
||||
return Promise.reject(response);
|
||||
}
|
||||
},
|
||||
(response) => {
|
||||
/* 对响应错误做点什么 (statusCode !== 200)*/
|
||||
if (!response.data) {
|
||||
return Promise.reject({
|
||||
status: 500,
|
||||
message: 'API接口服务异常!'
|
||||
})
|
||||
} else if (response.data.status == 401) {
|
||||
uni.$tm.toast(response.data.message);
|
||||
// 如果是请求分类之后报401说明密码错误,那么清除该密码,下次点击会报403弹窗再次输入密码
|
||||
if (response.config.url.indexOf('/api/content/categories') >= 0) {
|
||||
const category = getCategoryNameByUrl(response.config.url)
|
||||
delCache('APP_CATEGORY_PWD_' + category);
|
||||
uni.showToast({
|
||||
title: '提示:密码不正确',
|
||||
icon: 'none',
|
||||
success: () => {
|
||||
setTimeout(() => {
|
||||
showCategoryInputPasswordModal(response, category);
|
||||
}, 800)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 其他情况维持原来的逻辑
|
||||
delCache('APP_ADMIN_LOGIN_TOKEN');
|
||||
uni.$eShowModal({
|
||||
title: '提示',
|
||||
content: '您未登录超管账号或登录已过期,是否重新登录?',
|
||||
showCancel: true,
|
||||
cancelText: '否',
|
||||
cancelColor: '#999999',
|
||||
confirmText: '是',
|
||||
confirmColor: '#03a9f4'
|
||||
}).then(res => {
|
||||
uni.navigateTo({
|
||||
url: '/pagesB/login/login'
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/about/about'
|
||||
})
|
||||
})
|
||||
}
|
||||
} else if (response.data.status == 403) {
|
||||
// 如果报403是请求分类文章接口(您没有该分类的访问权限)的话说明是私密分类,需要输入密码请求
|
||||
if (response.config.url.indexOf('/api/content/categories') >= 0) {
|
||||
const category = getCategoryNameByUrl(response.config.url);
|
||||
showCategoryInputPasswordModal(response, category);
|
||||
}
|
||||
} else {
|
||||
return Promise.reject(response.data);
|
||||
}
|
||||
http.interceptors.response.use((response) => {
|
||||
/* 对响应成功做点什么 可使用async await 做异步操作*/
|
||||
// if (response.data.code !== 200) { // 服务端返回的状态码不等于200,则reject()
|
||||
// return Promise.reject(response) // return Promise.reject 可使promise状态进入catch
|
||||
// if (response.config.custom.verification) { // 演示自定义参数的作用
|
||||
// return response.data
|
||||
// }
|
||||
|
||||
}
|
||||
);
|
||||
};
|
||||
if (response.statusCode == 200) {
|
||||
return response.data;
|
||||
} else {
|
||||
return Promise.reject(response);
|
||||
}
|
||||
}, (response) => {
|
||||
/* 对响应错误做点什么 (statusCode !== 200)*/
|
||||
if (!response.data) {
|
||||
return Promise.reject({
|
||||
status: 500, message: 'API接口服务异常!'
|
||||
})
|
||||
} else if (response.data.status == 401) {
|
||||
uni.$tm.toast(response.data.message);
|
||||
// 如果是请求分类之后报401说明密码错误,那么清除该密码,下次点击会报403弹窗再次输入密码
|
||||
if (response.config.url.indexOf('/api/content/categories') >= 0) {
|
||||
const category = getCategoryNameByUrl(response.config.url)
|
||||
delCache('APP_CATEGORY_PWD_' + category);
|
||||
uni.showToast({
|
||||
title: '提示:密码不正确', icon: 'none', success: () => {
|
||||
setTimeout(() => {
|
||||
showCategoryInputPasswordModal(response, category);
|
||||
}, 800)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 其他情况维持原来的逻辑
|
||||
delCache('APP_ADMIN_LOGIN_TOKEN');
|
||||
uni.$eShowModal({
|
||||
title: '提示',
|
||||
content: '您未登录超管账号或登录已过期,是否重新登录?',
|
||||
showCancel: true,
|
||||
cancelText: '否',
|
||||
cancelColor: '#999999',
|
||||
confirmText: '是',
|
||||
confirmColor: '#03a9f4'
|
||||
}).then(res => {
|
||||
uni.navigateTo({
|
||||
url: '/pagesB/login/login'
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/about/about'
|
||||
})
|
||||
})
|
||||
}
|
||||
return Promise.reject(response.data);
|
||||
} else if (response.data.status == 403) {
|
||||
// 如果报403是请求分类文章接口(您没有该分类的访问权限)的话说明是私密分类,需要输入密码请求
|
||||
if (response.config.url.indexOf('/api/content/categories') >= 0) {
|
||||
const category = getCategoryNameByUrl(response.config.url);
|
||||
showCategoryInputPasswordModal(response, category);
|
||||
}
|
||||
return Promise.reject(response.data);
|
||||
} else {
|
||||
return Promise.reject(response.data);
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/**
|
||||
* 封装各种请求方式
|
||||
*/
|
||||
|
||||
|
||||
import {
|
||||
http
|
||||
} from '@/common/http/index.js'
|
||||
@@ -11,7 +9,7 @@ export default {
|
||||
Get: (url, params, config = {}) => {
|
||||
return http.get(url, {
|
||||
params,
|
||||
...config
|
||||
...config
|
||||
})
|
||||
},
|
||||
Post: (url, data, config = {}) => {
|
||||
@@ -26,4 +24,4 @@ export default {
|
||||
Delete: (url, data, config = {}) => {
|
||||
return http.delete(url, data, config)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,14 @@
|
||||
* markdown配置
|
||||
*/
|
||||
|
||||
import HaloConfig from '@/config/halo.config.js'
|
||||
import {getAppConfigs} from '@/config/index.js'
|
||||
import HaloTokenConfig from '@/config/uhalo.config.js'
|
||||
import utils from '@/utils/index.js'
|
||||
|
||||
export default {
|
||||
domain: HaloConfig.apiUrl,
|
||||
tagStyle: {
|
||||
table: `
|
||||
domain: HaloTokenConfig.BASE_API,
|
||||
tagStyle: {
|
||||
table: `
|
||||
table-layout: fixed;
|
||||
border-collapse:collapse;
|
||||
margin-bottom: 18px;
|
||||
@@ -17,17 +20,17 @@ export default {
|
||||
border: 1px solid #dcdcdc;
|
||||
border-radius: 4px;
|
||||
`,
|
||||
th: `
|
||||
th: `
|
||||
padding: 8px;
|
||||
border-right: 1px solid var(--classE);
|
||||
border-bottom: 1px solid var(--classE);
|
||||
`,
|
||||
td: `
|
||||
td: `
|
||||
padding: 8px;
|
||||
border-right: 1px solid var(--classE);
|
||||
border-bottom: 1px solid var(--classE);
|
||||
`,
|
||||
blockquote: `
|
||||
blockquote: `
|
||||
padding: 8px 15px;
|
||||
color: #606266;
|
||||
background: #f2f6fc;
|
||||
@@ -36,62 +39,62 @@ export default {
|
||||
line-height: 26px;
|
||||
margin-bottom: 18px;
|
||||
`,
|
||||
ul: 'padding-left: 15px;line-height: 1.85;',
|
||||
ol: 'padding-left: 15px;line-height: 1.85;',
|
||||
li: 'margin-bottom: 12px;line-height: 1.85;',
|
||||
h1: `
|
||||
ul: 'padding-left: 15px;line-height: 1.85;',
|
||||
ol: 'padding-left: 15px;line-height: 1.85;',
|
||||
li: 'margin-bottom: 12px;line-height: 1.85;',
|
||||
h1: `
|
||||
margin: 30px 0 20px;
|
||||
color: var(--main);
|
||||
line-height: 24px;
|
||||
position: relative;
|
||||
font-size:1.2em;
|
||||
`,
|
||||
h2: `
|
||||
h2: `
|
||||
color: var(--main);
|
||||
line-height: 24px;
|
||||
position: relative;
|
||||
margin: 22px 0 16px;
|
||||
font-size: 1.16em;
|
||||
`,
|
||||
h3: `
|
||||
h3: `
|
||||
color: var(--main);
|
||||
line-height: 24px;
|
||||
position: relative;
|
||||
margin: 26px 0 18px;
|
||||
font-size: 1.14em;
|
||||
`,
|
||||
h4: `
|
||||
h4: `
|
||||
color: var(--main);
|
||||
line-height: 24px;
|
||||
margin-bottom: 18px;
|
||||
position: relative;
|
||||
font-size: 1.12em;
|
||||
`,
|
||||
h5: `
|
||||
h5: `
|
||||
color: var(--main);
|
||||
line-height: 24px;
|
||||
margin-bottom: 14px;
|
||||
position: relative;
|
||||
font-size: 1.1em;
|
||||
`,
|
||||
h6: `
|
||||
h6: `
|
||||
color: #303133;
|
||||
line-height: 24px;
|
||||
margin-bottom: 14px;
|
||||
position: relative;
|
||||
font-size: 14px;
|
||||
`,
|
||||
p: `
|
||||
p: `
|
||||
line-height: 1.65;
|
||||
margin-bottom: 14px;
|
||||
font-size: 14px;
|
||||
`,
|
||||
'code': ` `,
|
||||
strong: 'font-weight: 700;color: rgb(248, 57, 41);',
|
||||
video: 'width: 100%',
|
||||
},
|
||||
containStyle: 'font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;padding:12px;font-size: 14px;color: #606266;word-spacing: 0.8px;letter-spacing: 0.8px;border-radius: 6px;background-color:#FFFFFF;',
|
||||
'code': ` `,
|
||||
strong: 'font-weight: 700;color: rgb(248, 57, 41);',
|
||||
video: 'width: 100%',
|
||||
},
|
||||
containStyle: 'font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;padding:12px;font-size: 14px;color: #606266;word-spacing: 0.8px;letter-spacing: 0.8px;border-radius: 6px;background-color:#FFFFFF;',
|
||||
|
||||
loadingGif: HaloConfig.loadingGifUrl,
|
||||
emptyGif: HaloConfig.loadingEmptyUrl,
|
||||
loadingGif: utils.checkImageUrl(getAppConfigs().imagesConfig.loadingGifUrl),
|
||||
emptyGif: utils.checkImageUrl(getAppConfigs().imagesConfig.loadingEmptyUrl),
|
||||
}
|
||||
|
||||
+73
-77
@@ -9,81 +9,77 @@
|
||||
* 修改人员:
|
||||
* 修改时间:
|
||||
*/
|
||||
import HaloConfig from '@/config/halo.config.js';
|
||||
import HaloAdConfig from '@/config/ad.config.js';
|
||||
export default {
|
||||
install(Vue) {
|
||||
Vue.mixin({
|
||||
data() {
|
||||
return {
|
||||
author: HaloConfig.author,
|
||||
_isWechat: true,
|
||||
haloAdConfig: HaloAdConfig,
|
||||
_aniWaitIndex: 0, // 动画索引
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 获取全局应用设置
|
||||
globalAppSettings() {
|
||||
return uni.$tm.vx.getters().getSettings;
|
||||
},
|
||||
// 计算动画索引
|
||||
calcAniWait() {
|
||||
return (index) => {
|
||||
if ((index + 1) % 10 == 0) {
|
||||
this._aniWaitIndex = 1;
|
||||
} else {
|
||||
this._aniWaitIndex += 1;
|
||||
}
|
||||
console.log('this._aniWaitIndex', this._aniWaitIndex);
|
||||
return this._aniWaitIndex * 50
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.fnResetSetAniWaitIndex()
|
||||
},
|
||||
created() {
|
||||
// #ifdef MP-WEIXIN
|
||||
this._isWechat = true;
|
||||
uni.$tm.vx.commit('setWxShare', HaloConfig.wxShareConfig);
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
this._isWechat = false;
|
||||
// #endif
|
||||
},
|
||||
onShow() {
|
||||
this.fnResetSetAniWaitIndex()
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 设置页面标题
|
||||
* @param {Object} title 标题
|
||||
*/
|
||||
fnSetPageTitle(title) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: title || HaloConfig.title
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面返回顶部
|
||||
*/
|
||||
fnToTopPage(duration = 500) {
|
||||
duration = isNaN(duration) ? 500 : duration
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: duration,
|
||||
fail: (err) => {
|
||||
console.log('err:', err);
|
||||
},
|
||||
});
|
||||
},
|
||||
// 初始化动画索引值(需要在每个页面调用)
|
||||
fnResetSetAniWaitIndex() {
|
||||
this._aniWaitIndex = 0
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
export default {
|
||||
install(Vue) {
|
||||
Vue.mixin({
|
||||
data() {
|
||||
return {
|
||||
_isWechat: true,
|
||||
_aniWaitIndex: 0
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
haloConfig() {
|
||||
return this.$tm.vx.getters().getConfigs;
|
||||
},
|
||||
haloPluginsConfig() {
|
||||
return this.$tm.vx.getters().getConfigs?.pluginConfig;
|
||||
},
|
||||
// 获取全局应用设置
|
||||
globalAppSettings() {
|
||||
return uni.$tm.vx.getters().getSettings;
|
||||
},
|
||||
// 计算动画索引
|
||||
calcAniWait() {
|
||||
return (index) => {
|
||||
if ((index + 1) % 10 === 0) {
|
||||
this._aniWaitIndex = 1;
|
||||
} else {
|
||||
this._aniWaitIndex += 1;
|
||||
}
|
||||
return this._aniWaitIndex * 50
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.fnResetSetAniWaitIndex()
|
||||
},
|
||||
created() {
|
||||
// #ifdef MP-WEIXIN
|
||||
this._isWechat = true;
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
this._isWechat = false;
|
||||
// #endif
|
||||
},
|
||||
onShow() {
|
||||
this.fnResetSetAniWaitIndex()
|
||||
},
|
||||
methods: {
|
||||
// 设置页面标题
|
||||
fnSetPageTitle(title) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: title || this.haloConfig?.appConfig?.startConfig?.title || "uni-halo",
|
||||
})
|
||||
},
|
||||
|
||||
// 页面返回顶部
|
||||
fnToTopPage(duration = 500) {
|
||||
duration = isNaN(duration) ? 500 : duration
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: duration,
|
||||
fail: (err) => {
|
||||
console.log('err:', err);
|
||||
},
|
||||
});
|
||||
},
|
||||
// 初始化动画索引值(需要在每个页面调用)
|
||||
fnResetSetAniWaitIndex() {
|
||||
this._aniWaitIndex = 0
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* 功能:插件检查
|
||||
*/
|
||||
import {
|
||||
NeedPluginIds,
|
||||
NeedPlugins,
|
||||
checkNeedPluginAvailable
|
||||
} from "@/utils/plugin.js"
|
||||
|
||||
const HaloPluginAvailableMixin = {
|
||||
data() {
|
||||
return {
|
||||
NeedPluginIds,
|
||||
NeedPlugins,
|
||||
uniHaloPluginAvailableError: "",
|
||||
uniHaloPluginAvailable: true,
|
||||
uniHaloPluginPageClass: "",
|
||||
uniHaloPluginId: "", // 当前需要的插件
|
||||
uniHaloPluginInfo: "" // 当前插件信息
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
uniHaloPluginAvailable: {
|
||||
immediate: true,
|
||||
handler(val) {
|
||||
if (val) {
|
||||
this.uniHaloPluginPageClass = ""
|
||||
} else {
|
||||
this.uniHaloPluginPageClass = "box-border items-center justify-center"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** 设置插件ID */
|
||||
setPluginId(pluginId) {
|
||||
this.uniHaloPluginId = pluginId
|
||||
this.uniHaloPluginInfo = NeedPlugins.get(pluginId)
|
||||
},
|
||||
/** 检查插件状态 */
|
||||
async checkPluginAvailable(pluginId) {
|
||||
pluginId = pluginId ?? this.uniHaloPluginId
|
||||
if (!pluginId) return false;
|
||||
const available = await checkNeedPluginAvailable(pluginId)
|
||||
this.uniHaloPluginAvailable = available
|
||||
return available
|
||||
},
|
||||
/** 设置错误信息 */
|
||||
setPluginError(text) {
|
||||
this.uniHaloPluginAvailableError = text
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
export default HaloPluginAvailableMixin;
|
||||
@@ -1,66 +0,0 @@
|
||||
// 微信分享配置
|
||||
import haloConfig from '@/config/halo.config.js'
|
||||
import { jsonToUrlParams2 } from '@/utils/url.params.js'
|
||||
export const haloWxShareMixin = {
|
||||
data() {
|
||||
return {
|
||||
haloWxShareData: {
|
||||
...haloConfig.wxShareConfig
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
//#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: haloConfig.apiUrl,
|
||||
query: {}
|
||||
}, config)
|
||||
|
||||
uni.$tm.vx.commit('setWxShare', _config);
|
||||
this.haloWxShareData = _config;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -172,3 +172,178 @@
|
||||
}
|
||||
|
||||
/* 文本省略样式 结束 */
|
||||
|
||||
.box-border{
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
// 定义尺寸变量(单位:rpx)
|
||||
$spacing-sizes: (
|
||||
0: 0,
|
||||
2: 4rpx,
|
||||
4: 8rpx,
|
||||
8: 16rpx,
|
||||
12: 24rpx,
|
||||
24: 48rpx,
|
||||
48: 96rpx
|
||||
);
|
||||
|
||||
// 内边距类
|
||||
@each $name, $size in $spacing-sizes {
|
||||
// 全方向内边距:p-{size}
|
||||
.uh-p-#{$name} {
|
||||
padding: $size !important;
|
||||
}
|
||||
|
||||
// 水平方向内边距:px-{size}
|
||||
.uh-px-#{$name} {
|
||||
padding-left: $size !important;
|
||||
padding-right: $size !important;
|
||||
}
|
||||
|
||||
// 垂直方向内边距:py-{size}
|
||||
.uh-py-#{$name} {
|
||||
padding-top: $size !important;
|
||||
padding-bottom: $size !important;
|
||||
}
|
||||
|
||||
// 上内边距:pt-{size}
|
||||
.uh-pt-#{$name} {
|
||||
padding-top: $size !important;
|
||||
}
|
||||
|
||||
// 右内边距:pr-{size}
|
||||
.uh-pr-#{$name} {
|
||||
padding-right: $size !important;
|
||||
}
|
||||
|
||||
// 下内边距:pb-{size}
|
||||
.uh-pb-#{$name} {
|
||||
padding-bottom: $size !important;
|
||||
}
|
||||
|
||||
// 左内边距:pl-{size}
|
||||
.uh-pl-#{$name} {
|
||||
padding-left: $size !important;
|
||||
}
|
||||
}
|
||||
|
||||
//外边距工具类
|
||||
@each $name, $size in $spacing-sizes {
|
||||
// 全方向外边距:m-{size}
|
||||
.uh-m-#{$name} {
|
||||
margin: $size !important;
|
||||
}
|
||||
|
||||
// 水平方向外边距:mx-{size}
|
||||
.uh-mx-#{$name} {
|
||||
margin-left: $size !important;
|
||||
margin-right: $size !important;
|
||||
}
|
||||
|
||||
// 垂直方向外边距:my-{size}
|
||||
.uh-my-#{$name} {
|
||||
margin-top: $size !important;
|
||||
margin-bottom: $size !important;
|
||||
}
|
||||
|
||||
// 上外边距:mt-{size}
|
||||
.uh-mt-#{$name} {
|
||||
margin-top: $size !important;
|
||||
}
|
||||
|
||||
// 右外边距:mr-{size}
|
||||
.uh-mr-#{$name} {
|
||||
margin-right: $size !important;
|
||||
}
|
||||
|
||||
// 下外边距:mb-{size}
|
||||
.uh-mb-#{$name} {
|
||||
margin-bottom: $size !important;
|
||||
}
|
||||
|
||||
// 左外边距:ml-{size}
|
||||
.uh-ml-#{$name} {
|
||||
margin-left: $size !important;
|
||||
}
|
||||
}
|
||||
|
||||
// gap 类
|
||||
@each $name, $size in $spacing-sizes {
|
||||
// 全方向gap:gap-{size}
|
||||
.uh-gap-#{$name} {
|
||||
gap: $size !important;
|
||||
}
|
||||
|
||||
// 水平方向gap:gap-x-{size}
|
||||
.uh-gap-x-#{$name} {
|
||||
column-gap: $size !important;
|
||||
}
|
||||
|
||||
// 垂直方向gap:gap-y-{size}
|
||||
.uh-gap-y-#{$name} {
|
||||
row-gap: $size !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.w-full {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.h-full {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.flex {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.flex-col {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.flex-1 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.flex-shrink-0 {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.items-center {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.items-start {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.items-end {
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.justify-between {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.justify-around {
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.justify-end {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.justify-start {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.justify-center {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.text-break {
|
||||
overflow-wrap: break-word;
|
||||
word-break: break-all;
|
||||
}
|
||||
@@ -1,24 +1,23 @@
|
||||
<template>
|
||||
<view class="article-card " :class="cardType" @click="fnClickEvent('card')">
|
||||
<view class="left">
|
||||
<cache-image class="thumbnail" radius="6rpx" :url="$utils.checkThumbnailUrl(article.thumbnail)" :fileMd5="$utils.checkThumbnailUrl(article.thumbnail)" mode="aspectFill"></cache-image>
|
||||
<!-- <image class="thumbnail" lazy-load :src="$utils.checkThumbnailUrl(article.thumbnail)" mode="aspectFill"></image> -->
|
||||
<cache-image class="thumbnail" radius="6rpx" :url="$utils.checkThumbnailUrl(article.spec.cover)" :fileMd5="article.spec.cover" mode="aspectFill"></cache-image>
|
||||
<!-- <image class="thumbnail" lazy-load :src="$utils.checkThumbnailUrl(article.spec.cover)" mode="aspectFill"></image> -->
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="title">
|
||||
<text class="is-top bg-gradient-blue-accent" v-if="article.topped">置顶</text>
|
||||
<text class="title-text text-overflow">{{ article.title }}</text>
|
||||
<text class="is-top bg-gradient-blue-accent" v-if="article.spec.pinned">置顶</text>
|
||||
<text class="title-text text-overflow">{{ article.spec.title }}</text>
|
||||
</view>
|
||||
<view class="content text-overflow-2">{{ article.summary }}</view>
|
||||
<view class="content text-overflow-2">{{ article.status.excerpt }}</view>
|
||||
<view class="foot">
|
||||
<view class="create-time">
|
||||
<text class="time-label">发布时间:</text>
|
||||
{{ { d: article.createTime, f: 'yyyy-MM-dd' } | formatTime }}
|
||||
{{ { d: article.spec.publishTime, f: 'yyyy-MM-dd' } | formatTime }}
|
||||
</view>
|
||||
<view class="visits">
|
||||
<!-- <tm-icons :size="24" name="icon-filter-fill"></tm-icons> -->
|
||||
浏览
|
||||
<text class="number">{{ article.visits }}</text>
|
||||
<text class="number">{{ article.stats.visit }}</text>
|
||||
次
|
||||
</view>
|
||||
</view>
|
||||
@@ -67,7 +66,7 @@
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
margin: 0 24rpx;
|
||||
padding: 24rpx;
|
||||
padding:22rpx 24rpx;
|
||||
border-radius: 12rpx;
|
||||
background-color: #ffff;
|
||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
|
||||
@@ -1,220 +1,222 @@
|
||||
<template>
|
||||
<view class="article-min-card" :class="[globalAppSettings.layout.cardType]" @click="fnClickEvent('card')">
|
||||
<view class="left">
|
||||
<cache-image class="thumbnail" radius="6rpx" :url="$utils.checkThumbnailUrl(article.thumbnail)" :fileMd5="$utils.checkThumbnailUrl(article.thumbnail)" mode="aspectFill"></cache-image>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="title text-overflow">{{ article.title }}</view>
|
||||
<view class="content text-overflow">{{ article.summary }}</view>
|
||||
<view class="foot">
|
||||
<view class="create-time">
|
||||
<!-- <text class="icon iconfont icon-clock"></text> -->
|
||||
<text class="time-label">发布时间:</text>
|
||||
{{ { d: article.createTime, f: 'yyyy-MM-dd' } | formatTime }}
|
||||
</view>
|
||||
<view class="visits">
|
||||
<!-- <text class="icon iconfont icon-eye"></text> -->
|
||||
浏览
|
||||
<text class="number">{{ article.visits }}</text>
|
||||
次
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="article-min-card" @click="fnClickEvent('card')">
|
||||
<view class="left">
|
||||
<cache-image class="thumbnail" radius="6rpx" :url="$utils.checkThumbnailUrl(article.spec.cover)" :fileMd5="article.spec.cover"
|
||||
mode="aspectFill"></cache-image>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="title text-overflow">{{ article.spec.title }}</view>
|
||||
<view class="content text-overflow">{{ article.status.excerpt }}</view>
|
||||
<view class="foot">
|
||||
<view class="create-time">
|
||||
<text class="time-label">发布时间:</text>
|
||||
{{ {d: article.spec.publishTime, f: 'yyyy-MM-dd'} | formatTime }}
|
||||
</view>
|
||||
<view class="visits">
|
||||
浏览
|
||||
<text class="number">{{ article.stats.visit }}</text>
|
||||
次
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'article-min-card',
|
||||
props: {
|
||||
article: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fnClickEvent() {
|
||||
this.$emit('on-click', this.article);
|
||||
}
|
||||
}
|
||||
};
|
||||
export default {
|
||||
name: 'article-min-card',
|
||||
props: {
|
||||
article: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fnClickEvent() {
|
||||
this.$emit('on-click', this.article);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.article-min-card {
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
border-radius: 12rpx;
|
||||
background-color: #ffff;
|
||||
overflow: hidden;
|
||||
margin: 12rpx 24rpx;
|
||||
margin-bottom: 24rpx;
|
||||
padding: 16rpx;
|
||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
.article-min-card {
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
border-radius: 12rpx;
|
||||
background-color: #ffff;
|
||||
overflow: hidden;
|
||||
margin: 12rpx 24rpx;
|
||||
margin-bottom: 24rpx;
|
||||
padding: 16rpx;
|
||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
|
||||
&.lr_image_text {}
|
||||
&.lr_image_text {
|
||||
}
|
||||
|
||||
&.lr_text_image {
|
||||
.left {
|
||||
order: 2;
|
||||
padding-left: 30rpx;
|
||||
}
|
||||
&.lr_text_image {
|
||||
.left {
|
||||
order: 2;
|
||||
padding-left: 30rpx;
|
||||
}
|
||||
|
||||
.right {
|
||||
order: 1;
|
||||
padding-left: 0;
|
||||
}
|
||||
}
|
||||
.right {
|
||||
order: 1;
|
||||
padding-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&.tb_image_text {
|
||||
flex-direction: column;
|
||||
&.tb_image_text {
|
||||
flex-direction: column;
|
||||
|
||||
.left {
|
||||
width: 100%;
|
||||
height: 220rpx;
|
||||
}
|
||||
.left {
|
||||
width: 100%;
|
||||
height: 220rpx;
|
||||
}
|
||||
|
||||
.right {
|
||||
padding-left: 0;
|
||||
width: 100%;
|
||||
.right {
|
||||
padding-left: 0;
|
||||
width: 100%;
|
||||
|
||||
.title {
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
.title {
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.foot {
|
||||
justify-content: flex-start;
|
||||
.foot {
|
||||
justify-content: flex-start;
|
||||
|
||||
.create-time {
|
||||
.time-label {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
.create-time {
|
||||
.time-label {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
.visits {
|
||||
margin-left: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.visits {
|
||||
margin-left: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.tb_text_image {
|
||||
flex-direction: column;
|
||||
&.tb_text_image {
|
||||
flex-direction: column;
|
||||
|
||||
.left {
|
||||
width: 100%;
|
||||
height: 220rpx;
|
||||
order: 2;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
.left {
|
||||
width: 100%;
|
||||
height: 220rpx;
|
||||
order: 2;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.right {
|
||||
padding-left: 0;
|
||||
width: 100%;
|
||||
order: 1;
|
||||
.right {
|
||||
padding-left: 0;
|
||||
width: 100%;
|
||||
order: 1;
|
||||
|
||||
.foot {
|
||||
justify-content: flex-start;
|
||||
.foot {
|
||||
justify-content: flex-start;
|
||||
|
||||
.create-time {
|
||||
.time-label {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
.create-time {
|
||||
.time-label {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
.visits {
|
||||
margin-left: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.visits {
|
||||
margin-left: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.only_text {
|
||||
.left {
|
||||
display: none;
|
||||
}
|
||||
&.only_text {
|
||||
.left {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.right {
|
||||
padding-left: 0;
|
||||
.right {
|
||||
padding-left: 0;
|
||||
|
||||
.foot {
|
||||
justify-content: flex-start;
|
||||
.foot {
|
||||
justify-content: flex-start;
|
||||
|
||||
.create-time {
|
||||
.time-label {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
.create-time {
|
||||
.time-label {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
.visits {
|
||||
margin-left: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.visits {
|
||||
margin-left: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.left {
|
||||
width: 180rpx;
|
||||
height: 130rpx;
|
||||
.left {
|
||||
width: 180rpx;
|
||||
height: 130rpx;
|
||||
|
||||
.thumbnail {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
}
|
||||
.thumbnail {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
width: 0;
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-left: 20rpx;
|
||||
.right {
|
||||
width: 0;
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-left: 20rpx;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: var(--main-text-color);
|
||||
}
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: var(--main-text-color);
|
||||
}
|
||||
|
||||
.content {
|
||||
font-size: 26rpx;
|
||||
color: #909399;
|
||||
margin-top: 14rpx;
|
||||
}
|
||||
.content {
|
||||
font-size: 26rpx;
|
||||
color: #909399;
|
||||
margin-top: 14rpx;
|
||||
}
|
||||
|
||||
.foot {
|
||||
display: flex;
|
||||
font-size: 24rpx;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
color: #909399;
|
||||
margin-top: 14rpx;
|
||||
.foot {
|
||||
display: flex;
|
||||
font-size: 24rpx;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
color: #909399;
|
||||
margin-top: 14rpx;
|
||||
|
||||
.create-time {
|
||||
font-size: 24rpx;
|
||||
.create-time {
|
||||
font-size: 24rpx;
|
||||
|
||||
.time-label {
|
||||
display: none;
|
||||
}
|
||||
.time-label {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.icon {
|
||||
font-size: 24rpx;
|
||||
padding-right: 4rpx;
|
||||
}
|
||||
}
|
||||
.icon {
|
||||
font-size: 24rpx;
|
||||
padding-right: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.visits {
|
||||
.icon {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.visits {
|
||||
.icon {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.number {
|
||||
padding: 0 6rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.number {
|
||||
padding: 0 6rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,605 @@
|
||||
<template>
|
||||
<view class="vote-card" :class="[loading]">
|
||||
<view v-if="loading !=='success'" class="vote-error" @click="fnGetData()">
|
||||
{{loadingText}}
|
||||
</view>
|
||||
<template v-else>
|
||||
<view class="vote-card-head flex flex-col">
|
||||
<view class="flex justify-between">
|
||||
<view class="flex">
|
||||
<tm-tags color="orange" style="min-width:40rpx;" :shadow="0" rounded size="s"
|
||||
model="fill">{{ index+1 }}</tm-tags>
|
||||
|
||||
<tm-tags v-if="vote.spec.type==='single'" color="light-blue" :shadow="0" rounded size="s"
|
||||
model="fill">单选</tm-tags>
|
||||
<tm-tags v-else-if="vote.spec.type==='multiple'" color="light-blue" :shadow="0" rounded size="s"
|
||||
model="fill">多选</tm-tags>
|
||||
<tm-tags v-else-if="vote.spec.type==='pk'" color="light-blue" :shadow="0" rounded size="s"
|
||||
model="fill">双选PK</tm-tags>
|
||||
|
||||
<tm-tags v-if="vote.spec._state=='已结束'" color="red" size="s" rounded :shadow="0"
|
||||
model="fill">已结束</tm-tags>
|
||||
<tm-tags v-else-if="vote.spec._state=='未开始'" color="orange" size="s" rounded :shadow="0"
|
||||
model="fill">未开始</tm-tags>
|
||||
<tm-tags v-else-if="vote.spec._state=='进行中'" color="green" size="s" rounded :shadow="0"
|
||||
model="fill">进行中</tm-tags>
|
||||
|
||||
</view>
|
||||
<view class="flex-shrink">
|
||||
<tm-button theme="light-blue" :shadow="0" dense size="s"
|
||||
@click="handleToVoteDetail(vote)">查看投票详情</tm-button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="title">
|
||||
{{ vote.spec.title }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="vote-card-body">
|
||||
|
||||
<view v-if="vote.spec.remark" class="remark text-size-s">
|
||||
{{vote.spec.remark}}
|
||||
</view>
|
||||
|
||||
<template>
|
||||
<!-- 单选 -->
|
||||
<view v-if="vote.spec.type==='single'" class="single">
|
||||
<view class="w-full flex flex-col uh-gap-8">
|
||||
<template v-if="vote.spec.isVoted">
|
||||
<view v-for="(option,optionIndex) in vote.spec.options" :key="optionIndex"
|
||||
class="is-voted-item" :class="[option.checked?'selected':'']" :style="{
|
||||
'--percent': option.percent + '%'
|
||||
}">
|
||||
<view class="is-voted-item-content flex w-full flex-between uh-gap-4">
|
||||
<view class="text-align-left flex-1 text-break">
|
||||
{{option.title }}
|
||||
</view>
|
||||
<view class="flex-shrink ">
|
||||
{{option.percent }}%
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view v-for="(option,optionIndex) in vote.spec.options" :key="optionIndex"
|
||||
class="vote-select-option flex-1 w-full text-break"
|
||||
:class="[option.checked?'light-blue':'grey-lighten-3']"
|
||||
@click="handleSelectSingleOption(option)">
|
||||
{{option.title }}
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 多选 -->
|
||||
<view v-else-if="vote.spec.type==='multiple'" class="multiple">
|
||||
<view class="w-full flex flex-col uh-gap-8">
|
||||
<template v-if="vote.spec.isVoted">
|
||||
<view v-for="(option,optionIndex) in vote.spec.options" :key="optionIndex"
|
||||
class="is-voted-item" :class="[option.checked?'selected':'']" :style="{
|
||||
'--percent': option.percent + '%'
|
||||
}">
|
||||
<view class="is-voted-item-content flex w-full flex-between uh-gap-4">
|
||||
<view class="text-align-left flex-1 text-break">
|
||||
{{option.title }}
|
||||
</view>
|
||||
<view class="flex-shrink ">
|
||||
{{option.percent }}%
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view v-for="(option,optionIndex) in vote.spec.options" :key="optionIndex"
|
||||
class="vote-select-option flex-1 w-full text-break"
|
||||
:class="[option.checked?'light-blue':'grey-lighten-3']"
|
||||
@click="handleSelectCheckboxOption(option)">
|
||||
{{option.title }}
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- PK -->
|
||||
<view v-else-if="vote.spec.type==='pk'" class="pk">
|
||||
<view class="pk-container">
|
||||
<view class="radio-item" v-for="(option,optionIndex) in vote.spec.options"
|
||||
:key="optionIndex" :class="[optionIndex==0?'radio-left':'radio-right']"
|
||||
:style="{width:option.percent + '%'}">
|
||||
<view class="option-item"
|
||||
:class="[optionIndex==0?'option-item-left':'option-item-right']">
|
||||
{{option.percent }}%
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="option-foot w-full flex flex-between uh-mt-12">
|
||||
<view class="w-full flex flex-col uh-gap-8">
|
||||
<template v-if="vote.spec.isVoted">
|
||||
<view v-for="(option,optionIndex) in vote.spec.options" :key="optionIndex"
|
||||
class="is-voted-item" :class="[option.checked?'selected':'']" :style="{
|
||||
'--percent': option.percent + '%'
|
||||
}">
|
||||
<view class="is-voted-item-content flex w-full flex-between uh-gap-4">
|
||||
<view class="text-align-left flex-1 text-break">
|
||||
{{option.title }}
|
||||
</view>
|
||||
<view class="flex-shrink ">
|
||||
{{option.percent }}%
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view v-for="(option,optionIndex) in vote.spec.options" :key="optionIndex"
|
||||
class="vote-select-option flex-1 w-full text-break"
|
||||
:class="[option.checked?'light-blue':'grey-lighten-3']"
|
||||
@click="handleSelectSingleOption(option)">
|
||||
选项{{ optionIndex+1}}:{{option.title }}
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
<view class="vote-card-foot flex flex-between">
|
||||
<view class="left flex">
|
||||
<tm-tags v-if="vote.spec.timeLimit==='permanent'" color="grey-darken-2" rounded size="s"
|
||||
model="text">结束:永久有效 </tm-tags>
|
||||
<tm-tags v-else color="grey-darken-2" rounded size="s" model="text">
|
||||
<template
|
||||
v-if="vote.spec._state=='未开始'">开始:{{ {d: vote.spec.startDate, f: 'yyyy-MM-dd HH:mm'} | formatTime }}
|
||||
</template>
|
||||
<template v-else>结束:{{ {d: vote.spec.endDate, f: 'yyyy-MM-dd HH:mm'} | formatTime }}
|
||||
</template>
|
||||
</tm-tags>
|
||||
</view>
|
||||
|
||||
<view class="right flex flex-end">
|
||||
<tm-tags color="grey-darken-2" rounded size="s" model="text">{{ vote.stats.voteCount }}
|
||||
人已参与</tm-tags>
|
||||
<tm-tags v-if="vote.spec.isVoted" color="blue" rounded size="s" model="text">已投票</tm-tags>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="submitForm.voteData.length!==0" class="box-border uh-mt-12 w-full uh-px-2">
|
||||
<tm-button v-if="!vote.spec.canAnonymously" theme="red" :shadow="0" class="w-full" text :block="true"
|
||||
:height="72" @click="handleSubmit()">不支持匿名投票(点击)</tm-button>
|
||||
<tm-button v-else-if="fnCalcIsVoted()" theme="white" text :block="true" :height="72"
|
||||
class="w-full">您已参与投票</tm-button>
|
||||
<tm-button v-else theme="light-blue" class="w-full" :block="true" :height="72"
|
||||
@click="handleSubmit()">提交投票</tm-button>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
|
||||
import {
|
||||
voteCacheUtil
|
||||
} from '@/utils/vote.js'
|
||||
|
||||
const types = {
|
||||
"pk": "双选PK",
|
||||
"multiple": "多选",
|
||||
"single": "单选"
|
||||
}
|
||||
|
||||
export default {
|
||||
name: "ArticleVote",
|
||||
components: {
|
||||
tmButton,
|
||||
tmTags
|
||||
},
|
||||
props: {
|
||||
voteId: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
index: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
article: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: "loading",
|
||||
loadingText: "加载中,请稍等...",
|
||||
detail: null,
|
||||
vote: null,
|
||||
submitForm: {
|
||||
voteData: []
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fnGetData();
|
||||
},
|
||||
methods: {
|
||||
fnGetData() {
|
||||
this.loadingText = "加载中,请稍等...";
|
||||
this.loading = "loading";
|
||||
this.$httpApi.v2
|
||||
.getVoteDetail(this.voteId)
|
||||
.then(res => {
|
||||
this.pageTitle = "投票详情" + `(${types[res.vote.spec.type]})`
|
||||
|
||||
const tempVoteRes = res;
|
||||
|
||||
tempVoteRes.vote.spec.isVoted = this.fnCalcIsVoted()
|
||||
tempVoteRes.vote.spec.disabled = this.fnCalcIsVoted()
|
||||
tempVoteRes.vote.spec._state = this.handleCalcVoteState(tempVoteRes.vote)
|
||||
|
||||
tempVoteRes.vote.spec.options.map((option, index) => {
|
||||
option.value = option.id
|
||||
option.label = option.title
|
||||
option.isVoted = this.fnCalcIsVoted()
|
||||
option.checked = this.fnCalcIsChecked(option)
|
||||
|
||||
if (tempVoteRes.vote.spec.type === 'single') {
|
||||
option.percent = this.fnCalcPercent(option, tempVoteRes.vote.stats);
|
||||
} else if (tempVoteRes.vote.spec.type === 'multiple') {
|
||||
option.percent = this.fnCalcPercent(option, tempVoteRes.vote.stats);
|
||||
} else if (tempVoteRes.vote.spec.type === 'pk') {
|
||||
option.percent = this.fnCalcPercent(option, tempVoteRes.vote.stats);
|
||||
}
|
||||
|
||||
option.dataStr = JSON.stringify(option)
|
||||
|
||||
return option
|
||||
})
|
||||
|
||||
this.vote = tempVoteRes.vote
|
||||
this.detail = tempVoteRes;
|
||||
|
||||
setTimeout(() => {
|
||||
this.loading = 'success';
|
||||
}, 200);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
this.loadingText = "投票内容加载失败,点击重试"
|
||||
})
|
||||
},
|
||||
fnCalcPercent(voteOption, stats) {
|
||||
if (!this.fnCalcIsVoted()) return 0;
|
||||
if (!stats?.voteDataList) return 0;
|
||||
const option = stats.voteDataList.find(x => x.id == voteOption.id)
|
||||
if (!option) return 0;
|
||||
const percent = (option.voteCount / stats.voteCount) * 100
|
||||
return Math.round(percent)
|
||||
},
|
||||
|
||||
fnCalcIsVoted() {
|
||||
return voteCacheUtil.has(this.voteId)
|
||||
},
|
||||
|
||||
fnCalcIsChecked(option) {
|
||||
const data = voteCacheUtil.get(this.voteId)
|
||||
if (!data) return false;
|
||||
const checked = data.selected.includes(option.id)
|
||||
return checked
|
||||
},
|
||||
handleCalcVoteState(vote) {
|
||||
if (vote.spec.timeLimit !== 'custom') {
|
||||
return vote.spec.hasEnd ? "已结束" : "进行中"
|
||||
}
|
||||
|
||||
const nowTime = new Date().getTime()
|
||||
const startTime = new Date(vote.spec.startDate).getTime()
|
||||
const endTime = new Date(vote.spec.endDate).getTime()
|
||||
|
||||
if (nowTime < startTime) {
|
||||
return "未开始"
|
||||
}
|
||||
if (nowTime < endTime) {
|
||||
return "进行中"
|
||||
}
|
||||
return vote.spec.hasEnd ? "已结束" : "进行中"
|
||||
},
|
||||
formatJsonStr(jsonStr) {
|
||||
return jsonStr ? JSON.parse(jsonStr) : {}
|
||||
},
|
||||
handleSubmitTip() {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "请选择选项后继续"
|
||||
})
|
||||
},
|
||||
handleSubmit() {
|
||||
if (!this.vote.spec.canAnonymously) {
|
||||
uni.showModal({
|
||||
icon: "none",
|
||||
title: "提示",
|
||||
content: "该投票不支持匿名,请到博主的 网站端 进行投票!",
|
||||
cancelColor: "#666666",
|
||||
cancelText: "关闭",
|
||||
confirmText: "复制地址",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
console.log("this.article",this.article)
|
||||
const articleUrl = this.$baseApiUrl + (this.article?.status?.permalink ?? "")
|
||||
this.$utils.copyText(articleUrl, "原文地址复制成功")
|
||||
}
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
uni.showLoading({
|
||||
title: "正在保存..."
|
||||
})
|
||||
|
||||
this.$httpApi.v2
|
||||
.submitVote(this.voteId, this.submitForm, this.vote.spec.canAnonymously)
|
||||
.then(res => {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "提交成功"
|
||||
})
|
||||
|
||||
voteCacheUtil.set(this.voteId, {
|
||||
selected: [...this.submitForm.voteData],
|
||||
data: this.vote
|
||||
})
|
||||
|
||||
this.fnGetData()
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "提交失败,请重试"
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
handleSelectSingleOption(option) {
|
||||
if (this.vote.spec._state == '未开始') {
|
||||
this.showToast(`投票未开始`)
|
||||
return
|
||||
}
|
||||
if (this.vote.spec.disabled) return
|
||||
this.vote.spec.options.map(item => {
|
||||
if (option.id == item.id) {
|
||||
item.checked = true
|
||||
} else {
|
||||
item.checked = false
|
||||
}
|
||||
})
|
||||
this.submitForm.voteData = this.vote.spec.options.filter(x => x.checked).map(item => item.id)
|
||||
},
|
||||
|
||||
handleSelectCheckboxOption(option) {
|
||||
if (this.vote.spec._state == '未开始') {
|
||||
this.showToast(`投票未开始`)
|
||||
return
|
||||
}
|
||||
if (this.vote.spec.disabled) return
|
||||
|
||||
const checkedList = this.vote.spec.options.filter(x => x.checked && x.id != option.id)
|
||||
|
||||
if (this.vote.spec.type === 'multiple' && checkedList.length >= this.vote.spec.maxVotes) {
|
||||
this.showToast(`最多选择 ${this.vote.spec.maxVotes} 项`)
|
||||
return
|
||||
}
|
||||
|
||||
this.vote.spec.options.map(item => {
|
||||
if (option.id == item.id) {
|
||||
item.checked = !item.checked
|
||||
}
|
||||
})
|
||||
this.submitForm.voteData = this.vote.spec.options.filter(x => x.checked).map(item => item.id)
|
||||
},
|
||||
handleToVoteDetail(vote) {
|
||||
uni.navigateTo({
|
||||
url: `/pagesA/vote-detail/vote-detail?name=${vote.metadata.name}`
|
||||
});
|
||||
},
|
||||
showToast(content) {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: content,
|
||||
mask: true
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.w-full {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.wp-50 {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.vote-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
padding: 24rpx;
|
||||
border-radius: 12rpx;
|
||||
background-color: #ffff;
|
||||
overflow: hidden;
|
||||
margin-bottom: 12rpx;
|
||||
border: 1px solid #eee;
|
||||
|
||||
&.error {
|
||||
padding: 0;
|
||||
border-style: dashed;
|
||||
border-color: #e88080;
|
||||
color: #e88080;
|
||||
background-color: rgba(232, 128, 128, 0.075);
|
||||
}
|
||||
|
||||
&.loading {
|
||||
padding: 0;
|
||||
border-style: dashed;
|
||||
border-color: rgba(3, 174, 252, 1);
|
||||
color: rgba(3, 174, 252, 1);
|
||||
background-color: rgba(3, 174, 252, 0.075);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.vote-error {
|
||||
padding: 50rpx 24rpx;
|
||||
font-size: 24rpx;
|
||||
border-radius: 12rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.vote-card-head {
|
||||
margin-bottom: 12rpx;
|
||||
|
||||
.title {
|
||||
padding: 12rpx 0;
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.vote-card-body {
|
||||
|
||||
.remark {
|
||||
box-sizing: border-box;
|
||||
color: rgba(0, 0, 0, 0.75);
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.vote-card-foot {
|
||||
box-sizing: border-box;
|
||||
padding-top: 6px;
|
||||
margin-top: 12px;
|
||||
border-top: 2rpx solid #eee;
|
||||
|
||||
.left {}
|
||||
}
|
||||
|
||||
.is-voted-item {
|
||||
min-height: 72rpx;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
border-radius: 12rpx;
|
||||
background-color: rgba(229, 229, 229, 0.75);
|
||||
font-size: 24rpx;
|
||||
overflow: hidden;
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
width: var(--percent);
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(208, 208, 208, 1);
|
||||
z-index: 0;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
&.selected {
|
||||
background-color: rgba(3, 169, 244, 0.35);
|
||||
color: #ffffff;
|
||||
|
||||
&::before {
|
||||
background-color: rgba(3, 169, 244, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.is-voted-item-content {
|
||||
box-sizing: border-box;
|
||||
min-height: 72rpx;
|
||||
padding: 12rpx 24rpx;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.vote-select-option {
|
||||
box-sizing: border-box;
|
||||
padding: 20rpx 24rpx;
|
||||
font-size: 24rpx;
|
||||
border-radius: 12rpx;
|
||||
transition: all 0.1s ease-in-out;
|
||||
}
|
||||
|
||||
.single {
|
||||
::v-deep {}
|
||||
}
|
||||
|
||||
.multiple {
|
||||
::v-deep {}
|
||||
}
|
||||
|
||||
.pk {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding: 0 12rpx;
|
||||
|
||||
::v-deep {
|
||||
|
||||
.pk-container {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.radio-item {
|
||||
flex-grow: 1;
|
||||
min-width: 30% !important;
|
||||
max-width: 70% !important;
|
||||
}
|
||||
|
||||
.radio-left {}
|
||||
|
||||
.radio-right {}
|
||||
|
||||
.option-item {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding: 24rpx;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.option-item-left {
|
||||
background: linear-gradient(90deg, #3B82F6, #60A5FA);
|
||||
color: white;
|
||||
clip-path: polygon(0 0, calc(100% - 40rpx) 0, 100% 100%, 0 100%);
|
||||
}
|
||||
|
||||
.option-item-right {
|
||||
background: linear-gradient(90deg, #F87171, #EF4444);
|
||||
color: white;
|
||||
clip-path: polygon(0 0, 100% 0, 100% 100%, 40rpx 100%);
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.option-foot {
|
||||
width: 100%;
|
||||
margin-top: 6rpx;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
|
||||
.left {
|
||||
box-sizing: border-box;
|
||||
padding-right: 24rpx;
|
||||
}
|
||||
|
||||
.right {
|
||||
box-sizing: border-box;
|
||||
padding-left: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -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,193 +1,198 @@
|
||||
<template>
|
||||
<view class="cache-image-wrap">
|
||||
<view v-if="loadStatus == 'loading'" class="img-loading" :style="[imgStyle, loadStyle]">
|
||||
<!-- <text class="img-load-icon iconfont icon-loading"></text>
|
||||
<text class="img-load-text">{{ loadText }}</text> -->
|
||||
<image :src="loadingImgSrc" :style="[loadingImgStyle]" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view v-if="loadStatus == 'error'" class="img-error" :style="[imgStyle, loadErrStyle]">
|
||||
<!-- <text class="img-err-icon iconfont icon-exclamation-circle"></text>
|
||||
<text class="img-load-text">{{ loadErrText }}</text> -->
|
||||
<image class="img-error-img" :src="loadingErrorImageSrc" mode="scaleToFill"></image>
|
||||
</view>
|
||||
<image v-show="loadStatus == 'success'" :src="src" @load="fnOnLoad" @error="fnOnError" :lazy-load="lazyLoad" :style="[imgStyle]" :mode="mode" @click="$emit('on-click', url)"></image>
|
||||
</view>
|
||||
<view class="cache-image-wrap">
|
||||
<view v-if="loadStatus == 'loading'" class="img-loading" :style="[imgStyle, loadStyle]">
|
||||
<!-- <text class="img-load-icon iconfont icon-loading"></text>
|
||||
<text class="img-load-text">{{ loadText }}</text> -->
|
||||
<image :src="loadingImgSrc" :style="[loadingImgStyle]" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view v-if="loadStatus == 'error'" class="img-error" :style="[imgStyle, loadErrStyle]">
|
||||
<!-- <text class="img-err-icon iconfont icon-exclamation-circle"></text>
|
||||
<text class="img-load-text">{{ loadErrText }}</text> -->
|
||||
<image class="img-error-img" :src="loadingErrorImageSrc" mode="scaleToFill"></image>
|
||||
</view>
|
||||
<image v-show="loadStatus == 'success'" :src="src" @load="fnOnLoad" @error="fnOnError" :lazy-load="lazyLoad"
|
||||
:style="[imgStyle]" :mode="mode" @click="$emit('on-click', url)"></image>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import imageCache from '@/utils/imageCache.js';
|
||||
export default {
|
||||
name: 'cache-image',
|
||||
props: {
|
||||
url: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
lazyLoad: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
loadStyle: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {
|
||||
backgroundColor: '#ffffff',
|
||||
color: '#333'
|
||||
};
|
||||
}
|
||||
},
|
||||
loadErrStyle: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {
|
||||
color: 'rgba(244, 67, 54,1)'
|
||||
// backgroundColor: 'rgba(244, 67, 54,0.2)'
|
||||
};
|
||||
}
|
||||
},
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'aspectFill'
|
||||
},
|
||||
loadText: {
|
||||
type: String,
|
||||
default: '加载中...'
|
||||
},
|
||||
loadErrText: {
|
||||
type: String,
|
||||
default: '加载失败'
|
||||
},
|
||||
fileMd5: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
styles: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: '100%'
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '100%'
|
||||
},
|
||||
radius: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
imgStyle: {},
|
||||
loadingImgStyle: {
|
||||
width: '120rpx',
|
||||
},
|
||||
src: '', // 图片地址
|
||||
loadStatus: 'loading'
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
loadingImgSrc() {
|
||||
return getApp().globalData.loadingGifUrl;
|
||||
},
|
||||
loadingErrorImageSrc() {
|
||||
return getApp().globalData.loadingErrUrl
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 监听图片md5值的变化
|
||||
fileMd5(val) {
|
||||
// 查找获取图片缓存
|
||||
this.fnGetImageCache();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.imgStyle = {
|
||||
width: this.width,
|
||||
height: this.height,
|
||||
borderRadius: this.radius,
|
||||
...this.styles
|
||||
};
|
||||
import imageCache from '@/utils/imageCache.js';
|
||||
|
||||
// 查找获取图片缓存
|
||||
this.fnGetImageCache();
|
||||
},
|
||||
methods: {
|
||||
// 查找获取图片缓存
|
||||
async fnGetImageCache() {
|
||||
// #ifdef APP-PLUS
|
||||
var result = await imageCache.getImageCache(this.url, this.fileMd5);
|
||||
if (result) {
|
||||
this.src = result;
|
||||
} else {
|
||||
this.src = this.url;
|
||||
}
|
||||
// #endif
|
||||
// #ifndef APP-PLUS
|
||||
this.src = this.url;
|
||||
// #endif
|
||||
},
|
||||
fnOnLoad() {
|
||||
this.loadStatus = 'success';
|
||||
},
|
||||
fnOnError(e) {
|
||||
this.loadStatus = 'error';
|
||||
}
|
||||
}
|
||||
};
|
||||
export default {
|
||||
name: 'cache-image',
|
||||
props: {
|
||||
url: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
lazyLoad: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
loadStyle: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {
|
||||
backgroundColor: '#ffffff',
|
||||
color: '#333'
|
||||
};
|
||||
}
|
||||
},
|
||||
loadErrStyle: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {
|
||||
color: 'rgba(244, 67, 54,1)'
|
||||
// backgroundColor: 'rgba(244, 67, 54,0.2)'
|
||||
};
|
||||
}
|
||||
},
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'aspectFill'
|
||||
},
|
||||
loadText: {
|
||||
type: String,
|
||||
default: '加载中...'
|
||||
},
|
||||
loadErrText: {
|
||||
type: String,
|
||||
default: '加载失败'
|
||||
},
|
||||
fileMd5: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
styles: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: '100%'
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '100%'
|
||||
},
|
||||
radius: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
imgStyle: {},
|
||||
loadingImgStyle: {
|
||||
width: '120rpx',
|
||||
},
|
||||
src: '', // 图片地址
|
||||
loadStatus: 'loading'
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
imagesConfig() {
|
||||
return this.$tm.vx.getters().getConfigs.imagesConfig
|
||||
},
|
||||
loadingImgSrc() {
|
||||
return this.$utils.checkImageUrl(this.imagesConfig.loadingGifUrl);
|
||||
},
|
||||
loadingErrorImageSrc() {
|
||||
return this.$utils.checkImageUrl(this.imagesConfig.loadingErrUrl)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 监听图片md5值的变化
|
||||
fileMd5(val) {
|
||||
// 查找获取图片缓存
|
||||
this.fnGetImageCache();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.imgStyle = {
|
||||
width: this.width,
|
||||
height: this.height,
|
||||
borderRadius: this.radius,
|
||||
...this.styles
|
||||
};
|
||||
|
||||
// 查找获取图片缓存
|
||||
this.fnGetImageCache();
|
||||
},
|
||||
methods: {
|
||||
// 查找获取图片缓存
|
||||
async fnGetImageCache() {
|
||||
// #ifdef APP-PLUS
|
||||
var result = await imageCache.getImageCache(this.url, this.fileMd5);
|
||||
if (result) {
|
||||
this.src = result;
|
||||
} else {
|
||||
this.src = this.url;
|
||||
}
|
||||
// #endif
|
||||
// #ifndef APP-PLUS
|
||||
this.src = this.url;
|
||||
// #endif
|
||||
},
|
||||
fnOnLoad() {
|
||||
this.loadStatus = 'success';
|
||||
},
|
||||
fnOnError(e) {
|
||||
this.loadStatus = 'error';
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.cache-image-wrap {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.cache-image-wrap {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.img-loading,
|
||||
.img-error {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
.img-loading,
|
||||
.img-error {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
.img-load-icon {
|
||||
font-size: 36rpx;
|
||||
animation: xhRote 0.8s infinite linear;
|
||||
}
|
||||
.img-load-icon {
|
||||
font-size: 36rpx;
|
||||
animation: xhRote 0.8s infinite linear;
|
||||
}
|
||||
|
||||
.img-load-text {
|
||||
font-size: 28rpx;
|
||||
margin-top: 8rpx;
|
||||
color: inherit;
|
||||
}
|
||||
.img-load-text {
|
||||
font-size: 28rpx;
|
||||
margin-top: 8rpx;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.img-error {
|
||||
font-size: 28rpx;
|
||||
.img-error {
|
||||
font-size: 28rpx;
|
||||
|
||||
&-img {
|
||||
width: 100%;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
}
|
||||
&-img {
|
||||
width: 100%;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.img-err-icon {
|
||||
font-size: 36rpx;
|
||||
}
|
||||
.img-err-icon {
|
||||
font-size: 36rpx;
|
||||
}
|
||||
|
||||
@keyframes xhRote {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
@keyframes xhRote {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,67 +1,79 @@
|
||||
<template>
|
||||
<view class="category-mini-card">
|
||||
<cache-image
|
||||
class="img"
|
||||
height="120rpx"
|
||||
:url="$utils.checkThumbnailUrl(category.thumbnail)"
|
||||
:fileMd5="$utils.checkThumbnailUrl(category.thumbnail)"
|
||||
mode="aspectFill"
|
||||
></cache-image>
|
||||
|
||||
<text class="label">{{ category.postCount }} 篇</text>
|
||||
<view class="name">{{ category.name }}</view>
|
||||
<cache-image class="img" height="180rpx" :url="$utils.checkThumbnailUrl(category.spec.cover,false)"
|
||||
:fileMd5="$utils.checkThumbnailUrl(category.spec.cover)" mode="aspectFill"></cache-image>
|
||||
<view class="content">
|
||||
<view class="name">{{ category.spec.displayName }}</view>
|
||||
<text class="label">共 {{ category.postCount }} 篇</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'category-mini-card',
|
||||
props: {
|
||||
category: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
export default {
|
||||
name: 'category-mini-card',
|
||||
props: {
|
||||
category: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.category-mini-card {
|
||||
display: inline-block;
|
||||
width: 260rpx;
|
||||
height: 180rpx;
|
||||
position: relative;
|
||||
border-radius: 12rpx;
|
||||
background-color: #fff;
|
||||
overflow: hidden;
|
||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
position: relative;
|
||||
.img {
|
||||
width: 100%;
|
||||
height: 120rpx;
|
||||
border: 6rpx 6rpx 0 0;
|
||||
.category-mini-card {
|
||||
display: inline-block;
|
||||
width: 260rpx;
|
||||
height: 180rpx;
|
||||
position: relative;
|
||||
border-radius: 12rpx;
|
||||
background-color: #fff;
|
||||
overflow: hidden;
|
||||
}
|
||||
.label {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 86rpx;
|
||||
color: #03a9f4;
|
||||
font-size: 24rpx;
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
border-radius: 0rpx 24rpx 0 0;
|
||||
display: flex;
|
||||
padding: 2rpx 12rpx;
|
||||
padding-right: 24rpx;
|
||||
}
|
||||
.name {
|
||||
position: absolute;
|
||||
bottom: 16rpx;
|
||||
left: 0;
|
||||
right: 0;
|
||||
font-size: 24rpx;
|
||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
position: relative;
|
||||
text-align: center;
|
||||
color: #333;
|
||||
color: #ffffff;
|
||||
|
||||
&:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.25);
|
||||
backdrop-filter: blur(3rpx);
|
||||
}
|
||||
|
||||
.content {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 3;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
}
|
||||
|
||||
.name {
|
||||
font-weight: bold;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 24rpx;
|
||||
margin-top: 6rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -1,167 +1,165 @@
|
||||
<template>
|
||||
<view class=" comment-item flex flex-col mt-30 pt-24" :class="{ 'child-comment-item': isChild, 'no-solid': !useSolid, classItem }">
|
||||
<view v-if="comment" class=" comment-item flex flex-col mt-30 pt-24"
|
||||
:class="{ 'child-comment-item': isChild, 'no-solid': !useSolid, classItem }">
|
||||
<view class="comment-item_user flex">
|
||||
<image
|
||||
v-if="comment.isAdmin"
|
||||
class="user-avatar"
|
||||
:class="{ 'is-radius': globalAppSettings.isAvatarRadius }"
|
||||
:src="bloggerInfo.avatar"
|
||||
mode="aspectFill"
|
||||
@error="fnOnImageError(comment)"
|
||||
></image>
|
||||
<image
|
||||
v-else
|
||||
class="user-avatar"
|
||||
:class="{ 'is-radius': globalAppSettings.isAvatarRadius }"
|
||||
:src="comment.avatar"
|
||||
mode="aspectFill"
|
||||
@error="fnOnImageError(comment)"
|
||||
></image>
|
||||
<image class="user-avatar" :class="{ 'is-radius': globalAppSettings.isAvatarRadius }"
|
||||
:src="$utils.checkAvatarUrl(comment.owner.avatar, false)" mode="aspectFill"
|
||||
@error="fnOnImageError(comment)"></image>
|
||||
<view class="user-info pl-14">
|
||||
<view class="author">
|
||||
<text class="mr-6 text-grey-darken-1 text-size-m">{{ comment.author }}</text>
|
||||
<tm-tags v-if="comment.isAdmin" :dense="true" color="bg-gradient-amber-accent" size="xs" model="fill">博主</tm-tags>
|
||||
|
||||
<tm-tags v-else :dense="true" color="bg-gradient-light-blue-lighten " size="xs" model="fill">游客</tm-tags>
|
||||
<text class="mr-6 text-grey-darken-1 text-size-m">{{ comment.owner.displayName }}</text>
|
||||
</view>
|
||||
<view class="flex mt-4">
|
||||
<view v-if="false" class="text-size-s text-grey mr-12">IP属地:暂无信息</view>
|
||||
<view class="time text-size-xs text-grey">
|
||||
<text class="">{{ $tm.dayjs(comment.createTime).format('YYYY年MM月DD日') }}</text>
|
||||
<text class="ml-12">{{ $tm.dayjs(comment.createTime).fromNow(true) }}前</text>
|
||||
<text class="">{{ $tm.dayjs(comment.spec.creationTime).format('YYYY年MM月DD日') }}</text>
|
||||
<text class="ml-12">{{ $tm.dayjs(comment.spec.creationTime).fromNow(true) }}前</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="useActions" class="">
|
||||
<tm-button v-if="!disallowComment" size="s" text theme="blue" @click="$emit('on-comment', { type: 'user', comment: comment })">回复</tm-button>
|
||||
<tm-button size="s" text theme="grey" @click="$emit('on-copy', comment.content)">复制</tm-button>
|
||||
<tm-button v-if="!disallowComment" size="s" text theme="blue"
|
||||
@click="$emit('on-comment', { type: 'user', comment: comment })">回复</tm-button>
|
||||
<tm-button size="s" text theme="grey" @click="$emit('on-copy', comment.spec.raw)">复制</tm-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="comment-item_content mt-12" :class="{ 'has-bg': useContentBg, 'not-ml': isChild }" @click="$emit('on-detail', comment)" v-html="comment.content"></view>
|
||||
<!-- <view v-if="useActions" class="comment-item_info text-size-s text-grey">
|
||||
<text v-if="false" @click="$emit('on-todo')">点赞</text>
|
||||
<text @click="$emit('on-comment', { type: 'user', comment: comment })">回复</text>
|
||||
<text v-if="false" class="ml-24" @click="$emit('on-todo')">举报</text>
|
||||
<text class="ml-24" @click="$emit('on-copy', comment.content)">复制内容</text>
|
||||
</view> -->
|
||||
<view class="comment-item_content mt-12" :class="{ 'has-bg': useContentBg, 'not-ml': isChild }"
|
||||
@click="$emit('on-detail', comment)" v-html="comment.spec.raw"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
export default {
|
||||
name: 'comment-item',
|
||||
components: { tmTags, tmButton },
|
||||
props: {
|
||||
classItem: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
export default {
|
||||
name: 'comment-item',
|
||||
components: {
|
||||
tmTags,
|
||||
tmButton
|
||||
},
|
||||
disallowComment: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
useActions: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
useSolid: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
useContentBg: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
isChild: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
postId: {
|
||||
type: Number,
|
||||
default: null
|
||||
},
|
||||
comment: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 获取博主信息
|
||||
bloggerInfo() {
|
||||
let blogger = this.$tm.vx.getters().getBlogger;
|
||||
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
|
||||
return blogger;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fnOnImageError(data) {
|
||||
if (data.isAdmin) {
|
||||
data.avatar = this.$haloConfig.author.avatar;
|
||||
} else {
|
||||
data.avatar = `${this.$haloConfig.defaultAvatarUrl}&rt=${new Date().getTime()}`;
|
||||
props: {
|
||||
classItem: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
disallowComment: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
useActions: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
useSolid: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
useContentBg: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
isChild: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
postName: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
comment: {
|
||||
type: Object,
|
||||
default: () => null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
imageConfigs() {
|
||||
return this.$tm.vx.getters().getConfigs.imagesConfig;
|
||||
},
|
||||
bloggerInfo() {
|
||||
let blogger = this.$tm.vx.getters().getConfigs.authorConfig.blogger;
|
||||
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
|
||||
return blogger;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fnOnImageError(data) {
|
||||
if (data && data.owner) {
|
||||
if (this.imageConfigs.defaultAvatarUrl.indexOf('?') == -1) {
|
||||
data.owner.avatar = `${this.imageConfigs.defaultAvatarUrl}?next-v=${new Date().getTime()}`
|
||||
} else {
|
||||
data.owner.avatar = `${this.imageConfigs.defaultAvatarUrl}&next-v=${new Date().getTime()}`
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
console.log("comment", this.comment)
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.comment-item {
|
||||
box-sizing: border-box;
|
||||
border-top: 2rpx solid #f5f5f5;
|
||||
.comment-item {
|
||||
box-sizing: border-box;
|
||||
border-top: 2rpx solid #f5f5f5;
|
||||
|
||||
&.child-comment-item {
|
||||
padding-top: 0;
|
||||
margin-left: 80rpx;
|
||||
border: 0;
|
||||
}
|
||||
&.no-solid {
|
||||
border: 0;
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
&_user {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.user-avatar {
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.05);
|
||||
border: 4rpx solid #ffffff;
|
||||
border-radius: 12rpx;
|
||||
&.is-radius {
|
||||
border-radius: 50%;
|
||||
&.child-comment-item {
|
||||
padding-top: 0;
|
||||
margin-left: 80rpx;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
&.no-solid {
|
||||
border: 0;
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
|
||||
&_user {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.user-avatar {
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.05);
|
||||
border: 4rpx solid #ffffff;
|
||||
border-radius: 12rpx;
|
||||
|
||||
&.is-radius {
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.user-info {
|
||||
width: 0;
|
||||
flex-grow: 1;
|
||||
}
|
||||
}
|
||||
.user-info {
|
||||
width: 0;
|
||||
flex-grow: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&_content {
|
||||
font-size: 28rpx;
|
||||
margin-left: 80rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 10rpx;
|
||||
line-height: 1.8;
|
||||
color: var(--main-text-color);
|
||||
&.has-bg {
|
||||
background-color: #fafafa;
|
||||
padding: 6rpx 24rpx;
|
||||
&_content {
|
||||
font-size: 28rpx;
|
||||
margin-left: 80rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 10rpx;
|
||||
line-height: 1.8;
|
||||
color: var(--main-text-color);
|
||||
|
||||
&.has-bg {
|
||||
background-color: #fafafa;
|
||||
padding: 6rpx 24rpx;
|
||||
}
|
||||
|
||||
&.not-ml {
|
||||
margin-left: 80rpx;
|
||||
}
|
||||
}
|
||||
&.not-ml {
|
||||
|
||||
&_info {
|
||||
margin-top: 6rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: 80rpx;
|
||||
}
|
||||
}
|
||||
&_info {
|
||||
margin-top: 6rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: 80rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -1,87 +1,70 @@
|
||||
<template>
|
||||
<view class="comment-list">
|
||||
<!-- 顶部区域 -->
|
||||
<view class="comment-list_head">
|
||||
<view class="title">
|
||||
评论列表
|
||||
<text class="count">({{ result.total || 0 }}条)</text>
|
||||
<view class="comment-list">
|
||||
<!-- 顶部区域 -->
|
||||
<view class="comment-list_head">
|
||||
<view class="title">
|
||||
<text>评论列表</text>
|
||||
<text class="count">({{ (result && result.total) || 0 }}条)</text>
|
||||
</view>
|
||||
<view class="refresh">
|
||||
<text class="icon iconfont icon-sync-alt text-weight-s text-grey-darken-1"></text>
|
||||
<text class="text-weight-s text-grey-darken-1 ml-6" style="font-size: 26rpx;" @click="fnGetData">刷新</text>
|
||||
</view>
|
||||
<view class="filter">
|
||||
<text class="filter-item " :class="{ active: sort == 0 }" @click="fnOnSort(0)">默认</text>
|
||||
<text class="filter-item " :class="{ active: sort == 1 }" @click="fnOnSort(1)">热评</text>
|
||||
<!-- <text class="filter-item">全部</text> -->
|
||||
</view>
|
||||
</view>
|
||||
<!-- 内容区域 -->
|
||||
<view class="comment-list_content">
|
||||
<view v-if="loading != 'success'" class="loading-wrap flex">
|
||||
<view v-if="loading == 'loading'" class="loading flex flex-center flex-col">
|
||||
<text class="e-loading-icon iconfont icon-loading text-blue"></text>
|
||||
<view class="text-size-n text-grey-lighten-1 py-12 mt-12">加载中,请稍等...</view>
|
||||
</view>
|
||||
<view v-else-if="loading == 'error'" class="error">
|
||||
<tm-empty icon="icon-wind-cry" label="加载失败">
|
||||
<tm-button theme="bg-gradient-light-blue-accent" size="m" v-if="!disallowComment" @click="fnToComment()">刷新试试</tm-button>
|
||||
</tm-empty>
|
||||
</view>
|
||||
</view>
|
||||
<block v-else>
|
||||
<tm-alerts
|
||||
v-if="disallowComment && dataList.length !== 0"
|
||||
color="red"
|
||||
text
|
||||
:margin="[0, 0]"
|
||||
:shadow="0"
|
||||
label="Ծ‸Ծ博主已设置该文章禁止评论!"
|
||||
:round="3"
|
||||
></tm-alerts>
|
||||
<view class="empty pt-50" v-if="dataList.length == 0">
|
||||
<tm-empty v-if="disallowComment" icon="icon-shiliangzhinengduixiang-" label="暂无评论">
|
||||
<text class="text-red text-size-s">- 文章已开启禁止评论 -</text>
|
||||
</tm-empty>
|
||||
<tm-empty v-else icon="icon-shiliangzhinengduixiang-" label="暂无评论">
|
||||
<tm-button theme="light-blue" :dense="true" :shadow="0" size="m" @click="fnToComment(null)">抢沙发</tm-button>
|
||||
</tm-empty>
|
||||
</view>
|
||||
<block v-else>
|
||||
<!-- 评论内容 : 目前仅支持二级评论 -->
|
||||
<block v-for="(comment, index) in dataList" :key="comment.id">
|
||||
<comment-item
|
||||
:useContentBg="false"
|
||||
:isChild="false"
|
||||
:comment="comment"
|
||||
:postId="postId"
|
||||
:disallowComment="disallowComment"
|
||||
@on-copy="fnCopyContent"
|
||||
@on-comment="fnToComment"
|
||||
@on-todo="fnToDo"
|
||||
@on-detail="fnShowCommetnDetail"
|
||||
></comment-item>
|
||||
</view>
|
||||
<!-- 内容区域 -->
|
||||
<view class="comment-list_content">
|
||||
<view v-if="loading !== 'success'" class="loading-wrap flex">
|
||||
<view v-if="loading === 'loading'" class="loading flex flex-center flex-col">
|
||||
<text class="e-loading-icon iconfont icon-loading text-blue"></text>
|
||||
<view class="text-size-n text-grey-lighten-1 py-12 mt-12">加载中,请稍等...</view>
|
||||
</view>
|
||||
<view v-else-if="loading === 'error'" class="error">
|
||||
<tm-empty icon="icon-wind-cry" label="加载失败">
|
||||
<tm-button theme="bg-gradient-light-blue-accent" size="m" v-if="!disallowComment"
|
||||
@click="fnToComment()">刷新试试
|
||||
</tm-button>
|
||||
</tm-empty>
|
||||
</view>
|
||||
</view>
|
||||
<block v-else>
|
||||
<tm-alerts v-if="disallowComment && dataList.length !== 0" color="red" text :margin="[0, 0]" :shadow="0"
|
||||
label="Ծ‸Ծ博主已设置该文章禁止评论!" :round="3"></tm-alerts>
|
||||
<view class="empty pt-50" v-if="dataList.length === 0">
|
||||
<tm-empty v-if="disallowComment" icon="icon-shiliangzhinengduixiang-" label="暂无评论">
|
||||
<text class="text-red text-size-s">- 文章已开启禁止评论 -</text>
|
||||
</tm-empty>
|
||||
<tm-empty v-else icon="icon-shiliangzhinengduixiang-" label="暂无评论">
|
||||
<tm-button theme="light-blue" :dense="true" :shadow="0" size="m" @click="fnToComment(null)">抢沙发
|
||||
</tm-button>
|
||||
</tm-empty>
|
||||
</view>
|
||||
<block v-else>
|
||||
<!-- 评论内容 : 目前仅支持二级评论 -->
|
||||
<block v-for="(comment, index) in dataList" :key="comment.metadata.name">
|
||||
<comment-item :useContentBg="false" :isChild="false" :comment="comment" :postName="postName"
|
||||
:disallowComment="disallowComment" @on-copy="fnCopyContent" @on-comment="fnToComment"
|
||||
@on-todo="fnToDo" @on-detail="fnShowCommentDetail"></comment-item>
|
||||
|
||||
<!-- 二级评论 -->
|
||||
<block v-if="comment.children && comment.children.length != 0">
|
||||
<block v-for="(childComment, childIndex) in comment.children" :key="childComment.id">
|
||||
<comment-item
|
||||
:useContentBg="false"
|
||||
:isChild="true"
|
||||
:comment="childComment"
|
||||
:postId="postId"
|
||||
:disallowComment="disallowComment"
|
||||
@on-copy="fnCopyContent"
|
||||
@on-comment="fnToComment"
|
||||
@on-todo="fnToDo"
|
||||
@on-detail="fnShowCommetnDetail"
|
||||
></comment-item>
|
||||
</block>
|
||||
</block>
|
||||
</block>
|
||||
<view v-if="false" class="to-more-comment">
|
||||
<tm-button item-class="btn" :block="true" width="90vw" theme="bg-gradient-light-blue-lighten" size="m">点击查看全部评论</tm-button>
|
||||
</view>
|
||||
</block>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 二级评论 -->
|
||||
<block v-if="comment.replies && comment.replies.items.length !== 0">
|
||||
<block v-for="(childComment, childIndex) in comment.replies.items"
|
||||
:key="childComment.metadata.name">
|
||||
<comment-item :useContentBg="false" :isChild="true" :comment="childComment"
|
||||
:postName="postName" :disallowComment="disallowComment" @on-copy="fnCopyContent"
|
||||
@on-comment="fnToComment" @on-todo="fnToDo"
|
||||
@on-detail="fnShowCommentDetail"></comment-item>
|
||||
</block>
|
||||
</block>
|
||||
</block>
|
||||
<view v-if="false" class="to-more-comment">
|
||||
<tm-button item-class="btn" :block="true" width="90vw" theme="bg-gradient-light-blue-lighten"
|
||||
size="m">点击查看全部评论
|
||||
</tm-button>
|
||||
</view>
|
||||
</block>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -90,193 +73,200 @@ import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
import tmAlerts from '@/tm-vuetify/components/tm-alerts/tm-alerts.vue';
|
||||
|
||||
export default {
|
||||
name: 'comment-list',
|
||||
components: { tmEmpty, tmButton, tmAlerts },
|
||||
props: {
|
||||
// 是否禁用评论
|
||||
disallowComment: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
postId: {
|
||||
type: Number,
|
||||
default: null
|
||||
},
|
||||
post: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
sort: 0,
|
||||
queryParams: {
|
||||
sort: '',
|
||||
more: true
|
||||
},
|
||||
api: 'getPostCommentTree',
|
||||
result: {},
|
||||
dataList: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.fnGetData();
|
||||
uni.$on('comment_list_refresh', () => {
|
||||
this.fnOnSort(this.sort, true);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
fnOnSort(type, refresh = false) {
|
||||
if (this.sort == type && refresh == false) return;
|
||||
const _api = ['getPostCommentTree', 'getPostTopCommentList'];
|
||||
this.sort = type;
|
||||
this.api = _api[type];
|
||||
this.fnGetData();
|
||||
},
|
||||
fnGetData() {
|
||||
this.loading = 'loading';
|
||||
this.$httpApi[this.api](this.postId, {})
|
||||
.then(res => {
|
||||
if (res.status == 200) {
|
||||
this.result = res.data;
|
||||
this.dataList = res.data.content;
|
||||
this.loading = 'success';
|
||||
this.$emit('on-loaded', this.dataList);
|
||||
} else {
|
||||
this.loading = 'error';
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = 'error';
|
||||
})
|
||||
.finally(() => {
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
fnToDo() {
|
||||
uni.$tm.toast('Halo暂未支持!');
|
||||
},
|
||||
fnToComment(data) {
|
||||
if (this.disallowComment) {
|
||||
return uni.$tm.toast('文章已禁止评论!');
|
||||
}
|
||||
console.log(data);
|
||||
let _comment = {};
|
||||
if (data) {
|
||||
let { type, comment } = data;
|
||||
// 来自用户
|
||||
_comment = {
|
||||
id: this.post.id,
|
||||
parentId: comment.id,
|
||||
title: comment.author,
|
||||
from: 'posts',
|
||||
formPage: 'comment_list',
|
||||
type: 'user'
|
||||
};
|
||||
} else {
|
||||
// 来自文章
|
||||
_comment = {
|
||||
id: this.post.id,
|
||||
parentId: 0,
|
||||
title: '评论文章:' + this.post.title,
|
||||
formPage: 'comment_list',
|
||||
from: 'posts',
|
||||
type: 'post'
|
||||
};
|
||||
}
|
||||
name: 'comment-list',
|
||||
components: {
|
||||
tmEmpty,
|
||||
tmButton,
|
||||
tmAlerts
|
||||
},
|
||||
props: {
|
||||
// 是否禁用评论
|
||||
disallowComment: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
postName: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
post: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
queryParams: {
|
||||
group: "content.halo.run",
|
||||
kind: "Post",
|
||||
version: "v1alpha1",
|
||||
name: "",
|
||||
page: 1,
|
||||
size: 50,
|
||||
withReplies: true,
|
||||
replySize: 10
|
||||
},
|
||||
result: null,
|
||||
dataList: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.queryParams.name = this.postName;
|
||||
this.fnGetData();
|
||||
uni.$on('comment_list_refresh', () => {
|
||||
this.fnOnSort(true);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
fnOnSort(refresh = false) {
|
||||
if (refresh === false) return;
|
||||
this.fnGetData();
|
||||
},
|
||||
fnGetData() {
|
||||
this.loading = 'loading';
|
||||
this.$httpApi.v2.getPostCommentList(this.queryParams)
|
||||
.then(res => {
|
||||
console.log("日志:", res)
|
||||
this.result = res;
|
||||
this.dataList = res.items;
|
||||
this.loading = 'success';
|
||||
this.$emit('on-loaded', this.dataList);
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = 'error';
|
||||
})
|
||||
.finally(() => {
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
fnToDo() {
|
||||
uni.$tm.toast('Halo暂未支持!');
|
||||
},
|
||||
fnToComment(data) {
|
||||
if (this.disallowComment) {
|
||||
return uni.$tm.toast('文章已禁止评论!');
|
||||
}
|
||||
let _comment = {};
|
||||
console.log('data', data)
|
||||
if (data) {
|
||||
let {type, comment} = data;
|
||||
// 来自用户
|
||||
_comment = {
|
||||
isComment: false,
|
||||
postName: comment.metadata.name,
|
||||
title: comment.owner.displayName,
|
||||
from: 'posts',
|
||||
formPage: 'comment_list',
|
||||
type: 'user'
|
||||
};
|
||||
} else {
|
||||
// 来自文章
|
||||
_comment = {
|
||||
isComment: true,
|
||||
postName: this.post.metadata.name,
|
||||
title: '新增评论',
|
||||
formPage: 'comment_list',
|
||||
from: 'posts',
|
||||
type: 'post'
|
||||
};
|
||||
}
|
||||
|
||||
uni.$tm.vx.commit('comment/setCommentInfo', _comment);
|
||||
this.$Router.push({
|
||||
path: '/pagesA/comment/comment',
|
||||
query: _comment
|
||||
});
|
||||
},
|
||||
fnCopyContent(content) {
|
||||
uni.$tm.u.setClipboardData(content);
|
||||
uni.$tm.toast('内容已复制成功!');
|
||||
},
|
||||
this.$emit("on-comment", _comment)
|
||||
},
|
||||
fnCopyContent(content) {
|
||||
uni.$tm.u.setClipboardData(content);
|
||||
uni.$tm.toast('内容已复制成功!');
|
||||
},
|
||||
|
||||
fnShowCommetnDetail(comment) {
|
||||
this.$emit('on-comment-detail', {
|
||||
postId: this.postId,
|
||||
comment: comment
|
||||
});
|
||||
}
|
||||
}
|
||||
fnShowCommentDetail(comment) {
|
||||
this.$emit('on-comment-detail', {
|
||||
postName: this.postName,
|
||||
comment: comment
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.comment-list {
|
||||
&_head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
padding-left: 24rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
&_head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
padding-left: 24rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
|
||||
&:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0rpx;
|
||||
top: 8rpx;
|
||||
width: 8rpx;
|
||||
height: 26rpx;
|
||||
background-color: rgb(3, 174, 252);
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
.title {
|
||||
.count {
|
||||
font-size: 28rpx;
|
||||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
.filter {
|
||||
font-size: 26rpx;
|
||||
font-weight: normal;
|
||||
&:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0rpx;
|
||||
top: 8rpx;
|
||||
width: 8rpx;
|
||||
height: 26rpx;
|
||||
background-color: rgb(3, 174, 252);
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
&-item {
|
||||
margin-left: 20rpx;
|
||||
color: #666;
|
||||
&.active {
|
||||
font-weight: bold;
|
||||
color: rgb(255, 152, 0);
|
||||
font-size: 26rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&_content {
|
||||
margin-top: 24rpx;
|
||||
padding-bottom: 36rpx;
|
||||
}
|
||||
.title {
|
||||
.count {
|
||||
font-size: 28rpx;
|
||||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
|
||||
.filter {
|
||||
font-size: 26rpx;
|
||||
font-weight: normal;
|
||||
|
||||
&-item {
|
||||
margin-left: 20rpx;
|
||||
color: #666;
|
||||
|
||||
&.active {
|
||||
font-weight: bold;
|
||||
color: rgb(255, 152, 0);
|
||||
font-size: 26rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&_content {
|
||||
margin-top: 24rpx;
|
||||
padding-bottom: 36rpx;
|
||||
}
|
||||
}
|
||||
.loading-wrap {
|
||||
width: 100%;
|
||||
height: 506rpx;
|
||||
.loading {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.e-loading-icon {
|
||||
font-size: 100rpx;
|
||||
}
|
||||
.loading-wrap {
|
||||
width: 100%;
|
||||
height: 506rpx;
|
||||
|
||||
.loading {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.e-loading-icon {
|
||||
font-size: 100rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.to-more-comment {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: 80rpx;
|
||||
::v-deep {
|
||||
.tm-button .tm-button-btn uni-button {
|
||||
height: 70rpx;
|
||||
}
|
||||
}
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: 80rpx;
|
||||
|
||||
::v-deep {
|
||||
.tm-button .tm-button-btn uni-button {
|
||||
height: 70rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,233 @@
|
||||
<template>
|
||||
<tm-poup v-model="isShow" position="bottom" height="71vh" @change="handleOnChange">
|
||||
<view class="title text-align-center">{{ calcTitle }}</view>
|
||||
<tm-form @submit="fnOnSubmit">
|
||||
<tm-input name="content" :vertical="true" required :height="220" input-type="textarea"
|
||||
bg-color="grey-lighten-5" :maxlength="200" :borderBottom="false" placeholder="请输入内容,不超过200字符..."
|
||||
v-model="form.content"></tm-input>
|
||||
<tm-input name="author" align="right" required title="我的昵称" placeholder="请输入您的昵称..."
|
||||
v-model="form.author"></tm-input>
|
||||
<tm-input name="avatar" align="right" title="我的头像" placeholder="请输入您的头像..."
|
||||
v-model="form.avatar"></tm-input>
|
||||
<tm-input name="email" align="right" title="邮箱地址" placeholder="请输入您的邮箱..." v-model="form.email"></tm-input>
|
||||
<tm-input name="authorUrl" align="right" title="我的网站" placeholder="请输入您的网址..."
|
||||
v-model="form.authorUrl"></tm-input>
|
||||
<view class="pa-24 pl-30 pr-30">
|
||||
<tm-button navtie-type="form" theme="bg-gradient-blue-accent" block>提交
|
||||
</tm-button>
|
||||
</view>
|
||||
</tm-form>
|
||||
</tm-poup>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue';
|
||||
import tmForm from '@/tm-vuetify/components/tm-form/tm-form.vue';
|
||||
import tmInput from '@/tm-vuetify/components/tm-input/tm-input.vue';
|
||||
import tmSwitch from '@/tm-vuetify/components/tm-switch/tm-switch.vue';
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
|
||||
export default {
|
||||
name: 'CommentModal',
|
||||
components: {
|
||||
tmPoup,
|
||||
tmForm,
|
||||
tmInput,
|
||||
tmSwitch,
|
||||
tmButton
|
||||
},
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
isComment: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
postName: {
|
||||
type: String,
|
||||
default: ""
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isShow: false,
|
||||
params: {
|
||||
postName: '',
|
||||
title: '', // 被回复的标题 type=user =用户名 否则为文章标题
|
||||
form: '',
|
||||
formPage: '', // 来自哪个页面
|
||||
type: 'post' // 来源文章/页面 还是用户 user=用户
|
||||
},
|
||||
form: {
|
||||
allowNotification: true,
|
||||
author: '', // 作者
|
||||
avatar: '',
|
||||
authorUrl: '', // 作者主页
|
||||
content: '', // 评论内容
|
||||
email: '', // 邮件
|
||||
postName: ""
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
calcTitle() {
|
||||
if (this.isComment) {
|
||||
return this.title
|
||||
}
|
||||
return `回复用户:${this.title}`
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
show: {
|
||||
immediate: true,
|
||||
handler: function (newVal) {
|
||||
if (!newVal) return;
|
||||
this.isShow = true;
|
||||
this.handleResetForm();
|
||||
this.form.postName = this.postName;
|
||||
let visitor = uni.getStorageSync('Visitor')
|
||||
if (!visitor) return;
|
||||
visitor = JSON.parse(visitor)
|
||||
this.form.author = visitor.author;
|
||||
this.form.avatar = visitor.avatar;
|
||||
this.form.email = visitor.email;
|
||||
this.form.authorUrl = visitor.authorUrl;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleResetForm() {
|
||||
this.params = {
|
||||
postName: '',
|
||||
title: '',
|
||||
form: '',
|
||||
formPage: '',
|
||||
type: 'post'
|
||||
}
|
||||
this.form = {
|
||||
allowNotification: true,
|
||||
author: '',
|
||||
avatar: '',
|
||||
authorUrl: '',
|
||||
content: '',
|
||||
email: '',
|
||||
postName: ""
|
||||
}
|
||||
},
|
||||
fnOnSubmit(e) {
|
||||
if (e === false) {
|
||||
return uni.$tm.toast('请检查所有的必填项是否填写完整!');
|
||||
}
|
||||
// if (!this.form.email) {
|
||||
// return uni.$tm.toast('未填写邮箱地址,将无法接收提醒!');
|
||||
// }
|
||||
// if (this.form.email && !uni.$tm.test.email(this.form.email)) {
|
||||
// return uni.$tm.toast('请填写正确的邮箱地址!');
|
||||
// }
|
||||
// if (this.form.authorUrl && !uni.$tm.test.url(this.form.authorUrl)) {
|
||||
// return uni.$tm.toast('请输入正确的Url地址!');
|
||||
// }
|
||||
this.fnHandle();
|
||||
},
|
||||
handleSetVisitor() {
|
||||
uni.setStorageSync('Visitor', JSON.stringify({
|
||||
author: this.form.author,
|
||||
avatar: this.form.avatar,
|
||||
email: this.form.email,
|
||||
authorUrl: this.form.authorUrl,
|
||||
}))
|
||||
},
|
||||
fnHandle() {
|
||||
uni.showLoading({
|
||||
title: '正在提交...'
|
||||
});
|
||||
|
||||
// 评论
|
||||
if (this.isComment) {
|
||||
const commentForm = {
|
||||
allowNotification: true,
|
||||
raw: this.form.content,
|
||||
content: this.form.content,
|
||||
owner: {
|
||||
avatar: this.form.avatar,
|
||||
displayName: this.form.author,
|
||||
email: this.form.email,
|
||||
website: this.form.authorUrl,
|
||||
},
|
||||
subjectRef: {
|
||||
group: "content.halo.run",
|
||||
kind: "Post",
|
||||
name: this.form.postName,
|
||||
version: "v1alpha1",
|
||||
}
|
||||
}
|
||||
this.$httpApi.v2.addPostComment(commentForm)
|
||||
.then(res => {
|
||||
uni.$tm.toast('评论成功,可能需要审核!');
|
||||
// 更新评论者信息
|
||||
this.handleSetVisitor();
|
||||
this.handleClose(true)
|
||||
this.handleResetForm()
|
||||
})
|
||||
.catch(err => {
|
||||
uni.$tm.toast("评论失败");
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 回复
|
||||
const replyForm = {
|
||||
allowNotification: true,
|
||||
raw: this.form.content,
|
||||
content: this.form.content,
|
||||
owner: {
|
||||
avatar: this.form.avatar,
|
||||
displayName: this.form.author,
|
||||
email: this.form.email,
|
||||
website: this.form.authorUrl,
|
||||
},
|
||||
quoteReply: this.form.postName
|
||||
}
|
||||
this.$httpApi.v2.addPostCommentReply(this.form.postName, replyForm)
|
||||
.then(res => {
|
||||
uni.$tm.toast('回复成功,可能需要审核!');
|
||||
// 更新评论者信息
|
||||
this.handleSetVisitor();
|
||||
this.handleClose(true)
|
||||
this.handleResetForm()
|
||||
})
|
||||
.catch(err => {
|
||||
uni.$tm.toast("回复失败");
|
||||
});
|
||||
},
|
||||
handleOnChange(isOpen) {
|
||||
this.isShow = isOpen;
|
||||
if(!isOpen){
|
||||
this.$emit("on-close", {
|
||||
isSubmit:false,
|
||||
refresh: false
|
||||
})
|
||||
}
|
||||
},
|
||||
handleClose(refresh = false) {
|
||||
this.isShow = false;
|
||||
this.$emit("on-close", {
|
||||
isSubmit:true,
|
||||
refresh: refresh
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.title {
|
||||
margin: 24rpx 0;
|
||||
}
|
||||
</style>
|
||||
@@ -102,6 +102,8 @@
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 20rpx 24rpx;
|
||||
background-color: rgba(0, 0, 0, 0.085);
|
||||
backdrop-filter: blur(3rpx);
|
||||
&.no-dot {
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
+122
-135
@@ -2,47 +2,31 @@
|
||||
<!-- 轮播图 -->
|
||||
<view class="Swiper-mfw-index-box">
|
||||
<view class="Swiper-mfw-index Swiper-box" :class="[dotPosition]">
|
||||
<swiper
|
||||
class="Swiper-mfw"
|
||||
:style="{ height: height }"
|
||||
:circular="true"
|
||||
:indicator-dots="false"
|
||||
:autoplay="autoplay"
|
||||
:interval="3000"
|
||||
:duration="1000"
|
||||
:current="currentIndex"
|
||||
:disable-touch="disable_touch"
|
||||
@change="change"
|
||||
>
|
||||
<swiper class="Swiper-mfw" :style="{ height: height }" :circular="true" :indicator-dots="false"
|
||||
:autoplay="autoplay" :interval="3000" :duration="1000" :current="currentIndex"
|
||||
:disable-touch="disable_touch" @change="change">
|
||||
<!-- 只需要前5条数据 -->
|
||||
<swiper-item class="swiper-mfw-item" v-if="index <= (dotPosition == 'right' ? 3 : 4)" v-for="(item, index) in list" :key="index">
|
||||
<!-- /*
|
||||
<block v-for="(item, index) in list" :key="index">
|
||||
<swiper-item class="swiper-mfw-item" v-if="index <= 4">
|
||||
<!-- /*
|
||||
1. 这里不需要用api控制暂停视频
|
||||
2. 因为video标签上加了v-if="current==index"
|
||||
3. 当current == index时才会创建视频组件
|
||||
4. 否current != index则就销毁视频
|
||||
*/ -->
|
||||
<!-- 如果有视频,则显示视频-->
|
||||
<template v-if="item.mp4 && current == index">
|
||||
<video
|
||||
class="ImageVideo"
|
||||
:id="'ImageVideo' + index"
|
||||
:ref="'ImageVideo' + index"
|
||||
:src="item.mp4"
|
||||
:loop="true"
|
||||
:muted="false"
|
||||
:autoplay="current == index ? true : false"
|
||||
:controls="false"
|
||||
:show-fullscreen-btn="false"
|
||||
:show-play-btn="false"
|
||||
:enable-progress-gesture="false"
|
||||
:play-strategy="0"
|
||||
:poster="item.image || item.src"
|
||||
></video>
|
||||
</template>
|
||||
<!-- 否则显示图片 -->
|
||||
<image v-else :src="item.image || item.src" class="Image" mode="aspectFill" @click.stop="$emit('on-click', item)"></image>
|
||||
</swiper-item>
|
||||
<!-- 如果有视频,则显示视频-->
|
||||
<template v-if="item.mp4 && current == index">
|
||||
<video class="ImageVideo" :id="'ImageVideo' + index" :ref="'ImageVideo' + index"
|
||||
:src="item.mp4" :loop="true" :muted="false" :autoplay="current == index ? true : false"
|
||||
:controls="false" :show-fullscreen-btn="false" :show-play-btn="false"
|
||||
:enable-progress-gesture="false" :play-strategy="0"
|
||||
:poster="item.image || item.src"></video>
|
||||
</template>
|
||||
<!-- 否则显示图片 -->
|
||||
<image v-else :src="item.image || item.src" class="Image" mode="aspectFill"
|
||||
@click.stop="$emit('on-click', item)"></image>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
<!-- 指示器 [Top] -->
|
||||
<view v-if="useTop" class="Swiper-indicator-box indicator-Top-box">
|
||||
@@ -59,7 +43,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="right-hot-ttf">
|
||||
<text class="text hot-text">{{ title }}</text>
|
||||
<text class="text hot-text text-overflow-2">{{ title }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -79,17 +63,20 @@
|
||||
</view>
|
||||
<!-- 标题 -->
|
||||
<view class="Top-Title">
|
||||
<text class="text title-text">{{ item.title }}</text>
|
||||
<text class="text title-text text-overflow-2">{{ item.title }}</text>
|
||||
</view>
|
||||
<!-- 用户信息 -->
|
||||
<view class="Bottom-UserInfo">
|
||||
<view v-if="false" class="Bottom-UserInfo">
|
||||
<!-- 头像 -->
|
||||
<view class="UserImage-box"><image :src="item.avatar" class="Image" mode="aspectFill"></image></view>
|
||||
<view class="UserImage-box">
|
||||
<image :src="item.avatar" class="Image" mode="aspectFill"></image>
|
||||
</view>
|
||||
<!-- 用户名 -->
|
||||
<view class="textbox UserName-box">
|
||||
<text class="text UserInfo">{{ item.nickname }}</text>
|
||||
</view>
|
||||
<view v-if="item.createTime" class="jiange-box"><text class="text jiange-text"></text></view>
|
||||
<view v-if="item.createTime" class="jiange-box"><text class="text jiange-text"></text>
|
||||
</view>
|
||||
<view v-if="item.createTime" class="textbox UserGPS-box">
|
||||
<text class="text UserInfo">发布于 {{ item.createTime }}</text>
|
||||
</view>
|
||||
@@ -106,18 +93,14 @@
|
||||
<!-- 左边 -->
|
||||
<view class="Bottom-left-Imagelist">
|
||||
<block v-for="(item, index) in list" :key="index">
|
||||
<view
|
||||
class="Bottom-item"
|
||||
v-if="Number(index) <= (dotPosition == 'right' ? 3 : 4)"
|
||||
:class="currentIndex == index ? 'current' : 'no'"
|
||||
@click="SwiperIndTap(index)"
|
||||
>
|
||||
<view class="Bottom-item" v-if="Number(index) <= 4"
|
||||
:class="currentIndex == index ? 'current' : 'no'" @click="SwiperIndTap(index)">
|
||||
<image :src="item.image || item.src" class="Image" mode="aspectFill"></image>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<!-- 右边 -->
|
||||
<view class="Bottom-right-lili-btn">
|
||||
<view v-if="false" class="Bottom-right-lili-btn">
|
||||
<view class="Bottom-item is-more">
|
||||
<view class="more" @click.stop="$emit('on-more')">
|
||||
MORE
|
||||
@@ -132,102 +115,106 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'e-swiper',
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '450rpx'
|
||||
},
|
||||
dotPosition: {
|
||||
type: String,
|
||||
default: 'bottom'
|
||||
},
|
||||
useTop: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
useDot: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
useTitle: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
useUser: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 轮播图 数据列表
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
// 当前选中的项(指示器坐标位置)
|
||||
current: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
// 是否自动轮播
|
||||
autoplay: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 是否禁止用户 touch 操作
|
||||
currentIndex: 0,
|
||||
disable_touch: false, //touch 用户划动引起swiper变化。
|
||||
date: {
|
||||
year: '-',
|
||||
monthEn: '-',
|
||||
month: '-'
|
||||
export default {
|
||||
name: 'e-swiper',
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '450rpx'
|
||||
},
|
||||
dotPosition: {
|
||||
type: String,
|
||||
default: 'bottom'
|
||||
},
|
||||
useTop: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
useDot: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
useTitle: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
useUser: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 轮播图 数据列表
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
// 当前选中的项(指示器坐标位置)
|
||||
current: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
// 是否自动轮播
|
||||
autoplay: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.currentIndex = this.current;
|
||||
const date = new Date();
|
||||
//将月份名称存储在数组中
|
||||
const monthArray = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 是否禁止用户 touch 操作
|
||||
currentIndex: 0,
|
||||
disable_touch: false, //touch 用户划动引起swiper变化。
|
||||
date: {
|
||||
year: '-',
|
||||
monthEn: '-',
|
||||
month: '-'
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.currentIndex = this.current;
|
||||
const date = new Date();
|
||||
//将月份名称存储在数组中
|
||||
const monthArray = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov',
|
||||
'Dec');
|
||||
|
||||
this.date.year = date.getFullYear();
|
||||
let month = date.getMonth() + 1;
|
||||
this.date.month = month < 10 ? '0' + month : month;
|
||||
this.date.monthEn = monthArray[date.getMonth()].toUpperCase();
|
||||
},
|
||||
methods: {
|
||||
// current 改变时会触发 change 事件,event.detail = {current: current, source: source}
|
||||
change(e) {
|
||||
let { current, source } = e.detail;
|
||||
//只有页面自动切换,手动切换时才轮播,其他不允许
|
||||
if (source === 'autoplay' || source === 'touch') {
|
||||
this.date.year = date.getFullYear();
|
||||
let month = date.getMonth() + 1;
|
||||
this.date.month = month < 10 ? '0' + month : month;
|
||||
this.date.monthEn = monthArray[date.getMonth()].toUpperCase();
|
||||
},
|
||||
methods: {
|
||||
// current 改变时会触发 change 事件,event.detail = {current: current, source: source}
|
||||
change(e) {
|
||||
let {
|
||||
current,
|
||||
source
|
||||
} = e.detail;
|
||||
//只有页面自动切换,手动切换时才轮播,其他不允许
|
||||
if (source === 'autoplay' || source === 'touch') {
|
||||
let event = {
|
||||
current: current
|
||||
};
|
||||
this.currentIndex = current;
|
||||
this.$emit('change', event);
|
||||
}
|
||||
},
|
||||
// 手动点击了指示器[小图模式]
|
||||
SwiperIndTap(e) {
|
||||
let index = e;
|
||||
let event = {
|
||||
current: current
|
||||
current: index
|
||||
};
|
||||
this.currentIndex = current;
|
||||
this.currentIndex = index;
|
||||
this.$emit('change', event);
|
||||
}
|
||||
},
|
||||
// 手动点击了指示器[小图模式]
|
||||
SwiperIndTap(e) {
|
||||
let index = e;
|
||||
let event = {
|
||||
current: index
|
||||
};
|
||||
this.currentIndex = index;
|
||||
this.$emit('change', event);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './e-swiper.scss';
|
||||
@import './e-swiper.scss';
|
||||
</style>
|
||||
|
||||
@@ -1,177 +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().getBlogger;
|
||||
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>
|
||||
@@ -0,0 +1,93 @@
|
||||
<template>
|
||||
<tm-poup v-model="isShow" width="80vw" height="800rpx" position="center" :round="6" @change="fnOnChange">
|
||||
<view class="fulled pa-4">
|
||||
<view class="mt-24 fulled text-weight-b text-size-sm text-align-center text-overflow-2 pb-24">{{ title }}</view>
|
||||
<view class="fulled mt-2">
|
||||
<scroll-view class="fulled" scroll-y :style="{
|
||||
height: url? '600rpx': '680rpx'
|
||||
}">
|
||||
<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="content" :markdown="true" :showLineNumber="true" :showLanguageName="true"
|
||||
:copyByLongPress="true"/>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view v-if="url" class="fulled mt-12 flex flex-center">
|
||||
<tm-button theme="bg-gradient-light-blue-accent" size="m" @click="fnToWebview()">
|
||||
点击跳转内容链接
|
||||
</tm-button>
|
||||
</view>
|
||||
</view>
|
||||
</tm-poup>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue';
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
||||
|
||||
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
||||
|
||||
export default {
|
||||
name: 'notify-dialog',
|
||||
components: {
|
||||
tmPoup,
|
||||
tmButton,
|
||||
mpHtml
|
||||
},
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
content: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isShow: false,
|
||||
markdownConfig: MarkdownConfig,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.isShow = this.show;
|
||||
},
|
||||
methods: {
|
||||
fnToWebview() {
|
||||
if (this.$utils.checkIsUrl(this.url)) {
|
||||
uni.navigateTo({
|
||||
url: '/pagesC/website/website?data=' +
|
||||
JSON.stringify({
|
||||
title: this.title,
|
||||
url: encodeURIComponent(this.url)
|
||||
}),
|
||||
success: () => {
|
||||
this.fnOnChange(false)
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
fnOnChange(e) {
|
||||
this.isShow = false;
|
||||
this.$emit('on-change', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<view v-if="pluginInfo" class="plugin-unavailable flex flex-col flex-center"
|
||||
:class="{border:useBorder,'decoration':useDecoration}" :style="[calcCustomStyle]">
|
||||
<!-- 图标 -->
|
||||
<image class="plugin-logo" :src="pluginInfo.logo" mode="scaleToFill"></image>
|
||||
<!-- 名称 -->
|
||||
<view class="plugin-name">
|
||||
{{ pluginInfo.name }}
|
||||
</view>
|
||||
<view class="plugin-error">
|
||||
未安装/启用插件
|
||||
</view>
|
||||
<!-- 描述 -->
|
||||
<view class="plugin-desc">
|
||||
{{ pluginInfo.desc }}
|
||||
</view>
|
||||
<view v-if="errorText" class="plugin-tip">
|
||||
{{errorText}}
|
||||
</view>
|
||||
<!-- 插件地址 -->
|
||||
<view class="plugin-url">
|
||||
插件地址:{{ pluginInfo.url }}
|
||||
</view>
|
||||
<!-- 反馈按钮/复制地址 -->
|
||||
<view class="plugin-btns w-full flex-center">
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<tm-button theme="light-blue" :block="true" class="w-full" :height="70" @click="copy">复制地址</tm-button>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<tm-button theme="light-blue" plan text :height="70" @click="copy">复制地址</tm-button>
|
||||
<tm-button theme="light-blue" open-type="contact" :height="70">提交反馈</tm-button>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
|
||||
<view class="plugin-copyright">
|
||||
提示:请确保 Halo 博客已安装相关插件
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
NeedPluginIds,
|
||||
NeedPlugins,
|
||||
CheckNeedPluginAvailable
|
||||
} from "@/utils/plugin.js"
|
||||
import utils from '@/utils/index.js'
|
||||
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
|
||||
export default {
|
||||
name: "plugin-unavailable",
|
||||
components: {
|
||||
tmButton
|
||||
},
|
||||
props: {
|
||||
pluginId: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
errorText: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
useDecoration: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
useBorder: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
customStyle: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
NeedPluginIds,
|
||||
NeedPlugins,
|
||||
pluginInfo: null,
|
||||
defaultStyle: {
|
||||
width: "80vw",
|
||||
borderRadius: "24rpx"
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
calcCustomStyle() {
|
||||
const style = this.customStyle ?? {}
|
||||
return {
|
||||
...this.defaultStyle,
|
||||
...style
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
pluginId: {
|
||||
deep: true,
|
||||
immediate: true,
|
||||
handler(newVal, oldVal) {
|
||||
this.pluginInfo = NeedPlugins.get(newVal)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
copy() {
|
||||
utils.copyText(this.pluginInfo.url, "插件地址已复制")
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.plugin-unavailable {
|
||||
box-sizing: border-box;
|
||||
margin: auto;
|
||||
padding: 100rpx 36rpx;
|
||||
gap: 24rpx;
|
||||
font-size: 28rpx;
|
||||
|
||||
&.border {
|
||||
// border: 2rpx solid #E2E8F0;
|
||||
border: 2rpx solid #eee;
|
||||
}
|
||||
|
||||
&.decoration {
|
||||
background-color: rgba(255, 255, 255, 0.95);
|
||||
box-shadow: 0 0 12rpx rgba(226, 232, 240, 0.35);
|
||||
backdrop-filter: blur(6rpx);
|
||||
border-top: 12rpx solid rgba(3, 169, 244, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.plugin-logo {
|
||||
box-sizing: border-box;
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 24rpx;
|
||||
}
|
||||
|
||||
.plugin-name {
|
||||
box-sizing: border-box;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.plugin-error {
|
||||
box-sizing: border-box;
|
||||
padding: 6rpx 16rpx;
|
||||
border-radius: 36rpx;
|
||||
background-color: rgba(255, 61, 49, 0.075);
|
||||
color: rgba(255, 61, 49, 1);
|
||||
font-size: 24rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.plugin-tip {
|
||||
box-sizing: border-box;
|
||||
padding: 10rpx 20rpx;
|
||||
border-radius: 12rpx;
|
||||
border: 2rpx dashed #f2c97d;
|
||||
color: #f0a020;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.plugin-desc {
|
||||
box-sizing: border-box;
|
||||
width: 60vw;
|
||||
font-size: 24rpx;
|
||||
text-align: center;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.plugin-url {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 16rpx 24rpx;
|
||||
border-radius: 12rpx;
|
||||
background-color: #F1F5F9;
|
||||
color: #666;
|
||||
font-size: 24rpx;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.plugin-btns {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.plugin-copyright {
|
||||
font-size: 20rpx;
|
||||
color: #999;
|
||||
transform: scale(0.9) translateY(20px);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,243 @@
|
||||
<script>
|
||||
export default {
|
||||
name: 'restrict-read-skeleton',
|
||||
props: {
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
hover: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
buttonText: {
|
||||
type: String,
|
||||
default: '刷新'
|
||||
},
|
||||
buttonColor: {
|
||||
type: String,
|
||||
default: '#07c160'
|
||||
},
|
||||
buttonSize: {
|
||||
type: String,
|
||||
default: 'normal', // 'small', 'normal', 'large'
|
||||
validator: value => ['small', 'normal', 'large'].includes(value)
|
||||
},
|
||||
lines: {
|
||||
type: Number,
|
||||
default: 4,
|
||||
validator: value => value >= 1 && value <= 6
|
||||
},
|
||||
skeletonColor: {
|
||||
type: String,
|
||||
default: '#f5f5f5'
|
||||
},
|
||||
skeletonHighlight: {
|
||||
type: String,
|
||||
default: '#e8e8e8'
|
||||
},
|
||||
animationDuration: {
|
||||
type: Number,
|
||||
default: 1.5
|
||||
},
|
||||
showButton: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
tipText: {
|
||||
type: String,
|
||||
default: '' // 默认不显示提示文字
|
||||
},
|
||||
tipColor: {
|
||||
type: String,
|
||||
default: '#666666' // 提示文字颜色
|
||||
},
|
||||
tipSize: {
|
||||
type: Number,
|
||||
default: 24 // 提示文字大小,单位rpx
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleRefresh() {
|
||||
this.$emit('refresh');
|
||||
},
|
||||
onTouchStart() {
|
||||
this.$emit('touchstart');
|
||||
},
|
||||
onTouchEnd() {
|
||||
this.$emit('touchend');
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 骨架屏容器 -->
|
||||
<view class="container">
|
||||
<!-- 骨架屏内容 -->
|
||||
<view class="skeleton" v-if="loading">
|
||||
<!-- 内容区域 -->
|
||||
<view class="skeleton-body">
|
||||
<view
|
||||
v-for="(item, index) in Array(lines).fill(0)"
|
||||
:key="index"
|
||||
class="skeleton-line"
|
||||
:class="{
|
||||
'short': index === lines - 2,
|
||||
'shorter': index === lines - 1
|
||||
}"
|
||||
:style="{
|
||||
background: `linear-gradient(90deg, ${skeletonColor} 25%, ${skeletonHighlight} 50%, ${skeletonColor} 75%)`,
|
||||
animationDuration: `${animationDuration}s`
|
||||
}">
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 实际内容 -->
|
||||
<view v-else>
|
||||
<slot></slot>
|
||||
</view>
|
||||
|
||||
<!-- 提示文字和按钮容器 -->
|
||||
<view v-if="showButton" class="button-container">
|
||||
<!-- 提示文字 -->
|
||||
<text
|
||||
v-if="tipText"
|
||||
class="tip-text"
|
||||
:style="{
|
||||
color: tipColor,
|
||||
fontSize: tipSize + 'rpx'
|
||||
}"
|
||||
>{{ tipText }}</text>
|
||||
|
||||
<!-- 按钮 -->
|
||||
<button
|
||||
class="overlay-button"
|
||||
:class="[buttonSize, { 'button-hover': hover }]"
|
||||
hover-class="none"
|
||||
@touchstart="onTouchStart"
|
||||
@touchend="onTouchEnd"
|
||||
@click="handleRefresh"
|
||||
:style="{ backgroundColor: buttonColor }"
|
||||
>
|
||||
{{ buttonText }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
/* 容器样式 */
|
||||
.container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
min-height: 200rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
}
|
||||
|
||||
/* 骨架屏样式 */
|
||||
.skeleton {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 30rpx;
|
||||
|
||||
&-body {
|
||||
margin: 20rpx 0;
|
||||
}
|
||||
|
||||
&-line {
|
||||
height: 32rpx;
|
||||
background-size: 400% 100%;
|
||||
border-radius: 8rpx;
|
||||
margin-bottom: 20rpx;
|
||||
animation: skeleton-loading 1.5s ease infinite;
|
||||
|
||||
&.short {
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
&.shorter {
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 按钮容器样式 */
|
||||
.button-container {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
/* 提示文字样式 */
|
||||
.tip-text {
|
||||
margin-bottom: 20rpx;
|
||||
text-align: center;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
/* 按钮样式 */
|
||||
.overlay-button {
|
||||
position: relative; // 改为相对定位
|
||||
transform: none; // 移除transform
|
||||
color: white;
|
||||
border-radius: 50rpx;
|
||||
padding: 0 40rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
font-size: 28rpx;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
|
||||
transition: all 0.3s ease;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
|
||||
&:active {
|
||||
transform: scale(0.95); // 简化active状态的transform
|
||||
}
|
||||
|
||||
&.small {
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
font-size: 24rpx;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
&.large {
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
font-size: 32rpx;
|
||||
padding: 0 50rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.button-hover {
|
||||
transform: translateY(-4rpx); // 简化hover状态的transform
|
||||
box-shadow: 0 8rpx 16rpx rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
/* 骨架屏动画 */
|
||||
@keyframes skeleton-loading {
|
||||
0% {
|
||||
background-position: 100% 50%;
|
||||
}
|
||||
100% {
|
||||
background-position: 0 50%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,343 @@
|
||||
<template>
|
||||
<view class="vote-card" @click="$emit('on-click',vote)">
|
||||
<view class="vote-card-head flex">
|
||||
<view class="left flex flex-center w-full">
|
||||
<view class="flex-shrink">
|
||||
<tm-tags v-if="vote.spec.type==='single'" color="light-blue" :shadow="0" rounded size="s"
|
||||
model="fill">单选</tm-tags>
|
||||
<tm-tags v-else-if="vote.spec.type==='multiple'" color="light-blue" :shadow="0" rounded size="s"
|
||||
model="fill">多选</tm-tags>
|
||||
<tm-tags v-else-if="vote.spec.type==='pk'" color="light-blue" :shadow="0" rounded size="s"
|
||||
model="fill">双选PK</tm-tags>
|
||||
</view>
|
||||
<view class="title text-overflow">
|
||||
{{ vote.spec.title }}
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="false" class="flex-shrink right flex flex-end">
|
||||
<tm-tags v-if="vote.spec.hasEnded" color="red" rounded :shadow="0" size="s" model="text">已结束</tm-tags>
|
||||
<tm-tags v-else color="green" rounded size="s" :shadow="0" model="text">进行中</tm-tags>
|
||||
</view>
|
||||
</view>
|
||||
<view class="vote-card-body w-full">
|
||||
|
||||
<view v-if="vote.spec.remark" class="remark text-overflow-2 text-size-s">
|
||||
{{vote.spec.remark}}
|
||||
</view>
|
||||
|
||||
<template v-if="showOptions">
|
||||
<!-- 单选 -->
|
||||
<view v-if="vote.spec.type==='single'" class="single">
|
||||
<tm-groupradio @change="onOptionRadioChange">
|
||||
<tm-radio v-for="(option,optionIndex) in vote.spec.options" :key="optionIndex" dense
|
||||
:disabled="vote.spec.disabled" v-model="option.checked" :extendData="option">
|
||||
<template v-slot:default="{checkData}">
|
||||
<tm-button :shadow="0" :theme="checkData.checked?'light-blue':'grey-lighten-3'"
|
||||
:plan="false" :block="true" class="w-full" size="m" :height="72">
|
||||
<view class="flex flex-between w-full">
|
||||
<text class="text-align-left text-overflow"> {{ checkData.extendData.title }}
|
||||
</text>
|
||||
<text class="flex-shrink"> {{checkData.extendData.percent }}% </text>
|
||||
</view>
|
||||
</tm-button>
|
||||
</template>
|
||||
</tm-radio>
|
||||
</tm-groupradio>
|
||||
</view>
|
||||
|
||||
<!-- 多选 -->
|
||||
<view v-else-if="vote.spec.type==='multiple'" class="multiple">
|
||||
<tm-groupcheckbox @change="onOptionCheckboxChange">
|
||||
<tm-checkbox v-for="(option,optionIndex) in vote.spec.options" :key="optionIndex" dense
|
||||
:disabled="vote.spec.disabled" v-model="option.checked" :extendData="option">
|
||||
<template v-slot:default="{checkData}">
|
||||
<tm-button :shadow="0" :theme="checkData.checked?'light-blue':'grey-lighten-3'"
|
||||
:plan="false" :block="true" class="w-full" size="m" :height="72">
|
||||
<view class="flex flex-between w-full">
|
||||
<text class="text-align-left text-overflow"> {{ checkData.extendData.title }}
|
||||
</text>
|
||||
<text class="flex-shrink"> {{checkData.extendData.percent }}% </text>
|
||||
</view>
|
||||
</tm-button>
|
||||
</template>
|
||||
</tm-checkbox>
|
||||
</tm-groupcheckbox>
|
||||
</view>
|
||||
|
||||
<!-- PK -->
|
||||
<view v-else-if="vote.spec.type==='pk'" class="pk">
|
||||
<tm-groupradio @change="onOptionPkChange">
|
||||
<tm-radio v-for="(option,optionIndex) in vote.spec.options" :key="optionIndex" dense
|
||||
:disabled="vote.spec.disabled" v-model="option.checked" :extendData="option"
|
||||
class="radio-item" :class="[optionIndex==0?'radio-left':'radio-right']"
|
||||
:style="{width:option.percent + '%'}">
|
||||
<template v-slot:default="{checkData}">
|
||||
<view class="option-item"
|
||||
:class="[optionIndex==0?'option-item-left':'option-item-right']">
|
||||
{{checkData.extendData.percent }}%
|
||||
</view>
|
||||
</template>
|
||||
</tm-radio>
|
||||
</tm-groupradio>
|
||||
<view class="option-foot w-full flex flex-between">
|
||||
<view v-for="(option,optionIndex) in vote.spec.options" :key="optionIndex">
|
||||
<view v-if="optionIndex==0" class="left flex-1 flex-shrink text-overflow">
|
||||
{{option.title}}
|
||||
</view>
|
||||
<view v-else class="right flex-1 flex-shrink text-overflow text-align-right">
|
||||
{{option.title}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
<view class="vote-card-foot flex flex-between">
|
||||
<view class="left flex">
|
||||
<tm-tags v-if="vote.spec._state=='已结束'" color="red" size="s" rounded :shadow="0"
|
||||
model="text">已结束</tm-tags>
|
||||
<tm-tags v-else-if="vote.spec._state=='未开始'" color="orange" size="s" rounded :shadow="0"
|
||||
model="text">未开始</tm-tags>
|
||||
<tm-tags v-else-if="vote.spec._state=='进行中'" color="green" size="s" rounded :shadow="0"
|
||||
model="text">进行中</tm-tags>
|
||||
|
||||
<tm-tags v-if="vote.spec.isVoted" color="blue" rounded size="s" model="text">已投票</tm-tags>
|
||||
|
||||
<tm-tags v-if="vote.spec.timeLimit==='permanent'" color="grey-darken-2" rounded size="s"
|
||||
model="text">结束:永久有效 </tm-tags>
|
||||
<tm-tags v-else color="grey-darken-2" rounded size="s" model="text">
|
||||
<template
|
||||
v-if="vote.spec._state=='未开始'">开始:{{ {d: vote.spec.startDate, f: 'yyyy-MM-dd HH:mm'} | formatTime }}
|
||||
</template>
|
||||
<template v-else>结束:{{ {d: vote.spec.endDate, f: 'yyyy-MM-dd HH:mm'} | formatTime }}
|
||||
</template>
|
||||
</tm-tags>
|
||||
</view>
|
||||
|
||||
<view v-if="false" class="right flex flex-end">
|
||||
<tm-tags v-if="false" color="grey-darken-2" rounded size="s" model="text">{{ vote.stats.voteCount }}
|
||||
人已参与</tm-tags>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmGroupradio from '@/tm-vuetify/components/tm-groupradio/tm-groupradio.vue';
|
||||
import tmRadio from '@/tm-vuetify/components/tm-radio/tm-radio.vue';
|
||||
import tmGroupcheckbox from '@/tm-vuetify/components/tm-groupcheckbox/tm-groupcheckbox.vue';
|
||||
import tmCheckbox from '@/tm-vuetify/components/tm-checkbox/tm-checkbox.vue';
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
|
||||
export default {
|
||||
name: "VoteCard",
|
||||
options: {
|
||||
virtualHost: true,
|
||||
styleIsolation: 'shared'
|
||||
},
|
||||
components: {
|
||||
tmGroupradio,
|
||||
tmRadio,
|
||||
tmGroupcheckbox,
|
||||
tmCheckbox,
|
||||
tmButton,
|
||||
tmTags
|
||||
},
|
||||
props: {
|
||||
vote: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
index: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
showOptions: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onOptionRadioChange(e) {
|
||||
console.log("onOptionRadioChange", e)
|
||||
},
|
||||
onOptionCheckboxChange(e) {
|
||||
console.log("onOptionCheckboxChange", e)
|
||||
},
|
||||
onOptionPkChange(e) {
|
||||
console.log("onOptionPkChange", e)
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.w-full {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.wp-50 {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.vote-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
margin: 0 24rpx;
|
||||
padding: 24rpx;
|
||||
border-radius: 12rpx;
|
||||
background-color: #ffff;
|
||||
box-shadow: 0rpx 2rpx 12rpx rgba(0, 0, 0, 0.035);
|
||||
overflow: hidden;
|
||||
margin-bottom: 24rpx;
|
||||
// border: 1px solid #eee;
|
||||
}
|
||||
|
||||
.vote-card-head {
|
||||
margin-bottom: 12rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.left {
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.vote-card-body {
|
||||
|
||||
.remark {
|
||||
box-sizing: border-box;
|
||||
padding-top: 0;
|
||||
color: rgba(0, 0, 0, 0.75);
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.vote-card-foot {
|
||||
box-sizing: border-box;
|
||||
padding-top: 6px;
|
||||
margin-top: 6px;
|
||||
border-top: 2rpx solid #F7F7F7;
|
||||
|
||||
.left {}
|
||||
}
|
||||
|
||||
|
||||
.single {
|
||||
::v-deep {
|
||||
.tm-groupradio {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12rpx 0;
|
||||
}
|
||||
|
||||
.tm-checkbox {
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
padding: 0 12rpx;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.tm-button-label {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.multiple {
|
||||
::v-deep {
|
||||
.tm-groupcheckbox {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12rpx 0;
|
||||
}
|
||||
|
||||
.tm-checkbox {
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
padding: 0 12rpx;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.tm-button-label {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.pk {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding: 0 12rpx;
|
||||
|
||||
::v-deep {
|
||||
.tm-groupradio {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.tm-checkbox {
|
||||
flex-grow: 1;
|
||||
min-width: 30% !important;
|
||||
max-width: 70% !important;
|
||||
}
|
||||
|
||||
.radio-item {
|
||||
position: relative;
|
||||
|
||||
.selected {
|
||||
z-index: 10;
|
||||
}
|
||||
}
|
||||
|
||||
.radio-left {}
|
||||
|
||||
.radio-right {}
|
||||
|
||||
.option-item {
|
||||
width: 100%;
|
||||
padding: 12rpx 24rpx;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.option-item-left {
|
||||
background: linear-gradient(90deg, #3B82F6, #60A5FA);
|
||||
color: white;
|
||||
clip-path: polygon(0 0, calc(100% - 40rpx) 0, 100% 100%, 0 100%);
|
||||
}
|
||||
|
||||
.option-item-right {
|
||||
background: linear-gradient(90deg, #F87171, #EF4444);
|
||||
color: white;
|
||||
clip-path: polygon(0 0, 100% 0, 100% 100%, 40rpx 100%);
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.option-foot {
|
||||
width: 100%;
|
||||
margin-top: 6rpx;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
|
||||
.left {
|
||||
box-sizing: border-box;
|
||||
padding-right: 24rpx;
|
||||
}
|
||||
|
||||
.right {
|
||||
box-sizing: border-box;
|
||||
padding-left: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* 广告配置
|
||||
*/
|
||||
export default {
|
||||
adpid: '', // uni-AD App广告位id,在uni-AD官网申请广告位
|
||||
unitId: '', // 广告单元id,可在小程序管理后台的流量主模块新建 (非个人资质,小程序后台广告主开通申请)
|
||||
frequency: 8, // 列表中,广告出现的频率(8=每8条数据出现一次广告)
|
||||
// 首页广告
|
||||
home: {
|
||||
use: false,
|
||||
},
|
||||
// 文章列表广告
|
||||
articles: {
|
||||
use: false,
|
||||
},
|
||||
// 文章详情广告
|
||||
articleDetail: {
|
||||
// 微信广告/dclound申请的广告
|
||||
use: true,
|
||||
|
||||
// 自定义广告
|
||||
custom: {
|
||||
use: true,
|
||||
cover: 'https://b.925i.cn/uni_halo/uni_halo_ad_cover.png',
|
||||
title: 'uni-halo 正式开源啦,欢迎来使用和体验!',
|
||||
content: '基于 uni-app + halo1.x API 实现一款现代化的开源博客 / CMS 系统API开发的多端应用。功能包括:前台博客系统 和 后台管理系统,同时满足浏览和管理两端合一的需求,真正实现一个应用实现博客浏览和后台管理。',
|
||||
url: 'https://uni-halo.925i.cn'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
/**
|
||||
* 功能:基础配置
|
||||
* 作者:小莫唐尼
|
||||
* 邮箱:studio@925i.cn
|
||||
* 时间:2022年08月23日 15:19:14
|
||||
* 版本:v0.1.0
|
||||
* 修改记录:
|
||||
* 修改内容:
|
||||
* 修改人员:
|
||||
* 修改时间:
|
||||
*/
|
||||
export default {
|
||||
showCopyright: true, // 显示开源版权信息
|
||||
showAbout: true, // 显示关于项目入口
|
||||
uni_halo_logo: 'https://b.925i.cn/uni_halo/uni_halo_logo.png', // uni-halo的logo
|
||||
|
||||
apiUrl: '', // Api基础域名 [必填] :你的Halo博客基础域名
|
||||
apiAuthorization: '', // Api认证key [必填]: Halo中-系统-博客设置-切换到高级选项-API设置-Access key
|
||||
|
||||
title: '', // 博客标题 [建议必填]:在某些页面没有设置具体的页面名称时候,使用该值显示
|
||||
miniCodeImageUrl: '', // 小程序的太阳码/二维码的图片地址 [建议必填]
|
||||
|
||||
aboutProfileImageUrl: '', // 关于页面中的资料卡背景图 [建议必填]
|
||||
|
||||
// 启动页面的配置(页面地址`/pagesA/start/start`)
|
||||
start: {
|
||||
use: true, // 是否使用首次启动页:用户第一次使用你的应用会显示否则不显示
|
||||
title: 'uni-halo', // 启动页面中的文字标题
|
||||
bg: '', // 留空则使用默认 开屏首页背景,可以是颜色值或者图片图片地址
|
||||
logo: 'https://b.925i.cn/uni_halo/uni_halo_logo.png', // logo
|
||||
desc1: '全新UI,准备出发', // 描述信息1
|
||||
desc2: '新触动 新感受 新体验', // 描述信息2
|
||||
btnText: '全新触发' // 按钮文字
|
||||
},
|
||||
|
||||
// 博主信息
|
||||
author: {
|
||||
use: true, // 是否启用这里配置的信息,不启用则获取PC端博客设置的信息
|
||||
nickname: '', // 昵称
|
||||
avatar: '', // 头像
|
||||
email: '', // 邮箱
|
||||
description: '', // 介绍
|
||||
},
|
||||
|
||||
// 版权信息(用于文章详情)
|
||||
copyright: {
|
||||
use: true, // 是否使用版权描述
|
||||
author: '', // 版权归属说明
|
||||
description: '', // 版权描述
|
||||
violation: '', // 侵权处理说明
|
||||
},
|
||||
|
||||
// 社交信息(将会在`/pagesA/contact/contact`页面中展示)
|
||||
// 具体的某个参数值留空则不展示
|
||||
social: {
|
||||
qq: "", // qq号
|
||||
wechat: "", // 微信号
|
||||
weibo: "", // 微博地址
|
||||
email: "", // 邮箱地址
|
||||
blog: "", // 博客地址
|
||||
juejin: "", // 掘金地址
|
||||
bilibili: "", // b站地址
|
||||
gitee: "", // gitee地址
|
||||
github: "", // github地址
|
||||
csdn: "" // CSDN地址
|
||||
},
|
||||
|
||||
defaultThumbnailUrl: '', // 默认封面图地址
|
||||
defaultStaticThumbnailUrl: '', // 静态默认封面图(不可以是随机图地址)
|
||||
defaultImageUrl: '', // 默认图片地址
|
||||
defaultAvatarUrl: '', // 默认头像地址
|
||||
|
||||
loadingGifUrl: '', // 图片加载中的地址
|
||||
loadingErrUrl: '', // 图片加载失败的地址
|
||||
loadingEmptyUrl: '', // 加载图片为空地址
|
||||
|
||||
waveImageUrl: '', // 关于页面波浪图片
|
||||
|
||||
banner: { // 轮播图配置
|
||||
type: 'article', // 轮播图数据源 list=下方配置 article=热门文章封面
|
||||
list: [],
|
||||
},
|
||||
|
||||
quickNav: { // 快捷导航配置(如不需要恋爱日记,请注释或删除94-101行的代码)
|
||||
use: true, // 是否在个人中心显示以下页面的入口
|
||||
list: [{
|
||||
icon: 'halocoloricon-classify',
|
||||
text: '文章归档',
|
||||
iconSize: 60,
|
||||
color: 'blue',
|
||||
type: 'page',
|
||||
path: '/pagesA/archives/archives'
|
||||
},
|
||||
{
|
||||
icon: 'halocoloricon-attent',
|
||||
text: '恋爱日记',
|
||||
iconSize: 60,
|
||||
color: 'blue',
|
||||
type: 'page',
|
||||
path: '/pagesA/love/love'
|
||||
},
|
||||
{
|
||||
icon: 'halocoloricon-calendar',
|
||||
text: '个人日记',
|
||||
iconSize: 60,
|
||||
color: 'blue',
|
||||
type: 'page',
|
||||
path: '/pagesA/journal/journal'
|
||||
},
|
||||
{
|
||||
icon: 'halocoloricon-message',
|
||||
text: '留言板',
|
||||
iconSize: 60,
|
||||
color: 'blue',
|
||||
type: 'page',
|
||||
path: '/pagesA/leaving/leaving'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// 微信分享信息
|
||||
wxShareConfig: {
|
||||
title: '', // 小程序分享标题[非必填]
|
||||
desc: '', // 小程序分享描述[非必填]
|
||||
imageUrl: '', // 小程序分享时候图片地址[非必填]
|
||||
path: '/pages/index/index', // 分享路径[非必填] - 基本不需要修改
|
||||
copyLink: '/pages/index/index', // 复制链接[非必填] - 基本不需要修改
|
||||
query: {}, // 分享参数[非必填] - 基本不需要填写
|
||||
},
|
||||
|
||||
colors: [
|
||||
'#39B449',
|
||||
'#E44C41',
|
||||
'#8698A2',
|
||||
'#0080FE',
|
||||
'#1CBCB4',
|
||||
'#6638B5',
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
// 应用设置存储key值
|
||||
export const _AppConfigKey = 'APP_GLOBAL_CONFIGS';
|
||||
export const _AppMockJsonKey = 'APP_GLOBAL_MOCK_JSON';
|
||||
|
||||
// 默认的应用设置
|
||||
export const DefaultAppConfigs = {
|
||||
basicConfig: {
|
||||
tokenConfig: {
|
||||
personalToken: "",
|
||||
}
|
||||
},
|
||||
loveConfig: {},
|
||||
imagesConfig: {},
|
||||
authorConfig: {},
|
||||
appConfig: {},
|
||||
pluginConfig: {
|
||||
toolsPlugin: {},
|
||||
linksSubmitPlugin: {},
|
||||
},
|
||||
pageConfig: {
|
||||
homeConfig: {
|
||||
pageTitle: "首页",
|
||||
useCategory: true,
|
||||
bannerConfig: {
|
||||
enabled: true,
|
||||
showTitle: true,
|
||||
showIndicator: true,
|
||||
height: "400rpx",
|
||||
dotPosition: "right",
|
||||
type: "post",
|
||||
list: []
|
||||
}
|
||||
},
|
||||
categoryConfig: {
|
||||
type: "list"
|
||||
},
|
||||
momentConfig: {
|
||||
useTagRandomColor: true
|
||||
}
|
||||
},
|
||||
auditConfig: {
|
||||
auditModeEnabled: false,
|
||||
auditModeData: {
|
||||
jsonUrl: "",
|
||||
jsonData: ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取应用设置
|
||||
*/
|
||||
export const getAppConfigs = () => {
|
||||
let configs = uni.getStorageSync(_AppConfigKey)
|
||||
if (configs) return JSON.parse(configs)
|
||||
|
||||
uni.setStorageSync(_AppConfigKey, JSON.stringify(DefaultAppConfigs))
|
||||
return DefaultAppConfigs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存应用设置
|
||||
*/
|
||||
export const setAppConfigs = (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))
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* 配置key
|
||||
*/
|
||||
|
||||
export default {
|
||||
SHEET_LEAVING: 'leaving', // 留言板
|
||||
}
|
||||
@@ -1,148 +0,0 @@
|
||||
/**
|
||||
* 恋爱日记配置
|
||||
*/
|
||||
export default {
|
||||
waveImageUrl: 'https://b.925i.cn/uni_halo/uni_halo_about_wave.gif', // 波浪图片地址
|
||||
bgImageUrl: 'https://b.925i.cn/uni_halo_love/love_bg1.png', // 背景图片
|
||||
loveImageUrl: 'https://b.925i.cn/uni_halo_love/like.png', // 爱心图片
|
||||
|
||||
boy: {
|
||||
name: '未知男主',
|
||||
avatar: 'https://b.925i.cn/uni_halo_love/love_boy.png',
|
||||
birthday: '2022-09-25', // 生日
|
||||
},
|
||||
|
||||
girl: {
|
||||
name: '未知女主',
|
||||
avatar: 'https://b.925i.cn/uni_halo_love/love_girl.png',
|
||||
birthday: '2022-04-19', // 生日
|
||||
},
|
||||
timeTitle: '这是我们一起走过的',
|
||||
loveStartDate: '2022-04-10 13:14:20', // 恋爱开始时间
|
||||
|
||||
nav: [{
|
||||
key: 'journey',
|
||||
use: true,
|
||||
iconImageUrl: 'https://b.925i.cn/uni_halo_love/diandian.png',
|
||||
title: '关于我们',
|
||||
desc: '我们一起度过的那些经历'
|
||||
},
|
||||
{
|
||||
key: 'album',
|
||||
use: true,
|
||||
iconImageUrl: 'https://b.925i.cn/uni_halo_love/diandian.png',
|
||||
title: '恋爱相册',
|
||||
desc: '定格了我们的那些小美好'
|
||||
},
|
||||
{
|
||||
key: 'list',
|
||||
use: true,
|
||||
iconImageUrl: 'https://b.925i.cn/uni_halo_love/diandian.png',
|
||||
title: '恋爱清单',
|
||||
desc: '你我之间的约定我们都在努力实现'
|
||||
},
|
||||
],
|
||||
|
||||
// 关于我们:支持富文本内容
|
||||
journey: `
|
||||
准备晚安啦,睡觉前讲个故事吧~<p>槐树庄的村口有一棵大槐树,树下的村口第一家就是猫奶奶的家。</p><p>猫奶奶是一位孤寡老人,因为她经常收留和救治周围的流浪猫,所以村民就都管她叫“猫奶奶”。</p><p>一个月圆之夜,猫奶奶走到院门口,忽然发现门口石级上放着一个红毯子,里面包着一个啼(tí)哭的女婴。</p><p>猫奶奶找不到女婴的父母,只好收留了她,并给她起了个名字叫樱红。</p><p>猫奶奶辛苦地抚育着樱红成长,转眼之间,樱红已经九岁,上小学三年级了。</p><p>从樱红懂事起,猫奶奶就爱给她讲一个睡前故事,那是当地一个古老的传说。</p><p>在浓郁的树影深处有一个百花园,百花园里生长着奇花异草,还住了一个会唱歌的花仙子。花仙子的歌声美丽动人,能治百病。但是那里有一条奇怪的规矩,寻找花仙子的人在进入百花园后,见到花仙子之前,都不能发出一点声音,不然花仙子就不会出来见他。</p><p>受这个故事的影响,樱红特别喜欢唱歌。</p><p>这天晚上,樱红放学回家,家家户户炊烟袅(niǎo)袅,而自家烟囱却连一丝一缕(lǚ)的炊烟都没有。</p><p>樱红一惊,冲进院门一看,果然出事了!只见猫奶奶呻吟着倒在灶台前,双目紧闭,两只小脚也在不停地抽搐(chù)。</p><p>樱红慌了,好在有邻居的帮助,猫奶奶被送到了医院。经过抢救,猫奶奶总算醒过来,但是却半身不遂(suí),说话也不利落了。</p><p>猫奶奶不能下地行走做家务,小小的樱红,一夜之间就挑起了家庭的重担。</p><p>樱红一面求助于村委会,四处寻医问药,让猫奶奶获得进一步的治疗;一面在课余学做家务,悉心照顾猫奶奶,端水喂饭,不辞辛苦。</p><p>自从猫奶奶病倒以后,樱红每天早晨推开院门就会看见门前放着一朵小花,有时还会有一两尾鲜活的鲑(guī)鱼。</p><p>这样过了三个月,好奇的樱红在一个夜晚悄悄躲在院门的后面,想看看到底是谁。</p><p>到了午夜十二点,只见一只花猫衔着一棵风铃草来到院门前,把风铃草放下,转身就走。(浪漫童话小故事)樱红认出这只小花猫曾经被猫奶奶救助过,于是,她悄悄地尾随小花猫往前走。</p><p>不一会儿,她就发现自己进入了一个从未见过的世界:蔚蓝的天空飘着七色的云,阳光千丝万缕地落下来,鲜花盛开,彩蝶飞舞,百鸟齐鸣。</p><p>这到底是什么地方?她忽然想起了那个传说,这该不会就是花仙子住的百花园吧?</p><p>樱红几乎惊叫起来,但她立即想起了那条在见到花仙子之前,不能发出一点声音的规矩。于是她捂紧了嘴巴。</p><p>这时,她发现百花园里除了自己还有一个面色苍白的男孩子,闭着眼睛,右手攥着一根竹竿摸索着前行,应该是眼睛看不见了。</p><p>只见男孩子慢慢地偏离了路径,马上就要掉进路边的水沟里了。</p><p>樱红下意识地大声呼喊:“站住,小心脚底下!”一张口,樱红才想起来,自己已经坏了规矩!</p><p>此时,“轰隆”一声巨响后,眼前的一切都消失了,樱红仍然站在自家院门前的大槐树下。</p><p>真遗憾啊!樱红深深叹了口气,可为了救人,她并不觉得后悔。</p><p>第二天早上,樱红被一种美妙的歌声唤醒。</p><p>唱歌的人就是美丽的花仙子,她乘坐着奇花异草编成的花篮,飘进了她家的院子里。</p><p>奇迹发生了,只见猫奶奶起身下床,像健康人一样走出房门。</p><p>猫奶奶看到了花仙子,不敢相信地揉着眼睛说:“你就是传说中的花仙子吗?是你治好了我的病?”</p><p>花仙子说:“是的!是这个小女孩的善良打动了我,连我那不能出声的规矩都要为她破例了。”</p><p>樱红高兴地看着猫奶奶。从此,她和猫奶奶继续幸福地生活着。</p>
|
||||
`,
|
||||
// 恋爱相册
|
||||
albumKeyName: '恋爱相册', // 对应后台的图库分组名称
|
||||
// 恋爱清单
|
||||
loveList: {
|
||||
useApi: false, // 是否启用api接口
|
||||
api: '', // api 接口(如果使用api接口的方式,则下方的data可以留空,但是api接口必须按照对应的数据格式返回)
|
||||
data: [{
|
||||
index: 0, // 序号
|
||||
finish: true, // 是否已完成
|
||||
title: '偷偷记录对方熟睡的模样', // 事件名称
|
||||
desc: '偷偷观察对方熟睡的模样,记录下来', // 事件描述
|
||||
detail: {
|
||||
start: '2022年05月20日', // 计划开始时间
|
||||
desc: '偷偷观察对方熟睡的模样,记录下来', // 事件详细描述
|
||||
end: '每天', // 完成时间,
|
||||
moment: '', // 完成瞬间的记录
|
||||
other: '', // 其他说明
|
||||
}
|
||||
}, {
|
||||
index: 1,
|
||||
finish: false,
|
||||
title: '陪对方过生日',
|
||||
desc: '陪对方一起过生日',
|
||||
detail: {
|
||||
start: '2023年05月20日',
|
||||
desc: '陪对方一起过生日,他和我的生日',
|
||||
end: '',
|
||||
moment: '',
|
||||
other: '他 生日5月20日 我生日9月25日',
|
||||
}
|
||||
},
|
||||
{
|
||||
index: 2,
|
||||
finish: false,
|
||||
title: '一起去旅行',
|
||||
desc: '一起来一场说走就走的旅行,希望去的是大理',
|
||||
detail: {
|
||||
start: '',
|
||||
desc: '',
|
||||
end: '',
|
||||
moment: '一起来一场说走就走的旅行,希望去的是大理',
|
||||
other: '',
|
||||
}
|
||||
},
|
||||
{
|
||||
index: 3,
|
||||
finish: false,
|
||||
title: '一起穿情侣装逛街',
|
||||
desc: '一起穿情侣装逛街',
|
||||
detail: {
|
||||
start: '',
|
||||
desc: '',
|
||||
end: '',
|
||||
moment: '',
|
||||
other: '',
|
||||
}
|
||||
},
|
||||
{
|
||||
index: 4,
|
||||
finish: false,
|
||||
title: '一起看日出',
|
||||
desc: '一起看日出',
|
||||
detail: {
|
||||
start: '',
|
||||
desc: '',
|
||||
end: '',
|
||||
moment: '',
|
||||
other: '',
|
||||
}
|
||||
},
|
||||
{
|
||||
index: 5,
|
||||
finish: false,
|
||||
title: '一起看日落',
|
||||
desc: '一起看日落',
|
||||
detail: {
|
||||
start: '',
|
||||
desc: '',
|
||||
end: '',
|
||||
moment: '',
|
||||
other: '', // 其他说明
|
||||
}
|
||||
},
|
||||
{
|
||||
index: 6,
|
||||
finish: false,
|
||||
title: '一起买菜、做饭、刷碗',
|
||||
desc: '一起买菜、做饭、刷碗',
|
||||
detail: {
|
||||
start: '',
|
||||
desc: '',
|
||||
end: '',
|
||||
moment: '',
|
||||
other: '',
|
||||
}
|
||||
}
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
/**
|
||||
* 恋爱日记配置
|
||||
*/
|
||||
export default {
|
||||
waveImageUrl: 'https://b.925i.cn/uni_halo/uni_halo_about_wave.gif', // 波浪图片地址
|
||||
bgImageUrl: 'https://b.925i.cn/uni_halo_love/love_bg1.png', // 背景图片
|
||||
loveImageUrl: 'https://b.925i.cn/uni_halo_love/like.png', // 爱心图片
|
||||
|
||||
boy: {
|
||||
name: '未知男主',
|
||||
avatar: 'https://b.925i.cn/uni_halo_love/love_boy.png',
|
||||
birthday: '2022-09-25', // 生日
|
||||
},
|
||||
|
||||
girl: {
|
||||
name: '未知女主',
|
||||
avatar: 'https://b.925i.cn/uni_halo_love/love_girl.png',
|
||||
birthday: '2022-07-25', // 生日
|
||||
},
|
||||
|
||||
timeTitle: '这是我们一起走过的', // 恋爱时间标题
|
||||
loveStartDate: '2022-05-20 13:14:20', // 恋爱开始时间
|
||||
|
||||
// 恋爱日记首页导航(除了 key 以外都可以修改)
|
||||
nav: [{
|
||||
key: 'journey',
|
||||
use: true,
|
||||
iconImageUrl: 'https://b.925i.cn/uni_halo_love/diandian.png',
|
||||
title: '关于我们',
|
||||
desc: '我们一起度过的那些经历'
|
||||
},
|
||||
{
|
||||
key: 'album',
|
||||
use: true,
|
||||
iconImageUrl: 'https://b.925i.cn/uni_halo_love/diandian.png',
|
||||
title: '恋爱相册',
|
||||
desc: '定格了我们的那些小美好'
|
||||
},
|
||||
{
|
||||
key: 'list',
|
||||
use: true,
|
||||
iconImageUrl: 'https://b.925i.cn/uni_halo_love/diandian.png',
|
||||
title: '恋爱清单',
|
||||
desc: '你我之间的约定我们都在努力实现'
|
||||
},
|
||||
],
|
||||
|
||||
// 关于我们:支持富文本内容
|
||||
journey: `
|
||||
<p>有一只马,它的邻居是一只驴。</p><p>有一天,马和驴都被主人牵到外面晒太阳,马和驴聊起了天。</p><p>马说:“我叫马,你呢?”</p><p>驴说:“我叫驴。(哄小宝贝睡觉的甜甜睡前故事)”</p><p>马说:“为什么我俩的名字不一样呢?”</p><p>驴说:“因为我和你不一样。”</p><p>马说:“我们俩什么地方不一样呢?”</p><p>驴说:“我身材小巧,而你却比较粗壮,不如我耐看。”马看了看比自已矮小很多的驴,认为驴说的话有点道理。</p><p>马说:“我们俩除了身材不一样,还有什么不同呢?”</p><p>驴说:“我们俩的声音不一样,我的声音多动听呀!”说着驴伸长脖子叫了两声。“不信,你也叫两声试试。”马也伸长脖子嘶鸣了两声,的确和驴的声音有点不同,马不好意思地低下了头。</p><p>过了一会儿,马又说:“我们俩除了身材和声音不一样外,还有什么不同呢?”</p><p>驴说:“我的步伐多么优雅呀。”说着,驴迈开蹄子走了两步,“而你呢,却昂首阔步,一点儿也不优雅,(如何哄女朋友睡觉的睡前故事爱情浪漫)不信你走两步试试。”</p><p>马听驴这么一说,就高昂着头走了两步,旋即,马飞奔了起来,转了一圈回来后,驴得意地说:“怎么样,我没说错罢,你就是急性子,和优雅不沾边。”马听了驴的话,有点感到惭愧。</p><p>最后,马又鼓起勇气说:“我们俩还有什么不同呢?”</p><p>驴说:“我的家庭意识比你强,主人抽我一鞭子,我就跟着主人回家,而你呢?恐怕不会吧……”</p><p>马还没有来得及回答,马和驴的主人同时来到了马和驴的身边。只见驴的主人抽了驴一鞭子后,驴乖乖地跟着主人回家了。马把这一切都看在了眼里,它为自已和驴的诸多不同而感到惭愧,只见马的主人也抽了马一鞭子,马犹豫了一下,终于象驴一样乖乖地跟着主人回了家。</p><p>一个伯乐站在远处看到了这一幕后,叹口气离开了。</p>
|
||||
`,
|
||||
// 恋爱相册
|
||||
albumKeyName: '恋爱相册', // 对应后台的图库分组名称
|
||||
// 恋爱清单
|
||||
loveList: {
|
||||
useApi: false, // 是否启用api接口
|
||||
api: '', // api 接口(如果使用api接口的方式,则下方的data可以留空,但是api接口必须按照对应的数据格式返回)
|
||||
data: [{
|
||||
index: 0, // 序号
|
||||
finish: true, // 是否已完成
|
||||
title: '偷偷记录对方熟睡的模样', // 事件名称
|
||||
desc: '偷偷观察对方熟睡的模样,记录下来', // 事件描述
|
||||
detail: {
|
||||
start: '2022年05月20日', // 计划开始时间
|
||||
desc: '偷偷观察对方熟睡的模样,记录下来', // 事件详细描述
|
||||
end: '每天', // 完成时间,
|
||||
moment: '', // 完成瞬间的记录
|
||||
other: '', // 其他说明
|
||||
}
|
||||
}, {
|
||||
index: 1,
|
||||
finish: false,
|
||||
title: '陪对方过生日',
|
||||
desc: '陪对方一起过生日',
|
||||
detail: {
|
||||
start: '2023年05月20日',
|
||||
desc: '陪对方一起过生日,他和我的生日',
|
||||
end: '',
|
||||
moment: '',
|
||||
other: '他 生日5月20日 我生日9月25日',
|
||||
}
|
||||
},
|
||||
{
|
||||
index: 2,
|
||||
finish: false,
|
||||
title: '一起去旅行',
|
||||
desc: '一起来一场说走就走的旅行,希望去的是大理',
|
||||
detail: {
|
||||
start: '',
|
||||
desc: '',
|
||||
end: '',
|
||||
moment: '一起来一场说走就走的旅行,希望去的是大理',
|
||||
other: '',
|
||||
}
|
||||
},
|
||||
{
|
||||
index: 3,
|
||||
finish: false,
|
||||
title: '一起穿情侣装逛街',
|
||||
desc: '一起穿情侣装逛街',
|
||||
detail: {
|
||||
start: '',
|
||||
desc: '',
|
||||
end: '',
|
||||
moment: '',
|
||||
other: '',
|
||||
}
|
||||
},
|
||||
{
|
||||
index: 4,
|
||||
finish: false,
|
||||
title: '一起看日出',
|
||||
desc: '一起看日出',
|
||||
detail: {
|
||||
start: '',
|
||||
desc: '',
|
||||
end: '',
|
||||
moment: '',
|
||||
other: '',
|
||||
}
|
||||
},
|
||||
{
|
||||
index: 5,
|
||||
finish: false,
|
||||
title: '一起看日落',
|
||||
desc: '一起看日落',
|
||||
detail: {
|
||||
start: '',
|
||||
desc: '',
|
||||
end: '',
|
||||
moment: '',
|
||||
other: '', // 其他说明
|
||||
}
|
||||
},
|
||||
{
|
||||
index: 6,
|
||||
finish: false,
|
||||
title: '一起买菜、做饭、刷碗',
|
||||
desc: '一起买菜、做饭、刷碗',
|
||||
detail: {
|
||||
start: '',
|
||||
desc: '',
|
||||
end: '',
|
||||
moment: '',
|
||||
other: '',
|
||||
}
|
||||
}
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
/**
|
||||
* 页面配置
|
||||
*/
|
||||
import AppKeys from './keys.js'
|
||||
|
||||
export default {
|
||||
[AppKeys.SHEET_LEAVING]: 65, // 留言板页面ID
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/** 应用基础配置 */
|
||||
const UHaloBaseConfig = Object.freeze({
|
||||
|
||||
/** 基础请求域名:你的Halo博客基础域名 */
|
||||
BASE_API: "",
|
||||
// 示例:
|
||||
// BASE_API: "https://blog.xiaoxiaomo.cn",
|
||||
|
||||
// todo:可能有其他配置
|
||||
})
|
||||
|
||||
export default UHaloBaseConfig;
|
||||
@@ -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,14 +1,10 @@
|
||||
import App from "./App";
|
||||
import Vue from "vue";
|
||||
import {
|
||||
router,
|
||||
RouterMount
|
||||
} from './router/router.js'
|
||||
Vue.use(router)
|
||||
|
||||
// 挂载全局工具类
|
||||
import utils from "./utils/index.js";
|
||||
Vue.prototype.$utils = utils;
|
||||
uni.$utils = utils;
|
||||
|
||||
// 全局统一样式的对话框
|
||||
import Fy from '@/js_sdk/fy-showModal/index.js'
|
||||
@@ -62,12 +58,9 @@ Vue.prototype.$http = http;
|
||||
import ApiManager from '@/api/index.js'
|
||||
Vue.use(ApiManager);
|
||||
|
||||
import HaloConfig from '@/config/halo.config.js'
|
||||
Vue.prototype.$haloConfig = HaloConfig
|
||||
Vue.prototype.$baseApiUrl = HaloConfig.apiUrl
|
||||
import HaloTokenConfig from '@/config/uhalo.config.js'
|
||||
Vue.prototype.$baseApiUrl = HaloTokenConfig.BASE_API
|
||||
|
||||
import HaloAdConfig from '@/config/ad.config.js'
|
||||
Vue.prototype.$haloAdConfig = HaloAdConfig
|
||||
// 由于微信小程序的运行机制问题,需声明如下一行,H5和APP非必填
|
||||
Vue.prototype._i18n = i18n;
|
||||
|
||||
@@ -77,12 +70,5 @@ const app = new Vue({
|
||||
i18n,
|
||||
...App,
|
||||
});
|
||||
// app.$mount();
|
||||
|
||||
// #ifdef H5
|
||||
RouterMount(app, router, '#app')
|
||||
// #endif
|
||||
|
||||
// #ifndef H5
|
||||
app.$mount(); //为了兼容小程序及app端必须这样写才有效果
|
||||
// #endif
|
||||
app.$mount();
|
||||
|
||||
+38
-19
@@ -2,8 +2,8 @@
|
||||
"name" : "uni-halo",
|
||||
"appid" : "__UNI__5748B6E",
|
||||
"description" : "uni-halo博客:基于halo开源博客系统API开发的多端博客。",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : 100,
|
||||
"versionName" : "2.0.8",
|
||||
"versionCode" : 208,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
@@ -112,43 +112,43 @@
|
||||
}
|
||||
},
|
||||
"uniStatistics" : {
|
||||
"enable" : true
|
||||
"enable" : false
|
||||
}
|
||||
},
|
||||
/* 快应用特有相关 */
|
||||
"quickapp" : {},
|
||||
/* 小程序特有相关 */
|
||||
"mp-weixin" : {
|
||||
"appid" : "wx1bb161867082c72f",
|
||||
"appid" : "",
|
||||
"setting" : {
|
||||
"urlCheck" : false,
|
||||
"minified" : true
|
||||
},
|
||||
"usingComponents" : true,
|
||||
"uniStatistics" : {
|
||||
"enable" : true
|
||||
"enable" : false
|
||||
}
|
||||
},
|
||||
"mp-alipay" : {
|
||||
"usingComponents" : true,
|
||||
"uniStatistics" : {
|
||||
"enable" : true
|
||||
"enable" : false
|
||||
}
|
||||
},
|
||||
"mp-baidu" : {
|
||||
"usingComponents" : true,
|
||||
"uniStatistics" : {
|
||||
"enable" : true
|
||||
"enable" : false
|
||||
}
|
||||
},
|
||||
"mp-toutiao" : {
|
||||
"usingComponents" : true,
|
||||
"uniStatistics" : {
|
||||
"enable" : true
|
||||
"enable" : false
|
||||
}
|
||||
},
|
||||
"uniStatistics" : {
|
||||
"enable" : true,
|
||||
"enable" : false,
|
||||
"version" : "2"
|
||||
},
|
||||
"vueVersion" : "2",
|
||||
@@ -157,12 +157,12 @@
|
||||
"devServer" : {
|
||||
"disableHostCheck" : true,
|
||||
"proxy" : {
|
||||
"/api" : {
|
||||
"target" : "https://b.925i.cn",
|
||||
"/apis" : {
|
||||
"target" : "https://blog.xiaoxiaomo.cn",
|
||||
"changeOrigin" : true,
|
||||
"secure" : false,
|
||||
"pathRewrite" : {
|
||||
"^/api" : "/api"
|
||||
"^/apis" : "/apis"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -174,7 +174,11 @@
|
||||
}
|
||||
},
|
||||
"uniStatistics" : {
|
||||
"enable" : true
|
||||
"enable" : false
|
||||
},
|
||||
"router" : {
|
||||
"base" : "/uni-halo/",
|
||||
"mode" : "history"
|
||||
}
|
||||
},
|
||||
"_spaceID" : "699a26a5-a6cd-4b54-b603-5155b312a5f5",
|
||||
@@ -186,32 +190,47 @@
|
||||
"es6" : true
|
||||
},
|
||||
"uniStatistics" : {
|
||||
"enable" : true
|
||||
"enable" : false
|
||||
}
|
||||
},
|
||||
"mp-jd" : {
|
||||
"uniStatistics" : {
|
||||
"enable" : true
|
||||
"enable" : false
|
||||
}
|
||||
},
|
||||
"mp-kuaishou" : {
|
||||
"uniStatistics" : {
|
||||
"enable" : true
|
||||
"enable" : false
|
||||
}
|
||||
},
|
||||
"mp-lark" : {
|
||||
"uniStatistics" : {
|
||||
"enable" : true
|
||||
"enable" : false
|
||||
}
|
||||
},
|
||||
"quickapp-webview-huawei" : {
|
||||
"uniStatistics" : {
|
||||
"enable" : true
|
||||
"enable" : false
|
||||
}
|
||||
},
|
||||
"quickapp-webview-union" : {
|
||||
"uniStatistics" : {
|
||||
"enable" : true
|
||||
"enable" : false
|
||||
}
|
||||
},
|
||||
"app-harmony" : {
|
||||
"uniStatistics" : {
|
||||
"enable" : false
|
||||
}
|
||||
},
|
||||
"mp-harmony" : {
|
||||
"uniStatistics" : {
|
||||
"enable" : false
|
||||
}
|
||||
},
|
||||
"mp-xhs" : {
|
||||
"uniStatistics" : {
|
||||
"enable" : false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+24
-21
@@ -1,23 +1,26 @@
|
||||
{
|
||||
"name": "uni-halo",
|
||||
"version": "1.0.0",
|
||||
"description": "<p align=\"center\">\r <img alt=\"logo\" src=\"https://b.925i.cn/uni_halo/uni_halo_logo.png\" width=\"120\" height=\"120\" style=\"margin-bottom: 10px;\">\r </p>\r <h3 align=\"center\" style=\"margin: 30px 0 30px;font-weight: bold;font-size:40px;\">uni-halo</h3>\r <h3 align=\"center\">uni-halo 基于Halo一款现代化的开源博客/CMS系统API开发的可多端编译应用</h3>",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://gitee.com/ialley-workshop-open/uni-halo.git"
|
||||
},
|
||||
"keywords": ["uni-halo", "小莫唐尼", "巷子工坊"],
|
||||
"author": "巷子工坊丨小莫唐尼",
|
||||
"license": "AGPL-3.0",
|
||||
"bugs": {
|
||||
"url": "https://gitee.com/ialley-workshop-open/uni-halo/issues"
|
||||
},
|
||||
"homepage": "https://uni-halo.925i.cn",
|
||||
"devDependencies": {
|
||||
"vue-i18n": "^9.1.10"
|
||||
},
|
||||
"dependencies": {
|
||||
"uni-read-pages": "^1.0.5",
|
||||
"uni-simple-router": "^2.0.8-beta.4"
|
||||
}
|
||||
"name": "uni-halo",
|
||||
"version": "2.0.8",
|
||||
"description": "<p align=\"center\">\r <img alt=\"logo\" src=\"https://b.925i.cn/uni_halo/uni_halo_logo.png\" width=\"120\" height=\"120\" style=\"margin-bottom: 10px;\">\r </p>\r <h3 align=\"center\" style=\"margin: 30px 0 30px;font-weight: bold;font-size:40px;\">uni-halo</h3>\r <h3 align=\"center\">uni-halo 基于Halo一款现代化的开源博客/CMS系统API开发的可多端编译应用</h3>",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://gitee.com/ialley-workshop-open/uni-halo.git"
|
||||
},
|
||||
"keywords": [
|
||||
"uni-halo",
|
||||
"小莫唐尼",
|
||||
"巷子工坊"
|
||||
],
|
||||
"author": "巷子工坊丨小莫唐尼",
|
||||
"license": "AGPL-3.0",
|
||||
"bugs": {
|
||||
"url": "https://gitee.com/ialley-workshop-open/uni-halo/issues"
|
||||
},
|
||||
"homepage": "https://uni-halo.925i.cn",
|
||||
"devDependencies": {
|
||||
"vue-i18n": "^9.1.10"
|
||||
},
|
||||
"dependencies": {
|
||||
"qs": "^6.12.1"
|
||||
}
|
||||
}
|
||||
|
||||
+360
-577
@@ -1,585 +1,368 @@
|
||||
{
|
||||
"pages": [{
|
||||
"path": "pages/index/index",
|
||||
"pages": [
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "uni-halo",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/tabbar/home/home",
|
||||
"style": {
|
||||
"navigationBarTitleText": "首页",
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationStyle": "custom",
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/tabbar/category/category",
|
||||
"style": {
|
||||
"navigationBarTitleText": "分类",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/tabbar/gallery/gallery",
|
||||
"style": {
|
||||
"navigationBarTitleText": "图库",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/tabbar/moments/moments",
|
||||
"style": {
|
||||
"navigationBarTitleText": "瞬间",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/tabbar/about/about",
|
||||
"style": {
|
||||
"navigationBarTitleText": "关于",
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "uni_modules/uni-upgrade-center-app/pages/upgrade-popup",
|
||||
"style": {
|
||||
"disableScroll": true,
|
||||
"app-plus": {
|
||||
"backgroundColorTop": "transparent",
|
||||
"background": "transparent",
|
||||
"titleNView": false,
|
||||
"scrollIndicator": false,
|
||||
"popGesture": "none",
|
||||
"animationType": "fade-in",
|
||||
"animationDuration": 200
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
//此配置为小程序的分包加载机制。在5+App里始终为整包。
|
||||
"subPackages": [
|
||||
{
|
||||
"root": "pagesA",
|
||||
"pages": [
|
||||
{
|
||||
"path": "start/start",
|
||||
"style": {
|
||||
"navigationBarTitleText": "uni-halo",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "article-detail/article-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "内容详情",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "love/love",
|
||||
"style": {
|
||||
"navigationBarTitleText": "恋爱日记",
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": false,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "love/list",
|
||||
"style": {
|
||||
"navigationBarTitleText": "恋爱清单",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "love/album",
|
||||
"style": {
|
||||
"navigationBarTitleText": "恋爱相册",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "love/journey",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我们的故事",
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "archives/archives",
|
||||
"style": {
|
||||
"navigationBarTitleText": "归档",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "friend-links/friend-links",
|
||||
"style": {
|
||||
"navigationBarTitleText": "友情链接",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "articles/articles",
|
||||
"style": {
|
||||
"navigationBarTitleText": "内容搜索",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "category-detail/category-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "分类详情",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "disclaimers/disclaimers",
|
||||
"style": {
|
||||
"navigationBarTitleText": "免责声明",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "contact/contact",
|
||||
"style": {
|
||||
"navigationBarTitleText": "联系博主",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "about/about",
|
||||
"style": {
|
||||
"navigationBarTitleText": "关于博客",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "setting/setting",
|
||||
"style": {
|
||||
"navigationBarTitleText": "设置",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "tags/tags",
|
||||
"style": {
|
||||
"navigationBarTitleText": "",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "tag-detail/tag-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "标签详情",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "submit-link/submit-link",
|
||||
"style": {
|
||||
"navigationBarTitleText": "友链提交",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "moment-detail/moment-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "瞬间详情",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "votes/votes",
|
||||
"style": {
|
||||
"navigationBarTitleText": "uni-halo",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
"navigationBarTitleText": "投票列表",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/tabbar/home/home",
|
||||
"path": "vote-detail/vote-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "首页",
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationStyle": "custom",
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"path": "pages/tabbar/category/category",
|
||||
"style": {
|
||||
"navigationBarTitleText": "分类",
|
||||
"enablePullDownRefresh": false,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"path": "pages/tabbar/gallery/gallery",
|
||||
"style": {
|
||||
"navigationBarTitleText": "图库",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"path": "pages/tabbar/links/links",
|
||||
"style": {
|
||||
"navigationBarTitleText": "友链",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"path": "pages/tabbar/about/about",
|
||||
"style": {
|
||||
"navigationBarTitleText": "关于",
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"path": "uni_modules/uni-upgrade-center-app/pages/upgrade-popup",
|
||||
"style": {
|
||||
"disableScroll": true,
|
||||
"app-plus": {
|
||||
"backgroundColorTop": "transparent",
|
||||
"background": "transparent",
|
||||
"titleNView": false,
|
||||
"scrollIndicator": false,
|
||||
"popGesture": "none",
|
||||
"animationType": "fade-in",
|
||||
"animationDuration": 200
|
||||
}
|
||||
"navigationBarTitleText": "投票详情",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
//此配置为小程序的分包加载机制。在5+App里始终为整包。
|
||||
"subPackages": [{
|
||||
"root": "pagesA",
|
||||
"pages": [{
|
||||
"path": "start/start",
|
||||
"style": {
|
||||
"navigationBarTitleText": "uni-halo",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "article-detail/article-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "文章详情",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"path": "love/love",
|
||||
"style": {
|
||||
"navigationBarTitleText": "恋爱日记",
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": false,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"path": "love/list",
|
||||
"style": {
|
||||
"navigationBarTitleText": "恋爱清单",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
|
||||
}, {
|
||||
"path": "love/album",
|
||||
"style": {
|
||||
"navigationBarTitleText": "恋爱相册",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"path": "love/journey",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我们的故事",
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}, {
|
||||
"path": "archives/archives",
|
||||
"style": {
|
||||
"navigationBarTitleText": "文章归档",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}, {
|
||||
"path": "journal/journal",
|
||||
"style": {
|
||||
"navigationBarTitleText": "个人日记",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"path": "leaving/leaving",
|
||||
"style": {
|
||||
"navigationBarTitleText": "留言板",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}, {
|
||||
"path": "articles/articles",
|
||||
"style": {
|
||||
"navigationBarTitleText": "文章列表",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"path": "category-detail/category-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "分类详情",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"path": "comment/comment",
|
||||
"style": {
|
||||
"navigationBarTitleText": "",
|
||||
"enablePullDownRefresh": false
|
||||
},
|
||||
"meta": {
|
||||
"auth": "login"
|
||||
}
|
||||
}, {
|
||||
"path": "disclaimers/disclaimers",
|
||||
"style": {
|
||||
"navigationBarTitleText": "免责声明",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}, {
|
||||
"path": "contact/contact",
|
||||
"style": {
|
||||
"navigationBarTitleText": "联系博主",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}, {
|
||||
"path": "about/about",
|
||||
"style": {
|
||||
"navigationBarTitleText": "关于博客",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}, {
|
||||
"path": "setting/setting",
|
||||
"style": {
|
||||
"navigationBarTitleText": "设置",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}, {
|
||||
"path": "tags/tags",
|
||||
"style": {
|
||||
"navigationBarTitleText": "",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}, {
|
||||
"path": "tag-detail/tag-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "标签详情",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
"root": "pagesB",
|
||||
"pages": [{
|
||||
"path": "login/login",
|
||||
"style": {
|
||||
"navigationBarTitleText": "登录",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "admin/admin",
|
||||
"style": {
|
||||
"navigationBarTitleText": "工作台",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"auth": "admin"
|
||||
}
|
||||
}, {
|
||||
"path": "settings/settings",
|
||||
"style": {
|
||||
"navigationBarTitleText": "系统设置",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"auth": "admin"
|
||||
}
|
||||
}, {
|
||||
"path": "journal/journal",
|
||||
"style": {
|
||||
"navigationBarTitleText": "日记管理",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"auth": "admin"
|
||||
}
|
||||
}, {
|
||||
"path": "journal/journal-edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "",
|
||||
"enablePullDownRefresh": false,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"auth": "admin"
|
||||
}
|
||||
}, {
|
||||
"path": "articles/articles",
|
||||
"style": {
|
||||
"navigationBarTitleText": "文章管理",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"auth": "admin"
|
||||
}
|
||||
}, {
|
||||
"path": "articles/article-edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "写文章",
|
||||
"enablePullDownRefresh": false
|
||||
},
|
||||
"meta": {
|
||||
"auth": "admin"
|
||||
}
|
||||
}, {
|
||||
"path": "articles/article-setting",
|
||||
"style": {
|
||||
"navigationBarTitleText": "文章设置",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"auth": "admin"
|
||||
}
|
||||
}, {
|
||||
"path": "category/category",
|
||||
"style": {
|
||||
"navigationBarTitleText": "分类管理",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"auth": "admin"
|
||||
}
|
||||
}, {
|
||||
"path": "tags/tags",
|
||||
"style": {
|
||||
"navigationBarTitleText": "标签管理",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"auth": "admin"
|
||||
}
|
||||
}, {
|
||||
"path": "attachment/attachment",
|
||||
"style": {
|
||||
"navigationBarTitleText": "附件管理",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"auth": "admin"
|
||||
}
|
||||
}, {
|
||||
"path": "links/links",
|
||||
"style": {
|
||||
"navigationBarTitleText": "友链管理",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"auth": "admin"
|
||||
}
|
||||
}, {
|
||||
"path": "photos/photos",
|
||||
"style": {
|
||||
"navigationBarTitleText": "图库管理",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"auth": "admin"
|
||||
}
|
||||
}, {
|
||||
"path": "photos/photos-edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "新增/编辑图片",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"auth": "admin"
|
||||
}
|
||||
}, {
|
||||
"path": "comments/comments",
|
||||
"style": {
|
||||
"navigationBarTitleText": "评论管理",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"auth": "admin"
|
||||
}
|
||||
}, {
|
||||
"path": "menus/menus",
|
||||
"style": {
|
||||
"navigationBarTitleText": "菜单管理",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"auth": "admin"
|
||||
}
|
||||
}, {
|
||||
"path": "password/password",
|
||||
"style": {
|
||||
"navigationBarTitleText": "修改密码",
|
||||
"enablePullDownRefresh": false
|
||||
},
|
||||
"meta": {
|
||||
"auth": "admin"
|
||||
}
|
||||
}, {
|
||||
"path": "profile/profile",
|
||||
"style": {
|
||||
"navigationBarTitleText": "个人信息",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"auth": "admin"
|
||||
}
|
||||
}, {
|
||||
"path": "logs/logs",
|
||||
"style": {
|
||||
"navigationBarTitleText": "日志管理",
|
||||
"enablePullDownRefresh": true,
|
||||
"app-plus": {
|
||||
"pullToRefresh": {
|
||||
"color": "#03a9f4",
|
||||
"style": "circle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"auth": "admin"
|
||||
}
|
||||
}]
|
||||
}, {
|
||||
"root": "pagesC",
|
||||
"pages": [{
|
||||
"path": "website/website",
|
||||
"style": {
|
||||
"navigationBarTitleText": "",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}]
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "uni-halo",
|
||||
"navigationBarBackgroundColor": "#ffffff",
|
||||
"backgroundColor": "#F8F8F8"
|
||||
},
|
||||
"tabBar": {
|
||||
"backgroundColor": "#fff",
|
||||
"borderStyle": "white",
|
||||
"color": "#303133",
|
||||
"selectedColor": "#03a9f4",
|
||||
"list": [{
|
||||
"iconPath": "static/tabbar/select_home.png",
|
||||
"selectedIconPath": "static/tabbar/select_home_active.png",
|
||||
"pagePath": "pages/tabbar/home/home",
|
||||
"text": "首页"
|
||||
},
|
||||
{
|
||||
"iconPath": "static/tabbar/select_category.png",
|
||||
"selectedIconPath": "static/tabbar/select_category_active.png",
|
||||
"pagePath": "pages/tabbar/category/category",
|
||||
"text": "分类"
|
||||
}, {
|
||||
"iconPath": "static/tabbar/select_gallery.png",
|
||||
"selectedIconPath": "static/tabbar/select_gallery_active.png",
|
||||
"pagePath": "pages/tabbar/gallery/gallery",
|
||||
"text": "图库"
|
||||
}, {
|
||||
"iconPath": "static/tabbar/select_links.png",
|
||||
"selectedIconPath": "static/tabbar/select_links_active.png",
|
||||
"pagePath": "pages/tabbar/links/links",
|
||||
"text": "友链"
|
||||
}, {
|
||||
"iconPath": "static/tabbar/select_mine.png",
|
||||
"selectedIconPath": "static/tabbar/select_mine_active.png",
|
||||
"pagePath": "pages/tabbar/about/about",
|
||||
"text": "关于"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pagesC",
|
||||
"pages": [
|
||||
{
|
||||
"path": "website/website",
|
||||
"style": {
|
||||
"navigationBarTitleText": "",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "uni-halo",
|
||||
"navigationBarBackgroundColor": "#ffffff",
|
||||
"backgroundColor": "#F8F8F8"
|
||||
},
|
||||
"tabBar": {
|
||||
"backgroundColor": "#fff",
|
||||
"borderStyle": "white",
|
||||
"color": "#303133",
|
||||
"selectedColor": "#03a9f4",
|
||||
"list": [
|
||||
{
|
||||
"iconPath": "static/tabbar/select_home.png",
|
||||
"selectedIconPath": "static/tabbar/select_home_active.png",
|
||||
"pagePath": "pages/tabbar/home/home",
|
||||
"text": "首页"
|
||||
},
|
||||
{
|
||||
"iconPath": "static/tabbar/select_category.png",
|
||||
"selectedIconPath": "static/tabbar/select_category_active.png",
|
||||
"pagePath": "pages/tabbar/category/category",
|
||||
"text": "分类"
|
||||
},
|
||||
{
|
||||
"iconPath": "static/tabbar/select_gallery.png",
|
||||
"selectedIconPath": "static/tabbar/select_gallery_active.png",
|
||||
"pagePath": "pages/tabbar/gallery/gallery",
|
||||
"text": "图库"
|
||||
},
|
||||
{
|
||||
"iconPath": "static/tabbar/select_links.png",
|
||||
"selectedIconPath": "static/tabbar/select_links_active.png",
|
||||
"pagePath": "pages/tabbar/moments/moments",
|
||||
"text": "瞬间"
|
||||
},
|
||||
{
|
||||
"iconPath": "static/tabbar/select_mine.png",
|
||||
"selectedIconPath": "static/tabbar/select_mine_active.png",
|
||||
"pagePath": "pages/tabbar/about/about",
|
||||
"text": "关于"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+126
-21
@@ -1,31 +1,136 @@
|
||||
<template>
|
||||
<view class="app-page"></view>
|
||||
<view class="app-page flex flex-center">
|
||||
<PluginUnavailable v-if="!uniHaloPluginAvailable" :pluginId="uniHaloPluginId"
|
||||
:error-text="uniHaloPluginAvailableError" :use-border="false" :use-decoration="false" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
onLoad() {
|
||||
this.fnCheckShowStarted();
|
||||
},
|
||||
methods: {
|
||||
// 检查是否需要跳转到启动页
|
||||
fnCheckShowStarted() {
|
||||
if (!getApp().globalData.start.use) {
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/home'
|
||||
});
|
||||
return;
|
||||
import pluginAvailableMixin from "@/common/mixins/pluginAvailable.js"
|
||||
import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue'
|
||||
|
||||
const homePagePath = '/pages/tabbar/home/home'
|
||||
const startPagePath = '/pagesA/start/start'
|
||||
const articleDetailPath = '/pagesA/article-detail/article-detail';
|
||||
|
||||
const _DEV_ = false
|
||||
const _DEV_TO_TYPE_ = "page"
|
||||
const _DEV_TO_PATH_ = "/pagesA/article-detail/article-detail?name=077efb85-3544-4307-b24c-537a9e53f116"
|
||||
|
||||
export default {
|
||||
mixins: [pluginAvailableMixin],
|
||||
components: {
|
||||
PluginUnavailable
|
||||
},
|
||||
computed: {
|
||||
configs() {
|
||||
return this.$tm.vx.getters().getConfigs;
|
||||
}
|
||||
if (uni.getStorageSync('APP_HAS_STARTED')) {
|
||||
},
|
||||
async onLoad(options) {
|
||||
// 检查插件
|
||||
this.setPluginId(this.NeedPluginIds.PluginUniHalo)
|
||||
this.setPluginError("阿偶,检测到当前插件没有安装或者启用,无法启动 uni-halo 哦,请联系管理员")
|
||||
if (!await this.checkPluginAvailable()) return
|
||||
|
||||
// 获取配置
|
||||
uni.$tm.vx.actions('config/fetchConfigs').then(async (res) => {
|
||||
if (options.scene) {
|
||||
if ('' !== options.scene) {
|
||||
const postId = await this.getPostIdByQRCode(options.scene);
|
||||
if (postId) {
|
||||
uni.redirectTo({
|
||||
url: articleDetailPath + `?name=${postId}`,
|
||||
animationType: 'slide-in-right'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
// uni.$tm.vx.commit('setWxShare', res.shareConfig);
|
||||
// #endif
|
||||
|
||||
// 获取mockjson
|
||||
if (res.auditConfig.auditModeEnabled) {
|
||||
if (res.auditConfig.auditModeData.jsonUrl) {
|
||||
await uni.$tm.vx.actions('config/fetchMockJson')
|
||||
} else {
|
||||
const mockJson = uni.$utils.checkJsonAndParse(res.auditConfig.auditModeData
|
||||
.jsonData)
|
||||
if (mockJson.ok) {
|
||||
uni.$tm.vx.commit('config/setMockJson', mockJson.jsonData)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 进入检查
|
||||
this.fnCheckShowStarted();
|
||||
}).catch((err) => {
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/home'
|
||||
});
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
url: '/pagesA/start/start'
|
||||
url: homePagePath
|
||||
});
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
fnCheckShowStarted() {
|
||||
// 本地开发,快速跳转页面,发布请设置 _DEV_ = false
|
||||
if (_DEV_ && _DEV_TO_PATH_) {
|
||||
if (_DEV_TO_TYPE_ == 'tabbar') {
|
||||
uni.switchTab({
|
||||
url: _DEV_TO_PATH_
|
||||
});
|
||||
} else if (_DEV_TO_TYPE_ == 'page') {
|
||||
uni.navigateTo({
|
||||
url: _DEV_TO_PATH_
|
||||
});
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (!this.configs.appConfig.startConfig.enabled) {
|
||||
uni.switchTab({
|
||||
url: homePagePath
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 是否每次都显示启动页
|
||||
if (this.configs.appConfig.startConfig.alwaysShow) {
|
||||
uni.removeStorageSync('APP_HAS_STARTED')
|
||||
uni.redirectTo({
|
||||
url: startPagePath
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 只显示一次启动页
|
||||
if (uni.getStorageSync('APP_HAS_STARTED')) {
|
||||
uni.switchTab({
|
||||
url: homePagePath
|
||||
});
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
url: startPagePath
|
||||
});
|
||||
}
|
||||
},
|
||||
async getPostIdByQRCode(key) {
|
||||
const response = await this.$httpApi.v2.getQRCodeInfo(key);
|
||||
if (response) {
|
||||
if (response && response.postId) {
|
||||
return response.postId;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
}
|
||||
</style>
|
||||
+493
-546
File diff suppressed because it is too large
Load Diff
+454
-216
@@ -1,234 +1,472 @@
|
||||
<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>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
</view>
|
||||
<view v-else class="content flex">
|
||||
<view v-if="categoryList.length == 0" class="category-empty flex flex-center">
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有文章分类~"></tm-empty>
|
||||
</view>
|
||||
<block v-else>
|
||||
<tm-sliderNav :list="categoryList" bg-color="white" color="light-blue" rang-key="name" @change="fnOnCategoryChange"></tm-sliderNav>
|
||||
<scroll-view class="right-content pt-12 pb-12" :scroll-y="true" :scroll-top="scrollTop" :scroll-with-animation="true" :refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="60" refresher-background="#fafafa" @refresherrefresh="fnGetData(true)" @scrolltolower="fnGetData(false)" @scroll="fnOnScroll" @touchmove.stop @touchstart="fnOnTouchStart" @touchend="fnOnTouchEnd" @touchcancel="fnOnTouchEnd">
|
||||
<view v-if="dataList.length == 0" class="article-empty flex flex-center">
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="该分类下暂无文章~"></tm-empty>
|
||||
</view>
|
||||
<view class="app-page" :style="{
|
||||
padding:calcShowType==='list-post'? 0 : '24rpx 0'
|
||||
}">
|
||||
<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" :class="[calcShowType==='list-post'?'list-post':'']">
|
||||
<view v-if="dataList.length === 0" class="content-empty flex flex-center" style="height: 70vh;">
|
||||
<!-- 空布局 -->
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
|
||||
</view>
|
||||
<block v-else>
|
||||
<block v-if="calcAuditModeEnabled || calcShowType==='list'">
|
||||
<tm-translate v-for="(item, index) in dataList" :key="index"
|
||||
style="box-sizing: border-box;width: 50%;padding: 0 8rpx;" animation-name="fadeUp"
|
||||
:wait="calcAniWait(index)">
|
||||
<view class="catgory-card" :style="{backgroundImage:`url(${item.spec.cover})`}">
|
||||
<view class="content" @click="handleToCategory(item)">
|
||||
<view style="font-size: 32rpx;color: #ffffff;">{{ item.spec.displayName }}</view>
|
||||
<view v-if="!calcAuditModeEnabled"
|
||||
style="font-size: 24rpx;color: #ffffff;margin-top: 6rpx;">
|
||||
共 {{ item.postCount }} 篇文章
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</tm-translate>
|
||||
<view class="load-text">{{ loadMoreText }}</view>
|
||||
</block>
|
||||
<view v-else-if="calcShowType==='list-post'" class="fulled flex" style="min-height:100vh">
|
||||
<view class="bg-white" :style="{height: '100%'}">
|
||||
<tm-sliderNav :list="categoryList" bg-color="white" color="light-blue" rang-key="displayName"
|
||||
@change="fnOnCategoryChange"></tm-sliderNav>
|
||||
</view>
|
||||
<scroll-view class="right-content pt-12 pb-12" :scroll-y="true" :scroll-top="scrollTop"
|
||||
:scroll-with-animation="true" :refresher-enabled="true" :refresher-triggered="triggered"
|
||||
:refresher-threshold="60" refresher-background="#fafafa"
|
||||
@refresherrefresh="fnGetPostByCategory(true)" @scrolltolower="fnGetPostByCategory(false)"
|
||||
@scroll="fnOnScroll" @touchmove.stop @touchstart="fnOnTouchStart" @touchend="fnOnTouchEnd"
|
||||
@touchcancel="fnOnTouchEnd">
|
||||
<view v-if="postList.length === 0" class="article-empty flex flex-center">
|
||||
<tm-empty :size="120" icon="icon-shiliangzhinengduixiang-" label="该分类下暂无文章~"></tm-empty>
|
||||
</view>
|
||||
<block v-else>
|
||||
<block v-for="(post, index) in postList" :key="post.spec.publishTime">
|
||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||
<article-min-card :article="post" @on-click="fnToArticleDetail"></article-min-card>
|
||||
</tm-translate>
|
||||
</block>
|
||||
<view class="load-text">{{ loadMoreText }}</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<block v-else>
|
||||
<block v-for="(article, index) in dataList" :key="article.createTime">
|
||||
<!-- 文章卡片 -->
|
||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||
<article-min-card :article="article" @on-click="fnToArticleDetail"></article-min-card>
|
||||
</tm-translate>
|
||||
</block>
|
||||
<view class="load-text">{{ loadMoreText }}</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
</block>
|
||||
</view>
|
||||
<tm-flotbutton v-if="dataList.length > 10" color="light-blue" @click="fnToTopScroll" size="m" icon="icon-angle-up"></tm-flotbutton>
|
||||
</view>
|
||||
<view class="flot-buttons">
|
||||
<tm-button @click="fnScrollTop" size="m" :fab="true" theme="light-blue"
|
||||
icon="icon-angle-up"></tm-button>
|
||||
<tm-button v-if="!calcAuditModeEnabled" @click="fnChangeShowType" size="m" :fab="true" theme="light-blue"
|
||||
:icon="calcShowType==='list'?'icon-align-left':'icon-all'"></tm-button>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import throttle from '@/utils/throttle.js';
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import tmFlowLayout from '@/tm-vuetify/components/tm-flowLayout/tm-flowLayout.vue';
|
||||
import tmSliderNav from '@/tm-vuetify/components/tm-sliderNav/tm-sliderNav.vue';
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
|
||||
import ArticleMinCard from '@/components/article-min-card/article-min-card.vue';
|
||||
export default {
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmTranslate,
|
||||
tmFlotbutton,
|
||||
tmEmpty,
|
||||
tmFlowLayout,
|
||||
tmSliderNav,
|
||||
ArticleMinCard
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0,
|
||||
slug: ''
|
||||
},
|
||||
categoryList: [],
|
||||
result: null,
|
||||
dataList: [],
|
||||
isLoadMore: false,
|
||||
loadMoreText: '',
|
||||
scrollTop: 0,
|
||||
tempScrollTop: 0,
|
||||
scrollTimeout: null,
|
||||
triggered: false
|
||||
};
|
||||
},
|
||||
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
||||
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
||||
import tmFlowLayout from '@/tm-vuetify/components/tm-flowLayout/tm-flowLayout.vue';
|
||||
import tmSliderNav from '@/tm-vuetify/components/tm-sliderNav/tm-sliderNav.vue';
|
||||
import ArticleMinCard from '@/components/article-min-card/article-min-card.vue';
|
||||
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('文章分类');
|
||||
this.fnGetAllCategory();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.queryParams.page = 0;
|
||||
this.isLoadMore = false;
|
||||
this.fnGetData();
|
||||
},
|
||||
onReachBottom(e) {
|
||||
if (this.result.hasNext) {
|
||||
this.queryParams.page += 1;
|
||||
this.isLoadMore = true;
|
||||
this.fnGetData(false);
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '没有更多数据了'
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fnOnCategoryChange(e) {
|
||||
this.fnResetSetAniWaitIndex();
|
||||
this.queryParams.slug = this.categoryList[e].slug;
|
||||
this.fnToTopScroll();
|
||||
this.dataList = [];
|
||||
this.fnGetData();
|
||||
},
|
||||
|
||||
fnGetAllCategory() {
|
||||
this.loading = 'loading';
|
||||
// uni.showLoading({
|
||||
// mask: true,
|
||||
// title: '加载中...'
|
||||
// });
|
||||
this.$httpApi
|
||||
.getCategoryList({ more: true })
|
||||
.then(res => {
|
||||
this.categoryList = res.data;
|
||||
if (res.data.length != 0) {
|
||||
this.queryParams.slug = res.data[0].slug;
|
||||
this.triggered = false;
|
||||
this.loading = 'success';
|
||||
this.fnGetData(true, false);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
})
|
||||
.finally(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
});
|
||||
},
|
||||
fnGetData(isPulldownRefresh = true, triggered = true) {
|
||||
if (!isPulldownRefresh) {
|
||||
if (this.result.hasNext) {
|
||||
this.queryParams.page += 1;
|
||||
} else {
|
||||
return uni.showToast({
|
||||
icon: 'none',
|
||||
title: '没有更多数据了'
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.queryParams.page = 0;
|
||||
if (triggered) {
|
||||
this.triggered = true;
|
||||
}
|
||||
}
|
||||
export default {
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmButton,
|
||||
tmTranslate,
|
||||
tmEmpty,
|
||||
mpHtml,
|
||||
tmFlowLayout,
|
||||
tmSliderNav,
|
||||
ArticleMinCard
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
markdownConfig: MarkdownConfig,
|
||||
loading: 'loading',
|
||||
queryParams: {
|
||||
size: 20,
|
||||
page: 1,
|
||||
fieldSelector: ['spec.hideFromList=false']
|
||||
},
|
||||
hasNext: false,
|
||||
dataList: [],
|
||||
categoryList: [],
|
||||
isLoadMore: false,
|
||||
loadMoreText: '加载中...',
|
||||
currentCategoryConfig: {
|
||||
type: "list"
|
||||
},
|
||||
currentCategoryName: "",
|
||||
postQueryParams: {
|
||||
size: 10,
|
||||
page: 0,
|
||||
},
|
||||
postList: [],
|
||||
triggered: false,
|
||||
scrollTop: 0,
|
||||
tempScrollTop: 0,
|
||||
scrollTimeout: null,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
haloConfigs() {
|
||||
return this.$tm.vx.getters().getConfigs;
|
||||
},
|
||||
calcAuditModeEnabled() {
|
||||
return this.haloConfigs.auditConfig.auditModeEnabled
|
||||
},
|
||||
mockJson() {
|
||||
return this.$tm.vx.getters().getMockJson;
|
||||
},
|
||||
categoryConfig() {
|
||||
return this.haloConfigs.pageConfig.categoryConfig
|
||||
},
|
||||
calcShowType() {
|
||||
return this.currentCategoryConfig.type
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
categoryConfig: {
|
||||
deep: true,
|
||||
immediate: true,
|
||||
handler(newVal) {
|
||||
console.log("执行了", newVal)
|
||||
if (!newVal) return;
|
||||
this.currentCategoryConfig = newVal
|
||||
this.handleInitPage()
|
||||
},
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.isLoadMore = false;
|
||||
this.queryParams.page = 0;
|
||||
this.fnGetData();
|
||||
},
|
||||
onReachBottom(e) {
|
||||
if (this.calcAuditModeEnabled) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '没有更多数据了'
|
||||
});
|
||||
return
|
||||
}
|
||||
if (this.hasNext) {
|
||||
if (this.calcShowType === 'list') {
|
||||
|
||||
this.$httpApi
|
||||
.getCategoryPostList(this.queryParams.slug, this.queryParams)
|
||||
.then(res => {
|
||||
this.result = res.data;
|
||||
this.queryParams.page += 1;
|
||||
} else {
|
||||
this.postQueryParams.page += 1;
|
||||
}
|
||||
this.isLoadMore = true;
|
||||
this.fnGetData();
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '没有更多数据了'
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fnChangeShowType() {
|
||||
if (this.calcShowType === 'list-post') {
|
||||
this.currentCategoryConfig.type = 'list'
|
||||
} else {
|
||||
this.currentCategoryConfig.type = 'list-post'
|
||||
}
|
||||
this.handleInitPage();
|
||||
},
|
||||
handleResetInit() {
|
||||
this.postList = []
|
||||
this.dataList = []
|
||||
this.categoryList = []
|
||||
this.queryParams.page = 0;
|
||||
this.postQueryParams.page = 0;
|
||||
this.hasNext = false
|
||||
this.isLoadMore = false
|
||||
this.loadMoreText = '加载中...'
|
||||
this.currentCategoryName = ""
|
||||
this.triggered = false
|
||||
this.fnResetSetAniWaitIndex()
|
||||
},
|
||||
handleInitPage() {
|
||||
this.handleResetInit()
|
||||
if (this.calcShowType === 'list-post') {
|
||||
this.queryParams.size = 99999
|
||||
}
|
||||
this.fnGetData();
|
||||
},
|
||||
fnGetData() {
|
||||
if (this.calcAuditModeEnabled) {
|
||||
this.categoryConfig.type = "list"
|
||||
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);
|
||||
if (this.calcShowType === 'list') {
|
||||
this.loading = 'success';
|
||||
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
// 处理数据
|
||||
this.hasNext = res.hasNext;
|
||||
|
||||
if (!isPulldownRefresh) {
|
||||
this.dataList = this.dataList.concat(res.data.content);
|
||||
} else {
|
||||
this.dataList = res.data.content;
|
||||
}
|
||||
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
})
|
||||
.catch(err => {
|
||||
this.loadMoreText = '加载失败!';
|
||||
})
|
||||
.finally(() => {
|
||||
this.triggered = false;
|
||||
});
|
||||
},
|
||||
//跳转文章详情
|
||||
fnToArticleDetail(article) {
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
|
||||
animationType: 'slide-in-right'
|
||||
});
|
||||
},
|
||||
fnOnScroll(e) {
|
||||
this.tempScrollTop = e.detail.scrollTop;
|
||||
},
|
||||
fnToTopScroll() {
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 500
|
||||
});
|
||||
this.scrollTop = 0;
|
||||
this.tempScrollTop = 0;
|
||||
},
|
||||
fnOnTouchStart() {
|
||||
clearTimeout(this.scrollTimeout);
|
||||
},
|
||||
fnOnTouchEnd() {
|
||||
this.scrollTimeout = setTimeout(() => {
|
||||
this.scrollTop = this.tempScrollTop;
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
};
|
||||
const tempItems = res.items.map(item => {
|
||||
item.spec.cover = this.$utils.checkThumbnailUrl(item.spec.cover, true)
|
||||
return item;
|
||||
})
|
||||
|
||||
if (this.isLoadMore) {
|
||||
this.dataList = this.dataList.concat(tempItems);
|
||||
} else {
|
||||
this.dataList = tempItems;
|
||||
}
|
||||
} else {
|
||||
this.dataList = res.items
|
||||
this.categoryList = res.items.map(item => {
|
||||
return {
|
||||
displayName: item.spec.displayName,
|
||||
name: item.metadata.name,
|
||||
...item,
|
||||
}
|
||||
})
|
||||
this.triggered = false;
|
||||
this.loading = 'success';
|
||||
if (this.dataList.length !== 0) {
|
||||
this.currentCategoryName = this.dataList[0].metadata.name;
|
||||
this.fnGetPostByCategory()
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
}, 500);
|
||||
});
|
||||
},
|
||||
handlePreview(index, list) {
|
||||
uni.previewImage({
|
||||
current: index,
|
||||
urls: list.map(item => item.url)
|
||||
})
|
||||
},
|
||||
handleToCategory(data) {
|
||||
if (this.calcAuditModeEnabled) {
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/pagesA/category-detail/category-detail?name=${data.metadata.name}&title=${data.spec.displayName}`
|
||||
})
|
||||
},
|
||||
fnGetPostByCategory(isPulldownRefresh = true, triggered = true) {
|
||||
if (!isPulldownRefresh) {
|
||||
if (this.hasNext) {
|
||||
this.postQueryParams.page += 1;
|
||||
} else {
|
||||
return uni.showToast({
|
||||
icon: 'none',
|
||||
title: '没有更多数据了'
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.postQueryParams.page = 0;
|
||||
if (triggered) {
|
||||
this.triggered = true;
|
||||
}
|
||||
}
|
||||
|
||||
this.$httpApi.v2
|
||||
.getCategoryPostList(this.currentCategoryName, this.postQueryParams)
|
||||
.then(res => {
|
||||
this.hasNext = res.hasNext;
|
||||
|
||||
if (!isPulldownRefresh) {
|
||||
this.postList = this.postList.concat(res.items);
|
||||
} else {
|
||||
this.postList = res.items;
|
||||
}
|
||||
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
})
|
||||
.catch(err => {
|
||||
this.loadMoreText = '加载失败!';
|
||||
})
|
||||
.finally(() => {
|
||||
this.triggered = false;
|
||||
});
|
||||
},
|
||||
|
||||
fnOnCategoryChange(e) {
|
||||
this.fnResetSetAniWaitIndex();
|
||||
this.currentCategoryName = this.dataList[e].metadata.name;
|
||||
this.fnToTopScroll();
|
||||
this.postList = [];
|
||||
this.fnGetPostByCategory();
|
||||
},
|
||||
|
||||
fnOnScroll(e) {
|
||||
this.tempScrollTop = e.detail.scrollTop;
|
||||
},
|
||||
fnToTopScroll() {
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 500
|
||||
});
|
||||
this.scrollTop = 0;
|
||||
this.tempScrollTop = 0;
|
||||
},
|
||||
fnOnTouchStart() {
|
||||
clearTimeout(this.scrollTimeout);
|
||||
},
|
||||
fnOnTouchEnd() {
|
||||
this.scrollTimeout = setTimeout(() => {
|
||||
this.scrollTop = this.tempScrollTop;
|
||||
}, 500);
|
||||
},
|
||||
//跳转文章详情
|
||||
fnToArticleDetail(post) {
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/article-detail/article-detail?name=' + post.metadata.name,
|
||||
animationType: 'slide-in-right'
|
||||
});
|
||||
},
|
||||
fnScrollTop() {
|
||||
if (this.calcShowType === 'list') {
|
||||
this.fnToTopPage()
|
||||
} else {
|
||||
this.fnToTopScroll()
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fff;
|
||||
}
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 24rpx 0;
|
||||
}
|
||||
|
||||
.content {
|
||||
height: 100vh;
|
||||
background-color: #fafafa;
|
||||
}
|
||||
.auditModeEnabled {
|
||||
width: 100%;
|
||||
height: 80vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.category-empty {
|
||||
width: 100%;
|
||||
height: 70vh;
|
||||
}
|
||||
.loading-wrap {
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.article-empty {
|
||||
width: 100%;
|
||||
height: 70vh;
|
||||
}
|
||||
.app-page-content {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding: 0 12rpx;
|
||||
gap: 20rpx 0;
|
||||
|
||||
.right-content {
|
||||
// width: calc(100vw - 144rpx);
|
||||
width: calc(100vw - 190rpx);
|
||||
height: 100vh;
|
||||
background-color: #fff;
|
||||
white-space: nowrap;
|
||||
background-color: #fafafa;
|
||||
}
|
||||
&.list-post {
|
||||
padding: 0;
|
||||
gap: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.loading-wrap {
|
||||
padding: 24rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
.catgory-card {
|
||||
width: 100%;
|
||||
height: 200rpx;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
border-radius: 12rpx;
|
||||
background-color: #ffff;
|
||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
overflow: hidden;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
|
||||
&:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.15);
|
||||
backdrop-filter: blur(3rpx);
|
||||
z-index: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.load-text {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.flot-buttons {
|
||||
position: fixed;
|
||||
bottom: 100rpx;
|
||||
right: 32rpx;
|
||||
flex-direction: column;
|
||||
display: flex;
|
||||
gap: 6rpx;
|
||||
z-index: 999;
|
||||
}
|
||||
</style>
|
||||
|
||||
+265
-203
@@ -1,108 +1,64 @@
|
||||
<template>
|
||||
<view class="app-page">
|
||||
<!-- 顶部切换 -->
|
||||
<view class="e-fixed" v-if="category.list.length > 2">
|
||||
<tm-tabs color="light-blue" v-model="category.activeIndex" :list="category.list" align="left" @change="fnOnCategoryChange"></tm-tabs>
|
||||
</view>
|
||||
<!-- 占位区域 -->
|
||||
<view style="width: 100vw;height: 90rpx;"></view>
|
||||
<!-- 加载区域 -->
|
||||
<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>
|
||||
</view>
|
||||
<!-- 内容区域 -->
|
||||
<view class="content" v-else>
|
||||
<view v-if="dataList.length == 0" class="content-empty">
|
||||
<!-- 空布局 -->
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有分享图片~"></tm-empty>
|
||||
<view class="app-page" :class="[uniHaloPluginPageClass]">
|
||||
<PluginUnavailable v-if="!uniHaloPluginAvailable" :pluginId="uniHaloPluginId"
|
||||
:error-text="uniHaloPluginAvailableError" />
|
||||
<template v-else>
|
||||
<!-- 顶部切换 -->
|
||||
<view class="e-fixed" v-if="category.list.length > 0">
|
||||
<tm-tabs color="light-blue" :shadow="0" v-model="category.activeIndex" range-key="displayName"
|
||||
:list="category.list" align="left" @change="fnOnCategoryChange($event, false)"></tm-tabs>
|
||||
</view>
|
||||
<block v-else>
|
||||
<tm-flowLayout v-if="globalAppSettings.gallery.useWaterfull" @click="fnOnClick" ref="wafll">
|
||||
<template v-slot:left="{ hdata }">
|
||||
<tm-translate animation-name="fadeUp">
|
||||
<view class="card round-3 overflow white">
|
||||
<tm-images :previmage="false" :src="hdata.item.image" @click="fnPreview(hdata.item)"></tm-images>
|
||||
<view class="pa-10 text-size-s">
|
||||
<view class="text-overflow-2">
|
||||
<tm-tags color="bg-gradient-amber-accent" :shadow="0" :dense="true" size="s" model="fill">{{ hdata.item.team }}</tm-tags>
|
||||
<text class="pl-6">{{ hdata.item.name }}</text>
|
||||
</view>
|
||||
<view v-if="hdata.item.description" class="ma-10">{{ hdata.item.description }}</view>
|
||||
<view v-if="hdata.item.location" class="mt-10 text-grey-lighten-1">
|
||||
<tm-icons name="icon-position-fill"></tm-icons>
|
||||
<text class="pl-5">{{ hdata.item.location }}</text>
|
||||
</view>
|
||||
<view class="flex-between mt-12 flex-center">
|
||||
<view>
|
||||
<text class="text-size-xs text-red ml-5">{{ hdata.item.likes }}</text>
|
||||
<text class="text-size-xs text-red ml-5">喜欢</text>
|
||||
</view>
|
||||
<view class="pl-10 text-size-xs text-grey-lighten-1">{{ hdata.item.takeTime }}</view>
|
||||
</view>
|
||||
<!-- 占位区域 -->
|
||||
<view v-if="category.list.length > 0" style="width: 100vw;height: 90rpx;"></view>
|
||||
<!-- 加载区域 -->
|
||||
<view v-if="loading == 'loading'" 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>
|
||||
</view>
|
||||
<view v-else-if="loading == 'error'" class="flex flex-col flex-center" style="width:100%;height:60vh;">
|
||||
<tm-empty icon="icon-wind-cry" label="阿偶,似乎获取数据失败了~">
|
||||
<tm-button theme="light-blue" size="m" :shadow="0" @click="fnGetData(true)">刷新试试</tm-button>
|
||||
</tm-empty>
|
||||
</view>
|
||||
<!-- 内容区域 -->
|
||||
<view v-else class="content">
|
||||
<k-touch-listen class="touch-listen-content" @touchLeft="touchLeft" @touchRight="touchRight">
|
||||
<view v-if="dataList.length === 0" class="content-empty">
|
||||
<!-- 空布局 -->
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有分享图片~"></tm-empty>
|
||||
</view>
|
||||
<block v-else>
|
||||
<block v-if="galleryConfig.useWaterfall">
|
||||
<!--瀑布流-->
|
||||
<tm-flowLayout-custom ref="wafll" style="width: 100%;"
|
||||
@click="fnOnFlowClick"></tm-flowLayout-custom>
|
||||
</block>
|
||||
<!-- 列表 -->
|
||||
<block v-else>
|
||||
<tm-translate v-for="(item, index) in dataList" :key="index"
|
||||
style="box-sizing: border-box;padding: 6rpx;width: 50%;height: 250rpx;"
|
||||
animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||
<view style="border-radius: 12rpx;overflow: hidden;width: 100%;height: 250rpx;">
|
||||
<image style="width: 100%;height: 100%;" mode="aspectFill" :src="item.spec.url"
|
||||
@click="fnPreview(item)" />
|
||||
</view>
|
||||
</view>
|
||||
</tm-translate>
|
||||
</template>
|
||||
<template v-slot:right="{ hdata }">
|
||||
<tm-translate animation-name="fadeUp">
|
||||
<view class="card round-3 overflow white">
|
||||
<tm-images :previmage="false" :src="hdata.item.image" @click="fnPreview(hdata.item)"></tm-images>
|
||||
<view class="pa-10 text-size-s">
|
||||
<view class="text-overflow-2">
|
||||
<tm-tags :shadow="0" :dense="true" color="bg-gradient-amber-accent" size="s" model="fill">{{ hdata.item.team }}</tm-tags>
|
||||
<text class="pl-6">{{ hdata.item.name }}</text>
|
||||
</view>
|
||||
<view v-if="hdata.item.description" class="ma-10">{{ hdata.item.description }}</view>
|
||||
<view v-if="hdata.item.location" class="mt-10 text-grey-lighten-1">
|
||||
<tm-icons name="icon-position-fill"></tm-icons>
|
||||
<text class="pl-5">{{ hdata.item.location }}</text>
|
||||
</view>
|
||||
<view class="flex-between mt-12 flex-center">
|
||||
<view>
|
||||
<text class="text-size-xs text-red ml-5">{{ hdata.item.likes }}</text>
|
||||
<text class="text-size-xs text-red ml-5">喜欢</text>
|
||||
</view>
|
||||
<view class="pl-10 text-size-xs text-grey-lighten-1">{{ hdata.item.takeTime }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</tm-translate>
|
||||
</template>
|
||||
</tm-flowLayout>
|
||||
<block v-else>
|
||||
<block v-for="(item, index) in dataList" :key="index">
|
||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||
<view class="round-3 shadow-2 overflow white mb-24">
|
||||
<tm-images :previmage="false" :src="item.image" @click="fnPreview(item)"></tm-images>
|
||||
<view class="pa-24 text-size-m">
|
||||
<view class="text-overflow-2">
|
||||
<tm-tags :shadow="0" :dense="true" color="bg-gradient-amber-accent" size="s" model="fill">{{ item.team }}</tm-tags>
|
||||
<text class="pl-6">{{ item.name }}</text>
|
||||
</view>
|
||||
<view v-if="item.description" class="ma-10">{{ item.description }}</view>
|
||||
<view v-if="item.location" class="mt-10 text-grey-lighten-1">
|
||||
<tm-icons name="icon-position-fill"></tm-icons>
|
||||
<text class="pl-5">{{ item.location }}</text>
|
||||
</view>
|
||||
<view class="flex-between mt-12 flex-center">
|
||||
<view>
|
||||
<text class="text-size-m text-red ml-5">{{ item.likes }}</text>
|
||||
<text class="text-size-m text-red ml-5">喜欢</text>
|
||||
</view>
|
||||
<view class="pl-10 text-size-m text-grey-lighten-1">{{ item.takeTime }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</tm-translate>
|
||||
</tm-translate>
|
||||
</block>
|
||||
|
||||
<view class="load-text">{{ loadMoreText }}</view>
|
||||
</block>
|
||||
</block>
|
||||
<tm-flotbutton @click="fnToTopPage" color="light-blue" size="m" icon="icon-angle-up"></tm-flotbutton>
|
||||
<view class="load-text">{{ loadMoreText }}</view>
|
||||
</block>
|
||||
</view>
|
||||
</k-touch-listen>
|
||||
</view>
|
||||
|
||||
<view v-if="!calcAuditModeEnabled" class="flot-buttons">
|
||||
<tm-button v-if="loading == 'error'" @click="fnGetCategory" size="m" :fab="true" theme="light-blue"
|
||||
icon="icon-sync-alt"></tm-button>
|
||||
<tm-button @click="fnToTopPage" size="m" :fab="true" theme="light-blue"
|
||||
icon="icon-angle-up"></tm-button>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -114,10 +70,17 @@
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
|
||||
import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue';
|
||||
import tmFlowLayout from '@/tm-vuetify/components/tm-flowLayout/tm-flowLayout.vue';
|
||||
import tmFlowLayoutCustom from '@/tm-vuetify/components/tm-flowLayout-custom/tm-flowLayout-custom.vue';
|
||||
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
|
||||
import pluginAvailable from "@/common/mixins/pluginAvailable.js"
|
||||
import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue'
|
||||
export default {
|
||||
options: {
|
||||
multipleSlots: true
|
||||
},
|
||||
mixins: [pluginAvailable],
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmTranslate,
|
||||
@@ -126,8 +89,10 @@
|
||||
tmEmpty,
|
||||
tmIcons,
|
||||
tmImages,
|
||||
tmFlowLayout,
|
||||
tmTabs
|
||||
tmFlowLayoutCustom,
|
||||
tmTabs,
|
||||
tmButton,
|
||||
PluginUnavailable
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -140,54 +105,72 @@
|
||||
},
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0,
|
||||
team: null,
|
||||
keyword: ''
|
||||
},
|
||||
cache: {
|
||||
dataList: [],
|
||||
total: 0
|
||||
page: 1,
|
||||
group: ""
|
||||
},
|
||||
isLoadMore: false,
|
||||
loadMoreText: '',
|
||||
result: {},
|
||||
dataList: []
|
||||
hasNext: false,
|
||||
dataList: [],
|
||||
lock: false
|
||||
};
|
||||
},
|
||||
filters: {
|
||||
filterTakeTime(val) {
|
||||
return uni.$tm.dayjs(val).format('DD/MM/YYYY');
|
||||
}
|
||||
computed: {
|
||||
galleryConfig() {
|
||||
return this.$tm.vx.getters().getConfigs.pageConfig.galleryConfig;
|
||||
},
|
||||
haloConfigs() {
|
||||
return this.$tm.vx.getters().getConfigs;
|
||||
},
|
||||
mockJson() {
|
||||
return this.$tm.vx.getters().getMockJson;
|
||||
},
|
||||
calcAuditModeEnabled() {
|
||||
return this.haloConfigs.auditConfig.auditModeEnabled
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
globalAppSettings: {
|
||||
galleryConfig: {
|
||||
async handler(newValue, oldValue) {
|
||||
if (!newValue) return;
|
||||
this.fnSetPageTitle(newValue.pageTitle);
|
||||
this.fnGetCategory();
|
||||
},
|
||||
deep: true,
|
||||
handler() {
|
||||
// this.isLoadMore = false;
|
||||
// this.queryParams.page = 0;
|
||||
// this.dataList = [];
|
||||
// this.cache.list = [];
|
||||
// this.cache.total = 0;
|
||||
}
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('个人图库');
|
||||
this.fnGetCategory();
|
||||
},
|
||||
created() {
|
||||
this.fnGetData();
|
||||
async onLoad() {
|
||||
// 检查插件
|
||||
this.setPluginId(this.NeedPluginIds.PluginPhotos)
|
||||
this.setPluginError("阿偶,检测到当前插件没有安装或者启用,无法使用图库功能哦,请联系管理员")
|
||||
await this.checkPluginAvailable()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
if (!this.uniHaloPluginAvailable) {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
return
|
||||
}
|
||||
this.dataList = []
|
||||
this.isLoadMore = false;
|
||||
this.queryParams.page = 0;
|
||||
this.fnGetData();
|
||||
this.queryParams.page = 1;
|
||||
this.fnGetData(true);
|
||||
},
|
||||
onReachBottom(e) {
|
||||
if (this.result.hasNext) {
|
||||
if (!this.uniHaloPluginAvailable) return;
|
||||
if (this.calcAuditModeEnabled) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '没有更多数据了'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.hasNext) {
|
||||
this.queryParams.page += 1;
|
||||
this.isLoadMore = true;
|
||||
this.fnGetData();
|
||||
this.fnGetData(false);
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
@@ -196,98 +179,159 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fnOnCategoryChange(index) {
|
||||
fnGetDataByCategory(index) {
|
||||
this.fnResetSetAniWaitIndex();
|
||||
this.dataList = [];
|
||||
if (index == 0) {
|
||||
this.queryParams.team = null;
|
||||
} else {
|
||||
this.queryParams.team = this.category.list[index];
|
||||
}
|
||||
this.queryParams.page = 0;
|
||||
this.queryParams.group = this.category.list[index].name;
|
||||
this.queryParams.page = 1;
|
||||
this.fnToTopPage();
|
||||
this.fnGetData();
|
||||
this.dataList = [];
|
||||
this.fnGetData(true);
|
||||
},
|
||||
fnOnCategoryChange(index) {
|
||||
if (this.lock) {
|
||||
// uni.showToast({
|
||||
// title: "上一个请求进行中...",
|
||||
// icon: "none"
|
||||
// })
|
||||
return;
|
||||
}
|
||||
this.fnGetDataByCategory(index)
|
||||
},
|
||||
fnGetCategory() {
|
||||
this.$httpApi.getPhotoTeams().then(res => {
|
||||
this.category.list = ['全部', ...res.data];
|
||||
if (this.calcAuditModeEnabled) {
|
||||
this.fnGetData(true);
|
||||
return
|
||||
}
|
||||
this.$httpApi.v2.getPhotoGroupList({
|
||||
page: 1,
|
||||
size: 0
|
||||
}).then(res => {
|
||||
this.category.list = res.items.map(item => {
|
||||
return {
|
||||
name: item.metadata.name,
|
||||
displayName: item.spec.displayName,
|
||||
priority: item.spec.priority
|
||||
}
|
||||
}).sort((a, b) => a.priority - b.priority);
|
||||
|
||||
if (this.category.list.length !== 0) {
|
||||
this.queryParams.group = this.category.list[0].name;
|
||||
this.fnGetData(true);
|
||||
}
|
||||
}).catch(e => {
|
||||
this.loading = 'error'
|
||||
this.category.list = []
|
||||
this.category.activeIndex = 0
|
||||
this.category.activeValue = ""
|
||||
});
|
||||
},
|
||||
fnGetData() {
|
||||
// uni.showLoading({
|
||||
// mask: true,
|
||||
// title: '加载中...'
|
||||
// });
|
||||
fnGetData(isClearWaterfall = false) {
|
||||
if (this.calcAuditModeEnabled) {
|
||||
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();
|
||||
this.lock = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置状态为加载中
|
||||
if (!this.isLoadMore) {
|
||||
this.loading = 'loading';
|
||||
}
|
||||
this.loadMoreText = '';
|
||||
this.$httpApi
|
||||
.getPhotoListByPage(this.queryParams)
|
||||
this.$httpApi.v2
|
||||
.getPhotoListByGroupName(this.queryParams)
|
||||
.then(res => {
|
||||
if (res.status == 200) {
|
||||
this.loading = 'success';
|
||||
this.result = res.data;
|
||||
if (res.data.content.length != 0) {
|
||||
const _list = res.data.content.map((item, index) => {
|
||||
item['image'] = this.$utils.checkImageUrl(item.thumbnail);
|
||||
item['model'] = 'text';
|
||||
item['takeTime'] = this.$tm.dayjs(item['takeTime']).format('DD/MM/YYYY');
|
||||
return item;
|
||||
});
|
||||
this.fnCacheDataList(_list);
|
||||
if (this.globalAppSettings.gallery.useWaterfull) {
|
||||
this.dataList = _list;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.wafll.pushData(_list);
|
||||
});
|
||||
} else {
|
||||
this.dataList = this.dataList.concat(_list);
|
||||
}
|
||||
this.hasNext = res.hasNext;
|
||||
this.loading = 'success';
|
||||
if (res.items.length !== 0) {
|
||||
const _list = res.items.map((item, index) => {
|
||||
item.spec.url = this.$utils.checkImageUrl(item.spec.url || item.spec.cover);
|
||||
return item;
|
||||
});
|
||||
if (this.isLoadMore) {
|
||||
this.dataList = this.dataList.concat(_list);
|
||||
} else {
|
||||
this.dataList = _list;
|
||||
}
|
||||
if (this.galleryConfig.useWaterfall) {
|
||||
this.$nextTick(() => {
|
||||
if (isClearWaterfall) {
|
||||
this.$refs.wafll.clear()
|
||||
}
|
||||
this.$refs.wafll.pushData(_list)
|
||||
})
|
||||
}
|
||||
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
} else {
|
||||
this.loading = 'error';
|
||||
this.waterfall.loading = 'finish';
|
||||
this.loadMoreText = '';
|
||||
}
|
||||
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
this.waterfall.loading = 'finish';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
this.lock = false;
|
||||
}, 500);
|
||||
});
|
||||
},
|
||||
// 缓存数据
|
||||
fnCacheDataList(dataList) {
|
||||
if (this.queryParams.page == 0) {
|
||||
this.cache.dataList = dataList;
|
||||
} else {
|
||||
this.cache.dataList = [...this.cache.dataList, ...dataList];
|
||||
}
|
||||
},
|
||||
|
||||
// 瀑布流组件点击事件
|
||||
fnOnClick(data) {
|
||||
console.log('点击数据', data);
|
||||
fnOnFlowClick({
|
||||
item
|
||||
}) {
|
||||
this.fnPreview(item)
|
||||
},
|
||||
// 预览
|
||||
fnPreview(item) {
|
||||
const index = this.cache.dataList.findIndex(x => x.id == item.id);
|
||||
fnPreview(data) {
|
||||
uni.previewImage({
|
||||
current: index,
|
||||
urls: this.cache.dataList.map(x => x.image),
|
||||
current: this.dataList.findIndex(x => x.metadata.name === data.metadata.name),
|
||||
urls: this.dataList.map(x => x.spec.url),
|
||||
indicator: 'number',
|
||||
loop: true
|
||||
});
|
||||
},
|
||||
touchLeft() {
|
||||
if (this.loading != "success") return;
|
||||
this.category.activeIndex += 1
|
||||
if (this.category.activeIndex >= this.category.list.length) {
|
||||
this.category.activeIndex = 0
|
||||
}
|
||||
this.lock = true
|
||||
this.fnGetDataByCategory(this.category.activeIndex)
|
||||
},
|
||||
touchRight() {
|
||||
if (this.loading != "success") return;
|
||||
this.category.activeIndex -= 1
|
||||
if (this.category.activeIndex < 0) {
|
||||
this.category.activeIndex = 0
|
||||
}
|
||||
this.lock = true
|
||||
this.fnGetDataByCategory(this.category.activeIndex)
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -301,31 +345,49 @@
|
||||
flex-direction: column;
|
||||
padding-bottom: 24rpx;
|
||||
background-color: #fafafa;
|
||||
|
||||
&.is-balck {
|
||||
background-color: #212121;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
box-sizing: border-box;
|
||||
padding: 0 24rpx;
|
||||
padding-top: 24rpx;
|
||||
|
||||
.content-empty {
|
||||
height: 60vh;
|
||||
width: 100%;
|
||||
height: 70vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
.touch-listen-content {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
box-sizing: border-box;
|
||||
padding: 24rpx 24rpx 0;
|
||||
gap: 12rpx 0;
|
||||
}
|
||||
|
||||
.loading-wrap {
|
||||
box-sizing: border-box;
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.card {
|
||||
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
.load-text {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.flot-buttons {
|
||||
position: fixed;
|
||||
bottom: 100rpx;
|
||||
right: 32rpx;
|
||||
flex-direction: column;
|
||||
display: flex;
|
||||
gap: 6rpx;
|
||||
z-index: 999;
|
||||
}
|
||||
</style>
|
||||
+416
-145
@@ -1,16 +1,18 @@
|
||||
<template>
|
||||
<view class="app-page">
|
||||
<tm-menubars iconColor="white" color="white" :flat="true" :showback="false">
|
||||
<image slot="left" class="logo ml-24 round-24" :src="bloggerInfo.avatar" mode="scaleToFill" @click="$tm.toast('以后会放一个彩蛋~')"></image>
|
||||
<view slot="left">
|
||||
<image @click="fnOnLogoToPage" class="logo ml-24 round-24" :src="appInfo.logo" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="search-input round-12 pt-12 pb-12 flex pl-24" @click="fnToSearch">
|
||||
<text class="search-input_icon iconfont text-size-m icon-search text-grey"></text>
|
||||
<view class="search-input_text pl-12 text-size-m text-grey">搜索文章...</view>
|
||||
<view class="search-input_text pl-12 text-size-m text-grey">搜索内容...</view>
|
||||
</view>
|
||||
<!-- #ifdef APP-PLUS || H5 -->
|
||||
<view slot="right" class="mr-24 text-size-m text-grey">uni-halo</view>
|
||||
<view slot="right" class="mr-24 text-size-m text-grey text-overflow">{{ appInfo.name }}</view>
|
||||
<!-- #endif -->
|
||||
</tm-menubars>
|
||||
<view v-if="loading != 'success'" class="loading-wrap">
|
||||
<view v-if="loading !== 'success' && articleList.length===0" class="loading-wrap">
|
||||
<tm-skeleton model="card"></tm-skeleton>
|
||||
<tm-skeleton model="cardActions"></tm-skeleton>
|
||||
<tm-skeleton model="list"></tm-skeleton>
|
||||
@@ -19,42 +21,65 @@
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
</view>
|
||||
<block v-else>
|
||||
<view class="bg-white pb-24">
|
||||
<!-- 轮播图+广告 -->
|
||||
<view class="banner bg-white ml-24 mr-24 mt-12 round-3" v-if="bannerList.length != 0">
|
||||
<e-swiper :dotPosition="globalAppSettings.banner.dotPosition" :autoplay="true" :useDot="globalAppSettings.banner.useDot" :list="bannerList" @on-click="fnOnBannerClick"></e-swiper>
|
||||
<view v-if="bannerConfig.enabled" class="bg-white pb-24">
|
||||
<view class="banner bg-white ml-24 mr-24 mt-12 round-3" v-if="bannerList.length !== 0">
|
||||
<e-swiper :height="bannerConfig.height" :dotPosition="bannerConfig.dotPosition" :autoplay="true"
|
||||
:useDot="bannerConfig.showIndicator" :showTitle="bannerConfig.showTitle"
|
||||
:type="bannerConfig.type" :list="bannerList" @on-click="fnOnBannerClick" />
|
||||
</view>
|
||||
<!-- 快捷导航 -->
|
||||
<!-- <view v-if="useQuickNav" class="quick-nav flex-between round-3 flex mt-12 ml-12 mr-12 pa-24">
|
||||
<view class="quick-nav-item flex flex-col flex-center" v-for="(nav, index) in quickNavList" :key="index" @click="fnToNavPage(nav)">
|
||||
<tm-icons :size="120" :name="nav.icon"></tm-icons>
|
||||
<view class="name text-size-s mt-4">{{ nav.text }}</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<!-- 金刚区 :v-if="navList.filter(x=>x.show).length>=4" -->
|
||||
<view :v-if="navList.filter(x=>x.show).length>=4" class="nav-box mt-16 mb-24 pl-24 pr-24 uh-py-12">
|
||||
<view class="page-item_title text-weight-b ">快捷导航</view>
|
||||
<view class="nav-list flex uh-mt-12">
|
||||
<template v-for="(item,index) in navList">
|
||||
<view v-if="item.show" class="nav-item" :key="index" @click="fnClickNav(item)">
|
||||
<!-- :class="[item.bgClass]" -->
|
||||
<view class="nav-item-icon" :style="{
|
||||
'--bgColor':item.bgColor,
|
||||
boxShadow: '0rpx 0rpx 6rpx ' + item.shadow,
|
||||
backgroundColor: item.bgColor
|
||||
}">
|
||||
<tm-icons :size="48" color="white" prefx="halocoloricon" :name="item.icon"></tm-icons>
|
||||
</view>
|
||||
<view class="nav-item-text">
|
||||
{{item.title}}
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 精品分类 -->
|
||||
<view class="flex flex-between mt-16 mb-24 pl-24 pr-24">
|
||||
<view class="page-item_title text-weight-b ">精品分类</view>
|
||||
<view class="show-more flex flex-center bg-white round-3" @click="fnToCategoryPage">
|
||||
<text class="iconfont icon-angle-right text-size-s text-grey-darken-1"></text>
|
||||
</view>
|
||||
<view v-if="false" class="flex flex-center text-size-s text-grey-darken-1" @click="fnToCategoryPage">
|
||||
<text class=" text-size-m">查看更多</text>
|
||||
<text class="iconfont icon-angle-right text-size-s "></text>
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view class="category" scroll-x="true">
|
||||
<view v-if="categoryList.length == 0" class="cate-empty round-3 mr-5 flex flex-center text-grey">还没有任何文章分类~</view>
|
||||
<block v-else>
|
||||
<view class="content" v-for="(category, index) in categoryList" :key="category.createTime" @click="fnToCategoryBy(category)">
|
||||
<category-mini-card :category="category"></category-mini-card>
|
||||
<block v-if="calcIsShowCategory">
|
||||
<view class="flex flex-between mt-16 mb-24 pl-24 pr-24">
|
||||
<view class="page-item_title text-weight-b ">精选分类</view>
|
||||
<view class="show-more flex flex-center bg-white round-3" @click="fnToCategoryPage">
|
||||
<text class="iconfont icon-angle-right text-size-s text-grey-darken-1"></text>
|
||||
</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
<view v-if="false" class="flex flex-center text-size-s text-grey-darken-1"
|
||||
@click="fnToCategoryPage">
|
||||
<text class=" text-size-m">查看更多</text>
|
||||
<text class="iconfont icon-angle-right text-size-s "></text>
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view class="category" scroll-x="true">
|
||||
<view v-if="categoryList.length === 0" class="cate-empty round-3 mr-5 flex flex-center text-grey">
|
||||
还没有任何分类~
|
||||
</view>
|
||||
<block v-else>
|
||||
<view class="content" v-for="(category, index) in categoryList" :key="category.metadata.name"
|
||||
@click="fnToCategoryBy(category)">
|
||||
<category-mini-card :category="category"></category-mini-card>
|
||||
</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
</block>
|
||||
|
||||
<!-- 最新文章 -->
|
||||
<view class="flex flex-between mt-24 mb-24 pl-24 pr-24">
|
||||
<view class="page-item_title text-weight-b">最新文章</view>
|
||||
<view class="page-item_title text-weight-b">最新列表</view>
|
||||
<view class="show-more flex flex-center bg-white round-3" @click="fnToArticlesPage">
|
||||
<text class="iconfont icon-angle-right text-size-s text-grey-darken-1"></text>
|
||||
</view>
|
||||
@@ -63,29 +88,27 @@
|
||||
<text class="iconfont icon-angle-right text-size-s "></text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="articleList.length == 0" class="article-empty"><tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有发表任何文章~"></tm-empty></view>
|
||||
<view v-if="articleList.length === 0" class="article-empty">
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有发表任何内容~"></tm-empty>
|
||||
</view>
|
||||
<block v-else>
|
||||
<view :class="globalAppSettings.layout.home">
|
||||
<block v-for="(article, index) in articleList" :key="article.createTime">
|
||||
<tm-translate class="ani-item" animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||
<article-card from="home" :article="article" @on-click="fnToArticleDetail"></article-card>
|
||||
<!-- 广告区域 -->
|
||||
<view v-if="haloAdConfig.home.use && (index + 1) % haloAdConfig.frequency == 0" class="ad-wrap ma-24">
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<ad v-if="haloAdConfig.unitId" :unit-id="haloAdConfig.unitId"></ad>
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<ad v-if="haloAdConfig.adpid" :adpid="haloAdConfig.adpid"></ad>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</tm-translate>
|
||||
</block>
|
||||
<tm-translate v-for="(article, index) in articleList" :key="index" class="ani-item"
|
||||
animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||
<article-card from="home" :article="article" :post="article"
|
||||
@on-click="fnToArticleDetail"></article-card>
|
||||
</tm-translate>
|
||||
</view>
|
||||
<view class="load-text mt-12">{{ loadMoreText }}</view>
|
||||
<tm-flotbutton v-if="articleList.length > 10" color="light-blue" @click="fnToTopPage" size="m" icon="icon-angle-up"></tm-flotbutton>
|
||||
<tm-flotbutton v-if="articleList.length > 10" :width="90" color="light-blue" @click="fnToTopPage"
|
||||
size="s" icon="icon-angle-up"></tm-flotbutton>
|
||||
</block>
|
||||
</block>
|
||||
<!-- <tm-flotbutton @click="fnChangeMode" size="m" color="light-blue" :icon="$tm.vx.state().tmVuetify.black ? 'icon-lightbulb' : 'icon-lightbulb-fill'"></tm-flotbutton> -->
|
||||
|
||||
|
||||
<!-- 弹窗 -->
|
||||
<NotifyDialog v-if="notify.show" :show="notify.show" :title="notify.data.title" :content="notify.data.content"
|
||||
:url="notify.data.url" @on-change="fnOnNotifyChange"></NotifyDialog>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -96,8 +119,11 @@
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import tmGrid from '@/tm-vuetify/components/tm-grid/tm-grid.vue';
|
||||
|
||||
import eSwiper from '@/components/e-swiper/e-swiper.vue';
|
||||
import NotifyDialog from "@/components/notify-dialog/notify-dialog.vue";
|
||||
import qs from 'qs'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -107,14 +133,17 @@
|
||||
tmFlotbutton,
|
||||
tmIcons,
|
||||
tmEmpty,
|
||||
eSwiper
|
||||
tmGrid,
|
||||
eSwiper,
|
||||
NotifyDialog
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0
|
||||
size: 5,
|
||||
page: 1,
|
||||
sort: ['spec.pinned,desc', 'spec.publishTime,desc']
|
||||
},
|
||||
result: {},
|
||||
isLoadMore: false,
|
||||
@@ -124,34 +153,75 @@
|
||||
noticeList: [],
|
||||
articleList: [],
|
||||
categoryList: [],
|
||||
useQuickNav: false,
|
||||
quickNavList: []
|
||||
notify: {
|
||||
show: false,
|
||||
data: {}
|
||||
},
|
||||
navList: []
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
haloConfigs() {
|
||||
return this.$tm.vx.getters().getConfigs;
|
||||
},
|
||||
bloggerInfo() {
|
||||
let blogger = this.$tm.vx.getters().getBlogger;
|
||||
const blogger = this.$tm.vx.getters().getConfigs.authorConfig.blogger;
|
||||
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
|
||||
return blogger;
|
||||
},
|
||||
|
||||
appInfo() {
|
||||
const appInfo = this.haloConfigs.appConfig.appInfo;
|
||||
appInfo.logo = this.$utils.checkImageUrl(appInfo.logo)
|
||||
return appInfo;
|
||||
},
|
||||
mockJson() {
|
||||
return this.$tm.vx.getters().getMockJson;
|
||||
},
|
||||
calcAuditModeEnabled() {
|
||||
return this.haloConfigs.auditConfig.auditModeEnabled
|
||||
},
|
||||
calcIsShowCategory() {
|
||||
if (this.calcAuditModeEnabled && this.categoryList.length !== 0) {
|
||||
return false
|
||||
}
|
||||
if (this.calcAuditModeEnabled) {
|
||||
return false
|
||||
}
|
||||
return this.haloConfigs.pageConfig.homeConfig.useCategory
|
||||
},
|
||||
bannerConfig() {
|
||||
return this.haloConfigs.pageConfig.homeConfig.bannerConfig
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
haloConfigs: {
|
||||
handler(val) {
|
||||
if (!val) return;
|
||||
this.fnGetNavList();
|
||||
},
|
||||
deep: true,
|
||||
immediate: true,
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.fnSetPageTitle();
|
||||
this.useQuickNav = this.$haloConfig.quickNav.use;
|
||||
},
|
||||
|
||||
created() {
|
||||
this.fnQuery();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.isLoadMore = false;
|
||||
this.queryParams.page = 0;
|
||||
this.queryParams.page = 1;
|
||||
this.fnQuery();
|
||||
},
|
||||
|
||||
onReachBottom(e) {
|
||||
if (this.calcAuditModeEnabled) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '没有更多数据了'
|
||||
});
|
||||
return
|
||||
}
|
||||
if (this.result.hasNext) {
|
||||
this.queryParams.page += 1;
|
||||
this.isLoadMore = true;
|
||||
@@ -168,21 +238,34 @@
|
||||
this.fnGetBanner();
|
||||
this.fnGetArticleList();
|
||||
this.fnGetCategoryList();
|
||||
this.fnGetQuickNavList();
|
||||
},
|
||||
fnGetQuickNavList() {
|
||||
this.useQuickNav = this.$haloConfig.quickNav.use;
|
||||
if (!this.$haloConfig.quickNav.use) return;
|
||||
const _quickNavList = this.$haloConfig.quickNav.list;
|
||||
this.quickNavList = _quickNavList.map(item => {
|
||||
return item;
|
||||
});
|
||||
},
|
||||
fnGetCategoryList() {
|
||||
this.$httpApi
|
||||
.getCategoryList({ more: true })
|
||||
if (this.calcAuditModeEnabled) {
|
||||
this.categoryList = this.mockJson.home.categoryList.map((item) => {
|
||||
return {
|
||||
metadata: {
|
||||
name: Date.now() * Math.random(),
|
||||
},
|
||||
spec: {
|
||||
displayName: item.title,
|
||||
cover: item.cover
|
||||
},
|
||||
postCount: 0
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.calcIsShowCategory) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.$httpApi.v2
|
||||
.getCategoryList({
|
||||
fieldSelector: ['spec.hideFromList=false']
|
||||
})
|
||||
.then(res => {
|
||||
this.categoryList = res.data.sort((a, b) => {
|
||||
this.categoryList = res.items.sort((a, b) => {
|
||||
return b.postCount - a.postCount;
|
||||
});
|
||||
|
||||
@@ -203,102 +286,185 @@
|
||||
},
|
||||
// 获取轮播图
|
||||
fnGetBanner() {
|
||||
const _this = this;
|
||||
const _format = function(list, type) {
|
||||
return list.map((item, index) => {
|
||||
switch (type) {
|
||||
case 'list':
|
||||
return {
|
||||
id: index,
|
||||
nickname: _this.bloggerInfo.nickname,
|
||||
avatar: _this.bloggerInfo.avatar,
|
||||
address: item.href || '',
|
||||
title: item.title,
|
||||
image: _this.$utils.checkImageUrl(item.thumbnail)
|
||||
};
|
||||
case 'article':
|
||||
return {
|
||||
mp4: '',
|
||||
id: item.id,
|
||||
nickname: _this.bloggerInfo.nickname,
|
||||
avatar: _this.bloggerInfo.avatar,
|
||||
address: '',
|
||||
createTime: uni.$tm.dayjs(item.createTime).fromNow(),
|
||||
title: item.title,
|
||||
src: _this.$utils.checkImageUrl(item.thumbnail),
|
||||
image: _this.$utils.checkImageUrl(item.thumbnail)
|
||||
};
|
||||
case 'banner':
|
||||
return {
|
||||
id: '',
|
||||
src: item
|
||||
};
|
||||
if (this.calcAuditModeEnabled) {
|
||||
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),
|
||||
type: "custom",
|
||||
content: "",
|
||||
url: ""
|
||||
}
|
||||
});
|
||||
};
|
||||
switch (this.$haloConfig.banner.type) {
|
||||
case 'list': // 手动配置的banner
|
||||
this.bannerList = _format(this.$haloConfig.banner.list, 'list');
|
||||
break;
|
||||
case 'article': // 来自热门文章的封面
|
||||
this.$httpApi.getPostList({ page: 0, size: 6, sort: 'topPriority,visits,desc' }).then(res => {
|
||||
this.bannerList = _format(res.data.content, 'article');
|
||||
if (this.bannerList.length == 0) {
|
||||
this.bannerList = _format(this.$haloConfig.banner.list, 'list');
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'banner': // 来自后台配置的banner(暂未开放)
|
||||
this.bannerList = _format([], 'banner');
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!this.bannerConfig.enabled) return;
|
||||
|
||||
if (this.bannerConfig.type === 'custom') {
|
||||
this.bannerList = this.bannerConfig.list.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: "",
|
||||
title: item.title,
|
||||
src: this.$utils.checkThumbnailUrl(item.cover),
|
||||
image: this.$utils.checkThumbnailUrl(item.cover),
|
||||
type: "custom",
|
||||
content: item.content,
|
||||
url: item.url
|
||||
}
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
||||
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) => {
|
||||
this.bannerList = res.data.items.map((item, index) => {
|
||||
return {
|
||||
mp4: '',
|
||||
id: item.metadata.name,
|
||||
nickname: item.owner.displayName,
|
||||
avatar: this.$utils.checkAvatarUrl(item.owner.avatar),
|
||||
address: '',
|
||||
createTime: uni.$tm.dayjs(item.spec.publishTime).fromNow(),
|
||||
title: item.spec.title,
|
||||
src: this.$utils.checkThumbnailUrl(item.spec.cover),
|
||||
image: this.$utils.checkThumbnailUrl(item.spec.cover),
|
||||
type: "post",
|
||||
content: item.status.excerpt,
|
||||
url: ""
|
||||
};
|
||||
});
|
||||
},
|
||||
fail: (err) => {}
|
||||
})
|
||||
|
||||
},
|
||||
fnOnBannerChange(e) {
|
||||
this.bannerCurrent = e.current;
|
||||
fnOnNotifyChange(e) {
|
||||
this.notify.show = e;
|
||||
},
|
||||
fnOnBannerClick(item) {
|
||||
if (item.id == '') return;
|
||||
this.fnToArticleDetail(item);
|
||||
if (this.calcAuditModeEnabled) {
|
||||
return;
|
||||
}
|
||||
if (item.type === 'custom') {
|
||||
if (item.content) {
|
||||
this.notify.data = item
|
||||
this.notify.show = true
|
||||
return;
|
||||
}
|
||||
if (uni.$utils.checkIsUrl(item.url)) {
|
||||
uni.navigateTo({
|
||||
url: '/pagesC/website/website?data=' +
|
||||
JSON.stringify({
|
||||
title: item.title || "加载中...",
|
||||
url: encodeURIComponent(item.url)
|
||||
})
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.id === '') return;
|
||||
this.fnToArticleDetail({
|
||||
metadata: {
|
||||
name: item.id
|
||||
}
|
||||
});
|
||||
},
|
||||
// 文章列表
|
||||
fnGetArticleList() {
|
||||
// uni.showLoading({
|
||||
// mask: true,
|
||||
// title: '加载中...'
|
||||
// });
|
||||
if (this.calcAuditModeEnabled) {
|
||||
this.articleList = this.mockJson.home.postList.map((item) => {
|
||||
return {
|
||||
metadata: {
|
||||
name: Date.now() * Math.random(),
|
||||
},
|
||||
spec: {
|
||||
pinned: false,
|
||||
cover: item.cover,
|
||||
title: item.title,
|
||||
publishTime: item.time
|
||||
},
|
||||
status: {
|
||||
excerpt: item.desc
|
||||
},
|
||||
stats: {
|
||||
visit: 0
|
||||
}
|
||||
}
|
||||
});
|
||||
this.loading = 'success';
|
||||
this.loadMoreText = '呜呜,没有更多数据啦~';
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
return;
|
||||
}
|
||||
// 设置状态为加载中
|
||||
if (!this.isLoadMore) {
|
||||
this.loading = 'loading';
|
||||
}
|
||||
this.loadMoreText = '加载中...';
|
||||
this.$httpApi
|
||||
.getPostList(this.queryParams)
|
||||
.then(res => {
|
||||
this.loading = 'success';
|
||||
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
this.result = res.data;
|
||||
|
||||
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.hasNext = data.hasNext;
|
||||
if (this.isLoadMore) {
|
||||
this.articleList = this.articleList.concat(res.data.content);
|
||||
this.articleList = this.articleList.concat(data.items);
|
||||
} else {
|
||||
this.articleList = res.data.content;
|
||||
this.articleList = data.items;
|
||||
}
|
||||
this.loading = 'success';
|
||||
})
|
||||
.catch(err => {
|
||||
this.loadMoreText = data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
},
|
||||
fail: (err) => {
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
uni.$tm.toast(err.message || '数据加载失败!');
|
||||
})
|
||||
.finally(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
//跳转文章详情
|
||||
fnToArticleDetail(article) {
|
||||
if (this.calcAuditModeEnabled) {
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
|
||||
url: '/pagesA/article-detail/article-detail?name=' + article.metadata.name,
|
||||
animationType: 'slide-in-right'
|
||||
});
|
||||
},
|
||||
@@ -332,8 +498,11 @@
|
||||
|
||||
// 根据slug查询分类下的文章
|
||||
fnToCategoryBy(category) {
|
||||
if (this.calcAuditModeEnabled) {
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/pagesA/category-detail/category-detail?slug=${category.slug}&name=${category.name}`
|
||||
url: `/pagesA/category-detail/category-detail?name=${category.metadata.name}&title=${category.spec.displayName}`
|
||||
});
|
||||
},
|
||||
|
||||
@@ -350,6 +519,75 @@
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/articles/articles'
|
||||
});
|
||||
},
|
||||
fnOnLogoToPage() {
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/about/about'
|
||||
})
|
||||
},
|
||||
fnClickNav(data) {
|
||||
uni.navigateTo({
|
||||
url: data.path
|
||||
});
|
||||
},
|
||||
fnGetNavList() {
|
||||
this.navList = [{
|
||||
key: 'archives',
|
||||
title: this.calcAuditModeEnabled ? '内容归档' : '文章归档',
|
||||
bgColor: "rgba(3, 169, 244, 0.95)",
|
||||
shadow: "rgba(3, 169, 244, 0.4)",
|
||||
bgClass: 'bg-gradient-blue-accent',
|
||||
icon: 'icon-news',
|
||||
iconColor: '',
|
||||
path: '/pagesA/archives/archives',
|
||||
type: 'page',
|
||||
show: true
|
||||
}, {
|
||||
key: 'vote',
|
||||
title: '投票中心',
|
||||
bgColor: "rgba(0, 188, 212,0.95)",
|
||||
shadow: "rgba(0, 188, 212, 0.4)",
|
||||
bgClass: 'bg-gradient-blue-accent',
|
||||
icon: 'icon-box',
|
||||
iconColor: '',
|
||||
path: '/pagesA/votes/votes',
|
||||
type: 'page',
|
||||
show: !this.calcAuditModeEnabled
|
||||
}, {
|
||||
key: 'disclaimers',
|
||||
title: '友情链接',
|
||||
bgColor: "rgba(0, 150, 136, 0.95)",
|
||||
shadow: "rgba(0, 150, 136, 0.4)",
|
||||
bgClass: 'bg-gradient-blue-accent',
|
||||
icon: 'icon-lianjie',
|
||||
iconColor: '',
|
||||
path: '/pagesA/friend-links/friend-links',
|
||||
type: 'page',
|
||||
show: true
|
||||
}, {
|
||||
key: 'love',
|
||||
title: '恋爱日记',
|
||||
bgColor: "rgba(255,76,103, 0.95)",
|
||||
shadow: "rgba(255,76,103, 0.4)",
|
||||
bgClass: 'bg-gradient-blue-accent',
|
||||
icon: 'icon-like',
|
||||
iconColor: '',
|
||||
path: '/pagesA/love/love',
|
||||
type: 'page',
|
||||
show: this.haloConfigs.loveConfig.loveEnabled
|
||||
}, {
|
||||
key: 'contact-blogger',
|
||||
title: '联系博主',
|
||||
bgColor: "rgba(255, 152, 0, 0.95)",
|
||||
shadow: "rgba(255, 152, 0, 0.4)",
|
||||
bgClass: 'bg-gradient-blue-accent',
|
||||
icon: 'icon-paper-plane',
|
||||
iconColor: '',
|
||||
rightText: '博主主常用常用联系方式',
|
||||
path: '/pagesA/contact/contact',
|
||||
type: 'page',
|
||||
show: this.haloConfigs.authorConfig.social.enabled
|
||||
}]
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -466,4 +704,37 @@
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.nav-box {
|
||||
background-color: #ffff;
|
||||
overflow: hidden;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.nav-list {
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
// justify-content: space-between;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
font-size: 26rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.nav-item-icon {
|
||||
padding: 24rpx;
|
||||
// border-radius: 24rpx 32rpx 24rpx 32rpx;
|
||||
border-radius: 24rpx;
|
||||
// border: 2rpx solid #fff;
|
||||
}
|
||||
|
||||
.nav-item-text {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -1,405 +0,0 @@
|
||||
<template>
|
||||
<view class="app-page card-shadow">
|
||||
<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>
|
||||
</view>
|
||||
<view v-else class="content" :class="{ 'bg-white': result.length !== 0 }">
|
||||
<!-- 空数据 -->
|
||||
<view v-if="result.length == 0" class="content-empty flex flex-center">
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="啊偶,博主还没有朋友呢~"></tm-empty>
|
||||
</view>
|
||||
|
||||
<!-- 如果只有一个分组:使用列表的形式 result.length == 1 -->
|
||||
<view v-else-if="result.length == 1" class="flex flex-col pb-24">
|
||||
<block v-for="(link, index) in result[0].children" :key="index">
|
||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||
<!-- 色彩版本 -->
|
||||
<view v-if="!globalAppSettings.links.useSimple" class="info flex pt-24 pb-24 pl-12 pr-12" :class="{ 'border-b-1': index != result[0].children.length - 1 }" @click="fnOnLinkEvent(link)">
|
||||
<view class="link-logo">
|
||||
<cache-image class="link-logo_img" radius="12rpx" :url="link.logo" :fileMd5="link.logo" mode="aspectFill"></cache-image>
|
||||
</view>
|
||||
<view class="flex flex-col pl-30 info-detail">
|
||||
<view class="link-card_name text-size-l text-weight-b text-red">{{ link.name }}</view>
|
||||
<view class="poup-tag ml--10 mt-6">
|
||||
<tm-tags color="bg-gradient-amber-accent" :shadow="0" size="s" model="fill">
|
||||
ID:{{ link.id }}
|
||||
</tm-tags>
|
||||
<tm-tags color=" bg-gradient-light-blue-lighten" :shadow="0" size="s" model="fill">
|
||||
{{ link.team || '暂未分组' }}
|
||||
</tm-tags>
|
||||
</view>
|
||||
<view class="link-card_desc text-overflow text-size-s mt-4">
|
||||
博客简介:{{ link.description || '这个博主很懒,没写简介~' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 简洁版本 -->
|
||||
<view v-else class="link-card flex ml-24 mr-24 pt-24 pb-24" @click="fnOnLinkEvent(link)">
|
||||
<image class="logo shadow-6" :src="link.logo" mode="aspectFill"></image>
|
||||
<view class="info pl-24">
|
||||
<view class="name text-size-g">{{ link.name }}</view>
|
||||
<view class="desc mt-12 text-size-s text-grey-darken-1">{{ link.description }}</view>
|
||||
<view v-if="false" class="link mt-12 text-size-m text-grey-darken-1">
|
||||
<text class="iconfont icon-link mr-6 text-size-s"></text>
|
||||
{{ link.url }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</tm-translate>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!-- 如果大于一个分组:使用联系人的索引形式 result.length > 1 -->
|
||||
<block v-else>
|
||||
<block v-for="(team, index) in result" :key="index">
|
||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||
<view class="grey-lighten-4 text text-size-s text-weight-b px-32 py-12">{{ team.title }}</view>
|
||||
<block v-for="(link, linkIndex) in team.children" :key="link.id">
|
||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(linkIndex)">
|
||||
<!-- 色彩版本 -->
|
||||
<view v-if="!globalAppSettings.links.useSimple" class="info flex pt-24 pb-24 pl-12 pr-12" :class="{
|
||||
'border-b-1':
|
||||
linkIndex != team.children.length - 1 || index == result.length - 1
|
||||
}" @click="fnOnLinkEvent(link)">
|
||||
<view class="link-logo">
|
||||
<cache-image class="link-logo_img" radius="12rpx" :url="link.logo" :fileMd5="link.logo" mode="aspectFill"></cache-image>
|
||||
</view>
|
||||
<view class="flex flex-col pl-30 info-detail">
|
||||
<view class="link-card_name text-size-l text-weight-b text-red">
|
||||
{{ link.name }}
|
||||
</view>
|
||||
<view class="poup-tag ml--10 mt-6">
|
||||
<tm-tags color="bg-gradient-amber-accent" :shadow="0" size="s" model="fill">
|
||||
ID:{{ link.id }}
|
||||
</tm-tags>
|
||||
<tm-tags color=" bg-gradient-light-blue-lighten" :shadow="0" size="s" model="fill">
|
||||
{{ link.team || '暂未分组' }}
|
||||
</tm-tags>
|
||||
</view>
|
||||
<view class="link-card_desc text-overflow text-size-s mt-4">
|
||||
博客简介:{{ link.description || '这个博主很懒,没写简介~' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 简洁版本 -->
|
||||
<view v-else class="link-card flex ml-24 mr-24 pt-24 pb-24" @click="fnOnLinkEvent(link)">
|
||||
<image class="logo shadow-6" :src="link.logo" mode="aspectFill"></image>
|
||||
<view class="info pl-24">
|
||||
<view class="name text-size-g">{{ link.name }}</view>
|
||||
<view class="desc mt-12 text-size-s text-grey-darken-1">
|
||||
{{ link.description }}
|
||||
</view>
|
||||
<view v-if="false" class="link mt-12 text-size-m text-grey-darken-1">
|
||||
<text class="iconfont icon-link mr-6 text-size-s"></text>
|
||||
{{ link.url }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</tm-translate>
|
||||
</block>
|
||||
</tm-translate>
|
||||
</block>
|
||||
</block>
|
||||
|
||||
<!-- 返回顶部 -->
|
||||
<tm-flotbutton v-if="linkTotal > 10" color="light-blue" @click="fnToTopPage" size="m" icon="icon-angle-up"></tm-flotbutton>
|
||||
|
||||
<!-- 详情弹窗 -->
|
||||
<tm-poup v-model="detail.show" :width="640" height="auto" position="center" :round="6">
|
||||
<view class="poup pa-36">
|
||||
<view class="info flex">
|
||||
<view class="poup-logo bg-gradient-amber-accent pa-4 shadow-24">
|
||||
<image class="poup-logo_img" :src="detail.data.logo" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="pl-24 info-detail">
|
||||
<view class="poup-name text-size-lg text-weight-b">{{ detail.data.name }}</view>
|
||||
<view class="poup-tag ml--10">
|
||||
<tm-tags color="bg-gradient-amber-accent" size="n" model="fill">
|
||||
ID:{{ detail.data.id }}
|
||||
</tm-tags>
|
||||
<tm-tags color="bg-gradient-light-blue-lighten" size="n" model="fill">
|
||||
{{ detail.data.team || '暂未分组' }}
|
||||
</tm-tags>
|
||||
</view>
|
||||
<view class="poup-link text-size-m" @click="fnCopyLink(detail.data)">
|
||||
<text class="text-orange">{{ detail.data.url }}</text>
|
||||
<text class="iconfont icon-copy text-size-s ml-6 text-grey"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="poup-desc mt-20">
|
||||
博客简介:{{ detail.data.description || '这个博主很懒,没写简介~' }}
|
||||
</view>
|
||||
|
||||
<!-- 博客预览图 -->
|
||||
<view class="mt-24">
|
||||
<tm-images :width="568" :round="2" :src="caclSiteThumbnail(detail.data.url)" mode="aspectFill"></tm-images>
|
||||
</view>
|
||||
</view>
|
||||
</tm-poup>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue';
|
||||
import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue';
|
||||
|
||||
import { GetRandomNumberByRange } from '@/utils/random.js';
|
||||
export default {
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmTranslate,
|
||||
tmFlotbutton,
|
||||
tmTags,
|
||||
tmEmpty,
|
||||
tmImages,
|
||||
tmPoup
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0,
|
||||
sort: ''
|
||||
},
|
||||
result: [],
|
||||
detail: {
|
||||
show: false,
|
||||
data: {}
|
||||
},
|
||||
linkTotal: 0
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
caclSiteThumbnail(val) {
|
||||
return val => {
|
||||
if (!val) return '';
|
||||
if (val.charAt(val.length - 1) != '/') {
|
||||
val = val + '/';
|
||||
}
|
||||
return 'https://image.thum.io/get/width/1000/crop/800/' + val;
|
||||
};
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('朋友圈');
|
||||
},
|
||||
created() {
|
||||
this.fnGetData();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.fnGetData();
|
||||
},
|
||||
methods: {
|
||||
fnRandomColor() {
|
||||
const _r = GetRandomNumberByRange(0, this.$haloConfig.colors.length - 1);
|
||||
return this.$haloConfig.colors[_r];
|
||||
},
|
||||
fnGetData() {
|
||||
this.linkTotal = 0;
|
||||
this.loading = 'loading';
|
||||
// uni.showLoading({
|
||||
// mask: true,
|
||||
// title: '加载中...'
|
||||
// });
|
||||
this.$httpApi
|
||||
.getLinkListByTeam()
|
||||
.then(res => {
|
||||
if (res.status == 200) {
|
||||
console.log('请求结果:');
|
||||
console.log(res);
|
||||
// 处理数据
|
||||
const _result = res.data.map(item => {
|
||||
const _team = item.team || '未分组';
|
||||
const _links = item.links.map(link => {
|
||||
this.linkTotal += 1;
|
||||
link.logo = this.$utils.checkAvatarUrl(link.logo);
|
||||
return link;
|
||||
});
|
||||
return {
|
||||
title: _team,
|
||||
children: _links
|
||||
};
|
||||
});
|
||||
|
||||
this.result = _result.reverse();
|
||||
setTimeout(() => {
|
||||
this.loading = 'success';
|
||||
}, 500);
|
||||
} else {
|
||||
this.loading = 'error';
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
}, 500);
|
||||
});
|
||||
},
|
||||
|
||||
fnOnLinkEvent(link) {
|
||||
this.detail.data = link;
|
||||
this.detail.show = true;
|
||||
},
|
||||
|
||||
fnCopyLink(link) {
|
||||
uni.setClipboardData({
|
||||
data: `${link.name}:${link.url}`,
|
||||
showToast: false,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '链接复制成功!'
|
||||
});
|
||||
},
|
||||
fail: () => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '复制失败!'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fafafd;
|
||||
}
|
||||
|
||||
.loading-wrap {
|
||||
padding: 24rpx;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 0 24rpx;
|
||||
padding-top: 24rpx;
|
||||
|
||||
.content-empty {
|
||||
height: 60vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
.link-card {
|
||||
border-bottom: 2rpx solid #f5f5f5;
|
||||
background-color: #ffffff;
|
||||
|
||||
&.one {
|
||||
border: 0;
|
||||
box-shadow: 0rpx 2rpx 24rpx 0rpx rgba(0, 0, 0, 0.03);
|
||||
|
||||
.logo {
|
||||
box-shadow: 0rpx 2rpx 12rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
.logo {
|
||||
// width: 126rpx;
|
||||
// height: 126rpx;
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 12rpx;
|
||||
border: 6rpx solid #ffffff;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.info {
|
||||
width: 0;
|
||||
flex-grow: 1;
|
||||
|
||||
.name {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: #303133;
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.desc {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: #303133;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.link-card_name {
|
||||
// color: #303133;
|
||||
// color: #0080fe;
|
||||
}
|
||||
|
||||
.link-card_desc {
|
||||
font-size: 24rpx;
|
||||
line-height: 1.6;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.link-logo {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
|
||||
&_img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.poup-logo {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
border-radius: 50%;
|
||||
|
||||
&_img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.info-detail {
|
||||
width: 0;
|
||||
flex-grow: 1;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.poup-desc {
|
||||
font-size: 28rpx;
|
||||
line-height: 1.6;
|
||||
color: #555 !important;
|
||||
}
|
||||
|
||||
.preview-site {
|
||||
width: 100%;
|
||||
height: 300rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,410 @@
|
||||
<template>
|
||||
<view class="app-page" :class="[uniHaloPluginPageClass]">
|
||||
<PluginUnavailable v-if="!uniHaloPluginAvailable" :pluginId="uniHaloPluginId"
|
||||
:error-text="uniHaloPluginAvailableError" />
|
||||
<template v-else>
|
||||
<view v-if="loading !== 'success'" class="loading-wrap">
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
</view>
|
||||
<!-- 内容区域 -->
|
||||
<view v-else class="app-page-content">
|
||||
<view v-if="dataList.length === 0" class="content-empty flex flex-center" style="min-height: 70vh;">
|
||||
<!-- 空布局 -->
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
|
||||
</view>
|
||||
<block v-else>
|
||||
<!-- 卡片 -->
|
||||
<tm-translate v-for="(moment, index) in dataList" :key="moment.metadata.name"
|
||||
animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||
<view class="moment-card">
|
||||
<view class="head" style="display: flex;align-items: center;">
|
||||
<view class="avatar" style="flex-shrink: 0;">
|
||||
<image style="width: 66rpx;height: 66rpx;border-radius: 50%;"
|
||||
:src="moment.spec.user.avatar" />
|
||||
</view>
|
||||
<view class="nickname" style="margin-left: 12rpx;">
|
||||
<view style="font-size: 30rpx;font-weight: bold;color: #333333;">
|
||||
{{ moment.spec.user.displayName }}
|
||||
</view>
|
||||
<view style="margin-top: 6rpx;font-size: 24rpx;color: #666;">
|
||||
{{ {d: moment.spec.releaseTime, f: 'yyyy年MM月dd日 星期w'} | formatTime }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="content" @click.stop="handleToMomentDetail(moment)">
|
||||
<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="moment.spec.newHtml" :markdown="true" :showLineNumber="true"
|
||||
:showLanguageName="true" :copyByLongPress="true" />
|
||||
</view>
|
||||
<view v-if="moment.images && moment.images.length!==0" class="images"
|
||||
:class="['images-'+moment.images.length]">
|
||||
<view class="image-item" v-for="(image,mediumIndex) in moment.images"
|
||||
:key="mediumIndex">
|
||||
<image mode="aspectFill" style="width: 100%;height: 100%;border-radius: 6rpx;"
|
||||
:src="image.url" @click="handlePreview(mediumIndex,moment.images)" />
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="moment.audios && moment.audios.length!==0" class="mb-12"
|
||||
style="display: flex; flex-direction: column; gap: 12rpx 0;padding: 0 24rpx;padding-right:28rpx;">
|
||||
<audio v-for="(audio,index) in moment.audios" :controls="true" :key="index"
|
||||
:id="audio.url" :poster="bloggerInfo.avatar"
|
||||
:name="'来自' + (startConfig.title||bloggerInfo.nickname) + '的声音'"
|
||||
:author="bloggerInfo.nickname" :src="audio.url"></audio>
|
||||
</view>
|
||||
<view v-if="moment.videos && moment.videos.length!==0" class="mb-12"
|
||||
style="display: flex; flex-direction: column; gap: 12rpx 0;padding: 0 24rpx; ">
|
||||
<video style="width:100%;height: 400rpx;border-radius: 12rpx;"
|
||||
v-for="(video,index) in moment.videos" :key="index" :src="video.url"
|
||||
:id="'video_' + video.id" :show-mute-btn="true" :controls="true"
|
||||
:show-center-play-btn="true" :enable-progress-gesture="true"
|
||||
@play="onVideoPlay(video.id)" @pause="onVideoPause(video.id)"
|
||||
@ended="onVideoEnded(video.id)"></video>
|
||||
</view>
|
||||
<view v-if="moment.spec.tags && moment.spec.tags.length!==0"
|
||||
class="mt-12 px-16 pb-24 flex flex-wrap">
|
||||
<tm-tags v-for="(tag,tagIndex) in moment.spec.tags" :key="tagIndex"
|
||||
:color="randomTagColor()" size="m" model="text">
|
||||
{{ tag }}
|
||||
</tm-tags>
|
||||
</view>
|
||||
</view>
|
||||
</tm-translate>
|
||||
<tm-flotbutton @click="fnToTopPage" :width="90" size="xs" color="light-blue" :icon-size="24"
|
||||
icon="icon-angle-up"></tm-flotbutton>
|
||||
<view class="load-text">{{ loadMoreText }}</view>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
|
||||
|
||||
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
||||
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
||||
import {
|
||||
getRandomNumberByRange
|
||||
} from "@/utils/random.js";
|
||||
import {
|
||||
generateUUID
|
||||
} from '@/utils/uuid.js';
|
||||
|
||||
import pluginAvailableMixin from "@/common/mixins/pluginAvailable.js"
|
||||
import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue'
|
||||
|
||||
export default {
|
||||
mixins: [pluginAvailableMixin],
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmFlotbutton,
|
||||
tmTranslate,
|
||||
tmEmpty,
|
||||
tmTags,
|
||||
mpHtml,
|
||||
PluginUnavailable
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
markdownConfig: MarkdownConfig,
|
||||
loading: 'loading',
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 1
|
||||
},
|
||||
hasNext: false,
|
||||
dataList: [],
|
||||
isLoadMore: false,
|
||||
loadMoreText: '加载中...',
|
||||
tagColors: ['orange', 'green', 'red', 'blue'],
|
||||
videoContexts: {},
|
||||
currentVideoId: null
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
bloggerInfo() {
|
||||
let blogger = this.$tm.vx.getters().getConfigs.authorConfig.blogger;
|
||||
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
|
||||
return blogger;
|
||||
},
|
||||
haloConfigs() {
|
||||
return this.$tm.vx.getters().getConfigs;
|
||||
},
|
||||
mockJson() {
|
||||
return this.$tm.vx.getters().getMockJson;
|
||||
},
|
||||
calcAuditModeEnabled() {
|
||||
return this.haloConfigs.auditConfig.auditModeEnabled
|
||||
},
|
||||
calcUseTagRandomColor() {
|
||||
return this.haloConfigs.pageConfig.momentConfig.useTagRandomColor
|
||||
},
|
||||
startConfig() {
|
||||
return this.haloConfigs.appConfig.startConfig;
|
||||
}
|
||||
},
|
||||
async onLoad() {
|
||||
// 检查插件
|
||||
this.setPluginId(this.NeedPluginIds.PluginMoments)
|
||||
this.setPluginError("阿偶,检测到当前插件没有安装或者启用,无法使用瞬间功能哦,请联系管理员")
|
||||
if (!await this.checkPluginAvailable()) return
|
||||
|
||||
this.fnGetData();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
if (!this.uniHaloPluginAvailable) {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
return
|
||||
}
|
||||
this.isLoadMore = false;
|
||||
this.queryParams.page = 0;
|
||||
this.videoContexts = {};
|
||||
this.currentVideoId = null;
|
||||
this.fnGetData();
|
||||
},
|
||||
onReachBottom(e) {
|
||||
if (!this.uniHaloPluginAvailable) return;
|
||||
if (this.calcAuditModeEnabled) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '没有更多数据了'
|
||||
});
|
||||
return
|
||||
}
|
||||
if (this.hasNext) {
|
||||
this.queryParams.page += 1;
|
||||
this.isLoadMore = true;
|
||||
this.fnGetData();
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '没有更多数据了'
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fnGetData() {
|
||||
if (this.calcAuditModeEnabled) {
|
||||
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,
|
||||
visible: "PUBLIC"
|
||||
},
|
||||
images: item.images.map((img) => {
|
||||
return {
|
||||
type: "PHOTO",
|
||||
url: this.$utils.checkThumbnailUrl(img),
|
||||
}
|
||||
}),
|
||||
videos: []
|
||||
}
|
||||
});
|
||||
this.loading = 'success';
|
||||
this.loadMoreText = '呜呜,没有更多数据啦~';
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
return;
|
||||
}
|
||||
uni.showLoading({
|
||||
mask: true,
|
||||
title: '加载中...'
|
||||
});
|
||||
// 设置状态为加载中
|
||||
if (!this.isLoadMore) {
|
||||
this.loading = 'loading';
|
||||
}
|
||||
this.loadMoreText = '加载中...';
|
||||
this.$httpApi.v2
|
||||
.getMomentList(this.queryParams)
|
||||
.then(res => {
|
||||
this.loading = 'success';
|
||||
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
this.hasNext = res.hasNext;
|
||||
|
||||
const tempItems = res.items.filter(x => x.spec.visible === 'PUBLIC').map(item => {
|
||||
item.spec.user = {
|
||||
displayName: this.bloggerInfo.nickname,
|
||||
avatar: this.$utils.checkAvatarUrl(this.bloggerInfo.avatar)
|
||||
}
|
||||
item.spec.content.medium.map(medium => {
|
||||
medium.url = this.$utils.checkThumbnailUrl(medium.url, true)
|
||||
})
|
||||
|
||||
item.spec.newHtml = this.removeTagLinksCompletely(item.spec.content.html, '')
|
||||
item['images'] = item.spec.content.medium
|
||||
.filter(x => x.type === 'PHOTO')
|
||||
|
||||
item['videos'] = item.spec.content.medium
|
||||
.filter(x => x.type === 'VIDEO').map(item => {
|
||||
item.id = generateUUID()
|
||||
return item;
|
||||
})
|
||||
|
||||
item['audios'] = item.spec.content.medium
|
||||
.filter(x => x.type === 'AUDIO')
|
||||
return item;
|
||||
})
|
||||
|
||||
if (this.isLoadMore) {
|
||||
this.dataList = this.dataList.concat(tempItems);
|
||||
} else {
|
||||
this.dataList = tempItems;
|
||||
}
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.createVideoContexts(tempItems);
|
||||
})
|
||||
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
}, 500);
|
||||
});
|
||||
},
|
||||
handlePreview(index, list) {
|
||||
uni.previewImage({
|
||||
current: index,
|
||||
urls: list.map(item => item.url)
|
||||
})
|
||||
},
|
||||
removeTagLinksCompletely(htmlString) {
|
||||
const regex = /<a\s+(?:[^>]*?\s+)?class=(['"])[^'"]*?\btag\b[^'"]*?\1[^>]*?>.*?<\/a>/gi;
|
||||
const newHtml = htmlString.replace(regex, '');
|
||||
return newHtml
|
||||
},
|
||||
randomTagColor() {
|
||||
if (!this.calcUseTagRandomColor) return "blue";
|
||||
const randomIndex = getRandomNumberByRange(0, this.tagColors.length);
|
||||
return this.tagColors[randomIndex];
|
||||
},
|
||||
createVideoContexts(list) {
|
||||
this.stopAllVideos()
|
||||
list.map(item => item.videos).flat().forEach(item => {
|
||||
this.videoContexts[item.id] = uni.createVideoContext(`video_${item.id}`, this);
|
||||
})
|
||||
},
|
||||
onVideoPlay(videoId) {
|
||||
this.currentVideoId = videoId;
|
||||
this.stopAllVideos(videoId)
|
||||
},
|
||||
onVideoPause(videoId) {
|
||||
if (this.currentVideoId == videoId) {
|
||||
this.currentVideoId = null;
|
||||
}
|
||||
},
|
||||
onVideoEnded(videoId) {
|
||||
this.currentVideoId = null;
|
||||
},
|
||||
stopAllVideos(excludesVideoId = null) {
|
||||
Object.keys(this.videoContexts).forEach(videoId => {
|
||||
if (!excludesVideoId || excludesVideoId != videoId) {
|
||||
const videoContext = this.videoContexts[videoId]
|
||||
videoContext?.pause();
|
||||
}
|
||||
});
|
||||
},
|
||||
handleToMomentDetail(moment) {
|
||||
if (this.calcAuditModeEnabled) return;
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/moment-detail/moment-detail?name=' + moment.metadata.name,
|
||||
animationType: 'slide-in-right'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-page {
|
||||
box-sizing: border-box;
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 24rpx 0;
|
||||
}
|
||||
|
||||
.loading-wrap {
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.moment-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
margin: 0 24rpx;
|
||||
border-radius: 12rpx;
|
||||
background-color: #ffff;
|
||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
overflow: hidden;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.head {
|
||||
padding: 24rpx;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.images {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
padding: 24rpx;
|
||||
padding-top: 0;
|
||||
|
||||
.image-item {
|
||||
box-sizing: border-box;
|
||||
border-radius: 24rpx;
|
||||
padding: 6rpx;
|
||||
width: 33%;
|
||||
height: 200rpx
|
||||
}
|
||||
|
||||
&-1 {
|
||||
>.image-item {
|
||||
width: 100%;
|
||||
height: 350rpx
|
||||
}
|
||||
}
|
||||
|
||||
&-2 {
|
||||
>.image-item {
|
||||
width: 50%;
|
||||
height: 250rpx
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
::v-deep .uni-audio-default {
|
||||
width: 100%;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -1,134 +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: [],
|
||||
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>
|
||||
+80
-75
@@ -1,94 +1,99 @@
|
||||
<template>
|
||||
<view class="app-page bg-white flex flex-col">
|
||||
<view v-if="uni_halo_logo" class="logo mt-40 pt-40"><image class="logo-img round-3" :src="uni_halo_logo" mode="aspectFill"></image></view>
|
||||
<view class="mt-12 text-weight-b text-size-lg" :class="{ 'mt-40 pt-40': !uni_halo_logo }">uni-halo</view>
|
||||
<view class="mt-12 text-size-s text-grey-darken-3"></view>
|
||||
<view class="list-group mt-48" style="width: 100%;">
|
||||
<tm-grouplist :shadow="0" :margin="0" :borderBottom="true">
|
||||
<tm-listitem title="开源组织" :font-size="28" @click="$utils.copyText('https://www.ialley.cn', '巷子工坊官网已复制成功!')">
|
||||
<text class="text-size-s" slot="rightValue">巷子工坊</text>
|
||||
</tm-listitem>
|
||||
<tm-listitem title="开源作者" :font-size="28" @click="$utils.copyText('https://b.925i.cn', '作者博客地址已复制')">
|
||||
<text class="text-size-s" slot="rightValue">小莫唐尼</text>
|
||||
</tm-listitem>
|
||||
<tm-listitem title="作者博客" :font-size="28" @click="$utils.copyText('https://b.925i.cn', '作者博客地址已复制')">
|
||||
<text class="text-size-s text-overflow" slot="rightValue">https://b.925i.cn</text>
|
||||
</tm-listitem>
|
||||
<tm-listitem title="文档地址" :font-size="28" @click="$utils.copyText('https://uni-halo.925i.cn', '项目码云仓库已复制')">
|
||||
<text class="text-size-s text-overflow" slot="rightValue">https://uni-halo.925i.cn</text>
|
||||
</tm-listitem>
|
||||
<tm-listitem title="码云仓库" :font-size="28" @click="$utils.copyText('https://gitee.com/ialley-workshop-open/uni-halo', '码云仓库地址已复制')">
|
||||
<text class="text-size-s text-overflow" slot="rightValue">https://gitee.com/ialley-workshop-open/uni-halo</text>
|
||||
</tm-listitem>
|
||||
<tm-listitem title="Github" :font-size="28" @click="$utils.copyText('https://github.com/ialley-workshop-open/uni-halo', 'Github地址已复制')">
|
||||
<text class="text-size-s text-overflow" slot="rightValue">https://github.com/ialley-workshop-open/uni-halo</text>
|
||||
</tm-listitem>
|
||||
</tm-grouplist>
|
||||
</view>
|
||||
<view class="copyright bg-white text-size-xs text-align-center text-grey-darken-1 pa-36">
|
||||
<view class="">根据 AGPL-3.0 协议开源</view>
|
||||
<view class="mt-8">「 2022 uni-halo 丨 开源项目丨巷子工坊@小莫唐尼 」</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="app-page bg-white flex flex-col">
|
||||
<view class="logo mt-40 pt-40">
|
||||
<image class="logo-img round-3" src="https://uni-halo.925i.cn/logo.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="mt-12 text-weight-b text-size-lg">uni-halo</view>
|
||||
<view class="mt-12 text-size-s text-grey-darken-3"></view>
|
||||
<view class="list-group mt-48" style="width: 100%;">
|
||||
<tm-grouplist :shadow="0" :margin="0" :borderBottom="true">
|
||||
<tm-listitem title="开源组织" :font-size="28" @click="$utils.copyText('https://www.ialley.cn', '巷子工坊官网已复制成功!')">
|
||||
<text class="text-size-s" slot="rightValue">巷子工坊</text>
|
||||
</tm-listitem>
|
||||
<tm-listitem title="开源作者" :font-size="28" @click="$utils.copyText('https://www.xiaoxiaomo.cn', '作者主页地址已复制')">
|
||||
<text class="text-size-s" slot="rightValue">小莫唐尼</text>
|
||||
</tm-listitem>
|
||||
<tm-listitem title="作者博客" :font-size="28" @click="$utils.copyText('https://blog.xiaoxiaomo.cn', '作者博客地址已复制')">
|
||||
<text class="text-size-s text-overflow" slot="rightValue">https://blog.xiaoxiaomo.cn</text>
|
||||
</tm-listitem>
|
||||
<tm-listitem title="文档地址" :font-size="28" @click="$utils.copyText('https://uni-halo.925i.cn', '项目码云仓库已复制')">
|
||||
<text class="text-size-s text-overflow" slot="rightValue">https://uni-halo.925i.cn</text>
|
||||
</tm-listitem>
|
||||
<tm-listitem title="码云仓库" :font-size="28"
|
||||
@click="$utils.copyText('https://gitee.com/ialley-workshop-open/uni-halo', '码云仓库地址已复制')">
|
||||
<text class="text-size-s text-overflow" slot="rightValue">https://gitee.com/ialley-workshop-open/uni-halo</text>
|
||||
</tm-listitem>
|
||||
<tm-listitem title="Github" :font-size="28"
|
||||
@click="$utils.copyText('https://github.com/ialley-workshop-open/uni-halo', 'Github地址已复制')">
|
||||
<text class="text-size-s text-overflow" slot="rightValue">https://github.com/ialley-workshop-open/uni-halo</text>
|
||||
</tm-listitem>
|
||||
</tm-grouplist>
|
||||
</view>
|
||||
<view class="copyright bg-white text-size-xs text-align-center text-grey-darken-1 pa-36">
|
||||
<view class="">根据 AGPL-3.0 协议开源</view>
|
||||
<view class="mt-8">「 2022 uni-halo 丨 开源项目丨巷子工坊@小莫唐尼 」</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmGrouplist from '@/tm-vuetify/components/tm-grouplist/tm-grouplist.vue';
|
||||
import tmListitem from '@/tm-vuetify/components/tm-listitem/tm-listitem.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
tmGrouplist,
|
||||
tmListitem
|
||||
},
|
||||
computed: {
|
||||
uni_halo_logo() {
|
||||
return getApp().globalData.uni_halo_logo;
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('关于项目');
|
||||
},
|
||||
methods: {}
|
||||
components: {
|
||||
tmGrouplist,
|
||||
tmListitem
|
||||
},
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('关于项目');
|
||||
},
|
||||
methods: {}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
box-sizing: border-box;
|
||||
align-items: center;
|
||||
.logo-img {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
}
|
||||
.info {
|
||||
margin-left: 90rpx;
|
||||
margin-right: 90rpx;
|
||||
}
|
||||
.copyright {
|
||||
width: 100vw;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
box-sizing: border-box;
|
||||
align-items: center;
|
||||
|
||||
.label {
|
||||
display: inline-block;
|
||||
min-width: 140rpx;
|
||||
}
|
||||
.logo-img {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
}
|
||||
|
||||
.info {
|
||||
margin-left: 90rpx;
|
||||
margin-right: 90rpx;
|
||||
}
|
||||
|
||||
.copyright {
|
||||
width: 100vw;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.label {
|
||||
display: inline-block;
|
||||
min-width: 140rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.text-overflow {
|
||||
width: calc(100vw - 300rpx);
|
||||
text-align: right;
|
||||
width: calc(100vw - 300rpx);
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.list-group {
|
||||
::v-deep {
|
||||
.left {
|
||||
width: 160rpx;
|
||||
min-width: 160rpx;
|
||||
}
|
||||
}
|
||||
::v-deep {
|
||||
.left {
|
||||
width: 160rpx;
|
||||
min-width: 160rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
+549
-316
@@ -1,367 +1,600 @@
|
||||
<template>
|
||||
<view class="app-page">
|
||||
<view class="e-fixed"><tm-tabs color="light-blue" v-model="tab.activeIndex" :list="tab.list" align="center" @change="fnOnTabChange"></tm-tabs></view>
|
||||
<!-- 占位区域 -->
|
||||
<view style="width: 100vw;height: 90rpx;"></view>
|
||||
<view class="app-page">
|
||||
|
||||
<!-- 骨架屏:加载区域 -->
|
||||
<view v-if="loading != 'success'" class="loading-wrap">
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
</view>
|
||||
<view class="e-fixed">
|
||||
<tm-tabs color="light-blue" v-model="tab.activeIndex" :list="tab.list" align="center"
|
||||
@change="fnOnTabChange"></tm-tabs>
|
||||
</view>
|
||||
<!-- 占位区域 -->
|
||||
<view style="width: 100vw;height: 90rpx;"></view>
|
||||
|
||||
<!-- 加载完成区域 -->
|
||||
<block v-else>
|
||||
<view v-if="dataList.length == 0" class="list-empty flex flex-center"><tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无归档的文章"></tm-empty></view>
|
||||
<view v-else class="e-timeline tm-timeline mt-24">
|
||||
<block v-for="(item, index) in dataList" :key="index">
|
||||
<view class="tm-timeline-item tm-timeline-item--leftDir">
|
||||
<view style="width: 160rpx;">
|
||||
<view :style="{ width: '24rpx', height: '24rpx' }" :class="[black_tmeme ? 'bk' : '']" class="flex-center rounded tm-timeline-jidian border-white-a-2 grey-lighten-2 light-blue shadow-primary-4"></view>
|
||||
<view :style="{ marginTop: '-24rpx' }" :class="[index !== dataList.length - 1 ? 'tm-timeline-item-boder' : '', black_tmeme ? 'bk' : '']" class="grey-lighten-2"></view>
|
||||
</view>
|
||||
<view class="tm-timeline-item-content relative">
|
||||
<view class="tm-timeline-item-left">
|
||||
<view class="time text-weight-b mb-24">
|
||||
{{ item.year }}年
|
||||
<block v-if="tab.activeIndex == 0">{{ item.month }}月</block>
|
||||
<text class="text-size-s text-grey-darken-1 ml-24">(共发布 {{ item.posts.length }} 篇文章)</text>
|
||||
</view>
|
||||
<block v-if="item.posts.length != 0">
|
||||
<block v-for="(post, postIndex) in item.posts" :key="post.id">
|
||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(postIndex)">
|
||||
<view class="flex post shadow-3 pa-24 mb-24" :class="[globalAppSettings.layout.cardType]" @click="fnToArticleDetail(post)">
|
||||
<image class="post-thumbnail" :src="$utils.checkThumbnailUrl(post.thumbnail)" mode="aspectFill"></image>
|
||||
<view class="post-info pl-20">
|
||||
<view class="post-info_title text-overflow">{{ post.title }}</view>
|
||||
<view class="post-info_summary text-overflow-2 mt-12 text-size-s text-grey-darken-1">{{ post.summary }}</view>
|
||||
<view class="post-info_time mt-12 text-size-s text-grey-darken-1">
|
||||
<text class="iconfont icon-clock text-size-s mr-6"></text>
|
||||
<text class="time-label">发布时间:</text>
|
||||
{{ { d: post.createTime, f: 'yyyy年MM月dd日 星期w' } | formatTime }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</tm-translate>
|
||||
</block>
|
||||
</block>
|
||||
<view v-else class="post-empty text-size-m text-grey-darken-1">该日期下暂无归档文章!</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<!-- 返回顶部 -->
|
||||
<tm-flotbutton @click="fnToTopPage" size="m" color="bg-gradient-light-blue-accent" icon="icon-angle-up"></tm-flotbutton>
|
||||
</block>
|
||||
</view>
|
||||
<!-- 骨架屏:加载区域 -->
|
||||
<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>
|
||||
|
||||
<!-- 加载完成区域 -->
|
||||
<block v-else>
|
||||
<view v-if="dataList.length === 0" class="list-empty flex flex-center">
|
||||
<tm-empty v-if="calcAuditModeEnabled" icon="icon-shiliangzhinengduixiang-" label="暂无归档的内容"></tm-empty>
|
||||
<tm-empty v-else icon="icon-shiliangzhinengduixiang-" label="暂无归档的文章"></tm-empty>
|
||||
</view>
|
||||
<view v-else class="e-timeline tm-timeline mt-24">
|
||||
<block v-for="(item, index) in dataList" :key="index">
|
||||
<view class="tm-timeline-item tm-timeline-item--leftDir">
|
||||
<view style="width: 160rpx;">
|
||||
<view :style="{ width: '24rpx', height: '24rpx' }" :class="[black_tmeme ? 'bk' : '']"
|
||||
class="flex-center rounded tm-timeline-jidian border-white-a-2 grey-lighten-2 light-blue shadow-primary-4">
|
||||
</view>
|
||||
<view :style="{ marginTop: '-24rpx' }"
|
||||
:class="[index !== dataList.length - 1 ? 'tm-timeline-item-boder' : '', black_tmeme ? 'bk' : '']"
|
||||
class="grey-lighten-2"></view>
|
||||
</view>
|
||||
<view class="tm-timeline-item-content relative">
|
||||
<view class="tm-timeline-item-left">
|
||||
<view class="flex time text-weight-b mb-24">
|
||||
<text>{{ item.year }}年</text>
|
||||
<text v-if="tab.activeIndex === 0">{{ item.month }}月</text>
|
||||
<view v-if="calcAuditModeEnabled" class="text-size-s text-grey-darken-1 ml-12">
|
||||
(共 {{ item.posts.length }} 篇内容)
|
||||
</view>
|
||||
<view v-else class="text-size-s text-grey-darken-1 ml-12">
|
||||
(共 {{ item.posts.length }} 篇文章)
|
||||
</view>
|
||||
</view>
|
||||
<block v-if="item.posts.length !== 0">
|
||||
<block v-for="(post, postIndex) in item.posts" :key="post.metadata.name">
|
||||
<view class="flex post shadow-3 pa-24 mb-24"
|
||||
:class="[globalAppSettings.layout.cardType]"
|
||||
@click="fnToArticleDetail(post)">
|
||||
<image class="post-thumbnail"
|
||||
:src="$utils.checkThumbnailUrl(post.spec.cover)" mode="aspectFill">
|
||||
</image>
|
||||
<view class="post-info pl-20">
|
||||
<view class="post-info_title text-overflow">{{ post.spec.title }}
|
||||
</view>
|
||||
<view
|
||||
class="post-info_summary text-overflow-2 mt-12 text-size-s text-grey-darken-1">
|
||||
{{ post.status.excerpt }}
|
||||
</view>
|
||||
<view class="post-info_time mt-12 text-size-s text-grey-darken-1">
|
||||
<text class="iconfont icon-clock text-size-s mr-6"></text>
|
||||
<text class="time-label">发布时间:</text>
|
||||
{{ {d: post.spec.publishTime, f: 'yyyy年MM月dd日 星期w'} | formatTime }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</block>
|
||||
<view v-else class="post-empty text-size-m text-grey-darken-1">该日期下暂无归档文章!</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="load-text mt-12">{{ loadMoreText }}</view>
|
||||
<!-- 返回顶部 -->
|
||||
<tm-flotbutton @click="fnToTopPage" size="m" color="bg-gradient-light-blue-accent"
|
||||
icon="icon-angle-up"></tm-flotbutton>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import qs from 'qs'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmTranslate,
|
||||
tmFlotbutton,
|
||||
tmTabs,
|
||||
tmEmpty
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
tab: {
|
||||
activeIndex: 0,
|
||||
list: ['按月份查看', '按年份查看']
|
||||
},
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0
|
||||
},
|
||||
result: null,
|
||||
dataList: [],
|
||||
api: 'getMonthArchives'
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
black_tmeme: function() {
|
||||
return this.$tm.vx.state().tmVuetify.black;
|
||||
},
|
||||
color_tmeme: function() {
|
||||
return this.$tm.vx.state().tmVuetify.color;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fnGetData();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.fnGetData();
|
||||
this.queryParams.page = 0;
|
||||
},
|
||||
export default {
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmTranslate,
|
||||
tmFlotbutton,
|
||||
tmTabs,
|
||||
tmEmpty
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
tab: {
|
||||
activeIndex: 0,
|
||||
list: ['按月份查看', '按年份查看']
|
||||
},
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 1
|
||||
},
|
||||
result: {},
|
||||
cacheDataList: [], // 所有请求的缓存数据
|
||||
dataList: [], // 显示的数据
|
||||
isLoadMore: false,
|
||||
loadMoreText: "加载中..."
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
black_tmeme: function () {
|
||||
return this.$tm.vx.state().tmVuetify.black;
|
||||
},
|
||||
color_tmeme: function () {
|
||||
return this.$tm.vx.state().tmVuetify.color;
|
||||
},
|
||||
haloConfigs() {
|
||||
return this.$tm.vx.getters().getConfigs;
|
||||
},
|
||||
mockJson() {
|
||||
return this.$tm.vx.getters().getMockJson;
|
||||
},
|
||||
calcAuditModeEnabled() {
|
||||
return this.haloConfigs.auditConfig.auditModeEnabled
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.fnGetData();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.isLoadMore = false;
|
||||
this.queryParams.page = 1;
|
||||
this.fnGetData();
|
||||
},
|
||||
onReachBottom(e) {
|
||||
if (this.calcAuditModeEnabled) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '没有更多数据了'
|
||||
});
|
||||
return
|
||||
}
|
||||
if (this.result.hasNext) {
|
||||
this.queryParams.page += 1;
|
||||
this.isLoadMore = true;
|
||||
this.fnGetData();
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '没有更多数据了'
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fnOnTabChange(index) {
|
||||
this.fnResetSetAniWaitIndex();
|
||||
this.queryParams.page = 0;
|
||||
this.dataList = this.handleGetShowDataList(this.handleGetPosts(this.cacheDataList))
|
||||
this.fnToTopPage();
|
||||
},
|
||||
fnGetData() {
|
||||
if (this.calcAuditModeEnabled) {
|
||||
const dataList = this.mockJson.archives.list.map(item => {
|
||||
const date = new Date(item.time)
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
return {
|
||||
metadata: {
|
||||
name: Date.now() * Math.random(),
|
||||
labels: {
|
||||
"content.halo.run/archive-year": year,
|
||||
"content.halo.run/archive-month": month
|
||||
}
|
||||
},
|
||||
spec: {
|
||||
pinned: false,
|
||||
cover: item.cover,
|
||||
title: item.title,
|
||||
publishTime: item.time
|
||||
},
|
||||
status: {
|
||||
excerpt: item.desc
|
||||
},
|
||||
stats: {
|
||||
visit: 0
|
||||
}
|
||||
}
|
||||
});
|
||||
const posts = this.handleGetPosts(dataList)
|
||||
this.dataList = []
|
||||
this.cacheDataList = dataList;
|
||||
this.dataList = this.handleGetShowDataList(posts)
|
||||
this.loading = 'success';
|
||||
this.loadMoreText = '呜呜,没有更多数据啦~';
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
return;
|
||||
}
|
||||
if (this.isLoadMore) {
|
||||
uni.showLoading({
|
||||
title: "加载中..."
|
||||
})
|
||||
} else {
|
||||
this.loading = 'loading';
|
||||
}
|
||||
this.loadMoreText = "加载中...";
|
||||
const paramsStr = qs.stringify(this.queryParams, {
|
||||
allowDots: true,
|
||||
encodeValuesOnly: true,
|
||||
skipNulls: true,
|
||||
encode: true,
|
||||
arrayFormat: 'repeat'
|
||||
})
|
||||
uni.request({
|
||||
url: this.$baseApiUrl + '/apis/api.content.halo.run/v1alpha1/posts?' + paramsStr,
|
||||
method: 'GET',
|
||||
success: (res) => {
|
||||
const data = res.data;
|
||||
this.result = data;
|
||||
const posts = this.handleGetPosts(data.items)
|
||||
const showDataList = this.handleGetShowDataList(posts)
|
||||
if (this.isLoadMore) {
|
||||
this.cacheDataList = this.handleUniqueCacheDatalist([
|
||||
...this.cacheDataList, ...data.items
|
||||
]);
|
||||
this.handleMergeDataList2(showDataList)
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.cacheDataList = data.items;
|
||||
this.dataList = showDataList
|
||||
}
|
||||
|
||||
methods: {
|
||||
fnOnTabChange(index) {
|
||||
this.fnResetSetAniWaitIndex();
|
||||
const _api = ['getMonthArchives', 'getYearArchives'];
|
||||
this.api = _api[index];
|
||||
this.queryParams.page = 0;
|
||||
this.fnGetData();
|
||||
},
|
||||
fnGetData() {
|
||||
this.loading = 'loading';
|
||||
// uni.showLoading({
|
||||
// mask: true,
|
||||
// title: '加载中...'
|
||||
// });
|
||||
this.$httpApi[this.api](this.queryParams)
|
||||
.then(res => {
|
||||
this.result = res.data;
|
||||
this.dataList = res.data;
|
||||
setTimeout(() => {
|
||||
this.loading = 'success';
|
||||
}, 500);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
}, 500);
|
||||
});
|
||||
},
|
||||
//跳转文章详情
|
||||
fnToArticleDetail(article) {
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
|
||||
animationType: 'slide-in-right'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
this.loading = 'success';
|
||||
this.loadMoreText = data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
|
||||
},
|
||||
fail: (err) => {
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
uni.$tm.toast(err.message || '数据加载失败!');
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
})
|
||||
},
|
||||
// 处理数据分类
|
||||
handleGetPosts(dataList) {
|
||||
const posts = {}
|
||||
const postLabelYearKey = "content.halo.run/archive-year"
|
||||
const postLabelMonthKey = "content.halo.run/archive-month"
|
||||
dataList.forEach(item => {
|
||||
let postItemKey = ""
|
||||
if (this.tab.activeIndex === 0) {
|
||||
postItemKey =
|
||||
`${item.metadata.labels[postLabelYearKey]}-${item.metadata.labels[postLabelMonthKey]}`
|
||||
} else {
|
||||
postItemKey = `${item.metadata.labels[postLabelYearKey]}`
|
||||
}
|
||||
if (posts[postItemKey]) {
|
||||
posts[postItemKey].push(item)
|
||||
} else {
|
||||
posts[postItemKey] = [item]
|
||||
}
|
||||
})
|
||||
return posts;
|
||||
},
|
||||
// 根据分类的数据,处理成显示的数据
|
||||
handleGetShowDataList(posts) {
|
||||
const dataListResult = []
|
||||
Object.keys(posts).forEach((key) => {
|
||||
const postData = {
|
||||
sort: 0,
|
||||
key: key,
|
||||
year: key,
|
||||
month: "",
|
||||
posts: posts[key]
|
||||
}
|
||||
if (this.tab.activeIndex == 0) {
|
||||
const splitDate = key.split("-")
|
||||
postData.year = splitDate[0]
|
||||
postData.month = splitDate[1]
|
||||
postData.sort = Number(key.replace("-", ""))
|
||||
} else {
|
||||
postData.sort = Number(key)
|
||||
}
|
||||
dataListResult.push(postData)
|
||||
})
|
||||
|
||||
dataListResult.sort((a, b) => {
|
||||
return Number(b.sort) - Number(a.sort)
|
||||
})
|
||||
|
||||
return dataListResult;
|
||||
},
|
||||
handleMergeDataList(list1, list2) {
|
||||
// 将list1转换为以key为键的对象
|
||||
let merged = list1.reduce((acc, item) => {
|
||||
acc[item.key] = {
|
||||
...item
|
||||
};
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
// 遍历list2,合并posts数组或添加新对象
|
||||
list2.forEach(item => {
|
||||
if (merged[item.key]) {
|
||||
// 如果key已存在,合并posts数组
|
||||
merged[item.key].posts = [...merged[item.key].posts, ...item.posts];
|
||||
} else {
|
||||
// 如果key不存在,添加新对象
|
||||
merged[item.key] = {
|
||||
...item
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// 将对象转换回数组
|
||||
return Object.values(merged);
|
||||
},
|
||||
handleMergeDataList2(list) {
|
||||
list.forEach((item, index) => {
|
||||
const find = this.dataList.find(x => x.key == item.key)
|
||||
if (find) {
|
||||
item.posts.forEach(post => {
|
||||
if (!find.posts.find(x => x.metadata.name == post.metadata.name)) {
|
||||
find.posts.push(post)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
list.forEach(post => {
|
||||
if (!this.dataList.find(x => x.key === post.key)) {
|
||||
this.dataList.push(post)
|
||||
}
|
||||
})
|
||||
|
||||
this.dataList.sort((a, b) => {
|
||||
return Number(b.sort) - Number(a.sort)
|
||||
})
|
||||
},
|
||||
handleUniqueCacheDatalist(dataList) {
|
||||
const seen = new Set();
|
||||
return dataList.filter(item => {
|
||||
return seen.has(item.metadata.name) ? false : seen.add(item.metadata.name);
|
||||
});
|
||||
},
|
||||
fnToArticleDetail(article) {
|
||||
if (this.calcAuditModeEnabled) {
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/article-detail/article-detail?name=' + article.metadata.name,
|
||||
animationType: 'slide-in-right'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fafafd;
|
||||
}
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fafafd;
|
||||
}
|
||||
|
||||
.loading-wrap {
|
||||
padding: 24rpx;
|
||||
}
|
||||
.auditModeEnabled {
|
||||
width: 100%;
|
||||
height: 80vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.list-empty {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
}
|
||||
.loading-wrap {
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.statistics {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.list-empty {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.e-timeline {
|
||||
::v-deep {
|
||||
.tm-timeline-item>view:first-child {
|
||||
width: 110rpx !important;
|
||||
}
|
||||
.statistics {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.tm-timeline-item-left {
|
||||
max-width: 580rpx !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
.e-timeline {
|
||||
::v-deep {
|
||||
.tm-timeline-item > view:first-child {
|
||||
width: 110rpx !important;
|
||||
}
|
||||
|
||||
.tm-timeline {
|
||||
.tm-timeline-item {
|
||||
.tm-timeline-item-left {
|
||||
max-width: 580rpx !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tm-timeline-item-left,
|
||||
.tm-timeline-item-right {
|
||||
width: 200rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.tm-timeline {
|
||||
.tm-timeline-item {
|
||||
|
||||
.tm-timeline-item-content {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.tm-timeline-item-left,
|
||||
.tm-timeline-item-right {
|
||||
width: 200rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.tm-timeline-jidian {
|
||||
margin: auto;
|
||||
}
|
||||
.tm-timeline-item-content {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
align-content: flex-start;
|
||||
}
|
||||
|
||||
&.tm-timeline-item--leftDir {
|
||||
display: flex;
|
||||
flex-flow: row;
|
||||
.tm-timeline-jidian {
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
&.endright {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
&.tm-timeline-item--leftDir {
|
||||
display: flex;
|
||||
flex-flow: row;
|
||||
|
||||
.tm-timeline-item-left,
|
||||
.tm-timeline-item-right {
|
||||
width: auto;
|
||||
max-width: 400rpx;
|
||||
}
|
||||
&.endright {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.tm-timeline-item-boder {
|
||||
height: 100%;
|
||||
width: 1px;
|
||||
margin: auto;
|
||||
}
|
||||
.tm-timeline-item-left,
|
||||
.tm-timeline-item-right {
|
||||
width: auto;
|
||||
max-width: 400rpx;
|
||||
}
|
||||
|
||||
.tm-timeline-jidian {
|
||||
position: relative;
|
||||
margin: auto;
|
||||
z-index: 2;
|
||||
}
|
||||
.tm-timeline-item-boder {
|
||||
height: 100%;
|
||||
width: 1px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.tm-timeline-item-content {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
align-content: flex-start;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.tm-timeline-jidian {
|
||||
position: relative;
|
||||
margin: auto;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.post {
|
||||
width: 560rpx;
|
||||
border-radius: 12rpx;
|
||||
background-color: #fff;
|
||||
.tm-timeline-item-content {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
align-content: flex-start;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.lr_image_text {}
|
||||
.post {
|
||||
width: 560rpx;
|
||||
border-radius: 12rpx;
|
||||
background-color: #fff;
|
||||
|
||||
&.lr_text_image {
|
||||
.post-thumbnail {
|
||||
order: 2;
|
||||
}
|
||||
&.lr_image_text {
|
||||
}
|
||||
|
||||
.post-info {
|
||||
order: 1;
|
||||
padding-left: 0;
|
||||
padding-right: 24rpx;
|
||||
}
|
||||
}
|
||||
&.lr_text_image {
|
||||
.post-thumbnail {
|
||||
order: 2;
|
||||
}
|
||||
|
||||
&.tb_image_text {
|
||||
flex-direction: column;
|
||||
.post-info {
|
||||
order: 1;
|
||||
padding-left: 0;
|
||||
padding-right: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.post-thumbnail {
|
||||
width: 100%;
|
||||
height: 220rpx;
|
||||
}
|
||||
&.tb_image_text {
|
||||
flex-direction: column;
|
||||
|
||||
.post-info {
|
||||
width: 100%;
|
||||
padding-left: 0;
|
||||
.post-thumbnail {
|
||||
width: 100%;
|
||||
height: 220rpx;
|
||||
}
|
||||
|
||||
&_title {
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
.post-info {
|
||||
width: 100%;
|
||||
padding-left: 0;
|
||||
|
||||
&_time {
|
||||
.iconfont {
|
||||
display: none;
|
||||
}
|
||||
&_title {
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.time-label {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&_time {
|
||||
.iconfont {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.tb_text_image {
|
||||
flex-direction: column;
|
||||
.time-label {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.post-thumbnail {
|
||||
order: 2;
|
||||
width: 100%;
|
||||
height: 220rpx;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
&.tb_text_image {
|
||||
flex-direction: column;
|
||||
|
||||
.post-info {
|
||||
order: 1;
|
||||
width: 100%;
|
||||
padding-left: 0;
|
||||
.post-thumbnail {
|
||||
order: 2;
|
||||
width: 100%;
|
||||
height: 220rpx;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
&_time {
|
||||
.iconfont {
|
||||
display: none;
|
||||
}
|
||||
.post-info {
|
||||
order: 1;
|
||||
width: 100%;
|
||||
padding-left: 0;
|
||||
|
||||
.time-label {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&_time {
|
||||
.iconfont {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.only_text {
|
||||
.post-info {
|
||||
padding: 6rpx;
|
||||
.time-label {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&_time {
|
||||
margin-top: 20rpx;
|
||||
&.only_text {
|
||||
.post-info {
|
||||
padding: 6rpx;
|
||||
|
||||
.iconfont {
|
||||
display: none;
|
||||
}
|
||||
&_time {
|
||||
margin-top: 20rpx;
|
||||
|
||||
.time-label {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
.iconfont {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.post-thumbnail {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
.time-label {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.post-thumbnail {
|
||||
border-radius: 6rpx;
|
||||
width: 200rpx;
|
||||
height: 170rpx;
|
||||
}
|
||||
.post-thumbnail {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.post-info {
|
||||
width: 0;
|
||||
flex-grow: 1;
|
||||
.post-thumbnail {
|
||||
border-radius: 6rpx;
|
||||
width: 200rpx;
|
||||
height: 170rpx;
|
||||
}
|
||||
|
||||
&_title {
|
||||
color: #303133;
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.post-info {
|
||||
width: 0;
|
||||
flex-grow: 1;
|
||||
|
||||
&_summary {
|
||||
display: -webkit-box;
|
||||
line-height: 1.6;
|
||||
}
|
||||
&_title {
|
||||
color: #303133;
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
&_time {
|
||||
.time-label {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
&_summary {
|
||||
display: -webkit-box;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
&_time {
|
||||
.time-label {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.time {
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+150
-111
@@ -1,46 +1,70 @@
|
||||
<template>
|
||||
<view class="app-page" :class="{ 'is-balck grey-darken-6': isBlackTheme }">
|
||||
<!-- 顶部切换 -->
|
||||
<view class="e-fixed shadow-2">
|
||||
<tm-search v-model="queryParams.keyword" :round="24" :shadow="0" color="light-blue" insert-color="light-blue" :clear="true" @confirm="fnOnSearch"></tm-search>
|
||||
<tm-tabs color="light-blue" :shadow="0" v-model="tab.activeIndex" :list="tab.list" align="center" @change="fnOnTabChange"></tm-tabs>
|
||||
</view>
|
||||
<!-- 占位区域 -->
|
||||
<view style="width: 100vw;height: 184rpx;"></view>
|
||||
<!-- 加载区域 -->
|
||||
<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>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
</view>
|
||||
<!-- 内容区域 -->
|
||||
<view v-else class="content">
|
||||
<view v-if="dataList.length == 0" class="content-empty flex flex-center">
|
||||
<!-- 空布局 -->
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="该分类下暂无数据"></tm-empty>
|
||||
<view class="app-page" :class="[uniHaloPluginPageClass]">
|
||||
<PluginUnavailable v-if="!uniHaloPluginAvailable" :pluginId="uniHaloPluginId"
|
||||
:error-text="uniHaloPluginAvailableError" />
|
||||
<template v-else>
|
||||
|
||||
<!-- 顶部切换 -->
|
||||
<view class="e-fixed shadow-1">
|
||||
<tm-search v-model="queryParams.keyword" :round="24" :shadow="0" color="light-blue"
|
||||
insert-color="light-blue" :clear="true" @input="fnOnSearch" @confirm="fnOnSearch"></tm-search>
|
||||
<tm-tabs v-if="false" color="light-blue" :shadow="0" v-model="tab.activeIndex" :list="tab.list"
|
||||
align="center" @change="fnOnTabChange"></tm-tabs>
|
||||
</view>
|
||||
<block v-else>
|
||||
<block v-for="(article, index) in dataList" :key="article.id">
|
||||
<!-- 文章卡片 -->
|
||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||
<article-card :article="article" @on-click="fnToArticleDetail"></article-card>
|
||||
<!-- 广告区域 -->
|
||||
<view v-if="haloAdConfig.articles.use && (index + 1) % haloAdConfig.frequency == 0" class="ad-wrap ma-24">
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<ad v-if="haloAdConfig.unitId" :unit-id="haloAdConfig.unitId"></ad>
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<ad v-if="haloAdConfig.adpid" :adpid="haloAdConfig.adpid"></ad>
|
||||
<!-- #endif -->
|
||||
<!-- 占位区域 -->
|
||||
<view style="width: 100vw;height: 100rpx;"></view>
|
||||
<!-- 加载区域 -->
|
||||
<view v-if="loading == 'loading'" class="loading-wrap pa-24">
|
||||
<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 v-else-if="loading == 'error'" class="content-empty flex flex-center">
|
||||
<tm-empty icon="icon-wind-cry" label="搜索异常"></tm-empty>
|
||||
</view>
|
||||
<!-- 内容区域 -->
|
||||
<view v-else class="content">
|
||||
<view v-if="dataList.length == 0" class="content-empty flex flex-center">
|
||||
<!-- 空布局 -->
|
||||
<tm-empty v-if="!queryParams.keyword" icon="icon-shiliangzhinengduixiang-"
|
||||
label="请输入关键词搜索"></tm-empty>
|
||||
<tm-empty v-else icon="icon-shiliangzhinengduixiang-"
|
||||
:label="`未搜到 ${queryParams.keyword} 相关内容`"></tm-empty>
|
||||
</view>
|
||||
<block v-else>
|
||||
<tm-translate v-for="(item, index) in dataList" :key="item.metadataName" animation-name="fadeUp"
|
||||
:wait="calcAniWait(index)">
|
||||
<view class="article-card" @click="fnToDetail(item)">
|
||||
<view class="mb-12 flex flex-start">
|
||||
<view class="flex-shrink ml--12">
|
||||
<tm-tags v-if="isArticle(item)" color="blue" size="n" model="text">文章</tm-tags>
|
||||
<tm-tags v-else color="green" size="n" model="text">瞬间</tm-tags>
|
||||
</view>
|
||||
<text class="ml-2 text-overflow text-size-n text-weight-b"
|
||||
style="color: #333;">{{ item.title }}</text>
|
||||
</view>
|
||||
<mp-html class="evan-markdown" lazy-load :domain="markdownConfig.domain"
|
||||
:loading-img="markdownConfig.loadingGif" :scroll-table="true" :selectable="true"
|
||||
:tag-style="markdownConfig.tagStyle" :content="item.description || item.content"
|
||||
:markdown="true" :showLineNumber="true" :showLanguageName="true"
|
||||
:copyByLongPress="true" />
|
||||
<view class="mt-12 flex flex-center flex-between">
|
||||
<text style="font-size: 24rpx;color:#888">
|
||||
最近更新时间:{{ {d: item.updateTimestamp, f: 'yyyy年MM月dd日 HH点mm分ss秒'} | formatTime }}
|
||||
</text>
|
||||
<!-- <tm-tags v-if="isArticle(item)" color="blue" size="n" model="text">文章</tm-tags>
|
||||
<tm-tags v-else color="green" size="n" model="text">瞬间</tm-tags> -->
|
||||
</view>
|
||||
</view>
|
||||
</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>
|
||||
<tm-flotbutton @click="fnToTopPage" size="m" color="light-blue"
|
||||
icon="icon-angle-up"></tm-flotbutton>
|
||||
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -51,117 +75,108 @@
|
||||
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
|
||||
|
||||
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
||||
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
||||
|
||||
import pluginAvailableMixin from "@/common/mixins/pluginAvailable.js"
|
||||
import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue'
|
||||
|
||||
export default {
|
||||
mixins: [pluginAvailableMixin],
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmSearch,
|
||||
tmTranslate,
|
||||
tmTabs,
|
||||
tmFlotbutton,
|
||||
tmEmpty
|
||||
tmEmpty,
|
||||
tmTags,
|
||||
mpHtml,
|
||||
PluginUnavailable
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isBlackTheme: false,
|
||||
markdownConfig: MarkdownConfig,
|
||||
loading: 'loading',
|
||||
tab: {
|
||||
activeIndex: 0,
|
||||
list: ['全部', '最新文章', '热门文章', '最近更新', '最多点赞']
|
||||
},
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0,
|
||||
sort: 'topPriority,createTime,desc',
|
||||
keyword: ''
|
||||
keyword: "",
|
||||
limit: 50,
|
||||
highlightPreTag: "",
|
||||
highlightPostTag: ""
|
||||
},
|
||||
cache: {
|
||||
dataList: [],
|
||||
total: 0
|
||||
},
|
||||
isLoadMore: false,
|
||||
loadMoreText: '加载中...',
|
||||
result: {},
|
||||
dataList: []
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('文章列表');
|
||||
computed: {
|
||||
haloConfigs() {
|
||||
return this.$tm.vx.getters().getConfigs;
|
||||
},
|
||||
calcAuditModeEnabled() {
|
||||
return this.haloConfigs.auditConfig.auditModeEnabled
|
||||
},
|
||||
},
|
||||
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();
|
||||
async onLoad() {
|
||||
this.fnSetPageTitle('内容搜索');
|
||||
// 检查插件
|
||||
this.setPluginId(this.NeedPluginIds.PluginSearchWidget)
|
||||
this.setPluginError("阿偶,检测到当前插件没有安装或者启用,无法使用搜索功能哦,请联系管理员")
|
||||
if (!await this.checkPluginAvailable()) return
|
||||
if (!this.queryParams.keyword) {
|
||||
this.loading = 'success'
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '没有更多数据了'
|
||||
});
|
||||
this.fnGetData();
|
||||
}
|
||||
},
|
||||
|
||||
onPullDownRefresh() {
|
||||
if (!this.uniHaloPluginAvailable) {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
return
|
||||
}
|
||||
this.fnOnSearch()
|
||||
},
|
||||
|
||||
methods: {
|
||||
fnOnTabChange(index) {
|
||||
this.fnResetSetAniWaitIndex();
|
||||
this.dataList = [];
|
||||
const _sorts = {
|
||||
0: '',
|
||||
1: 'topPriority,createTime,desc',
|
||||
2: 'topPriority,visits,desc',
|
||||
3: 'topPriority,updateTime,desc',
|
||||
4: 'topPriority,likes,desc'
|
||||
};
|
||||
this.queryParams.sort = _sorts[index];
|
||||
this.queryParams.page = 0;
|
||||
this.dataList = [];
|
||||
this.fnToTopPage();
|
||||
this.fnGetData();
|
||||
},
|
||||
fnOnSearch() {
|
||||
this.fnResetSetAniWaitIndex();
|
||||
this.queryParams.page = 0;
|
||||
this.isLoadMore = false;
|
||||
this.fnGetData();
|
||||
if (!this.queryParams.keyword) {
|
||||
this.dataList = []
|
||||
} else {
|
||||
this.fnGetData();
|
||||
}
|
||||
},
|
||||
fnGetData() {
|
||||
// uni.showLoading({
|
||||
// mask: true,
|
||||
// title: '加载中...'
|
||||
// });
|
||||
// 设置状态为加载中
|
||||
if (!this.isLoadMore) {
|
||||
this.loading = 'loading';
|
||||
if (this.calcAuditModeEnabled) {
|
||||
return;
|
||||
}
|
||||
this.loadMoreText = '加载中...';
|
||||
this.$httpApi
|
||||
.getPostList(this.queryParams)
|
||||
// 设置状态为加载中
|
||||
this.loading = 'loading';
|
||||
this.$httpApi.v2
|
||||
.getPostListByKeyword(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;
|
||||
}
|
||||
this.dataList = res.hits;
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
@@ -170,13 +185,24 @@
|
||||
}, 800);
|
||||
});
|
||||
},
|
||||
isArticle(item) {
|
||||
return item.type == 'post.content.halo.run'
|
||||
},
|
||||
//跳转详情
|
||||
fnToDetail(item) {
|
||||
if (this.calcAuditModeEnabled) return;
|
||||
if (this.isArticle(item)) {
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/article-detail/article-detail?name=' + item.metadataName,
|
||||
animationType: 'slide-in-right'
|
||||
});
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/moment-detail/moment-detail?name=' + item.metadataName,
|
||||
animationType: 'slide-in-right'
|
||||
});
|
||||
}
|
||||
|
||||
//跳转文章详情
|
||||
fnToArticleDetail(article) {
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
|
||||
animationType: 'slide-in-right'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -198,9 +224,22 @@
|
||||
|
||||
.content {
|
||||
padding-top: 24rpx;
|
||||
}
|
||||
|
||||
.content-empty {
|
||||
height: 60vh;
|
||||
}
|
||||
.content-empty {
|
||||
height: 60vh;
|
||||
}
|
||||
|
||||
.article-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
margin: 0 24rpx;
|
||||
padding: 24rpx;
|
||||
border-radius: 12rpx;
|
||||
background-color: #ffff;
|
||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
overflow: hidden;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -1,146 +1,166 @@
|
||||
<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>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
</view>
|
||||
<block v-else>
|
||||
<view class="empty" v-if="dataList.length == 0"><tm-empty icon="icon-shiliangzhinengduixiang-" label="该分类下暂无文章"></tm-empty></view>
|
||||
<block v-else>
|
||||
<block v-for="(article, index) in dataList" :key="article.createTime">
|
||||
<!-- 文章卡片 -->
|
||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)"><article-card :article="article" @on-click="fnToArticleDetail"></article-card></tm-translate>
|
||||
</block>
|
||||
<view class="load-text">{{ loadMoreText }}</view>
|
||||
</block>
|
||||
<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>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
</view>
|
||||
<block v-else>
|
||||
<view class="empty" v-if="dataList.length == 0">
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-"
|
||||
label="该分类下暂无文章"></tm-empty>
|
||||
</view>
|
||||
<block v-else>
|
||||
<block v-for="(article, index) in dataList" :key="article.createTime">
|
||||
<!-- 文章卡片 -->
|
||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||
<article-card :article="article"
|
||||
@on-click="fnToArticleDetail"></article-card>
|
||||
</tm-translate>
|
||||
</block>
|
||||
<view class="load-text">{{ loadMoreText }}</view>
|
||||
</block>
|
||||
|
||||
<tm-flotbutton @click="fnToTopPage" color="light-blue" size="m" icon="icon-angle-up"></tm-flotbutton>
|
||||
</block>
|
||||
</view>
|
||||
<tm-flotbutton @click="fnToTopPage" color="light-blue" size="m" icon="icon-angle-up"></tm-flotbutton>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import ArticleCard from '@/components/article-card/article-card.vue';
|
||||
export default {
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmTranslate,
|
||||
tmFlotbutton,
|
||||
tmEmpty,
|
||||
ArticleCard
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0
|
||||
},
|
||||
slug: '',
|
||||
pageTitle: '加载中...',
|
||||
result: null,
|
||||
dataList: [],
|
||||
isLoadMore: false,
|
||||
loadMoreText: ''
|
||||
};
|
||||
},
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import ArticleCard from '@/components/article-card/article-card.vue';
|
||||
|
||||
onLoad(e) {
|
||||
this.slug = e.slug;
|
||||
this.pageTitle = e.name;
|
||||
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() {
|
||||
// uni.showLoading({
|
||||
// mask: true,
|
||||
// title: '加载中...'
|
||||
// });
|
||||
// 设置状态为加载中
|
||||
if (!this.isLoadMore) {
|
||||
this.loading = 'loading';
|
||||
}
|
||||
this.loadMoreText = '加载中...';
|
||||
this.$httpApi
|
||||
.getCategoryPostList(this.slug, this.queryParams)
|
||||
.then(res => {
|
||||
this.fnSetPageTitle(`分类:${this.pageTitle} (共${res.data.total}篇)`);
|
||||
this.result = res.data;
|
||||
if (this.isLoadMore) {
|
||||
this.dataList = this.dataList.concat(res.data.content);
|
||||
} else {
|
||||
this.dataList = res.data.content;
|
||||
}
|
||||
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
setTimeout(() => {
|
||||
this.loading = 'success';
|
||||
}, 500);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
}, 500);
|
||||
});
|
||||
},
|
||||
//跳转文章详情
|
||||
fnToArticleDetail(article) {
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
|
||||
animationType: 'slide-in-right'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
export default {
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmTranslate,
|
||||
tmFlotbutton,
|
||||
tmEmpty,
|
||||
ArticleCard
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0
|
||||
},
|
||||
name: '',
|
||||
pageTitle: '加载中...',
|
||||
hasNext: false,
|
||||
dataList: [],
|
||||
isLoadMore: false,
|
||||
loadMoreText: ''
|
||||
};
|
||||
},
|
||||
|
||||
onLoad(e) {
|
||||
this.name = e.name;
|
||||
this.pageTitle = e.title;
|
||||
this.fnGetData();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.isLoadMore = false;
|
||||
this.queryParams.page = 0;
|
||||
this.fnGetData();
|
||||
},
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
title: this.pageTitle,
|
||||
path: `/pagesA/category-detail/category-detail?name=${this.name}&title=${this.pageTitle}`
|
||||
}
|
||||
},
|
||||
onShareTimeline() {
|
||||
return {
|
||||
title: this.pageTitle,
|
||||
path: `/pagesA/category-detail/category-detail?name=${this.name}&title=${this.pageTitle}`
|
||||
}
|
||||
},
|
||||
onReachBottom(e) {
|
||||
if (this.hasNext) {
|
||||
this.queryParams.page += 1;
|
||||
this.isLoadMore = true;
|
||||
this.fnGetData();
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '没有更多数据了'
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fnGetData() {
|
||||
// uni.showLoading({
|
||||
// mask: true,
|
||||
// title: '加载中...'
|
||||
// });
|
||||
// 设置状态为加载中
|
||||
if (!this.isLoadMore) {
|
||||
this.loading = 'loading';
|
||||
}
|
||||
this.loadMoreText = '加载中...';
|
||||
this.$httpApi.v2
|
||||
.getCategoryPostList(this.name, this.queryParams)
|
||||
.then(res => {
|
||||
console.log("请求成功:", res)
|
||||
this.fnSetPageTitle(`${this.pageTitle} (共${res.total}篇)`);
|
||||
this.hasNext = res.hasNext;
|
||||
if (this.isLoadMore) {
|
||||
this.dataList = this.dataList.concat(res.items);
|
||||
} else {
|
||||
this.dataList = res.items;
|
||||
}
|
||||
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
setTimeout(() => {
|
||||
this.loading = 'success';
|
||||
}, 500);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
}, 500);
|
||||
});
|
||||
},
|
||||
//跳转文章详情
|
||||
fnToArticleDetail(article) {
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/article-detail/article-detail?name=' + article.metadata.name,
|
||||
animationType: 'slide-in-right'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 24rpx 0;
|
||||
background-color: #fafafd;
|
||||
}
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 24rpx 0;
|
||||
background-color: #fafafd;
|
||||
}
|
||||
|
||||
.loading-wrap {
|
||||
padding: 0 24rpx;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.loading-wrap {
|
||||
padding: 0 24rpx;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.empty {
|
||||
height: 60vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
.empty {
|
||||
height: 60vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,153 +0,0 @@
|
||||
<template>
|
||||
<view class="app-page pa-6">
|
||||
<view class="content pt-24 pb-24 round-4">
|
||||
<!-- 表单区域 -->
|
||||
<tm-form @submit="fnOnSubmit">
|
||||
<tm-input :auto-focus="true" name="content" :vertical="true" required :height="220" input-type="textarea" bg-color="grey-lighten-5" :maxlength="200" :borderBottom="false" placeholder="请输入内容,不超过200字符..." v-model="form.content"></tm-input>
|
||||
<tm-input name="author" align="right" required title="我的昵称" placeholder="请输入您的昵称..." v-model="form.author"></tm-input>
|
||||
<tm-input name="email" align="right" title="邮箱地址" placeholder="请输入您的邮箱..." v-model="form.email"></tm-input>
|
||||
<tm-input name="authorUrl" align="right" title="我的网站" placeholder="请输入您的网址..." v-model="form.authorUrl"></tm-input>
|
||||
<view class="mx-32 my-24 border-b-1 pb-24 flex-between">
|
||||
<text class="text-size-n ">接收提醒</text>
|
||||
<view><tm-switch :text="['是', '否']" v-model="form.allowNotification" color="bg-gradient-blue-accent"></tm-switch></view>
|
||||
</view>
|
||||
<view class="pa-24 pl-30 pr-30"><tm-button navtie-type="form" theme="bg-gradient-blue-accent" block>提交</tm-button></view>
|
||||
</tm-form>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmForm from '@/tm-vuetify/components/tm-form/tm-form.vue';
|
||||
import tmInput from '@/tm-vuetify/components/tm-input/tm-input.vue';
|
||||
import tmSwitch from '@/tm-vuetify/components/tm-switch/tm-switch.vue';
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
tmForm,
|
||||
tmInput,
|
||||
tmSwitch,
|
||||
tmButton
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
params: {
|
||||
postId: '',
|
||||
parentId: '',
|
||||
title: '', // 被回复的标题 type=user =用户名 否则为文章标题
|
||||
form: '',
|
||||
formPage: '', // 来自哪个页面
|
||||
type: 'post' // 来源文章/页面 还是用户 user=用户
|
||||
},
|
||||
form: {
|
||||
allowNotification: true,
|
||||
author: '', // 作者
|
||||
avatar: '',
|
||||
authorUrl: '', // 作者主页
|
||||
content: '', // 评论内容
|
||||
email: '', // 邮件
|
||||
parentId: 0,
|
||||
postId: 0
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 评论游客信息
|
||||
wxLoginVisitorUser() {
|
||||
return uni.$tm.vx.getters().getWxLoginInfo;
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.params = this.$Route.query;
|
||||
this.form.postId = this.params.id;
|
||||
if (this.params.type == 'user') {
|
||||
this.form.parentId = this.params.parentId;
|
||||
this.fnSetPageTitle('回复用户:' + this.params.title);
|
||||
} else {
|
||||
this.form.parentId = 0;
|
||||
this.fnSetPageTitle(this.params.title);
|
||||
}
|
||||
this.form.author = this.wxLoginVisitorUser.nickName;
|
||||
this.form.avatar = this.wxLoginVisitorUser.avatarUrl;
|
||||
this.form.email = this.wxLoginVisitorUser.email;
|
||||
this.form.authorUrl = this.wxLoginVisitorUser.url;
|
||||
},
|
||||
methods: {
|
||||
fnOnSubmit(e) {
|
||||
console.log('提交评论');
|
||||
if (e === false) {
|
||||
return uni.$tm.toast('请检查所有的必填项是否填写完整!');
|
||||
}
|
||||
if (this.form.allowNotification && !this.form.email) {
|
||||
return uni.$tm.toast('未填写邮箱地址,将无法接收提醒!');
|
||||
}
|
||||
if (this.form.email && !uni.$tm.test.email(this.form.email)) {
|
||||
return uni.$tm.toast('请填写正确的邮箱地址!');
|
||||
}
|
||||
if (this.form.authorUrl && !uni.$tm.test.url(this.form.authorUrl)) {
|
||||
return uni.$tm.toast('请输入正确的Url地址!');
|
||||
}
|
||||
this.fnHandle();
|
||||
},
|
||||
|
||||
fnHandle() {
|
||||
uni.showLoading({
|
||||
title: '正在提交...'
|
||||
});
|
||||
const _api = {
|
||||
sheets: this.$httpApi.postSheetsComments,
|
||||
posts: this.$httpApi.postCommentPost
|
||||
};
|
||||
_api[this.params.from](this.form)
|
||||
.then(res => {
|
||||
if (res.status == 200) {
|
||||
uni.$tm.toast('提交成功,待博主审核通过后即可展示!');
|
||||
// 更新评论者信息
|
||||
uni.$tm.vx.commit('user/setWxLoginInfo', {
|
||||
avatarUrl: this.wxLoginVisitorUser.avatarUrl,
|
||||
nickName: this.form.author,
|
||||
email: this.form.email,
|
||||
url: this.form.authorUrl
|
||||
});
|
||||
// 清空评论内容
|
||||
this.form.content = '';
|
||||
// 触发刷新评论(可能需要评论审核不会有改变)
|
||||
// uni.$emit(this.params.formPage + '_refresh');
|
||||
} else {
|
||||
uni.$tm.toast('操作失败,请重试!');
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
uni.$tm.toast(err.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
// background-color: #fafafd;
|
||||
background-color: #ffffff;
|
||||
|
||||
.content {
|
||||
overflow: hidden;
|
||||
background-color: #fff;
|
||||
// box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
}
|
||||
|
||||
.poup-content {
|
||||
width: 500rpx;
|
||||
|
||||
::v-deep {
|
||||
.slider_id {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
+261
-238
@@ -1,256 +1,279 @@
|
||||
<template>
|
||||
<view class="app-page flex flex-col felx-center bg-white">
|
||||
<!-- 信息 -->
|
||||
<view class="profile flex flex-col flex-center pa-36">
|
||||
<view class="avatar"><image class="avatar-img" :src="bloggerInfo.avatar" mode="aspectFill"></image></view>
|
||||
<view class="nickname mt-24 text-weight-b text-size-g">{{ bloggerInfo.nickname }}</view>
|
||||
<view class="desc mt-24 text-size-m text-grey-darken-3">
|
||||
{{ bloggerInfo.description || '这个博主很懒,竟然没写介绍~' }}
|
||||
</view>
|
||||
<!-- 联系图标 -->
|
||||
<view class="mt-24 contact-icons">
|
||||
<!-- 放全部:似乎显得有点拥挤 -->
|
||||
<!-- <block v-for="(item, index) in result" :key="index"><text v-if="item.value" class="halocoloricon" :class="[item.icon, { 'ml-12': index != 0 }]"></text></block> -->
|
||||
<!-- 考虑放几个常用的就行 -->
|
||||
<text class="halocoloricon halocoloricon-qq"></text>
|
||||
<!-- #ifndef MP-QQ -->
|
||||
<text class="ml-12 halocoloricon halocoloricon-wechat"></text>
|
||||
<!-- #endif -->
|
||||
<text class="ml-12 halocoloricon halocoloricon-GitHub"></text>
|
||||
<text class="ml-12 halocoloricon halocoloricon-gitee"></text>
|
||||
<text class="ml-12 halocoloricon halocoloricon-ic_email_round"></text>
|
||||
</view>
|
||||
<view v-if="false" class="mt-24 ">
|
||||
<tm-button theme="bg-gradient-light-blue-accent" size="m" openType="contact">在线客服联系</tm-button>
|
||||
<tm-button theme="bg-gradient-orange-accent" size="m" @click="fnOnToWeb">访问PC端博客</tm-button>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 社交联系方式列表 -->
|
||||
<view class="contact ma-50 mt-0 pt-12">
|
||||
<block v-for="(item, index) in result" :key="index">
|
||||
<view v-if="item.value" class="item mt-24 flex" @click="fnOnClick(item)">
|
||||
<view class="left">
|
||||
<text class="icon halocoloricon" :class="[item.icon]"></text>
|
||||
<text class="name">{{ item.name }}</text>
|
||||
</view>
|
||||
<view class="right flex-1">{{ item.value }}</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
<view class="app-page flex flex-col felx-center bg-white">
|
||||
<!-- 信息 -->
|
||||
<view class="profile flex flex-col flex-center pa-36">
|
||||
<view class="avatar">
|
||||
<image class="avatar-img" :src="bloggerInfo.avatar" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="nickname mt-24 text-weight-b text-size-g">{{ bloggerInfo.nickname }}</view>
|
||||
<view class="desc mt-24 text-size-m text-grey-darken-3">
|
||||
{{ bloggerInfo.description || '这个博主很懒,竟然没写介绍~' }}
|
||||
</view>
|
||||
<!-- 联系图标 -->
|
||||
<view class="mt-24 contact-icons">
|
||||
<!-- 放全部:似乎显得有点拥挤 -->
|
||||
<!-- <block v-for="(item, index) in result" :key="index"><text v-if="item.value" class="halocoloricon" :class="[item.icon, { 'ml-12': index != 0 }]"></text></block> -->
|
||||
<!-- 考虑放几个常用的就行 -->
|
||||
<text class="halocoloricon halocoloricon-qq"></text>
|
||||
<!-- #ifndef MP-QQ -->
|
||||
<text class="ml-12 halocoloricon halocoloricon-wechat"></text>
|
||||
<!-- #endif -->
|
||||
<text class="ml-12 halocoloricon halocoloricon-GitHub"></text>
|
||||
<text class="ml-12 halocoloricon halocoloricon-gitee"></text>
|
||||
<text class="ml-12 halocoloricon halocoloricon-ic_email_round"></text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 社交联系方式列表 -->
|
||||
<view class="contact ma-50 mt-0 pt-12">
|
||||
<block v-if="calcIsNotEmpty">
|
||||
<block v-for="(item, index) in result" :key="index">
|
||||
<view v-if="item.value" class="item mt-24 flex" @click="fnOnClick(item)">
|
||||
<view class="left">
|
||||
<text class="icon halocoloricon" :class="[item.icon]"></text>
|
||||
<text class="name">{{ item.name }}</text>
|
||||
</view>
|
||||
<view class="right flex-1">{{ item.value }}</view>
|
||||
</view>
|
||||
</block>
|
||||
</block>
|
||||
<view v-else class="mt-12 pt-12">
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无联系方式"/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmButton
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0
|
||||
},
|
||||
result: [
|
||||
{
|
||||
key: 'qq',
|
||||
icon: 'halocoloricon-qq',
|
||||
name: '企鹅号',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
key: 'wechat',
|
||||
icon: 'halocoloricon-wechat',
|
||||
name: '微信号',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
key: 'github',
|
||||
icon: 'halocoloricon-GitHub',
|
||||
name: 'Github',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
key: 'gitee',
|
||||
icon: 'halocoloricon-gitee',
|
||||
name: 'Gitee',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
key: 'bilibili',
|
||||
icon: 'halocoloricon-bilibili',
|
||||
name: 'Bilibili',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
key: 'csdn',
|
||||
icon: 'halocoloricon-csdn1',
|
||||
name: 'CSDN',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
key: 'blog',
|
||||
icon: 'halocoloricon-url-monitor',
|
||||
name: '博客地址',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
key: 'juejin',
|
||||
icon: 'halocoloricon-juejin',
|
||||
name: '掘金地址',
|
||||
value: ''
|
||||
},
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmButton,
|
||||
tmEmpty
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0
|
||||
},
|
||||
result: [
|
||||
{
|
||||
key: 'qq',
|
||||
icon: 'halocoloricon-qq',
|
||||
name: '企鹅号',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
key: 'wechat',
|
||||
icon: 'halocoloricon-wechat',
|
||||
name: '微信号',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
key: 'github',
|
||||
icon: 'halocoloricon-GitHub',
|
||||
name: 'Github',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
key: 'gitee',
|
||||
icon: 'halocoloricon-gitee',
|
||||
name: 'Gitee',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
key: 'bilibili',
|
||||
icon: 'halocoloricon-bilibili',
|
||||
name: 'Bilibili',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
key: 'csdn',
|
||||
icon: 'halocoloricon-csdn1',
|
||||
name: 'CSDN',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
key: 'blog',
|
||||
icon: 'halocoloricon-url-monitor',
|
||||
name: '博客地址',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
key: 'juejin',
|
||||
icon: 'halocoloricon-juejin',
|
||||
name: '掘金地址',
|
||||
value: ''
|
||||
},
|
||||
|
||||
{
|
||||
key: 'weibo',
|
||||
icon: 'halocoloricon-social-weibo',
|
||||
name: '微博地址',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
key: 'email',
|
||||
icon: 'halocoloricon-ic_email_round',
|
||||
name: '邮箱地址',
|
||||
value: ''
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 获取博主信息
|
||||
bloggerInfo() {
|
||||
let blogger = this.$tm.vx.getters().getBlogger;
|
||||
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
|
||||
return blogger;
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('联系博主');
|
||||
},
|
||||
created() {
|
||||
this.fnGetData();
|
||||
},
|
||||
methods: {
|
||||
fnGetData() {
|
||||
for (let key in this.$haloConfig.social) {
|
||||
this.result.find(x => x.key == key).value = this.$haloConfig.social[key];
|
||||
}
|
||||
},
|
||||
fnOnToWeb() {
|
||||
uni.navigateTo({
|
||||
url:
|
||||
'/pagesC/website/website?data=' +
|
||||
JSON.stringify({
|
||||
title: this.$haloConfig.title,
|
||||
url: this.$haloConfig.social.blog
|
||||
})
|
||||
});
|
||||
},
|
||||
fnOnClick(item) {
|
||||
if (this.globalAppSettings.contact.isLinkCopy && this.$utils.checkIsUrl(item.value)) {
|
||||
uni.navigateTo({
|
||||
url:
|
||||
'/pagesC/website/website?data=' +
|
||||
JSON.stringify({
|
||||
title: item.name,
|
||||
url: item.value
|
||||
})
|
||||
});
|
||||
} else {
|
||||
this.$utils.copyText(item.value, item.name + ' 已复制!');
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
key: 'weibo',
|
||||
icon: 'halocoloricon-social-weibo',
|
||||
name: '微博地址',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
key: 'email',
|
||||
icon: 'halocoloricon-ic_email_round',
|
||||
name: '邮箱地址',
|
||||
value: ''
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
authorConfig() {
|
||||
return this.$tm.vx.getters().getConfigs.authorConfig;
|
||||
},
|
||||
bloggerInfo() {
|
||||
let blogger = this.authorConfig.blogger;
|
||||
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
|
||||
return blogger;
|
||||
},
|
||||
socialConfig() {
|
||||
return this.authorConfig.social;
|
||||
},
|
||||
calcIsNotEmpty() {
|
||||
return this.result.some((item) => item.value !== "");
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
socialConfig: {
|
||||
handler(newVal) {
|
||||
if (!newVal) return;
|
||||
this.fnGetData();
|
||||
},
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('联系博主');
|
||||
},
|
||||
methods: {
|
||||
fnGetData() {
|
||||
for (let key in this.socialConfig) {
|
||||
if (key === 'enabled') {
|
||||
continue;
|
||||
}
|
||||
this.result.find(x => x.key === key).value = this.socialConfig[key];
|
||||
}
|
||||
},
|
||||
fnOnClick(item) {
|
||||
this.$utils.copyText(item.value, item.name + ' 已复制!');
|
||||
// if (this.globalAppSettings.contact.isLinkCopy && this.$utils.checkIsUrl(item.value)) {
|
||||
// uni.navigateTo({
|
||||
// url: '/pagesC/website/website?data=' +
|
||||
// JSON.stringify({
|
||||
// title: item.name,
|
||||
// url: item.value
|
||||
// })
|
||||
// });
|
||||
// } else {
|
||||
// this.$utils.copyText(item.value, item.name + ' 已复制!');
|
||||
// }
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
padding-top: 160rpx;
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
padding-top: 160rpx;
|
||||
}
|
||||
.profile {
|
||||
.avatar {
|
||||
width: 170rpx;
|
||||
height: 170rpx;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
border-radius: 50%;
|
||||
border: 6rpx solid #fff;
|
||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.07);
|
||||
overflow: hidden;
|
||||
&-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.nickname {
|
||||
font-size: 38rpx;
|
||||
}
|
||||
}
|
||||
.contact-icons {
|
||||
.halocoloricon {
|
||||
font-size: 42rpx;
|
||||
}
|
||||
}
|
||||
.contact {
|
||||
box-sizing: border-box;
|
||||
border-top: 2rpx solid #f2f2f2;
|
||||
|
||||
.item {
|
||||
box-sizing: border-box;
|
||||
border-radius: 12rpx;
|
||||
background-color: #fafafa;
|
||||
// background-color: rgba(0, 0, 0, 0.05);
|
||||
// padding-bottom: 12rpx;
|
||||
// border-bottom: 2rpx solid #eee;
|
||||
padding: 16rpx;
|
||||
.left {
|
||||
position: relative;
|
||||
width: 140rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
// background-color: rgba(0, 0, 0, 0.03);
|
||||
border-radius: 12rpx 0 0 12rpx;
|
||||
&::after {
|
||||
display: none;
|
||||
content: ':';
|
||||
position: absolute;
|
||||
right: 18rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
.icon {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.name {
|
||||
margin-left: 10rpx;
|
||||
color: #555;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
.right {
|
||||
width: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
box-sizing: border-box;
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
font-size: 24rpx;
|
||||
box-sizing: border-box;
|
||||
padding-left: 12rpx;
|
||||
}
|
||||
}
|
||||
.profile {
|
||||
.avatar {
|
||||
width: 170rpx;
|
||||
height: 170rpx;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
border-radius: 50%;
|
||||
border: 6rpx solid #fff;
|
||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.07);
|
||||
overflow: hidden;
|
||||
|
||||
&-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.nickname {
|
||||
font-size: 38rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.contact-icons {
|
||||
.halocoloricon {
|
||||
font-size: 42rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.contact {
|
||||
box-sizing: border-box;
|
||||
border-top: 2rpx solid #f2f2f2;
|
||||
|
||||
.item {
|
||||
box-sizing: border-box;
|
||||
border-radius: 12rpx;
|
||||
background-color: #fafafa;
|
||||
// background-color: rgba(0, 0, 0, 0.05);
|
||||
// padding-bottom: 12rpx;
|
||||
// border-bottom: 2rpx solid #eee;
|
||||
padding: 16rpx;
|
||||
|
||||
.left {
|
||||
position: relative;
|
||||
width: 140rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
// background-color: rgba(0, 0, 0, 0.03);
|
||||
border-radius: 12rpx 0 0 12rpx;
|
||||
|
||||
&::after {
|
||||
display: none;
|
||||
content: ':';
|
||||
position: absolute;
|
||||
right: 18rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.icon {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.name {
|
||||
margin-left: 10rpx;
|
||||
color: #555;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
width: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
box-sizing: border-box;
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
font-size: 24rpx;
|
||||
box-sizing: border-box;
|
||||
padding-left: 12rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,42 +1,59 @@
|
||||
<template>
|
||||
<view class="app-page bg-white round-3 pa-46">
|
||||
<view class="text-weight-b text-size-lg text-align-center">《 本博客免责声明 》</view>
|
||||
<view v-if="false" class="text-size-s text-align-center mt-12 text-grey-darken-1">—— 博主:{{ bloggerInfo.nickname }} ——</view>
|
||||
<view class="mt-32">1、本博客属于个人非赢利性质的网站,所有转载的文章都以遵循原作者的版权声明注明了文章来源。</view>
|
||||
<view class="mt-24">2、如果原文没有版权声明,按照目前互联网开放的原则,本博客将在不通知作者的情况下转载文章。</view>
|
||||
<view class="mt-24">3、如果原文明确注明“禁止转载”,本博客将不会转载。</view>
|
||||
<view class="mt-24">
|
||||
4、如果本博客转载的文章不符合作者的版权声明或者作者不想让本博客转载您的文章,请邮件告知
|
||||
<text class="text-bg-gradient-light-blue-accent ml-12 mr-12 " @click="$utils.copyText(bloggerInfo.email, '邮箱复制成功!')">
|
||||
<text class="iconfont icon-mail-fill text-size-m mr-6"></text>
|
||||
{{ bloggerInfo.email }}
|
||||
</text>
|
||||
,博主将会在第一时间删除相关信息!
|
||||
</view>
|
||||
<view class="mt-24">5、本博客转载文章仅为留作备份和知识点分享的目的。</view>
|
||||
<view class="mt-24">6、本博客将尽力确保所提供信息的准确性及可靠性,但不保证信息的正确性和完整性,且不对因信息的不正确或遗漏导致的任何损失或损害承担相关责任。</view>
|
||||
<view class="mt-24">
|
||||
7、本博客所发布、转载的文章,其版权均归原作者所有。如其他自媒体、网站或个人从本博客下载使用,请在转载有关文章时务必尊重该文章的著作权,保留本博客注明的“原文来源”或者自行去原文处复制版权声明,并自负版权等法律责任。
|
||||
</view>
|
||||
<view class="mt-24">8、本博客的所有原创文章皆可以任意转载,但转载时务必请注明出处。</view>
|
||||
<view class="mt-24">9、尊重原创,知识共享!</view>
|
||||
</view>
|
||||
<view class="app-page bg-white round-3 pa-46">
|
||||
<!-- 通过配置 -->
|
||||
<view v-if="disclaimersContent" style="min-height: 100%;" v-html="disclaimersContent"></view>
|
||||
|
||||
<!-- 静态写法 -->
|
||||
<block v-else>
|
||||
<view class="text-weight-b text-size-lg text-align-center">《 本博客免责声明 》</view>
|
||||
<view v-if="false" class="text-size-s text-align-center mt-12 text-grey-darken-1">—— 博主:{{ bloggerInfo.nickname }} ——</view>
|
||||
<view class="mt-32">1、本博客属于个人非盈利性质的网站,所有转载的文章都以遵循原作者的版权声明注明了文章来源。</view>
|
||||
<view class="mt-24">2、如果原文没有版权声明,按照目前互联网开放的原则,本博客将在不通知作者的情况下转载文章。</view>
|
||||
<view class="mt-24">3、如果原文明确注明“禁止转载”,本博客将不会转载。</view>
|
||||
<view class="mt-24">
|
||||
4、如果本博客转载的文章不符合作者的版权声明或者作者不想让本博客转载您的文章,请邮件告知
|
||||
<text class="text-bg-gradient-light-blue-accent ml-12 mr-12 " @click="$utils.copyText(bloggerInfo.email, '电子邮箱已复制到剪贴板!')">
|
||||
<text class="iconfont icon-mail-fill text-size-m mr-6"></text>
|
||||
{{ bloggerInfo.email }}
|
||||
</text>
|
||||
,博主将会在第一时间删除相关信息!
|
||||
</view>
|
||||
<view class="mt-24">5、本博客转载文章仅为留作备份和知识点分享的目的。</view>
|
||||
<view class="mt-24">
|
||||
6、本博客将尽力确保所提供信息的准确性及可靠性,但不保证信息的正确性和完整性,且不对因信息的不正确或遗漏导致的任何损失或损害承担相关责任。
|
||||
</view>
|
||||
<view class="mt-24">
|
||||
7、本博客所发布、转载的文章,其版权均归原作者所有。如其他自媒体、网站或个人从本博客下载使用,请在转载有关文章时务必尊重该文章的著作权,保留本博客注明的“原文来源”或者自行去原文处复制版权声明,并自负版权等法律责任。
|
||||
</view>
|
||||
<view class="mt-24">8、本博客的所有原创文章皆可以任意转载,但转载时务必请注明出处。</view>
|
||||
<view class="mt-24">9、尊重原创,知识共享!</view>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
computed: {
|
||||
bloggerInfo() {
|
||||
return this.$tm.vx.getters().getBlogger;
|
||||
}
|
||||
}
|
||||
computed: {
|
||||
haloConfigs() {
|
||||
return this.$tm.vx.getters().getConfigs
|
||||
},
|
||||
disclaimersContent() {
|
||||
const basicConfig = this.haloConfigs.basicConfig;
|
||||
return basicConfig?.disclaimers.content
|
||||
},
|
||||
bloggerInfo() {
|
||||
const blogger = this.haloConfigs.authorConfig.blogger;
|
||||
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar)
|
||||
return blogger;
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.app-page {
|
||||
line-height: 1.65;
|
||||
font-size: 30rpx;
|
||||
color: var(--main-text-color);
|
||||
line-height: 1.65;
|
||||
font-size: 30rpx;
|
||||
color: var(--main-text-color);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,454 @@
|
||||
<template>
|
||||
<view class="app-page card-shadow" :class="[uniHaloPluginPageClass]">
|
||||
<PluginUnavailable v-if="!uniHaloPluginAvailable" :pluginId="uniHaloPluginId"
|
||||
:error-text="uniHaloPluginAvailableError" />
|
||||
<template v-else>
|
||||
<view v-if="loading != 'success'" class="loading-wrap">
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
</view>
|
||||
<view v-else class="content" :class="{ 'bg-white': dataList.length !== 0 }">
|
||||
<!-- 空数据 -->
|
||||
<view v-if="dataList.length == 0" class="content-empty flex flex-center">
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="啊偶,博主还没有朋友呢~"></tm-empty>
|
||||
</view>
|
||||
|
||||
<!-- 如果只有一个分组:使用列表的形式 dataList.length == 1 -->
|
||||
<view v-else class="flex flex-col pb-24">
|
||||
<block v-for="(link, index) in dataList" :key="index">
|
||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||
<!-- 色彩版本 -->
|
||||
<view v-if="!globalAppSettings.links.useSimple" class="info flex pt-24 pb-24 pl-12 pr-12"
|
||||
:class="{ 'border-b-1': index !== dataList.length - 1 }" @click="fnOnLinkEvent(link)">
|
||||
<view class="link-logo">
|
||||
<cache-image class="link-logo_img" radius="12rpx" :url="link.spec.logo"
|
||||
:fileMd5="link.spec.logo" mode="aspectFill"></cache-image>
|
||||
</view>
|
||||
<view class="flex flex-col pl-30 info-detail">
|
||||
<view class="link-card_name text-size-l text-weight-b text-red">
|
||||
<tm-tags style="margin-right: 12rpx;margin-left: -2rpx;"
|
||||
color="bg-gradient-light-blue-lighten" :shadow="0" size="s" model="fill">
|
||||
{{ link.spec.groupName || '暂未分组' }}
|
||||
</tm-tags>
|
||||
{{ link.spec.displayName }}
|
||||
</view>
|
||||
<view class="poup-tag mt-6" style="font-size: 28rpx;">
|
||||
站点地址:{{ link.spec.url }}
|
||||
<!-- <tm-tags color="bg-gradient-amber-accent" :shadow="0" size="s" model="fill">
|
||||
URL:{{ link.spec.url }}
|
||||
</tm-tags>
|
||||
<tm-tags color=" bg-gradient-light-blue-lighten" :shadow="0" size="s" model="fill">
|
||||
{{ link.spec.groupName || '暂未分组' }}
|
||||
</tm-tags> -->
|
||||
</view>
|
||||
<view class="link-card_desc text-overflow mt-4" style="font-size: 28rpx;">
|
||||
博客简介:{{ link.spec.description || '这个博主很懒,没写简介~' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 简洁版本 -->
|
||||
<view v-else class="link-card flex ml-24 mr-24 pt-24 pb-24" @click="fnOnLinkEvent(link)">
|
||||
<image class="logo shadow-6" :src="link.spec.logo" mode="aspectFill"></image>
|
||||
<view class="info pl-24">
|
||||
<view class="name text-size-g">{{ link.spec.displayName }}</view>
|
||||
<view class="desc mt-12 text-size-s text-grey-darken-1">{{ link.spec.description }}
|
||||
</view>
|
||||
<view v-if="false" class="link mt-12 text-size-m text-grey-darken-1">
|
||||
<text class="iconfont icon-link mr-6 text-size-s"></text>
|
||||
{{ link.spec.url }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</tm-translate>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!-- 返回顶部 -->
|
||||
<tm-flotbutton color="light-blue" @click="fnToTopPage" size="m" icon="icon-angle-up"></tm-flotbutton>
|
||||
<tm-flotbutton v-if="haloPluginConfigs.linksSubmitPlugin.enabled" :offset="[16,80]" label="申请"
|
||||
actions-pos="left" :show-text="true" color="bg-gradient-orange-accent"
|
||||
@click="toSubmitLinkPage"></tm-flotbutton>
|
||||
<!-- 详情弹窗 -->
|
||||
<tm-poup v-model="detail.show" :width="640" height="auto" position="center" :round="6">
|
||||
<view class="poup pa-36" v-if="detail.data">
|
||||
<view class="info flex">
|
||||
<view class="poup-logo bg-gradient-amber-accent pa-4 shadow-24">
|
||||
<image class="poup-logo_img" :src="$utils.checkImageUrl(detail.data.spec.logo)"
|
||||
mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="pl-24 info-detail">
|
||||
<view class="poup-name text-size-lg text-weight-b">{{ detail.data.spec.displayName }}
|
||||
</view>
|
||||
<view class="poup-tag ml--10">
|
||||
<tm-tags color="bg-gradient-light-blue-lighten" size="n" model="fill">
|
||||
{{ detail.data.spec.groupName }}
|
||||
</tm-tags>
|
||||
</view>
|
||||
<view class="poup-link text-size-m" @click="fnCopyLink(detail.data)">
|
||||
<text class="text-orange">{{ detail.data.spec.url }}</text>
|
||||
<text class="iconfont icon-copy text-size-s ml-6 text-grey"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="poup-desc mt-20">
|
||||
博客简介:{{ detail.data.spec.description || '这个博主很懒,没写简介~' }}
|
||||
</view>
|
||||
|
||||
<!-- 博客预览图 -->
|
||||
<view class="mt-24">
|
||||
<tm-images :width="568" :round="2" :src="calcSiteThumbnail(detail.data.spec.url)"
|
||||
mode="aspectFill"></tm-images>
|
||||
</view>
|
||||
</view>
|
||||
</tm-poup>
|
||||
|
||||
<view class="load-text">{{ loadMoreText }}</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue';
|
||||
import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue';
|
||||
|
||||
import pluginAvailableMixin from "@/common/mixins/pluginAvailable.js"
|
||||
import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue'
|
||||
|
||||
export default {
|
||||
mixins: [pluginAvailableMixin],
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmTranslate,
|
||||
tmFlotbutton,
|
||||
tmTags,
|
||||
tmEmpty,
|
||||
tmImages,
|
||||
tmPoup,
|
||||
PluginUnavailable
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 1
|
||||
},
|
||||
detail: {
|
||||
show: false,
|
||||
data: null
|
||||
},
|
||||
hasNext: false,
|
||||
isLoadMore: false,
|
||||
loadMoreText: '',
|
||||
linkGroupList: [],
|
||||
dataList: [],
|
||||
colors: [
|
||||
'#39B449',
|
||||
'#E44C41',
|
||||
'#8698A2',
|
||||
'#0080FE',
|
||||
'#1CBCB4',
|
||||
'#6638B5'
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
haloConfigs() {
|
||||
return this.$tm.vx.getters().getConfigs;
|
||||
},
|
||||
haloPluginConfigs() {
|
||||
return this.$tm.vx.getters().getConfigs.pluginConfig;
|
||||
},
|
||||
calcSiteThumbnail(val) {
|
||||
return val => {
|
||||
if (!val) return '';
|
||||
if (val.charAt(val.length - 1) !== '/') {
|
||||
val = val + '/';
|
||||
}
|
||||
return 'https://image.thum.io/get/width/1000/crop/800/' + val;
|
||||
};
|
||||
},
|
||||
calcAuditModeEnabled() {
|
||||
return this.haloConfigs.auditConfig.auditModeEnabled
|
||||
},
|
||||
},
|
||||
async onLoad() {
|
||||
this.fnSetPageTitle('友情链接');
|
||||
// 检查插件
|
||||
this.setPluginId(this.NeedPluginIds.PluginLinks)
|
||||
this.setPluginError("阿偶,检测到当前插件没有安装或者启用,无法使用友情链接功能哦,请联系管理员")
|
||||
if (!await this.checkPluginAvailable()) return
|
||||
this.fnGetLinkGroupData();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
if (!this.uniHaloPluginAvailable) {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
return
|
||||
}
|
||||
this.isLoadMore = false;
|
||||
this.queryParams.page = 1;
|
||||
this.dataList = []
|
||||
this.fnGetData();
|
||||
},
|
||||
onReachBottom(e) {
|
||||
if (!this.uniHaloPluginAvailable) return;
|
||||
if (this.hasNext) {
|
||||
this.queryParams.page += 1;
|
||||
this.isLoadMore = true;
|
||||
this.fnGetData();
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '没有更多数据了'
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fnGetLinkGroupData() {
|
||||
this.$httpApi.v2
|
||||
.getFriendLinkGroupList({
|
||||
page: 1,
|
||||
size: 0
|
||||
})
|
||||
.then(res => {
|
||||
this.linkGroupList = res.items;
|
||||
this.fnGetData()
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
},
|
||||
findLinkGroupDisplayNameByGroupMetadataName(groupName) {
|
||||
if (this.linkGroupList.length === 0) return groupName || "未分组"
|
||||
return this.linkGroupList.find(item => item.metadata.name === groupName)?.spec?.displayName || groupName ||
|
||||
"未分组"
|
||||
},
|
||||
fnGetData() {
|
||||
if (this.calcAuditModeEnabled) {
|
||||
return;
|
||||
}
|
||||
if (!this.isLoadMore) {
|
||||
this.loading = 'loading';
|
||||
}
|
||||
this.loadMoreText = '';
|
||||
this.$httpApi.v2
|
||||
.getFriendLinkList(this.queryParams)
|
||||
.then(res => {
|
||||
console.log('请求结果:');
|
||||
console.log(res);
|
||||
this.hasNext = res.hasNext;
|
||||
const list = res.items.map(item => {
|
||||
item.spec.logo = this.$utils.checkAvatarUrl(item.spec?.logo)
|
||||
item.spec.groupName = this.findLinkGroupDisplayNameByGroupMetadataName(item.spec
|
||||
?.groupName)
|
||||
return item;
|
||||
})
|
||||
this.dataList = this.dataList.concat(list);
|
||||
setTimeout(() => {
|
||||
this.loading = 'success';
|
||||
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
}, 500);
|
||||
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
}, 500);
|
||||
});
|
||||
},
|
||||
|
||||
handleGroup(list) {
|
||||
const group = {}
|
||||
list.forEach(item => {
|
||||
if (group[item.spec.groupName]) {
|
||||
group[item.spec.groupName].children.push(item)
|
||||
} else {
|
||||
group[item.spec.groupName] = {
|
||||
title: item.spec.groupName,
|
||||
children: [item]
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return Object.keys(group).map(key => {
|
||||
const {
|
||||
title,
|
||||
children = []
|
||||
} = group[key]
|
||||
return {
|
||||
title,
|
||||
children
|
||||
}
|
||||
})
|
||||
},
|
||||
fnOnLinkEvent(link) {
|
||||
this.detail.data = link;
|
||||
this.detail.show = true;
|
||||
},
|
||||
|
||||
fnCopyLink(link) {
|
||||
uni.setClipboardData({
|
||||
data: `${link.spec.displayName}:${link.spec.url}`,
|
||||
showToast: false,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '链接复制成功!'
|
||||
});
|
||||
},
|
||||
fail: () => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '复制失败!'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
toSubmitLinkPage() {
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/submit-link/submit-link'
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fafafd;
|
||||
}
|
||||
|
||||
.loading-wrap {
|
||||
padding: 24rpx;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 0 24rpx;
|
||||
padding-top: 24rpx;
|
||||
|
||||
.content-empty {
|
||||
height: 60vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
.link-card {
|
||||
border-bottom: 2rpx solid #f5f5f5;
|
||||
background-color: #ffffff;
|
||||
|
||||
&.one {
|
||||
border: 0;
|
||||
box-shadow: 0rpx 2rpx 24rpx 0rpx rgba(0, 0, 0, 0.03);
|
||||
|
||||
.logo {
|
||||
box-shadow: 0rpx 2rpx 12rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
.logo {
|
||||
// width: 126rpx;
|
||||
// height: 126rpx;
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 12rpx;
|
||||
border: 6rpx solid #ffffff;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.info {
|
||||
width: 0;
|
||||
flex-grow: 1;
|
||||
|
||||
.name {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: #303133;
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.desc {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: #303133;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.link-card_name {
|
||||
// color: #303133;
|
||||
// color: #0080fe;
|
||||
}
|
||||
|
||||
.link-card_desc {
|
||||
font-size: 24rpx;
|
||||
line-height: 1.6;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.link-logo {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
|
||||
&_img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.poup-logo {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
border-radius: 50%;
|
||||
|
||||
&_img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.info-detail {
|
||||
width: 0;
|
||||
flex-grow: 1;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.poup-desc {
|
||||
font-size: 28rpx;
|
||||
line-height: 1.6;
|
||||
color: #555 !important;
|
||||
}
|
||||
|
||||
.preview-site {
|
||||
width: 100%;
|
||||
height: 300rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -1,134 +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
|
||||
},
|
||||
result: null,
|
||||
dataList: [],
|
||||
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() {
|
||||
// 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>
|
||||
@@ -1,257 +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>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
</view>
|
||||
<!-- 内容区域 -->
|
||||
<view v-else class="app-page-content pa-24" :class="{ 'bg-white': dataList.length !== 0 }">
|
||||
<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="calcAniWait(index)">
|
||||
<!-- 列表项 -->
|
||||
<comment-item class="mb-12" :isChild="false" :comment="item" :postId="sheetId" :useSolid="false" @on-copy="fnCopyContent" @on-comment="fnToComment" @on-detail="fnOnShowCommentDetail"></comment-item>
|
||||
</tm-translate>
|
||||
</block>
|
||||
<tm-flotbutton :offset="[16, 80]" @click="fnToTopPage" size="m" color="light-blue" icon="icon-angle-up"></tm-flotbutton>
|
||||
<view class="load-text">{{ loadMoreText }}</view>
|
||||
</block>
|
||||
<tm-flotbutton actions-pos="left" :show-text="true" color="bg-gradient-orange-accent" @click="fnToComment(null)"></tm-flotbutton>
|
||||
</view>
|
||||
|
||||
<!-- 评论详情 -->
|
||||
<tm-poup v-model="commentDetail.show" height="auto" :round="6" :over-close="true" position="bottom">
|
||||
<view class="pa-24">
|
||||
<view class="poup-head pb-24">
|
||||
<view class="poup-title text-align-center text-size-g text-weight-b mb-32">留言详情</view>
|
||||
<comment-item :useActions="false" :isChild="false" :comment="commentDetail.comment" :postId="sheetId"></comment-item>
|
||||
</view>
|
||||
|
||||
<scroll-view :scroll-y="true" class="poup-body">
|
||||
<view v-if="commentDetail.loading != 'success'" class="poup-loading-wrap flex flex-center">
|
||||
<view v-if="commentDetail.loading == 'loading'" class="loading flex flex-center flex-col">
|
||||
<text class="e-loading-icon iconfont icon-loading text-blue"></text>
|
||||
<view class="text-size-n text-grey-lighten-1 py-12 mt-12">加载中,请稍等...</view>
|
||||
</view>
|
||||
<view v-else-if="commentDetail.loading == 'error'" class="error">
|
||||
<tm-empty icon="icon-wind-cry" label="加载失败">
|
||||
<tm-button theme="bg-gradient-light-blue-accent" size="m" @click="fnGetChildComments()">刷新试试</tm-button>
|
||||
</tm-empty>
|
||||
</view>
|
||||
</view>
|
||||
<block v-else>
|
||||
<view v-if="commentDetail.list.length == 0" class="poup-empty flex flex-center">
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="没有更多评论啦~"></tm-empty>
|
||||
</view>
|
||||
|
||||
<block v-else>
|
||||
<comment-item v-for="(comment, index) in commentDetail.list" :useSolid="false" :useActions="false" :key="index" :isChild="false" :comment="comment" :postId="sheetId"></comment-item>
|
||||
</block>
|
||||
</block>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</tm-poup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AppKeys from '@/config/keys.js';
|
||||
import SheetConfig from '@/config/sheets.config.js';
|
||||
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue';
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
import commentItem from '@/components/comment-item/comment-item.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmFlotbutton,
|
||||
tmTranslate,
|
||||
tmEmpty,
|
||||
tmPoup,
|
||||
tmButton,
|
||||
commentItem
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0
|
||||
},
|
||||
result: null,
|
||||
dataList: [],
|
||||
isLoadMore: false,
|
||||
loadMoreText: '加载中...',
|
||||
sheetId: SheetConfig[AppKeys.SHEET_LEAVING],
|
||||
commentDetail: {
|
||||
loading: 'loading',
|
||||
show: false,
|
||||
comment: {},
|
||||
postId: undefined,
|
||||
list: []
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('留言板');
|
||||
},
|
||||
created() {
|
||||
this.fnGetData();
|
||||
uni.$on('leaving_refresh', () => {
|
||||
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() {
|
||||
// uni.showLoading({
|
||||
// mask: true,
|
||||
// title: '加载中...'
|
||||
// });
|
||||
// 设置状态为加载中
|
||||
if (!this.isLoadMore) {
|
||||
this.loading = 'loading';
|
||||
}
|
||||
this.loadMoreText = '加载中...';
|
||||
this.$httpApi
|
||||
.getSheetsCommentsTreeBySheetId(this.sheetId, this.queryParams)
|
||||
.then(res => {
|
||||
if (res.status == 200) {
|
||||
this.loading = 'success';
|
||||
// return;
|
||||
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;
|
||||
}
|
||||
} else {
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
}, 500);
|
||||
});
|
||||
},
|
||||
fnToComment(data) {
|
||||
let _comment = {};
|
||||
if (data) {
|
||||
_comment = {
|
||||
id: this.sheetId,
|
||||
parentId: data.comment.id,
|
||||
title: data.comment.author,
|
||||
from: 'sheets',
|
||||
formPage: 'leaving',
|
||||
type: 'user'
|
||||
};
|
||||
} else {
|
||||
_comment = {
|
||||
id: this.sheetId,
|
||||
parentId: 0,
|
||||
title: '留言板留言',
|
||||
from: 'sheets',
|
||||
formPage: 'leaving',
|
||||
type: 'post'
|
||||
};
|
||||
}
|
||||
|
||||
uni.$tm.vx.commit('comment/setCommentInfo', _comment);
|
||||
this.$Router.push({
|
||||
path: '/pagesA/comment/comment',
|
||||
query: _comment
|
||||
});
|
||||
},
|
||||
fnCopyContent(content) {
|
||||
uni.$tm.u.setClipboardData(content);
|
||||
uni.$tm.toast('内容已复制成功!');
|
||||
},
|
||||
fnOnShowCommentDetail(comment) {
|
||||
this.commentDetail.comment = comment;
|
||||
this.commentDetail.list = [];
|
||||
this.commentDetail.show = true;
|
||||
this.fnGetChildComments();
|
||||
},
|
||||
fnGetChildComments() {
|
||||
this.commentDetail.loading = 'loading';
|
||||
this.$httpApi
|
||||
.getSheetsChildrenCommentList(this.sheetId, this.commentDetail.comment.id, {})
|
||||
.then(res => {
|
||||
if (res.status == 200) {
|
||||
this.commentDetail.loading = 'success';
|
||||
this.commentDetail.list = res.data;
|
||||
} else {
|
||||
this.commentDetail.loading = 'error';
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.commentDetail.loading = 'error';
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fafafd;
|
||||
}
|
||||
|
||||
.app-page-content {
|
||||
box-sizing: border-box;
|
||||
// box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.content-empty {
|
||||
width: 100%;
|
||||
height: 60vh;
|
||||
}
|
||||
|
||||
.loading-wrap {
|
||||
box-sizing: border-box;
|
||||
padding: 24rpx;
|
||||
}
|
||||
</style>
|
||||
+339
-333
@@ -1,78 +1,69 @@
|
||||
<template>
|
||||
<view class="app-page">
|
||||
<view v-if="loading != 'success'" class="loading-wrap">
|
||||
<view v-if="loading == 'loading'" class="loading">
|
||||
<view class="loading-icon flex flex-center"><text class="e-loading-icon iconfont icon-loading"></text></view>
|
||||
<view class="loadig-text ">相册正在努力加载中啦~</view>
|
||||
</view>
|
||||
<tm-empty v-else icon="icon-shiliangzhinengduixiang-" color="red" label="啊偶,加载失败了呢~">
|
||||
<tm-button theme="red" :shadow="0" size="m" @click="fnRefresh()">刷新试试</tm-button>
|
||||
</tm-empty>
|
||||
</view>
|
||||
<!-- 内容区域 -->
|
||||
<view v-else class="app-page-content">
|
||||
<view v-if="dataList.length == 0" color="light-blue" class="content-empty flex flex-center">
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="相册暂时还没有数据~">
|
||||
<tm-button :shadow="0" size="m" theme="light-blue" @click="fnRefresh()">刷新试试</tm-button>
|
||||
</tm-empty>
|
||||
</view>
|
||||
<block v-else>
|
||||
<swiper
|
||||
class="swiper-album"
|
||||
:current="swiperIndex"
|
||||
:acceleration="true"
|
||||
:circular="true"
|
||||
:vertical="false"
|
||||
:indicator-dots="false"
|
||||
:autoplay="false"
|
||||
@change="fnOnChange"
|
||||
>
|
||||
<block v-for="(item, index) in dataList" :key="index">
|
||||
<swiper-item class="swiper-album-item">
|
||||
<view class="scroll-wrap">
|
||||
<view class="card">
|
||||
<cache-image
|
||||
class="card-image"
|
||||
width="100%"
|
||||
height="46vh"
|
||||
radius="12rpx"
|
||||
:url="item.image"
|
||||
:fileMd5="item.image"
|
||||
mode="aspectFill"
|
||||
@on-click="fnOnPreview(item)"
|
||||
></cache-image>
|
||||
<view v-if="item.description" class="card-desc">{{ item.description }}</view>
|
||||
<view v-else class="card-desc is-empty flex flex-col">
|
||||
<view class="text-grey-darken-1">该照片没有记录任何信息</view>
|
||||
<view class="text-size-m mt-24 text-grey-darken-1">记录一下拍照的瞬间,会更精彩哟</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
<view class="tabbar">
|
||||
<view class="pre" @click="fnChange(false)">
|
||||
<text class="icon"><text class="iconfont icon-arrow-left"></text></text>
|
||||
<text class="text">上一张</text>
|
||||
</view>
|
||||
<view class="refresh" @click="fnRefresh()">
|
||||
<text class="refresh-text">点击</text>
|
||||
<text class="refresh-heart iconfont icon-diagnose"></text>
|
||||
<text class="refresh-text">刷新</text>
|
||||
</view>
|
||||
<view class="next" @click="fnChange(true)">
|
||||
<text class="text">下一张</text>
|
||||
<text class="icon"><text class="iconfont icon-arrow-right"></text></text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
<view class="app-page">
|
||||
<view v-if="loading !== 'success'" class="loading-wrap">
|
||||
<view v-if="loading === 'loading'" class="loading">
|
||||
<view class="loading-icon flex flex-center">
|
||||
<text class="e-loading-icon iconfont icon-loading"></text>
|
||||
</view>
|
||||
<view class="loadig-text ">相册正在努力加载中啦~</view>
|
||||
</view>
|
||||
<tm-empty v-else icon="icon-shiliangzhinengduixiang-" color="red" label="啊偶,加载失败了呢~">
|
||||
<tm-button theme="red" :shadow="0" size="m" @click="fnRefresh()">刷新试试</tm-button>
|
||||
</tm-empty>
|
||||
</view>
|
||||
<!-- 内容区域 -->
|
||||
<view v-else class="app-page-content">
|
||||
<view v-if="dataList.length === 0" color="light-blue" class="content-empty flex flex-center">
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="相册暂时还没有数据~">
|
||||
<tm-button :shadow="0" size="m" theme="light-blue" @click="fnRefresh()">刷新试试</tm-button>
|
||||
</tm-empty>
|
||||
</view>
|
||||
<block v-else>
|
||||
<swiper class="swiper-album" :current="swiperIndex" :acceleration="true" :circular="true"
|
||||
:vertical="false" :indicator-dots="false" :autoplay="false" @change="fnOnChange">
|
||||
<block v-for="(item, index) in dataList" :key="index">
|
||||
<swiper-item class="swiper-album-item">
|
||||
<view class="scroll-wrap">
|
||||
<view class="card">
|
||||
<cache-image class="card-image" width="100%" height="46vh" radius="12rpx"
|
||||
:url="item.image" :fileMd5="item.image" mode="aspectFill"
|
||||
@on-click="fnOnPreview(item)"></cache-image>
|
||||
<view v-if="item.spec.description" class="card-desc">{{ item.spec.description }}
|
||||
</view>
|
||||
<view v-else class="card-desc is-empty flex flex-col">
|
||||
<view class="text-grey-darken-1">该照片没有记录任何信息</view>
|
||||
<view class="text-size-m mt-24 text-grey-darken-1">记录一下拍照的瞬间,会更精彩哟</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
<view class="tabbar">
|
||||
<view class="pre" @click="fnChange(false)">
|
||||
<text class="icon">
|
||||
<text class="iconfont icon-arrow-left"></text>
|
||||
</text>
|
||||
<text class="text">上一张</text>
|
||||
</view>
|
||||
<view class="refresh" @click="fnRefresh()">
|
||||
<text class="refresh-text">点击</text>
|
||||
<text class="refresh-heart iconfont icon-diagnose"></text>
|
||||
<text class="refresh-text">刷新</text>
|
||||
</view>
|
||||
<view class="next" @click="fnChange(true)">
|
||||
<text class="text">下一张</text>
|
||||
<text class="icon">
|
||||
<text class="iconfont icon-arrow-right"></text>
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import LoveConfig from '@/config/love.config.js';
|
||||
import throttle from '@/utils/throttle.js';
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
@@ -80,298 +71,313 @@ 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: {
|
||||
tmButton,
|
||||
tmFlotbutton,
|
||||
tmTranslate,
|
||||
tmEmpty
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
loveConfig: LoveConfig,
|
||||
queryParams: {
|
||||
size: 99,
|
||||
page: 0,
|
||||
sort: 'takeTime',
|
||||
team: LoveConfig.albumKeyName
|
||||
},
|
||||
result: {},
|
||||
dataList: [],
|
||||
cache: {
|
||||
dataList: [],
|
||||
total: 0
|
||||
},
|
||||
swiperIndex: 0,
|
||||
tabbar: {
|
||||
list: []
|
||||
}
|
||||
};
|
||||
},
|
||||
components: {
|
||||
tmButton,
|
||||
tmFlotbutton,
|
||||
tmTranslate,
|
||||
tmEmpty
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
queryParams: {
|
||||
size: 100,
|
||||
page: 1,
|
||||
group: ""
|
||||
},
|
||||
result: {},
|
||||
dataList: [],
|
||||
swiperIndex: 0,
|
||||
tabbar: {
|
||||
list: []
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
loveConfig() {
|
||||
return this.$tm.vx.getters().getConfigs.loveConfig;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
loveConfig: {
|
||||
deep: true,
|
||||
immediate: true,
|
||||
handler(newVal, oldVal) {
|
||||
this.fnGetData()
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('恋爱相册');
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('恋爱相册');
|
||||
},
|
||||
created() {
|
||||
this.fnGetData();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.fnRefresh();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.fnRefresh();
|
||||
},
|
||||
|
||||
methods: {
|
||||
fnRefresh() {
|
||||
this.queryParams.page = 0;
|
||||
this.fnGetData();
|
||||
},
|
||||
fnGetData() {
|
||||
this.loading = 'loading';
|
||||
this.$httpApi
|
||||
.getPhotoListByPage(this.queryParams)
|
||||
.then(res => {
|
||||
if (res.status == 200) {
|
||||
this.loading = 'success';
|
||||
if (res.data.content.length != 0) {
|
||||
const _list = res.data.content.map((item, index) => {
|
||||
item['image'] = this.$utils.checkImageUrl(item.thumbnail);
|
||||
item['takeTime'] = this.$tm.dayjs(item['takeTime']).format('DD/MM/YYYY');
|
||||
return item;
|
||||
});
|
||||
this.dataList = _list;
|
||||
this.swiperIndex = 0;
|
||||
}
|
||||
} else {
|
||||
this.loading = 'error';
|
||||
uni.$tm.toast('加载失败,请下拉刷新重试!');
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
uni.$tm.toast('加载失败,请下拉刷新重试!');
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.stopPullDownRefresh();
|
||||
}, 200);
|
||||
});
|
||||
},
|
||||
// 缓存数据
|
||||
fnCacheDataList(dataList) {
|
||||
if (this.queryParams.page == 0) {
|
||||
this.cache.dataList = dataList;
|
||||
} else {
|
||||
this.cache.dataList = [...this.cache.dataList, ...dataList];
|
||||
}
|
||||
},
|
||||
fnOnPreview(item) {
|
||||
uni.previewImage({
|
||||
current: item.image,
|
||||
urls: this.dataList.map(x => x.image)
|
||||
});
|
||||
},
|
||||
fnOnChange(e) {
|
||||
this.swiperIndex = e.detail.current;
|
||||
},
|
||||
fnChange(isNext) {
|
||||
throttle(() => {
|
||||
if (isNext) {
|
||||
if (this.swiperIndex == this.dataList.length - 1) {
|
||||
this.swiperIndex = 0;
|
||||
} else {
|
||||
this.swiperIndex += 1;
|
||||
}
|
||||
} else {
|
||||
if (this.swiperIndex == 0) {
|
||||
this.swiperIndex = this.dataList.length - 1;
|
||||
} else {
|
||||
this.swiperIndex -= 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
methods: {
|
||||
fnRefresh() {
|
||||
this.queryParams.page = 0;
|
||||
this.fnGetData();
|
||||
},
|
||||
fnGetData() {
|
||||
this.loading = 'loading';
|
||||
this.queryParams.group = this.loveConfig.lovePhoto.groupName
|
||||
this.$httpApi.v2
|
||||
.getPhotoListByGroupName(this.queryParams)
|
||||
.then(res => {
|
||||
console.log("相册 res", res)
|
||||
this.loading = 'success';
|
||||
this.dataList = res.items.map((item, index) => {
|
||||
item['image'] = this.$utils.checkImageUrl(item.spec.cover || item.spec.url);
|
||||
item['takeTime'] = this.$tm.dayjs(item.metadata.creationTimestamp).format(
|
||||
'DD/MM/YYYY');
|
||||
return item;
|
||||
});
|
||||
this.swiperIndex = 0;
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
uni.$tm.toast('加载失败,请下拉刷新重试!');
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.stopPullDownRefresh();
|
||||
}, 200);
|
||||
});
|
||||
},
|
||||
|
||||
fnOnPreview(item) {
|
||||
uni.previewImage({
|
||||
current: item.image,
|
||||
urls: this.dataList.map(x => x.image)
|
||||
});
|
||||
},
|
||||
fnOnChange(e) {
|
||||
this.swiperIndex = e.detail.current;
|
||||
},
|
||||
fnChange(isNext) {
|
||||
throttle(() => {
|
||||
if (isNext) {
|
||||
if (this.swiperIndex === this.dataList.length - 1) {
|
||||
this.swiperIndex = 0;
|
||||
} else {
|
||||
this.swiperIndex += 1;
|
||||
}
|
||||
} else {
|
||||
if (this.swiperIndex === 0) {
|
||||
this.swiperIndex = this.dataList.length - 1;
|
||||
} else {
|
||||
this.swiperIndex -= 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
padding: 24rpx 0;
|
||||
padding-bottom: 144rpx;
|
||||
background: linear-gradient(
|
||||
-135deg,
|
||||
rgba(247, 149, 51, 0.1),
|
||||
rgba(243, 112, 85, 0.1) 15%,
|
||||
rgba(239, 78, 123, 0.1) 30%,
|
||||
rgba(161, 102, 171, 0.1) 44%,
|
||||
rgba(80, 115, 184, 0.1) 58%,
|
||||
rgba(16, 152, 173, 0.1) 72%,
|
||||
rgba(7, 179, 155, 0.1) 86%,
|
||||
rgba(109, 186, 130, 0.1)
|
||||
);
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
padding: 24rpx 0;
|
||||
padding-bottom: 144rpx;
|
||||
background: linear-gradient(-135deg,
|
||||
rgba(247, 149, 51, 0.1),
|
||||
rgba(243, 112, 85, 0.1) 15%,
|
||||
rgba(239, 78, 123, 0.1) 30%,
|
||||
rgba(161, 102, 171, 0.1) 44%,
|
||||
rgba(80, 115, 184, 0.1) 58%,
|
||||
rgba(16, 152, 173, 0.1) 72%,
|
||||
rgba(7, 179, 155, 0.1) 86%,
|
||||
rgba(109, 186, 130, 0.1));
|
||||
}
|
||||
|
||||
.app-page-content {
|
||||
}
|
||||
.loading-wrap {
|
||||
width: 100vw;
|
||||
height: 60vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
padding: 36rpx;
|
||||
|
||||
::v-deep {
|
||||
.tm-icons {
|
||||
margin-right: -20rpx;
|
||||
}
|
||||
}
|
||||
.loading-wrap {
|
||||
width: 100vw;
|
||||
height: 60vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
padding: 36rpx;
|
||||
|
||||
::v-deep {
|
||||
.tm-icons {
|
||||
margin-right: -20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.e-loading-icon {
|
||||
font-size: 120rpx;
|
||||
// color: #f88ca2;
|
||||
color: #56bbf9;
|
||||
font-size: 120rpx;
|
||||
// color: #f88ca2;
|
||||
color: #56bbf9;
|
||||
}
|
||||
|
||||
.loadig-text {
|
||||
margin-top: 28rpx;
|
||||
font-size: 28rpx;
|
||||
// color: #f88ca2;
|
||||
color: #56bbf9;
|
||||
margin-top: 28rpx;
|
||||
font-size: 28rpx;
|
||||
// color: #f88ca2;
|
||||
color: #56bbf9;
|
||||
}
|
||||
|
||||
.content-empty {
|
||||
width: 100%;
|
||||
height: 60vh;
|
||||
width: 100%;
|
||||
height: 60vh;
|
||||
}
|
||||
|
||||
.swiper-album {
|
||||
width: 100vw;
|
||||
height: calc(100vh - 24rpx - 144rpx);
|
||||
width: 100vw;
|
||||
height: calc(100vh - 24rpx - 144rpx);
|
||||
}
|
||||
|
||||
.swiper-album-item {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
padding: 36rpx;
|
||||
/* #ifdef H5 */
|
||||
padding-bottom: 110rpx;
|
||||
/* #endif */
|
||||
/* #ifndef H5 */
|
||||
padding-bottom: 60rpx;
|
||||
/* #endif */
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
padding: 36rpx;
|
||||
/* #ifdef H5 */
|
||||
padding-bottom: 110rpx;
|
||||
/* #endif */
|
||||
/* #ifndef H5 */
|
||||
padding-bottom: 60rpx;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.scroll-wrap {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 36rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 12rpx;
|
||||
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 36rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 12rpx;
|
||||
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
}
|
||||
|
||||
.card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
// height: 65vh;
|
||||
height: 100%;
|
||||
max-height: 100%;
|
||||
border-radius: 12rpx;
|
||||
background-color: #ffffff;
|
||||
box-sizing: border-box;
|
||||
// box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
overflow: hidden;
|
||||
overflow-y: auto;
|
||||
::v-deep {
|
||||
.cache-image {
|
||||
height: initial !important;
|
||||
}
|
||||
}
|
||||
&-image {
|
||||
width: 100%;
|
||||
height: initial !important;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
&-desc {
|
||||
margin-top: 24rpx;
|
||||
line-height: 1.6;
|
||||
font-size: 30rpx;
|
||||
color: rgba(26, 26, 26, 0.9);
|
||||
&.is-empty {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-grow: 1;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
}
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
// height: 65vh;
|
||||
height: 100%;
|
||||
max-height: 100%;
|
||||
border-radius: 12rpx;
|
||||
background-color: #ffffff;
|
||||
box-sizing: border-box;
|
||||
// box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
overflow: hidden;
|
||||
overflow-y: auto;
|
||||
|
||||
::v-deep {
|
||||
.cache-image {
|
||||
height: initial !important;
|
||||
}
|
||||
}
|
||||
|
||||
&-image {
|
||||
width: 100%;
|
||||
height: initial !important;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
&-desc {
|
||||
margin-top: 24rpx;
|
||||
line-height: 1.6;
|
||||
font-size: 30rpx;
|
||||
color: rgba(26, 26, 26, 0.9);
|
||||
|
||||
&.is-empty {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-grow: 1;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tabbar {
|
||||
width: 90vw;
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
bottom: 40rpx;
|
||||
transform: translateX(-50%);
|
||||
border-radius: 25rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
// background-color: rgba(0, 0, 0, 0.5);
|
||||
background-color: #ffffff;
|
||||
color: #333;
|
||||
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.05);
|
||||
.refresh {
|
||||
animation: refreshAni 6s ease-in-out infinite;
|
||||
color: #56bbf9;
|
||||
&-heart {
|
||||
font-size: 42rpx;
|
||||
color: inherit;
|
||||
margin: 0 6rpx;
|
||||
}
|
||||
&-text {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
.pre {
|
||||
color: #56bbf9;
|
||||
transition: transform 0.1s ease-in-out;
|
||||
&:hover {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
.text {
|
||||
padding-left: 12rpx;
|
||||
}
|
||||
}
|
||||
.next {
|
||||
color: #f88ca2;
|
||||
transition: transform 0.1s ease-in-out;
|
||||
&:hover {
|
||||
transform: scale(1.03);
|
||||
}
|
||||
.text {
|
||||
padding-right: 12rpx;
|
||||
}
|
||||
}
|
||||
width: 90vw;
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
bottom: 40rpx;
|
||||
transform: translateX(-50%);
|
||||
border-radius: 25rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
// background-color: rgba(0, 0, 0, 0.5);
|
||||
background-color: #ffffff;
|
||||
color: #333;
|
||||
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.05);
|
||||
|
||||
.refresh {
|
||||
animation: refreshAni 6s ease-in-out infinite;
|
||||
color: #56bbf9;
|
||||
|
||||
&-heart {
|
||||
font-size: 42rpx;
|
||||
color: inherit;
|
||||
margin: 0 6rpx;
|
||||
}
|
||||
|
||||
&-text {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.pre {
|
||||
color: #56bbf9;
|
||||
transition: transform 0.1s ease-in-out;
|
||||
|
||||
&:hover {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.text {
|
||||
padding-left: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.next {
|
||||
color: #f88ca2;
|
||||
transition: transform 0.1s ease-in-out;
|
||||
|
||||
&:hover {
|
||||
transform: scale(1.03);
|
||||
}
|
||||
|
||||
.text {
|
||||
padding-right: 12rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes refreshAni {
|
||||
0% {
|
||||
color: #f88ca2;
|
||||
}
|
||||
50% {
|
||||
color: #56bbf9;
|
||||
}
|
||||
100% {
|
||||
color: #f88ca2;
|
||||
}
|
||||
0% {
|
||||
color: #f88ca2;
|
||||
}
|
||||
|
||||
50% {
|
||||
color: #56bbf9;
|
||||
}
|
||||
|
||||
100% {
|
||||
color: #f88ca2;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
+88
-74
@@ -1,92 +1,106 @@
|
||||
<template>
|
||||
<view class="app-page">
|
||||
<view class="page-title">我们的故事</view>
|
||||
<view class="html-typed" v-html="html">内容渲染</view>
|
||||
<view class="app-page">
|
||||
<view class="page-title">我们的故事</view>
|
||||
<view class="html-typed" v-html="html">内容渲染</view>
|
||||
|
||||
<scroll-btn bottom="160rpx" :scrollTop.sync="scrollTop"></scroll-btn>
|
||||
</view>
|
||||
<scroll-btn bottom="160rpx" :scrollTop.sync="scrollTop"></scroll-btn>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import LoveConfig from '@/config/love.config.js';
|
||||
import ScrollBtn from '@/components/scroll-btn/scroll-btn.vue';
|
||||
|
||||
export default {
|
||||
components: { ScrollBtn },
|
||||
data() {
|
||||
return {
|
||||
scrollTop: 0,
|
||||
html: '',
|
||||
timer: null
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.fnInit();
|
||||
},
|
||||
onPageScroll(e) {
|
||||
this.scrollTop = e.scrollTop;
|
||||
},
|
||||
onBackPress() {
|
||||
clearTimeout(this.timer);
|
||||
},
|
||||
methods: {
|
||||
fnInit() {
|
||||
clearTimeout(this.timer);
|
||||
const _html = LoveConfig.journey;
|
||||
let _index = 0;
|
||||
const _typing = () => {
|
||||
this.timer = setTimeout(() => {
|
||||
if (_index >= _html.length) {
|
||||
clearTimeout(this.timer);
|
||||
} else {
|
||||
this.html += _html.substring(_index, _index + 1);
|
||||
_index += 1;
|
||||
_typing();
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
_typing();
|
||||
}
|
||||
}
|
||||
components: {
|
||||
ScrollBtn
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
scrollTop: 0,
|
||||
html: '',
|
||||
timer: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
loveConfig() {
|
||||
return this.$tm.vx.getters().getConfigs.loveConfig;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
loveConfig: {
|
||||
deep: true,
|
||||
immediate: true,
|
||||
handler(newVal, oldVal) {
|
||||
if (!newVal) return;
|
||||
this.fnInit();
|
||||
}
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
this.scrollTop = e.scrollTop;
|
||||
},
|
||||
onBackPress() {
|
||||
clearTimeout(this.timer);
|
||||
},
|
||||
methods: {
|
||||
fnInit() {
|
||||
clearTimeout(this.timer);
|
||||
const _html = this.loveConfig.ourStory.content;
|
||||
let _index = 0;
|
||||
const _typing = () => {
|
||||
this.timer = setTimeout(() => {
|
||||
if (_index >= _html.length) {
|
||||
clearTimeout(this.timer);
|
||||
} else {
|
||||
this.html += _html.substring(_index, _index + 1);
|
||||
_index += 1;
|
||||
_typing();
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
_typing();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
padding: 36rpx;
|
||||
/* #ifdef APP-PLUS */
|
||||
padding-top: 100rpx;
|
||||
/* #endif */
|
||||
/* #ifdef H5 */
|
||||
padding-top: 80rpx;
|
||||
/* #endif */
|
||||
/* #ifdef MP-WEIXIN */
|
||||
padding-top: 120rpx;
|
||||
/* #endif */
|
||||
background: linear-gradient(
|
||||
-45deg,
|
||||
rgba(247, 149, 51, 0.1),
|
||||
rgba(243, 112, 85, 0.1) 15%,
|
||||
rgba(239, 78, 123, 0.1) 30%,
|
||||
rgba(161, 102, 171, 0.1) 44%,
|
||||
rgba(80, 115, 184, 0.1) 58%,
|
||||
rgba(16, 152, 173, 0.1) 72%,
|
||||
rgba(7, 179, 155, 0.1) 86%,
|
||||
rgba(109, 186, 130, 0.1)
|
||||
);
|
||||
color: rgba(26, 26, 26, 1);
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
padding: 36rpx;
|
||||
/* #ifdef APP-PLUS */
|
||||
padding-top: 100rpx;
|
||||
/* #endif */
|
||||
/* #ifdef H5 */
|
||||
padding-top: 80rpx;
|
||||
/* #endif */
|
||||
/* #ifdef MP-WEIXIN */
|
||||
padding-top: 120rpx;
|
||||
/* #endif */
|
||||
background: linear-gradient(-45deg,
|
||||
rgba(247, 149, 51, 0.1),
|
||||
rgba(243, 112, 85, 0.1) 15%,
|
||||
rgba(239, 78, 123, 0.1) 30%,
|
||||
rgba(161, 102, 171, 0.1) 44%,
|
||||
rgba(80, 115, 184, 0.1) 58%,
|
||||
rgba(16, 152, 173, 0.1) 72%,
|
||||
rgba(7, 179, 155, 0.1) 86%,
|
||||
rgba(109, 186, 130, 0.1));
|
||||
color: rgba(26, 26, 26, 1);
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 42rpx;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
text-shadow: 0rpx 4rpx 24rpx #bfe9ef;
|
||||
font-size: 42rpx;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
text-shadow: 0rpx 4rpx 24rpx #bfe9ef;
|
||||
}
|
||||
|
||||
.html-typed {
|
||||
margin-top: 52rpx;
|
||||
line-height: 1.8;
|
||||
font-size: 30rpx;
|
||||
margin-top: 52rpx;
|
||||
line-height: 1.8;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
+394
-385
@@ -1,421 +1,430 @@
|
||||
<template>
|
||||
<view class="app-page" @touchstart="fnOnTouchstart" @touchend="fnOnTouchend" @touchcancel="fnOnTouchend">
|
||||
<view class="love-card" :class="{ ani: isDoAni }">
|
||||
<view class="head">
|
||||
<image class="avatar" :src="loveConfig.boy.avatar" mode="scaleToFill"></image>
|
||||
<view class="love-days">
|
||||
<view class="tip-text">相恋</view>
|
||||
<view class="number">
|
||||
<text class="boy">-</text>
|
||||
<text class="days">{{ calcLoveDays }}</text>
|
||||
<text class="girl">-</text>
|
||||
</view>
|
||||
<view class="tip-text">天</view>
|
||||
</view>
|
||||
<image class="avatar" :src="loveConfig.girl.avatar" mode="scaleToFill"></image>
|
||||
</view>
|
||||
<view class="foot">
|
||||
<view class="text" v-if="false">
|
||||
我们已经相恋
|
||||
<text class="number">- {{ calcLoveDays }} -</text>
|
||||
天啦
|
||||
</view>
|
||||
看看我们的恋爱清单都完成了哪些吧
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="list.length == 0" class="list empty">
|
||||
<view class="card">
|
||||
<image class="empty-image" :src="loveConfig.loveImageUrl" mode="scaleToFill"></image>
|
||||
<view class="empty-text">暂时还没有恋爱清单,快去制定你们的恋爱清单吧~</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="list">
|
||||
<block v-for="(item, index) in list" :key="index">
|
||||
<view class="card" :class="{ ani: isDoAni }" :style="{ '--delay': calcCardDelay(index) }">
|
||||
<view class="head">
|
||||
<view class="status">
|
||||
<view v-if="!item.finish" class="text">进行中</view>
|
||||
<view v-else class="text finish">已完成</view>
|
||||
</view>
|
||||
<view class="title">
|
||||
<view class="title-name">{{ item.title }}</view>
|
||||
<view class="title-desc">{{ item.desc }}</view>
|
||||
</view>
|
||||
<view class="actions" @click="fnOnItemOpen(item)">
|
||||
<text class="icon">{{ item.open ? '-' : '+' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.open" class="body">
|
||||
<view class="desc">
|
||||
<view class="desc-label">开始时间:</view>
|
||||
<view class="desc-value">{{ item.detail.start || '暂无计划' }}</view>
|
||||
</view>
|
||||
<view class="desc" v-if="item.detail.desc">
|
||||
<view class="desc-label">事件描述:</view>
|
||||
<view class="desc-value">{{ item.detail.desc }}</view>
|
||||
</view>
|
||||
<view class="desc">
|
||||
<view class="desc-label">完成时间:</view>
|
||||
<view class="desc-value">{{ item.detail.end || '未开始或正在进行中...' }}</view>
|
||||
</view>
|
||||
<view class="desc">
|
||||
<view class="desc-label">完成打卡:</view>
|
||||
<view class="desc-value">{{ item.detail.moment || '未开始或正在进行中...' }}</view>
|
||||
</view>
|
||||
<view class="desc" v-if="item.detail.other">
|
||||
<view class="desc-label">爱心备注:</view>
|
||||
<view class="desc-value">{{ item.detail.other }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<scroll-btn :scrollTop.sync="scrollTop" @on-status="fnOnScrollStatus"></scroll-btn>
|
||||
</view>
|
||||
<view class="app-page" @touchstart="fnOnTouchstart" @touchend="fnOnTouchend" @touchcancel="fnOnTouchend">
|
||||
<view class="love-card" :class="{ ani: isDoAni }">
|
||||
<view class="head">
|
||||
<image class="avatar" :src="$utils.checkAvatarUrl(loveConfig.loveInfo.boyAvatar)" mode="scaleToFill"></image>
|
||||
<view class="love-days">
|
||||
<view class="tip-text">相恋</view>
|
||||
<view class="number">
|
||||
<text class="boy">-</text>
|
||||
<text class="days">{{ calcLoveDays }}</text>
|
||||
<text class="girl">-</text>
|
||||
</view>
|
||||
<view class="tip-text">天</view>
|
||||
</view>
|
||||
<image class="avatar" :src="$utils.checkAvatarUrl(loveConfig.loveInfo.girlAvatar)" mode="scaleToFill"></image>
|
||||
</view>
|
||||
<view class="foot">
|
||||
<view class="text" v-if="false">
|
||||
我们已经相恋
|
||||
<text class="number">- {{ calcLoveDays }} -</text>
|
||||
天啦
|
||||
</view>
|
||||
看看我们的恋爱清单都完成了哪些吧
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="list.length == 0" class="list empty">
|
||||
<view class="card">
|
||||
<image class="empty-image" :src="$utils.checkImageUrl(loveConfig.pageImages.heartImageUrl)" mode="scaleToFill"></image>
|
||||
<view class="empty-text">暂时还没有恋爱清单,快去制定你们的恋爱清单吧~</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="list">
|
||||
<block v-for="(item, index) in list" :key="index">
|
||||
<view class="card" :class="{ ani: isDoAni }" :style="{ '--delay': calcCardDelay(index) }">
|
||||
<view class="head">
|
||||
<view class="status">
|
||||
<view v-if="item.status==='wait'" class="text">未开始</view>
|
||||
<view v-else-if="item.status==='doing'" class="text">进行中</view>
|
||||
<view v-else-if="item.status==='complete'" class="text finish">已完成</view>
|
||||
</view>
|
||||
<view class="title">
|
||||
<view class="title-name">{{ item.title }}</view>
|
||||
</view>
|
||||
<view class="actions" @click="fnOnItemOpen(item)">
|
||||
<text class="icon">{{ item.open ? '-' : '+' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.open && item.content" class="body">
|
||||
<view v-if="item.content" class="desc">
|
||||
<view class="desc-label">事件内容:</view>
|
||||
<view class="desc-value">{{ item.content || "-" }}</view>
|
||||
</view>
|
||||
<view v-if="item.status==='complete' && item.completeDate" class="desc">
|
||||
<view class="desc-label">完成时间:</view>
|
||||
<view class="desc-value">{{ item.completeDate || '-' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<scroll-btn :scrollTop.sync="scrollTop" @on-status="fnOnScrollStatus"></scroll-btn>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import LoveConfig from '@/config/love.config.js';
|
||||
import ScrollBtn from '@/components/scroll-btn/scroll-btn.vue';
|
||||
|
||||
export default {
|
||||
components: { ScrollBtn },
|
||||
data() {
|
||||
return {
|
||||
isDoAni: true,
|
||||
scrollTop: 0,
|
||||
loveConfig: LoveConfig,
|
||||
list: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
calcLoveDays() {
|
||||
const formatStartDate = this.loveConfig.loveStartDate.replace(/-/g, '/');
|
||||
const start = new Date(formatStartDate),
|
||||
now = new Date();
|
||||
const T = now.getTime() - start.getTime();
|
||||
const i = 24 * 60 * 60 * 1000;
|
||||
const d = T / i;
|
||||
const D = Math.floor(d);
|
||||
return D;
|
||||
},
|
||||
calcCardDelay() {
|
||||
return index => {
|
||||
return Math.random() * index + 1 + 's';
|
||||
};
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fnGetList();
|
||||
},
|
||||
onPageScroll(e) {
|
||||
this.scrollTop = e.scrollTop;
|
||||
},
|
||||
methods: {
|
||||
fnGetList() {
|
||||
if (LoveConfig.loveList.useApi && LoveConfig.loveList.api) {
|
||||
uni.request({
|
||||
url: LoveConfig.loveList.api,
|
||||
header: {
|
||||
ContentType: 'application/json'
|
||||
},
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
success: res => {
|
||||
if (res.statusCode == 200 && res.data.status == 200) {
|
||||
this.list = res.data.data.map(item => {
|
||||
item['open'] = false;
|
||||
return item;
|
||||
});
|
||||
} else {
|
||||
uni.$tm.toast('数据请求失败,请检查接口!');
|
||||
}
|
||||
},
|
||||
fail: err => {
|
||||
uni.$tm.toast('数据请求失败,请检查接口!');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.list = LoveConfig.loveList.data.map(item => {
|
||||
item['open'] = false;
|
||||
return item;
|
||||
});
|
||||
}
|
||||
},
|
||||
fnOnItemOpen(item) {
|
||||
item.open = !item.open;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
fnOnScrollStatus(isEnd) {
|
||||
this.isDoAni = isEnd;
|
||||
},
|
||||
fnOnTouchstart() {
|
||||
this.isDoAni = false;
|
||||
},
|
||||
fnOnTouchend() {
|
||||
this.isDoAni = true;
|
||||
}
|
||||
}
|
||||
components: {
|
||||
ScrollBtn
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isDoAni: true,
|
||||
scrollTop: 0,
|
||||
list: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
loveConfig() {
|
||||
return this.$tm.vx.getters().getConfigs.loveConfig;
|
||||
},
|
||||
calcLoveDays() {
|
||||
const formatStartDate = this.loveConfig.loveDate.replace(/-/g, '/');
|
||||
const start = new Date(formatStartDate),
|
||||
now = new Date();
|
||||
const T = now.getTime() - start.getTime();
|
||||
const i = 24 * 60 * 60 * 1000;
|
||||
const d = T / i;
|
||||
const D = Math.floor(d);
|
||||
return D;
|
||||
},
|
||||
calcCardDelay() {
|
||||
return index => {
|
||||
return Math.random() * index + 1 + 's';
|
||||
};
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
loveConfig: {
|
||||
deep: true,
|
||||
immediate: true,
|
||||
handler(newVal) {
|
||||
if (!newVal) return;
|
||||
this.fnGetList();
|
||||
}
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
this.scrollTop = e.scrollTop;
|
||||
},
|
||||
methods: {
|
||||
fnGetList() {
|
||||
this.list = this.loveConfig.loveDaily.list.map(item => {
|
||||
item['open'] = false;
|
||||
return item;
|
||||
});
|
||||
},
|
||||
fnOnItemOpen(item) {
|
||||
item.open = !item.open;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
fnOnScrollStatus(isEnd) {
|
||||
this.isDoAni = isEnd;
|
||||
},
|
||||
fnOnTouchstart() {
|
||||
this.isDoAni = false;
|
||||
},
|
||||
fnOnTouchend() {
|
||||
this.isDoAni = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
padding: 36rpx;
|
||||
/* #ifdef H5 */
|
||||
padding-top: 60rpx;
|
||||
/* #endif */
|
||||
/* #ifndef H5 */
|
||||
padding-top: 180rpx;
|
||||
/* #endif */
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
padding: 36rpx;
|
||||
/* #ifdef H5 */
|
||||
padding-top: 60rpx;
|
||||
/* #endif */
|
||||
/* #ifndef H5 */
|
||||
padding-top: 180rpx;
|
||||
/* #endif */
|
||||
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
rgba(247, 149, 51, 0.1),
|
||||
rgba(243, 112, 85, 0.1) 15%,
|
||||
rgba(239, 78, 123, 0.1) 30%,
|
||||
rgba(161, 102, 171, 0.1) 44%,
|
||||
rgba(80, 115, 184, 0.1) 58%,
|
||||
rgba(16, 152, 173, 0.1) 72%,
|
||||
rgba(7, 179, 155, 0.1) 86%,
|
||||
rgba(109, 186, 130, 0.1)
|
||||
);
|
||||
background: linear-gradient(135deg,
|
||||
rgba(247, 149, 51, 0.1),
|
||||
rgba(243, 112, 85, 0.1) 15%,
|
||||
rgba(239, 78, 123, 0.1) 30%,
|
||||
rgba(161, 102, 171, 0.1) 44%,
|
||||
rgba(80, 115, 184, 0.1) 58%,
|
||||
rgba(16, 152, 173, 0.1) 72%,
|
||||
rgba(7, 179, 155, 0.1) 86%,
|
||||
rgba(109, 186, 130, 0.1));
|
||||
}
|
||||
|
||||
.love-card {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
padding: 0 24rpx;
|
||||
padding-top: 66rpx;
|
||||
padding-bottom: 52rpx;
|
||||
border-radius: 50rpx;
|
||||
border: 4rpx solid rgba(96, 77, 68, 0.9);
|
||||
border-color: #faf8eb;
|
||||
background-color: rgba(255, 199, 184, 0.9);
|
||||
margin-bottom: 52rpx;
|
||||
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.1);
|
||||
&.ani {
|
||||
animation: loveCardAni 3s ease-in-out infinite;
|
||||
}
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
padding: 0 24rpx;
|
||||
padding-top: 66rpx;
|
||||
padding-bottom: 52rpx;
|
||||
border-radius: 50rpx;
|
||||
border: 4rpx solid rgba(96, 77, 68, 0.9);
|
||||
border-color: #faf8eb;
|
||||
background-color: rgba(255, 199, 184, 0.9);
|
||||
margin-bottom: 52rpx;
|
||||
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.1);
|
||||
|
||||
.head {
|
||||
display: flex;
|
||||
.avatar {
|
||||
width: 150rpx;
|
||||
height: 150rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 50%;
|
||||
border: 6rpx solid rgba(255, 255, 255, 0.7);
|
||||
&.ani {
|
||||
animation: loveCardAni 3s ease-in-out infinite;
|
||||
}
|
||||
|
||||
&.boy {
|
||||
border-color: #56bbf9;
|
||||
}
|
||||
&.girl {
|
||||
border-color: #f88ca2;
|
||||
}
|
||||
}
|
||||
.love-days {
|
||||
margin: 0 12rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 26rpx;
|
||||
.tip-text {
|
||||
color: #333;
|
||||
}
|
||||
.number {
|
||||
font-size: 46rpx;
|
||||
padding: 12rpx 0;
|
||||
> .boy {
|
||||
color: #56bbf9;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
> .girl {
|
||||
color: #f88ca2;
|
||||
margin-left: 12rpx;
|
||||
}
|
||||
}
|
||||
.days {
|
||||
animation: daysAni 6s ease-in-out infinite;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
.foot {
|
||||
display: none;
|
||||
margin-top: 36rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.head {
|
||||
display: flex;
|
||||
|
||||
.avatar {
|
||||
width: 150rpx;
|
||||
height: 150rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 50%;
|
||||
border: 6rpx solid rgba(255, 255, 255, 0.7);
|
||||
|
||||
&.boy {
|
||||
border-color: #56bbf9;
|
||||
}
|
||||
|
||||
&.girl {
|
||||
border-color: #f88ca2;
|
||||
}
|
||||
}
|
||||
|
||||
.love-days {
|
||||
margin: 0 12rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 26rpx;
|
||||
|
||||
.tip-text {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.number {
|
||||
font-size: 46rpx;
|
||||
padding: 12rpx 0;
|
||||
|
||||
> .boy {
|
||||
color: #56bbf9;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
> .girl {
|
||||
color: #f88ca2;
|
||||
margin-left: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.days {
|
||||
animation: daysAni 6s ease-in-out infinite;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.foot {
|
||||
display: none;
|
||||
margin-top: 36rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes daysAni {
|
||||
0% {
|
||||
color: #f88ca2;
|
||||
}
|
||||
50% {
|
||||
color: #56bbf9;
|
||||
}
|
||||
100% {
|
||||
color: #f88ca2;
|
||||
}
|
||||
0% {
|
||||
color: #f88ca2;
|
||||
}
|
||||
|
||||
50% {
|
||||
color: #56bbf9;
|
||||
}
|
||||
|
||||
100% {
|
||||
color: #f88ca2;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes loveCardAni {
|
||||
0% {
|
||||
transform: scale(1);
|
||||
}
|
||||
50% {
|
||||
transform: scale(1.03);
|
||||
}
|
||||
100% {
|
||||
transform: scale(1);
|
||||
}
|
||||
0% {
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
50% {
|
||||
transform: scale(1.03);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
.list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.empty {
|
||||
height: calc(100vh - 180rpx - 280rpx - 36rpx);
|
||||
.card {
|
||||
height: 100%;
|
||||
padding: 100rpx;
|
||||
margin-bottom: 0;
|
||||
text-align: center;
|
||||
justify-content: center;
|
||||
color: rgba(96, 77, 68, 0.9);
|
||||
}
|
||||
&-image {
|
||||
width: 300rpx;
|
||||
height: 300rpx;
|
||||
}
|
||||
&-text {
|
||||
margin-top: 36rpx;
|
||||
line-height: 50rpx;
|
||||
}
|
||||
height: calc(100vh - 180rpx - 280rpx - 36rpx);
|
||||
|
||||
.card {
|
||||
height: 100%;
|
||||
padding: 100rpx;
|
||||
margin-bottom: 0;
|
||||
text-align: center;
|
||||
justify-content: center;
|
||||
color: rgba(96, 77, 68, 0.9);
|
||||
}
|
||||
|
||||
&-image {
|
||||
width: 300rpx;
|
||||
height: 300rpx;
|
||||
}
|
||||
|
||||
&-text {
|
||||
margin-top: 36rpx;
|
||||
line-height: 50rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
padding: 24rpx;
|
||||
border-radius: 50rpx;
|
||||
border: 4rpx solid rgba(96, 77, 68, 0.9);
|
||||
border-color: #fff;
|
||||
// background-color: #faf8eb;
|
||||
background-color: #ffffff;
|
||||
margin-bottom: 36rpx;
|
||||
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.05);
|
||||
animation-delay: var(--delay);
|
||||
&.ani {
|
||||
animation: cardAni 3s ease-in-out infinite;
|
||||
}
|
||||
.head {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
.status {
|
||||
width: 100rpx;
|
||||
display: flex;
|
||||
.text {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 50%;
|
||||
background-color: #ffc6ba;
|
||||
font-size: 24rpx;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
color: #55423b;
|
||||
&.finish {
|
||||
background-color: #bfe9ef;
|
||||
}
|
||||
}
|
||||
}
|
||||
.title {
|
||||
width: 0;
|
||||
flex-grow: 1;
|
||||
box-sizing: border-box;
|
||||
padding-left: 30rpx;
|
||||
padding-right: 24rpx;
|
||||
&-name {
|
||||
font-weight: bold;
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
}
|
||||
&-desc {
|
||||
margin-top: 8rpx;
|
||||
font-size: 26rpx;
|
||||
color: #555;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
.actions {
|
||||
width: 50rpx;
|
||||
.icon {
|
||||
display: inline-block;
|
||||
width: 45rpx;
|
||||
height: 45rpx;
|
||||
background-color: rgba(96, 77, 68, 0.2);
|
||||
border-radius: 50%;
|
||||
text-align: center;
|
||||
line-height: 45rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
padding: 24rpx;
|
||||
border-radius: 50rpx;
|
||||
border: 4rpx solid rgba(96, 77, 68, 0.9);
|
||||
border-color: #fff;
|
||||
// background-color: #faf8eb;
|
||||
background-color: #ffffff;
|
||||
margin-bottom: 36rpx;
|
||||
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.05);
|
||||
animation-delay: var(--delay);
|
||||
|
||||
.body {
|
||||
margin-top: 24rpx;
|
||||
width: 100%;
|
||||
background-color: #ffffff;
|
||||
// background-color: #faf8eb;
|
||||
background-color: rgba(96, 77, 68, 0.05);
|
||||
border-radius: 24rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 24rpx;
|
||||
padding-bottom: 12rpx;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
&.ani {
|
||||
// animation: cardAni 3s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.head {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
|
||||
.status {
|
||||
width: 100rpx;
|
||||
display: flex;
|
||||
|
||||
.text {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 50%;
|
||||
background-color: #ffc6ba;
|
||||
font-size: 24rpx;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
color: #55423b;
|
||||
|
||||
&.finish {
|
||||
background-color: #bfe9ef;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
width: 0;
|
||||
flex-grow: 1;
|
||||
box-sizing: border-box;
|
||||
padding-left: 30rpx;
|
||||
padding-right: 24rpx;
|
||||
|
||||
&-name {
|
||||
font-weight: bold;
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
&-desc {
|
||||
margin-top: 8rpx;
|
||||
font-size: 26rpx;
|
||||
color: #555;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.actions {
|
||||
width: 50rpx;
|
||||
|
||||
.icon {
|
||||
display: inline-block;
|
||||
width: 45rpx;
|
||||
height: 45rpx;
|
||||
background-color: rgba(96, 77, 68, 0.2);
|
||||
border-radius: 50%;
|
||||
text-align: center;
|
||||
line-height: 45rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.body {
|
||||
margin-top: 24rpx;
|
||||
width: 100%;
|
||||
background-color: #ffffff;
|
||||
// background-color: #faf8eb;
|
||||
background-color: rgba(96, 77, 68, 0.05);
|
||||
border-radius: 24rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 24rpx;
|
||||
padding-bottom: 12rpx;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes cardAni {
|
||||
0% {
|
||||
transform: translateY(0rpx);
|
||||
}
|
||||
0% {
|
||||
transform: translateY(0rpx);
|
||||
}
|
||||
|
||||
50% {
|
||||
transform: translateY(-10rpx);
|
||||
}
|
||||
50% {
|
||||
transform: translateY(-10rpx);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translateY(0rpx);
|
||||
}
|
||||
100% {
|
||||
transform: translateY(0rpx);
|
||||
}
|
||||
}
|
||||
|
||||
.desc {
|
||||
display: flex;
|
||||
margin-bottom: 12rpx;
|
||||
&-label {
|
||||
color: #333;
|
||||
width: 140rpx;
|
||||
// font-weight: bold;
|
||||
}
|
||||
&-value {
|
||||
width: 0;
|
||||
flex-grow: 1;
|
||||
line-height: 1.5;
|
||||
color: #333;
|
||||
}
|
||||
display: flex;
|
||||
margin-bottom: 12rpx;
|
||||
|
||||
&-label {
|
||||
color: #333;
|
||||
width: 140rpx;
|
||||
// font-weight: bold;
|
||||
}
|
||||
|
||||
&-value {
|
||||
width: 0;
|
||||
flex-grow: 1;
|
||||
line-height: 1.5;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
+382
-322
@@ -1,358 +1,418 @@
|
||||
<template>
|
||||
<view class="app-page bg-white">
|
||||
<!-- 情侣信息 -->
|
||||
<view class="lover-wrap" :style="[loveWrapStyle]">
|
||||
<view class="lover-card">
|
||||
<view class="boy">
|
||||
<image class="avatar" :src="loveConfig.boy.avatar" mode="aspectFit"></image>
|
||||
<view class="name">{{ loveConfig.boy.name }}</view>
|
||||
</view>
|
||||
<image class="like" :src="loveConfig.loveImageUrl" mode="scaleToFill"></image>
|
||||
<view class="girl">
|
||||
<image class="avatar" :src="loveConfig.girl.avatar" mode="aspectFit"></image>
|
||||
<view class="name">{{ loveConfig.girl.name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<image class="wave-image" :src="loveConfig.waveImageUrl" mode="scaleToFill"></image>
|
||||
</view>
|
||||
<!-- 恋爱记时 -->
|
||||
<view class="love-time-wrap">
|
||||
<view class="title">{{ loveConfig.timeTitle }}</view>
|
||||
<view class="content">
|
||||
<text class="text">
|
||||
第
|
||||
<text class="number">{{ loveDayCount.d }}</text>
|
||||
天
|
||||
</text>
|
||||
<text class="text">
|
||||
<text class="number">{{ loveDayCount.h }}</text>
|
||||
小时
|
||||
</text>
|
||||
<text class="text">
|
||||
<text class="number">{{ loveDayCount.m }}</text>
|
||||
分钟
|
||||
</text>
|
||||
<text class="text">
|
||||
<text class="number">{{ loveDayCount.s }}</text>
|
||||
秒
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 功能导航 -->
|
||||
<view class="list-wrap">
|
||||
<block v-for="(nav, index) in loveConfig.nav" :key="index">
|
||||
<view v-if="nav.use" class="list-item" @click="fnToPage(nav.key)">
|
||||
<view class="left"><image class="icon" :src="nav.iconImageUrl" mode="aspectFit"></image></view>
|
||||
<view class="right">
|
||||
<view class="name">{{ nav.title }}</view>
|
||||
<view class="desc">{{ nav.desc }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
<view class="app-page bg-white">
|
||||
<!-- 情侣信息 -->
|
||||
<view class="lover-wrap" :style="[loveWrapStyle]">
|
||||
<view class="lover-card">
|
||||
<view class="boy">
|
||||
<image class="avatar" :src="$utils.checkAvatarUrl(loveConfig.loveInfo.boyAvatar)" mode="aspectFit"></image>
|
||||
<view class="name">{{ loveConfig.loveInfo.boyNickname }}</view>
|
||||
</view>
|
||||
<image class="like" :src="$utils.checkImageUrl(loveConfig.pageImages.heartImageUrl)" mode="scaleToFill"></image>
|
||||
<view class="girl">
|
||||
<image class="avatar" :src="$utils.checkAvatarUrl(loveConfig.loveInfo.girlAvatar)" mode="aspectFit"></image>
|
||||
<view class="name">{{ loveConfig.loveInfo.girlNickname }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<image class="wave-image" :src="$utils.checkImageUrl(loveConfig.pageImages.waveImageUrl)" mode="scaleToFill"></image>
|
||||
</view>
|
||||
<!-- 恋爱记时 -->
|
||||
<view class="love-time-wrap">
|
||||
<view class="title">{{ loveConfig.loveDateTitle }}</view>
|
||||
<view class="content">
|
||||
<text class="text">
|
||||
第
|
||||
<text class="number">{{ loveDayCount.d }}</text>
|
||||
天
|
||||
</text>
|
||||
<text class="text">
|
||||
<text class="number">{{ loveDayCount.h }}</text>
|
||||
小时
|
||||
</text>
|
||||
<text class="text">
|
||||
<text class="number">{{ loveDayCount.m }}</text>
|
||||
分钟
|
||||
</text>
|
||||
<text class="text">
|
||||
<text class="number">{{ loveDayCount.s }}</text>
|
||||
秒
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 功能导航 -->
|
||||
<view class="list-wrap">
|
||||
<block v-for="(nav, index) in navList" :key="index">
|
||||
<view v-if="nav.use" class="list-item" @click="fnToPage(nav.key)">
|
||||
<view class="left">
|
||||
<image class="icon" :src="$utils.checkImageUrl(nav.iconImageUrl)" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="name">{{ nav.title }}</view>
|
||||
<view class="desc">{{ nav.desc }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import LoveConfig from '@/config/love.config.js';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loveConfig: LoveConfig,
|
||||
loveDayTimer: null,
|
||||
loveDayCount: {
|
||||
d: 0,
|
||||
h: 0,
|
||||
m: 0,
|
||||
s: 0
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
loveWrapStyle() {
|
||||
return {
|
||||
backgroundImage: `url(${this.loveConfig.bgImageUrl})`
|
||||
};
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('恋爱日记');
|
||||
this.fnInitLoveDayCount();
|
||||
},
|
||||
methods: {
|
||||
fnInitLoveDayCount() {
|
||||
clearTimeout(this.loveDayTimer);
|
||||
const _countDownFn = () => {
|
||||
this.loveDayTimer = setTimeout(_countDownFn, 1000);
|
||||
const formatStartDate = this.loveConfig.loveStartDate.replace(/-/g, '/');
|
||||
const start = new Date(formatStartDate),
|
||||
now = new Date();
|
||||
const T = now.getTime() - start.getTime();
|
||||
const i = 24 * 60 * 60 * 1000;
|
||||
const d = T / i;
|
||||
const D = Math.floor(d);
|
||||
const h = (d - D) * 24;
|
||||
const H = Math.floor(h);
|
||||
const m = (h - H) * 60;
|
||||
const M = Math.floor(m);
|
||||
const s = (m - M) * 60;
|
||||
const S = Math.floor(s);
|
||||
this.loveDayCount = {
|
||||
d: D,
|
||||
h: H,
|
||||
m: M,
|
||||
s: S
|
||||
};
|
||||
};
|
||||
_countDownFn();
|
||||
},
|
||||
fnToPage(pageName) {
|
||||
uni.navigateTo({
|
||||
url: `/pagesA/love/${pageName}`
|
||||
});
|
||||
}
|
||||
}
|
||||
data() {
|
||||
return {
|
||||
loveDayTimer: null,
|
||||
loveDayCount: {
|
||||
d: 0,
|
||||
h: 0,
|
||||
m: 0,
|
||||
s: 0
|
||||
},
|
||||
navList: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
loveConfig() {
|
||||
return this.$tm.vx.getters().getConfigs.loveConfig;
|
||||
},
|
||||
loveWrapStyle() {
|
||||
return {
|
||||
backgroundImage: `url(${this.$utils.checkImageUrl(this.loveConfig.pageImages.bgImageUrl)})`
|
||||
};
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
loveConfig: {
|
||||
deep: true,
|
||||
immediate: true,
|
||||
handler(newVal, oldVal) {
|
||||
if (!newVal) return;
|
||||
this.initList(newVal)
|
||||
this.fnInitLoveDayCount();
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('恋爱日记');
|
||||
},
|
||||
methods: {
|
||||
initList(configs) {
|
||||
this.navList = [
|
||||
{
|
||||
key: 'journey',
|
||||
use: configs.ourStory.enabled,
|
||||
iconImageUrl: configs.ourStory.iconUrl,
|
||||
title: '关于我们',
|
||||
desc: '我们一起度过的那些经历'
|
||||
},
|
||||
{
|
||||
key: 'album',
|
||||
use: configs.lovePhoto.enabled,
|
||||
iconImageUrl: configs.lovePhoto.iconUrl,
|
||||
title: '恋爱相册',
|
||||
desc: '定格了我们的那些小美好'
|
||||
},
|
||||
{
|
||||
key: 'list',
|
||||
use: configs.loveDaily.enabled,
|
||||
iconImageUrl: configs.loveDaily.iconUrl,
|
||||
title: '恋爱清单',
|
||||
desc: '你我之间的约定我们都在努力实现'
|
||||
},
|
||||
]
|
||||
},
|
||||
fnInitLoveDayCount() {
|
||||
clearTimeout(this.loveDayTimer);
|
||||
const _countDownFn = () => {
|
||||
this.loveDayTimer = setTimeout(_countDownFn, 1000);
|
||||
const formatStartDate = this.loveConfig.loveDate.replace(/-/g, '/');
|
||||
const start = new Date(formatStartDate),
|
||||
now = new Date();
|
||||
const T = now.getTime() - start.getTime();
|
||||
const i = 24 * 60 * 60 * 1000;
|
||||
const d = T / i;
|
||||
const D = Math.floor(d);
|
||||
const h = (d - D) * 24;
|
||||
const H = Math.floor(h);
|
||||
const m = (h - H) * 60;
|
||||
const M = Math.floor(m);
|
||||
const s = (m - M) * 60;
|
||||
const S = Math.floor(s);
|
||||
this.loveDayCount = {
|
||||
d: D,
|
||||
h: H,
|
||||
m: M,
|
||||
s: S
|
||||
};
|
||||
};
|
||||
_countDownFn();
|
||||
},
|
||||
fnToPage(pageName) {
|
||||
uni.navigateTo({
|
||||
url: `/pagesA/love/${pageName}`
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
background: linear-gradient(
|
||||
-45deg,
|
||||
rgba(247, 149, 51, 0.1),
|
||||
rgba(243, 112, 85, 0.1) 15%,
|
||||
rgba(239, 78, 123, 0.1) 30%,
|
||||
rgba(161, 102, 171, 0.1) 44%,
|
||||
rgba(80, 115, 184, 0.1) 58%,
|
||||
rgba(16, 152, 173, 0.1) 72%,
|
||||
rgba(7, 179, 155, 0.1) 86%,
|
||||
rgba(109, 186, 130, 0.1)
|
||||
);
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
background: linear-gradient(
|
||||
-45deg,
|
||||
rgba(247, 149, 51, 0.1),
|
||||
rgba(243, 112, 85, 0.1) 15%,
|
||||
rgba(239, 78, 123, 0.1) 30%,
|
||||
rgba(161, 102, 171, 0.1) 44%,
|
||||
rgba(80, 115, 184, 0.1) 58%,
|
||||
rgba(16, 152, 173, 0.1) 72%,
|
||||
rgba(7, 179, 155, 0.1) 86%,
|
||||
rgba(109, 186, 130, 0.1)
|
||||
);
|
||||
}
|
||||
|
||||
.lover-wrap {
|
||||
position: relative;
|
||||
width: 100vw;
|
||||
height: 50vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
background-position: 50% 50%;
|
||||
position: relative;
|
||||
width: 100vw;
|
||||
height: 50vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
background-position: 50% 50%;
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
content: '';
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAKUlEQVQImU3IMREAIAgAwJfNkQCEsH8cijjpMf6vnXlQaIiJFx+omEBfmqIEZLe2jzcAAAAASUVORK5CYII=);
|
||||
z-index: 0;
|
||||
backdrop-filter: blur(4rpx);
|
||||
overflow: hidden;
|
||||
}
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: -60rpx;
|
||||
width: 100vw;
|
||||
height: 60rpx;
|
||||
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
|
||||
}
|
||||
.lover-card {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 58%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 90vw;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
border-radius: 12rpx;
|
||||
z-index: 2;
|
||||
.avatar {
|
||||
width: 180rpx;
|
||||
height: 180rpx;
|
||||
border-radius: 50%;
|
||||
box-sizing: border-box;
|
||||
// border: 8rpx solid transparent;
|
||||
// border: 8rpx solid rgba(255, 255, 255, 0.7) !important;
|
||||
border: 8rpx solid rgba(255, 255, 255, 1) !important;
|
||||
}
|
||||
.name {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
text-align: center;
|
||||
letter-spacing: 2rpx;
|
||||
}
|
||||
.boy {
|
||||
color: #3ab8e4;
|
||||
.avatar {
|
||||
border-color: rgba(58, 184, 228, 0.7);
|
||||
}
|
||||
}
|
||||
.girl {
|
||||
color: #f57ab3;
|
||||
.avatar {
|
||||
border-color: rgba(245, 122, 179, 0.7);
|
||||
}
|
||||
}
|
||||
&::before {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
content: '';
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAKUlEQVQImU3IMREAIAgAwJfNkQCEsH8cijjpMf6vnXlQaIiJFx+omEBfmqIEZLe2jzcAAAAASUVORK5CYII=);
|
||||
z-index: 0;
|
||||
backdrop-filter: blur(4rpx);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.like {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
animation: likeani 1s ease-in-out infinite;
|
||||
}
|
||||
}
|
||||
.wave-image {
|
||||
width: 100%;
|
||||
height: 120rpx;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
mix-blend-mode: screen;
|
||||
}
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: -60rpx;
|
||||
width: 100vw;
|
||||
height: 60rpx;
|
||||
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
|
||||
}
|
||||
|
||||
.lover-card {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 58%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 90vw;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
border-radius: 12rpx;
|
||||
z-index: 2;
|
||||
|
||||
.avatar {
|
||||
width: 180rpx;
|
||||
height: 180rpx;
|
||||
border-radius: 50%;
|
||||
box-sizing: border-box;
|
||||
// border: 8rpx solid transparent;
|
||||
// border: 8rpx solid rgba(255, 255, 255, 0.7) !important;
|
||||
border: 8rpx solid rgba(255, 255, 255, 1) !important;
|
||||
}
|
||||
|
||||
.name {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
text-align: center;
|
||||
letter-spacing: 2rpx;
|
||||
}
|
||||
|
||||
.boy {
|
||||
color: #3ab8e4;
|
||||
|
||||
.avatar {
|
||||
border-color: rgba(58, 184, 228, 0.7);
|
||||
}
|
||||
}
|
||||
|
||||
.girl {
|
||||
color: #f57ab3;
|
||||
|
||||
.avatar {
|
||||
border-color: rgba(245, 122, 179, 0.7);
|
||||
}
|
||||
}
|
||||
|
||||
.like {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
animation: likeani 1s ease-in-out infinite;
|
||||
}
|
||||
}
|
||||
|
||||
.wave-image {
|
||||
width: 100%;
|
||||
height: 120rpx;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
mix-blend-mode: screen;
|
||||
}
|
||||
}
|
||||
|
||||
.love-time-wrap {
|
||||
margin-top: 80rpx;
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: 80rpx;
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.title {
|
||||
font-size: 46rpx;
|
||||
letter-spacing: 4rpx;
|
||||
// background-image: linear-gradient(270deg, #ff4500, #ffa500, #ffd700, #90ee90, #00ffff, #1e90ff, #9370db, #ff69b4, #ff4500);
|
||||
// -webkit-background-clip: text;
|
||||
// color: #000;
|
||||
color: #333;
|
||||
font-size: 42rpx;
|
||||
font-weight: bold;
|
||||
// animation: loveTimeTitleAni 80s linear infinite;
|
||||
}
|
||||
.content {
|
||||
margin-top: 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
.title {
|
||||
font-size: 46rpx;
|
||||
letter-spacing: 4rpx;
|
||||
// background-image: linear-gradient(270deg, #ff4500, #ffa500, #ffd700, #90ee90, #00ffff, #1e90ff, #9370db, #ff69b4, #ff4500);
|
||||
// -webkit-background-clip: text;
|
||||
// color: #000;
|
||||
color: #333;
|
||||
font-size: 42rpx;
|
||||
font-weight: bold;
|
||||
// animation: loveTimeTitleAni 80s linear infinite;
|
||||
}
|
||||
|
||||
.text {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.number {
|
||||
margin: 0 8rpx;
|
||||
font-size: 46rpx;
|
||||
// color: #ff69b4;
|
||||
color: #f83856;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
.content {
|
||||
margin-top: 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.text {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.number {
|
||||
margin: 0 8rpx;
|
||||
font-size: 46rpx;
|
||||
// color: #ff69b4;
|
||||
color: #f83856;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.list-wrap {
|
||||
margin-top: 75rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
padding: 0 36rpx;
|
||||
margin-top: 75rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
padding: 0 36rpx;
|
||||
|
||||
.list-item {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
box-sizing: border-box;
|
||||
padding: 28rpx 32rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 50rpx;
|
||||
margin-bottom: 32rpx;
|
||||
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
.list-item {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
box-sizing: border-box;
|
||||
padding: 28rpx 32rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 50rpx;
|
||||
margin-bottom: 32rpx;
|
||||
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
|
||||
&:nth-child(1) {
|
||||
animation: listItemAni1 3s ease-in-out infinite;
|
||||
}
|
||||
&:nth-child(2) {
|
||||
animation: listItemAni1 3s ease-in-out infinite;
|
||||
animation-delay: 1.5s;
|
||||
}
|
||||
&:nth-child(3) {
|
||||
animation: listItemAni1 3s ease-in-out infinite;
|
||||
animation-delay: 2s;
|
||||
}
|
||||
.left {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
.icon {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.right {
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
padding-left: 40rpx;
|
||||
.name {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
.desc {
|
||||
margin-top: 8px;
|
||||
font-size: 26rpx;
|
||||
color: #777777;
|
||||
}
|
||||
}
|
||||
}
|
||||
&:nth-child(1) {
|
||||
animation: listItemAni1 3s ease-in-out infinite;
|
||||
}
|
||||
|
||||
&:nth-child(2) {
|
||||
animation: listItemAni1 3s ease-in-out infinite;
|
||||
animation-delay: 1.5s;
|
||||
}
|
||||
|
||||
&:nth-child(3) {
|
||||
animation: listItemAni1 3s ease-in-out infinite;
|
||||
animation-delay: 2s;
|
||||
}
|
||||
|
||||
.left {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
|
||||
.icon {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
padding-left: 40rpx;
|
||||
|
||||
.name {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.desc {
|
||||
margin-top: 8px;
|
||||
font-size: 26rpx;
|
||||
color: #777777;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes likeani {
|
||||
0% {
|
||||
transform: scale(1);
|
||||
}
|
||||
25% {
|
||||
transform: scale(1.2);
|
||||
}
|
||||
50% {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
75% {
|
||||
transform: scale(1.3);
|
||||
}
|
||||
100% {
|
||||
transform: scale(1);
|
||||
}
|
||||
0% {
|
||||
transform: scale(1);
|
||||
}
|
||||
25% {
|
||||
transform: scale(1.2);
|
||||
}
|
||||
50% {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
75% {
|
||||
transform: scale(1.3);
|
||||
}
|
||||
100% {
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes loveTimeTitleAni {
|
||||
to {
|
||||
background-position: -200rem;
|
||||
}
|
||||
to {
|
||||
background-position: -200rem;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes listItemAni1 {
|
||||
0% {
|
||||
transform: translateY(0rpx);
|
||||
}
|
||||
0% {
|
||||
transform: translateY(0rpx);
|
||||
}
|
||||
|
||||
50% {
|
||||
transform: translateY(-10rpx);
|
||||
}
|
||||
50% {
|
||||
transform: translateY(-10rpx);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translateY(0rpx);
|
||||
}
|
||||
100% {
|
||||
transform: translateY(0rpx);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,357 @@
|
||||
<template>
|
||||
<view class="app-page">
|
||||
<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>
|
||||
</view>
|
||||
<block v-else>
|
||||
<view class="moment-card">
|
||||
<view class="card flex flex-start">
|
||||
<view class="avatar" style="flex-shrink: 0;">
|
||||
<image style="width: 80rpx;height: 80rpx;border-radius: 50%;" :src="moment.spec.user.avatar" />
|
||||
</view>
|
||||
<view class="nickname" style="margin-left: 12rpx;">
|
||||
<view style="font-size: 30rpx;font-weight: bold;color: #333333;">
|
||||
{{ moment.spec.user.displayName }}
|
||||
</view>
|
||||
<view style="margin-top: 6rpx;font-size: 24rpx;color: #666;">
|
||||
{{ {d: moment.spec.releaseTime, f: 'yyyy年MM月dd日 星期w'} | formatTime }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="moment.spec.tags && moment.spec.tags.length!==0" class="card flex flex-wrap flex-start"
|
||||
style="padding-top:12rpx;padding-bottom:12rpx;">
|
||||
<text class="text-size-m">标签列表:</text>
|
||||
<tm-tags v-for="(tag,tagIndex) in moment.spec.tags" :key="tagIndex" :color="randomTagColor()"
|
||||
size="m" model="text">
|
||||
{{ tag }}
|
||||
</tm-tags>
|
||||
</view>
|
||||
|
||||
<view class="card" style="padding:0">
|
||||
<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="moment.spec.newHtml" :markdown="true" :showLineNumber="true" :showLanguageName="true"
|
||||
:copyByLongPress="true" />
|
||||
</view>
|
||||
<view v-if="moment.images && moment.images.length!==0" class="card">
|
||||
<view class="card-head text-size-m">
|
||||
图片附件:
|
||||
</view>
|
||||
<view class="images" :class="['images-'+moment.images.length]">
|
||||
<view class="image-item" v-for="(image,mediumIndex) in moment.images" :key="mediumIndex">
|
||||
<image mode="aspectFill" style="width: 100%;height: 100%;border-radius: 6rpx;"
|
||||
:src="image.url" @click="handlePreview(mediumIndex,moment.images)" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="moment.audios && moment.audios.length!==0" class="card">
|
||||
<view class="card-head text-size-m">
|
||||
音频附件:
|
||||
</view>
|
||||
<view
|
||||
style="display: flex; flex-direction: column; gap: 12rpx 0;padding: 0 24rpx;padding-right:28rpx;">
|
||||
<audio v-for="(audio,index) in moment.audios" :controls="true" :key="index" :id="audio.url"
|
||||
:poster="bloggerInfo.avatar"
|
||||
:name="'来自' + (startConfig.title||bloggerInfo.nickname) + '的声音'"
|
||||
:author="bloggerInfo.nickname" :src="audio.url"></audio>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="moment.videos && moment.videos.length!==0" class="card">
|
||||
<view class="card-head text-size-m">
|
||||
视频附件:
|
||||
</view>
|
||||
<view style="margin-top:24rpx;width:100%;display: flex; flex-direction: column; gap: 12rpx 0;">
|
||||
<video style="width:100%;height: 400rpx;border-radius: 12rpx;"
|
||||
v-for="(video,index) in moment.videos" :key="index" :src="video.url"
|
||||
:id="'video_' + video.id" :show-mute-btn="true" :controls="true"
|
||||
:show-center-play-btn="true" :enable-progress-gesture="true" @play="onVideoPlay(video.id)"
|
||||
@pause="onVideoPause(video.id)" @ended="onVideoEnded(video.id)"></video>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 返回顶部 -->
|
||||
<tm-flotbutton :width="90" :offset="[16, 80]" icon="icon-angle-up" color="bg-gradient-light-blue-accent"
|
||||
@click="fnToTopPage()"></tm-flotbutton>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
||||
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
|
||||
|
||||
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
||||
import {
|
||||
getAppConfigs
|
||||
} from '@/config/index.js'
|
||||
import HaloTokenConfig from "@/config/uhalo.config";
|
||||
import {
|
||||
getRandomNumberByRange
|
||||
} from "@/utils/random.js";
|
||||
import {
|
||||
generateUUID
|
||||
} from '@/utils/uuid.js';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmFlotbutton,
|
||||
tmButton,
|
||||
tmEmpty,
|
||||
mpHtml,
|
||||
tmTags
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
markdownConfig: MarkdownConfig,
|
||||
queryParams: {
|
||||
name: null
|
||||
},
|
||||
moment: null,
|
||||
tagColors: ['orange', 'green', 'red', 'blue'],
|
||||
videoContexts: {},
|
||||
currentVideoId: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
haloConfigs() {
|
||||
return this.$tm.vx.getters().getConfigs;
|
||||
},
|
||||
calcUrl() {
|
||||
return url => {
|
||||
if (this.$utils.checkIsUrl(url)) {
|
||||
return url;
|
||||
}
|
||||
return getApp().globalData.baseApiUrl + url;
|
||||
};
|
||||
},
|
||||
// 获取博主信息
|
||||
bloggerInfo() {
|
||||
const blogger = this.haloConfigs.authorConfig.blogger;
|
||||
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
|
||||
return blogger;
|
||||
},
|
||||
calcUseTagRandomColor() {
|
||||
return this.haloConfigs.pageConfig.momentConfig.useTagRandomColor;
|
||||
},
|
||||
},
|
||||
onLoad(e) {
|
||||
this.fnSetPageTitle('瞬间加载中...');
|
||||
this.queryParams.name = e.name;
|
||||
this.fnGetData();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.videoContexts = {};
|
||||
this.currentVideoId = null;
|
||||
this.fnGetData();
|
||||
},
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
path: '/pagesA/moment-detail/moment-detail?name=' + this.moment.metadata.name,
|
||||
title: this.moment.spec.title,
|
||||
}
|
||||
},
|
||||
onShareTimeline() {
|
||||
return {
|
||||
title: this.moment.spec.title,
|
||||
query: {
|
||||
name: this.moment.metadata.name
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fnGetData() {
|
||||
this.loading = 'loading';
|
||||
this.$httpApi.v2
|
||||
.getMomentByName(this.queryParams.name)
|
||||
.then(res => {
|
||||
console.log('获取详情', res);
|
||||
let _tempResult = res;
|
||||
this.fnSetPageTitle('瞬间详情');
|
||||
|
||||
_tempResult.spec.user = {
|
||||
displayName: this.bloggerInfo.nickname,
|
||||
avatar: this.$utils.checkAvatarUrl(this.bloggerInfo.avatar)
|
||||
}
|
||||
_tempResult.spec.content.medium.map(medium => {
|
||||
medium.url = this.$utils.checkThumbnailUrl(medium.url, true)
|
||||
})
|
||||
|
||||
_tempResult.spec.newHtml = this.removeTagLinksCompletely(_tempResult.spec.content.html, '')
|
||||
_tempResult['images'] = _tempResult.spec.content.medium
|
||||
.filter(x => x.type === 'PHOTO')
|
||||
|
||||
_tempResult['videos'] = _tempResult.spec.content.medium
|
||||
.filter(x => x.type === 'VIDEO').map(_tempResult => {
|
||||
_tempResult.id = generateUUID()
|
||||
return _tempResult;
|
||||
})
|
||||
|
||||
_tempResult['audios'] = _tempResult.spec.content.medium
|
||||
.filter(x => x.type === 'AUDIO')
|
||||
|
||||
this.moment = _tempResult;
|
||||
this.loading = 'success';
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.createVideoContexts(_tempResult.videos);
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
console.log("错误", err)
|
||||
this.loading = 'error';
|
||||
})
|
||||
.finally(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
});
|
||||
},
|
||||
handlePreview(index, list) {
|
||||
uni.previewImage({
|
||||
current: index,
|
||||
urls: list.map(item => item.url)
|
||||
})
|
||||
},
|
||||
removeTagLinksCompletely(htmlString) {
|
||||
const regex = /<a\s+(?:[^>]*?\s+)?class=(['"])[^'"]*?\btag\b[^'"]*?\1[^>]*?>.*?<\/a>/gi;
|
||||
const newHtml = htmlString.replace(regex, '');
|
||||
return newHtml
|
||||
},
|
||||
randomTagColor() {
|
||||
if (!this.calcUseTagRandomColor) return "blue";
|
||||
const randomIndex = getRandomNumberByRange(0, this.tagColors.length);
|
||||
return this.tagColors[randomIndex];
|
||||
},
|
||||
createVideoContexts(videos) {
|
||||
this.stopAllVideos()
|
||||
videos.forEach(item => {
|
||||
this.videoContexts[item.id] = uni.createVideoContext(`video_${item.id}`, this);
|
||||
})
|
||||
},
|
||||
onVideoPlay(videoId) {
|
||||
this.currentVideoId = videoId;
|
||||
this.stopAllVideos(videoId)
|
||||
},
|
||||
onVideoPause(videoId) {
|
||||
if (this.currentVideoId == videoId) {
|
||||
this.currentVideoId = null;
|
||||
}
|
||||
},
|
||||
onVideoEnded(videoId) {
|
||||
this.currentVideoId = null;
|
||||
},
|
||||
stopAllVideos(excludesVideoId = null) {
|
||||
Object.keys(this.videoContexts).forEach(videoId => {
|
||||
if (!excludesVideoId || excludesVideoId != videoId) {
|
||||
const videoContext = this.videoContexts[videoId]
|
||||
videoContext?.pause();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
background-color: #fafafd;
|
||||
padding-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.loading-wrap {
|
||||
padding: 0 24rpx;
|
||||
height: inherit;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.moment-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
gap: 24rpx;
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
border-radius: 12rpx;
|
||||
background-color: #ffff;
|
||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
overflow: hidden;
|
||||
padding: 24rpx;
|
||||
|
||||
&-head {
|
||||
position: relative;
|
||||
// padding-left: 24rpx;
|
||||
margin-bottom: 6rpx;
|
||||
|
||||
&:before {
|
||||
display: none;
|
||||
box-sizing: border-box;
|
||||
content: "";
|
||||
width: 6rpx;
|
||||
height: 24rpx;
|
||||
border-radius: 24rpx;
|
||||
background: #2196F3;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 6rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.images {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
padding: 24rpx;
|
||||
|
||||
.image-item {
|
||||
box-sizing: border-box;
|
||||
border-radius: 24rpx;
|
||||
padding: 6rpx;
|
||||
width: 33%;
|
||||
height: 200rpx
|
||||
}
|
||||
|
||||
&-1 {
|
||||
>.image-item {
|
||||
width: 100%;
|
||||
height: 350rpx
|
||||
}
|
||||
}
|
||||
|
||||
&-2 {
|
||||
>.image-item {
|
||||
width: 50%;
|
||||
height: 250rpx
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
::v-deep .uni-audio-default {
|
||||
width: 100%;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
</style>
|
||||
+270
-259
@@ -14,43 +14,16 @@
|
||||
<text class="text-grey text-size-xs px-10 ml-12">应用以及文章列表布局设置</text>
|
||||
</view>
|
||||
<view class="sheet-content">
|
||||
<tm-pickers
|
||||
title="请选择首页布局"
|
||||
btn-color="light-blue"
|
||||
:default-value.sync="homeLayout.selectDefault"
|
||||
rang-key="name"
|
||||
:list="homeLayout.list"
|
||||
@confirm="fnOnHomeLayoutConfirm"
|
||||
>
|
||||
<tm-input
|
||||
name="status"
|
||||
required
|
||||
title="首页文章布局"
|
||||
placeholder="请选择首页文章布局"
|
||||
disabled
|
||||
align="right"
|
||||
:value="homeLayout.selectLabel"
|
||||
right-icon="icon-angle-right"
|
||||
></tm-input>
|
||||
<tm-pickers title="请选择首页布局" btn-color="light-blue" :default-value.sync="homeLayout.selectDefault"
|
||||
rang-key="name" :list="homeLayout.list" @confirm="fnOnHomeLayoutConfirm">
|
||||
<tm-input name="status" required title="首页文章布局" placeholder="请选择首页文章布局" disabled align="right"
|
||||
:value="homeLayout.selectLabel" right-icon="icon-angle-right"></tm-input>
|
||||
</tm-pickers>
|
||||
<tm-pickers
|
||||
title="请选择文章卡片样式"
|
||||
btn-color="light-blue"
|
||||
:default-value.sync="articleCardStyle.selectDefault"
|
||||
rang-key="name"
|
||||
:list="articleCardStyle.list"
|
||||
@confirm="fnOnArticleCardStyleConfirm"
|
||||
>
|
||||
<tm-input
|
||||
name="status"
|
||||
required
|
||||
title="文章卡片样式"
|
||||
placeholder="请选择文章卡片样式"
|
||||
disabled
|
||||
align="right"
|
||||
:value="articleCardStyle.selectLabel"
|
||||
right-icon="icon-angle-right"
|
||||
></tm-input>
|
||||
<tm-pickers title="请选择文章卡片样式" btn-color="light-blue"
|
||||
:default-value.sync="articleCardStyle.selectDefault" rang-key="name"
|
||||
:list="articleCardStyle.list" @confirm="fnOnArticleCardStyleConfirm">
|
||||
<tm-input name="status" required title="文章卡片样式" placeholder="请选择文章卡片样式" disabled align="right"
|
||||
:value="articleCardStyle.selectLabel" right-icon="icon-angle-right"></tm-input>
|
||||
</tm-pickers>
|
||||
</view>
|
||||
</tm-sheet>
|
||||
@@ -73,14 +46,16 @@
|
||||
</view>
|
||||
<view class="sheet-content">
|
||||
<view class="mx-32 my-24 border-b-1 pb-24 flex-between">
|
||||
<text class="text-size-m ">图库瀑布流模式</text>
|
||||
<tm-switch v-model="appSettings.gallery.useWaterfull" color="light-blue" :text="['是', '否']"></tm-switch>
|
||||
<text class="text-size-m">图库瀑布流模式</text>
|
||||
<tm-switch v-model="appSettings.gallery.useWaterfull" color="light-blue"
|
||||
:text="['是', '否']"></tm-switch>
|
||||
</view>
|
||||
<view class="mx-32 my-24 border-b-1 pb-24 flex-between">
|
||||
<text class="text-size-m ">友链简洁模式</text>
|
||||
<tm-switch v-model="appSettings.links.useSimple" color="light-blue" :text="['是', '否']"></tm-switch>
|
||||
<text class="text-size-m">友链简洁模式</text>
|
||||
<tm-switch v-model="appSettings.links.useSimple" color="light-blue"
|
||||
:text="['是', '否']"></tm-switch>
|
||||
</view>
|
||||
<view class="mx-32 mt-24 mb-0 border-b-1 pb-24 flex-between">
|
||||
<!-- <view class="mx-32 mt-24 mb-0 border-b-1 pb-24 flex-between">
|
||||
<text class="text-size-m">启用评论弹幕</text>
|
||||
<tm-switch v-model="appSettings.barrage.use" color="light-blue" :text="['是', '否']"></tm-switch>
|
||||
</view>
|
||||
@@ -102,31 +77,27 @@
|
||||
:value="barrage.selectLabel"
|
||||
right-icon="icon-angle-right"
|
||||
></tm-input>
|
||||
</tm-pickers>
|
||||
</tm-pickers> -->
|
||||
<view class="mx-32 my-24 border-b-1 pb-24 flex-between">
|
||||
<text class="text-size-m">是否圆形头像</text>
|
||||
<tm-switch v-model="appSettings.isAvatarRadius" color="light-blue" :text="['是', '否']"></tm-switch>
|
||||
<tm-switch v-model="appSettings.isAvatarRadius" color="light-blue"
|
||||
:text="['是', '否']"></tm-switch>
|
||||
</view>
|
||||
<view class="mx-32 my-24 border-b-1 pb-24 flex-between">
|
||||
<text class="text-size-m ">轮播图指示器</text>
|
||||
<tm-switch v-model="appSettings.banner.useDot" color="light-blue" :text="['是', '否']"></tm-switch>
|
||||
<tm-switch v-model="appSettings.banner.useDot" color="light-blue"
|
||||
:text="['是', '否']"></tm-switch>
|
||||
</view>
|
||||
<view v-if="appSettings.banner.useDot" class="mx-32 my-24 border-b-1 pb-24 flex-between">
|
||||
<text class="text-size-m ">轮播图指示器位置</text>
|
||||
<tm-groupradio name="dotPosition" @change="fnOnBannerDotChange">
|
||||
<tm-radio
|
||||
:name="item.name"
|
||||
:size="28"
|
||||
color="light-blue"
|
||||
v-for="(item, index) in dotPositionList"
|
||||
:key="index"
|
||||
v-model="item.checked"
|
||||
:label="item.name"
|
||||
></tm-radio>
|
||||
<tm-radio :name="item.name" :size="28" color="light-blue"
|
||||
v-for="(item, index) in dotPositionList" :key="index" v-model="item.checked"
|
||||
:label="item.name"></tm-radio>
|
||||
</tm-groupradio>
|
||||
</view>
|
||||
|
||||
<view class="mx-32 my-24 border-b-1 pb-24 flex-between">
|
||||
<!-- <view class="mx-32 my-24 border-b-1 pb-24 flex-between">
|
||||
<text class="text-size-m">显示完整统计</text>
|
||||
<tm-switch v-model="appSettings.about.showAllCount" color="light-blue" :text="['是', '否']"></tm-switch>
|
||||
</view>
|
||||
@@ -134,10 +105,10 @@
|
||||
<text class="text-size-m ">链接直接打开</text>
|
||||
<tm-switch v-model="appSettings.contact.isLinkCopy" color="light-blue" :text="['是', '否']"></tm-switch>
|
||||
</view>
|
||||
<view class="mx-32 my-24 border-b-1 pb-24 flex-between">
|
||||
<view v-if="false" class="mx-32 my-24 border-b-1 pb-24 flex-between">
|
||||
<text class="text-size-m ">显示后台入口</text>
|
||||
<tm-switch v-model="appSettings.about.showAdmin" color="light-blue" :text="['是', '否']"></tm-switch>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</tm-sheet>
|
||||
</tm-form>
|
||||
@@ -152,221 +123,261 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { _DefaultAppSettings } from '@/utils/app.js';
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
import tmForm from '@/tm-vuetify/components/tm-form/tm-form.vue';
|
||||
import tmPickers from '@/tm-vuetify/components/tm-pickers/tm-pickers.vue';
|
||||
import tmInput from '@/tm-vuetify/components/tm-input/tm-input.vue';
|
||||
import tmSwitch from '@/tm-vuetify/components/tm-switch/tm-switch.vue';
|
||||
import tmSheet from '@/tm-vuetify/components/tm-sheet/tm-sheet.vue';
|
||||
import tmGroupradio from '@/tm-vuetify/components/tm-groupradio/tm-groupradio.vue';
|
||||
import tmRadio from '@/tm-vuetify/components/tm-radio/tm-radio.vue';
|
||||
import {
|
||||
_DefaultAppSettings
|
||||
} from '@/utils/app.js';
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
import tmForm from '@/tm-vuetify/components/tm-form/tm-form.vue';
|
||||
import tmPickers from '@/tm-vuetify/components/tm-pickers/tm-pickers.vue';
|
||||
import tmInput from '@/tm-vuetify/components/tm-input/tm-input.vue';
|
||||
import tmSwitch from '@/tm-vuetify/components/tm-switch/tm-switch.vue';
|
||||
import tmSheet from '@/tm-vuetify/components/tm-sheet/tm-sheet.vue';
|
||||
import tmGroupradio from '@/tm-vuetify/components/tm-groupradio/tm-groupradio.vue';
|
||||
import tmRadio from '@/tm-vuetify/components/tm-radio/tm-radio.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
tmButton,
|
||||
tmForm,
|
||||
tmPickers,
|
||||
tmInput,
|
||||
tmSwitch,
|
||||
tmSheet,
|
||||
tmGroupradio,
|
||||
tmRadio
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isBlackTheme: false,
|
||||
loading: true,
|
||||
appSettings: {},
|
||||
isSaved: true,
|
||||
firstLoad: true,
|
||||
homeLayout: {
|
||||
list: [{ name: '一行一列', value: 'h_row_col1' }, { name: '一行两列', value: 'h_row_col2' }],
|
||||
selectDefault: ['一行一列'],
|
||||
selectLabel: '一行一列',
|
||||
selectValue: 'h_row_col1'
|
||||
},
|
||||
articleCardStyle: {
|
||||
list: [
|
||||
{ name: '左图右文', value: 'lr_image_text' },
|
||||
{ name: '左文右图', value: 'lr_text_image' },
|
||||
{ name: '上图下文', value: 'tb_image_text' },
|
||||
{ name: '上文下图', value: 'tb_text_image' },
|
||||
{ name: '只有文字', value: 'only_text' }
|
||||
],
|
||||
selectDefault: ['左图右文'],
|
||||
selectLabel: '左图右文',
|
||||
selectValue: 'lr_image_text'
|
||||
},
|
||||
dotPositionList: [{ name: '右边', value: 'right', checked: true }, { name: '下边', value: 'bottom', checked: false }],
|
||||
barrage: {
|
||||
list: [{ name: '顶部', value: 'rightToLeft' }, { name: '左下', value: 'leftBottom' }],
|
||||
selectDefault: ['顶部'],
|
||||
selectLabel: '顶部',
|
||||
selectValue: 'rightToLeft'
|
||||
}
|
||||
};
|
||||
},
|
||||
export default {
|
||||
components: {
|
||||
tmButton,
|
||||
tmForm,
|
||||
tmPickers,
|
||||
tmInput,
|
||||
tmSwitch,
|
||||
tmSheet,
|
||||
tmGroupradio,
|
||||
tmRadio
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isBlackTheme: false,
|
||||
loading: true,
|
||||
appSettings: {},
|
||||
isSaved: true,
|
||||
firstLoad: true,
|
||||
homeLayout: {
|
||||
list: [{
|
||||
name: '一行一列',
|
||||
value: 'h_row_col1'
|
||||
}, {
|
||||
name: '一行两列',
|
||||
value: 'h_row_col2'
|
||||
}],
|
||||
selectDefault: ['一行一列'],
|
||||
selectLabel: '一行一列',
|
||||
selectValue: 'h_row_col1'
|
||||
},
|
||||
articleCardStyle: {
|
||||
list: [{
|
||||
name: '左图右文',
|
||||
value: 'lr_image_text'
|
||||
},
|
||||
{
|
||||
name: '左文右图',
|
||||
value: 'lr_text_image'
|
||||
},
|
||||
{
|
||||
name: '上图下文',
|
||||
value: 'tb_image_text'
|
||||
},
|
||||
{
|
||||
name: '上文下图',
|
||||
value: 'tb_text_image'
|
||||
},
|
||||
{
|
||||
name: '只有文字',
|
||||
value: 'only_text'
|
||||
}
|
||||
],
|
||||
selectDefault: ['左图右文'],
|
||||
selectLabel: '左图右文',
|
||||
selectValue: 'lr_image_text'
|
||||
},
|
||||
dotPositionList: [{
|
||||
name: '右边',
|
||||
value: 'right',
|
||||
checked: true
|
||||
}, {
|
||||
name: '下边',
|
||||
value: 'bottom',
|
||||
checked: false
|
||||
}],
|
||||
barrage: {
|
||||
list: [{
|
||||
name: '顶部',
|
||||
value: 'rightToLeft'
|
||||
}, {
|
||||
name: '左下',
|
||||
value: 'leftBottom'
|
||||
}],
|
||||
selectDefault: ['顶部'],
|
||||
selectLabel: '顶部',
|
||||
selectValue: 'rightToLeft'
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
appSettings: {
|
||||
deep: true,
|
||||
handler() {
|
||||
if (this.firstLoad) {
|
||||
this.firstLoad = false;
|
||||
} else {
|
||||
this.isSaved = false;
|
||||
watch: {
|
||||
appSettings: {
|
||||
deep: true,
|
||||
handler() {
|
||||
if (this.firstLoad) {
|
||||
this.firstLoad = false;
|
||||
} else {
|
||||
this.isSaved = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
onLoad(e) {
|
||||
this.fnSetPageTitle('应用设置');
|
||||
},
|
||||
created() {
|
||||
this.appSettings = Object.assign({}, _DefaultAppSettings, uni.$tm.vx.getters().getSettings);
|
||||
this.fnHandleFormatSelect();
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.loading = false;
|
||||
uni.hideLoading();
|
||||
}, 500);
|
||||
},
|
||||
onLoad(e) {
|
||||
this.fnSetPageTitle('应用设置');
|
||||
},
|
||||
created() {
|
||||
this.appSettings = Object.assign({}, _DefaultAppSettings, uni.$tm.vx.getters().getSettings);
|
||||
this.fnHandleFormatSelect();
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.loading = false;
|
||||
uni.hideLoading();
|
||||
}, 500);
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 统一处理选择框的内容
|
||||
fnHandleFormatSelect() {
|
||||
methods: {
|
||||
// 统一处理选择框的内容
|
||||
fnHandleFormatSelect() {
|
||||
// 首页布局
|
||||
const _homeLayout = this.fnFindObjInList(this.homeLayout.list, 'value', this.appSettings.layout.home);
|
||||
this.homeLayout.selectDefault = [_homeLayout.name];
|
||||
this.homeLayout.selectLabel = _homeLayout.name;
|
||||
this.homeLayout.selectValue = _homeLayout.value;
|
||||
|
||||
const _articleCardStyle = this.fnFindObjInList(this.articleCardStyle.list, 'value', this.appSettings.layout
|
||||
.cardType);
|
||||
this.articleCardStyle.selectDefault = [_articleCardStyle.name];
|
||||
this.articleCardStyle.selectLabel = _articleCardStyle.name;
|
||||
this.articleCardStyle.selectValue = _articleCardStyle.value;
|
||||
|
||||
const _barrage = this.fnFindObjInList(this.barrage.list, 'value', this.appSettings.barrage.type);
|
||||
this.barrage.selectDefault = [_barrage.name];
|
||||
this.barrage.selectLabel = _barrage.name;
|
||||
this.barrage.selectValue = _barrage.value;
|
||||
},
|
||||
// 在集合中找匹配的对象
|
||||
fnFindObjInList(list, key, value) {
|
||||
return list.find(x => x[key] == value);
|
||||
},
|
||||
fnOnBannerDotChange(e) {
|
||||
const _select = e[0];
|
||||
if (_select.index == 0 && _select.checked) {
|
||||
this.appSettings.banner.dotPosition = 'right';
|
||||
}
|
||||
if (_select.index == 1 && _select.checked) {
|
||||
this.appSettings.banner.dotPosition = 'bottom';
|
||||
}
|
||||
},
|
||||
// 首页布局
|
||||
const _homeLayout = this.fnFindObjInList(this.homeLayout.list, 'value', this.appSettings.layout.home);
|
||||
this.homeLayout.selectDefault = [_homeLayout.name];
|
||||
this.homeLayout.selectLabel = _homeLayout.name;
|
||||
this.homeLayout.selectValue = _homeLayout.value;
|
||||
|
||||
const _articleCardStyle = this.fnFindObjInList(this.articleCardStyle.list, 'value', this.appSettings.layout.cardType);
|
||||
this.articleCardStyle.selectDefault = [_articleCardStyle.name];
|
||||
this.articleCardStyle.selectLabel = _articleCardStyle.name;
|
||||
this.articleCardStyle.selectValue = _articleCardStyle.value;
|
||||
|
||||
const _barrage = this.fnFindObjInList(this.barrage.list, 'value', this.appSettings.barrage.type);
|
||||
this.barrage.selectDefault = [_barrage.name];
|
||||
this.barrage.selectLabel = _barrage.name;
|
||||
this.barrage.selectValue = _barrage.value;
|
||||
},
|
||||
// 在集合中找匹配的对象
|
||||
fnFindObjInList(list, key, value) {
|
||||
return list.find(x => x[key] == value);
|
||||
},
|
||||
fnOnBannerDotChange(e) {
|
||||
const _select = e[0];
|
||||
if (_select.index == 0 && _select.checked) {
|
||||
this.appSettings.banner.dotPosition = 'right';
|
||||
}
|
||||
if (_select.index == 1 && _select.checked) {
|
||||
this.appSettings.banner.dotPosition = 'bottom';
|
||||
}
|
||||
},
|
||||
// 首页布局
|
||||
fnOnHomeLayoutConfirm(e) {
|
||||
const _select = e[0].data;
|
||||
this.homeLayout.selectDefault = [_select.name];
|
||||
this.homeLayout.selectLabel = _select.name;
|
||||
this.homeLayout.selectValue = _select.value;
|
||||
this.appSettings.layout.home = _select.value;
|
||||
},
|
||||
// 文章卡片样式
|
||||
fnOnArticleCardStyleConfirm(e) {
|
||||
const _select = e[0].data;
|
||||
this.articleCardStyle.selectDefault = [_select.name];
|
||||
this.articleCardStyle.selectLabel = _select.name;
|
||||
this.articleCardStyle.selectValue = _select.value;
|
||||
this.appSettings.layout.cardType = _select.value;
|
||||
},
|
||||
// 弹幕设置
|
||||
fnOnBarrageConfirm(e) {
|
||||
const _select = e[0].data;
|
||||
this.barrage.selectDefault = [_select.name];
|
||||
this.barrage.selectLabel = _select.name;
|
||||
this.barrage.selectValue = _select.value;
|
||||
this.appSettings.barrage.type = _select.value;
|
||||
},
|
||||
// 保存
|
||||
fnOnSave() {
|
||||
this.isSaved = true;
|
||||
this.$tm.vx.commit('setting/setSettings', this.appSettings);
|
||||
uni.$tm.toast('保存成功,部分设置在重启后生效!');
|
||||
},
|
||||
// 使用默认配置
|
||||
fnOnSaveDefault() {
|
||||
uni.$eShowModal({
|
||||
title: '提示',
|
||||
content: '您确定要恢复为默认的设置吗?',
|
||||
showCancel: true,
|
||||
cancelText: '否',
|
||||
cancelColor: '#999999',
|
||||
confirmText: '是',
|
||||
confirmColor: '#03a9f4'
|
||||
})
|
||||
.then(res => {
|
||||
this.isSaved = true;
|
||||
uni.$tm.vx.actions('setting/updateDefaultAppSettings');
|
||||
uni.$tm.toast('系统设置已恢复为默认配置,部分设置在重启后生效!');
|
||||
})
|
||||
.catch(err => {});
|
||||
},
|
||||
fnOnBack() {
|
||||
if (this.isSaved) {
|
||||
uni.navigateBack();
|
||||
return;
|
||||
}
|
||||
uni.$eShowModal({
|
||||
title: '提示',
|
||||
content: '您当前可能有未保存的数据,确定返回吗?',
|
||||
showCancel: true,
|
||||
cancelText: '否',
|
||||
cancelColor: '#999999',
|
||||
confirmText: '是',
|
||||
confirmColor: '#03a9f4'
|
||||
})
|
||||
.then(res => {
|
||||
fnOnHomeLayoutConfirm(e) {
|
||||
const _select = e[0].data;
|
||||
this.homeLayout.selectDefault = [_select.name];
|
||||
this.homeLayout.selectLabel = _select.name;
|
||||
this.homeLayout.selectValue = _select.value;
|
||||
this.appSettings.layout.home = _select.value;
|
||||
},
|
||||
// 文章卡片样式
|
||||
fnOnArticleCardStyleConfirm(e) {
|
||||
const _select = e[0].data;
|
||||
this.articleCardStyle.selectDefault = [_select.name];
|
||||
this.articleCardStyle.selectLabel = _select.name;
|
||||
this.articleCardStyle.selectValue = _select.value;
|
||||
this.appSettings.layout.cardType = _select.value;
|
||||
},
|
||||
// 弹幕设置
|
||||
fnOnBarrageConfirm(e) {
|
||||
const _select = e[0].data;
|
||||
this.barrage.selectDefault = [_select.name];
|
||||
this.barrage.selectLabel = _select.name;
|
||||
this.barrage.selectValue = _select.value;
|
||||
this.appSettings.barrage.type = _select.value;
|
||||
},
|
||||
// 保存
|
||||
fnOnSave() {
|
||||
this.isSaved = true;
|
||||
this.$tm.vx.commit('setting/setSettings', this.appSettings);
|
||||
uni.$tm.toast('保存成功,部分设置在重启后生效!');
|
||||
},
|
||||
// 使用默认配置
|
||||
fnOnSaveDefault() {
|
||||
uni.$eShowModal({
|
||||
title: '提示',
|
||||
content: '您确定要恢复为默认的设置吗?',
|
||||
showCancel: true,
|
||||
cancelText: '否',
|
||||
cancelColor: '#999999',
|
||||
confirmText: '是',
|
||||
confirmColor: '#03a9f4'
|
||||
})
|
||||
.then(res => {
|
||||
this.isSaved = true;
|
||||
uni.$tm.vx.actions('setting/updateDefaultAppSettings');
|
||||
uni.$tm.toast('系统设置已恢复为默认配置,部分设置在重启后生效!');
|
||||
})
|
||||
.catch(err => {});
|
||||
},
|
||||
fnOnBack() {
|
||||
if (this.isSaved) {
|
||||
uni.navigateBack();
|
||||
this.isSaved = true;
|
||||
})
|
||||
.catch(err => {});
|
||||
return;
|
||||
}
|
||||
uni.$eShowModal({
|
||||
title: '提示',
|
||||
content: '您当前可能有未保存的数据,确定返回吗?',
|
||||
showCancel: true,
|
||||
cancelText: '否',
|
||||
cancelColor: '#999999',
|
||||
confirmText: '是',
|
||||
confirmColor: '#03a9f4'
|
||||
})
|
||||
.then(res => {
|
||||
uni.navigateBack();
|
||||
this.isSaved = true;
|
||||
})
|
||||
.catch(err => {});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.app-page {
|
||||
box-sizing: border-box;
|
||||
padding-bottom: 120rpx;
|
||||
.btn-bar {
|
||||
width: 100vw;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
.app-page {
|
||||
box-sizing: border-box;
|
||||
padding: 24rpx;
|
||||
gap: 0 24rpx;
|
||||
box-shadow: 0rpx -6rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
padding-bottom: 120rpx;
|
||||
|
||||
.btn-bar {
|
||||
width: 100vw;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
box-sizing: border-box;
|
||||
padding: 24rpx;
|
||||
gap: 0 24rpx;
|
||||
box-shadow: 0rpx -6rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||
}
|
||||
}
|
||||
}
|
||||
.required {
|
||||
position: relative;
|
||||
padding-left: 18rpx;
|
||||
&:before {
|
||||
content: '*';
|
||||
position: absolute;
|
||||
left: -4rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
font-size: 34rpx;
|
||||
color: rgba(244, 67, 54, 1);
|
||||
|
||||
.required {
|
||||
position: relative;
|
||||
padding-left: 18rpx;
|
||||
|
||||
&:before {
|
||||
content: '*';
|
||||
position: absolute;
|
||||
left: -4rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
font-size: 34rpx;
|
||||
color: rgba(244, 67, 54, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
+449
-318
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="app-page bg-gradient-blue-lighten-b" :style="pageStyle">
|
||||
<view class="tn-satr">
|
||||
<view class="app-page bg-gradient-blue-lighten-b" :class="calcPageClass" :style="[calcPageStyle]">
|
||||
<view v-if="calcBackgroundType!=='video'" class="tn-satr">
|
||||
<view class="sky"></view>
|
||||
<view class="stars">
|
||||
<view class="falling-stars">
|
||||
@@ -40,361 +40,492 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="user-info__container flex flex-col flex-center">
|
||||
<image class="user-info__avatar" :src="startInfo.logo" mode="aspectFill"></image>
|
||||
<view class="user-info__nick-name">「 {{ startInfo.title }} 」</view>
|
||||
</view>
|
||||
<video v-else class="video-bg" :object-fit="startConfig.bgVideoFit" :src="$utils.checkUrl(startConfig.bgVideo)" :loop="true"
|
||||
:autoplay="true" :muted="true" :controls="false" :show-fullscreen-btn="false" :show-play-btn="false"
|
||||
:show-center-play-btn="false" :show-loading="false" :enable-progress-gesture="false"
|
||||
:show-progress="false"></video>
|
||||
|
||||
<view class="text-align-center text-white" style="padding: 60vh 0 0 0;">
|
||||
<view class="" style="font-size: 44rpx;" v-if="startInfo.desc1">{{ startInfo.desc1 }}</view>
|
||||
<view class="mt-30 text-size-m" v-if="startInfo.desc2">{{ startInfo.desc2 }}</view>
|
||||
</view>
|
||||
<cover-view v-if="startConfig.title || startConfig.logo" class="title-container">
|
||||
|
||||
<view class="" style="padding: 120rpx 200rpx;z-index: 999;position: relative;">
|
||||
<view class="start-btn" @click="fnStart()">{{ startInfo.btnText || '开始体验' }}</view>
|
||||
</view>
|
||||
<cover-view v-if="startConfig.logo" class="app-logo">
|
||||
<cover-view class="app-logo-border">
|
||||
<cover-image class="app-logo-image" :src="$utils.checkImageUrl(startConfig.logo)"
|
||||
mode="aspectFill"></cover-image>
|
||||
</cover-view>
|
||||
</cover-view>
|
||||
|
||||
<cover-view v-if="startConfig.title" class="app-title" :style="startConfig.titleStyle">
|
||||
「 {{ startConfig.title }} 」
|
||||
</cover-view>
|
||||
</cover-view>
|
||||
|
||||
<cover-view class="bottom-container">
|
||||
<cover-view class="text-align-center" :style="startConfig.descStyle"
|
||||
style="color:white;padding: 60vh 0 0 0;">
|
||||
<cover-view style="font-size: 44rpx;" v-show="startConfig.desc1">
|
||||
{{ startConfig.desc1 }}
|
||||
</cover-view>
|
||||
<cover-view class="mt-30 text-size-m" v-show="startConfig.desc2">
|
||||
{{ startConfig.desc2 }}
|
||||
</cover-view>
|
||||
</cover-view>
|
||||
<!-- #ifdef APP-PLUS -->
|
||||
<cover-view class="start-btn-app" :style="[startConfig.btnStyle]" @click="fnStart()">
|
||||
{{ startConfig.btnText || '开始体验' }}
|
||||
</cover-view>
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef APP-PLUS -->
|
||||
<cover-view class="start-btn" :class="[startConfig.btnClass]" @click="fnStart()"
|
||||
:style="[startConfig.btnStyle]">{{ startConfig.btnText || '开始体验' }}
|
||||
</cover-view>
|
||||
<!-- #endif -->
|
||||
</cover-view>
|
||||
<!-- 波浪效果 -->
|
||||
<wave></wave>
|
||||
<wave v-if="startConfig.useWave"></wave>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wave from '@/components/wave/wave.vue';
|
||||
export default {
|
||||
components: { wave },
|
||||
computed: {
|
||||
startInfo() {
|
||||
return getApp().globalData.start;
|
||||
import wave from '@/components/wave/wave.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
wave
|
||||
},
|
||||
pageStyle() {
|
||||
if (this.startInfo.bg) {
|
||||
const _bg = this.$utils.checkIsUrl(this.startInfo.bg) ? `url(${this.startInfo.bg})` : this.startInfo.bg;
|
||||
return {
|
||||
background: _bg + '!important'
|
||||
};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fnStart() {
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/home',
|
||||
success: () => {
|
||||
uni.setStorageSync('APP_HAS_STARTED', true);
|
||||
computed: {
|
||||
startConfig() {
|
||||
return this.$tm.vx.getters().getConfigs.appConfig.startConfig;
|
||||
},
|
||||
calcBackgroundType() {
|
||||
return this.startConfig.backgroundType;
|
||||
},
|
||||
calcPageClass() {
|
||||
if (this.calcBackgroundType === 'color') {
|
||||
return [this.startConfig.bg]
|
||||
}
|
||||
});
|
||||
return []
|
||||
},
|
||||
calcPageStyle() {
|
||||
if (this.calcBackgroundType === 'color') {
|
||||
return {}
|
||||
}
|
||||
if (this.calcBackgroundType === 'image') {
|
||||
return {
|
||||
backgroundImage: `url(${this.$utils.checkImageUrl(this.startConfig.bgImage)})!important`,
|
||||
backgroundSize: this.startConfig.bgImageFit
|
||||
}
|
||||
}
|
||||
if (this.calcBackgroundType === 'video') {
|
||||
return {
|
||||
background: '#ffffff'
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fnStart() {
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/home',
|
||||
success: () => {
|
||||
uni.setStorageSync('APP_HAS_STARTED', true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
}
|
||||
.start-btn {
|
||||
box-sizing: border-box;
|
||||
background-color: transparent;
|
||||
padding: 16rpx 50rpx;
|
||||
border-radius: 50rpx;
|
||||
border: 2rpx solid #ffffff;
|
||||
color: #ffffff;
|
||||
text-align: center;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
/* 用户信息 start */
|
||||
.user-info {
|
||||
&__container {
|
||||
position: absolute;
|
||||
top: 25vh;
|
||||
left: 50%;
|
||||
-webkit-transform: translate(-50%, -50%);
|
||||
transform: translate(-50%, -50%);
|
||||
.app-page {
|
||||
position: relative;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
&__avatar {
|
||||
.start-btn {
|
||||
box-sizing: border-box;
|
||||
background-color: transparent;
|
||||
padding: 16rpx 50rpx;
|
||||
border-radius: 50rpx;
|
||||
border: 2rpx solid #ffffff;
|
||||
color: #ffffff;
|
||||
text-align: center;
|
||||
font-size: 28rpx;
|
||||
margin-top: 60rpx;
|
||||
margin-bottom: 120rpx;
|
||||
}
|
||||
|
||||
.start-btn-app {
|
||||
border-radius: 50rpx;
|
||||
color: #ffffff;
|
||||
text-align: center;
|
||||
font-size: 28rpx;
|
||||
margin: 60rpx auto 120rpx auto;
|
||||
width: 40vw;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
border: 2rpx solid #ffffff;
|
||||
}
|
||||
|
||||
.bottom-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: absolute;
|
||||
bottom: 50rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.video-bg {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.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 {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
border: 8rpx solid rgba(255, 255, 255, 0.05);
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
box-shadow: 0rpx 0rpx 80rpx 0rpx rgba(0, 0, 0, 0.15);
|
||||
|
||||
&-border {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
border: 8rpx solid rgba(255, 255, 255, 0.35);
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
&-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
&__nick-name {
|
||||
.app-title {
|
||||
color: #ffffff;
|
||||
margin-top: 26rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
/* 用户信息 end */
|
||||
|
||||
/* 流星*/
|
||||
.tn-satr {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 600px;
|
||||
overflow: hidden;
|
||||
flex-shrink: 0;
|
||||
z-index: 998;
|
||||
}
|
||||
|
||||
.stars {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
width: 100%;
|
||||
height: 400px;
|
||||
}
|
||||
.tn-satr {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 600px;
|
||||
overflow: hidden;
|
||||
flex-shrink: 0;
|
||||
z-index: 998;
|
||||
}
|
||||
|
||||
.star {
|
||||
border-radius: 50%;
|
||||
background: #ffffff;
|
||||
box-shadow: 0px 0px 6px 0px rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
.stars {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
width: 100%;
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
.small-stars .star {
|
||||
position: absolute;
|
||||
width: 3px;
|
||||
height: 3px;
|
||||
}
|
||||
.small-stars .star:nth-child(2n) {
|
||||
opacity: 0;
|
||||
-webkit-animation: star-blink 1.2s linear infinite alternate;
|
||||
animation: star-blink 1.2s linear infinite alternate;
|
||||
}
|
||||
.small-stars .star:nth-child(1) {
|
||||
left: 40px;
|
||||
bottom: 50px;
|
||||
}
|
||||
.small-stars .star:nth-child(2) {
|
||||
left: 200px;
|
||||
bottom: 40px;
|
||||
}
|
||||
.small-stars .star:nth-child(3) {
|
||||
left: 60px;
|
||||
bottom: 120px;
|
||||
}
|
||||
.small-stars .star:nth-child(4) {
|
||||
left: 140px;
|
||||
bottom: 250px;
|
||||
}
|
||||
.small-stars .star:nth-child(5) {
|
||||
left: 400px;
|
||||
bottom: 300px;
|
||||
}
|
||||
.small-stars .star:nth-child(6) {
|
||||
left: 170px;
|
||||
bottom: 80px;
|
||||
}
|
||||
.small-stars .star:nth-child(7) {
|
||||
left: 200px;
|
||||
bottom: 360px;
|
||||
-webkit-animation-delay: 0.2s;
|
||||
animation-delay: 0.2s;
|
||||
}
|
||||
.small-stars .star:nth-child(8) {
|
||||
left: 250px;
|
||||
bottom: 320px;
|
||||
}
|
||||
.small-stars .star:nth-child(9) {
|
||||
left: 300px;
|
||||
bottom: 340px;
|
||||
}
|
||||
.small-stars .star:nth-child(10) {
|
||||
left: 130px;
|
||||
bottom: 320px;
|
||||
-webkit-animation-delay: 0.5s;
|
||||
animation-delay: 0.5s;
|
||||
}
|
||||
.small-stars .star:nth-child(11) {
|
||||
left: 230px;
|
||||
bottom: 330px;
|
||||
-webkit-animation-delay: 7s;
|
||||
animation-delay: 7s;
|
||||
}
|
||||
.small-stars .star:nth-child(12) {
|
||||
left: 300px;
|
||||
bottom: 360px;
|
||||
-webkit-animation-delay: 0.3s;
|
||||
animation-delay: 0.3s;
|
||||
}
|
||||
@-webkit-keyframes star-blink {
|
||||
50% {
|
||||
.star {
|
||||
border-radius: 50%;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 0 6px 0 rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
|
||||
.small-stars .star {
|
||||
position: absolute;
|
||||
width: 3px;
|
||||
height: 3px;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@keyframes star-blink {
|
||||
50% {
|
||||
|
||||
.small-stars .star:nth-child(2n) {
|
||||
opacity: 0;
|
||||
-webkit-animation: star-blink 1.2s linear infinite alternate;
|
||||
animation: star-blink 1.2s linear infinite alternate;
|
||||
}
|
||||
|
||||
.small-stars .star:nth-child(1) {
|
||||
left: 40px;
|
||||
bottom: 50px;
|
||||
}
|
||||
|
||||
.small-stars .star:nth-child(2) {
|
||||
left: 200px;
|
||||
bottom: 40px;
|
||||
}
|
||||
|
||||
.small-stars .star:nth-child(3) {
|
||||
left: 60px;
|
||||
bottom: 120px;
|
||||
}
|
||||
|
||||
.small-stars .star:nth-child(4) {
|
||||
left: 140px;
|
||||
bottom: 250px;
|
||||
}
|
||||
|
||||
.small-stars .star:nth-child(5) {
|
||||
left: 400px;
|
||||
bottom: 300px;
|
||||
}
|
||||
|
||||
.small-stars .star:nth-child(6) {
|
||||
left: 170px;
|
||||
bottom: 80px;
|
||||
}
|
||||
|
||||
.small-stars .star:nth-child(7) {
|
||||
left: 200px;
|
||||
bottom: 360px;
|
||||
-webkit-animation-delay: 0.2s;
|
||||
animation-delay: 0.2s;
|
||||
}
|
||||
|
||||
.small-stars .star:nth-child(8) {
|
||||
left: 250px;
|
||||
bottom: 320px;
|
||||
}
|
||||
|
||||
.small-stars .star:nth-child(9) {
|
||||
left: 300px;
|
||||
bottom: 340px;
|
||||
}
|
||||
|
||||
.small-stars .star:nth-child(10) {
|
||||
left: 130px;
|
||||
bottom: 320px;
|
||||
-webkit-animation-delay: 0.5s;
|
||||
animation-delay: 0.5s;
|
||||
}
|
||||
|
||||
.small-stars .star:nth-child(11) {
|
||||
left: 230px;
|
||||
bottom: 330px;
|
||||
-webkit-animation-delay: 7s;
|
||||
animation-delay: 7s;
|
||||
}
|
||||
|
||||
.small-stars .star:nth-child(12) {
|
||||
left: 300px;
|
||||
bottom: 360px;
|
||||
-webkit-animation-delay: 0.3s;
|
||||
animation-delay: 0.3s;
|
||||
}
|
||||
|
||||
@-webkit-keyframes star-blink {
|
||||
50% {
|
||||
width: 3px;
|
||||
height: 3px;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes star-blink {
|
||||
50% {
|
||||
width: 3px;
|
||||
height: 3px;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.medium-stars .star {
|
||||
position: absolute;
|
||||
width: 3px;
|
||||
height: 3px;
|
||||
opacity: 1;
|
||||
opacity: 0;
|
||||
-webkit-animation: star-blink 1.2s ease-in infinite alternate;
|
||||
animation: star-blink 1.2s ease-in infinite alternate;
|
||||
}
|
||||
}
|
||||
.medium-stars .star {
|
||||
position: absolute;
|
||||
width: 3px;
|
||||
height: 3px;
|
||||
opacity: 0;
|
||||
-webkit-animation: star-blink 1.2s ease-in infinite alternate;
|
||||
animation: star-blink 1.2s ease-in infinite alternate;
|
||||
}
|
||||
.medium-stars .star:nth-child(1) {
|
||||
left: 300px;
|
||||
bottom: 50px;
|
||||
}
|
||||
.medium-stars .star:nth-child(2) {
|
||||
left: 400px;
|
||||
bottom: 40px;
|
||||
-webkit-animation-delay: 0.4s;
|
||||
animation-delay: 0.4s;
|
||||
}
|
||||
.medium-stars .star:nth-child(3) {
|
||||
left: 330px;
|
||||
bottom: 300px;
|
||||
-webkit-animation-delay: 0.2s;
|
||||
animation-delay: 0.2s;
|
||||
}
|
||||
.medium-stars .star:nth-child(4) {
|
||||
left: 460px;
|
||||
bottom: 300px;
|
||||
-webkit-animation-delay: 0.9s;
|
||||
animation-delay: 0.9s;
|
||||
}
|
||||
.medium-stars .star:nth-child(5) {
|
||||
left: 300px;
|
||||
bottom: 150px;
|
||||
-webkit-animation-delay: 1.2s;
|
||||
animation-delay: 1.2s;
|
||||
}
|
||||
.medium-stars .star:nth-child(6) {
|
||||
left: 440px;
|
||||
bottom: 120px;
|
||||
-webkit-animation-delay: 1s;
|
||||
animation-delay: 1s;
|
||||
}
|
||||
.medium-stars .star:nth-child(7) {
|
||||
left: 200px;
|
||||
bottom: 140px;
|
||||
-webkit-animation-delay: 0.8s;
|
||||
animation-delay: 0.8s;
|
||||
}
|
||||
.medium-stars .star:nth-child(8) {
|
||||
left: 30px;
|
||||
bottom: 480px;
|
||||
-webkit-animation-delay: 0.3s;
|
||||
animation-delay: 0.3s;
|
||||
}
|
||||
.medium-stars .star:nth-child(9) {
|
||||
left: 460px;
|
||||
bottom: 400px;
|
||||
-webkit-animation-delay: 1.2s;
|
||||
animation-delay: 1.2s;
|
||||
}
|
||||
.medium-stars .star:nth-child(10) {
|
||||
left: 150px;
|
||||
bottom: 10px;
|
||||
-webkit-animation-delay: 1s;
|
||||
animation-delay: 1s;
|
||||
}
|
||||
.medium-stars .star:nth-child(11) {
|
||||
left: 420px;
|
||||
bottom: 450px;
|
||||
-webkit-animation-delay: 1.2s;
|
||||
animation-delay: 1.2s;
|
||||
}
|
||||
.medium-stars .star:nth-child(12) {
|
||||
left: 340px;
|
||||
bottom: 180px;
|
||||
-webkit-animation-delay: 1.1s;
|
||||
animation-delay: 1.1s;
|
||||
}
|
||||
@keyframes star-blink {
|
||||
50% {
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
opacity: 1;
|
||||
|
||||
.medium-stars .star:nth-child(1) {
|
||||
left: 300px;
|
||||
bottom: 50px;
|
||||
}
|
||||
}
|
||||
.star-fall {
|
||||
position: relative;
|
||||
border-radius: 2px;
|
||||
width: 80px;
|
||||
height: 2px;
|
||||
overflow: hidden;
|
||||
-webkit-transform: rotate(-20deg);
|
||||
transform: rotate(-20deg);
|
||||
}
|
||||
.star-fall:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 50px;
|
||||
height: 2px;
|
||||
background: -webkit-gradient(linear, right top, left top, from(rgba(0, 0, 0, 0)), to(rgba(255, 255, 255, 0.4)));
|
||||
background: linear-gradient(to left, rgba(0, 0, 0, 0) 0%, rgba(255, 255, 255, 0.4) 100%);
|
||||
left: 100%;
|
||||
-webkit-animation: star-fall 3.6s linear infinite;
|
||||
animation: star-fall 3.6s linear infinite;
|
||||
}
|
||||
|
||||
.star-fall:nth-child(1) {
|
||||
left: 80px;
|
||||
bottom: -100px;
|
||||
}
|
||||
.star-fall:nth-child(1):after {
|
||||
-webkit-animation-delay: 2.4s;
|
||||
animation-delay: 2.4s;
|
||||
}
|
||||
|
||||
.star-fall:nth-child(2) {
|
||||
left: 200px;
|
||||
bottom: -200px;
|
||||
}
|
||||
.star-fall:nth-child(2):after {
|
||||
-webkit-animation-delay: 2s;
|
||||
animation-delay: 2s;
|
||||
}
|
||||
|
||||
.star-fall:nth-child(3) {
|
||||
left: 430px;
|
||||
bottom: -50px;
|
||||
}
|
||||
.star-fall:nth-child(3):after {
|
||||
-webkit-animation-delay: 3.6s;
|
||||
animation-delay: 3.6s;
|
||||
}
|
||||
|
||||
.star-fall:nth-child(4) {
|
||||
left: 400px;
|
||||
bottom: 100px;
|
||||
}
|
||||
.star-fall:nth-child(4):after {
|
||||
-webkit-animation-delay: 0.2s;
|
||||
animation-delay: 0.2s;
|
||||
}
|
||||
|
||||
@-webkit-keyframes star-fall {
|
||||
20% {
|
||||
left: -100%;
|
||||
.medium-stars .star:nth-child(2) {
|
||||
left: 400px;
|
||||
bottom: 40px;
|
||||
-webkit-animation-delay: 0.4s;
|
||||
animation-delay: 0.4s;
|
||||
}
|
||||
100% {
|
||||
left: -100%;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes star-fall {
|
||||
20% {
|
||||
left: -100%;
|
||||
.medium-stars .star:nth-child(3) {
|
||||
left: 330px;
|
||||
bottom: 300px;
|
||||
-webkit-animation-delay: 0.2s;
|
||||
animation-delay: 0.2s;
|
||||
}
|
||||
100% {
|
||||
left: -100%;
|
||||
|
||||
.medium-stars .star:nth-child(4) {
|
||||
left: 460px;
|
||||
bottom: 300px;
|
||||
-webkit-animation-delay: 0.9s;
|
||||
animation-delay: 0.9s;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
.medium-stars .star:nth-child(5) {
|
||||
left: 300px;
|
||||
bottom: 150px;
|
||||
-webkit-animation-delay: 1.2s;
|
||||
animation-delay: 1.2s;
|
||||
}
|
||||
|
||||
.medium-stars .star:nth-child(6) {
|
||||
left: 440px;
|
||||
bottom: 120px;
|
||||
-webkit-animation-delay: 1s;
|
||||
animation-delay: 1s;
|
||||
}
|
||||
|
||||
.medium-stars .star:nth-child(7) {
|
||||
left: 200px;
|
||||
bottom: 140px;
|
||||
-webkit-animation-delay: 0.8s;
|
||||
animation-delay: 0.8s;
|
||||
}
|
||||
|
||||
.medium-stars .star:nth-child(8) {
|
||||
left: 30px;
|
||||
bottom: 480px;
|
||||
-webkit-animation-delay: 0.3s;
|
||||
animation-delay: 0.3s;
|
||||
}
|
||||
|
||||
.medium-stars .star:nth-child(9) {
|
||||
left: 460px;
|
||||
bottom: 400px;
|
||||
-webkit-animation-delay: 1.2s;
|
||||
animation-delay: 1.2s;
|
||||
}
|
||||
|
||||
.medium-stars .star:nth-child(10) {
|
||||
left: 150px;
|
||||
bottom: 10px;
|
||||
-webkit-animation-delay: 1s;
|
||||
animation-delay: 1s;
|
||||
}
|
||||
|
||||
.medium-stars .star:nth-child(11) {
|
||||
left: 420px;
|
||||
bottom: 450px;
|
||||
-webkit-animation-delay: 1.2s;
|
||||
animation-delay: 1.2s;
|
||||
}
|
||||
|
||||
.medium-stars .star:nth-child(12) {
|
||||
left: 340px;
|
||||
bottom: 180px;
|
||||
-webkit-animation-delay: 1.1s;
|
||||
animation-delay: 1.1s;
|
||||
}
|
||||
|
||||
@keyframes star-blink {
|
||||
50% {
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.star-fall {
|
||||
position: relative;
|
||||
border-radius: 2px;
|
||||
width: 80px;
|
||||
height: 2px;
|
||||
overflow: hidden;
|
||||
-webkit-transform: rotate(-20deg);
|
||||
transform: rotate(-20deg);
|
||||
}
|
||||
|
||||
.star-fall:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 50px;
|
||||
height: 2px;
|
||||
background: -webkit-gradient(linear, right top, left top, from(rgba(0, 0, 0, 0)), to(rgba(255, 255, 255, 0.4)));
|
||||
background: linear-gradient(to left, rgba(0, 0, 0, 0) 0%, rgba(255, 255, 255, 0.4) 100%);
|
||||
left: 100%;
|
||||
-webkit-animation: star-fall 3.6s linear infinite;
|
||||
animation: star-fall 3.6s linear infinite;
|
||||
}
|
||||
|
||||
.star-fall:nth-child(1) {
|
||||
left: 80px;
|
||||
bottom: -100px;
|
||||
}
|
||||
|
||||
.star-fall:nth-child(1):after {
|
||||
-webkit-animation-delay: 2.4s;
|
||||
animation-delay: 2.4s;
|
||||
}
|
||||
|
||||
.star-fall:nth-child(2) {
|
||||
left: 200px;
|
||||
bottom: -200px;
|
||||
}
|
||||
|
||||
.star-fall:nth-child(2):after {
|
||||
-webkit-animation-delay: 2s;
|
||||
animation-delay: 2s;
|
||||
}
|
||||
|
||||
.star-fall:nth-child(3) {
|
||||
left: 430px;
|
||||
bottom: -50px;
|
||||
}
|
||||
|
||||
.star-fall:nth-child(3):after {
|
||||
-webkit-animation-delay: 3.6s;
|
||||
animation-delay: 3.6s;
|
||||
}
|
||||
|
||||
.star-fall:nth-child(4) {
|
||||
left: 400px;
|
||||
bottom: 100px;
|
||||
}
|
||||
|
||||
.star-fall:nth-child(4):after {
|
||||
-webkit-animation-delay: 0.2s;
|
||||
animation-delay: 0.2s;
|
||||
}
|
||||
|
||||
@-webkit-keyframes star-fall {
|
||||
20% {
|
||||
left: -100%;
|
||||
}
|
||||
|
||||
100% {
|
||||
left: -100%;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes star-fall {
|
||||
20% {
|
||||
left: -100%;
|
||||
}
|
||||
|
||||
100% {
|
||||
left: -100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,272 @@
|
||||
<template>
|
||||
<tm-fullView>
|
||||
<view class="ma-32">
|
||||
<tm-coupon :hdata="calcBlogCoupon" color="blue" @click="blogDetailPoupShow=true"></tm-coupon>
|
||||
</view>
|
||||
<view class="pb-50">
|
||||
<tm-form @submit="fnOnSubmit">
|
||||
<tm-sheet :shadow="24" color="blue">
|
||||
<view class="text-size-s text-weight-b mb-24">友链信息提交</view>
|
||||
<tm-sheet :margin="[0,0]" :padding="[0,0]" :shadow="24" classname="overflow">
|
||||
<tm-input v-model="form.displayName" align="right" name="displayName" placeholder="请输入网站名称"
|
||||
required title="名称"></tm-input>
|
||||
<tm-input v-model="form.url" align="right" name="url" placeholder="请输入网站地址" required
|
||||
title="网址"></tm-input>
|
||||
<tm-input v-model="form.logo" align="right" name="logo" placeholder="请输入网站Logo" required
|
||||
title="Logo"></tm-input>
|
||||
<tm-input v-model="form.email" align="right" name="email" placeholder="请输入邮箱" required
|
||||
title="邮箱"></tm-input>
|
||||
<tm-input v-model="form.linkPageUrl" align="right" name="linkPageUrl" placeholder="请输入友链页面地址"
|
||||
title="友链页面"></tm-input>
|
||||
<view class="py-12 px-24 mx-12 round-3 border-b-1 grey text">
|
||||
<text class="text-grey text-size-xs px-10">
|
||||
<tm-helpTips :show="true" color="bg-gradient-blue-lighten-b" direction="bottom"
|
||||
label="展示本站链接的页面地址,用于校验是否添加本站友链" ment-direction="left" tip-direction="left">
|
||||
<tm-icons :fllowTheme="true" name="icon-question-circle"></tm-icons>
|
||||
</tm-helpTips>
|
||||
(贵站友情链接页面地址,即包含本站链接也页面)
|
||||
</text>
|
||||
</view>
|
||||
<tm-input v-model="form.rssUrl" align="right" name="rssUrl" placeholder="请输入RSS地址"
|
||||
title="RSS地址"></tm-input>
|
||||
<view class="py-12 px-24 mx-12 round-3 border-b-1 grey text">
|
||||
<text class="text-grey text-size-xs px-10">
|
||||
<tm-helpTips :show="true" color="bg-gradient-blue-lighten-b" direction="bottom"
|
||||
label="用于抓取文章" ment-direction="left" tip-direction="left">
|
||||
<tm-icons :fllowTheme="true" name="icon-question-circle"></tm-icons>
|
||||
</tm-helpTips>
|
||||
(用于抓取文章)
|
||||
</text>
|
||||
</view>
|
||||
<tm-input v-model="form.description" :border-bottom="false" :height="100" :maxlength="30"
|
||||
:vertical="true" bg-color="grey-lighten-5" input-type="textarea" name="description"
|
||||
placeholder="请输入网站描述,不超过30字符" required title="网站描述"></tm-input>
|
||||
<view class="px-24">
|
||||
<tm-button block navtie-type="form" theme="bg-gradient-blue-accent">提交数据</tm-button>
|
||||
<view class="py-32 text-size-s text-grey text-align-center">友链申请</view>
|
||||
</view>
|
||||
</tm-sheet>
|
||||
</tm-sheet>
|
||||
</tm-form>
|
||||
|
||||
<tm-poup v-model="blogDetailPoupShow" :round="6" :width="640" height="auto" position="center">
|
||||
<view class="poup pa-36" scroll-y="auto">
|
||||
<view class="info flex">
|
||||
<view class="poup-logo pa-4 shadow-24">
|
||||
<image :src="$utils.checkAvatarUrl(blogDetail.blogLogo)" class="poup-logo_img" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="pl-24 info-detail">
|
||||
<view class="poup-name text-size-lg text-weight-b">{{ blogDetail.blogName }}</view>
|
||||
<view class="poup-tag ml--10 text-size-n mt-10 text-grey">
|
||||
{{ blogDetail.blogDesc }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="poup-desc">
|
||||
<text>{{ calcBlogContent }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 博客预览图 -->
|
||||
<view class="mt-24">
|
||||
<tm-images :round="2" :src="calcSiteThumbnail(blogDetail.blogUrl)" :width="568"
|
||||
mode="aspectFill"></tm-images>
|
||||
</view>
|
||||
</view>
|
||||
<view class="poup-link flex flex-center mb-24">
|
||||
<tm-button theme="light-blue" size="n" @click="fnCopyLink(blogDetail.blogUrl)">复制友链交换信息</tm-button>
|
||||
<tm-button text theme="white" @click="blogDetailPoupShow = false">关闭</tm-button>
|
||||
</view>
|
||||
</tm-poup>
|
||||
</view>
|
||||
</tm-fullView>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmFullView from "@/tm-vuetify/components/tm-fullView/tm-fullView.vue"
|
||||
import tmMenubars from "@/tm-vuetify/components/tm-menubars/tm-menubars.vue"
|
||||
import tmSheet from "@/tm-vuetify/components/tm-sheet/tm-sheet.vue"
|
||||
import tmForm from "@/tm-vuetify/components/tm-form/tm-form.vue"
|
||||
import tmActionSheet from "@/tm-vuetify/components/tm-actionSheet/tm-actionSheet.vue"
|
||||
import tmButton from "@/tm-vuetify/components/tm-button/tm-button.vue"
|
||||
import tmInput from "@/tm-vuetify/components/tm-input/tm-input.vue"
|
||||
import tmHelpTips from "@/tm-vuetify/components/tm-helpTips/tm-helpTips.vue"
|
||||
import tmIcons from "@/tm-vuetify/components/tm-icons/tm-icons.vue"
|
||||
import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue'
|
||||
import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue'
|
||||
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue'
|
||||
import tmCoupon from '@/tm-vuetify/components/tm-coupon/tm-coupon.vue'
|
||||
import $utils from "@/utils";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
tmFullView,
|
||||
tmSheet,
|
||||
tmMenubars,
|
||||
tmForm,
|
||||
tmActionSheet,
|
||||
tmButton,
|
||||
tmInput,
|
||||
tmHelpTips,
|
||||
tmIcons,
|
||||
tmPoup,
|
||||
tmImages,
|
||||
tmTags,
|
||||
tmCoupon
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
blogDetailPoupShow: false,
|
||||
form: {
|
||||
url: '', // 网址
|
||||
name: '', // 名称
|
||||
logo: '', // Logo
|
||||
linkPageUrl: '', // 友链页面
|
||||
team: '自助提交', // 分组
|
||||
description: '' // 描述
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
$utils() {
|
||||
return $utils
|
||||
},
|
||||
haloPluginConfigs(){
|
||||
return this.$tm.vx.getters().getConfigs.pluginConfig;
|
||||
},
|
||||
blogDetail() {
|
||||
return this.haloPluginConfigs.linksSubmitPlugin;
|
||||
},
|
||||
calcSiteThumbnail(val) {
|
||||
return val => {
|
||||
if (!val) return '';
|
||||
if (val.charAt(val.length - 1) !== '/') {
|
||||
val = val + '/';
|
||||
}
|
||||
return 'https://image.thum.io/get/width/1000/crop/800/' + val;
|
||||
};
|
||||
},
|
||||
calcBlogContent() {
|
||||
return `
|
||||
博客名称:${this.blogDetail.blogName}
|
||||
博客地址:${this.blogDetail.blogUrl}
|
||||
博客logo:${$utils.checkAvatarUrl(this.blogDetail.blogLogo)}
|
||||
博客简介:${this.blogDetail.blogDesc}
|
||||
`
|
||||
},
|
||||
calcBlogCoupon() {
|
||||
return {
|
||||
img: $utils.checkAvatarUrl(this.blogDetail.blogLogo),
|
||||
title: this.blogDetail.blogName,
|
||||
time: this.blogDetail.blogDesc,
|
||||
btnText: '友链详情'
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('友链申请');
|
||||
},
|
||||
methods: {
|
||||
fnOnSubmit(e) {
|
||||
if (e === false) {
|
||||
return uni.$tm.toast('请检查所有的必填项是否填写完整!');
|
||||
}
|
||||
if (this.form.url && !uni.$tm.test.url(this.form.url)) {
|
||||
return uni.$tm.toast('请输入正确的网站地址!');
|
||||
}
|
||||
if (this.form.logo && !uni.$tm.test.url(this.form.logo)) {
|
||||
return uni.$tm.toast('请输入正确的Logo地址!');
|
||||
}
|
||||
if (this.form.email && !uni.$tm.test.email(this.form.email)) {
|
||||
return uni.$tm.toast('请输入正确的邮箱地址!');
|
||||
}
|
||||
if (this.form.linkPageUrl && !uni.$tm.test.url(this.form.linkPageUrl)) {
|
||||
return uni.$tm.toast('请输入正确的友链页面地址!');
|
||||
}
|
||||
if (this.form.rssUrl && !uni.$tm.test.url(this.form.rssUrl)) {
|
||||
return uni.$tm.toast('请输入正确的RSS地址!');
|
||||
}
|
||||
this.fnHandle();
|
||||
},
|
||||
fnHandle() {
|
||||
uni.showLoading({
|
||||
title: '正在提交...'
|
||||
});
|
||||
this.$httpApi.v2.submitLink(this.form)
|
||||
.then(res => {
|
||||
if (res.code === 200) {
|
||||
uni.$tm.toast(res.msg);
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/friend-links/friend-links',
|
||||
success() {
|
||||
let page = getCurrentPages().pop(); //跳转页面成功之后
|
||||
if (!page) return;
|
||||
page.onLoad(); //如果页面存在,则重新刷新页面
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
} else {
|
||||
uni.$tm.toast(res.msg);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
uni.$tm.toast(err.msg);
|
||||
});
|
||||
},
|
||||
fnCopyLink() {
|
||||
uni.setClipboardData({
|
||||
data: this.calcBlogContent,
|
||||
showToast: false,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '复制成功!'
|
||||
});
|
||||
},
|
||||
fail: () => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '复制失败!'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.poup-logo {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
border-radius: 24rpx;
|
||||
overflow: hidden;
|
||||
|
||||
&_img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.poup-desc {
|
||||
margin-top: -20rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 1.8;
|
||||
color: #555 !important;
|
||||
}
|
||||
|
||||
.info-detail {
|
||||
width: 0;
|
||||
flex-grow: 1;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
pre {
|
||||
//方法一:保留空白符序列,但是正常地进行换行。
|
||||
white-space: pre-wrap;
|
||||
//方法二:添加横向滚动条
|
||||
overflow-x: auto;
|
||||
}
|
||||
</style>
|
||||
+144
-135
@@ -1,146 +1,155 @@
|
||||
<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>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
</view>
|
||||
<block v-else>
|
||||
<view class="empty" v-if="dataList.length == 0"><tm-empty icon="icon-shiliangzhinengduixiang-" label="该标签下暂无文章"></tm-empty></view>
|
||||
<block v-else>
|
||||
<block v-for="(article, index) in dataList" :key="article.createTime">
|
||||
<!-- 文章卡片 -->
|
||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)"><article-card :article="article" @on-click="fnToArticleDetail"></article-card></tm-translate>
|
||||
</block>
|
||||
<view class="load-text">{{ loadMoreText }}</view>
|
||||
</block>
|
||||
<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>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
</view>
|
||||
<block v-else>
|
||||
<view class="empty" v-if="dataList.length == 0">
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-"
|
||||
label="该标签下暂无文章"></tm-empty>
|
||||
</view>
|
||||
<block v-else>
|
||||
<block v-for="(article, index) in dataList" :key="article.metadata.name">
|
||||
<!-- 文章卡片 -->
|
||||
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||
<article-card :article="article" @on-click="fnToArticleDetail"></article-card>
|
||||
</tm-translate>
|
||||
</block>
|
||||
<view class="load-text">{{ loadMoreText }}</view>
|
||||
</block>
|
||||
|
||||
<tm-flotbutton @click="fnToTopPage" color="light-blue" size="m" icon="icon-angle-up"></tm-flotbutton>
|
||||
</block>
|
||||
</view>
|
||||
<tm-flotbutton @click="fnToTopPage" color="light-blue" size="m" icon="icon-angle-up"></tm-flotbutton>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import ArticleCard from '@/components/article-card/article-card.vue';
|
||||
export default {
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmTranslate,
|
||||
tmFlotbutton,
|
||||
tmEmpty,
|
||||
ArticleCard
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
queryParams: {
|
||||
size: 10,
|
||||
page: 0
|
||||
},
|
||||
slug: '',
|
||||
pageTitle: '加载中...',
|
||||
result: null,
|
||||
dataList: [],
|
||||
isLoadMore: false,
|
||||
loadMoreText: ''
|
||||
};
|
||||
},
|
||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||
import ArticleCard from '@/components/article-card/article-card.vue';
|
||||
|
||||
onLoad(e) {
|
||||
this.slug = e.slug;
|
||||
this.pageTitle = e.name;
|
||||
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() {
|
||||
// uni.showLoading({
|
||||
// mask: true,
|
||||
// title: '加载中...'
|
||||
// });
|
||||
// 设置状态为加载中
|
||||
if (!this.isLoadMore) {
|
||||
this.loading = 'loading';
|
||||
}
|
||||
this.loadMoreText = '加载中...';
|
||||
this.$httpApi
|
||||
.getTagPostsList(this.slug, this.queryParams)
|
||||
.then(res => {
|
||||
this.fnSetPageTitle(`标签:${this.pageTitle} (共${res.data.total}篇)`);
|
||||
this.result = res.data;
|
||||
if (this.isLoadMore) {
|
||||
this.dataList = this.dataList.concat(res.data.content);
|
||||
} else {
|
||||
this.dataList = res.data.content;
|
||||
}
|
||||
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
setTimeout(() => {
|
||||
this.loading = 'success';
|
||||
}, 500);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
}, 500);
|
||||
});
|
||||
},
|
||||
//跳转文章详情
|
||||
fnToArticleDetail(article) {
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
|
||||
animationType: 'slide-in-right'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
export default {
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmTranslate,
|
||||
tmFlotbutton,
|
||||
tmEmpty,
|
||||
ArticleCard
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: 'loading',
|
||||
queryParams: {
|
||||
name: "",
|
||||
size: 10,
|
||||
page: 0
|
||||
},
|
||||
name: '',
|
||||
pageTitle: '加载中...',
|
||||
|
||||
dataList: [],
|
||||
hasNext: false,
|
||||
isLoadMore: false,
|
||||
loadMoreText: ''
|
||||
};
|
||||
},
|
||||
|
||||
onLoad(e) {
|
||||
this.name = e.name;
|
||||
this.queryParams.name = this.name;
|
||||
this.pageTitle = e.title;
|
||||
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.v2
|
||||
.getPostByTagName(this.name, this.queryParams)
|
||||
.then(res => {
|
||||
this.fnSetPageTitle(`${this.pageTitle} (共${res.total}篇)`);
|
||||
this.hasNext = res.hasNext;
|
||||
if (this.isLoadMore) {
|
||||
this.dataList = this.dataList.concat(res.items);
|
||||
} else {
|
||||
this.dataList = res.items;
|
||||
}
|
||||
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
setTimeout(() => {
|
||||
this.loading = 'success';
|
||||
}, 500);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
this.loading = 'error';
|
||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
}, 500);
|
||||
});
|
||||
},
|
||||
//跳转文章详情
|
||||
fnToArticleDetail(article) {
|
||||
uni.navigateTo({
|
||||
url: '/pagesA/article-detail/article-detail?name=' + article.metadata.name,
|
||||
animationType: 'slide-in-right'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 24rpx 0;
|
||||
background-color: #fafafd;
|
||||
}
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 24rpx 0;
|
||||
background-color: #fafafd;
|
||||
}
|
||||
|
||||
.loading-wrap {
|
||||
padding: 0 24rpx;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.loading-wrap {
|
||||
padding: 0 24rpx;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.empty {
|
||||
height: 60vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
.empty {
|
||||
height: 60vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user