mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-07-27 04:20:43 +08:00
Compare commits
155 Commits
v1.0.2-beta
...
v2.0.9
| 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 | |||
| a81c506a14 | |||
| 70dc7cd0a7 | |||
| ee28753094 | |||
| 91923c0b42 | |||
| f6feecb324 | |||
| 6fdaeed792 | |||
| f838da43d8 | |||
| 21d723d260 | |||
| d701867b83 | |||
| 66f4ccffc0 | |||
| 9720743c80 | |||
| 6ba87b1972 | |||
| a0f3d1b220 | |||
| 6e80fa14c8 | |||
| 22a8e92dc2 | |||
| 6b1e0e5cc0 | |||
| 261617fc12 | |||
| 5000da9a64 | |||
| 9573b303e2 | |||
| f12262f4df | |||
| 1305b4a555 | |||
| b7e2025ebb |
+3
-4
@@ -1,5 +1,4 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
unpackage/
|
unpackage/
|
||||||
config/halo.config.js
|
package-lock.json
|
||||||
config/ad.config.js
|
.idea
|
||||||
package-lock.json
|
|
||||||
|
|||||||
+27
-22
@@ -1,24 +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代表前端连云端云函数
|
// launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
|
||||||
"version": "0.0",
|
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
|
||||||
"configurations": [{
|
"version" : "0.0",
|
||||||
"app-plus" :
|
"configurations" : [
|
||||||
{
|
{
|
||||||
"launchtype" : "local"
|
"app-plus" : {
|
||||||
},
|
"launchtype" : "local"
|
||||||
"default" :
|
},
|
||||||
{
|
"default" : {
|
||||||
"launchtype" : "local"
|
"launchtype" : "local"
|
||||||
},
|
},
|
||||||
"h5" :
|
"h5" : {
|
||||||
{
|
"launchtype" : "local"
|
||||||
"launchtype" : "local"
|
},
|
||||||
},
|
"mp-qq" : {
|
||||||
"mp-weixin" :
|
"launchtype" : "local"
|
||||||
{
|
},
|
||||||
"launchtype" : "local"
|
"mp-weixin" : {
|
||||||
},
|
"launchtype" : "local"
|
||||||
"type" : "uniCloud"
|
},
|
||||||
}
|
"type" : "uniCloud"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"playground" : "standard",
|
||||||
|
"type" : "uni-app:app-android"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,48 +1,35 @@
|
|||||||
<script>
|
<script>
|
||||||
import HaloConfig from '@/config/halo.config.js';
|
import HaloTokenConfig from '@/config/uhalo.config.js';
|
||||||
import HaloAdConfig from '@/config/ad.config.js';
|
|
||||||
|
|
||||||
// app升级检测(搭配:https://ext.dcloud.net.cn/plugin?id=4470 升级中心)
|
// app升级检测(搭配:https://ext.dcloud.net.cn/plugin?id=4470 升级中心)
|
||||||
import CheckAppUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
|
import CheckAppUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
|
||||||
import { CheckWxUpdate } from '@/utils/update.js';
|
import {CheckWxUpdate} from '@/utils/update.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
globalData: {
|
globalData: {
|
||||||
baseApiUrl: HaloConfig.apiUrl,
|
baseApiUrl: HaloTokenConfig.BASE_API
|
||||||
...HaloConfig,
|
},
|
||||||
haloAdConfig: HaloAdConfig
|
onLaunch: function () {
|
||||||
},
|
|
||||||
onLaunch: function() {
|
|
||||||
console.log('App Launch');
|
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
CheckAppUpdate();
|
CheckAppUpdate();
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
CheckWxUpdate();
|
CheckWxUpdate();
|
||||||
uni.$tm.vx.commit('setWxShare', HaloConfig.wxShareConfig);
|
// #endif
|
||||||
// #endif
|
|
||||||
|
|
||||||
// 监听中间按钮(暂时没有使用)
|
uni.$tm.vx.actions('config/fetchConfigs').then((res) => {
|
||||||
uni.onTabBarMidButtonTap(() => {
|
})
|
||||||
console.log('点击中间按钮');
|
// 启动检查app的配置是否已经就绪,若未就绪则设置默认的
|
||||||
});
|
uni.$tm.vx.actions('setting/checkAndSetDefaultAppSettings');
|
||||||
|
},
|
||||||
// 初始化博主信息
|
onShow: function () {
|
||||||
uni.$tm.vx.actions('blogger/fnGetBlogger');
|
console.log('App Show');
|
||||||
|
},
|
||||||
// 临时:检查是否有用户,没有的话添加一个默认的用户
|
onHide: function () {
|
||||||
uni.$tm.vx.actions('user/checkAndSetDefaultUser');
|
console.log('App Hide');
|
||||||
|
}
|
||||||
// 启动检查app的配置是否已经就绪,若未就绪则设置默认的
|
|
||||||
uni.$tm.vx.actions('setting/checkAndSetDefaultAppSettings');
|
|
||||||
},
|
|
||||||
onShow: function() {
|
|
||||||
console.log('App Show');
|
|
||||||
},
|
|
||||||
onHide: function() {
|
|
||||||
console.log('App Hide');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -68,6 +55,6 @@ export default {
|
|||||||
/* #endif */
|
/* #endif */
|
||||||
|
|
||||||
page {
|
page {
|
||||||
background-color: #fafafa;
|
background-color: #fafafa;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,110 +1,133 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://uni-halo.925i.cn" target="_blank" rel="noopener noreferrer">
|
<a href="https://uni-halo.925i.cn" target="_blank" rel="noopener noreferrer">
|
||||||
<img width="100" src="https://b.925i.cn/uni_halo/uni_halo_logo.png" alt="uni-halo logo" />
|
<img width="100" src="https://uni-halo.925i.cn/logo.png" alt="uni-halo logo" />
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center"><b>uni-halo</b> 基于Halo一款现代化的开源博客/CMS系统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 />
|
<br />
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://b.925i.cn">作者博客</a>
|
<a href="https://www.xiaoxiaomo.cn">作者主页</a>
|
||||||
<a href="https://uni-halo.925i.cn">文档地址</a>
|
<a href="https://uni-halo.925i.cn">官方文档</a>
|
||||||
<a href="https://gitee.com/ialley-workshop-open/uni-halo">Gitee仓库</a>
|
<a href="https://github.com/ialley-workshop-open/uni-halo">仓库地址</a>
|
||||||
<a href="https://github.com/ialley-workshop-open/uni-halo">Github仓库</a>
|
<a href="https://github.com/ialley-workshop-open/plugin-uni-halo">插件仓库</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
如果您觉得这个项目对您有帮助,可以帮作者买杯饮料鼓励鼓励!
|
如果您觉得这个项目对您有帮助,可以帮作者买杯饮料鼓励鼓励,同时为了项目能够持续发展,可以根据您的喜好支持一下本项目哦,非常感谢您的支持,作者也会更有动力持续维护和更新新的功能哦~
|
||||||
|
|
||||||
<table rules="none" align="center" border="0">
|
| 支付宝 | 微信 | QQ |
|
||||||
<tr>
|
|:----------------------------------------------:|:---------------------------------------------:|:---------------------------------------------:|
|
||||||
<td>
|
|  |  |  |
|
||||||
<center>
|
|
||||||
<img src="https://uni-halo.925i.cn/qrcode/zfb.png" width="100%" />
|
## 一、项目介绍
|
||||||
<br/>
|
|
||||||
<font color="AAAAAA">支付宝打赏</font>
|
基于 Halo 2.x 提供的 API 接口,为微信小程序提供的一套开源的博客应用。
|
||||||
</center>
|
|
||||||
</td>
|
- 完全免费开源,包括程序源码、插件源码
|
||||||
<td>
|
- 页面支持插件配置
|
||||||
<center>
|
- 使用最新流行的技术栈
|
||||||
<img src="https://uni-halo.925i.cn/qrcode/wx.png" width="100%" />
|
- 支持特色功能,恋爱日记
|
||||||
<br/>
|
- 理论支持编译为 小程序(推荐)、APP
|
||||||
<font color="AAAAAA">微信打赏</font>
|
|
||||||
</center>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<center>
|
|
||||||
<img src="https://uni-halo.925i.cn/qrcode/qq.png" width="100%" />
|
|
||||||
<br/>
|
|
||||||
<font color="AAAAAA">QQ打赏</font>
|
|
||||||
</center>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
|
|
||||||
## 🌸 快速开始
|
### 在线预览(小莫唐尼)
|
||||||
|
|
||||||
详细部署文档请查阅 [uni-halo-doc](https://uni-halo.925i.cn/)
|
微信内容扫描下方二维码,即可在线预览小程序。
|
||||||
|
|
||||||
- 1、拉取或下载项目<https://gitee.com/ialley-workshop-open/uni-halo>;
|

|
||||||
- 2、通过hbuilderx 导入项目;
|
|
||||||
- 3、命令行执行 npm i 安装依赖;
|
|
||||||
- 4、配置运行信息,找到项目根目录config目录,将`halo.config.template.js`修改为 `halo.config.js` 并设置相关信息;
|
|
||||||
- 5、点击hbuilderx 工具 右上角预览、或者点击工具栏 运行-内置浏览器运行;
|
|
||||||
- 6、项目发行:
|
|
||||||
- 发行小程序:点击工具栏 发行 -> 小程序-微信
|
|
||||||
- 发行APP: 点击工具栏 发行 -> 原生App-云打包
|
|
||||||
|
|
||||||
|
|
||||||
## ⭐️ 功能清单
|
### 部分截图
|
||||||
|
|
||||||
### 用户部分
|
|首页|分类|图库|
|
||||||
1. - [x] 文章分类
|
|:--:|:--:|:--:|
|
||||||
2. - [x] 文章详情&海报分享
|
||||
|
||||||
3. - [x] 文章归档
|
|
||||||
4. - [x] 文章列表和搜索
|
|
||||||
5. - [x] 数据统计展示
|
|
||||||
6. - [x] 图库
|
|
||||||
7. - [x] 友链
|
|
||||||
8. - [x] 留言板
|
|
||||||
9. - [x] 个人日记
|
|
||||||
|
|
||||||
### 管理部分
|
|瞬间|我的|
|
||||||
1. - [x] 个人信息修改
|
|:--:|:--:|
|
||||||
2. - [x] 个人密码修改
|
|||
|
||||||
3. - [x] 日记管理
|
|
||||||
4. - [x] 文章管理
|
|
||||||
5. - [x] 分类管理
|
|
||||||
6. - [x] 标签管理
|
|
||||||
7. - [x] 附件管理
|
|
||||||
8. - [x] 友链管理
|
|
||||||
9. - [x] 图库管理
|
|
||||||
10. - [x] 评论管理
|
|
||||||
11. - [x] 日志管理
|
|
||||||
12. - [ ] 菜单设置
|
|
||||||
13. - [ ] 系统设置
|
|
||||||
|
|
||||||
## 📃 TODO
|
|
||||||
1. - [ ] 暗黑模式
|
|
||||||
2. - [ ] 国际化
|
|
||||||
|
|
||||||
|
|
||||||
## 🌈 在线体验
|
### 恋爱日记
|
||||||
|
|
||||||
- 敬请期待...
|
- 在 uni-halo 中,我们为您准备了一个恋爱日记的模块,您可以在其中记录您的恋爱故事,分享给您的朋友们,请扫示例小程序,在线体验恋爱日记的功能。
|
||||||
|
|
||||||
|
<br/>
|
||||||
## 🔍 许可证
|
|
||||||
|
|
||||||
|
### 功能介绍
|
||||||
|
|
||||||
|
- 基础功能:文章列表、文章分类、文章详情、个人图库、友情链接、我的瞬间
|
||||||
|
|
||||||
|
- 特色功能:恋爱日记,精心为您设计了秀恩爱的模块,秀出关于你们的故事、情侣甜蜜相册、恋爱记录清单,为您的恋爱保驾护航。
|
||||||
|
|
||||||
|
|
||||||
|
## 二、配套插件
|
||||||
|
|
||||||
|
### 下载地址
|
||||||
|
- 代码仓库:[https://github.com/ialley-workshop-open/plugin-uni-halo](https://github.com/ialley-workshop-open/plugin-uni-halo)
|
||||||
|
- 仓库版本:[https://github.com/ialley-workshop-open/plugin-uni-halo/releases](https://github.com/ialley-workshop-open/plugin-uni-halo/releases)
|
||||||
|
- 应用市场:[https://www.halo.run/store/apps/app-ryemX](https://www.halo.run/store/apps/app-ryemX)
|
||||||
|
|
||||||
|
### 使用方式
|
||||||
|
|
||||||
|
直接下载安装插件,在插件市场安装即可,安装完成后,需要配置插件,配置完成后,即可使用插件提供的功能。
|
||||||
|
|
||||||
|
|
||||||
|
## 三、相关文档
|
||||||
|
|
||||||
|
- 作者主页:[https://www.xiaoxiaomo.cn/](https://www.xiaoxiaomo.cn/)
|
||||||
|
- 作者博客:[https://blog.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群,再邀请进微信群
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
## 🎉 加入我们
|
||||||
|
|
||||||
|
uni-halo 还在持续更新中,本项目欢迎您的参与,共同维护,逐步完善,将项目做得更强。项目采用 AGPL-3.0 开源协议,本着一切免费的原则,原则上不会收取任何费用及版权,可以放心使用。
|
||||||
|
|
||||||
|
如果你想加入我们,可以多提供一些好的建议或者提交 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 协议开源,请遵守开源协议。
|
uni-halo 使用 AGPL-3.0 协议开源,请遵守开源协议。
|
||||||
|
|
||||||
## 🏭 贡献
|
<br/>
|
||||||
|
|
||||||
贡献代码请查看 [代码贡献规范](https://uni-halo.925i.cn/standard/category.html)
|
## 🙋 致谢
|
||||||
|
|
||||||
## 🙆♂ Halo
|
uni-halo 得益于以下优秀的技术支撑,我只是站在巨人的肩膀上捡了几根头发丝,但是非常感谢这些优秀的项目,带给了我们其他开发者和用户非常友好的体验!
|
||||||
- 接口文档地址(内容端):<https://api.halo.run/content-api.html>
|
|
||||||
- 接口文档地址(管理端):<https://api.halo.run/admin-api.html>
|
- [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/#/)
|
||||||
|
|||||||
@@ -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,24 +0,0 @@
|
|||||||
/**
|
|
||||||
* 分类接口
|
|
||||||
* @see https://api.halo.run/content-api.html#tag/category-controller
|
|
||||||
*/
|
|
||||||
|
|
||||||
import HttpHandler from '@/common/http/request.js'
|
|
||||||
export default {
|
|
||||||
/**
|
|
||||||
* 查询分类列表
|
|
||||||
* @param {Object} params 查询参数
|
|
||||||
*/
|
|
||||||
getCategoryList: (params) => {
|
|
||||||
return HttpHandler.Get('/api/content/categories', params)
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询分类下的文章
|
|
||||||
* @param {String} slug 分类名称
|
|
||||||
* @param {Object} params 查询参数
|
|
||||||
*/
|
|
||||||
getCategoryPostList: (slug, params) => {
|
|
||||||
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'
|
// 2.0接口
|
||||||
|
import v2 from './v2/all.api.js'
|
||||||
import archive from './archive.js'
|
import v2Config from './v2/all.config.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'
|
|
||||||
|
|
||||||
const ApiManager = {
|
const ApiManager = {
|
||||||
...archive,
|
v2,
|
||||||
...article,
|
v2Config,
|
||||||
...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
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const install = (Vue) => {
|
const install = (Vue) => {
|
||||||
Vue.prototype.$httpApi = ApiManager
|
Vue.prototype.$httpApi = ApiManager
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
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
|
* 邮箱:studio@925i.cn
|
||||||
* 时间:2022年07月21日 18:58:03
|
* 时间: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 {
|
import {
|
||||||
setInterceptors
|
setInterceptors
|
||||||
} from "./interceptors.js";
|
} from "./interceptors.js";
|
||||||
@@ -21,16 +21,16 @@ const http = new Request()
|
|||||||
http.setConfig((config) => {
|
http.setConfig((config) => {
|
||||||
|
|
||||||
// 如果是在外部浏览器调试或者编译为h5,请注释该行代码
|
// 如果是在外部浏览器调试或者编译为h5,请注释该行代码
|
||||||
config.baseURL = HaloConfig.apiUrl;
|
config.baseURL = HaloTokenConfig.BASE_API;
|
||||||
|
|
||||||
config.header = {
|
config.header = {
|
||||||
...config.header,
|
...config.header,
|
||||||
'api-authorization': HaloConfig.apiAuthorization,
|
|
||||||
ContentType: 'application/json',
|
ContentType: 'application/json',
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
})
|
})
|
||||||
|
|
||||||
setInterceptors(http)
|
setInterceptors(http)
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|||||||
+125
-68
@@ -9,76 +9,133 @@
|
|||||||
* 修改人员:
|
* 修改人员:
|
||||||
* 修改时间:
|
* 修改时间:
|
||||||
*/
|
*/
|
||||||
import {
|
import {delCache, setCache} from "@/utils/storage";
|
||||||
getAdminAccessToken
|
|
||||||
} from "@/utils/auth.js";
|
const getCategoryNameByUrl = (url) => {
|
||||||
import {
|
const reg = '(?<=/api/content/categories/).+(?=/posts)'
|
||||||
delCache
|
return url.match(reg)[0] || '无分类名'
|
||||||
} from "@/utils/storage";
|
}
|
||||||
|
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) {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export const setInterceptors = (http) => {
|
export const setInterceptors = (http) => {
|
||||||
http.interceptors.request.use(
|
http.interceptors.request.use((config) => {
|
||||||
(config) => {
|
console.log("config", 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.response.use(
|
// 可使用async await 做异步操作
|
||||||
(response) => {
|
config.header = {
|
||||||
/* 对响应成功做点什么 可使用async await 做异步操作*/
|
...config.header
|
||||||
// if (response.data.code !== 200) { // 服务端返回的状态码不等于200,则reject()
|
// ... 可以直接加参数
|
||||||
// return Promise.reject(response) // return Promise.reject 可使promise状态进入catch
|
};
|
||||||
// if (response.config.custom.verification) { // 演示自定义参数的作用
|
if (config.custom.personalToken) {
|
||||||
// return response.data
|
config.header['Authorization'] = `Bearer ${config.custom.personalToken}`
|
||||||
// }
|
}
|
||||||
|
return config;
|
||||||
|
}, (config) => {
|
||||||
|
// 可使用async await 做异步操作
|
||||||
|
return Promise.reject(config);
|
||||||
|
});
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
http.interceptors.response.use((response) => {
|
||||||
return response.data;
|
/* 对响应成功做点什么 可使用async await 做异步操作*/
|
||||||
} else {
|
// if (response.data.code !== 200) { // 服务端返回的状态码不等于200,则reject()
|
||||||
return Promise.reject(response);
|
// return Promise.reject(response) // return Promise.reject 可使promise状态进入catch
|
||||||
}
|
// if (response.config.custom.verification) { // 演示自定义参数的作用
|
||||||
},
|
// return response.data
|
||||||
(response) => {
|
// }
|
||||||
/* 对响应错误做点什么 (statusCode !== 200)*/
|
|
||||||
if (!response.data) {
|
|
||||||
return Promise.reject({
|
|
||||||
status: 500,
|
|
||||||
message: 'API接口服务异常!'
|
|
||||||
})
|
|
||||||
} else if (response.data.status == 401) {
|
|
||||||
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 {
|
|
||||||
return Promise.reject(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 {
|
import {
|
||||||
http
|
http
|
||||||
} from '@/common/http/index.js'
|
} from '@/common/http/index.js'
|
||||||
@@ -11,7 +9,7 @@ export default {
|
|||||||
Get: (url, params, config = {}) => {
|
Get: (url, params, config = {}) => {
|
||||||
return http.get(url, {
|
return http.get(url, {
|
||||||
params,
|
params,
|
||||||
...config
|
...config
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
Post: (url, data, config = {}) => {
|
Post: (url, data, config = {}) => {
|
||||||
@@ -26,4 +24,4 @@ export default {
|
|||||||
Delete: (url, data, config = {}) => {
|
Delete: (url, data, config = {}) => {
|
||||||
return http.delete(url, data, config)
|
return http.delete(url, data, config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,11 +2,14 @@
|
|||||||
* markdown配置
|
* 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 {
|
export default {
|
||||||
domain: HaloConfig.apiUrl,
|
domain: HaloTokenConfig.BASE_API,
|
||||||
tagStyle: {
|
tagStyle: {
|
||||||
table: `
|
table: `
|
||||||
table-layout: fixed;
|
table-layout: fixed;
|
||||||
border-collapse:collapse;
|
border-collapse:collapse;
|
||||||
margin-bottom: 18px;
|
margin-bottom: 18px;
|
||||||
@@ -17,17 +20,17 @@ export default {
|
|||||||
border: 1px solid #dcdcdc;
|
border: 1px solid #dcdcdc;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
`,
|
`,
|
||||||
th: `
|
th: `
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
border-right: 1px solid var(--classE);
|
border-right: 1px solid var(--classE);
|
||||||
border-bottom: 1px solid var(--classE);
|
border-bottom: 1px solid var(--classE);
|
||||||
`,
|
`,
|
||||||
td: `
|
td: `
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
border-right: 1px solid var(--classE);
|
border-right: 1px solid var(--classE);
|
||||||
border-bottom: 1px solid var(--classE);
|
border-bottom: 1px solid var(--classE);
|
||||||
`,
|
`,
|
||||||
blockquote: `
|
blockquote: `
|
||||||
padding: 8px 15px;
|
padding: 8px 15px;
|
||||||
color: #606266;
|
color: #606266;
|
||||||
background: #f2f6fc;
|
background: #f2f6fc;
|
||||||
@@ -36,62 +39,62 @@ export default {
|
|||||||
line-height: 26px;
|
line-height: 26px;
|
||||||
margin-bottom: 18px;
|
margin-bottom: 18px;
|
||||||
`,
|
`,
|
||||||
ul: 'padding-left: 15px;line-height: 1.85;',
|
ul: 'padding-left: 15px;line-height: 1.85;',
|
||||||
ol: 'padding-left: 15px;line-height: 1.85;',
|
ol: 'padding-left: 15px;line-height: 1.85;',
|
||||||
li: 'margin-bottom: 12px;line-height: 1.85;',
|
li: 'margin-bottom: 12px;line-height: 1.85;',
|
||||||
h1: `
|
h1: `
|
||||||
margin: 30px 0 20px;
|
margin: 30px 0 20px;
|
||||||
color: var(--main);
|
color: var(--main);
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size:1.2em;
|
font-size:1.2em;
|
||||||
`,
|
`,
|
||||||
h2: `
|
h2: `
|
||||||
color: var(--main);
|
color: var(--main);
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: 22px 0 16px;
|
margin: 22px 0 16px;
|
||||||
font-size: 1.16em;
|
font-size: 1.16em;
|
||||||
`,
|
`,
|
||||||
h3: `
|
h3: `
|
||||||
color: var(--main);
|
color: var(--main);
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: 26px 0 18px;
|
margin: 26px 0 18px;
|
||||||
font-size: 1.14em;
|
font-size: 1.14em;
|
||||||
`,
|
`,
|
||||||
h4: `
|
h4: `
|
||||||
color: var(--main);
|
color: var(--main);
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
margin-bottom: 18px;
|
margin-bottom: 18px;
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size: 1.2em;
|
font-size: 1.12em;
|
||||||
`,
|
`,
|
||||||
h5: `
|
h5: `
|
||||||
color: var(--main);
|
color: var(--main);
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size: 16px;
|
font-size: 1.1em;
|
||||||
`,
|
`,
|
||||||
h6: `
|
h6: `
|
||||||
color: #303133;
|
color: #303133;
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
`,
|
`,
|
||||||
p: `
|
p: `
|
||||||
line-height: 1.65;
|
line-height: 1.65;
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
`,
|
`,
|
||||||
'code': ` `,
|
'code': ` `,
|
||||||
strong: 'font-weight: 700;color: rgb(248, 57, 41);',
|
strong: 'font-weight: 700;color: rgb(248, 57, 41);',
|
||||||
video: 'width: 100%',
|
video: 'width: 100%',
|
||||||
},
|
},
|
||||||
containStyle: 'font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;padding:12px;font-size: 16px;color: #606266;word-spacing: 0.8px;letter-spacing: 0.8px;border-radius: 6px;background-color:#FFFFFF;',
|
containStyle: 'font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;padding:12px;font-size: 14px;color: #606266;word-spacing: 0.8px;letter-spacing: 0.8px;border-radius: 6px;background-color:#FFFFFF;',
|
||||||
|
|
||||||
loadingGif: HaloConfig.loadingGifUrl,
|
loadingGif: utils.checkImageUrl(getAppConfigs().imagesConfig.loadingGifUrl),
|
||||||
emptyGif: HaloConfig.loadingEmptyUrl,
|
emptyGif: utils.checkImageUrl(getAppConfigs().imagesConfig.loadingEmptyUrl),
|
||||||
}
|
}
|
||||||
|
|||||||
+71
-53
@@ -9,59 +9,77 @@
|
|||||||
* 修改人员:
|
* 修改人员:
|
||||||
* 修改时间:
|
* 修改时间:
|
||||||
*/
|
*/
|
||||||
import HaloConfig from '@/config/halo.config.js';
|
|
||||||
import HaloAdConfig from '@/config/ad.config.js';
|
|
||||||
export default {
|
export default {
|
||||||
install(Vue) {
|
install(Vue) {
|
||||||
Vue.mixin({
|
Vue.mixin({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
author: HaloConfig.author,
|
_isWechat: true,
|
||||||
_isWechat: true,
|
_aniWaitIndex: 0
|
||||||
haloAdConfig: HaloAdConfig
|
};
|
||||||
};
|
},
|
||||||
},
|
computed: {
|
||||||
computed: {
|
haloConfig() {
|
||||||
// 获取全局应用设置
|
return this.$tm.vx.getters().getConfigs;
|
||||||
globalAppSettings() {
|
},
|
||||||
return uni.$tm.vx.getters().getSettings;
|
haloPluginsConfig() {
|
||||||
}
|
return this.$tm.vx.getters().getConfigs?.pluginConfig;
|
||||||
},
|
},
|
||||||
created() {
|
// 获取全局应用设置
|
||||||
// #ifdef MP-WEIXIN
|
globalAppSettings() {
|
||||||
this._isWechat = true;
|
return uni.$tm.vx.getters().getSettings;
|
||||||
uni.$tm.vx.commit('setWxShare', HaloConfig.wxShareConfig);
|
},
|
||||||
// #endif
|
// 计算动画索引
|
||||||
// #ifndef MP-WEIXIN
|
calcAniWait() {
|
||||||
this._isWechat = false;
|
return (index) => {
|
||||||
// #endif
|
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",
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
// 页面返回顶部
|
||||||
/**
|
fnToTopPage(duration = 500) {
|
||||||
* 设置页面标题
|
duration = isNaN(duration) ? 500 : duration
|
||||||
* @param {Object} title 标题
|
uni.pageScrollTo({
|
||||||
*/
|
scrollTop: 0,
|
||||||
fnSetPageTitle(title) {
|
duration: duration,
|
||||||
uni.setNavigationBarTitle({
|
fail: (err) => {
|
||||||
title: title || HaloConfig.title
|
console.log('err:', err);
|
||||||
})
|
},
|
||||||
},
|
});
|
||||||
|
},
|
||||||
/**
|
// 初始化动画索引值(需要在每个页面调用)
|
||||||
* 页面返回顶部
|
fnResetSetAniWaitIndex() {
|
||||||
*/
|
this._aniWaitIndex = 0
|
||||||
fnToTopPage(duration = 500) {
|
}
|
||||||
duration = isNaN(duration) ? 500 : duration
|
},
|
||||||
uni.pageScrollTo({
|
});
|
||||||
scrollTop: 0,
|
},
|
||||||
duration: duration,
|
|
||||||
fail: (err) => {
|
|
||||||
console.log('err:', err);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -36,3 +36,314 @@
|
|||||||
transform: rotateZ(360deg);
|
transform: rotateZ(360deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 自定义广告
|
||||||
|
|
||||||
|
.ad-card {
|
||||||
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 24rpx;
|
||||||
|
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
|
||||||
|
&.is-lr {
|
||||||
|
display: flex;
|
||||||
|
.ad-card_tip {
|
||||||
|
top: initial;
|
||||||
|
left: 288rpx;
|
||||||
|
bottom: 24rpx;
|
||||||
|
// right: 160rpx;
|
||||||
|
padding: 4rpx 20rpx;
|
||||||
|
background-color: transparent;
|
||||||
|
border: 2rpx solid #607d8b;
|
||||||
|
color: #607d8b;
|
||||||
|
}
|
||||||
|
.ad-card_cover {
|
||||||
|
width: 240rpx;
|
||||||
|
height: 180rpx;
|
||||||
|
animation: adLinkAni 1s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
.ad-card_info {
|
||||||
|
width: 0;
|
||||||
|
flex-grow: 1;
|
||||||
|
padding-left: 24rpx;
|
||||||
|
&-title {
|
||||||
|
margin-top: 0;
|
||||||
|
width: 100%;
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
&-link {
|
||||||
|
top: initial;
|
||||||
|
// right: 150rpx;
|
||||||
|
bottom: 0;
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&_tip {
|
||||||
|
position: absolute;
|
||||||
|
left: 36rpx;
|
||||||
|
top: 36rpx;
|
||||||
|
display: inline-flex;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-radius: 6rpx;
|
||||||
|
padding: 4rpx 10rpx;
|
||||||
|
background-color: rgba(0, 0, 0, 0.3);
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 24rpx;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
&_cover {
|
||||||
|
width: 100%;
|
||||||
|
height: 300rpx;
|
||||||
|
border-radius: 6rpx;
|
||||||
|
}
|
||||||
|
&_info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
box-sizing: border-box;
|
||||||
|
position: relative;
|
||||||
|
&-title {
|
||||||
|
width: calc(100% - 120rpx);
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-top: 8rpx;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
&-desc {
|
||||||
|
margin-top: 6rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #616161;
|
||||||
|
line-height: 1.8;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
}
|
||||||
|
&-link {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 6rpx;
|
||||||
|
display: inline-flex;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-radius: 6rpx;
|
||||||
|
padding: 4rpx 10rpx;
|
||||||
|
border: 2rpx solid #03a9f4;
|
||||||
|
color: #03a9f4;
|
||||||
|
font-size: 24rpx;
|
||||||
|
transform: scale(0.93);
|
||||||
|
// animation: adLinkAni 0.8s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes adLinkAni {
|
||||||
|
0% {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
transform: scale(1.02);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 文本省略样式 开始 */
|
||||||
|
.text-sub-one {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 多行文本省略 */
|
||||||
|
@for $i from 2 through 30 {
|
||||||
|
.text-sub-more-#{$i} {
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: $i;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 文本省略样式 结束 */
|
||||||
|
|
||||||
|
.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,30 +1,23 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="article-card " :class="cardType" @click="fnClickEvent('card')">
|
<view class="article-card " :class="cardType" @click="fnClickEvent('card')">
|
||||||
<view class="left">
|
<view class="left">
|
||||||
<cache-image
|
<cache-image class="thumbnail" radius="6rpx" :url="$utils.checkThumbnailUrl(article.spec.cover)" :fileMd5="article.spec.cover" mode="aspectFill"></cache-image>
|
||||||
class="thumbnail"
|
<!-- <image class="thumbnail" lazy-load :src="$utils.checkThumbnailUrl(article.spec.cover)" mode="aspectFill"></image> -->
|
||||||
radius="12rpx"
|
|
||||||
: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> -->
|
|
||||||
</view>
|
</view>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<view class="title">
|
<view class="title">
|
||||||
<text class="is-top" v-if="article.topped">置顶</text>
|
<text class="is-top bg-gradient-blue-accent" v-if="article.spec.pinned">置顶</text>
|
||||||
<text class="title-text text-overflow">{{ article.title }}</text>
|
<text class="title-text text-overflow">{{ article.spec.title }}</text>
|
||||||
</view>
|
</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="foot">
|
||||||
<view class="create-time">
|
<view class="create-time">
|
||||||
<text class="time-label">发布时间:</text>
|
<text class="time-label">发布时间:</text>
|
||||||
{{ { d: article.createTime, f: 'yyyy-MM-dd' } | formatTime }}
|
{{ { d: article.spec.publishTime, f: 'yyyy-MM-dd' } | formatTime }}
|
||||||
</view>
|
</view>
|
||||||
<view class="visits">
|
<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>
|
||||||
</view>
|
</view>
|
||||||
@@ -33,272 +26,327 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
|
||||||
name: 'article-card',
|
export default {
|
||||||
props: {
|
name: 'article-card',
|
||||||
from: {
|
components: { tmTags },
|
||||||
type: String,
|
props: {
|
||||||
default: ''
|
from: {
|
||||||
},
|
type: String,
|
||||||
article: {
|
default: ''
|
||||||
type: Object,
|
},
|
||||||
default: () => {}
|
article: {
|
||||||
}
|
type: Object,
|
||||||
},
|
default: () => {}
|
||||||
computed: {
|
}
|
||||||
cardType() {
|
},
|
||||||
// tb_image_text=上图下文
|
computed: {
|
||||||
// tb_text_image=上文下图
|
cardType() {
|
||||||
if (this.from == 'home' && this.globalAppSettings.layout.home == 'h_row_col2') {
|
// tb_image_text=上图下文
|
||||||
if (!['tb_image_text', 'tb_text_image', 'only_text'].some(x => x == this.globalAppSettings.layout.cardType)) {
|
// tb_text_image=上文下图
|
||||||
return [this.from, this.globalAppSettings.layout.home, 'tb_image_text'];
|
if (this.from == 'home' && this.globalAppSettings.layout.home == 'h_row_col2') {
|
||||||
}
|
if (!['tb_image_text', 'tb_text_image', 'only_text'].some(x => x == this.globalAppSettings.layout.cardType)) {
|
||||||
return [this.from, this.globalAppSettings.layout.home, this.globalAppSettings.layout.cardType];
|
return [this.from, this.globalAppSettings.layout.home, 'tb_image_text'];
|
||||||
|
}
|
||||||
|
return [this.from, this.globalAppSettings.layout.home, this.globalAppSettings.layout.cardType];
|
||||||
|
}
|
||||||
|
return [this.globalAppSettings.layout.home, this.globalAppSettings.layout.cardType];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fnClickEvent() {
|
||||||
|
this.$emit('on-click', this.article);
|
||||||
}
|
}
|
||||||
return [this.globalAppSettings.layout.home, this.globalAppSettings.layout.cardType];
|
|
||||||
}
|
}
|
||||||
},
|
};
|
||||||
methods: {
|
|
||||||
fnClickEvent() {
|
|
||||||
this.$emit('on-click', this.article);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.article-card {
|
.article-card {
|
||||||
display: flex;
|
display: flex;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
margin: 0 24rpx;
|
margin: 0 24rpx;
|
||||||
padding: 32rpx;
|
padding:22rpx 24rpx;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
background-color: #ffff;
|
background-color: #ffff;
|
||||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-bottom: 24rpx;
|
margin-bottom: 24rpx;
|
||||||
&.home {
|
|
||||||
&.h_row_col2 {
|
&.h_row_col1 {
|
||||||
margin: 12rpx;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.home {
|
||||||
|
&.h_row_col2 {
|
||||||
|
margin: 12rpx;
|
||||||
|
|
||||||
|
.left {
|
||||||
|
width: 100%;
|
||||||
|
height: 200rpx;
|
||||||
|
|
||||||
|
.thumbnail {
|
||||||
|
|
||||||
|
::v-deep uni-image {
|
||||||
|
border-radius: 6rpx 6rpx 0 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
.title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 26rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
.is-top {
|
||||||
|
height: 36rpx;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
vertical-align: 4rpx;
|
||||||
|
transform: scale(0.9);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.foot {
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.create-time {
|
||||||
|
font-size: 24rpx;
|
||||||
|
|
||||||
|
.time-label {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.visits {
|
||||||
|
font-size: 24rpx;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.tb_text_image {
|
||||||
|
padding: 12rpx;
|
||||||
|
|
||||||
|
.left .thumbnail {
|
||||||
|
::v-deep {
|
||||||
|
uni-image {
|
||||||
|
border-radius: 6rpx !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.only_text {
|
||||||
|
padding: 24rpx;
|
||||||
|
|
||||||
|
.right .foot {
|
||||||
|
.create-time {
|
||||||
|
.time-label {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.visits {
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.lr_image_text {}
|
||||||
|
|
||||||
|
&.lr_text_image {
|
||||||
|
.left {
|
||||||
|
order: 2;
|
||||||
|
padding-left: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
order: 1;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.tb_image_text {
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 24rpx;
|
||||||
|
|
||||||
.left {
|
.left {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 200rpx;
|
height: 340rpx;
|
||||||
|
|
||||||
.thumbnail {
|
.thumbnail {
|
||||||
::v-deep uni-image {
|
::v-deep uni-image {
|
||||||
border-radius: 6rpx 6rpx 0 0 !important;
|
border-radius: 6rpx 6rpx 0 0 !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.right {
|
.right {
|
||||||
.title {
|
padding-left: 0;
|
||||||
display: flex;
|
padding: 24rpx 0;
|
||||||
align-items: center;
|
padding-bottom: 0;
|
||||||
font-size: 26rpx;
|
width: 100%;
|
||||||
font-weight: bold;
|
|
||||||
.is-top {
|
|
||||||
height: 36rpx;
|
|
||||||
margin-right: 10rpx;
|
|
||||||
line-height: 36rpx;
|
|
||||||
vertical-align: 4rpx;
|
|
||||||
transform: scale(0.9);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.foot {
|
.foot {
|
||||||
justify-content: space-between;
|
justify-content: flex-start;
|
||||||
.create-time {
|
|
||||||
font-size: 24rpx;
|
|
||||||
.time-label {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.visits {
|
|
||||||
font-size: 24rpx;
|
|
||||||
margin-left: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&.tb_text_image {
|
|
||||||
padding: 12rpx;
|
|
||||||
.left .thumbnail {
|
|
||||||
::v-deep {
|
|
||||||
uni-image {
|
|
||||||
border-radius: 6rpx !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&.only_text {
|
|
||||||
padding: 24rpx;
|
|
||||||
.right .foot {
|
|
||||||
.create-time {
|
|
||||||
.time-label {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.visits {
|
|
||||||
font-size: 24rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&.lr_image_text {
|
|
||||||
}
|
|
||||||
|
|
||||||
&.lr_text_image {
|
.create-time {
|
||||||
.left {
|
.time-label {
|
||||||
order: 2;
|
display: inline-block;
|
||||||
padding-left: 30rpx;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.visits {
|
||||||
|
margin-left: 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.right {
|
|
||||||
order: 1;
|
&.tb_text_image {
|
||||||
padding-left: 0;
|
flex-direction: column;
|
||||||
|
|
||||||
|
.left {
|
||||||
|
width: 100%;
|
||||||
|
height: 340rpx;
|
||||||
|
order: 2;
|
||||||
|
margin-top: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
padding-left: 0;
|
||||||
|
width: 100%;
|
||||||
|
order: 1;
|
||||||
|
|
||||||
|
.foot {
|
||||||
|
justify-content: flex-start;
|
||||||
|
|
||||||
|
.create-time {
|
||||||
|
.time-label {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.visits {
|
||||||
|
margin-left: 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
&.tb_image_text {
|
&.only_text {
|
||||||
flex-direction: column;
|
padding: 36rpx;
|
||||||
padding: 0;
|
|
||||||
|
.left {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
padding-left: 0;
|
||||||
|
|
||||||
|
.content {
|
||||||
|
margin-top: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.foot {
|
||||||
|
justify-content: flex-start;
|
||||||
|
margin-top: 24rpx;
|
||||||
|
|
||||||
|
.create-time {
|
||||||
|
.time-label {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.visits {
|
||||||
|
margin-left: 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.left {
|
.left {
|
||||||
width: 100%;
|
width: 240rpx;
|
||||||
height: 340rpx;
|
height: 180rpx;
|
||||||
|
|
||||||
.thumbnail {
|
.thumbnail {
|
||||||
::v-deep uni-image {
|
width: 100%;
|
||||||
border-radius: 6rpx 6rpx 0 0 !important;
|
height: 100%;
|
||||||
}
|
border-radius: 12rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.right {
|
.right {
|
||||||
padding-left: 0;
|
width: 0;
|
||||||
padding: 24rpx;
|
flex-grow: 1;
|
||||||
width: 100%;
|
display: flex;
|
||||||
.foot {
|
flex-direction: column;
|
||||||
justify-content: flex-start;
|
padding-left: 30rpx;
|
||||||
.create-time {
|
box-sizing: border-box;
|
||||||
.time-label {
|
|
||||||
display: inline-block;
|
.title {
|
||||||
}
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: var(--main-text-color);
|
||||||
|
|
||||||
|
.is-top {
|
||||||
|
height: 40rpx;
|
||||||
|
padding: 0 12rpx;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
line-height: 40rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
white-space: nowrap;
|
||||||
|
vertical-align: 4rpx;
|
||||||
|
color: #fff;
|
||||||
|
// background-image: -webkit-linear-gradient(0deg, #3ca5f6 0, #a86af9 100%);
|
||||||
|
border-radius: 6rpx 12rpx;
|
||||||
|
box-shadow: none !important;
|
||||||
}
|
}
|
||||||
.visits {
|
|
||||||
margin-left: 24rpx;
|
&-text {
|
||||||
|
color: #303133;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
&.tb_text_image {
|
|
||||||
flex-direction: column;
|
|
||||||
.left {
|
|
||||||
width: 100%;
|
|
||||||
height: 340rpx;
|
|
||||||
order: 2;
|
|
||||||
margin-top: 24rpx;
|
|
||||||
}
|
|
||||||
.right {
|
|
||||||
padding-left: 0;
|
|
||||||
width: 100%;
|
|
||||||
order: 1;
|
|
||||||
.foot {
|
|
||||||
justify-content: flex-start;
|
|
||||||
.create-time {
|
|
||||||
.time-label {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.visits {
|
|
||||||
margin-left: 24rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&.only_text {
|
|
||||||
padding: 36rpx;
|
|
||||||
.left {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.right {
|
|
||||||
padding-left: 0;
|
|
||||||
.content {
|
.content {
|
||||||
margin-top: 24rpx;
|
display: -webkit-box;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #909399;
|
||||||
|
height: 80rpx;
|
||||||
|
margin-top: 14rpx;
|
||||||
|
line-height: 42rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.foot {
|
.foot {
|
||||||
justify-content: flex-start;
|
display: flex;
|
||||||
margin-top: 24rpx;
|
font-size: 24rpx;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
color: #909399;
|
||||||
|
margin-top: 18rpx;
|
||||||
|
|
||||||
.create-time {
|
.create-time {
|
||||||
|
font-size: 26rpx;
|
||||||
|
|
||||||
.time-label {
|
.time-label {
|
||||||
display: inline-block;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.visits {
|
.visits {
|
||||||
margin-left: 24rpx;
|
.number {
|
||||||
|
padding: 0 6rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
</style>
|
||||||
.left {
|
|
||||||
width: 240rpx;
|
|
||||||
height: 180rpx;
|
|
||||||
.thumbnail {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
border-radius: 12rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.right {
|
|
||||||
width: 0;
|
|
||||||
flex-grow: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
padding-left: 30rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
.title {
|
|
||||||
display: flex;
|
|
||||||
font-size: 30rpx;
|
|
||||||
color: var(--main-text-color);
|
|
||||||
.is-top {
|
|
||||||
height: 40rpx;
|
|
||||||
padding: 0 12rpx;
|
|
||||||
margin-right: 10rpx;
|
|
||||||
line-height: 40rpx;
|
|
||||||
font-size: 24rpx;
|
|
||||||
white-space: nowrap;
|
|
||||||
vertical-align: 4rpx;
|
|
||||||
color: #fff;
|
|
||||||
background-image: -webkit-linear-gradient(0deg, #3ca5f6 0, #a86af9 100%);
|
|
||||||
border-radius: 4rpx 12rpx;
|
|
||||||
}
|
|
||||||
&-text {
|
|
||||||
color: #303133;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.content {
|
|
||||||
display: -webkit-box;
|
|
||||||
font-size: 26rpx;
|
|
||||||
color: #909399;
|
|
||||||
height: 80rpx;
|
|
||||||
margin-top: 14rpx;
|
|
||||||
line-height: 42rpx;
|
|
||||||
}
|
|
||||||
.foot {
|
|
||||||
display: flex;
|
|
||||||
font-size: 24rpx;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
color: #909399;
|
|
||||||
margin-top: 18rpx;
|
|
||||||
|
|
||||||
.create-time {
|
|
||||||
font-size: 26rpx;
|
|
||||||
.time-label {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.visits {
|
|
||||||
.number {
|
|
||||||
padding: 0 6rpx;
|
|
||||||
font-size: 26rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,197 +1,222 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="article-min-card" :class="[globalAppSettings.layout.cardType]" @click="fnClickEvent('card')">
|
<view class="article-min-card" @click="fnClickEvent('card')">
|
||||||
<view class="left">
|
<view class="left">
|
||||||
<cache-image
|
<cache-image class="thumbnail" radius="6rpx" :url="$utils.checkThumbnailUrl(article.spec.cover)" :fileMd5="article.spec.cover"
|
||||||
class="thumbnail"
|
mode="aspectFill"></cache-image>
|
||||||
radius="12rpx"
|
</view>
|
||||||
:url="$utils.checkThumbnailUrl(article.thumbnail)"
|
<view class="right">
|
||||||
:fileMd5="$utils.checkThumbnailUrl(article.thumbnail)"
|
<view class="title text-overflow">{{ article.spec.title }}</view>
|
||||||
mode="aspectFill"
|
<view class="content text-overflow">{{ article.status.excerpt }}</view>
|
||||||
></cache-image>
|
<view class="foot">
|
||||||
</view>
|
<view class="create-time">
|
||||||
<view class="right">
|
<text class="time-label">发布时间:</text>
|
||||||
<view class="title text-overflow">{{ article.title }}</view>
|
{{ {d: article.spec.publishTime, f: 'yyyy-MM-dd'} | formatTime }}
|
||||||
<view class="content text-overflow">{{ article.summary }}</view>
|
</view>
|
||||||
<view class="foot">
|
<view class="visits">
|
||||||
<view class="create-time">
|
浏览
|
||||||
<!-- <text class="icon iconfont icon-clock"></text> -->
|
<text class="number">{{ article.stats.visit }}</text>
|
||||||
<text class="time-label">发布时间:</text>
|
次
|
||||||
{{ { d: article.createTime, f: 'yyyy-MM-dd' } | formatTime }}
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="visits">
|
</view>
|
||||||
<!-- <text class="icon iconfont icon-eye"></text> -->
|
</view>
|
||||||
浏览
|
|
||||||
<text class="number">{{ article.visits }}</text>
|
|
||||||
次
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'article-min-card',
|
name: 'article-min-card',
|
||||||
props: {
|
props: {
|
||||||
article: {
|
article: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {}
|
default: () => {
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
methods: {
|
},
|
||||||
fnClickEvent() {
|
methods: {
|
||||||
this.$emit('on-click', this.article);
|
fnClickEvent() {
|
||||||
}
|
this.$emit('on-click', this.article);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.article-min-card {
|
.article-min-card {
|
||||||
display: flex;
|
display: flex;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
background-color: #ffff;
|
background-color: #ffff;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin: 12rpx 24rpx;
|
margin: 12rpx 24rpx;
|
||||||
margin-bottom: 24rpx;
|
margin-bottom: 24rpx;
|
||||||
padding: 16rpx;
|
padding: 16rpx;
|
||||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.05);
|
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||||
&.lr_image_text {
|
|
||||||
}
|
|
||||||
|
|
||||||
&.lr_text_image {
|
&.lr_image_text {
|
||||||
.left {
|
}
|
||||||
order: 2;
|
|
||||||
padding-left: 30rpx;
|
|
||||||
}
|
|
||||||
.right {
|
|
||||||
order: 1;
|
|
||||||
padding-left: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&.tb_image_text {
|
|
||||||
flex-direction: column;
|
|
||||||
.left {
|
|
||||||
width: 100%;
|
|
||||||
height: 220rpx;
|
|
||||||
}
|
|
||||||
.right {
|
|
||||||
padding-left: 0;
|
|
||||||
width: 100%;
|
|
||||||
.title {
|
|
||||||
margin-top: 24rpx;
|
|
||||||
}
|
|
||||||
.foot {
|
|
||||||
justify-content: flex-start;
|
|
||||||
.create-time {
|
|
||||||
.time-label {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.visits {
|
|
||||||
margin-left: 24rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&.tb_text_image {
|
|
||||||
flex-direction: column;
|
|
||||||
.left {
|
|
||||||
width: 100%;
|
|
||||||
height: 220rpx;
|
|
||||||
order: 2;
|
|
||||||
margin-top: 20rpx;
|
|
||||||
}
|
|
||||||
.right {
|
|
||||||
padding-left: 0;
|
|
||||||
width: 100%;
|
|
||||||
order: 1;
|
|
||||||
.foot {
|
|
||||||
justify-content: flex-start;
|
|
||||||
.create-time {
|
|
||||||
.time-label {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.visits {
|
|
||||||
margin-left: 24rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&.only_text {
|
|
||||||
.left {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.right {
|
|
||||||
padding-left: 0;
|
|
||||||
.foot {
|
|
||||||
justify-content: flex-start;
|
|
||||||
.create-time {
|
|
||||||
.time-label {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.visits {
|
|
||||||
margin-left: 24rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.left {
|
&.lr_text_image {
|
||||||
width: 180rpx;
|
.left {
|
||||||
height: 130rpx;
|
order: 2;
|
||||||
.thumbnail {
|
padding-left: 30rpx;
|
||||||
width: 100%;
|
}
|
||||||
height: 100%;
|
|
||||||
border-radius: 12rpx;
|
.right {
|
||||||
}
|
order: 1;
|
||||||
}
|
padding-left: 0;
|
||||||
.right {
|
}
|
||||||
width: 0;
|
}
|
||||||
flex-grow: 1;
|
|
||||||
display: flex;
|
&.tb_image_text {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding-left: 24rpx;
|
|
||||||
.title {
|
.left {
|
||||||
font-size: 28rpx;
|
width: 100%;
|
||||||
font-weight: 600;
|
height: 220rpx;
|
||||||
color: var(--main-text-color);
|
}
|
||||||
}
|
|
||||||
.content {
|
.right {
|
||||||
font-size: 26rpx;
|
padding-left: 0;
|
||||||
color: #909399;
|
width: 100%;
|
||||||
margin-top: 14rpx;
|
|
||||||
}
|
.title {
|
||||||
.foot {
|
margin-top: 24rpx;
|
||||||
display: flex;
|
}
|
||||||
font-size: 24rpx;
|
|
||||||
justify-content: space-between;
|
.foot {
|
||||||
align-items: center;
|
justify-content: flex-start;
|
||||||
color: #909399;
|
|
||||||
margin-top: 14rpx;
|
.create-time {
|
||||||
.create-time {
|
.time-label {
|
||||||
font-size: 24rpx;
|
display: inline-block;
|
||||||
.time-label {
|
}
|
||||||
display: none;
|
}
|
||||||
}
|
|
||||||
.icon {
|
.visits {
|
||||||
font-size: 24rpx;
|
margin-left: 24rpx;
|
||||||
padding-right: 4rpx;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.visits {
|
}
|
||||||
.icon {
|
|
||||||
font-size: 28rpx;
|
&.tb_text_image {
|
||||||
}
|
flex-direction: column;
|
||||||
.number {
|
|
||||||
padding: 0 6rpx;
|
.left {
|
||||||
font-size: 24rpx;
|
width: 100%;
|
||||||
}
|
height: 220rpx;
|
||||||
}
|
order: 2;
|
||||||
}
|
margin-top: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
padding-left: 0;
|
||||||
|
width: 100%;
|
||||||
|
order: 1;
|
||||||
|
|
||||||
|
.foot {
|
||||||
|
justify-content: flex-start;
|
||||||
|
|
||||||
|
.create-time {
|
||||||
|
.time-label {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.visits {
|
||||||
|
margin-left: 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.only_text {
|
||||||
|
.left {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
padding-left: 0;
|
||||||
|
|
||||||
|
.foot {
|
||||||
|
justify-content: flex-start;
|
||||||
|
|
||||||
|
.create-time {
|
||||||
|
.time-label {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.visits {
|
||||||
|
margin-left: 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.left {
|
||||||
|
width: 180rpx;
|
||||||
|
height: 130rpx;
|
||||||
|
|
||||||
|
.thumbnail {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.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);
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
|
||||||
|
.create-time {
|
||||||
|
font-size: 24rpx;
|
||||||
|
|
||||||
|
.time-label {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
font-size: 24rpx;
|
||||||
|
padding-right: 4rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.visits {
|
||||||
|
.icon {
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.number {
|
||||||
|
padding: 0 6rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</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,15 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<view style="overflow: hidden;position: fixed;width: 100%;height: 100%;pointer-events: none; top: 0;">
|
<view class="barrage-wrap" :class="[type]">
|
||||||
<view class="danmu-li" v-for="(item, index) in listData" :class="item.type" :style="item.style" :key="index">
|
<view class="danmu-li" v-for="(item, index) in listData" :class="[type, item.type]" :style="[item.style]" :key="index">
|
||||||
<view class="danmu-inner">
|
<view class="danmu-inner">
|
||||||
<view class="user-box">
|
<view class="user-box">
|
||||||
<view class="user-img">
|
<view class="user-img"><image class="avatar" :src="item.item.avatar"></image></view>
|
||||||
<view class="img-box">
|
<view class="user-text cl1">{{ item.item.author }}</view>
|
||||||
<image :src="item.avatar || 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=317894666,3379114684&fm=26&gp=0.jpg'"></image>
|
<view class="user-status cl1">{{ item.item.content }}</view>
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="user-text cl1">{{ item.nickName }}</view>
|
|
||||||
<view class="user-status cl1">{{ item.text }}</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -18,11 +14,17 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
//rightToLeft leftToRight leftBottom
|
// rightToLeft leftToRight leftBottom
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'rightToLeft'
|
default: 'rightToLeft'
|
||||||
},
|
},
|
||||||
|
list: {
|
||||||
|
type: Array,
|
||||||
|
default() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
},
|
||||||
minTime: {
|
minTime: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 4
|
default: 4
|
||||||
@@ -43,34 +45,34 @@ export default {
|
|||||||
//轨道高度
|
//轨道高度
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 40
|
default: 40
|
||||||
},
|
|
||||||
noStacked: {
|
|
||||||
//不允许堆叠(暂不可用)
|
|
||||||
type: Array,
|
|
||||||
default() {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
closeTimer: null,
|
||||||
listData: []
|
listData: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.hrackNum = Math.floor((this.maxTop - this.minTop) / this.hrackH);
|
//leftBottom 使用参数
|
||||||
|
if (this.type === 'leftBottom') {
|
||||||
|
this.hrackNum = Math.floor(this.maxTop / this.hrackH);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
add(obj) {
|
add(obj) {
|
||||||
|
this.isShow = true;
|
||||||
|
this.showFlag = true;
|
||||||
let data = {
|
let data = {
|
||||||
item: obj.item,
|
...obj,
|
||||||
id: Date.parse(new Date()),
|
id: Date.parse(new Date()),
|
||||||
time: Math.ceil(Math.floor(Math.random() * (this.maxTime - this.minTime + 1) + this.minTime)),
|
time: Math.ceil(Math.floor(Math.random() * (this.maxTime - this.minTime + 1) + this.minTime)),
|
||||||
type: this.type
|
type: this.type
|
||||||
};
|
};
|
||||||
if (this.type === 'leftBottom') {
|
if (this.type === 'leftBottom') {
|
||||||
let objData = {
|
let objData = {
|
||||||
item: data.item,
|
item: data,
|
||||||
type: 'leftBottomEnter',
|
type: 'leftBottomEnter',
|
||||||
style: {
|
style: {
|
||||||
transition: `all 0.5s`,
|
transition: `all 0.5s`,
|
||||||
@@ -88,7 +90,7 @@ export default {
|
|||||||
} else if (this.listData[i].status === 'reset') {
|
} else if (this.listData[i].status === 'reset') {
|
||||||
//重置
|
//重置
|
||||||
this.listData[i].style.transition = 'none';
|
this.listData[i].style.transition = 'none';
|
||||||
this.listData[i].style.bottom = 0;
|
this.listData[i].style.bottom = '6px';
|
||||||
this.listData[i].status = 'reuse';
|
this.listData[i].status = 'reuse';
|
||||||
} else if (this.listData[i].status === 'recycle') {
|
} else if (this.listData[i].status === 'recycle') {
|
||||||
//回收
|
//回收
|
||||||
@@ -105,8 +107,16 @@ export default {
|
|||||||
if (listLen < hrackNum + 2) {
|
if (listLen < hrackNum + 2) {
|
||||||
this.listData.push(objData);
|
this.listData.push(objData);
|
||||||
}
|
}
|
||||||
} else if (this.type === 'rightToLeft' || this.type === 'leftToRight') {
|
} else if (this.type === 'rightToLeft') {
|
||||||
let objData = this.horStacked(data);
|
let objData = {
|
||||||
|
item: data,
|
||||||
|
type: 'rightToLeft',
|
||||||
|
style: {
|
||||||
|
animationDuration: `${data.time}s`,
|
||||||
|
top: `${Math.ceil(Math.random() * (this.maxTop - this.minTop + 1) + this.minTop)}px`
|
||||||
|
},
|
||||||
|
delTime: Date.parse(new Date()) + data.time * 1200
|
||||||
|
};
|
||||||
for (let i in this.listData) {
|
for (let i in this.listData) {
|
||||||
if (this.listData[i].delTime <= Date.parse(new Date())) {
|
if (this.listData[i].delTime <= Date.parse(new Date())) {
|
||||||
this.repaint(i, objData.type);
|
this.repaint(i, objData.type);
|
||||||
@@ -118,16 +128,50 @@ export default {
|
|||||||
this.listData.push(objData);
|
this.listData.push(objData);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
horStacked(data) {
|
async remove(options = {}) {
|
||||||
return {
|
if (this.type == 'rightToLeft') {
|
||||||
item: data.item,
|
if (this.listData.length != 0) {
|
||||||
type: this.type,
|
const last = this.listData[this.listData.length - 1];
|
||||||
style: {
|
setTimeout(() => {
|
||||||
animationDuration: `${data.time}s`,
|
this.listData = [];
|
||||||
top: `${Math.ceil(Math.random() * (this.maxTop - this.minTop + 1) + this.minTop)}px`
|
}, last.item.time * 1200 + 1000);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
options = Object.assign(
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
duration: 5000, // 延迟关闭的时间
|
||||||
|
speed: 1000 // 弹幕消失的速度
|
||||||
},
|
},
|
||||||
delTime: Date.parse(new Date()) + data.time * 1200
|
options
|
||||||
|
);
|
||||||
|
|
||||||
|
const _fnHandleRemove = item => {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
setTimeout(() => {
|
||||||
|
// item['type'] = 'leftBottomExitLeft';
|
||||||
|
item['type'] = 'is-hide';
|
||||||
|
resolve();
|
||||||
|
}, options.speed);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
const _fnHandleLoop = item => {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
setTimeout(async () => {
|
||||||
|
for (var i = 0; i < this.listData.length; i++) {
|
||||||
|
await _fnHandleRemove(this.listData[i]);
|
||||||
|
}
|
||||||
|
resolve();
|
||||||
|
}, options.duration);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
await _fnHandleLoop();
|
||||||
|
setTimeout(() => {
|
||||||
|
this.listData = [];
|
||||||
|
}, options.duration + 200);
|
||||||
},
|
},
|
||||||
repaint(index, type) {
|
repaint(index, type) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -137,8 +181,8 @@ export default {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style></style>
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
@keyframes leftBottomEnter {
|
@keyframes leftBottomEnter {
|
||||||
0% {
|
0% {
|
||||||
transform: translateY(100%);
|
transform: translateY(100%);
|
||||||
@@ -163,6 +207,20 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keyframes leftBottomExitLeft {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0%);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
transform: translateX(-50%);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-100%);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@keyframes leftToRight {
|
@keyframes leftToRight {
|
||||||
0% {
|
0% {
|
||||||
transform: translateX(-100%);
|
transform: translateX(-100%);
|
||||||
@@ -182,13 +240,38 @@ export default {
|
|||||||
transform: translateX(-100%);
|
transform: translateX(-100%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.barrage-wrap {
|
||||||
|
position: fixed;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
pointer-events: none;
|
||||||
|
top: 0;
|
||||||
|
z-index: 99;
|
||||||
|
transition: all 1s ease-in-out;
|
||||||
|
&.leftBottom {
|
||||||
|
top: initial;
|
||||||
|
/* #ifdef H5 */
|
||||||
|
bottom: 130rpx;
|
||||||
|
/* #endif */
|
||||||
|
/* #ifndef H5 */
|
||||||
|
bottom: 36rpx;
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
}
|
||||||
.danmu-li {
|
.danmu-li {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
transform: translateX(100%);
|
transform: translateX(100%);
|
||||||
animation-timing-function: linear;
|
animation-timing-function: linear;
|
||||||
|
transition: all 0.5s ease-in-out;
|
||||||
|
opacity: 1;
|
||||||
|
&.is-hide {
|
||||||
|
opacity: 0;
|
||||||
|
// transform: translateX(-100%) !important;
|
||||||
|
}
|
||||||
|
&.leftBottom {
|
||||||
|
left: 24rpx;
|
||||||
|
}
|
||||||
&.leftBottomEnter {
|
&.leftBottomEnter {
|
||||||
animation-name: leftBottomEnter;
|
animation-name: leftBottomEnter;
|
||||||
}
|
}
|
||||||
@@ -196,53 +279,59 @@ export default {
|
|||||||
animation-name: leftBottomExit;
|
animation-name: leftBottomExit;
|
||||||
animation-fill-mode: forwards;
|
animation-fill-mode: forwards;
|
||||||
}
|
}
|
||||||
|
&.leftBottomExitLeft {
|
||||||
|
animation-name: leftBottomExitLeft;
|
||||||
|
animation-fill-mode: forwards;
|
||||||
|
}
|
||||||
&.rightToLeft {
|
&.rightToLeft {
|
||||||
animation-name: rightToLeft;
|
animation-name: rightToLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.leftToRight {
|
&.leftToRight {
|
||||||
animation-name: leftToRight;
|
animation-name: rightToLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
.danmu-inner {
|
.danmu-inner {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
font-size: 24rpx;
|
||||||
.user-box {
|
.user-box {
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 3rpx 40rpx 3rpx 10rpx;
|
padding: 6rpx 40rpx 6rpx 10rpx;
|
||||||
background: rgba(0, 0, 0, 0.3);
|
background: rgba(0, 0, 0, 0.3);
|
||||||
border-radius: 32rpx;
|
border-radius: 32rpx;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.user-img {
|
.user-img {
|
||||||
.img-box {
|
display: flex;
|
||||||
display: flex;
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
image {
|
.avatar {
|
||||||
width: 58rpx;
|
width: 42rpx;
|
||||||
height: 58rpx;
|
height: 42rpx;
|
||||||
background: rgba(55, 55, 55, 1);
|
background: rgba(55, 55, 55, 1);
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-status {
|
.user-status {
|
||||||
margin-left: 10rpx;
|
margin-left: 10rpx;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
font-size: 28rpx;
|
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: rgba(255, 255, 255, 1);
|
color: rgba(255, 255, 255, 1);
|
||||||
|
max-width: 320rpx;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-text {
|
.user-text {
|
||||||
|
max-width: 100rpx;
|
||||||
margin-left: 10rpx;
|
margin-left: 10rpx;
|
||||||
// white-space: nowrap;
|
|
||||||
font-size: 28rpx;
|
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
width: 80rpx;
|
|
||||||
color: rgba(255, 255, 255, 1);
|
color: rgba(255, 255, 255, 1);
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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,185 +1,198 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="cache-image">
|
<view class="cache-image-wrap">
|
||||||
<view v-if="loadStatus == 'loading'" class="img-loading" :style="[imgStyle, loadStyle]">
|
<view v-if="loadStatus == 'loading'" class="img-loading" :style="[imgStyle, loadStyle]">
|
||||||
<!-- <text class="img-load-icon iconfont icon-loading"></text>
|
<!-- <text class="img-load-icon iconfont icon-loading"></text>
|
||||||
<text class="img-load-text">{{ loadText }}</text> -->
|
<text class="img-load-text">{{ loadText }}</text> -->
|
||||||
<image :src="loadingImgSrc" :style="[imgStyle]" mode="aspectFit"></image>
|
<image :src="loadingImgSrc" :style="[loadingImgStyle]" mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="loadStatus == 'error'" class="img-error" :style="[imgStyle, loadErrStyle]">
|
<view v-if="loadStatus == 'error'" class="img-error" :style="[imgStyle, loadErrStyle]">
|
||||||
<text class="img-err-icon iconfont icon-exclamation-circle"></text>
|
<!-- <text class="img-err-icon iconfont icon-exclamation-circle"></text>
|
||||||
<text class="img-load-text">{{ loadErrText }}</text>
|
<text class="img-load-text">{{ loadErrText }}</text> -->
|
||||||
</view>
|
<image class="img-error-img" :src="loadingErrorImageSrc" mode="scaleToFill"></image>
|
||||||
<image
|
</view>
|
||||||
v-show="loadStatus == 'success'"
|
<image v-show="loadStatus == 'success'" :src="src" @load="fnOnLoad" @error="fnOnError" :lazy-load="lazyLoad"
|
||||||
:src="src"
|
:style="[imgStyle]" :mode="mode" @click="$emit('on-click', url)"></image>
|
||||||
@load="fnOnLoad"
|
</view>
|
||||||
@error="fnOnError"
|
|
||||||
:lazy-load="lazyLoad"
|
|
||||||
:style="[imgStyle]"
|
|
||||||
:mode="mode"
|
|
||||||
@click="$emit('on-click', url)"
|
|
||||||
></image>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import imageCache from '@/utils/imageCache.js';
|
import imageCache from '@/utils/imageCache.js';
|
||||||
export default {
|
|
||||||
name: 'cache-image',
|
|
||||||
props: {
|
|
||||||
url: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
lazyLoad: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
},
|
|
||||||
loadStyle: {
|
|
||||||
type: Object,
|
|
||||||
default() {
|
|
||||||
return {
|
|
||||||
backgroundColor: '#ffffff',
|
|
||||||
color: '#333'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
},
|
|
||||||
loadErrStyle: {
|
|
||||||
type: Object,
|
|
||||||
default() {
|
|
||||||
return {
|
|
||||||
color: 'rgba(244, 67, 54,1)'
|
|
||||||
// backgroundColor: 'rgba(244, 67, 54,0.2)'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mode: {
|
|
||||||
type: String,
|
|
||||||
default: 'aspectFill'
|
|
||||||
},
|
|
||||||
loadText: {
|
|
||||||
type: String,
|
|
||||||
default: '加载中...'
|
|
||||||
},
|
|
||||||
loadErrText: {
|
|
||||||
type: String,
|
|
||||||
default: '加载失败'
|
|
||||||
},
|
|
||||||
fileMd5: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
styles: {
|
|
||||||
type: Object,
|
|
||||||
default() {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
},
|
|
||||||
width: {
|
|
||||||
type: String,
|
|
||||||
default: '100%'
|
|
||||||
},
|
|
||||||
height: {
|
|
||||||
type: String,
|
|
||||||
default: '100%'
|
|
||||||
},
|
|
||||||
radius: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
imgStyle: {},
|
|
||||||
src: '', // 图片地址
|
|
||||||
loadStatus: 'loading'
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
loadingImgSrc() {
|
|
||||||
return getApp().globalData.loadingGifUrl;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
// 监听图片md5值的变化
|
|
||||||
fileMd5(val) {
|
|
||||||
// 查找获取图片缓存
|
|
||||||
this.fnGetImageCache();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
console.log('cache-image', this.url);
|
|
||||||
this.imgStyle = {
|
|
||||||
width: this.width,
|
|
||||||
height: this.height,
|
|
||||||
borderRadius: this.radius,
|
|
||||||
...this.styles
|
|
||||||
};
|
|
||||||
|
|
||||||
// 查找获取图片缓存
|
export default {
|
||||||
this.fnGetImageCache();
|
name: 'cache-image',
|
||||||
},
|
props: {
|
||||||
methods: {
|
url: {
|
||||||
// 查找获取图片缓存
|
type: String,
|
||||||
async fnGetImageCache() {
|
default: ''
|
||||||
// #ifdef APP-PLUS
|
},
|
||||||
var result = await imageCache.getImageCache(this.url, this.fileMd5);
|
lazyLoad: {
|
||||||
if (result) {
|
type: Boolean,
|
||||||
this.src = result;
|
default: true
|
||||||
} else {
|
},
|
||||||
this.src = this.url;
|
loadStyle: {
|
||||||
}
|
type: Object,
|
||||||
// #endif
|
default() {
|
||||||
// #ifndef APP-PLUS
|
return {
|
||||||
this.src = this.url;
|
backgroundColor: '#ffffff',
|
||||||
// #endif
|
color: '#333'
|
||||||
},
|
};
|
||||||
fnOnLoad() {
|
}
|
||||||
this.loadStatus = 'success';
|
},
|
||||||
},
|
loadErrStyle: {
|
||||||
fnOnError() {
|
type: Object,
|
||||||
this.loadStatus = 'error';
|
default() {
|
||||||
}
|
return {
|
||||||
}
|
color: 'rgba(244, 67, 54,1)'
|
||||||
|
// backgroundColor: 'rgba(244, 67, 54,0.2)'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mode: {
|
||||||
|
type: String,
|
||||||
|
default: 'aspectFill'
|
||||||
|
},
|
||||||
|
loadText: {
|
||||||
|
type: String,
|
||||||
|
default: '加载中...'
|
||||||
|
},
|
||||||
|
loadErrText: {
|
||||||
|
type: String,
|
||||||
|
default: '加载失败'
|
||||||
|
},
|
||||||
|
fileMd5: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
styles: {
|
||||||
|
type: Object,
|
||||||
|
default() {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
width: {
|
||||||
|
type: String,
|
||||||
|
default: '100%'
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: String,
|
||||||
|
default: '100%'
|
||||||
|
},
|
||||||
|
radius: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
imgStyle: {},
|
||||||
|
loadingImgStyle: {
|
||||||
|
width: '120rpx',
|
||||||
|
},
|
||||||
|
src: '', // 图片地址
|
||||||
|
loadStatus: 'loading'
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
imagesConfig() {
|
||||||
|
return this.$tm.vx.getters().getConfigs.imagesConfig
|
||||||
|
},
|
||||||
|
loadingImgSrc() {
|
||||||
|
return this.$utils.checkImageUrl(this.imagesConfig.loadingGifUrl);
|
||||||
|
},
|
||||||
|
loadingErrorImageSrc() {
|
||||||
|
return this.$utils.checkImageUrl(this.imagesConfig.loadingErrUrl)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
// 监听图片md5值的变化
|
||||||
|
fileMd5(val) {
|
||||||
|
// 查找获取图片缓存
|
||||||
|
this.fnGetImageCache();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.imgStyle = {
|
||||||
|
width: this.width,
|
||||||
|
height: this.height,
|
||||||
|
borderRadius: this.radius,
|
||||||
|
...this.styles
|
||||||
|
};
|
||||||
|
|
||||||
|
// 查找获取图片缓存
|
||||||
|
this.fnGetImageCache();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 查找获取图片缓存
|
||||||
|
async fnGetImageCache() {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
var result = await imageCache.getImageCache(this.url, this.fileMd5);
|
||||||
|
if (result) {
|
||||||
|
this.src = result;
|
||||||
|
} else {
|
||||||
|
this.src = this.url;
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
// #ifndef APP-PLUS
|
||||||
|
this.src = this.url;
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
fnOnLoad() {
|
||||||
|
this.loadStatus = 'success';
|
||||||
|
},
|
||||||
|
fnOnError(e) {
|
||||||
|
this.loadStatus = 'error';
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.cache-image {
|
.cache-image-wrap {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.img-loading,
|
.img-loading,
|
||||||
.img-error {
|
.img-error {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background-color: #f2f2f2;
|
background-color: #f2f2f2;
|
||||||
}
|
}
|
||||||
.img-load-icon {
|
|
||||||
font-size: 36rpx;
|
|
||||||
animation: xhRote 0.8s infinite linear;
|
|
||||||
}
|
|
||||||
.img-load-text {
|
|
||||||
font-size: 28rpx;
|
|
||||||
margin-top: 8rpx;
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
.img-error {
|
|
||||||
font-size: 28rpx;
|
|
||||||
}
|
|
||||||
.img-err-icon {
|
|
||||||
font-size: 36rpx;
|
|
||||||
}
|
|
||||||
@keyframes xhRote {
|
|
||||||
0% {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
.img-load-icon {
|
||||||
transform: rotate(360deg);
|
font-size: 36rpx;
|
||||||
}
|
animation: xhRote 0.8s infinite linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
.img-load-text {
|
||||||
|
font-size: 28rpx;
|
||||||
|
margin-top: 8rpx;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.img-error {
|
||||||
|
font-size: 28rpx;
|
||||||
|
|
||||||
|
&-img {
|
||||||
|
width: 100%;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.img-err-icon {
|
||||||
|
font-size: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes xhRote {
|
||||||
|
0% {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,63 +1,79 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="category-mini-card">
|
<view class="category-mini-card">
|
||||||
<!-- <image class="img" lazy-load :src="$utils.checkThumbnailUrl(category.thumbnail)" mode="aspectFill"></image> -->
|
<cache-image class="img" height="180rpx" :url="$utils.checkThumbnailUrl(category.spec.cover,false)"
|
||||||
<cache-image
|
:fileMd5="$utils.checkThumbnailUrl(category.spec.cover)" mode="aspectFill"></cache-image>
|
||||||
class="img"
|
<view class="content">
|
||||||
height="120rpx"
|
<view class="name">{{ category.spec.displayName }}</view>
|
||||||
:url="$utils.checkThumbnailUrl(category.thumbnail)"
|
<text class="label">共 {{ category.postCount }} 篇</text>
|
||||||
:fileMd5="$utils.checkThumbnailUrl(category.thumbnail)"
|
</view>
|
||||||
mode="aspectFill"
|
|
||||||
></cache-image>
|
|
||||||
|
|
||||||
<text class="label">{{ category.postCount }} 篇</text>
|
|
||||||
<view class="name">{{ category.name }}</view>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'category-mini-card',
|
name: 'category-mini-card',
|
||||||
props: {
|
props: {
|
||||||
category: {
|
category: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {}
|
default: () => {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.category-mini-card {
|
.category-mini-card {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 260rpx;
|
width: 260rpx;
|
||||||
height: 180rpx;
|
height: 180rpx;
|
||||||
position: relative;
|
position: relative;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
// border: 2rpx solid #f7f7f7;
|
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
position: relative;
|
||||||
.img {
|
|
||||||
width: 100%;
|
|
||||||
height: 120rpx;
|
|
||||||
border: 6rpx 6rpx 0 0;
|
|
||||||
}
|
|
||||||
.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 {
|
|
||||||
font-size: 24rpx;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: var(--main-text-color);
|
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>
|
<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">
|
<view class="comment-item_user flex">
|
||||||
<image
|
<image class="user-avatar" :class="{ 'is-radius': globalAppSettings.isAvatarRadius }"
|
||||||
v-if="comment.isAdmin"
|
:src="$utils.checkAvatarUrl(comment.owner.avatar, false)" mode="aspectFill"
|
||||||
class="user-avatar"
|
@error="fnOnImageError(comment)"></image>
|
||||||
: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>
|
|
||||||
<view class="user-info pl-14">
|
<view class="user-info pl-14">
|
||||||
<view class="author">
|
<view class="author">
|
||||||
<text class="mr-6 text-grey-darken-1 text-size-m">{{ comment.author }}</text>
|
<text class="mr-6 text-grey-darken-1 text-size-m">{{ comment.owner.displayName }}</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>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="flex mt-4">
|
<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">
|
<view class="time text-size-xs text-grey">
|
||||||
<text class="">{{ $tm.dayjs(comment.createTime).format('YYYY年MM月DD日') }}</text>
|
<text class="">{{ $tm.dayjs(comment.spec.creationTime).format('YYYY年MM月DD日') }}</text>
|
||||||
<text class="ml-12">{{ $tm.dayjs(comment.createTime).fromNow(true) }}前</text>
|
<text class="ml-12">{{ $tm.dayjs(comment.spec.creationTime).fromNow(true) }}前</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="useActions" class="">
|
<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 v-if="!disallowComment" size="s" text theme="blue"
|
||||||
<tm-button size="s" text theme="grey" @click="$emit('on-copy', comment.content)">复制</tm-button>
|
@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>
|
</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 class="comment-item_content mt-12" :class="{ 'has-bg': useContentBg, 'not-ml': isChild }"
|
||||||
<!-- <view v-if="useActions" class="comment-item_info text-size-s text-grey">
|
@click="$emit('on-detail', comment)" v-html="comment.spec.raw"></view>
|
||||||
<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>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
|
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
|
||||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||||
export default {
|
export default {
|
||||||
name: 'comment-item',
|
name: 'comment-item',
|
||||||
components: { tmTags, tmButton },
|
components: {
|
||||||
props: {
|
tmTags,
|
||||||
classItem: {
|
tmButton
|
||||||
type: Array,
|
|
||||||
default: () => []
|
|
||||||
},
|
},
|
||||||
disallowComment: {
|
props: {
|
||||||
type: Boolean,
|
classItem: {
|
||||||
default: false
|
type: Array,
|
||||||
},
|
default: () => []
|
||||||
useActions: {
|
},
|
||||||
type: Boolean,
|
disallowComment: {
|
||||||
default: true
|
type: Boolean,
|
||||||
},
|
default: false
|
||||||
useSolid: {
|
},
|
||||||
type: Boolean,
|
useActions: {
|
||||||
default: true
|
type: Boolean,
|
||||||
},
|
default: true
|
||||||
useContentBg: {
|
},
|
||||||
type: Boolean,
|
useSolid: {
|
||||||
default: true
|
type: Boolean,
|
||||||
},
|
default: true
|
||||||
isChild: {
|
},
|
||||||
type: Boolean,
|
useContentBg: {
|
||||||
default: false
|
type: Boolean,
|
||||||
},
|
default: true
|
||||||
postId: {
|
},
|
||||||
type: Number,
|
isChild: {
|
||||||
default: null
|
type: Boolean,
|
||||||
},
|
default: false
|
||||||
comment: {
|
},
|
||||||
type: Object,
|
postName: {
|
||||||
default: () => {}
|
type: String,
|
||||||
}
|
default: ""
|
||||||
},
|
},
|
||||||
computed: {
|
comment: {
|
||||||
// 获取博主信息
|
type: Object,
|
||||||
bloggerInfo() {
|
default: () => null
|
||||||
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()}`;
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
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>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.comment-item {
|
.comment-item {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border-top: 2rpx solid #f5f5f5;
|
border-top: 2rpx solid #f5f5f5;
|
||||||
|
|
||||||
&.child-comment-item {
|
&.child-comment-item {
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
margin-left: 80rpx;
|
margin-left: 80rpx;
|
||||||
border: 0;
|
border: 0;
|
||||||
}
|
}
|
||||||
&.no-solid {
|
|
||||||
border: 0;
|
&.no-solid {
|
||||||
margin-top: 0 !important;
|
border: 0;
|
||||||
}
|
margin-top: 0 !important;
|
||||||
&_user {
|
}
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
&_user {
|
||||||
.user-avatar {
|
display: flex;
|
||||||
width: 70rpx;
|
align-items: center;
|
||||||
height: 70rpx;
|
|
||||||
box-sizing: border-box;
|
.user-avatar {
|
||||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.05);
|
width: 70rpx;
|
||||||
border: 4rpx solid #ffffff;
|
height: 70rpx;
|
||||||
border-radius: 12rpx;
|
box-sizing: border-box;
|
||||||
&.is-radius {
|
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.05);
|
||||||
border-radius: 50%;
|
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 {
|
&_content {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
margin-left: 80rpx;
|
margin-left: 80rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
line-height: 1.8;
|
line-height: 1.8;
|
||||||
color: var(--main-text-color);
|
color: var(--main-text-color);
|
||||||
&.has-bg {
|
|
||||||
background-color: #fafafa;
|
&.has-bg {
|
||||||
padding: 6rpx 24rpx;
|
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;
|
margin-left: 80rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&_info {
|
</style>
|
||||||
margin-top: 6rpx;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-left: 80rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,88 +1,70 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="comment-list">
|
<view class="comment-list">
|
||||||
<!-- 顶部区域 -->
|
<!-- 顶部区域 -->
|
||||||
<view class="comment-list_head">
|
<view class="comment-list_head">
|
||||||
<view class="title">
|
<view class="title">
|
||||||
评论列表
|
<text>评论列表</text>
|
||||||
<text class="count">({{ result.total || 0 }}条)</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>
|
||||||
<view class="filter">
|
</view>
|
||||||
<text class="filter-item " :class="{ active: sort == 0 }" @click="fnOnSort(0)">默认</text>
|
<!-- 内容区域 -->
|
||||||
<text class="filter-item " :class="{ active: sort == 1 }" @click="fnOnSort(1)">热评</text>
|
<view class="comment-list_content">
|
||||||
<!-- <text class="filter-item">全部</text> -->
|
<view v-if="loading !== 'success'" class="loading-wrap flex">
|
||||||
</view>
|
<view v-if="loading === 'loading'" class="loading flex flex-center flex-col">
|
||||||
</view>
|
<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 class="comment-list_content">
|
</view>
|
||||||
<view v-if="loading != 'success'" class="loading-wrap flex">
|
<view v-else-if="loading === 'error'" class="error">
|
||||||
<view v-if="loading == 'loading'" class="loading flex flex-center flex-col">
|
<tm-empty icon="icon-wind-cry" label="加载失败">
|
||||||
<text class="e-loading-icon iconfont icon-loading text-blue"></text>
|
<tm-button theme="bg-gradient-light-blue-accent" size="m" v-if="!disallowComment"
|
||||||
<view class="text-size-n text-grey-lighten-1 py-12 mt-12">加载中,请稍等...</view>
|
@click="fnToComment()">刷新试试
|
||||||
</view>
|
</tm-button>
|
||||||
<view v-else-if="loading == 'error'" class="error">
|
</tm-empty>
|
||||||
<tm-empty icon="icon-wind-cry" label="加载失败">
|
</view>
|
||||||
<tm-button theme="bg-gradient-light-blue-accent" size="m" v-if="!disallowComment" @click="fnToComment()">刷新试试</tm-button>
|
</view>
|
||||||
</tm-empty>
|
<block v-else>
|
||||||
</view>
|
<tm-alerts v-if="disallowComment && dataList.length !== 0" color="red" text :margin="[0, 0]" :shadow="0"
|
||||||
</view>
|
label="Ծ‸Ծ博主已设置该文章禁止评论!" :round="3"></tm-alerts>
|
||||||
<block v-else>
|
<view class="empty pt-50" v-if="dataList.length === 0">
|
||||||
<tm-alerts
|
<tm-empty v-if="disallowComment" icon="icon-shiliangzhinengduixiang-" label="暂无评论">
|
||||||
v-if="disallowComment && dataList.length !== 0"
|
<text class="text-red text-size-s">- 文章已开启禁止评论 -</text>
|
||||||
color="red"
|
</tm-empty>
|
||||||
text
|
<tm-empty v-else icon="icon-shiliangzhinengduixiang-" label="暂无评论">
|
||||||
:margin="[0, 0]"
|
<tm-button theme="light-blue" :dense="true" :shadow="0" size="m" @click="fnToComment(null)">抢沙发
|
||||||
:shadow="0"
|
</tm-button>
|
||||||
label="Ծ‸Ծ博主已设置该文章禁止评论!"
|
</tm-empty>
|
||||||
:round="3"
|
</view>
|
||||||
close
|
<block v-else>
|
||||||
></tm-alerts>
|
<!-- 评论内容 : 目前仅支持二级评论 -->
|
||||||
<view class="empty pt-50" v-if="dataList.length == 0">
|
<block v-for="(comment, index) in dataList" :key="comment.metadata.name">
|
||||||
<tm-empty v-if="disallowComment" icon="icon-shiliangzhinengduixiang-" label="暂无评论">
|
<comment-item :useContentBg="false" :isChild="false" :comment="comment" :postName="postName"
|
||||||
<text class="text-red text-size-s">- 文章已开启禁止评论 -</text>
|
:disallowComment="disallowComment" @on-copy="fnCopyContent" @on-comment="fnToComment"
|
||||||
</tm-empty>
|
@on-todo="fnToDo" @on-detail="fnShowCommentDetail"></comment-item>
|
||||||
<tm-empty v-else icon="icon-shiliangzhinengduixiang-" label="暂无评论">
|
|
||||||
<tm-button theme="bg-gradient-light-blue-accent" 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>
|
|
||||||
|
|
||||||
<!-- 二级评论 -->
|
<!-- 二级评论 -->
|
||||||
<block v-if="comment.children && comment.children.length != 0">
|
<block v-if="comment.replies && comment.replies.items.length !== 0">
|
||||||
<block v-for="(childComment, childIndex) in comment.children" :key="childComment.id">
|
<block v-for="(childComment, childIndex) in comment.replies.items"
|
||||||
<comment-item
|
:key="childComment.metadata.name">
|
||||||
:useContentBg="false"
|
<comment-item :useContentBg="false" :isChild="true" :comment="childComment"
|
||||||
:isChild="true"
|
:postName="postName" :disallowComment="disallowComment" @on-copy="fnCopyContent"
|
||||||
:comment="childComment"
|
@on-comment="fnToComment" @on-todo="fnToDo"
|
||||||
:postId="postId"
|
@on-detail="fnShowCommentDetail"></comment-item>
|
||||||
:disallowComment="disallowComment"
|
</block>
|
||||||
@on-copy="fnCopyContent"
|
</block>
|
||||||
@on-comment="fnToComment"
|
</block>
|
||||||
@on-todo="fnToDo"
|
<view v-if="false" class="to-more-comment">
|
||||||
@on-detail="fnShowCommetnDetail"
|
<tm-button item-class="btn" :block="true" width="90vw" theme="bg-gradient-light-blue-lighten"
|
||||||
></comment-item>
|
size="m">点击查看全部评论
|
||||||
</block>
|
</tm-button>
|
||||||
</block>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
<view v-if="false" class="to-more-comment">
|
</block>
|
||||||
<tm-button item-class="btn" :block="true" width="90vw" theme="bg-gradient-light-blue-lighten" size="m">点击查看全部评论</tm-button>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -91,192 +73,200 @@ import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
|||||||
import tmAlerts from '@/tm-vuetify/components/tm-alerts/tm-alerts.vue';
|
import tmAlerts from '@/tm-vuetify/components/tm-alerts/tm-alerts.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'comment-list',
|
name: 'comment-list',
|
||||||
components: { tmEmpty, tmButton, tmAlerts },
|
components: {
|
||||||
props: {
|
tmEmpty,
|
||||||
// 是否禁用评论
|
tmButton,
|
||||||
disallowComment: {
|
tmAlerts
|
||||||
type: Boolean,
|
},
|
||||||
default: false
|
props: {
|
||||||
},
|
// 是否禁用评论
|
||||||
postId: {
|
disallowComment: {
|
||||||
type: Number,
|
type: Boolean,
|
||||||
default: null
|
default: false
|
||||||
},
|
},
|
||||||
post: {
|
postName: {
|
||||||
type: Object,
|
type: String,
|
||||||
default: () => {}
|
default: ""
|
||||||
}
|
},
|
||||||
},
|
post: {
|
||||||
data() {
|
type: Object,
|
||||||
return {
|
default: () => {
|
||||||
loading: 'loading',
|
}
|
||||||
sort: 0,
|
}
|
||||||
queryParams: {
|
},
|
||||||
sort: '',
|
data() {
|
||||||
more: true
|
return {
|
||||||
},
|
loading: 'loading',
|
||||||
api: 'getPostCommentTree',
|
queryParams: {
|
||||||
result: {},
|
group: "content.halo.run",
|
||||||
dataList: []
|
kind: "Post",
|
||||||
};
|
version: "v1alpha1",
|
||||||
},
|
name: "",
|
||||||
created() {
|
page: 1,
|
||||||
this.fnGetData();
|
size: 50,
|
||||||
uni.$on('comment_list_refresh', () => {
|
withReplies: true,
|
||||||
this.fnOnSort(this.sort, true);
|
replySize: 10
|
||||||
});
|
},
|
||||||
},
|
result: null,
|
||||||
methods: {
|
dataList: []
|
||||||
fnOnSort(type, refresh = false) {
|
};
|
||||||
if (this.sort == type && refresh == false) return;
|
},
|
||||||
const _api = ['getPostCommentTree', 'getPostTopCommentList'];
|
created() {
|
||||||
this.sort = type;
|
this.queryParams.name = this.postName;
|
||||||
this.api = _api[type];
|
this.fnGetData();
|
||||||
this.fnGetData();
|
uni.$on('comment_list_refresh', () => {
|
||||||
},
|
this.fnOnSort(true);
|
||||||
fnGetData() {
|
});
|
||||||
this.loading = 'loading';
|
},
|
||||||
this.$httpApi[this.api](this.postId, {})
|
methods: {
|
||||||
.then(res => {
|
fnOnSort(refresh = false) {
|
||||||
if (res.status == 200) {
|
if (refresh === false) return;
|
||||||
this.result = res.data;
|
this.fnGetData();
|
||||||
this.dataList = res.data.content;
|
},
|
||||||
this.loading = 'success';
|
fnGetData() {
|
||||||
} else {
|
this.loading = 'loading';
|
||||||
this.loading = 'error';
|
this.$httpApi.v2.getPostCommentList(this.queryParams)
|
||||||
}
|
.then(res => {
|
||||||
})
|
console.log("日志:", res)
|
||||||
.catch(err => {
|
this.result = res;
|
||||||
this.loading = 'error';
|
this.dataList = res.items;
|
||||||
})
|
this.loading = 'success';
|
||||||
.finally(() => {
|
this.$emit('on-loaded', this.dataList);
|
||||||
uni.hideLoading();
|
})
|
||||||
});
|
.catch(err => {
|
||||||
},
|
this.loading = 'error';
|
||||||
fnToDo() {
|
})
|
||||||
uni.$tm.toast('Halo暂未支持!');
|
.finally(() => {
|
||||||
},
|
uni.hideLoading();
|
||||||
fnToComment(data) {
|
});
|
||||||
if (this.disallowComment) {
|
},
|
||||||
return uni.$tm.toast('文章已禁止评论!');
|
fnToDo() {
|
||||||
}
|
uni.$tm.toast('Halo暂未支持!');
|
||||||
console.log(data);
|
},
|
||||||
let _comment = {};
|
fnToComment(data) {
|
||||||
if (data) {
|
if (this.disallowComment) {
|
||||||
let { type, comment } = data;
|
return uni.$tm.toast('文章已禁止评论!');
|
||||||
// 来自用户
|
}
|
||||||
_comment = {
|
let _comment = {};
|
||||||
id: this.post.id,
|
console.log('data', data)
|
||||||
parentId: comment.id,
|
if (data) {
|
||||||
title: comment.author,
|
let {type, comment} = data;
|
||||||
from: 'posts',
|
// 来自用户
|
||||||
formPage: 'comment_list',
|
_comment = {
|
||||||
type: 'user'
|
isComment: false,
|
||||||
};
|
postName: comment.metadata.name,
|
||||||
} else {
|
title: comment.owner.displayName,
|
||||||
// 来自文章
|
from: 'posts',
|
||||||
_comment = {
|
formPage: 'comment_list',
|
||||||
id: this.post.id,
|
type: 'user'
|
||||||
parentId: 0,
|
};
|
||||||
title: '评论文章:' + this.post.title,
|
} else {
|
||||||
formPage: 'comment_list',
|
// 来自文章
|
||||||
from: 'posts',
|
_comment = {
|
||||||
type: 'post'
|
isComment: true,
|
||||||
};
|
postName: this.post.metadata.name,
|
||||||
}
|
title: '新增评论',
|
||||||
|
formPage: 'comment_list',
|
||||||
|
from: 'posts',
|
||||||
|
type: 'post'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
uni.$tm.vx.commit('comment/setCommentInfo', _comment);
|
this.$emit("on-comment", _comment)
|
||||||
this.$Router.push({
|
},
|
||||||
path: '/pagesA/comment/comment',
|
fnCopyContent(content) {
|
||||||
query: _comment
|
uni.$tm.u.setClipboardData(content);
|
||||||
});
|
uni.$tm.toast('内容已复制成功!');
|
||||||
},
|
},
|
||||||
fnCopyContent(content) {
|
|
||||||
uni.$tm.u.setClipboardData(content);
|
|
||||||
uni.$tm.toast('内容已复制成功!');
|
|
||||||
},
|
|
||||||
|
|
||||||
fnShowCommetnDetail(comment) {
|
fnShowCommentDetail(comment) {
|
||||||
this.$emit('on-comment-detail', {
|
this.$emit('on-comment-detail', {
|
||||||
postId: this.postId,
|
postName: this.postName,
|
||||||
comment: comment
|
comment: comment
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.comment-list {
|
.comment-list {
|
||||||
&_head {
|
&_head {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
position: relative;
|
position: relative;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding-left: 24rpx;
|
padding-left: 24rpx;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0rpx;
|
left: 0rpx;
|
||||||
top: 8rpx;
|
top: 8rpx;
|
||||||
width: 8rpx;
|
width: 8rpx;
|
||||||
height: 26rpx;
|
height: 26rpx;
|
||||||
background-color: rgb(3, 174, 252);
|
background-color: rgb(3, 174, 252);
|
||||||
border-radius: 6rpx;
|
border-radius: 6rpx;
|
||||||
}
|
}
|
||||||
.title {
|
|
||||||
.count {
|
|
||||||
font-size: 28rpx;
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.filter {
|
|
||||||
font-size: 26rpx;
|
|
||||||
font-weight: normal;
|
|
||||||
|
|
||||||
&-item {
|
.title {
|
||||||
margin-left: 20rpx;
|
.count {
|
||||||
color: #666;
|
font-size: 28rpx;
|
||||||
&.active {
|
font-weight: normal;
|
||||||
font-weight: bold;
|
}
|
||||||
color: rgb(255, 152, 0);
|
}
|
||||||
font-size: 26rpx;
|
|
||||||
}
|
.filter {
|
||||||
}
|
font-size: 26rpx;
|
||||||
}
|
font-weight: normal;
|
||||||
}
|
|
||||||
&_content {
|
&-item {
|
||||||
margin-top: 24rpx;
|
margin-left: 20rpx;
|
||||||
padding-bottom: 36rpx;
|
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 {
|
.loading-wrap {
|
||||||
font-size: 100rpx;
|
width: 100%;
|
||||||
}
|
height: 506rpx;
|
||||||
|
|
||||||
|
.loading {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.e-loading-icon {
|
||||||
|
font-size: 100rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.to-more-comment {
|
.to-more-comment {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-top: 80rpx;
|
margin-top: 80rpx;
|
||||||
::v-deep {
|
|
||||||
.tm-button .tm-button-btn uni-button {
|
::v-deep {
|
||||||
height: 70rpx;
|
.tm-button .tm-button-btn uni-button {
|
||||||
}
|
height: 70rpx;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</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%;
|
width: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 20rpx 24rpx;
|
padding: 20rpx 24rpx;
|
||||||
|
background-color: rgba(0, 0, 0, 0.085);
|
||||||
|
backdrop-filter: blur(3rpx);
|
||||||
&.no-dot {
|
&.no-dot {
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+122
-135
@@ -2,47 +2,31 @@
|
|||||||
<!-- 轮播图 -->
|
<!-- 轮播图 -->
|
||||||
<view class="Swiper-mfw-index-box">
|
<view class="Swiper-mfw-index-box">
|
||||||
<view class="Swiper-mfw-index Swiper-box" :class="[dotPosition]">
|
<view class="Swiper-mfw-index Swiper-box" :class="[dotPosition]">
|
||||||
<swiper
|
<swiper class="Swiper-mfw" :style="{ height: height }" :circular="true" :indicator-dots="false"
|
||||||
class="Swiper-mfw"
|
:autoplay="autoplay" :interval="3000" :duration="1000" :current="currentIndex"
|
||||||
:style="{ height: height }"
|
:disable-touch="disable_touch" @change="change">
|
||||||
:circular="true"
|
|
||||||
:indicator-dots="false"
|
|
||||||
:autoplay="autoplay"
|
|
||||||
:interval="3000"
|
|
||||||
:duration="1000"
|
|
||||||
:current="currentIndex"
|
|
||||||
:disable-touch="disable_touch"
|
|
||||||
@change="change"
|
|
||||||
>
|
|
||||||
<!-- 只需要前5条数据 -->
|
<!-- 只需要前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控制暂停视频
|
1. 这里不需要用api控制暂停视频
|
||||||
2. 因为video标签上加了v-if="current==index"
|
2. 因为video标签上加了v-if="current==index"
|
||||||
3. 当current == index时才会创建视频组件
|
3. 当current == index时才会创建视频组件
|
||||||
4. 否current != index则就销毁视频
|
4. 否current != index则就销毁视频
|
||||||
*/ -->
|
*/ -->
|
||||||
<!-- 如果有视频,则显示视频-->
|
<!-- 如果有视频,则显示视频-->
|
||||||
<template v-if="item.mp4 && current == index">
|
<template v-if="item.mp4 && current == index">
|
||||||
<video
|
<video class="ImageVideo" :id="'ImageVideo' + index" :ref="'ImageVideo' + index"
|
||||||
class="ImageVideo"
|
:src="item.mp4" :loop="true" :muted="false" :autoplay="current == index ? true : false"
|
||||||
:id="'ImageVideo' + index"
|
:controls="false" :show-fullscreen-btn="false" :show-play-btn="false"
|
||||||
:ref="'ImageVideo' + index"
|
:enable-progress-gesture="false" :play-strategy="0"
|
||||||
:src="item.mp4"
|
:poster="item.image || item.src"></video>
|
||||||
:loop="true"
|
</template>
|
||||||
:muted="false"
|
<!-- 否则显示图片 -->
|
||||||
:autoplay="current == index ? true : false"
|
<image v-else :src="item.image || item.src" class="Image" mode="aspectFill"
|
||||||
:controls="false"
|
@click.stop="$emit('on-click', item)"></image>
|
||||||
:show-fullscreen-btn="false"
|
</swiper-item>
|
||||||
:show-play-btn="false"
|
</block>
|
||||||
: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>
|
|
||||||
</swiper>
|
</swiper>
|
||||||
<!-- 指示器 [Top] -->
|
<!-- 指示器 [Top] -->
|
||||||
<view v-if="useTop" class="Swiper-indicator-box indicator-Top-box">
|
<view v-if="useTop" class="Swiper-indicator-box indicator-Top-box">
|
||||||
@@ -59,7 +43,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="right-hot-ttf">
|
<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>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -79,17 +63,20 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- 标题 -->
|
<!-- 标题 -->
|
||||||
<view class="Top-Title">
|
<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>
|
||||||
<!-- 用户信息 -->
|
<!-- 用户信息 -->
|
||||||
<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">
|
<view class="textbox UserName-box">
|
||||||
<text class="text UserInfo">{{ item.nickname }}</text>
|
<text class="text UserInfo">{{ item.nickname }}</text>
|
||||||
</view>
|
</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">
|
<view v-if="item.createTime" class="textbox UserGPS-box">
|
||||||
<text class="text UserInfo">发布于 {{ item.createTime }}</text>
|
<text class="text UserInfo">发布于 {{ item.createTime }}</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -106,18 +93,14 @@
|
|||||||
<!-- 左边 -->
|
<!-- 左边 -->
|
||||||
<view class="Bottom-left-Imagelist">
|
<view class="Bottom-left-Imagelist">
|
||||||
<block v-for="(item, index) in list" :key="index">
|
<block v-for="(item, index) in list" :key="index">
|
||||||
<view
|
<view class="Bottom-item" v-if="Number(index) <= 4"
|
||||||
class="Bottom-item"
|
:class="currentIndex == index ? 'current' : 'no'" @click="SwiperIndTap(index)">
|
||||||
v-if="Number(index) <= (dotPosition == 'right' ? 3 : 4)"
|
|
||||||
:class="currentIndex == index ? 'current' : 'no'"
|
|
||||||
@click="SwiperIndTap(index)"
|
|
||||||
>
|
|
||||||
<image :src="item.image || item.src" class="Image" mode="aspectFill"></image>
|
<image :src="item.image || item.src" class="Image" mode="aspectFill"></image>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
<!-- 右边 -->
|
<!-- 右边 -->
|
||||||
<view class="Bottom-right-lili-btn">
|
<view v-if="false" class="Bottom-right-lili-btn">
|
||||||
<view class="Bottom-item is-more">
|
<view class="Bottom-item is-more">
|
||||||
<view class="more" @click.stop="$emit('on-more')">
|
<view class="more" @click.stop="$emit('on-more')">
|
||||||
MORE
|
MORE
|
||||||
@@ -132,102 +115,106 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'e-swiper',
|
name: 'e-swiper',
|
||||||
props: {
|
props: {
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
},
|
},
|
||||||
height: {
|
height: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '450rpx'
|
default: '450rpx'
|
||||||
},
|
},
|
||||||
dotPosition: {
|
dotPosition: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'bottom'
|
default: 'bottom'
|
||||||
},
|
},
|
||||||
useTop: {
|
useTop: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
useDot: {
|
useDot: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
useTitle: {
|
useTitle: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
useUser: {
|
useUser: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
// 轮播图 数据列表
|
// 轮播图 数据列表
|
||||||
list: {
|
list: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => []
|
default: () => []
|
||||||
},
|
},
|
||||||
// 当前选中的项(指示器坐标位置)
|
// 当前选中的项(指示器坐标位置)
|
||||||
current: {
|
current: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0
|
default: 0
|
||||||
},
|
},
|
||||||
// 是否自动轮播
|
// 是否自动轮播
|
||||||
autoplay: {
|
autoplay: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
// 是否禁止用户 touch 操作
|
|
||||||
currentIndex: 0,
|
|
||||||
disable_touch: false, //touch 用户划动引起swiper变化。
|
|
||||||
date: {
|
|
||||||
year: '-',
|
|
||||||
monthEn: '-',
|
|
||||||
month: '-'
|
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
},
|
data() {
|
||||||
created() {
|
return {
|
||||||
this.currentIndex = this.current;
|
// 是否禁止用户 touch 操作
|
||||||
const date = new Date();
|
currentIndex: 0,
|
||||||
//将月份名称存储在数组中
|
disable_touch: false, //touch 用户划动引起swiper变化。
|
||||||
const monthArray = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
|
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();
|
this.date.year = date.getFullYear();
|
||||||
let month = date.getMonth() + 1;
|
let month = date.getMonth() + 1;
|
||||||
this.date.month = month < 10 ? '0' + month : month;
|
this.date.month = month < 10 ? '0' + month : month;
|
||||||
this.date.monthEn = monthArray[date.getMonth()].toUpperCase();
|
this.date.monthEn = monthArray[date.getMonth()].toUpperCase();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// current 改变时会触发 change 事件,event.detail = {current: current, source: source}
|
// current 改变时会触发 change 事件,event.detail = {current: current, source: source}
|
||||||
change(e) {
|
change(e) {
|
||||||
let { current, source } = e.detail;
|
let {
|
||||||
//只有页面自动切换,手动切换时才轮播,其他不允许
|
current,
|
||||||
if (source === 'autoplay' || source === 'touch') {
|
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 = {
|
let event = {
|
||||||
current: current
|
current: index
|
||||||
};
|
};
|
||||||
this.currentIndex = current;
|
this.currentIndex = index;
|
||||||
this.$emit('change', event);
|
this.$emit('change', event);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
// 手动点击了指示器[小图模式]
|
|
||||||
SwiperIndTap(e) {
|
|
||||||
let index = e;
|
|
||||||
let event = {
|
|
||||||
current: index
|
|
||||||
};
|
|
||||||
this.currentIndex = index;
|
|
||||||
this.$emit('change', event);
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import './e-swiper.scss';
|
@import './e-swiper.scss';
|
||||||
</style>
|
</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>
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#如何使用
|
|
||||||
###js
|
|
||||||
```javascript
|
|
||||||
import lffBarrage from '@/components/lff-barrage/lff-barrage.vue'
|
|
||||||
components:{lffBarrage},
|
|
||||||
methods:{
|
|
||||||
colrdo(){ //插入一条弹幕
|
|
||||||
this.$refs.lffBarrage.add({item:'你好呀小伙子'});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
###HTML
|
|
||||||
```html
|
|
||||||
<lff-barrage ref="lffBarrage"></lff-barrage>
|
|
||||||
```
|
|
||||||
@@ -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,85 @@
|
|||||||
|
<template>
|
||||||
|
<view class="scroll-btn" :style="{ bottom: bottom }" @click.stop="fnScroll()">
|
||||||
|
<text v-if="_scrollTop >= 180" class="iconfont icon-long-arrow-up"></text>
|
||||||
|
<text v-else class="iconfont icon-long-arrow-down"></text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import throttle from '@/utils/throttle.js';
|
||||||
|
export default {
|
||||||
|
name: 'scroll-btn',
|
||||||
|
props: {
|
||||||
|
bottom: {
|
||||||
|
type: String,
|
||||||
|
default: '180rpx'
|
||||||
|
},
|
||||||
|
scrollTop: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return { timer: null, _scrollTop: 0 };
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
scrollTop(val) {
|
||||||
|
this._scrollTop = val;
|
||||||
|
this.$forceUpdate();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this._scrollTop = this.scrollTop;
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fnScroll() {
|
||||||
|
throttle(() => {
|
||||||
|
this.$emit('on-status', false);
|
||||||
|
const isTop = this._scrollTop >= 180;
|
||||||
|
this._scrollTop = isTop ? 0 : 999999999999;
|
||||||
|
uni.pageScrollTo({
|
||||||
|
duration: 500,
|
||||||
|
scrollTop: this._scrollTop,
|
||||||
|
success: () => {
|
||||||
|
clearTimeout(this.timer);
|
||||||
|
this.timer = setTimeout(() => {
|
||||||
|
this.$emit('on-status', true);
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.$emit('update:scrollTop', this._scrollTop);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.scroll-btn {
|
||||||
|
position: fixed;
|
||||||
|
// bottom: 200rpx;
|
||||||
|
// right: -90rpx;
|
||||||
|
right: 52rpx;
|
||||||
|
width: 80rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 4rpx solid #ffffff;
|
||||||
|
background-color: #bfe9ef;
|
||||||
|
box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.1);
|
||||||
|
z-index: 99;
|
||||||
|
transition: right 0.5s ease-in-out;
|
||||||
|
|
||||||
|
&.is-show {
|
||||||
|
right: 52rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.iconfont {
|
||||||
|
font-size: 36rpx;
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</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,20 +0,0 @@
|
|||||||
/**
|
|
||||||
* 广告配置
|
|
||||||
*/
|
|
||||||
export default {
|
|
||||||
adpid: '', // uni-AD App广告位id,在uni-AD官网申请广告位
|
|
||||||
unitId: '', // 广告单元id,可在小程序管理后台的流量主模块新建 (非个人资质,小程序后台广告主开通申请)
|
|
||||||
frequency: 8, // 列表中,广告出现的频率(8=每8条数据出现一次广告)
|
|
||||||
// 首页广告
|
|
||||||
home: {
|
|
||||||
use: false,
|
|
||||||
},
|
|
||||||
// 文章列表广告
|
|
||||||
articles: {
|
|
||||||
use: false,
|
|
||||||
},
|
|
||||||
// 文章详情广告
|
|
||||||
articleDetail: {
|
|
||||||
use: false, // 是否启用
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,137 +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: '', // 默认封面图地址
|
|
||||||
defaultImageUrl: '', // 默认图片地址
|
|
||||||
defaultAvatarUrl: '', // 默认头像地址
|
|
||||||
|
|
||||||
loadingGifUrl: '', // 图片加载中的地址
|
|
||||||
loadingErrUrl: '', // 图片加载失败的地址
|
|
||||||
loadingEmptyUrl: '', // 加载图片为空地址
|
|
||||||
|
|
||||||
waveImageUrl: '', // 关于页面波浪图片
|
|
||||||
|
|
||||||
banner: { // 轮播图配置
|
|
||||||
type: 'article', // 轮播图数据源 list=下方配置 article=热门文章封面
|
|
||||||
list: [],
|
|
||||||
},
|
|
||||||
|
|
||||||
quickNav: { // 快捷导航配置
|
|
||||||
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/start/start', // 分享路径[非必填] - 基本不需要修改
|
|
||||||
copyLink: '/pages/start/start', // 复制链接[非必填] - 基本不需要修改
|
|
||||||
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,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 App from "./App";
|
||||||
import Vue from "vue";
|
import Vue from "vue";
|
||||||
import {
|
|
||||||
router,
|
|
||||||
RouterMount
|
|
||||||
} from './router/router.js'
|
|
||||||
Vue.use(router)
|
|
||||||
|
|
||||||
// 挂载全局工具类
|
// 挂载全局工具类
|
||||||
import utils from "./utils/index.js";
|
import utils from "./utils/index.js";
|
||||||
Vue.prototype.$utils = utils;
|
Vue.prototype.$utils = utils;
|
||||||
|
uni.$utils = utils;
|
||||||
|
|
||||||
// 全局统一样式的对话框
|
// 全局统一样式的对话框
|
||||||
import Fy from '@/js_sdk/fy-showModal/index.js'
|
import Fy from '@/js_sdk/fy-showModal/index.js'
|
||||||
@@ -62,12 +58,9 @@ Vue.prototype.$http = http;
|
|||||||
import ApiManager from '@/api/index.js'
|
import ApiManager from '@/api/index.js'
|
||||||
Vue.use(ApiManager);
|
Vue.use(ApiManager);
|
||||||
|
|
||||||
import HaloConfig from '@/config/halo.config.js'
|
import HaloTokenConfig from '@/config/uhalo.config.js'
|
||||||
Vue.prototype.$haloConfig = HaloConfig
|
Vue.prototype.$baseApiUrl = HaloTokenConfig.BASE_API
|
||||||
Vue.prototype.$baseApiUrl = HaloConfig.apiUrl
|
|
||||||
|
|
||||||
import HaloAdConfig from '@/config/ad.config.js'
|
|
||||||
Vue.prototype.$haloAdConfig = HaloAdConfig
|
|
||||||
// 由于微信小程序的运行机制问题,需声明如下一行,H5和APP非必填
|
// 由于微信小程序的运行机制问题,需声明如下一行,H5和APP非必填
|
||||||
Vue.prototype._i18n = i18n;
|
Vue.prototype._i18n = i18n;
|
||||||
|
|
||||||
@@ -77,12 +70,5 @@ const app = new Vue({
|
|||||||
i18n,
|
i18n,
|
||||||
...App,
|
...App,
|
||||||
});
|
});
|
||||||
// app.$mount();
|
|
||||||
|
|
||||||
// #ifdef H5
|
app.$mount();
|
||||||
RouterMount(app, router, '#app')
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// #ifndef H5
|
|
||||||
app.$mount(); //为了兼容小程序及app端必须这样写才有效果
|
|
||||||
// #endif
|
|
||||||
|
|||||||
+86
-12
@@ -2,8 +2,8 @@
|
|||||||
"name" : "uni-halo",
|
"name" : "uni-halo",
|
||||||
"appid" : "__UNI__5748B6E",
|
"appid" : "__UNI__5748B6E",
|
||||||
"description" : "uni-halo博客:基于halo开源博客系统API开发的多端博客。",
|
"description" : "uni-halo博客:基于halo开源博客系统API开发的多端博客。",
|
||||||
"versionName" : "1.0.0",
|
"versionName" : "2.0.8",
|
||||||
"versionCode" : 100,
|
"versionCode" : 208,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
@@ -110,30 +110,46 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"uniStatistics" : {
|
||||||
|
"enable" : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/* 快应用特有相关 */
|
/* 快应用特有相关 */
|
||||||
"quickapp" : {},
|
"quickapp" : {},
|
||||||
/* 小程序特有相关 */
|
/* 小程序特有相关 */
|
||||||
"mp-weixin" : {
|
"mp-weixin" : {
|
||||||
"appid" : "wx1bb161867082c72f",
|
"appid" : "",
|
||||||
"setting" : {
|
"setting" : {
|
||||||
"urlCheck" : false,
|
"urlCheck" : false,
|
||||||
"minified" : true
|
"minified" : true
|
||||||
},
|
},
|
||||||
"usingComponents" : true
|
"usingComponents" : true,
|
||||||
|
"uniStatistics" : {
|
||||||
|
"enable" : false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"mp-alipay" : {
|
"mp-alipay" : {
|
||||||
"usingComponents" : true
|
"usingComponents" : true,
|
||||||
|
"uniStatistics" : {
|
||||||
|
"enable" : false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"mp-baidu" : {
|
"mp-baidu" : {
|
||||||
"usingComponents" : true
|
"usingComponents" : true,
|
||||||
|
"uniStatistics" : {
|
||||||
|
"enable" : false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"mp-toutiao" : {
|
"mp-toutiao" : {
|
||||||
"usingComponents" : true
|
"usingComponents" : true,
|
||||||
|
"uniStatistics" : {
|
||||||
|
"enable" : false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"uniStatistics" : {
|
"uniStatistics" : {
|
||||||
"enable" : false
|
"enable" : false,
|
||||||
|
"version" : "2"
|
||||||
},
|
},
|
||||||
"vueVersion" : "2",
|
"vueVersion" : "2",
|
||||||
"h5" : {
|
"h5" : {
|
||||||
@@ -141,12 +157,12 @@
|
|||||||
"devServer" : {
|
"devServer" : {
|
||||||
"disableHostCheck" : true,
|
"disableHostCheck" : true,
|
||||||
"proxy" : {
|
"proxy" : {
|
||||||
"/api" : {
|
"/apis" : {
|
||||||
"target" : "https://b.925i.cn",
|
"target" : "https://blog.xiaoxiaomo.cn",
|
||||||
"changeOrigin" : true,
|
"changeOrigin" : true,
|
||||||
"secure" : false,
|
"secure" : false,
|
||||||
"pathRewrite" : {
|
"pathRewrite" : {
|
||||||
"^/api" : ""
|
"^/apis" : "/apis"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -156,7 +172,65 @@
|
|||||||
"treeShaking" : {
|
"treeShaking" : {
|
||||||
"enable" : true
|
"enable" : true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"uniStatistics" : {
|
||||||
|
"enable" : false
|
||||||
|
},
|
||||||
|
"router" : {
|
||||||
|
"base" : "/uni-halo/",
|
||||||
|
"mode" : "history"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"_spaceID" : "699a26a5-a6cd-4b54-b603-5155b312a5f5"
|
"_spaceID" : "699a26a5-a6cd-4b54-b603-5155b312a5f5",
|
||||||
|
"mp-qq" : {
|
||||||
|
"appid" : "1112285420",
|
||||||
|
"setting" : {
|
||||||
|
"minified" : true,
|
||||||
|
"postcss" : true,
|
||||||
|
"es6" : true
|
||||||
|
},
|
||||||
|
"uniStatistics" : {
|
||||||
|
"enable" : false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mp-jd" : {
|
||||||
|
"uniStatistics" : {
|
||||||
|
"enable" : false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mp-kuaishou" : {
|
||||||
|
"uniStatistics" : {
|
||||||
|
"enable" : false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mp-lark" : {
|
||||||
|
"uniStatistics" : {
|
||||||
|
"enable" : false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"quickapp-webview-huawei" : {
|
||||||
|
"uniStatistics" : {
|
||||||
|
"enable" : false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"quickapp-webview-union" : {
|
||||||
|
"uniStatistics" : {
|
||||||
|
"enable" : false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"app-harmony" : {
|
||||||
|
"uniStatistics" : {
|
||||||
|
"enable" : false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mp-harmony" : {
|
||||||
|
"uniStatistics" : {
|
||||||
|
"enable" : false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mp-xhs" : {
|
||||||
|
"uniStatistics" : {
|
||||||
|
"enable" : false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-2
@@ -1,9 +1,26 @@
|
|||||||
{
|
{
|
||||||
|
"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": {
|
"devDependencies": {
|
||||||
"vue-i18n": "^9.1.10"
|
"vue-i18n": "^9.1.10"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"uni-read-pages": "^1.0.5",
|
"qs": "^6.12.1"
|
||||||
"uni-simple-router": "^2.0.8-beta.4"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+359
-549
@@ -1,558 +1,368 @@
|
|||||||
{
|
{
|
||||||
"pages": [{
|
"pages": [
|
||||||
"path": "pages/index/index",
|
{
|
||||||
|
"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": {
|
"style": {
|
||||||
"navigationBarTitleText": "uni-halo",
|
"navigationBarTitleText": "投票列表",
|
||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": true,
|
||||||
"navigationStyle": "custom"
|
"app-plus": {
|
||||||
|
"pullToRefresh": {
|
||||||
|
"color": "#03a9f4",
|
||||||
|
"style": "circle"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/tabbar/home/home",
|
"path": "vote-detail/vote-detail",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "首页",
|
"navigationBarTitleText": "投票详情",
|
||||||
"enablePullDownRefresh": true,
|
"enablePullDownRefresh": true,
|
||||||
"navigationStyle": "custom",
|
"app-plus": {
|
||||||
"app-plus": {
|
"pullToRefresh": {
|
||||||
"pullToRefresh": {
|
"color": "#03a9f4",
|
||||||
"color": "#03a9f4",
|
"style": "circle"
|
||||||
"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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
//此配置为小程序的分包加载机制。在5+App里始终为整包。
|
},
|
||||||
"subPackages": [{
|
{
|
||||||
"root": "pagesA",
|
"root": "pagesC",
|
||||||
"pages": [{
|
"pages": [
|
||||||
"path": "start/start",
|
{
|
||||||
"style": {
|
"path": "website/website",
|
||||||
"navigationBarTitleText": "uni-halo",
|
"style": {
|
||||||
"enablePullDownRefresh": false,
|
"navigationBarTitleText": "",
|
||||||
"navigationStyle": "custom"
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
}, {
|
}
|
||||||
"path": "article-detail/article-detail",
|
]
|
||||||
"style": {
|
}
|
||||||
"navigationBarTitleText": "文章详情",
|
],
|
||||||
"enablePullDownRefresh": true,
|
"globalStyle": {
|
||||||
"app-plus": {
|
"navigationBarTextStyle": "black",
|
||||||
"pullToRefresh": {
|
"navigationBarTitleText": "uni-halo",
|
||||||
"color": "#03a9f4",
|
"navigationBarBackgroundColor": "#ffffff",
|
||||||
"style": "circle"
|
"backgroundColor": "#F8F8F8"
|
||||||
}
|
},
|
||||||
}
|
"tabBar": {
|
||||||
}
|
"backgroundColor": "#fff",
|
||||||
}, {
|
"borderStyle": "white",
|
||||||
"path": "love/love",
|
"color": "#303133",
|
||||||
"style": {
|
"selectedColor": "#03a9f4",
|
||||||
"navigationBarTitleText": "",
|
"list": [
|
||||||
"enablePullDownRefresh": true,
|
{
|
||||||
"app-plus": {
|
"iconPath": "static/tabbar/select_home.png",
|
||||||
"pullToRefresh": {
|
"selectedIconPath": "static/tabbar/select_home_active.png",
|
||||||
"color": "#03a9f4",
|
"pagePath": "pages/tabbar/home/home",
|
||||||
"style": "circle"
|
"text": "首页"
|
||||||
}
|
},
|
||||||
}
|
{
|
||||||
}
|
"iconPath": "static/tabbar/select_category.png",
|
||||||
|
"selectedIconPath": "static/tabbar/select_category_active.png",
|
||||||
}, {
|
"pagePath": "pages/tabbar/category/category",
|
||||||
"path": "archives/archives",
|
"text": "分类"
|
||||||
"style": {
|
},
|
||||||
"navigationBarTitleText": "文章归档",
|
{
|
||||||
"enablePullDownRefresh": true,
|
"iconPath": "static/tabbar/select_gallery.png",
|
||||||
"app-plus": {
|
"selectedIconPath": "static/tabbar/select_gallery_active.png",
|
||||||
"pullToRefresh": {
|
"pagePath": "pages/tabbar/gallery/gallery",
|
||||||
"color": "#03a9f4",
|
"text": "图库"
|
||||||
"style": "circle"
|
},
|
||||||
}
|
{
|
||||||
}
|
"iconPath": "static/tabbar/select_links.png",
|
||||||
}
|
"selectedIconPath": "static/tabbar/select_links_active.png",
|
||||||
|
"pagePath": "pages/tabbar/moments/moments",
|
||||||
}, {
|
"text": "瞬间"
|
||||||
"path": "journal/journal",
|
},
|
||||||
"style": {
|
{
|
||||||
"navigationBarTitleText": "个人日记",
|
"iconPath": "static/tabbar/select_mine.png",
|
||||||
"enablePullDownRefresh": true,
|
"selectedIconPath": "static/tabbar/select_mine_active.png",
|
||||||
"app-plus": {
|
"pagePath": "pages/tabbar/about/about",
|
||||||
"pullToRefresh": {
|
"text": "关于"
|
||||||
"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": "white",
|
|
||||||
"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": "关于"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+126
-21
@@ -1,31 +1,136 @@
|
|||||||
<template>
|
<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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
import pluginAvailableMixin from "@/common/mixins/pluginAvailable.js"
|
||||||
onLoad() {
|
import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue'
|
||||||
this.fnCheckShowStarted();
|
|
||||||
},
|
const homePagePath = '/pages/tabbar/home/home'
|
||||||
methods: {
|
const startPagePath = '/pagesA/start/start'
|
||||||
// 检查是否需要跳转到启动页
|
const articleDetailPath = '/pagesA/article-detail/article-detail';
|
||||||
fnCheckShowStarted() {
|
|
||||||
if (!getApp().globalData.start.use) {
|
const _DEV_ = false
|
||||||
uni.switchTab({
|
const _DEV_TO_TYPE_ = "page"
|
||||||
url: '/pages/tabbar/home/home'
|
const _DEV_TO_PATH_ = "/pagesA/article-detail/article-detail?name=077efb85-3544-4307-b24c-537a9e53f116"
|
||||||
});
|
|
||||||
return;
|
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({
|
uni.switchTab({
|
||||||
url: '/pages/tabbar/home/home'
|
url: homePagePath
|
||||||
});
|
|
||||||
} else {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pagesA/start/start'
|
|
||||||
});
|
});
|
||||||
|
})
|
||||||
|
},
|
||||||
|
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>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.app-page {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
+502
-479
File diff suppressed because it is too large
Load Diff
+446
-216
@@ -1,242 +1,472 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page">
|
<view class="app-page" :style="{
|
||||||
<view v-if="loading != 'success'" class="loading-wrap">
|
padding:calcShowType==='list-post'? 0 : '24rpx 0'
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
}">
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<view v-if="loading !== 'success'" class="loading-wrap">
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
</view>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<view v-else class="content flex">
|
</view>
|
||||||
<view v-if="categoryList.length == 0" class="category-empty flex flex-center">
|
<!-- 内容区域 -->
|
||||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有文章分类~"></tm-empty>
|
<view v-else class="app-page-content" :class="[calcShowType==='list-post'?'list-post':'']">
|
||||||
</view>
|
<view v-if="dataList.length === 0" class="content-empty flex flex-center" style="height: 70vh;">
|
||||||
<block v-else>
|
<!-- 空布局 -->
|
||||||
<tm-sliderNav :list="categoryList" color="light-blue" rang-key="name" @change="fnOnCategoryChange"></tm-sliderNav>
|
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
|
||||||
<scroll-view
|
</view>
|
||||||
class="right-content pt-12 pb-12"
|
<block v-else>
|
||||||
:scroll-y="true"
|
<block v-if="calcAuditModeEnabled || calcShowType==='list'">
|
||||||
:scroll-top="scrollTop"
|
<tm-translate v-for="(item, index) in dataList" :key="index"
|
||||||
:scroll-with-animation="true"
|
style="box-sizing: border-box;width: 50%;padding: 0 8rpx;" animation-name="fadeUp"
|
||||||
:refresher-enabled="true"
|
:wait="calcAniWait(index)">
|
||||||
:refresher-triggered="triggered"
|
<view class="catgory-card" :style="{backgroundImage:`url(${item.spec.cover})`}">
|
||||||
:refresher-threshold="60"
|
<view class="content" @click="handleToCategory(item)">
|
||||||
@refresherrefresh="fnGetData(true)"
|
<view style="font-size: 32rpx;color: #ffffff;">{{ item.spec.displayName }}</view>
|
||||||
@scrolltolower="fnGetData(false)"
|
<view v-if="!calcAuditModeEnabled"
|
||||||
@scroll="fnOnScroll"
|
style="font-size: 24rpx;color: #ffffff;margin-top: 6rpx;">
|
||||||
@touchmove.stop
|
共 {{ item.postCount }} 篇文章
|
||||||
@touchstart="fnOnTouchStart"
|
</view>
|
||||||
@touchend="fnOnTouchEnd"
|
</view>
|
||||||
@touchcancel="fnOnTouchEnd"
|
</view>
|
||||||
>
|
</tm-translate>
|
||||||
<view v-if="dataList.length == 0" class="article-empty flex flex-center">
|
<view class="load-text">{{ loadMoreText }}</view>
|
||||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="该分类下暂无文章~"></tm-empty>
|
</block>
|
||||||
</view>
|
<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>
|
<view class="flot-buttons">
|
||||||
<block v-for="(article, index) in dataList" :key="article.createTime">
|
<tm-button @click="fnScrollTop" size="m" :fab="true" theme="light-blue"
|
||||||
<!-- 文章卡片 -->
|
icon="icon-angle-up"></tm-button>
|
||||||
<tm-translate animation-name="fadeUp" :wait="(index + 1) * 50">
|
<tm-button v-if="!calcAuditModeEnabled" @click="fnChangeShowType" size="m" :fab="true" theme="light-blue"
|
||||||
<article-min-card :article="article" @on-click="fnToArticleDetail"></article-min-card>
|
:icon="calcShowType==='list'?'icon-align-left':'icon-all'"></tm-button>
|
||||||
</tm-translate>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
<view class="load-text">{{ loadMoreText }}</view>
|
</view>
|
||||||
</block>
|
|
||||||
</scroll-view>
|
</view>
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
<tm-flotbutton v-if="dataList.length > 10" color="light-blue" @click="fnToTopScroll" size="m" icon="icon-angle-up"></tm-flotbutton>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import throttle from '@/utils/throttle.js';
|
|
||||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.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 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 tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||||
|
|
||||||
|
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
||||||
|
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
||||||
import tmFlowLayout from '@/tm-vuetify/components/tm-flowLayout/tm-flowLayout.vue';
|
import tmFlowLayout from '@/tm-vuetify/components/tm-flowLayout/tm-flowLayout.vue';
|
||||||
import tmSliderNav from '@/tm-vuetify/components/tm-sliderNav/tm-sliderNav.vue';
|
import tmSliderNav from '@/tm-vuetify/components/tm-sliderNav/tm-sliderNav.vue';
|
||||||
|
|
||||||
import ArticleMinCard from '@/components/article-min-card/article-min-card.vue';
|
import ArticleMinCard from '@/components/article-min-card/article-min-card.vue';
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
tmSkeleton,
|
tmSkeleton,
|
||||||
tmTranslate,
|
tmButton,
|
||||||
tmFlotbutton,
|
tmTranslate,
|
||||||
tmEmpty,
|
tmEmpty,
|
||||||
tmFlowLayout,
|
mpHtml,
|
||||||
tmSliderNav,
|
tmFlowLayout,
|
||||||
ArticleMinCard
|
tmSliderNav,
|
||||||
},
|
ArticleMinCard
|
||||||
data() {
|
},
|
||||||
return {
|
data() {
|
||||||
loading: 'loading',
|
return {
|
||||||
queryParams: {
|
markdownConfig: MarkdownConfig,
|
||||||
size: 10,
|
loading: 'loading',
|
||||||
page: 0,
|
queryParams: {
|
||||||
slug: ''
|
size: 20,
|
||||||
},
|
page: 1,
|
||||||
categoryList: [],
|
fieldSelector: ['spec.hideFromList=false']
|
||||||
result: null,
|
},
|
||||||
dataList: [],
|
hasNext: false,
|
||||||
isLoadMore: false,
|
dataList: [],
|
||||||
loadMoreText: '',
|
categoryList: [],
|
||||||
scrollTop: 0,
|
isLoadMore: false,
|
||||||
tempScrollTop: 0,
|
loadMoreText: '加载中...',
|
||||||
scrollTimeout: null,
|
currentCategoryConfig: {
|
||||||
triggered: false
|
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') {
|
||||||
|
|
||||||
onLoad() {
|
this.queryParams.page += 1;
|
||||||
this.fnSetPageTitle('文章分类');
|
} else {
|
||||||
this.fnGetAllCategory();
|
this.postQueryParams.page += 1;
|
||||||
},
|
}
|
||||||
onPullDownRefresh() {
|
this.isLoadMore = true;
|
||||||
this.queryParams.page = 0;
|
this.fnGetData();
|
||||||
this.isLoadMore = false;
|
} else {
|
||||||
this.fnGetData();
|
uni.showToast({
|
||||||
},
|
icon: 'none',
|
||||||
onReachBottom(e) {
|
title: '没有更多数据了'
|
||||||
if (this.result.hasNext) {
|
});
|
||||||
this.queryParams.page += 1;
|
}
|
||||||
this.isLoadMore = true;
|
},
|
||||||
this.fnGetData(false);
|
methods: {
|
||||||
} else {
|
fnChangeShowType() {
|
||||||
uni.showToast({
|
if (this.calcShowType === 'list-post') {
|
||||||
icon: 'none',
|
this.currentCategoryConfig.type = 'list'
|
||||||
title: '没有更多数据了'
|
} else {
|
||||||
});
|
this.currentCategoryConfig.type = 'list-post'
|
||||||
}
|
}
|
||||||
},
|
this.handleInitPage();
|
||||||
methods: {
|
},
|
||||||
fnOnCategoryChange(e) {
|
handleResetInit() {
|
||||||
this.queryParams.slug = this.categoryList[e].slug;
|
this.postList = []
|
||||||
this.fnToTopScroll();
|
this.dataList = []
|
||||||
this.dataList = [];
|
this.categoryList = []
|
||||||
this.fnGetData();
|
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;
|
||||||
|
|
||||||
fnGetAllCategory() {
|
const tempItems = res.items.map(item => {
|
||||||
this.loading = 'loading';
|
item.spec.cover = this.$utils.checkThumbnailUrl(item.spec.cover, true)
|
||||||
uni.showLoading({
|
return item;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$httpApi
|
if (this.isLoadMore) {
|
||||||
.getCategoryPostList(this.queryParams.slug, this.queryParams)
|
this.dataList = this.dataList.concat(tempItems);
|
||||||
.then(res => {
|
} else {
|
||||||
this.result = res.data;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!isPulldownRefresh) {
|
this.$httpApi.v2
|
||||||
this.dataList = this.dataList.concat(res.data.content);
|
.getCategoryPostList(this.currentCategoryName, this.postQueryParams)
|
||||||
} else {
|
.then(res => {
|
||||||
this.dataList = res.data.content;
|
this.hasNext = res.hasNext;
|
||||||
}
|
|
||||||
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
if (!isPulldownRefresh) {
|
||||||
})
|
this.postList = this.postList.concat(res.items);
|
||||||
.catch(err => {
|
} else {
|
||||||
this.loadMoreText = '加载失败!';
|
this.postList = res.items;
|
||||||
})
|
}
|
||||||
.finally(() => {
|
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||||
this.triggered = false;
|
})
|
||||||
});
|
.catch(err => {
|
||||||
},
|
this.loadMoreText = '加载失败!';
|
||||||
//跳转文章详情
|
})
|
||||||
fnToArticleDetail(article) {
|
.finally(() => {
|
||||||
uni.navigateTo({
|
this.triggered = false;
|
||||||
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
|
});
|
||||||
animationType: 'slide-in-right'
|
},
|
||||||
});
|
|
||||||
},
|
fnOnCategoryChange(e) {
|
||||||
fnOnScroll(e) {
|
this.fnResetSetAniWaitIndex();
|
||||||
this.tempScrollTop = e.detail.scrollTop;
|
this.currentCategoryName = this.dataList[e].metadata.name;
|
||||||
},
|
this.fnToTopScroll();
|
||||||
fnToTopScroll() {
|
this.postList = [];
|
||||||
uni.pageScrollTo({
|
this.fnGetPostByCategory();
|
||||||
scrollTop: 0,
|
},
|
||||||
duration: 500
|
|
||||||
});
|
fnOnScroll(e) {
|
||||||
this.scrollTop = 0;
|
this.tempScrollTop = e.detail.scrollTop;
|
||||||
this.tempScrollTop = 0;
|
},
|
||||||
},
|
fnToTopScroll() {
|
||||||
fnOnTouchStart() {
|
uni.pageScrollTo({
|
||||||
clearTimeout(this.scrollTimeout);
|
scrollTop: 0,
|
||||||
},
|
duration: 500
|
||||||
fnOnTouchEnd() {
|
});
|
||||||
this.scrollTimeout = setTimeout(() => {
|
this.scrollTop = 0;
|
||||||
this.scrollTop = this.tempScrollTop;
|
this.tempScrollTop = 0;
|
||||||
}, 500);
|
},
|
||||||
}
|
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>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-page {
|
.app-page {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
min-height: 100vh;
|
display: flex;
|
||||||
display: flex;
|
flex-direction: column;
|
||||||
flex-direction: column;
|
padding: 24rpx 0;
|
||||||
background-color: #fff;
|
|
||||||
}
|
}
|
||||||
.content {
|
|
||||||
height: 100vh;
|
.auditModeEnabled {
|
||||||
background-color: #fafafa;
|
width: 100%;
|
||||||
}
|
height: 80vh;
|
||||||
.category-empty {
|
display: flex;
|
||||||
width: 100%;
|
flex-direction: column;
|
||||||
height: 70vh;
|
align-items: center;
|
||||||
}
|
justify-content: center;
|
||||||
.article-empty {
|
|
||||||
width: 100%;
|
|
||||||
height: 70vh;
|
|
||||||
}
|
|
||||||
.right-content {
|
|
||||||
// width: calc(100vw - 144rpx);
|
|
||||||
width: calc(100vw - 190rpx);
|
|
||||||
height: 100vh;
|
|
||||||
background-color: #fff;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading-wrap {
|
.loading-wrap {
|
||||||
padding: 24rpx;
|
padding: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-page-content {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding: 0 12rpx;
|
||||||
|
gap: 20rpx 0;
|
||||||
|
|
||||||
|
&.list-post {
|
||||||
|
padding: 0;
|
||||||
|
gap: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.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>
|
</style>
|
||||||
|
|||||||
+368
-303
@@ -1,328 +1,393 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page" :class="{ 'is-balck grey-darken-6': isBlackTheme }">
|
<view class="app-page" :class="[uniHaloPluginPageClass]">
|
||||||
<!-- 顶部切换 -->
|
<PluginUnavailable v-if="!uniHaloPluginAvailable" :pluginId="uniHaloPluginId"
|
||||||
<view class="e-fixed" v-if="category.list.length > 2">
|
:error-text="uniHaloPluginAvailableError" />
|
||||||
<tm-tabs color="light-blue" v-model="category.activeIndex" :list="category.list" align="left" @change="fnOnCategoryChange"></tm-tabs>
|
<template v-else>
|
||||||
</view>
|
<!-- 顶部切换 -->
|
||||||
<!-- 占位区域 -->
|
<view class="e-fixed" v-if="category.list.length > 0">
|
||||||
<view style="width: 100vw;height: 90rpx;"></view>
|
<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 v-if="loading != 'success'" class="loading-wrap">
|
|
||||||
<tm-skeleton model="card"></tm-skeleton>
|
|
||||||
<tm-skeleton model="cardActions"></tm-skeleton>
|
|
||||||
<tm-skeleton model="list"></tm-skeleton>
|
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
|
||||||
</view>
|
|
||||||
<!-- 内容区域 -->
|
|
||||||
<view class="content" v-else :class="{ 'bg-white': dataList.length !== 0 }">
|
|
||||||
<view v-if="dataList.length == 0" class="content-empty">
|
|
||||||
<!-- 空布局 -->
|
|
||||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有分享图片~"></tm-empty>
|
|
||||||
</view>
|
</view>
|
||||||
<block v-else>
|
<!-- 占位区域 -->
|
||||||
<tm-flowLayout v-if="globalAppSettings.gallery.useWaterfull" @click="fnOnClick" ref="wafll">
|
<view v-if="category.list.length > 0" style="width: 100vw;height: 90rpx;"></view>
|
||||||
<template v-slot:left="{ hdata }">
|
<!-- 加载区域 -->
|
||||||
<tm-translate animation-name="fadeUp">
|
<view v-if="loading == 'loading'" class="loading-wrap">
|
||||||
<view class="round-3 shadow-2 overflow white">
|
<tm-skeleton model="card"></tm-skeleton>
|
||||||
<tm-images :previmage="false" :src="hdata.item.image" @click="fnPreview(hdata.item)"></tm-images>
|
<tm-skeleton model="card"></tm-skeleton>
|
||||||
<view class="pa-10 text-size-s">
|
<tm-skeleton model="card"></tm-skeleton>
|
||||||
<view class="text-overflow-2">
|
<tm-skeleton model="card"></tm-skeleton>
|
||||||
<tm-tags color="bg-gradient-amber-accent" :shadow="0" :dense="true" size="s" model="fill">{{ hdata.item.team }}</tm-tags>
|
</view>
|
||||||
<text class="pl-6">{{ hdata.item.name }}</text>
|
<view v-else-if="loading == 'error'" class="flex flex-col flex-center" style="width:100%;height:60vh;">
|
||||||
</view>
|
<tm-empty icon="icon-wind-cry" label="阿偶,似乎获取数据失败了~">
|
||||||
<view v-if="hdata.item.description" class="ma-10">{{ hdata.item.description }}</view>
|
<tm-button theme="light-blue" size="m" :shadow="0" @click="fnGetData(true)">刷新试试</tm-button>
|
||||||
<view v-if="hdata.item.location" class="mt-10 text-grey-lighten-1">
|
</tm-empty>
|
||||||
<tm-icons name="icon-position-fill"></tm-icons>
|
</view>
|
||||||
<text class="pl-5">{{ hdata.item.location }}</text>
|
<!-- 内容区域 -->
|
||||||
</view>
|
<view v-else class="content">
|
||||||
<view class="flex-between mt-12 flex-center">
|
<k-touch-listen class="touch-listen-content" @touchLeft="touchLeft" @touchRight="touchRight">
|
||||||
<view>
|
<view v-if="dataList.length === 0" class="content-empty">
|
||||||
<text class="text-size-xs text-red ml-5">{{ hdata.item.likes }}</text>
|
<!-- 空布局 -->
|
||||||
<text class="text-size-xs text-red ml-5">喜欢</text>
|
<tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有分享图片~"></tm-empty>
|
||||||
</view>
|
</view>
|
||||||
<view class="pl-10 text-size-xs text-grey-lighten-1">{{ hdata.item.takeTime }}</view>
|
<block v-else>
|
||||||
</view>
|
<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>
|
||||||
</view>
|
</tm-translate>
|
||||||
</tm-translate>
|
</block>
|
||||||
</template>
|
|
||||||
<template v-slot:right="{ hdata }">
|
<view class="load-text">{{ loadMoreText }}</view>
|
||||||
<tm-translate animation-name="fadeUp">
|
|
||||||
<view class="round-3 shadow-2 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="(index + 1) * 50">
|
|
||||||
<view class="round-3 shadow-2 overflow white mb-24">
|
|
||||||
<tm-images :previmage="false" :src="item.image" @click="fnPreview(item, index)"></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>
|
|
||||||
</block>
|
</block>
|
||||||
</block>
|
</k-touch-listen>
|
||||||
<tm-flotbutton @click="fnToTopPage" color="light-blue" size="m" icon="icon-angle-up"></tm-flotbutton>
|
</view>
|
||||||
<view class="load-text">{{ loadMoreText }}</view>
|
|
||||||
</block>
|
<view v-if="!calcAuditModeEnabled" class="flot-buttons">
|
||||||
</view>
|
<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>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||||
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
|
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
|
||||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||||
import tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
|
import tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
|
||||||
import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue';
|
import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue';
|
||||||
import tmFlowLayout from '@/tm-vuetify/components/tm-flowLayout/tm-flowLayout.vue';
|
import tmFlowLayoutCustom from '@/tm-vuetify/components/tm-flowLayout-custom/tm-flowLayout-custom.vue';
|
||||||
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
|
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
|
||||||
|
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||||
|
|
||||||
export default {
|
import pluginAvailable from "@/common/mixins/pluginAvailable.js"
|
||||||
components: {
|
import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue'
|
||||||
tmSkeleton,
|
export default {
|
||||||
tmTranslate,
|
options: {
|
||||||
tmFlotbutton,
|
multipleSlots: true
|
||||||
tmTags,
|
},
|
||||||
tmEmpty,
|
mixins: [pluginAvailable],
|
||||||
tmIcons,
|
components: {
|
||||||
tmImages,
|
tmSkeleton,
|
||||||
tmFlowLayout,
|
tmTranslate,
|
||||||
tmTabs
|
tmFlotbutton,
|
||||||
},
|
tmTags,
|
||||||
data() {
|
tmEmpty,
|
||||||
return {
|
tmIcons,
|
||||||
isBlackTheme: false,
|
tmImages,
|
||||||
loading: 'loading',
|
tmFlowLayoutCustom,
|
||||||
category: {
|
tmTabs,
|
||||||
activeIndex: 0,
|
tmButton,
|
||||||
activeValue: '',
|
PluginUnavailable
|
||||||
list: []
|
},
|
||||||
},
|
data() {
|
||||||
queryParams: {
|
return {
|
||||||
size: 10,
|
isBlackTheme: false,
|
||||||
page: 0,
|
loading: 'loading',
|
||||||
team: null,
|
category: {
|
||||||
keyword: ''
|
activeIndex: 0,
|
||||||
},
|
activeValue: '',
|
||||||
cache: {
|
list: []
|
||||||
|
},
|
||||||
|
queryParams: {
|
||||||
|
size: 10,
|
||||||
|
page: 1,
|
||||||
|
group: ""
|
||||||
|
},
|
||||||
|
isLoadMore: false,
|
||||||
|
loadMoreText: '',
|
||||||
|
hasNext: false,
|
||||||
dataList: [],
|
dataList: [],
|
||||||
total: 0
|
lock: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
galleryConfig() {
|
||||||
|
return this.$tm.vx.getters().getConfigs.pageConfig.galleryConfig;
|
||||||
},
|
},
|
||||||
isLoadMore: false,
|
haloConfigs() {
|
||||||
loadMoreText: '',
|
return this.$tm.vx.getters().getConfigs;
|
||||||
result: {},
|
},
|
||||||
dataList: []
|
mockJson() {
|
||||||
};
|
return this.$tm.vx.getters().getMockJson;
|
||||||
},
|
},
|
||||||
filters: {
|
calcAuditModeEnabled() {
|
||||||
filterTakeTime(val) {
|
return this.haloConfigs.auditConfig.auditModeEnabled
|
||||||
return uni.$tm.dayjs(val).format('DD/MM/YYYY');
|
},
|
||||||
}
|
},
|
||||||
},
|
watch: {
|
||||||
watch: {
|
galleryConfig: {
|
||||||
globalAppSettings: {
|
async handler(newValue, oldValue) {
|
||||||
deep: true,
|
if (!newValue) return;
|
||||||
handler() {
|
this.fnSetPageTitle(newValue.pageTitle);
|
||||||
// this.isLoadMore = false;
|
this.fnGetCategory();
|
||||||
// this.queryParams.page = 0;
|
},
|
||||||
// this.dataList = [];
|
deep: true,
|
||||||
// this.cache.list = [];
|
immediate: true
|
||||||
// this.cache.total = 0;
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
async onLoad() {
|
||||||
onLoad() {
|
// 检查插件
|
||||||
this.fnSetPageTitle('个人图库');
|
this.setPluginId(this.NeedPluginIds.PluginPhotos)
|
||||||
this.fnGetCategory();
|
this.setPluginError("阿偶,检测到当前插件没有安装或者启用,无法使用图库功能哦,请联系管理员")
|
||||||
},
|
await this.checkPluginAvailable()
|
||||||
created() {
|
},
|
||||||
this.fnGetData();
|
onPullDownRefresh() {
|
||||||
},
|
if (!this.uniHaloPluginAvailable) {
|
||||||
onPullDownRefresh() {
|
uni.hideLoading();
|
||||||
this.isLoadMore = false;
|
uni.stopPullDownRefresh();
|
||||||
this.queryParams.page = 0;
|
return
|
||||||
this.fnGetData();
|
}
|
||||||
},
|
this.dataList = []
|
||||||
onReachBottom(e) {
|
this.isLoadMore = false;
|
||||||
if (this.result.hasNext) {
|
this.queryParams.page = 1;
|
||||||
this.queryParams.page += 1;
|
this.fnGetData(true);
|
||||||
this.isLoadMore = true;
|
},
|
||||||
this.fnGetData();
|
onReachBottom(e) {
|
||||||
} else {
|
if (!this.uniHaloPluginAvailable) return;
|
||||||
uni.showToast({
|
if (this.calcAuditModeEnabled) {
|
||||||
icon: 'none',
|
uni.showToast({
|
||||||
title: '没有更多数据了'
|
icon: 'none',
|
||||||
});
|
title: '没有更多数据了'
|
||||||
}
|
});
|
||||||
},
|
return;
|
||||||
methods: {
|
}
|
||||||
fnOnCategoryChange(index) {
|
|
||||||
this.dataList = [];
|
if (this.hasNext) {
|
||||||
if (index == 0) {
|
this.queryParams.page += 1;
|
||||||
this.queryParams.team = null;
|
this.isLoadMore = true;
|
||||||
|
this.fnGetData(false);
|
||||||
} else {
|
} else {
|
||||||
this.queryParams.team = this.category.list[index];
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '没有更多数据了'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
this.queryParams.page = 0;
|
|
||||||
this.fnToTopPage();
|
|
||||||
this.fnGetData();
|
|
||||||
},
|
},
|
||||||
fnGetCategory() {
|
methods: {
|
||||||
this.$httpApi.getPhotoTeams().then(res => {
|
fnGetDataByCategory(index) {
|
||||||
this.category.list = ['全部', ...res.data];
|
this.fnResetSetAniWaitIndex();
|
||||||
});
|
this.queryParams.group = this.category.list[index].name;
|
||||||
},
|
this.queryParams.page = 1;
|
||||||
fnGetData() {
|
this.fnToTopPage();
|
||||||
uni.showLoading({
|
this.dataList = [];
|
||||||
mask: true,
|
this.fnGetData(true);
|
||||||
title: '加载中...'
|
},
|
||||||
});
|
fnOnCategoryChange(index) {
|
||||||
// 设置状态为加载中
|
if (this.lock) {
|
||||||
if (!this.isLoadMore) {
|
// uni.showToast({
|
||||||
this.loading = 'loading';
|
// title: "上一个请求进行中...",
|
||||||
}
|
// icon: "none"
|
||||||
this.loadMoreText = '';
|
// })
|
||||||
this.$httpApi
|
return;
|
||||||
.getPhotoListByPage(this.queryParams)
|
}
|
||||||
.then(res => {
|
this.fnGetDataByCategory(index)
|
||||||
if (res.status == 200) {
|
},
|
||||||
this.loading = 'success';
|
fnGetCategory() {
|
||||||
this.result = res.data;
|
if (this.calcAuditModeEnabled) {
|
||||||
if (res.data.content.length != 0) {
|
this.fnGetData(true);
|
||||||
const _list = res.data.content.map((item, index) => {
|
return
|
||||||
item['image'] = this.$utils.checkImageUrl(item.thumbnail);
|
}
|
||||||
item['model'] = 'text';
|
this.$httpApi.v2.getPhotoGroupList({
|
||||||
item['takeTime'] = this.$tm.dayjs(item['takeTime']).format('DD/MM/YYYY');
|
page: 1,
|
||||||
return item;
|
size: 0
|
||||||
});
|
}).then(res => {
|
||||||
this.fnCacheDataList(_list);
|
this.category.list = res.items.map(item => {
|
||||||
if (this.globalAppSettings.gallery.useWaterfull) {
|
return {
|
||||||
this.dataList = _list;
|
name: item.metadata.name,
|
||||||
this.$nextTick(() => {
|
displayName: item.spec.displayName,
|
||||||
this.$refs.wafll.pushData(_list);
|
priority: item.spec.priority
|
||||||
});
|
}
|
||||||
} else {
|
}).sort((a, b) => a.priority - b.priority);
|
||||||
this.dataList = this.dataList.concat(_list);
|
|
||||||
|
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(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.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
})
|
||||||
} else {
|
|
||||||
this.loading = 'error';
|
|
||||||
this.waterfall.loading = 'finish';
|
|
||||||
this.loadMoreText = '';
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
console.error(err);
|
|
||||||
this.loading = 'error';
|
|
||||||
this.waterfall.loading = 'finish';
|
|
||||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.hideLoading();
|
|
||||||
uni.stopPullDownRefresh();
|
|
||||||
}, 500);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 缓存数据
|
|
||||||
fnCacheDataList(dataList) {
|
|
||||||
if (this.queryParams.page == 0) {
|
|
||||||
this.cache.dataList = dataList;
|
|
||||||
} else {
|
|
||||||
this.cache.dataList = [...this.cache.dataList, ...dataList];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 瀑布流组件点击事件
|
this.loading = 'success';
|
||||||
fnOnClick(data) {
|
|
||||||
console.log('点击数据', data);
|
if (this.galleryConfig.useWaterfall) {
|
||||||
},
|
this.$nextTick(() => {
|
||||||
// 预览
|
if (isClearWaterfall) {
|
||||||
fnPreview(item, index) {
|
this.$refs.wafll.clear()
|
||||||
if (!index) {
|
}
|
||||||
index = this.dataList.findIndex(x => x.id == item.id);
|
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.v2
|
||||||
|
.getPhotoListByGroupName(this.queryParams)
|
||||||
|
.then(res => {
|
||||||
|
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.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.error(err);
|
||||||
|
this.loading = 'error';
|
||||||
|
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
this.lock = false;
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fnOnFlowClick({
|
||||||
|
item
|
||||||
|
}) {
|
||||||
|
this.fnPreview(item)
|
||||||
|
},
|
||||||
|
// 预览
|
||||||
|
fnPreview(data) {
|
||||||
|
uni.previewImage({
|
||||||
|
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)
|
||||||
}
|
}
|
||||||
uni.previewImage({
|
|
||||||
current: index,
|
|
||||||
urls: this.dataList.map(x => x.image),
|
|
||||||
indicator: 'number',
|
|
||||||
loop: true
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-page {
|
.app-page {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
padding-bottom: 24rpx;
|
|
||||||
background-color: #fafafd;
|
|
||||||
|
|
||||||
&.is-balck {
|
|
||||||
background-color: #212121;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.content {
|
|
||||||
box-sizing: border-box;
|
|
||||||
padding: 0 24rpx;
|
|
||||||
padding-top: 24rpx;
|
|
||||||
|
|
||||||
.content-empty {
|
|
||||||
height: 60vh;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
flex-direction: column;
|
||||||
justify-content: center;
|
padding-bottom: 24rpx;
|
||||||
|
background-color: #fafafa;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.loading-wrap {
|
.content {
|
||||||
box-sizing: border-box;
|
width: 100%;
|
||||||
padding: 24rpx;
|
display: flex;
|
||||||
}
|
flex-wrap: wrap;
|
||||||
</style>
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
.content-empty {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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>
|
||||||
+671
-393
File diff suppressed because it is too large
Load Diff
@@ -1,348 +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="(item, index) in result[0].children" :key="index">
|
|
||||||
<tm-translate animation-name="fadeUp" :wait="(index + 1) * 50">
|
|
||||||
<view class="link-card one round-a-6 flex ma-24 mb-0 pa-24" @click="fnOnLinkEvent(item)">
|
|
||||||
<cache-image class="logo shadow-2" radius="12rpx" width="80rpx" height="80rpx" :url="item.logo" :fileMd5="item.logo" mode="aspectFill"></cache-image>
|
|
||||||
<view class="info pl-24">
|
|
||||||
<view class="name text-size-g">{{ item.name }}</view>
|
|
||||||
<view class="desc mt-12 text-size-s text-grey-darken-1">{{ item.description }}</view>
|
|
||||||
<view class="link mt-12 text-size-m text-grey-darken-1">
|
|
||||||
<text class="iconfont icon-link mr-6 text-size-s"></text>
|
|
||||||
{{ item.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="(index + 1) * 50">
|
|
||||||
<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="(linkIndex + 1) * 50">
|
|
||||||
<!-- 色彩版本 -->
|
|
||||||
<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>
|
<template>
|
||||||
<view class="app-page bg-white flex flex-col">
|
<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="logo mt-40 pt-40">
|
||||||
<view class="mt-12 text-weight-b text-size-lg" :class="{ 'mt-40 pt-40': !uni_halo_logo }">uni-halo</view>
|
<image class="logo-img round-3" src="https://uni-halo.925i.cn/logo.png" mode="aspectFill"></image>
|
||||||
<view class="mt-12 text-size-s text-grey-darken-3"></view>
|
</view>
|
||||||
<view class="list-group mt-48" style="width: 100%;">
|
<view class="mt-12 text-weight-b text-size-lg">uni-halo</view>
|
||||||
<tm-grouplist :shadow="0" :margin="0" :borderBottom="true">
|
<view class="mt-12 text-size-s text-grey-darken-3"></view>
|
||||||
<tm-listitem title="开源组织" :font-size="28" @click="$utils.copyText('https://www.ialley.cn', '巷子工坊官网已复制成功!')">
|
<view class="list-group mt-48" style="width: 100%;">
|
||||||
<text class="text-size-s" slot="rightValue">巷子工坊</text>
|
<tm-grouplist :shadow="0" :margin="0" :borderBottom="true">
|
||||||
</tm-listitem>
|
<tm-listitem title="开源组织" :font-size="28" @click="$utils.copyText('https://www.ialley.cn', '巷子工坊官网已复制成功!')">
|
||||||
<tm-listitem title="开源作者" :font-size="28" @click="$utils.copyText('https://b.925i.cn', '作者博客地址已复制')">
|
<text class="text-size-s" slot="rightValue">巷子工坊</text>
|
||||||
<text class="text-size-s" slot="rightValue">小莫唐尼</text>
|
</tm-listitem>
|
||||||
</tm-listitem>
|
<tm-listitem title="开源作者" :font-size="28" @click="$utils.copyText('https://www.xiaoxiaomo.cn', '作者主页地址已复制')">
|
||||||
<tm-listitem title="作者博客" :font-size="28" @click="$utils.copyText('https://b.925i.cn', '作者博客地址已复制')">
|
<text class="text-size-s" slot="rightValue">小莫唐尼</text>
|
||||||
<text class="text-size-s text-overflow" slot="rightValue">https://b.925i.cn</text>
|
</tm-listitem>
|
||||||
</tm-listitem>
|
<tm-listitem title="作者博客" :font-size="28" @click="$utils.copyText('https://blog.xiaoxiaomo.cn', '作者博客地址已复制')">
|
||||||
<tm-listitem title="文档地址" :font-size="28" @click="$utils.copyText('https://uni-halo.925i.cn', '项目码云仓库已复制')">
|
<text class="text-size-s text-overflow" slot="rightValue">https://blog.xiaoxiaomo.cn</text>
|
||||||
<text class="text-size-s text-overflow" slot="rightValue">https://uni-halo.925i.cn</text>
|
</tm-listitem>
|
||||||
</tm-listitem>
|
<tm-listitem title="文档地址" :font-size="28" @click="$utils.copyText('https://uni-halo.925i.cn', '项目码云仓库已复制')">
|
||||||
<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://uni-halo.925i.cn</text>
|
||||||
<text class="text-size-s text-overflow" slot="rightValue">https://gitee.com/ialley-workshop-open/uni-halo</text>
|
</tm-listitem>
|
||||||
</tm-listitem>
|
<tm-listitem title="码云仓库" :font-size="28"
|
||||||
<tm-listitem title="Github" :font-size="28" @click="$utils.copyText('https://github.com/ialley-workshop-open/uni-halo', 'Github地址已复制')">
|
@click="$utils.copyText('https://gitee.com/ialley-workshop-open/uni-halo', '码云仓库地址已复制')">
|
||||||
<text class="text-size-s text-overflow" slot="rightValue">https://github.com/ialley-workshop-open/uni-halo</text>
|
<text class="text-size-s text-overflow" slot="rightValue">https://gitee.com/ialley-workshop-open/uni-halo</text>
|
||||||
</tm-listitem>
|
</tm-listitem>
|
||||||
</tm-grouplist>
|
<tm-listitem title="Github" :font-size="28"
|
||||||
</view>
|
@click="$utils.copyText('https://github.com/ialley-workshop-open/uni-halo', 'Github地址已复制')">
|
||||||
<view class="copyright bg-white text-size-xs text-align-center text-grey-darken-1 pa-36">
|
<text class="text-size-s text-overflow" slot="rightValue">https://github.com/ialley-workshop-open/uni-halo</text>
|
||||||
<view class="">根据 AGPL-3.0 协议开源</view>
|
</tm-listitem>
|
||||||
<view class="mt-8">「 2022 uni-halo 丨 开源项目丨巷子工坊@小莫唐尼 」</view>
|
</tm-grouplist>
|
||||||
</view>
|
</view>
|
||||||
</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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import tmGrouplist from '@/tm-vuetify/components/tm-grouplist/tm-grouplist.vue';
|
import tmGrouplist from '@/tm-vuetify/components/tm-grouplist/tm-grouplist.vue';
|
||||||
import tmListitem from '@/tm-vuetify/components/tm-listitem/tm-listitem.vue';
|
import tmListitem from '@/tm-vuetify/components/tm-listitem/tm-listitem.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
tmGrouplist,
|
tmGrouplist,
|
||||||
tmListitem
|
tmListitem
|
||||||
},
|
},
|
||||||
computed: {
|
onLoad() {
|
||||||
uni_halo_logo() {
|
this.fnSetPageTitle('关于项目');
|
||||||
return getApp().globalData.uni_halo_logo;
|
},
|
||||||
}
|
methods: {}
|
||||||
},
|
|
||||||
onLoad() {
|
|
||||||
this.fnSetPageTitle('关于项目');
|
|
||||||
},
|
|
||||||
methods: {}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.app-page {
|
.app-page {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
align-items: center;
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
.label {
|
.logo-img {
|
||||||
display: inline-block;
|
width: 160rpx;
|
||||||
min-width: 140rpx;
|
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 {
|
.text-overflow {
|
||||||
width: calc(100vw - 300rpx);
|
width: calc(100vw - 300rpx);
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-group {
|
.list-group {
|
||||||
::v-deep {
|
::v-deep {
|
||||||
.left {
|
.left {
|
||||||
width: 160rpx;
|
width: 160rpx;
|
||||||
min-width: 160rpx;
|
min-width: 160rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
+559
-299
@@ -1,69 +1,85 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page">
|
<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="e-fixed">
|
||||||
<view v-if="loading != 'success'" class="loading-wrap">
|
<tm-tabs color="light-blue" v-model="tab.activeIndex" :list="tab.list" align="center"
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
@change="fnOnTabChange"></tm-tabs>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
</view>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<!-- 占位区域 -->
|
||||||
</view>
|
<view style="width: 100vw;height: 90rpx;"></view>
|
||||||
|
|
||||||
<!-- 加载完成区域 -->
|
<!-- 骨架屏:加载区域 -->
|
||||||
<block v-else>
|
<view v-if="loading !== 'success'" class="loading-wrap">
|
||||||
<view v-if="dataList.length == 0" class="list-empty flex flex-center"><tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无归档的文章"></tm-empty></view>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<view v-else class="e-timeline tm-timeline mt-24">
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<block v-for="(item, index) in dataList" :key="index">
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<view class="tm-timeline-item tm-timeline-item--leftDir">
|
</view>
|
||||||
<view style="width: 160rpx;">
|
|
||||||
<view
|
<!-- 加载完成区域 -->
|
||||||
:style="{ width: '24rpx', height: '24rpx' }"
|
<block v-else>
|
||||||
:class="[black_tmeme ? 'bk' : '']"
|
<view v-if="dataList.length === 0" class="list-empty flex flex-center">
|
||||||
class="flex-center rounded tm-timeline-jidian border-white-a-2 grey-lighten-2 light-blue shadow-primary-4"
|
<tm-empty v-if="calcAuditModeEnabled" icon="icon-shiliangzhinengduixiang-" label="暂无归档的内容"></tm-empty>
|
||||||
></view>
|
<tm-empty v-else icon="icon-shiliangzhinengduixiang-" label="暂无归档的文章"></tm-empty>
|
||||||
<view
|
</view>
|
||||||
:style="{ marginTop: '-24rpx' }"
|
<view v-else class="e-timeline tm-timeline mt-24">
|
||||||
:class="[index !== dataList.length - 1 ? 'tm-timeline-item-boder' : '', black_tmeme ? 'bk' : '']"
|
<block v-for="(item, index) in dataList" :key="index">
|
||||||
class="grey-lighten-2"
|
<view class="tm-timeline-item tm-timeline-item--leftDir">
|
||||||
></view>
|
<view style="width: 160rpx;">
|
||||||
</view>
|
<view :style="{ width: '24rpx', height: '24rpx' }" :class="[black_tmeme ? 'bk' : '']"
|
||||||
<view class="tm-timeline-item-content relative">
|
class="flex-center rounded tm-timeline-jidian border-white-a-2 grey-lighten-2 light-blue shadow-primary-4">
|
||||||
<view class="tm-timeline-item-left">
|
</view>
|
||||||
<view class="time text-weight-b mb-24">
|
<view :style="{ marginTop: '-24rpx' }"
|
||||||
{{ item.year }}年
|
:class="[index !== dataList.length - 1 ? 'tm-timeline-item-boder' : '', black_tmeme ? 'bk' : '']"
|
||||||
<block v-if="tab.activeIndex == 0">{{ item.month }}月</block>
|
class="grey-lighten-2"></view>
|
||||||
<text class="text-size-s text-grey-darken-1 ml-24">(共发布 {{ item.posts.length }} 篇文章)</text>
|
</view>
|
||||||
</view>
|
<view class="tm-timeline-item-content relative">
|
||||||
<block v-if="item.posts.length != 0">
|
<view class="tm-timeline-item-left">
|
||||||
<block v-for="(post, postIndex) in item.posts" :key="post.id">
|
<view class="flex time text-weight-b mb-24">
|
||||||
<tm-translate animation-name="fadeUp" :wait="(postIndex + 1) * 50">
|
<text>{{ item.year }}年</text>
|
||||||
<view class="flex post shadow-3 pa-24 mb-24" :class="[globalAppSettings.layout.cardType]" @click="fnToArticleDetail(post)">
|
<text v-if="tab.activeIndex === 0">{{ item.month }}月</text>
|
||||||
<image class="post-thumbnail" :src="$utils.checkThumbnailUrl(post.thumbnail)" mode="aspectFill"></image>
|
<view v-if="calcAuditModeEnabled" class="text-size-s text-grey-darken-1 ml-12">
|
||||||
<view class="post-info pl-20">
|
(共 {{ item.posts.length }} 篇内容)
|
||||||
<view class="post-info_title text-overflow">{{ post.title }}</view>
|
</view>
|
||||||
<view class="post-info_summary text-overflow-2 mt-12 text-size-s text-grey-darken-1">{{ post.summary }}</view>
|
<view v-else class="text-size-s text-grey-darken-1 ml-12">
|
||||||
<view class="post-info_time mt-12 text-size-s text-grey-darken-1">
|
(共 {{ item.posts.length }} 篇文章)
|
||||||
<text class="iconfont icon-clock text-size-s mr-6"></text>
|
</view>
|
||||||
<text class="time-label">发布时间:</text>
|
</view>
|
||||||
{{ { d: post.createTime, f: 'yyyy年MM月dd日 星期w' } | formatTime }}
|
<block v-if="item.posts.length !== 0">
|
||||||
</view>
|
<block v-for="(post, postIndex) in item.posts" :key="post.metadata.name">
|
||||||
</view>
|
<view class="flex post shadow-3 pa-24 mb-24"
|
||||||
</view>
|
:class="[globalAppSettings.layout.cardType]"
|
||||||
</tm-translate>
|
@click="fnToArticleDetail(post)">
|
||||||
</block>
|
<image class="post-thumbnail"
|
||||||
</block>
|
:src="$utils.checkThumbnailUrl(post.spec.cover)" mode="aspectFill">
|
||||||
<view v-else class="post-empty text-size-m text-grey-darken-1">该日期下暂无归档文章!</view>
|
</image>
|
||||||
</view>
|
<view class="post-info pl-20">
|
||||||
</view>
|
<view class="post-info_title text-overflow">{{ post.spec.title }}
|
||||||
</view>
|
</view>
|
||||||
</block>
|
<view
|
||||||
</view>
|
class="post-info_summary text-overflow-2 mt-12 text-size-s text-grey-darken-1">
|
||||||
<!-- 返回顶部 -->
|
{{ post.status.excerpt }}
|
||||||
<tm-flotbutton @click="fnToTopPage" size="m" color="bg-gradient-light-blue-accent" icon="icon-angle-up"></tm-flotbutton>
|
</view>
|
||||||
</block>
|
<view class="post-info_time mt-12 text-size-s text-grey-darken-1">
|
||||||
</view>
|
<text class="iconfont icon-clock text-size-s mr-6"></text>
|
||||||
|
<text class="time-label">发布时间:</text>
|
||||||
|
{{ {d: post.spec.publishTime, f: 'yyyy年MM月dd日 星期w'} | formatTime }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -72,269 +88,513 @@ import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
|||||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||||
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
|
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
|
||||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||||
|
import qs from 'qs'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
tmSkeleton,
|
tmSkeleton,
|
||||||
tmTranslate,
|
tmTranslate,
|
||||||
tmFlotbutton,
|
tmFlotbutton,
|
||||||
tmTabs,
|
tmTabs,
|
||||||
tmEmpty
|
tmEmpty
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: 'loading',
|
loading: 'loading',
|
||||||
tab: {
|
tab: {
|
||||||
activeIndex: 0,
|
activeIndex: 0,
|
||||||
list: ['按月份查看', '按年份查看']
|
list: ['按月份查看', '按年份查看']
|
||||||
},
|
},
|
||||||
queryParams: {
|
queryParams: {
|
||||||
size: 10,
|
size: 10,
|
||||||
page: 0
|
page: 1
|
||||||
},
|
},
|
||||||
result: null,
|
result: {},
|
||||||
dataList: [],
|
cacheDataList: [], // 所有请求的缓存数据
|
||||||
api: 'getMonthArchives'
|
dataList: [], // 显示的数据
|
||||||
};
|
isLoadMore: false,
|
||||||
},
|
loadMoreText: "加载中..."
|
||||||
computed: {
|
};
|
||||||
black_tmeme: function() {
|
},
|
||||||
return this.$tm.vx.state().tmVuetify.black;
|
computed: {
|
||||||
},
|
black_tmeme: function () {
|
||||||
color_tmeme: function() {
|
return this.$tm.vx.state().tmVuetify.black;
|
||||||
return this.$tm.vx.state().tmVuetify.color;
|
},
|
||||||
}
|
color_tmeme: function () {
|
||||||
},
|
return this.$tm.vx.state().tmVuetify.color;
|
||||||
created() {
|
},
|
||||||
this.fnGetData();
|
haloConfigs() {
|
||||||
},
|
return this.$tm.vx.getters().getConfigs;
|
||||||
onPullDownRefresh() {
|
},
|
||||||
this.fnGetData();
|
mockJson() {
|
||||||
this.queryParams.page = 0;
|
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: {
|
this.loading = 'success';
|
||||||
fnOnTabChange(index) {
|
this.loadMoreText = data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||||
// todo:
|
uni.hideLoading();
|
||||||
const _api = ['getMonthArchives', 'getYearArchives'];
|
uni.stopPullDownRefresh();
|
||||||
this.api = _api[index];
|
|
||||||
this.queryParams.page = 0;
|
},
|
||||||
this.fnGetData();
|
fail: (err) => {
|
||||||
},
|
this.loading = 'error';
|
||||||
fnGetData() {
|
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||||
this.loading = 'loading';
|
uni.$tm.toast(err.message || '数据加载失败!');
|
||||||
uni.showLoading({
|
uni.hideLoading();
|
||||||
mask: true,
|
uni.stopPullDownRefresh();
|
||||||
title: '加载中...'
|
}
|
||||||
});
|
})
|
||||||
this.$httpApi[this.api](this.queryParams)
|
},
|
||||||
.then(res => {
|
// 处理数据分类
|
||||||
this.result = res.data;
|
handleGetPosts(dataList) {
|
||||||
this.dataList = res.data;
|
const posts = {}
|
||||||
setTimeout(() => {
|
const postLabelYearKey = "content.halo.run/archive-year"
|
||||||
this.loading = 'success';
|
const postLabelMonthKey = "content.halo.run/archive-month"
|
||||||
}, 500);
|
dataList.forEach(item => {
|
||||||
})
|
let postItemKey = ""
|
||||||
.catch(err => {
|
if (this.tab.activeIndex === 0) {
|
||||||
console.error(err);
|
postItemKey =
|
||||||
this.loading = 'error';
|
`${item.metadata.labels[postLabelYearKey]}-${item.metadata.labels[postLabelMonthKey]}`
|
||||||
})
|
} else {
|
||||||
.finally(() => {
|
postItemKey = `${item.metadata.labels[postLabelYearKey]}`
|
||||||
setTimeout(() => {
|
}
|
||||||
uni.hideLoading();
|
if (posts[postItemKey]) {
|
||||||
uni.stopPullDownRefresh();
|
posts[postItemKey].push(item)
|
||||||
}, 500);
|
} else {
|
||||||
});
|
posts[postItemKey] = [item]
|
||||||
},
|
}
|
||||||
//跳转文章详情
|
})
|
||||||
fnToArticleDetail(article) {
|
return posts;
|
||||||
uni.navigateTo({
|
},
|
||||||
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
|
// 根据分类的数据,处理成显示的数据
|
||||||
animationType: 'slide-in-right'
|
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>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-page {
|
.app-page {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
background-color: #fafafd;
|
background-color: #fafafd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.auditModeEnabled {
|
||||||
|
width: 100%;
|
||||||
|
height: 80vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
.loading-wrap {
|
.loading-wrap {
|
||||||
padding: 24rpx;
|
padding: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-empty {
|
.list-empty {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.statistics {
|
.statistics {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.e-timeline {
|
.e-timeline {
|
||||||
::v-deep {
|
::v-deep {
|
||||||
.tm-timeline-item > view:first-child {
|
.tm-timeline-item > view:first-child {
|
||||||
width: 110rpx !important;
|
width: 110rpx !important;
|
||||||
}
|
}
|
||||||
.tm-timeline-item-left {
|
|
||||||
max-width: 580rpx !important;
|
.tm-timeline-item-left {
|
||||||
width: 100% !important;
|
max-width: 580rpx !important;
|
||||||
}
|
width: 100% !important;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tm-timeline {
|
.tm-timeline {
|
||||||
.tm-timeline-item {
|
.tm-timeline-item {
|
||||||
.tm-timeline-item-left,
|
|
||||||
.tm-timeline-item-right {
|
|
||||||
width: 200rpx;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tm-timeline-item-content {
|
.tm-timeline-item-left,
|
||||||
display: flex;
|
.tm-timeline-item-right {
|
||||||
justify-content: center;
|
width: 200rpx;
|
||||||
align-items: flex-start;
|
flex-shrink: 0;
|
||||||
align-content: flex-start;
|
}
|
||||||
}
|
|
||||||
.tm-timeline-jidian {
|
.tm-timeline-item-content {
|
||||||
margin: auto;
|
display: flex;
|
||||||
}
|
justify-content: center;
|
||||||
&.tm-timeline-item--leftDir {
|
align-items: flex-start;
|
||||||
display: flex;
|
align-content: flex-start;
|
||||||
flex-flow: row;
|
}
|
||||||
&.endright {
|
|
||||||
justify-content: flex-end;
|
.tm-timeline-jidian {
|
||||||
}
|
margin: auto;
|
||||||
.tm-timeline-item-left,
|
}
|
||||||
.tm-timeline-item-right {
|
|
||||||
width: auto;
|
&.tm-timeline-item--leftDir {
|
||||||
max-width: 400rpx;
|
display: flex;
|
||||||
}
|
flex-flow: row;
|
||||||
.tm-timeline-item-boder {
|
|
||||||
height: 100%;
|
&.endright {
|
||||||
width: 1px;
|
justify-content: flex-end;
|
||||||
margin: auto;
|
}
|
||||||
}
|
|
||||||
.tm-timeline-jidian {
|
.tm-timeline-item-left,
|
||||||
position: relative;
|
.tm-timeline-item-right {
|
||||||
margin: auto;
|
width: auto;
|
||||||
z-index: 2;
|
max-width: 400rpx;
|
||||||
}
|
}
|
||||||
.tm-timeline-item-content {
|
|
||||||
display: flex;
|
.tm-timeline-item-boder {
|
||||||
justify-content: flex-start;
|
height: 100%;
|
||||||
align-items: flex-start;
|
width: 1px;
|
||||||
align-content: flex-start;
|
margin: auto;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
.tm-timeline-jidian {
|
||||||
|
position: relative;
|
||||||
|
margin: auto;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tm-timeline-item-content {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: flex-start;
|
||||||
|
align-content: flex-start;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.post {
|
.post {
|
||||||
width: 560rpx;
|
width: 560rpx;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
&.lr_image_text {
|
|
||||||
}
|
|
||||||
&.lr_text_image {
|
|
||||||
.post-thumbnail {
|
|
||||||
order: 2;
|
|
||||||
}
|
|
||||||
.post-info {
|
|
||||||
order: 1;
|
|
||||||
padding-left: 0;
|
|
||||||
padding-right: 24rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&.tb_image_text {
|
|
||||||
flex-direction: column;
|
|
||||||
.post-thumbnail {
|
|
||||||
width: 100%;
|
|
||||||
height: 220rpx;
|
|
||||||
}
|
|
||||||
.post-info {
|
|
||||||
width: 100%;
|
|
||||||
padding-left: 0;
|
|
||||||
&_title {
|
|
||||||
margin-top: 12rpx;
|
|
||||||
}
|
|
||||||
&_time {
|
|
||||||
.iconfont {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.time-label {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&.tb_text_image {
|
|
||||||
flex-direction: column;
|
|
||||||
.post-thumbnail {
|
|
||||||
order: 2;
|
|
||||||
width: 100%;
|
|
||||||
height: 220rpx;
|
|
||||||
margin-top: 12rpx;
|
|
||||||
}
|
|
||||||
.post-info {
|
|
||||||
order: 1;
|
|
||||||
width: 100%;
|
|
||||||
padding-left: 0;
|
|
||||||
|
|
||||||
&_time {
|
&.lr_image_text {
|
||||||
.iconfont {
|
}
|
||||||
display: none;
|
|
||||||
}
|
&.lr_text_image {
|
||||||
.time-label {
|
.post-thumbnail {
|
||||||
display: inline-block;
|
order: 2;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
.post-info {
|
||||||
}
|
order: 1;
|
||||||
&.only_text {
|
padding-left: 0;
|
||||||
.post-info {
|
padding-right: 24rpx;
|
||||||
padding: 6rpx;
|
}
|
||||||
&_time {
|
}
|
||||||
margin-top: 20rpx;
|
|
||||||
.iconfont {
|
&.tb_image_text {
|
||||||
display: none;
|
flex-direction: column;
|
||||||
}
|
|
||||||
.time-label {
|
.post-thumbnail {
|
||||||
display: inline-block;
|
width: 100%;
|
||||||
}
|
height: 220rpx;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.post-thumbnail {
|
.post-info {
|
||||||
display: none;
|
width: 100%;
|
||||||
}
|
padding-left: 0;
|
||||||
}
|
|
||||||
|
&_title {
|
||||||
|
margin-top: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
&_time {
|
||||||
|
.iconfont {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.time-label {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.tb_text_image {
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.post-thumbnail {
|
||||||
|
order: 2;
|
||||||
|
width: 100%;
|
||||||
|
height: 220rpx;
|
||||||
|
margin-top: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-info {
|
||||||
|
order: 1;
|
||||||
|
width: 100%;
|
||||||
|
padding-left: 0;
|
||||||
|
|
||||||
|
&_time {
|
||||||
|
.iconfont {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.time-label {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.only_text {
|
||||||
|
.post-info {
|
||||||
|
padding: 6rpx;
|
||||||
|
|
||||||
|
&_time {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
|
||||||
|
.iconfont {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.time-label {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-thumbnail {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-thumbnail {
|
.post-thumbnail {
|
||||||
border-radius: 6rpx;
|
border-radius: 6rpx;
|
||||||
width: 200rpx;
|
width: 200rpx;
|
||||||
height: 170rpx;
|
height: 170rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-info {
|
.post-info {
|
||||||
width: 0;
|
width: 0;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
&_title {
|
|
||||||
color: #303133;
|
&_title {
|
||||||
font-size: 28rpx;
|
color: #303133;
|
||||||
font-weight: bold;
|
font-size: 28rpx;
|
||||||
}
|
font-weight: bold;
|
||||||
&_summary {
|
}
|
||||||
display: -webkit-box;
|
|
||||||
line-height: 1.6;
|
&_summary {
|
||||||
}
|
display: -webkit-box;
|
||||||
&_time {
|
line-height: 1.6;
|
||||||
.time-label {
|
}
|
||||||
display: none;
|
|
||||||
}
|
&_time {
|
||||||
}
|
.time-label {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.time {
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+218
-176
@@ -1,203 +1,245 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page" :class="{ 'is-balck grey-darken-6': isBlackTheme }">
|
<view class="app-page" :class="[uniHaloPluginPageClass]">
|
||||||
<!-- 顶部切换 -->
|
<PluginUnavailable v-if="!uniHaloPluginAvailable" :pluginId="uniHaloPluginId"
|
||||||
<view class="e-fixed shadow-2">
|
:error-text="uniHaloPluginAvailableError" />
|
||||||
<tm-search v-model="queryParams.keyword" :round="24" :shadow="0" color="light-blue" insert-color="light-blue" :clear="true" @confirm="fnOnSearch"></tm-search>
|
<template v-else>
|
||||||
<tm-tabs color="light-blue" :shadow="0" v-model="tab.activeIndex" :list="tab.list" align="center" @change="fnOnTabChange"></tm-tabs>
|
|
||||||
</view>
|
<!-- 顶部切换 -->
|
||||||
<!-- 占位区域 -->
|
<view class="e-fixed shadow-1">
|
||||||
<view style="width: 100vw;height: 184rpx;"></view>
|
<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>
|
||||||
<view v-if="loading != 'success'" class="loading-wrap pa-24">
|
<tm-tabs v-if="false" color="light-blue" :shadow="0" v-model="tab.activeIndex" :list="tab.list"
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
align="center" @change="fnOnTabChange"></tm-tabs>
|
||||||
<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>
|
</view>
|
||||||
<block v-else>
|
<!-- 占位区域 -->
|
||||||
<block v-for="(article, index) in dataList" :key="article.id">
|
<view style="width: 100vw;height: 100rpx;"></view>
|
||||||
<!-- 文章卡片 -->
|
<!-- 加载区域 -->
|
||||||
<tm-translate animation-name="fadeUp" :wait="(index + 1) * 50">
|
<view v-if="loading == 'loading'" class="loading-wrap pa-24">
|
||||||
<article-card :article="article" @on-click="fnToArticleDetail"></article-card>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<!-- 广告区域 -->
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<view v-if="haloAdConfig.articles.use && (index + 1) % haloAdConfig.frequency == 0" class="ad-wrap ma-24">
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<!-- #ifdef MP-WEIXIN -->
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<ad v-if="haloAdConfig.unitId" :unit-id="haloAdConfig.unitId"></ad>
|
</view>
|
||||||
<!-- #endif -->
|
<view v-else-if="loading == 'error'" class="content-empty flex flex-center">
|
||||||
<!-- #ifndef MP-WEIXIN -->
|
<tm-empty icon="icon-wind-cry" label="搜索异常"></tm-empty>
|
||||||
<ad v-if="haloAdConfig.adpid" :adpid="haloAdConfig.adpid"></ad>
|
</view>
|
||||||
<!-- #endif -->
|
<!-- 内容区域 -->
|
||||||
|
<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>
|
</view>
|
||||||
</tm-translate>
|
</tm-translate>
|
||||||
</block>
|
|
||||||
|
|
||||||
<tm-flotbutton @click="fnToTopPage" size="m" color="light-blue" icon="icon-angle-up"></tm-flotbutton>
|
<tm-flotbutton @click="fnToTopPage" size="m" color="light-blue"
|
||||||
<view class="load-text">{{ loadMoreText }}</view>
|
icon="icon-angle-up"></tm-flotbutton>
|
||||||
</block>
|
|
||||||
</view>
|
</block>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||||
import tmSearch from '@/tm-vuetify/components/tm-search/tm-search.vue';
|
import tmSearch from '@/tm-vuetify/components/tm-search/tm-search.vue';
|
||||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||||
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
|
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
|
||||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||||
|
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
|
||||||
|
|
||||||
export default {
|
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
||||||
components: {
|
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
||||||
tmSkeleton,
|
|
||||||
tmSearch,
|
|
||||||
tmTranslate,
|
|
||||||
tmTabs,
|
|
||||||
tmFlotbutton,
|
|
||||||
tmEmpty
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
isBlackTheme: false,
|
|
||||||
loading: 'loading',
|
|
||||||
tab: {
|
|
||||||
activeIndex: 0,
|
|
||||||
list: ['全部', '最新文章', '热门文章', '最近更新', '最多点赞']
|
|
||||||
},
|
|
||||||
queryParams: {
|
|
||||||
size: 10,
|
|
||||||
page: 0,
|
|
||||||
sort: 'topPriority,createTime,desc',
|
|
||||||
keyword: ''
|
|
||||||
},
|
|
||||||
cache: {
|
|
||||||
dataList: [],
|
|
||||||
total: 0
|
|
||||||
},
|
|
||||||
isLoadMore: false,
|
|
||||||
loadMoreText: '加载中...',
|
|
||||||
result: {},
|
|
||||||
dataList: []
|
|
||||||
};
|
|
||||||
},
|
|
||||||
onLoad() {
|
|
||||||
this.fnSetPageTitle('文章列表');
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.fnGetData();
|
|
||||||
},
|
|
||||||
onPullDownRefresh() {
|
|
||||||
this.isLoadMore = false;
|
|
||||||
this.queryParams.page = 0;
|
|
||||||
this.fnGetData();
|
|
||||||
},
|
|
||||||
|
|
||||||
onReachBottom(e) {
|
import pluginAvailableMixin from "@/common/mixins/pluginAvailable.js"
|
||||||
if (this.result.hasNext) {
|
import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue'
|
||||||
this.queryParams.page += 1;
|
|
||||||
this.isLoadMore = true;
|
export default {
|
||||||
this.fnGetData();
|
mixins: [pluginAvailableMixin],
|
||||||
} else {
|
components: {
|
||||||
uni.showToast({
|
tmSkeleton,
|
||||||
icon: 'none',
|
tmSearch,
|
||||||
title: '没有更多数据了'
|
tmTranslate,
|
||||||
});
|
tmTabs,
|
||||||
}
|
tmFlotbutton,
|
||||||
},
|
tmEmpty,
|
||||||
methods: {
|
tmTags,
|
||||||
fnOnTabChange(index) {
|
mpHtml,
|
||||||
this.dataList = [];
|
PluginUnavailable
|
||||||
const _sorts = {
|
},
|
||||||
0: '',
|
data() {
|
||||||
1: 'topPriority,createTime,desc',
|
return {
|
||||||
2: 'topPriority,visits,desc',
|
markdownConfig: MarkdownConfig,
|
||||||
3: 'topPriority,updateTime,desc',
|
loading: 'loading',
|
||||||
4: 'topPriority,likes,desc'
|
tab: {
|
||||||
|
activeIndex: 0,
|
||||||
|
list: ['全部', '最新文章', '热门文章', '最近更新', '最多点赞']
|
||||||
|
},
|
||||||
|
queryParams: {
|
||||||
|
keyword: "",
|
||||||
|
limit: 50,
|
||||||
|
highlightPreTag: "",
|
||||||
|
highlightPostTag: ""
|
||||||
|
},
|
||||||
|
cache: {
|
||||||
|
dataList: [],
|
||||||
|
total: 0
|
||||||
|
},
|
||||||
|
dataList: []
|
||||||
};
|
};
|
||||||
this.queryParams.sort = _sorts[index];
|
|
||||||
this.queryParams.page = 0;
|
|
||||||
this.dataList = [];
|
|
||||||
this.fnToTopPage();
|
|
||||||
this.fnGetData();
|
|
||||||
},
|
},
|
||||||
fnOnSearch() {
|
computed: {
|
||||||
this.queryParams.page = 0;
|
haloConfigs() {
|
||||||
this.isLoadMore = false;
|
return this.$tm.vx.getters().getConfigs;
|
||||||
this.fnGetData();
|
},
|
||||||
|
calcAuditModeEnabled() {
|
||||||
|
return this.haloConfigs.auditConfig.auditModeEnabled
|
||||||
|
},
|
||||||
},
|
},
|
||||||
fnGetData() {
|
async onLoad() {
|
||||||
uni.showLoading({
|
this.fnSetPageTitle('内容搜索');
|
||||||
mask: true,
|
// 检查插件
|
||||||
title: '加载中...'
|
this.setPluginId(this.NeedPluginIds.PluginSearchWidget)
|
||||||
});
|
this.setPluginError("阿偶,检测到当前插件没有安装或者启用,无法使用搜索功能哦,请联系管理员")
|
||||||
// 设置状态为加载中
|
if (!await this.checkPluginAvailable()) return
|
||||||
if (!this.isLoadMore) {
|
if (!this.queryParams.keyword) {
|
||||||
this.loading = 'loading';
|
this.loading = 'success'
|
||||||
|
} else {
|
||||||
|
this.fnGetData();
|
||||||
}
|
}
|
||||||
this.loadMoreText = '加载中...';
|
|
||||||
this.$httpApi
|
|
||||||
.getPostList(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();
|
|
||||||
}, 800);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//跳转文章详情
|
onPullDownRefresh() {
|
||||||
fnToArticleDetail(article) {
|
if (!this.uniHaloPluginAvailable) {
|
||||||
uni.navigateTo({
|
uni.hideLoading();
|
||||||
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
|
uni.stopPullDownRefresh();
|
||||||
animationType: 'slide-in-right'
|
return
|
||||||
});
|
}
|
||||||
|
this.fnOnSearch()
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
fnOnTabChange(index) {
|
||||||
|
this.fnResetSetAniWaitIndex();
|
||||||
|
this.dataList = [];
|
||||||
|
this.fnToTopPage();
|
||||||
|
this.fnGetData();
|
||||||
|
},
|
||||||
|
fnOnSearch() {
|
||||||
|
this.fnResetSetAniWaitIndex();
|
||||||
|
if (!this.queryParams.keyword) {
|
||||||
|
this.dataList = []
|
||||||
|
} else {
|
||||||
|
this.fnGetData();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fnGetData() {
|
||||||
|
if (this.calcAuditModeEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 设置状态为加载中
|
||||||
|
this.loading = 'loading';
|
||||||
|
this.$httpApi.v2
|
||||||
|
.getPostListByKeyword(this.queryParams)
|
||||||
|
.then(res => {
|
||||||
|
this.loading = 'success';
|
||||||
|
this.dataList = res.hits;
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.error(err);
|
||||||
|
this.loading = 'error';
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
}, 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'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-page {
|
.app-page {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding-bottom: 24rpx;
|
padding-bottom: 24rpx;
|
||||||
background-color: #fafafd;
|
background-color: #fafafd;
|
||||||
|
|
||||||
&.is-balck {
|
&.is-balck {
|
||||||
background-color: #212121;
|
background-color: #212121;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
padding-top: 24rpx;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.content {
|
|
||||||
padding-top: 24rpx;
|
|
||||||
|
|
||||||
.content-empty {
|
.content-empty {
|
||||||
height: 60vh;
|
height: 60vh;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</style>
|
.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,24 +1,30 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page">
|
<view class="app-page">
|
||||||
<view v-if="loading != 'success'" class="loading-wrap">
|
<view v-if="loading != 'success'" class="loading-wrap">
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
</view>
|
</view>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<view class="empty" v-if="dataList.length == 0"><tm-empty icon="icon-shiliangzhinengduixiang-" label="该分类下暂无文章"></tm-empty></view>
|
<view class="empty" v-if="dataList.length == 0">
|
||||||
<block v-else>
|
<tm-empty icon="icon-shiliangzhinengduixiang-"
|
||||||
<block v-for="(article, index) in dataList" :key="article.createTime">
|
label="该分类下暂无文章"></tm-empty>
|
||||||
<!-- 文章卡片 -->
|
</view>
|
||||||
<tm-translate animation-name="fadeUp" :wait="(index + 1) * 50"><article-card :article="article" @on-click="fnToArticleDetail"></article-card></tm-translate>
|
<block v-else>
|
||||||
</block>
|
<block v-for="(article, index) in dataList" :key="article.createTime">
|
||||||
<view class="load-text">{{ loadMoreText }}</view>
|
<!-- 文章卡片 -->
|
||||||
</block>
|
<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>
|
<tm-flotbutton @click="fnToTopPage" color="light-blue" size="m" icon="icon-angle-up"></tm-flotbutton>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -27,118 +33,134 @@ import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
|||||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||||
import ArticleCard from '@/components/article-card/article-card.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: ''
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
onLoad(e) {
|
export default {
|
||||||
this.slug = e.slug;
|
components: {
|
||||||
this.pageTitle = e.name;
|
tmSkeleton,
|
||||||
this.fnGetData();
|
tmTranslate,
|
||||||
},
|
tmFlotbutton,
|
||||||
onPullDownRefresh() {
|
tmEmpty,
|
||||||
this.isLoadMore = false;
|
ArticleCard
|
||||||
this.queryParams.page = 0;
|
},
|
||||||
this.fnGetData();
|
data() {
|
||||||
},
|
return {
|
||||||
onReachBottom(e) {
|
loading: 'loading',
|
||||||
if (this.result.hasNext) {
|
queryParams: {
|
||||||
this.queryParams.page += 1;
|
size: 10,
|
||||||
this.isLoadMore = true;
|
page: 0
|
||||||
this.fnGetData();
|
},
|
||||||
} else {
|
name: '',
|
||||||
uni.showToast({
|
pageTitle: '加载中...',
|
||||||
icon: 'none',
|
hasNext: false,
|
||||||
title: '没有更多数据了'
|
dataList: [],
|
||||||
});
|
isLoadMore: false,
|
||||||
}
|
loadMoreText: ''
|
||||||
},
|
};
|
||||||
methods: {
|
},
|
||||||
fnGetData() {
|
|
||||||
uni.showLoading({
|
onLoad(e) {
|
||||||
mask: true,
|
this.name = e.name;
|
||||||
title: '加载中...'
|
this.pageTitle = e.title;
|
||||||
});
|
this.fnGetData();
|
||||||
// 设置状态为加载中
|
},
|
||||||
if (!this.isLoadMore) {
|
onPullDownRefresh() {
|
||||||
this.loading = 'loading';
|
this.isLoadMore = false;
|
||||||
}
|
this.queryParams.page = 0;
|
||||||
this.loadMoreText = '加载中...';
|
this.fnGetData();
|
||||||
this.$httpApi
|
},
|
||||||
.getCategoryPostList(this.slug, this.queryParams)
|
onShareAppMessage() {
|
||||||
.then(res => {
|
return {
|
||||||
this.fnSetPageTitle(`分类:${this.pageTitle} (共${res.data.total}篇)`);
|
title: this.pageTitle,
|
||||||
this.result = res.data;
|
path: `/pagesA/category-detail/category-detail?name=${this.name}&title=${this.pageTitle}`
|
||||||
if (this.isLoadMore) {
|
}
|
||||||
this.dataList = this.dataList.concat(res.data.content);
|
},
|
||||||
} else {
|
onShareTimeline() {
|
||||||
this.dataList = res.data.content;
|
return {
|
||||||
}
|
title: this.pageTitle,
|
||||||
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
path: `/pagesA/category-detail/category-detail?name=${this.name}&title=${this.pageTitle}`
|
||||||
setTimeout(() => {
|
}
|
||||||
this.loading = 'success';
|
},
|
||||||
}, 500);
|
onReachBottom(e) {
|
||||||
})
|
if (this.hasNext) {
|
||||||
.catch(err => {
|
this.queryParams.page += 1;
|
||||||
console.error(err);
|
this.isLoadMore = true;
|
||||||
this.loading = 'error';
|
this.fnGetData();
|
||||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
} else {
|
||||||
})
|
uni.showToast({
|
||||||
.finally(() => {
|
icon: 'none',
|
||||||
setTimeout(() => {
|
title: '没有更多数据了'
|
||||||
uni.hideLoading();
|
});
|
||||||
uni.stopPullDownRefresh();
|
}
|
||||||
}, 500);
|
},
|
||||||
});
|
methods: {
|
||||||
},
|
fnGetData() {
|
||||||
//跳转文章详情
|
// uni.showLoading({
|
||||||
fnToArticleDetail(article) {
|
// mask: true,
|
||||||
uni.navigateTo({
|
// title: '加载中...'
|
||||||
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
|
// });
|
||||||
animationType: 'slide-in-right'
|
// 设置状态为加载中
|
||||||
});
|
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>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.app-page {
|
.app-page {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 24rpx 0;
|
padding: 24rpx 0;
|
||||||
background-color: #fafafd;
|
background-color: #fafafd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading-wrap {
|
.loading-wrap {
|
||||||
padding: 0 24rpx;
|
padding: 0 24rpx;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.empty {
|
.empty {
|
||||||
height: 60vh;
|
height: 60vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,163 +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) {
|
|
||||||
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
-234
@@ -1,252 +1,279 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page flex flex-col felx-center bg-white">
|
<view class="app-page flex flex-col felx-center bg-white">
|
||||||
<!-- 信息 -->
|
<!-- 信息 -->
|
||||||
<view class="profile flex flex-col flex-center pa-36">
|
<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="avatar">
|
||||||
<view class="nickname mt-24 text-weight-b text-size-g">{{ bloggerInfo.nickname }}</view>
|
<image class="avatar-img" :src="bloggerInfo.avatar" mode="aspectFill"></image>
|
||||||
<view class="desc mt-24 text-size-m text-grey-darken-3">{{ bloggerInfo.description || '这个博主很懒,竟然没写介绍~' }}</view>
|
</view>
|
||||||
<!-- 联系图标 -->
|
<view class="nickname mt-24 text-weight-b text-size-g">{{ bloggerInfo.nickname }}</view>
|
||||||
<view class="mt-24 contact-icons">
|
<view class="desc mt-24 text-size-m text-grey-darken-3">
|
||||||
<!-- 放全部:似乎显得有点拥挤 -->
|
{{ bloggerInfo.description || '这个博主很懒,竟然没写介绍~' }}
|
||||||
<!-- <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> -->
|
</view>
|
||||||
<!-- 考虑放几个常用的就行 -->
|
<!-- 联系图标 -->
|
||||||
<text class="halocoloricon halocoloricon-qq"></text>
|
<view class="mt-24 contact-icons">
|
||||||
<text class="ml-12 halocoloricon halocoloricon-wechat"></text>
|
<!-- 放全部:似乎显得有点拥挤 -->
|
||||||
<text class="ml-12 halocoloricon halocoloricon-GitHub"></text>
|
<!-- <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="ml-12 halocoloricon halocoloricon-gitee"></text>
|
<!-- 考虑放几个常用的就行 -->
|
||||||
<text class="ml-12 halocoloricon halocoloricon-ic_email_round"></text>
|
<text class="halocoloricon halocoloricon-qq"></text>
|
||||||
</view>
|
<!-- #ifndef MP-QQ -->
|
||||||
<view v-if="false" class="mt-24 ">
|
<text class="ml-12 halocoloricon halocoloricon-wechat"></text>
|
||||||
<tm-button theme="bg-gradient-light-blue-accent" size="m" openType="contact">在线客服联系</tm-button>
|
<!-- #endif -->
|
||||||
<tm-button theme="bg-gradient-orange-accent" size="m" @click="fnOnToWeb">访问PC端博客</tm-button>
|
<text class="ml-12 halocoloricon halocoloricon-GitHub"></text>
|
||||||
</view>
|
<text class="ml-12 halocoloricon halocoloricon-gitee"></text>
|
||||||
</view>
|
<text class="ml-12 halocoloricon halocoloricon-ic_email_round"></text>
|
||||||
<!-- 社交联系方式列表 -->
|
</view>
|
||||||
<view class="contact ma-50 mt-0 pt-12">
|
</view>
|
||||||
<block v-for="(item, index) in result" :key="index">
|
<!-- 社交联系方式列表 -->
|
||||||
<view v-if="item.value" class="item mt-24 flex" @click="fnOnClick(item)">
|
<view class="contact ma-50 mt-0 pt-12">
|
||||||
<view class="left">
|
<block v-if="calcIsNotEmpty">
|
||||||
<text class="icon halocoloricon" :class="[item.icon]"></text>
|
<block v-for="(item, index) in result" :key="index">
|
||||||
<text class="name">{{ item.name }}</text>
|
<view v-if="item.value" class="item mt-24 flex" @click="fnOnClick(item)">
|
||||||
</view>
|
<view class="left">
|
||||||
<view class="right flex-1">{{ item.value }}</view>
|
<text class="icon halocoloricon" :class="[item.icon]"></text>
|
||||||
</view>
|
<text class="name">{{ item.name }}</text>
|
||||||
</block>
|
</view>
|
||||||
</view>
|
<view class="right flex-1">{{ item.value }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
</block>
|
||||||
|
</block>
|
||||||
|
<view v-else class="mt-12 pt-12">
|
||||||
|
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无联系方式"/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.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 {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
tmSkeleton,
|
tmSkeleton,
|
||||||
tmButton
|
tmButton,
|
||||||
},
|
tmEmpty
|
||||||
data() {
|
},
|
||||||
return {
|
data() {
|
||||||
loading: 'loading',
|
return {
|
||||||
queryParams: {
|
loading: 'loading',
|
||||||
size: 10,
|
queryParams: {
|
||||||
page: 0
|
size: 10,
|
||||||
},
|
page: 0
|
||||||
result: [
|
},
|
||||||
{
|
result: [
|
||||||
key: 'qq',
|
{
|
||||||
icon: 'halocoloricon-qq',
|
key: 'qq',
|
||||||
name: '企鹅号',
|
icon: 'halocoloricon-qq',
|
||||||
value: ''
|
name: '企鹅号',
|
||||||
},
|
value: ''
|
||||||
{
|
},
|
||||||
key: 'wechat',
|
{
|
||||||
icon: 'halocoloricon-wechat',
|
key: 'wechat',
|
||||||
name: '微信号',
|
icon: 'halocoloricon-wechat',
|
||||||
value: ''
|
name: '微信号',
|
||||||
},
|
value: ''
|
||||||
{
|
},
|
||||||
key: 'github',
|
{
|
||||||
icon: 'halocoloricon-GitHub',
|
key: 'github',
|
||||||
name: 'Github',
|
icon: 'halocoloricon-GitHub',
|
||||||
value: ''
|
name: 'Github',
|
||||||
},
|
value: ''
|
||||||
{
|
},
|
||||||
key: 'gitee',
|
{
|
||||||
icon: 'halocoloricon-gitee',
|
key: 'gitee',
|
||||||
name: 'Gitee',
|
icon: 'halocoloricon-gitee',
|
||||||
value: ''
|
name: 'Gitee',
|
||||||
},
|
value: ''
|
||||||
{
|
},
|
||||||
key: 'bilibili',
|
{
|
||||||
icon: 'halocoloricon-bilibili',
|
key: 'bilibili',
|
||||||
name: 'Bilibili',
|
icon: 'halocoloricon-bilibili',
|
||||||
value: ''
|
name: 'Bilibili',
|
||||||
},
|
value: ''
|
||||||
{
|
},
|
||||||
key: 'csdn',
|
{
|
||||||
icon: 'halocoloricon-csdn1',
|
key: 'csdn',
|
||||||
name: 'CSDN',
|
icon: 'halocoloricon-csdn1',
|
||||||
value: ''
|
name: 'CSDN',
|
||||||
},
|
value: ''
|
||||||
{
|
},
|
||||||
key: 'blog',
|
{
|
||||||
icon: 'halocoloricon-url-monitor',
|
key: 'blog',
|
||||||
name: '博客地址',
|
icon: 'halocoloricon-url-monitor',
|
||||||
value: ''
|
name: '博客地址',
|
||||||
},
|
value: ''
|
||||||
{
|
},
|
||||||
key: 'juejin',
|
{
|
||||||
icon: 'halocoloricon-juejin',
|
key: 'juejin',
|
||||||
name: '掘金地址',
|
icon: 'halocoloricon-juejin',
|
||||||
value: ''
|
name: '掘金地址',
|
||||||
},
|
value: ''
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
key: 'weibo',
|
key: 'weibo',
|
||||||
icon: 'halocoloricon-social-weibo',
|
icon: 'halocoloricon-social-weibo',
|
||||||
name: '微博地址',
|
name: '微博地址',
|
||||||
value: ''
|
value: ''
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'email',
|
key: 'email',
|
||||||
icon: 'halocoloricon-ic_email_round',
|
icon: 'halocoloricon-ic_email_round',
|
||||||
name: '邮箱地址',
|
name: '邮箱地址',
|
||||||
value: ''
|
value: ''
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
// 获取博主信息
|
authorConfig() {
|
||||||
bloggerInfo() {
|
return this.$tm.vx.getters().getConfigs.authorConfig;
|
||||||
let blogger = this.$tm.vx.getters().getBlogger;
|
},
|
||||||
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
|
bloggerInfo() {
|
||||||
return blogger;
|
let blogger = this.authorConfig.blogger;
|
||||||
}
|
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
|
||||||
},
|
return blogger;
|
||||||
onLoad() {
|
},
|
||||||
this.fnSetPageTitle('联系博主');
|
socialConfig() {
|
||||||
},
|
return this.authorConfig.social;
|
||||||
created() {
|
},
|
||||||
this.fnGetData();
|
calcIsNotEmpty() {
|
||||||
},
|
return this.result.some((item) => item.value !== "");
|
||||||
methods: {
|
}
|
||||||
fnGetData() {
|
},
|
||||||
for (let key in this.$haloConfig.social) {
|
watch: {
|
||||||
this.result.find(x => x.key == key).value = this.$haloConfig.social[key];
|
socialConfig: {
|
||||||
}
|
handler(newVal) {
|
||||||
},
|
if (!newVal) return;
|
||||||
fnOnToWeb() {
|
this.fnGetData();
|
||||||
uni.navigateTo({
|
},
|
||||||
url:
|
deep: true,
|
||||||
'/pagesC/website/website?data=' +
|
immediate: true
|
||||||
JSON.stringify({
|
}
|
||||||
title: this.$haloConfig.title,
|
},
|
||||||
url: this.$haloConfig.social.blog
|
onLoad() {
|
||||||
})
|
this.fnSetPageTitle('联系博主');
|
||||||
});
|
},
|
||||||
},
|
methods: {
|
||||||
fnOnClick(item) {
|
fnGetData() {
|
||||||
if (this.globalAppSettings.contact.isLinkCopy && this.$utils.checkIsUrl(item.value)) {
|
for (let key in this.socialConfig) {
|
||||||
uni.navigateTo({
|
if (key === 'enabled') {
|
||||||
url:
|
continue;
|
||||||
'/pagesC/website/website?data=' +
|
}
|
||||||
JSON.stringify({
|
this.result.find(x => x.key === key).value = this.socialConfig[key];
|
||||||
title: item.name,
|
}
|
||||||
url: item.value
|
},
|
||||||
})
|
fnOnClick(item) {
|
||||||
});
|
this.$utils.copyText(item.value, item.name + ' 已复制!');
|
||||||
} else {
|
// if (this.globalAppSettings.contact.isLinkCopy && this.$utils.checkIsUrl(item.value)) {
|
||||||
this.$utils.copyText(item.value, item.name + ' 已复制!');
|
// uni.navigateTo({
|
||||||
}
|
// url: '/pagesC/website/website?data=' +
|
||||||
}
|
// JSON.stringify({
|
||||||
}
|
// title: item.name,
|
||||||
|
// url: item.value
|
||||||
|
// })
|
||||||
|
// });
|
||||||
|
// } else {
|
||||||
|
// this.$utils.copyText(item.value, item.name + ' 已复制!');
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-page {
|
.app-page {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding-top: 160rpx;
|
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 {
|
.profile {
|
||||||
box-sizing: border-box;
|
.avatar {
|
||||||
border-radius: 12rpx;
|
width: 170rpx;
|
||||||
background-color: #fafafa;
|
height: 170rpx;
|
||||||
// background-color: rgba(0, 0, 0, 0.05);
|
position: relative;
|
||||||
// padding-bottom: 12rpx;
|
box-sizing: border-box;
|
||||||
// border-bottom: 2rpx solid #eee;
|
border-radius: 50%;
|
||||||
padding: 16rpx;
|
border: 6rpx solid #fff;
|
||||||
.left {
|
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.07);
|
||||||
position: relative;
|
overflow: hidden;
|
||||||
width: 140rpx;
|
|
||||||
display: flex;
|
&-img {
|
||||||
align-items: center;
|
width: 100%;
|
||||||
box-sizing: border-box;
|
height: 100%;
|
||||||
// background-color: rgba(0, 0, 0, 0.03);
|
}
|
||||||
border-radius: 12rpx 0 0 12rpx;
|
}
|
||||||
&::after {
|
|
||||||
display: none;
|
.nickname {
|
||||||
content: ':';
|
font-size: 38rpx;
|
||||||
position: absolute;
|
}
|
||||||
right: 18rpx;
|
}
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-50%);
|
.contact-icons {
|
||||||
font-size: 24rpx;
|
.halocoloricon {
|
||||||
color: #666;
|
font-size: 42rpx;
|
||||||
}
|
}
|
||||||
.icon {
|
}
|
||||||
font-size: 24rpx;
|
|
||||||
}
|
.contact {
|
||||||
.name {
|
box-sizing: border-box;
|
||||||
margin-left: 10rpx;
|
border-top: 2rpx solid #f2f2f2;
|
||||||
color: #555;
|
|
||||||
font-size: 24rpx;
|
.item {
|
||||||
}
|
box-sizing: border-box;
|
||||||
}
|
border-radius: 12rpx;
|
||||||
.right {
|
background-color: #fafafa;
|
||||||
width: 0;
|
// background-color: rgba(0, 0, 0, 0.05);
|
||||||
display: flex;
|
// padding-bottom: 12rpx;
|
||||||
align-items: center;
|
// border-bottom: 2rpx solid #eee;
|
||||||
flex-wrap: wrap;
|
padding: 16rpx;
|
||||||
box-sizing: border-box;
|
|
||||||
word-wrap: break-word;
|
.left {
|
||||||
word-break: break-all;
|
position: relative;
|
||||||
font-size: 24rpx;
|
width: 140rpx;
|
||||||
box-sizing: border-box;
|
display: flex;
|
||||||
padding-left: 12rpx;
|
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>
|
</style>
|
||||||
|
|||||||
@@ -1,42 +1,59 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page bg-white round-3 pa-46">
|
<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 v-if="disclaimersContent" style="min-height: 100%;" v-html="disclaimersContent"></view>
|
||||||
<view class="mt-32">1、本博客属于个人非赢利性质的网站,所有转载的文章都以遵循原作者的版权声明注明了文章来源。</view>
|
|
||||||
<view class="mt-24">2、如果原文没有版权声明,按照目前互联网开放的原则,本博客将在不通知作者的情况下转载文章。</view>
|
<!-- 静态写法 -->
|
||||||
<view class="mt-24">3、如果原文明确注明“禁止转载”,本博客将不会转载。</view>
|
<block v-else>
|
||||||
<view class="mt-24">
|
<view class="text-weight-b text-size-lg text-align-center">《 本博客免责声明 》</view>
|
||||||
4、如果本博客转载的文章不符合作者的版权声明或者作者不想让本博客转载您的文章,请邮件告知
|
<view v-if="false" class="text-size-s text-align-center mt-12 text-grey-darken-1">—— 博主:{{ bloggerInfo.nickname }} ——</view>
|
||||||
<text class="text-bg-gradient-light-blue-accent ml-12 mr-12 " @click="$utils.copyText(bloggerInfo.email, '邮箱复制成功!')">
|
<view class="mt-32">1、本博客属于个人非盈利性质的网站,所有转载的文章都以遵循原作者的版权声明注明了文章来源。</view>
|
||||||
<text class="iconfont icon-mail-fill text-size-m mr-6"></text>
|
<view class="mt-24">2、如果原文没有版权声明,按照目前互联网开放的原则,本博客将在不通知作者的情况下转载文章。</view>
|
||||||
{{ bloggerInfo.email }}
|
<view class="mt-24">3、如果原文明确注明“禁止转载”,本博客将不会转载。</view>
|
||||||
</text>
|
<view class="mt-24">
|
||||||
,博主将会在第一时间删除相关信息!
|
4、如果本博客转载的文章不符合作者的版权声明或者作者不想让本博客转载您的文章,请邮件告知
|
||||||
</view>
|
<text class="text-bg-gradient-light-blue-accent ml-12 mr-12 " @click="$utils.copyText(bloggerInfo.email, '电子邮箱已复制到剪贴板!')">
|
||||||
<view class="mt-24">5、本博客转载文章仅为留作备份和知识点分享的目的。</view>
|
<text class="iconfont icon-mail-fill text-size-m mr-6"></text>
|
||||||
<view class="mt-24">6、本博客将尽力确保所提供信息的准确性及可靠性,但不保证信息的正确性和完整性,且不对因信息的不正确或遗漏导致的任何损失或损害承担相关责任。</view>
|
{{ bloggerInfo.email }}
|
||||||
<view class="mt-24">
|
</text>
|
||||||
7、本博客所发布、转载的文章,其版权均归原作者所有。如其他自媒体、网站或个人从本博客下载使用,请在转载有关文章时务必尊重该文章的著作权,保留本博客注明的“原文来源”或者自行去原文处复制版权声明,并自负版权等法律责任。
|
,博主将会在第一时间删除相关信息!
|
||||||
</view>
|
</view>
|
||||||
<view class="mt-24">8、本博客的所有原创文章皆可以任意转载,但转载时务必请注明出处。</view>
|
<view class="mt-24">5、本博客转载文章仅为留作备份和知识点分享的目的。</view>
|
||||||
<view class="mt-24">9、尊重原创,知识共享!</view>
|
<view class="mt-24">
|
||||||
</view>
|
6、本博客将尽力确保所提供信息的准确性及可靠性,但不保证信息的正确性和完整性,且不对因信息的不正确或遗漏导致的任何损失或损害承担相关责任。
|
||||||
|
</view>
|
||||||
|
<view class="mt-24">
|
||||||
|
7、本博客所发布、转载的文章,其版权均归原作者所有。如其他自媒体、网站或个人从本博客下载使用,请在转载有关文章时务必尊重该文章的著作权,保留本博客注明的“原文来源”或者自行去原文处复制版权声明,并自负版权等法律责任。
|
||||||
|
</view>
|
||||||
|
<view class="mt-24">8、本博客的所有原创文章皆可以任意转载,但转载时务必请注明出处。</view>
|
||||||
|
<view class="mt-24">9、尊重原创,知识共享!</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
computed: {
|
computed: {
|
||||||
bloggerInfo() {
|
haloConfigs() {
|
||||||
return this.$tm.vx.getters().getBlogger;
|
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>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.app-page {
|
.app-page {
|
||||||
line-height: 1.65;
|
line-height: 1.65;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
color: var(--main-text-color);
|
color: var(--main-text-color);
|
||||||
}
|
}
|
||||||
</style>
|
</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,133 +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="(index + 1) * 50">
|
|
||||||
<!-- 日记卡片 -->
|
|
||||||
<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,270 +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" :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="(index + 1) * 50">
|
|
||||||
<!-- 列表项 -->
|
|
||||||
<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>
|
|
||||||
@@ -0,0 +1,383 @@
|
|||||||
|
<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.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 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';
|
||||||
|
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',
|
||||||
|
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('恋爱相册');
|
||||||
|
},
|
||||||
|
|
||||||
|
onPullDownRefresh() {
|
||||||
|
this.fnRefresh();
|
||||||
|
},
|
||||||
|
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.e-loading-icon {
|
||||||
|
font-size: 120rpx;
|
||||||
|
// color: #f88ca2;
|
||||||
|
color: #56bbf9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loadig-text {
|
||||||
|
margin-top: 28rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
// color: #f88ca2;
|
||||||
|
color: #56bbf9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-empty {
|
||||||
|
width: 100%;
|
||||||
|
height: 60vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.swiper-album {
|
||||||
|
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 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.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);
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes refreshAni {
|
||||||
|
0% {
|
||||||
|
color: #f88ca2;
|
||||||
|
}
|
||||||
|
|
||||||
|
50% {
|
||||||
|
color: #56bbf9;
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
color: #f88ca2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
<template>
|
||||||
|
<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>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import ScrollBtn from '@/components/scroll-btn/scroll-btn.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-title {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +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="$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 ScrollBtn from '@/components/scroll-btn/scroll-btn.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
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 */
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes loveCardAni {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.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);
|
||||||
|
}
|
||||||
|
|
||||||
|
50% {
|
||||||
|
transform: translateY(-10rpx);
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
+406
-10
@@ -1,22 +1,418 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page bg-white flex flex-center"><text class="text-bg-gradient-red-accent-b">祝有情人👩❤👨终成眷属</text></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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {};
|
return {
|
||||||
},
|
loveDayTimer: null,
|
||||||
onLoad() {
|
loveDayCount: {
|
||||||
this.fnSetPageTitle('恋爱日记');
|
d: 0,
|
||||||
},
|
h: 0,
|
||||||
methods: {}
|
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>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.app-page {
|
.app-page {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 100vh;
|
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%;
|
||||||
|
|
||||||
|
&::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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
|
||||||
|
.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;
|
||||||
|
|
||||||
|
.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;
|
||||||
|
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes loveTimeTitleAni {
|
||||||
|
to {
|
||||||
|
background-position: -200rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes listItemAni1 {
|
||||||
|
0% {
|
||||||
|
transform: translateY(0rpx);
|
||||||
|
}
|
||||||
|
|
||||||
|
50% {
|
||||||
|
transform: translateY(-10rpx);
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
transform: translateY(0rpx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</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>
|
||||||
+291
-237
@@ -14,41 +14,16 @@
|
|||||||
<text class="text-grey text-size-xs px-10 ml-12">应用以及文章列表布局设置</text>
|
<text class="text-grey text-size-xs px-10 ml-12">应用以及文章列表布局设置</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="sheet-content">
|
<view class="sheet-content">
|
||||||
<tm-pickers
|
<tm-pickers title="请选择首页布局" btn-color="light-blue" :default-value.sync="homeLayout.selectDefault"
|
||||||
title="请选择首页布局"
|
rang-key="name" :list="homeLayout.list" @confirm="fnOnHomeLayoutConfirm">
|
||||||
btn-color="light-blue"
|
<tm-input name="status" required title="首页文章布局" placeholder="请选择首页文章布局" disabled align="right"
|
||||||
:default-value.sync="homeLayout.selectDefault"
|
:value="homeLayout.selectLabel" right-icon="icon-angle-right"></tm-input>
|
||||||
rang-key="name"
|
|
||||||
:list="homeLayout.list"
|
|
||||||
@confirm="fnOnHomeLayoutConfirm"
|
|
||||||
>
|
|
||||||
<tm-input
|
|
||||||
name="status"
|
|
||||||
required
|
|
||||||
title="首页布局"
|
|
||||||
placeholder="请选择首页布局"
|
|
||||||
disabled
|
|
||||||
:value="homeLayout.selectLabel"
|
|
||||||
right-icon="icon-angle-right"
|
|
||||||
></tm-input>
|
|
||||||
</tm-pickers>
|
</tm-pickers>
|
||||||
<tm-pickers
|
<tm-pickers title="请选择文章卡片样式" btn-color="light-blue"
|
||||||
title="请选择文章卡片样式"
|
:default-value.sync="articleCardStyle.selectDefault" rang-key="name"
|
||||||
btn-color="light-blue"
|
:list="articleCardStyle.list" @confirm="fnOnArticleCardStyleConfirm">
|
||||||
:default-value.sync="articleCardStyle.selectDefault"
|
<tm-input name="status" required title="文章卡片样式" placeholder="请选择文章卡片样式" disabled align="right"
|
||||||
rang-key="name"
|
:value="articleCardStyle.selectLabel" right-icon="icon-angle-right"></tm-input>
|
||||||
:list="articleCardStyle.list"
|
|
||||||
@confirm="fnOnArticleCardStyleConfirm"
|
|
||||||
>
|
|
||||||
<tm-input
|
|
||||||
name="status"
|
|
||||||
required
|
|
||||||
title="卡片样式"
|
|
||||||
placeholder="请选择文章卡片样式"
|
|
||||||
disabled
|
|
||||||
:value="articleCardStyle.selectLabel"
|
|
||||||
right-icon="icon-angle-right"
|
|
||||||
></tm-input>
|
|
||||||
</tm-pickers>
|
</tm-pickers>
|
||||||
</view>
|
</view>
|
||||||
</tm-sheet>
|
</tm-sheet>
|
||||||
@@ -71,37 +46,58 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="sheet-content">
|
<view class="sheet-content">
|
||||||
<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>
|
<text class="text-size-m">图库瀑布流模式</text>
|
||||||
<tm-switch v-model="appSettings.gallery.useWaterfull" color="light-blue" :text="['是', '否']"></tm-switch>
|
<tm-switch v-model="appSettings.gallery.useWaterfull" color="light-blue"
|
||||||
|
:text="['是', '否']"></tm-switch>
|
||||||
</view>
|
</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>
|
<text class="text-size-m">友链简洁模式</text>
|
||||||
<tm-switch v-model="appSettings.links.useSimple" color="light-blue" :text="['是', '否']"></tm-switch>
|
<tm-switch v-model="appSettings.links.useSimple" color="light-blue"
|
||||||
|
:text="['是', '否']"></tm-switch>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- <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>
|
||||||
|
<tm-pickers
|
||||||
|
v-if="appSettings.barrage.use"
|
||||||
|
title="评论弹幕位置"
|
||||||
|
btn-color="light-blue"
|
||||||
|
:default-value.sync="barrage.selectDefault"
|
||||||
|
rang-key="name"
|
||||||
|
:list="barrage.list"
|
||||||
|
@confirm="fnOnBarrageConfirm"
|
||||||
|
>
|
||||||
|
<tm-input
|
||||||
|
name="status"
|
||||||
|
title="评论弹幕位置"
|
||||||
|
placeholder="请选择评论弹幕位置"
|
||||||
|
disabled
|
||||||
|
align="right"
|
||||||
|
:value="barrage.selectLabel"
|
||||||
|
right-icon="icon-angle-right"
|
||||||
|
></tm-input>
|
||||||
|
</tm-pickers> -->
|
||||||
<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>
|
<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>
|
||||||
<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>
|
<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>
|
||||||
<view v-if="appSettings.banner.useDot" class="mx-32 my-24 border-b-1 pb-24 flex-between">
|
<view v-if="appSettings.banner.useDot" class="mx-32 my-24 border-b-1 pb-24 flex-between">
|
||||||
<text class="text-size-m ">轮播图指示器位置</text>
|
<text class="text-size-m ">轮播图指示器位置</text>
|
||||||
<tm-groupradio name="dotPosition" @change="fnOnBannerDotChange">
|
<tm-groupradio name="dotPosition" @change="fnOnBannerDotChange">
|
||||||
<tm-radio
|
<tm-radio :name="item.name" :size="28" color="light-blue"
|
||||||
:name="item.name"
|
v-for="(item, index) in dotPositionList" :key="index" v-model="item.checked"
|
||||||
:size="28"
|
:label="item.name"></tm-radio>
|
||||||
color="light-blue"
|
|
||||||
v-for="(item, index) in dotPositionList"
|
|
||||||
:key="index"
|
|
||||||
v-model="item.checked"
|
|
||||||
:label="item.name"
|
|
||||||
></tm-radio>
|
|
||||||
</tm-groupradio>
|
</tm-groupradio>
|
||||||
</view>
|
</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>
|
<text class="text-size-m">显示完整统计</text>
|
||||||
<tm-switch v-model="appSettings.about.showAllCount" color="light-blue" :text="['是', '否']"></tm-switch>
|
<tm-switch v-model="appSettings.about.showAllCount" color="light-blue" :text="['是', '否']"></tm-switch>
|
||||||
</view>
|
</view>
|
||||||
@@ -109,10 +105,10 @@
|
|||||||
<text class="text-size-m ">链接直接打开</text>
|
<text class="text-size-m ">链接直接打开</text>
|
||||||
<tm-switch v-model="appSettings.contact.isLinkCopy" color="light-blue" :text="['是', '否']"></tm-switch>
|
<tm-switch v-model="appSettings.contact.isLinkCopy" color="light-blue" :text="['是', '否']"></tm-switch>
|
||||||
</view>
|
</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>
|
<text class="text-size-m ">显示后台入口</text>
|
||||||
<tm-switch v-model="appSettings.about.showAdmin" color="light-blue" :text="['是', '否']"></tm-switch>
|
<tm-switch v-model="appSettings.about.showAdmin" color="light-blue" :text="['是', '否']"></tm-switch>
|
||||||
</view>
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
</tm-sheet>
|
</tm-sheet>
|
||||||
</tm-form>
|
</tm-form>
|
||||||
@@ -127,203 +123,261 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { _DefaultAppSettings } from '@/utils/app.js';
|
import {
|
||||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
_DefaultAppSettings
|
||||||
import tmForm from '@/tm-vuetify/components/tm-form/tm-form.vue';
|
} from '@/utils/app.js';
|
||||||
import tmPickers from '@/tm-vuetify/components/tm-pickers/tm-pickers.vue';
|
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||||
import tmInput from '@/tm-vuetify/components/tm-input/tm-input.vue';
|
import tmForm from '@/tm-vuetify/components/tm-form/tm-form.vue';
|
||||||
import tmSwitch from '@/tm-vuetify/components/tm-switch/tm-switch.vue';
|
import tmPickers from '@/tm-vuetify/components/tm-pickers/tm-pickers.vue';
|
||||||
import tmSheet from '@/tm-vuetify/components/tm-sheet/tm-sheet.vue';
|
import tmInput from '@/tm-vuetify/components/tm-input/tm-input.vue';
|
||||||
import tmGroupradio from '@/tm-vuetify/components/tm-groupradio/tm-groupradio.vue';
|
import tmSwitch from '@/tm-vuetify/components/tm-switch/tm-switch.vue';
|
||||||
import tmRadio from '@/tm-vuetify/components/tm-radio/tm-radio.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 {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
tmButton,
|
tmButton,
|
||||||
tmForm,
|
tmForm,
|
||||||
tmPickers,
|
tmPickers,
|
||||||
tmInput,
|
tmInput,
|
||||||
tmSwitch,
|
tmSwitch,
|
||||||
tmSheet,
|
tmSheet,
|
||||||
tmGroupradio,
|
tmGroupradio,
|
||||||
tmRadio
|
tmRadio
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isBlackTheme: false,
|
isBlackTheme: false,
|
||||||
loading: true,
|
loading: true,
|
||||||
appSettings: {},
|
appSettings: {},
|
||||||
isSaved: true,
|
isSaved: true,
|
||||||
firstLoad: true,
|
firstLoad: true,
|
||||||
homeLayout: {
|
homeLayout: {
|
||||||
list: [{ name: '一行一列', value: 'h_row_col1' }, { name: '一行两列', value: 'h_row_col2' }],
|
list: [{
|
||||||
selectDefault: ['一行一列'],
|
name: '一行一列',
|
||||||
selectLabel: '一行一列',
|
value: 'h_row_col1'
|
||||||
selectValue: 'h_row_col1'
|
}, {
|
||||||
},
|
name: '一行两列',
|
||||||
articleCardStyle: {
|
value: 'h_row_col2'
|
||||||
list: [
|
}],
|
||||||
{ name: '左图右文', value: 'lr_image_text' },
|
selectDefault: ['一行一列'],
|
||||||
{ name: '左文右图', value: 'lr_text_image' },
|
selectLabel: '一行一列',
|
||||||
{ name: '上图下文', value: 'tb_image_text' },
|
selectValue: 'h_row_col1'
|
||||||
{ name: '上文下图', value: 'tb_text_image' },
|
},
|
||||||
{ name: '只有文字', value: 'only_text' }
|
articleCardStyle: {
|
||||||
],
|
list: [{
|
||||||
selectDefault: ['左图右文'],
|
name: '左图右文',
|
||||||
selectLabel: '左图右文',
|
value: 'lr_image_text'
|
||||||
selectValue: 'lr_image_text'
|
},
|
||||||
},
|
{
|
||||||
dotPositionList: [{ name: '右边', value: 'right', checked: true }, { name: '下边', value: 'bottom', checked: false }]
|
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: {
|
watch: {
|
||||||
appSettings: {
|
appSettings: {
|
||||||
deep: true,
|
deep: true,
|
||||||
handler() {
|
handler() {
|
||||||
if (this.firstLoad) {
|
if (this.firstLoad) {
|
||||||
this.firstLoad = false;
|
this.firstLoad = false;
|
||||||
} else {
|
} else {
|
||||||
this.isSaved = false;
|
this.isSaved = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
|
||||||
|
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
this.fnSetPageTitle('应用设置');
|
this.fnSetPageTitle('应用设置');
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.appSettings = Object.assign({}, _DefaultAppSettings, uni.$tm.vx.getters().getSettings);
|
this.appSettings = Object.assign({}, _DefaultAppSettings, uni.$tm.vx.getters().getSettings);
|
||||||
this.fnHandleFormatSelect();
|
this.fnHandleFormatSelect();
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '加载中...',
|
title: '加载中...',
|
||||||
mask: true
|
mask: true
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
}, 500);
|
}, 500);
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
// 统一处理选择框的内容
|
// 统一处理选择框的内容
|
||||||
fnHandleFormatSelect() {
|
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);
|
fnOnHomeLayoutConfirm(e) {
|
||||||
this.homeLayout.selectDefault = [_homeLayout.name];
|
const _select = e[0].data;
|
||||||
this.homeLayout.selectLabel = _homeLayout.name;
|
this.homeLayout.selectDefault = [_select.name];
|
||||||
this.homeLayout.selectValue = _homeLayout.value;
|
this.homeLayout.selectLabel = _select.name;
|
||||||
|
this.homeLayout.selectValue = _select.value;
|
||||||
const _articleCardStyle = this.fnFindObjInList(this.articleCardStyle.list, 'value', this.appSettings.layout.cardType);
|
this.appSettings.layout.home = _select.value;
|
||||||
this.articleCardStyle.selectDefault = [_articleCardStyle.name];
|
},
|
||||||
this.articleCardStyle.selectLabel = _articleCardStyle.name;
|
// 文章卡片样式
|
||||||
this.articleCardStyle.selectValue = _articleCardStyle.value;
|
fnOnArticleCardStyleConfirm(e) {
|
||||||
},
|
const _select = e[0].data;
|
||||||
// 在集合中找匹配的对象
|
this.articleCardStyle.selectDefault = [_select.name];
|
||||||
fnFindObjInList(list, key, value) {
|
this.articleCardStyle.selectLabel = _select.name;
|
||||||
return list.find(x => x[key] == value);
|
this.articleCardStyle.selectValue = _select.value;
|
||||||
},
|
this.appSettings.layout.cardType = _select.value;
|
||||||
fnOnBannerDotChange(e) {
|
},
|
||||||
const _select = e[0];
|
// 弹幕设置
|
||||||
if (_select.index == 0 && _select.checked) {
|
fnOnBarrageConfirm(e) {
|
||||||
this.appSettings.banner.dotPosition = 'right';
|
const _select = e[0].data;
|
||||||
}
|
this.barrage.selectDefault = [_select.name];
|
||||||
if (_select.index == 1 && _select.checked) {
|
this.barrage.selectLabel = _select.name;
|
||||||
this.appSettings.banner.dotPosition = 'bottom';
|
this.barrage.selectValue = _select.value;
|
||||||
}
|
this.appSettings.barrage.type = _select.value;
|
||||||
},
|
},
|
||||||
// 首页布局
|
// 保存
|
||||||
fnOnHomeLayoutConfirm(e) {
|
fnOnSave() {
|
||||||
const _select = e[0].data;
|
this.isSaved = true;
|
||||||
this.homeLayout.selectDefault = [_select.name];
|
this.$tm.vx.commit('setting/setSettings', this.appSettings);
|
||||||
this.homeLayout.selectLabel = _select.name;
|
uni.$tm.toast('保存成功,部分设置在重启后生效!');
|
||||||
this.homeLayout.selectValue = _select.value;
|
},
|
||||||
this.appSettings.layout.home = _select.value;
|
// 使用默认配置
|
||||||
},
|
fnOnSaveDefault() {
|
||||||
// 文章卡片样式
|
uni.$eShowModal({
|
||||||
fnOnArticleCardStyleConfirm(e) {
|
title: '提示',
|
||||||
const _select = e[0].data;
|
content: '您确定要恢复为默认的设置吗?',
|
||||||
this.articleCardStyle.selectDefault = [_select.name];
|
showCancel: true,
|
||||||
this.articleCardStyle.selectLabel = _select.name;
|
cancelText: '否',
|
||||||
this.articleCardStyle.selectValue = _select.value;
|
cancelColor: '#999999',
|
||||||
this.appSettings.layout.cardType = _select.value;
|
confirmText: '是',
|
||||||
},
|
confirmColor: '#03a9f4'
|
||||||
// 保存
|
})
|
||||||
fnOnSave() {
|
.then(res => {
|
||||||
this.isSaved = true;
|
this.isSaved = true;
|
||||||
console.log('this.appSettings', this.appSettings);
|
uni.$tm.vx.actions('setting/updateDefaultAppSettings');
|
||||||
this.$tm.vx.commit('setting/setSettings', this.appSettings);
|
uni.$tm.toast('系统设置已恢复为默认配置,部分设置在重启后生效!');
|
||||||
uni.$tm.toast('保存成功,部分设置在重启后生效!');
|
})
|
||||||
},
|
.catch(err => {});
|
||||||
// 使用默认配置
|
},
|
||||||
fnOnSaveDefault() {
|
fnOnBack() {
|
||||||
uni.$eShowModal({
|
if (this.isSaved) {
|
||||||
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 => {
|
|
||||||
uni.navigateBack();
|
uni.navigateBack();
|
||||||
this.isSaved = true;
|
return;
|
||||||
})
|
}
|
||||||
.catch(err => {});
|
uni.$eShowModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '您当前可能有未保存的数据,确定返回吗?',
|
||||||
|
showCancel: true,
|
||||||
|
cancelText: '否',
|
||||||
|
cancelColor: '#999999',
|
||||||
|
confirmText: '是',
|
||||||
|
confirmColor: '#03a9f4'
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
uni.navigateBack();
|
||||||
|
this.isSaved = true;
|
||||||
|
})
|
||||||
|
.catch(err => {});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.app-page {
|
.app-page {
|
||||||
box-sizing: border-box;
|
|
||||||
padding-bottom: 120rpx;
|
|
||||||
.btn-bar {
|
|
||||||
width: 100vw;
|
|
||||||
position: fixed;
|
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 24rpx;
|
padding-bottom: 120rpx;
|
||||||
gap: 0 24rpx;
|
|
||||||
box-shadow: 0rpx -6rpx 24rpx rgba(0, 0, 0, 0.03);
|
.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 {
|
.required {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-left: 18rpx;
|
padding-left: 18rpx;
|
||||||
&:before {
|
|
||||||
content: '*';
|
&:before {
|
||||||
position: absolute;
|
content: '*';
|
||||||
left: -4rpx;
|
position: absolute;
|
||||||
top: 50%;
|
left: -4rpx;
|
||||||
transform: translateY(-50%);
|
top: 50%;
|
||||||
font-size: 34rpx;
|
transform: translateY(-50%);
|
||||||
color: rgba(244, 67, 54, 1);
|
font-size: 34rpx;
|
||||||
|
color: rgba(244, 67, 54, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
</style>
|
||||||
</style>
|
|
||||||
+449
-318
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page bg-gradient-blue-lighten-b" :style="pageStyle">
|
<view class="app-page bg-gradient-blue-lighten-b" :class="calcPageClass" :style="[calcPageStyle]">
|
||||||
<view class="tn-satr">
|
<view v-if="calcBackgroundType!=='video'" class="tn-satr">
|
||||||
<view class="sky"></view>
|
<view class="sky"></view>
|
||||||
<view class="stars">
|
<view class="stars">
|
||||||
<view class="falling-stars">
|
<view class="falling-stars">
|
||||||
@@ -40,361 +40,492 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="user-info__container flex flex-col flex-center">
|
<video v-else class="video-bg" :object-fit="startConfig.bgVideoFit" :src="$utils.checkUrl(startConfig.bgVideo)" :loop="true"
|
||||||
<image class="user-info__avatar" :src="startInfo.logo" mode="aspectFill"></image>
|
:autoplay="true" :muted="true" :controls="false" :show-fullscreen-btn="false" :show-play-btn="false"
|
||||||
<view class="user-info__nick-name">「 {{ startInfo.title }} 」</view>
|
:show-center-play-btn="false" :show-loading="false" :enable-progress-gesture="false"
|
||||||
</view>
|
:show-progress="false"></video>
|
||||||
|
|
||||||
<view class="text-align-center text-white" style="padding: 60vh 0 0 0;">
|
<cover-view v-if="startConfig.title || startConfig.logo" class="title-container">
|
||||||
<view class="" style="font-size: 44rpx;" v-if="startInfo.desc1">{{ startInfo.desc1 }}</view>
|
|
||||||
<view class="mt-30 text-size-m" v-if="startInfo.desc2">{{ startInfo.desc2 }}</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="" style="padding: 120rpx 200rpx;z-index: 999;position: relative;">
|
<cover-view v-if="startConfig.logo" class="app-logo">
|
||||||
<view class="start-btn" @click="fnStart()">{{ startInfo.btnText || '开始体验' }}</view>
|
<cover-view class="app-logo-border">
|
||||||
</view>
|
<cover-image class="app-logo-image" :src="$utils.checkImageUrl(startConfig.logo)"
|
||||||
|
mode="aspectFill"></cover-image>
|
||||||
|
</cover-view>
|
||||||
|
</cover-view>
|
||||||
|
|
||||||
|
<cover-view v-if="startConfig.title" class="app-title" :style="startConfig.titleStyle">
|
||||||
|
「 {{ 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>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import wave from '@/components/wave/wave.vue';
|
import wave from '@/components/wave/wave.vue';
|
||||||
export default {
|
|
||||||
components: { wave },
|
export default {
|
||||||
computed: {
|
components: {
|
||||||
startInfo() {
|
wave
|
||||||
return getApp().globalData.start;
|
|
||||||
},
|
},
|
||||||
pageStyle() {
|
computed: {
|
||||||
if (this.startInfo.bg) {
|
startConfig() {
|
||||||
const _bg = this.$utils.checkIsUrl(this.startInfo.bg) ? `url(${this.startInfo.bg})` : this.startInfo.bg;
|
return this.$tm.vx.getters().getConfigs.appConfig.startConfig;
|
||||||
return {
|
},
|
||||||
background: _bg + '!important'
|
calcBackgroundType() {
|
||||||
};
|
return this.startConfig.backgroundType;
|
||||||
}
|
},
|
||||||
return {};
|
calcPageClass() {
|
||||||
}
|
if (this.calcBackgroundType === 'color') {
|
||||||
},
|
return [this.startConfig.bg]
|
||||||
methods: {
|
|
||||||
fnStart() {
|
|
||||||
uni.switchTab({
|
|
||||||
url: '/pages/tabbar/home/home',
|
|
||||||
success: () => {
|
|
||||||
uni.setStorageSync('APP_HAS_STARTED', true);
|
|
||||||
}
|
}
|
||||||
});
|
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>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-page {
|
.app-page {
|
||||||
width: 100vw;
|
position: relative;
|
||||||
height: 100vh;
|
width: 100vw;
|
||||||
}
|
height: 100vh;
|
||||||
.start-btn {
|
background-size: cover;
|
||||||
box-sizing: border-box;
|
background-repeat: no-repeat;
|
||||||
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%);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&__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;
|
width: 200rpx;
|
||||||
height: 200rpx;
|
height: 200rpx;
|
||||||
border: 8rpx solid rgba(255, 255, 255, 0.05);
|
|
||||||
border-radius: 50%;
|
&-border {
|
||||||
overflow: hidden;
|
width: 100%;
|
||||||
box-shadow: 0rpx 0rpx 80rpx 0rpx rgba(0, 0, 0, 0.15);
|
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;
|
color: #ffffff;
|
||||||
margin-top: 26rpx;
|
margin-top: 26rpx;
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/* 用户信息 end */
|
|
||||||
|
|
||||||
/* 流星*/
|
|
||||||
.tn-satr {
|
|
||||||
position: fixed;
|
|
||||||
width: 100%;
|
|
||||||
height: 600px;
|
|
||||||
overflow: hidden;
|
|
||||||
flex-shrink: 0;
|
|
||||||
z-index: 998;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stars {
|
.tn-satr {
|
||||||
position: absolute;
|
position: fixed;
|
||||||
z-index: 1;
|
width: 100%;
|
||||||
width: 100%;
|
height: 600px;
|
||||||
height: 400px;
|
overflow: hidden;
|
||||||
}
|
flex-shrink: 0;
|
||||||
|
z-index: 998;
|
||||||
|
}
|
||||||
|
|
||||||
.star {
|
.stars {
|
||||||
border-radius: 50%;
|
position: absolute;
|
||||||
background: #ffffff;
|
z-index: 1;
|
||||||
box-shadow: 0px 0px 6px 0px rgba(255, 255, 255, 0.8);
|
width: 100%;
|
||||||
}
|
height: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
.small-stars .star {
|
.star {
|
||||||
position: absolute;
|
border-radius: 50%;
|
||||||
width: 3px;
|
background: #ffffff;
|
||||||
height: 3px;
|
box-shadow: 0 0 6px 0 rgba(255, 255, 255, 0.8);
|
||||||
}
|
}
|
||||||
.small-stars .star:nth-child(2n) {
|
|
||||||
opacity: 0;
|
.small-stars .star {
|
||||||
-webkit-animation: star-blink 1.2s linear infinite alternate;
|
position: absolute;
|
||||||
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;
|
width: 3px;
|
||||||
height: 3px;
|
height: 3px;
|
||||||
opacity: 1;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@keyframes star-blink {
|
.small-stars .star:nth-child(2n) {
|
||||||
50% {
|
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;
|
width: 3px;
|
||||||
height: 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 {
|
.medium-stars .star:nth-child(1) {
|
||||||
position: absolute;
|
left: 300px;
|
||||||
width: 3px;
|
bottom: 50px;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.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) {
|
.medium-stars .star:nth-child(2) {
|
||||||
left: 80px;
|
left: 400px;
|
||||||
bottom: -100px;
|
bottom: 40px;
|
||||||
}
|
-webkit-animation-delay: 0.4s;
|
||||||
.star-fall:nth-child(1):after {
|
animation-delay: 0.4s;
|
||||||
-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 {
|
.medium-stars .star:nth-child(3) {
|
||||||
20% {
|
left: 330px;
|
||||||
left: -100%;
|
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>
|
||||||
+133
-122
@@ -1,24 +1,29 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page">
|
<view class="app-page">
|
||||||
<view v-if="loading != 'success'" class="loading-wrap">
|
<view v-if="loading != 'success'" class="loading-wrap">
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
</view>
|
</view>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<view class="empty" v-if="dataList.length == 0"><tm-empty icon="icon-shiliangzhinengduixiang-" label="该标签下暂无文章"></tm-empty></view>
|
<view class="empty" v-if="dataList.length == 0">
|
||||||
<block v-else>
|
<tm-empty icon="icon-shiliangzhinengduixiang-"
|
||||||
<block v-for="(article, index) in dataList" :key="article.createTime">
|
label="该标签下暂无文章"></tm-empty>
|
||||||
<!-- 文章卡片 -->
|
</view>
|
||||||
<tm-translate animation-name="fadeUp" :wait="(index + 1) * 50"><article-card :article="article" @on-click="fnToArticleDetail"></article-card></tm-translate>
|
<block v-else>
|
||||||
</block>
|
<block v-for="(article, index) in dataList" :key="article.metadata.name">
|
||||||
<view class="load-text">{{ loadMoreText }}</view>
|
<!-- 文章卡片 -->
|
||||||
</block>
|
<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>
|
<tm-flotbutton @click="fnToTopPage" color="light-blue" size="m" icon="icon-angle-up"></tm-flotbutton>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -27,118 +32,124 @@ import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
|||||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||||
import ArticleCard from '@/components/article-card/article-card.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: ''
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
onLoad(e) {
|
export default {
|
||||||
this.slug = e.slug;
|
components: {
|
||||||
this.pageTitle = e.name;
|
tmSkeleton,
|
||||||
this.fnGetData();
|
tmTranslate,
|
||||||
},
|
tmFlotbutton,
|
||||||
onPullDownRefresh() {
|
tmEmpty,
|
||||||
this.isLoadMore = false;
|
ArticleCard
|
||||||
this.queryParams.page = 0;
|
},
|
||||||
this.fnGetData();
|
data() {
|
||||||
},
|
return {
|
||||||
onReachBottom(e) {
|
loading: 'loading',
|
||||||
if (this.result.hasNext) {
|
queryParams: {
|
||||||
this.queryParams.page += 1;
|
name: "",
|
||||||
this.isLoadMore = true;
|
size: 10,
|
||||||
this.fnGetData();
|
page: 0
|
||||||
} else {
|
},
|
||||||
uni.showToast({
|
name: '',
|
||||||
icon: 'none',
|
pageTitle: '加载中...',
|
||||||
title: '没有更多数据了'
|
|
||||||
});
|
dataList: [],
|
||||||
}
|
hasNext: false,
|
||||||
},
|
isLoadMore: false,
|
||||||
methods: {
|
loadMoreText: ''
|
||||||
fnGetData() {
|
};
|
||||||
uni.showLoading({
|
},
|
||||||
mask: true,
|
|
||||||
title: '加载中...'
|
onLoad(e) {
|
||||||
});
|
this.name = e.name;
|
||||||
// 设置状态为加载中
|
this.queryParams.name = this.name;
|
||||||
if (!this.isLoadMore) {
|
this.pageTitle = e.title;
|
||||||
this.loading = 'loading';
|
this.fnGetData();
|
||||||
}
|
},
|
||||||
this.loadMoreText = '加载中...';
|
onPullDownRefresh() {
|
||||||
this.$httpApi
|
this.isLoadMore = false;
|
||||||
.getTagPostsList(this.slug, this.queryParams)
|
this.queryParams.page = 0;
|
||||||
.then(res => {
|
this.fnGetData();
|
||||||
this.fnSetPageTitle(`标签:${this.pageTitle} (共${res.data.total}篇)`);
|
},
|
||||||
this.result = res.data;
|
onReachBottom(e) {
|
||||||
if (this.isLoadMore) {
|
if (this.hasNext) {
|
||||||
this.dataList = this.dataList.concat(res.data.content);
|
this.queryParams.page += 1;
|
||||||
} else {
|
this.isLoadMore = true;
|
||||||
this.dataList = res.data.content;
|
this.fnGetData();
|
||||||
}
|
} else {
|
||||||
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
uni.showToast({
|
||||||
setTimeout(() => {
|
icon: 'none',
|
||||||
this.loading = 'success';
|
title: '没有更多数据了'
|
||||||
}, 500);
|
});
|
||||||
})
|
}
|
||||||
.catch(err => {
|
},
|
||||||
console.error(err);
|
methods: {
|
||||||
this.loading = 'error';
|
fnGetData() {
|
||||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
// uni.showLoading({
|
||||||
})
|
// mask: true,
|
||||||
.finally(() => {
|
// title: '加载中...'
|
||||||
setTimeout(() => {
|
// });
|
||||||
uni.hideLoading();
|
// 设置状态为加载中
|
||||||
uni.stopPullDownRefresh();
|
if (!this.isLoadMore) {
|
||||||
}, 500);
|
this.loading = 'loading';
|
||||||
});
|
}
|
||||||
},
|
this.loadMoreText = '加载中...';
|
||||||
//跳转文章详情
|
this.$httpApi.v2
|
||||||
fnToArticleDetail(article) {
|
.getPostByTagName(this.name, this.queryParams)
|
||||||
uni.navigateTo({
|
.then(res => {
|
||||||
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
|
this.fnSetPageTitle(`${this.pageTitle} (共${res.total}篇)`);
|
||||||
animationType: 'slide-in-right'
|
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>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.app-page {
|
.app-page {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 24rpx 0;
|
padding: 24rpx 0;
|
||||||
background-color: #fafafd;
|
background-color: #fafafd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading-wrap {
|
.loading-wrap {
|
||||||
padding: 0 24rpx;
|
padding: 0 24rpx;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.empty {
|
.empty {
|
||||||
height: 60vh;
|
height: 60vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user