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

179 Commits

Author SHA1 Message Date
小莫唐尼 1407b58024 fix: 修复分类统计显示undefined问题 #42 2026-07-20 16:21:18 +08:00
小莫唐尼 de142c4729 feat: 添加文章访问统计功能
1. 新增getDomainOnly工具函数用于提取URL域名
2. 新增postTrackersCounter接口调用方法
3. 在文章详情页添加访问数据上报 #31 #41
2026-06-05 13:20:25 +08:00
小莫唐尼 0b4090f9e9 chore: 向gitignore添加.trae目录
忽略.trae临时配置目录,避免将其提交到代码仓库
2026-05-25 00:33:24 +08:00
小莫唐尼 3ccd4f7ccf chore: 删除无用的 git 提交消息规则文件
移除了项目中未实际使用的自定义提交规则配置文件
2026-05-25 00:32:16 +08:00
小莫唐尼 6f01501fd1 chore: 发布版本2.0.10,修复并优化多项功能
1.  更新manifest.json和package.json版本号至2.0.10
2.  修复友情链接api #40
3.  修复图库api #39
4.  统一home.vue页面的代码缩进格式
5.  清理api文件冗余注释,修复接口域名路径
6.  优化图库页面空状态提示文案
2026-05-25 00:27:42 +08:00
yhliu e426abf336 modify home.vue 2026-04-27 22:43:37 +08:00
yhliu a767397e23 feat 链接管理、投票管理控制 2026-04-27 22:43:37 +08:00
yhliu 17f5b4b917 feat 首页是否显示快捷导航 2026-04-27 22:43:37 +08:00
小莫唐尼 94ff37f77f fix: 修复文档图片不显示问题 2026-04-24 18:53:56 +08:00
小莫唐尼 73bc88bad8 fix: 修复域名 后缀带 / 问题,修改doc文档 2026-04-24 18:06:23 +08:00
小莫唐尼 72dc278a2b feat: 修复数据看板无法滚动问题 2025-11-28 01:19:52 +08:00
小莫唐尼 7ba35ffd5d feat: 新增数据可视化看板、删除多余的文件 2025-11-28 00:01:00 +08:00
小莫唐尼 3643bdf6f6 fix: 修复海报保存问题 2025-11-26 15:19:04 +08:00
liuyiwuqing 21fee2dc9a feat(auth): 限制阅读支持评论后访问
- 引入 getOpenid 和 getNologinEmail 方法统一管理认证信息
- 替换原有直接读取 storage 方式为封装方法调用
- 优化文章详情页按钮文案展示逻辑
- 新增评论后自动刷新限制阅读内容功能
- 调整评论权限提示逻辑,跳转至评论弹窗而非 toast 提示
2025-11-25 21:32:07 +08:00
小莫唐尼 90f6516f45 fix: 修复文章详情的豆瓣资源名称重复显示 2025-11-13 18:43:43 +08:00
小莫唐尼 a15621d55e feat: 优化文章详情的豆瓣资源显示 2025-11-13 18:33:40 +08:00
小莫唐尼 a717beb0e7 feat: 文章详情支持豆瓣插件 2025-11-13 17:37:33 +08:00
liuyiwuqing b9ad94ddb5 !26 fix(api):修复友情链接提交接口地址
* fix(api):修复友情链接提交接口地址
2025-10-20 08:51:09 +00:00
小莫唐尼 9ab013562d fix: 修复投票状态显示问题 2025-08-29 17:52:53 +08:00
小莫唐尼 a8bd121deb feat: 文章详情有封面图的时候支持点击预览大图 2025-08-22 11:16:33 +08:00
小莫唐尼 476a1ec48e fix: 修复投票详情页面分享BUG 2025-08-22 11:15:56 +08:00
小莫唐尼 31ade9908a feat: 优化投票功能,调整API 2025-08-21 19:32:22 +08:00
小莫唐尼 5606e8c59f fix: 修复投票多选BUG 2025-08-21 11:18:08 +08:00
小莫唐尼 61d3b22fdb fix: 修复插件状态检测功能 2025-08-21 11:17:36 +08:00
小莫唐尼 c05aa5253c feat: 优化投票功能,在审核模式下设置不显示 2025-08-20 23:47:05 +08:00
小莫唐尼 0b599dcced feat: 优化首页快捷导航 2025-08-20 23:29:05 +08:00
小莫唐尼 623e3fa59a feat: 文章详情支持投票功能 2025-08-20 23:19:41 +08:00
小莫唐尼 1075f588fa fix: 修复全局预定义css影响问题 2025-08-20 22:00:47 +08:00
小莫唐尼 c0d8cb2c3b feat: 新增投票功能 2025-08-20 21:56:34 +08:00
小莫唐尼 9c6a054b12 feat: 补充遗漏插件检查组件 2025-08-20 21:55:11 +08:00
小莫唐尼 6a05f664ba feat: 添加插件检测 2025-08-20 21:53:24 +08:00
小莫唐尼 9c4d2242ae fix: 修复瞬间详情显示bug 2025-07-22 00:40:36 +08:00
小莫唐尼 eac027c116 feat: 内容搜索支持显示文章和瞬间、瞬间支持跳转详情 2025-07-22 00:07:57 +08:00
小莫唐尼 3a08008192 fix: 修复审核模式瞬间无法正确加载数据问题 (#33) 2025-07-21 22:19:06 +08:00
小莫唐尼 7daf93d51f fix: 修复瞬间视频可同时播放多个视频bug、优化列表加载 2025-07-21 17:53:36 +08:00
小莫唐尼 409be28deb fix: 修复图库添加左右手势滑动后布局显示bug 2025-07-20 00:11:41 +08:00
小莫唐尼 97e358e41f fix: 修复图库功能loading 成功状态 error 改为 success 2025-07-20 00:04:53 +08:00
小莫唐尼 c17e668afe feat: 优化返回顶部按钮大小 2025-07-19 23:59:56 +08:00
小莫唐尼 4611932ad8 feat: 图库支持左右滑动 2025-07-19 23:46:40 +08:00
小莫唐尼 452d021816 fix: 修复图库分类排序问题 2025-07-19 14:08:44 +08:00
小莫唐尼 d71022c224 fix: 修复分类详情分享bug 2025-07-01 20:23:06 +08:00
小莫唐尼 d521a641de refactor: 对token配置进行重构、同时修复token获取失败的问题 2025-07-01 20:09:05 +08:00
小莫唐尼 4246d8cdcb refactor: 调整默认的配置文件 2025-06-29 11:29:06 +08:00
小莫唐尼 6989fd8ddc fix: 修复自定义轮播图弹窗链接跳转网页问题 2025-06-28 15:09:56 +08:00
小莫唐尼 742b51a23e feat: 新增瞬间支持音频 2025-06-25 18:51:44 +08:00
小莫唐尼 bc541a3ef6 fix: 修复瞬间内容中的图片视频无法展示问题 2025-06-25 18:33:44 +08:00
小莫唐尼 67fc682164 feat: 瞬间卡片增加标签显示功能 2025-06-25 17:28:57 +08:00
小莫唐尼 b43dd7e5a7 fix: 修复启动页面视频背景url兼容问题 2025-06-25 16:22:07 +08:00
小莫唐尼 e29ccf65c5 fix: 修复搜索功能 2025-06-22 12:02:43 +08:00
小莫唐尼 91553fc053 feat: 优化分类显示按钮根据审核模式状态显示因此 2025-06-22 11:15:20 +08:00
小莫唐尼 22f57b7860 feat: 优化UI 2025-06-22 11:06:41 +08:00
小莫唐尼 2a25727c0b feat: 分类页面支持切换不同的展示模式 2025-06-16 19:42:45 +08:00
小莫唐尼 eb69ae4af6 feat: 更新版本 2.0.8 2025-06-15 18:42:00 +08:00
小莫唐尼 2fd83a7814 feat: 新增首页轮播支持配置 2025-06-15 18:38:52 +08:00
小莫唐尼 8963ba1921 fix: 修复首页和分类页面显示已经隐藏的分类数据问题 2025-06-15 14:58:07 +08:00
liuyiwuqing 051c72b584 !25 支持文章自定义验证码获取方式、优化友链提交页面
* fix(提交链接): 修复博客 logo 显示问题
* feat(plugin): 重构友链提交插件配置
* feat(api): 为 restrict-read 请求添加微信会话 ID 并支持自定义验证码类型
2025-06-15 06:37:50 +00:00
小莫唐尼 552827eaac update: 调整token配置参数 2025-06-13 12:47:12 +08:00
liuyiwuqing e8d13c674f !24 feat(restrict-read): 实现文章限制阅读功能
* feat(restrict-read): 实现文章限制阅读功能
* Merge remote-tracking branch 'origin/v2.0-beta' into v2.0-beta
* feat(restrict-read): 实现文章限制阅读功能
2025-06-13 03:38:44 +00:00
小莫唐尼 256bc0e00f update: 首页分类查询过滤 2025-06-11 15:57:35 +08:00
小莫唐尼 9aa0e310f2 fix: 修复文章详情海报二维码在安卓下显示异常问题 2025-02-14 16:44:43 +08:00
小莫唐尼 6a0bb0e07f update: 文章海报取消渐变背景 2025-02-07 21:21:51 +08:00
小莫唐尼 044f737016 update: 瞬间过滤非公开的内容 2025-02-07 21:11:48 +08:00
小莫唐尼 27b3d31828 update: 优化文章详情海报图片在安卓下显示不完整问题 2025-02-07 21:03:43 +08:00
小莫唐尼 64c9a15d51 update: 修改README内容 2024-12-04 17:28:13 +08:00
小莫唐尼 df4c58d3e4 feat: 文章详情新增评论自动滚动到评论区域 2024-12-03 10:04:08 +08:00
小莫唐尼 93f23696ef update: 修改作者相关网页地址、免责声明页面邮箱点击可复制 2024-12-03 09:25:50 +08:00
小莫唐尼 2ed7e1a260 update: 修改作者博客地址 2024-11-29 16:16:20 +08:00
小莫唐尼 e19b107ed0 feat: 新增文章点赞功能 2024-11-06 19:23:13 +08:00
小莫唐尼 7c15c84dba update: 调整获取模拟参数请求策略 2024-10-28 18:38:29 +08:00
小莫唐尼 e8edc03526 update: 修改我的页面文章归档的显示策略 2024-10-28 18:28:56 +08:00
小莫唐尼 2b717ad449 update: 修改模拟数据请求地址为动态配置 2024-10-28 18:25:40 +08:00
小莫唐尼 5efc877a89 feat: 添加模拟数据模板 2024-10-28 18:00:19 +08:00
小莫唐尼 75a133415a fix: 修复README内容链接丢失 2024-10-28 17:57:37 +08:00
小莫唐尼 bf41b08b35 update: 优化审核模式,新增审核使用模拟数据 2024-10-28 17:53:43 +08:00
小莫唐尼 74a5efb596 Merge branch 'main' of https://github.com/ialley-workshop-open/uni-halo 2024-10-22 18:26:29 +08:00
小莫唐尼 40dd4f4b7f update: 调整审核模式隐藏部分内容,修复分类显示控制不生效 2024-10-22 18:19:23 +08:00
小莫唐尼 341670adcf fix: 修复恋爱日记图标丢失问题 2024-10-22 18:06:34 +08:00
小莫唐尼 115aea2580 fix: 修复文章分享功能 2024-10-22 17:03:06 +08:00
小莫唐尼 58f1e7f131 fix: 修复文章分享功能 2024-10-22 16:30:30 +08:00
小莫唐尼 26ce84b950 fix: 修复瞬间视频不显示bug 2024-10-17 18:49:28 +08:00
小莫唐尼 32b3bbaa74 fix: 修复文章归档 2024-10-17 18:07:15 +08:00
小莫唐尼 76c00f31f6 update: 恋爱配置导航内图标支持后台配置 2024-10-17 17:29:15 +08:00
小莫唐尼 e28ea6ca08 fix: 修复文章归档功能 2024-10-17 17:19:39 +08:00
小莫唐尼 a98254e6cc fix: 修复编译到app时,启动页按钮样式丢失问题 2024-10-17 11:28:13 +08:00
小莫唐尼 82062d9465 fix: 修复首页轮播图不显示问题 2024-08-27 20:41:37 +08:00
小莫唐尼 706cee2240 fix: 修复图库瀑布流模式无数据下,切换其他分类有数据不显示数据bug 2024-08-18 20:41:03 +08:00
liuyiwuqing da60eb2daf 1. 新增小程序审核模式 2024-08-05 19:23:16 +08:00
liuyiwuqing a764c3dbfe Merge remote-tracking branch 'origin/v2.0-beta' into v2.0-beta 2024-08-05 19:17:50 +08:00
小莫唐尼 88fb74a795 fix: 修复Halo最新版本搜索接口字段不存在问题 2024-08-05 19:04:55 +08:00
liuyiwuqing 52d4b7927b 1. 优化密码访问,实现联动插件动态启用关闭;
2. 文章海报分享支持动态小程序码;
3. 支持扫描文章海报跳转指定文章详情;
2024-08-02 15:28:50 +08:00
小莫唐尼 ff31e0d8e8 feat: 首页左上角图标支持跳转到关于页面 2024-07-16 11:20:14 +08:00
小莫唐尼 a65ea2617b update: 调整部分显示的内容,如文章相关文字进行替换 2024-07-16 11:13:52 +08:00
小莫唐尼 bb228c6705 fix: 修复首页分页失败问题,重新添加node依赖 2024-07-16 10:54:55 +08:00
小莫唐尼 62992b2688 fix: 修复loading图片地址异常问题 2024-07-15 18:40:27 +08:00
小莫唐尼 da141ae10a update: README.md 2024-07-15 09:09:17 +08:00
小莫唐尼 d22224e2fc update: 移除node_modules依赖 2024-07-11 11:28:27 +08:00
小莫唐尼 d0b3a42c1d fix: 修复启动页面图片背景不生效问题、取消logo阴影 2024-07-10 23:00:00 +08:00
小莫唐尼 c3349ae070 fix: 修复启动页面视频背景下文字遮挡问题、新增更多参数配置 2024-07-10 17:17:24 +08:00
小莫唐尼 ad6719e201 feat: 启动页面支持视频背景 2024-07-10 11:20:25 +08:00
小莫唐尼 0e342d5fa3 fix: 修复恋爱相册无封面取值问题 2024-07-09 16:11:28 +08:00
小莫唐尼 daf1318a90 update: 更新README文档 2024-07-05 19:04:44 +08:00
小莫唐尼 d4ccc9b7d6 fix: 修复图库瀑布流bug 2024-07-05 17:41:39 +08:00
小莫唐尼 ce60c334ec fix: 修复图库配置不生效问题,取消默认配置 2024-07-04 11:00:25 +08:00
小莫唐尼 ca723bae80 update: 增加图库可进行配置是否使用瀑布流还是列表、调整文章详情和关于页面图片配置 2024-07-04 10:42:32 +08:00
小莫唐尼 c312fab4b1 fix: 修复图库图片下拉和加载更多的时候清空且随机显示问题 2024-07-03 18:31:43 +08:00
小莫唐尼 d9db03959a update: 调整联系博页面,可在后台配置显示隐藏 2024-07-02 18:04:18 +08:00
小莫唐尼 add84f6e4b update: 文章详情广告字段调整 2024-07-02 17:43:18 +08:00
小莫唐尼 850ee73fa2 feat: 图库支持瀑布流 2024-07-02 15:40:43 +08:00
小莫唐尼 77da85f7d4 fix: 修复文章评论回复功能 2024-06-27 00:21:26 +08:00
小莫唐尼 4d0901b650 update: 删除分享配置,使用微信默认的分享机制 2024-06-26 23:41:00 +08:00
小莫唐尼 66a39dd723 fix: 修复文章海报摘要过长,并且显示html标签的问题 2024-06-26 15:52:17 +08:00
小莫唐尼 4cdcbb1958 fix: 修复默认进入文章详情页面自动弹出键盘问题 2024-06-26 14:56:38 +08:00
小莫唐尼 e0569e287f fix: 修复分享混入代码错误问题 2024-06-26 14:43:48 +08:00
小莫唐尼 b42932ddad fix: 修复分享图片失效问题 2024-06-26 11:54:25 +08:00
小莫唐尼 cc05b64dec update: 调整首页顶部头像为应用LOGO、调整启动页面,增加是否每次都显示判断 2024-06-26 09:47:04 +08:00
小莫唐尼 aec54e8c5b fix: 修复友情链接复制问题 2024-06-26 09:19:54 +08:00
小莫唐尼 15e95a2f3e update: 取消应用设置入口 2024-06-26 00:33:07 +08:00
小莫唐尼 74e5c9c3cf fix: 友链分组名称 2024-06-26 00:32:19 +08:00
小莫唐尼 85227a8aa4 refactor: 重构评论功能,评论页面改为弹窗方式 2024-06-26 00:19:35 +08:00
小莫唐尼 e7a00c5b69 update: 调整友情链接页面,显示分组、显示弹窗详情 2024-06-25 19:15:42 +08:00
小莫唐尼 85e558f1a0 fix: 修复文章详情评论区按钮显示隐藏问题 2024-06-25 12:19:21 +08:00
小莫唐尼 fade65397d fix: 修复启动页面无法正常启动问题 2024-06-25 12:10:53 +08:00
小莫唐尼 a2bd2cc8ba fix: 修复免责声明页面显示异常问题 2024-06-25 12:07:29 +08:00
小莫唐尼 bdaeb98432 fix: 修复关于页面背景图不显示和免责声明页面内容不显示问题 2024-06-25 11:26:10 +08:00
小莫唐尼 ccefbcee02 fix: 修复关于页面图片配置路径问题 2024-06-25 10:52:36 +08:00
小莫唐尼 e5590c0a22 fix: 修复启动页面图片配置路径问题 2024-06-25 10:50:20 +08:00
小莫唐尼 a85131308c update: 修改说明文档 2024-06-24 19:46:06 +08:00
小莫唐尼 e17edade28 refactor: 将页面配置通过插件动态化配置(plugin-uni-halo) 2024-06-24 18:59:05 +08:00
liuyiwuqing 959acab9c7 1. 修复文章密码访问失效问题 2024-06-15 18:28:58 +08:00
liuyiwuqing 0b59f69fa0 1. 提取tools工具箱插件配置 2024-06-15 17:33:06 +08:00
liuyiwuqing ab755a8623 1. 文章验证码相关接口更新;
2. 友链提交相关接口更新;
2024-06-09 15:33:26 +08:00
小莫唐尼 a67ad88c3f fix: 修复评论头像字段错误问题 2024-06-04 17:42:51 +08:00
小莫唐尼 6684f80f02 update: 调整插件配置为全局混入 2024-06-03 10:28:00 +08:00
小莫唐尼 620354b77a update: 优化友链提交配置 2024-06-02 19:38:27 +08:00
小莫唐尼 19c4e12a5b update: 删除后台管理相关页面代码 2024-06-02 18:46:36 +08:00
liuyiwuqing 3b0ef59ca7 新增友链提交功能 2024-05-31 18:47:19 +08:00
liuyiwuqing 0386c66b70 修复广告id变量引用问题 2024-05-28 17:34:34 +08:00
小莫唐尼 9721932c34 update: 优化代码格式 2024-05-27 23:10:23 +08:00
小莫唐尼 f9fce7d0ed !16 新增文章访问验证码功能
Merge pull request !16 from liuyiwuqing/v2.0-beta
2024-05-27 15:01:26 +00:00
liuyiwuqing 4747d593be 新增文章访问验证码功能
使用教程:https://blog.muyin.site/archives/3gysn5O9
2024-05-27 22:29:15 +08:00
小莫唐尼 7d8e4ad559 docs: 更新文档 2024-05-25 17:05:09 +08:00
小莫唐尼 3d02b8cc44 fix: 修复文章详情评论头像问题 2024-05-25 16:13:37 +08:00
小莫唐尼 595c2d7cb7 fix: 修复文章搜索内容不显示问题 2024-05-25 15:40:38 +08:00
小莫唐尼 2154daea57 fix: 修复首页文章请求地址默认使用代理问题 2024-05-25 15:00:48 +08:00
小莫唐尼 85f166e7d0 fix: 修复首页文章排序问题、修复文章详情广告问题 2024-05-25 14:58:28 +08:00
小莫唐尼 0d618e21ce fix: 修复瞬间图片预览索引不正确 2024-05-25 14:02:26 +08:00
小莫唐尼 8d610473b3 fix: 修复个人图库分类少于2条不显示问题,修复图片预览问题 2024-05-22 22:29:13 +08:00
小莫唐尼 512a4013b9 fix: 修复首页加载异常问题 2024-05-22 00:43:24 +08:00
小莫唐尼 f6069cad95 update: 修复首次运行跳转页面非首页问题 2024-05-21 10:00:07 +08:00
小莫唐尼 90ef890766 update: 添加忽略文件 2024-05-20 11:23:52 +08:00
小莫唐尼 5727efa820 update: 正式支持 Halo 2.x 版本(uni-halo v2.0-beta ) 2024-05-20 01:32:31 +08:00
小莫唐尼 057a7cf6f0 release: 发布 uni-halo beta-v2.0 版本 2024-05-20 01:27:15 +08:00
小莫唐尼 a81c506a14 修改:优化文章分类添加密码验证功能 2023-08-03 02:31:22 +08:00
小莫唐尼 70dc7cd0a7 修改:优化文章卡片样式 2023-08-03 01:55:57 +08:00
小莫唐尼 ee28753094 修改:取消博客页面的loading 2023-08-03 01:44:24 +08:00
小莫唐尼 91923c0b42 同步代码 2023-08-03 01:37:20 +08:00
cuolv f6feecb324 新增:私密分类的访问 2023-08-02 05:30:13 +00:00
小莫唐尼 6fdaeed792 update:修改README.md 2023-06-25 09:28:49 +08:00
小莫唐尼 f838da43d8 修改:优化列表动画效果 2023-06-08 21:23:21 +08:00
小莫唐尼 21d723d260 新增:文章详情原文链接、访问密码功能 2023-06-08 20:48:15 +08:00
小莫唐尼 d701867b83 修改:更新README 2023-05-14 11:12:48 +08:00
小莫唐尼 66f4ccffc0 修改:简单兼容QQ小程序(未测试) 2023-05-14 11:08:20 +08:00
小莫唐尼 9720743c80 修改:修复友情链接未分组并且使用色彩版本无法展示BUG 2023-03-18 00:04:25 +08:00
小莫唐尼 6ba87b1972 修改:修复文章详情页面不兼容其他pc端主题导致文章内容不显示的BUG 2023-02-07 15:39:58 +08:00
小莫唐尼 a0f3d1b220 修改:修复文章分享好友和朋友圈功能 2023-02-05 18:40:40 +08:00
小莫唐尼 6e80fa14c8 修改:修复文章和分类无封面图使用静态默认图片无法显示的BUG 2023-01-13 01:17:57 +08:00
小莫唐尼 22a8e92dc2 修改:修复tm-vuetify 在 HBuilderX3.6.14版本中 dayjs 找不到的问题 2022-12-26 20:09:30 +08:00
小莫唐尼 6b1e0e5cc0 新增:文章详情自定义广告 2022-12-15 17:34:26 +08:00
小莫唐尼 261617fc12 修改:修复恋爱日记在微信小程序ios下的日期转换错误bug;
修改:修复海报分享因为无图使用随机图在微信小程序下异常bug;
新增:halo.config.template.js 新增一个配置项 defaultStaticThumbnailUrl 默认静态图片用于海报在无图且使用了随机图时候的封面图片地址
2022-12-15 14:25:54 +08:00
小莫唐尼 5000da9a64 新增:文章详情评论弹幕设置功能 2022-12-13 10:51:21 +08:00
小莫唐尼 9573b303e2 新增:文章详情页面添加弹幕功能;
修改:修复友链列表单分组显示问题;
优化;对恋爱日记清单列表进行优化
2022-12-12 23:03:48 +08:00
小莫唐尼 f12262f4df 修改:调整恋爱日记相关UI 2022-12-12 00:30:47 +08:00
小莫唐尼 1305b4a555 修改:优化恋爱日记配置信息 2022-12-11 17:41:31 +08:00
小莫唐尼 b7e2025ebb 新增:新增恋爱日记功能 2022-12-11 16:52:32 +08:00
小莫唐尼 0da5feb2ee 修复:修复封面图片,如果是随机图api不生效的BUG 2022-12-10 14:30:32 +08:00
小莫唐尼 e46c5c2b6f 新增:文章版权说明;
新增:文章详情点击标签跳转查询标签下的文章列表;
优化:调整markdown文字大小
2022-12-10 14:24:36 +08:00
小莫唐尼 70c5b34de0 新增:留言评论头像形状设置;
修复:修复文章管理设置文章标签在小程序端不显示的bug;
修复:修复后台管理工作台因为无法读取用户信息页面不显示bug;
优化:优化友情链接动画效果
2022-12-10 12:26:47 +08:00
小莫唐尼 9d3ebac076 新增:更新halo.config.js 配置参数;
更新:更新项目UI框架;
修复:修复友链列表丢失白色背景色BUG;
2022-12-09 18:10:47 +08:00
小莫唐尼 3fd3b2247a 修复:后台管理文章设置BUG;
修复:友链列表不显示数据BUG;
修复:应用设置点击返回,触发提示BUG;
2022-12-09 10:48:00 +08:00
263 changed files with 30551 additions and 26324 deletions
+4 -4
View File
@@ -1,5 +1,5 @@
node_modules/
unpackage/
config/halo.config.js
config/ad.config.js
package-lock.json
unpackage/
package-lock.json
.idea
.trae
+27 -22
View File
@@ -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代表前端连云端云函数
"version": "0.0",
"configurations": [{
"app-plus" :
{
"launchtype" : "local"
},
"default" :
{
"launchtype" : "local"
},
"h5" :
{
"launchtype" : "local"
},
"mp-weixin" :
{
"launchtype" : "local"
},
"type" : "uniCloud"
}
{
// launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
"version" : "0.0",
"configurations" : [
{
"app-plus" : {
"launchtype" : "local"
},
"default" : {
"launchtype" : "local"
},
"h5" : {
"launchtype" : "local"
},
"mp-qq" : {
"launchtype" : "local"
},
"mp-weixin" : {
"launchtype" : "local"
},
"type" : "uniCloud"
},
{
"playground" : "standard",
"type" : "uni-app:app-android"
}
]
}
+26 -43
View File
@@ -1,48 +1,35 @@
<script>
import HaloConfig from '@/config/halo.config.js';
import HaloAdConfig from '@/config/ad.config.js';
import HaloTokenConfig from '@/config/uhalo.config.js';
// app升级检测(搭配:https://ext.dcloud.net.cn/plugin?id=4470 升级中心)
import CheckAppUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
import { CheckWxUpdate } from '@/utils/update.js';
import {CheckWxUpdate} from '@/utils/update.js';
export default {
globalData: {
baseApiUrl: HaloConfig.apiUrl,
...HaloConfig,
haloAdConfig: HaloAdConfig
},
onLaunch: function() {
console.log('App Launch');
globalData: {
baseApiUrl: HaloTokenConfig.BASE_API
},
onLaunch: function () {
// #ifdef APP-PLUS
CheckAppUpdate();
// #endif
// #ifdef APP-PLUS
CheckAppUpdate();
// #endif
// #ifdef MP-WEIXIN
CheckWxUpdate();
uni.$tm.vx.commit('setWxShare', HaloConfig.wxShareConfig);
// #endif
// #ifdef MP-WEIXIN
CheckWxUpdate();
// #endif
// 监听中间按钮(暂时没有使用)
uni.onTabBarMidButtonTap(() => {
console.log('点击中间按钮');
});
// 初始化博主信息
uni.$tm.vx.actions('blogger/fnGetBlogger');
// 临时:检查是否有用户,没有的话添加一个默认的用户
uni.$tm.vx.actions('user/checkAndSetDefaultUser');
// 启动检查app的配置是否已经就绪,若未就绪则设置默认的
uni.$tm.vx.actions('setting/checkAndSetDefaultAppSettings');
},
onShow: function() {
console.log('App Show');
},
onHide: function() {
console.log('App Hide');
}
uni.$tm.vx.actions('config/fetchConfigs').then((res) => {
})
// 启动检查app的配置是否已经就绪,若未就绪则设置默认的
uni.$tm.vx.actions('setting/checkAndSetDefaultAppSettings');
},
onShow: function () {
console.log('App Show');
},
onHide: function () {
console.log('App Hide');
}
};
</script>
@@ -64,14 +51,10 @@ export default {
@import './common/icons/mphtmliconfont.css';
/* #ifndef MP-WEIXIN */
@import './common/markdown/markdown.scss'; //引入markdown呈现
@import './common/markdown/markdown.scss';
/* #endif */
page {
// background-color: #f3f5f7;
// background-color: #f7f7f7;
// background-color: #ffffff;
background-color: #fafafa;
// background-color: #f4f5f5;
background-color: #fafafa;
}
</style>
+94 -82
View File
@@ -1,110 +1,122 @@
<p align="center">
<a href="https://uni-halo.925i.cn" target="_blank" rel="noopener noreferrer">
<img width="100" src="https://b.925i.cn/uni_halo/uni_halo_logo.png" alt="uni-halo logo" />
<img width="100" src="https://uni-halo.925i.cn/logo.png" alt="uni-halo logo" />
</a>
</p>
<p align="center"><b>uni-halo</b> 基于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 />
<p align="center">
<a href="https://b.925i.cn">作者博客</a>
<a href="https://uni-halo.925i.cn">文档地址</a>
<a href="https://gitee.com/ialley-workshop-open/uni-halo">Gitee仓库</a>
<a href="https://github.com/ialley-workshop-open/uni-halo">Github仓库</a>
<a href="https://www.xiaoxiaomo.cn">作者主页</a>
<a href="https://uni-halo.925i.cn">官方文档</a>
<a href="https://github.com/ialley-workshop-open/uni-halo">仓库地址</a>
<a href="https://github.com/ialley-workshop-open/plugin-uni-halo">插件仓库</a>
</p>
---
如果您觉得这个项目对您有帮助,可以帮作者买杯饮料鼓励鼓励!
如果您觉得这个项目对您有帮助,可以帮作者买杯饮料鼓励鼓励,同时为了项目能够持续发展,可以根据您的喜好支持一下本项目哦,非常感谢您的支持,作者也会更有动力持续维护和更新新的功能哦~
<table rules="none" align="center" border="0">
<tr>
<td>
<center>
<img src="https://uni-halo.925i.cn/qrcode/zfb.png" width="100%" />
<br/>
<font color="AAAAAA">支付宝打赏</font>
</center>
</td>
<td>
<center>
<img src="https://uni-halo.925i.cn/qrcode/wx.png" width="100%" />
<br/>
<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>
| 支付宝 | 微信 | QQ |
|:---------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------:|
| ![支付宝赞助](https://gcore.jsdelivr.net/gh/uni-halo/uni-halo-static-resources/author/ZFBRewardCode.png) | ![微信赞助](https://gcore.jsdelivr.net/gh/uni-halo/uni-halo-static-resources/author/WXRewardCode.png) | ![QQ赞助](https://gcore.jsdelivr.net/gh/uni-halo/uni-halo-static-resources/author/QQRewardCode.png) |
## 一、项目介绍
基于 Halo 2.x 提供的 API 接口,为微信小程序提供的一套开源的博客应用。
- 完全免费开源,包括程序源码、插件源码
- 页面支持插件配置
- 使用最新流行的技术栈
- 支持特色功能,恋爱日记
- 理论支持编译为 小程序(推荐)、APP
### 部分截图
|首页|分类|我的|
|:--:|:--:|:--:|
|![首页](https://gcore.jsdelivr.net/gh/uni-halo/uni-halo-static-resources/screenshots/v2/首页.png)|![分类](https://gcore.jsdelivr.net/gh/uni-halo/uni-halo-static-resources/screenshots/v2/分类.jpg)|![我的](https://gcore.jsdelivr.net/gh/uni-halo/uni-halo-static-resources/screenshots/v2/关于.jpg)|
## 🌸 快速开始
详细部署文档请查阅 [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-云打包
- 在 uni-halo 中,我们为您准备了一个恋爱日记的模块,您可以在其中记录您的恋爱故事,分享给您的朋友们,请扫示例小程序,在线体验恋爱日记的功能。
![恋爱日记](https://gcore.jsdelivr.net/gh/uni-halo/uni-halo-static-resources/screenshots/v2/恋爱日记.jpg)
<br/>
## ⭐️ 功能清单
### 功能介绍
### 用户部分
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. - [ ] 国际化
- 特色功能:恋爱日记,精心为您设计了秀恩爱的模块,秀出关于你们的故事、情侣甜蜜相册、恋爱记录清单,为您的恋爱保驾护航。
## 🌈 在线体验
## 二、配套插件
- 敬请期待...
## 🔍 许可证
### 下载地址
- 代码仓库:[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 协议开源,请遵守开源协议。
## 🏭 贡献
<br/>
贡献代码请查看 [代码贡献规范](https://uni-halo.925i.cn/standard/category.html)
## 🙋 致谢
## 🙆‍♂ Halo
- 接口文档地址(内容端):<https://api.halo.run/content-api.html>
- 接口文档地址(管理端):<https://api.halo.run/admin-api.html>
uni-halo 得益于以下优秀的技术支撑,我只是站在巨人的肩膀上捡了几根头发丝,但是非常感谢这些优秀的项目,带给了我们其他开发者和用户非常友好的体验!
- [Halo:一款好用又强大的开源建站工具](https://halo.run/)
- [uni-app:是一个使用 Vue.js 开发所有前端应用的框架,开发者编写一套代码可编译到多个平台](https://uniapp.dcloud.net.cn/)
- [tm-vuetify:是一个为 uni-app 平台定制的颜值也非常高的 UI 框架](https://www.jx2d.cn/)
- [mp-html:一个强大的小程序富文本组件](https://jin-yufeng.gitee.io/mp-html/#/)
-86
View File
@@ -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}`)
},
}
-70
View File
@@ -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}`)
},
}
-142
View File
@@ -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}`)
},
}
-61
View File
@@ -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}`)
},
}
-59
View File
@@ -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')
},
}
-28
View File
@@ -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`)
},
}
-101
View File
@@ -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)
},
}
-122
View File
@@ -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)
},
}
-56
View File
@@ -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}`)
},
}
-83
View File
@@ -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)
},
}
-22
View File
@@ -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`)
},
}
-25
View File
@@ -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
})
},
}
-15
View File
@@ -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`)
},
}
-24
View File
@@ -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)
},
}
-45
View File
@@ -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 -56
View File
@@ -10,68 +10,19 @@
* 修改时间:
*/
import HttpHandler from '@/common/http/request.js'
import archive from './archive.js'
import article from './article.js'
import blogger from './blogger.js'
import category from './category.js'
import comment from './comment.js'
import journal from './journal.js'
import link from './link.js'
import menu from './menu.js'
import option from './option.js'
import photo from './photo.js'
import post from './post.js'
import sheet from './sheet.js'
import statistics from './statistics.js'
import theme from './theme.js'
// 管理端
import admin_login from './admin/user.js'
import admin_links from './admin/links.js'
import admin_attachment from './admin/attachment.js'
import admin_category from './admin/category.js'
import admin_journal from './admin/journal.js'
import admin_photos from './admin/photos.js'
import admin_tags from './admin/tags.js'
import admin_comments from './admin/comments.js'
import admin_posts from './admin/posts.js'
import admin_logs from './admin/logs.js'
// 2.0接口
import v2 from './v2/all.api.js'
import v2Config from './v2/all.config.js'
const ApiManager = {
...archive,
...article,
...blogger,
...category,
...comment,
...journal,
...link,
...option,
...photo,
...post,
...sheet,
...statistics,
...theme,
// 管理端的api
admin: {
...admin_login,
...admin_links,
...admin_attachment,
...admin_category,
...admin_journal,
...admin_photos,
...admin_tags,
...admin_comments,
...admin_posts,
...admin_logs
}
v2,
v2Config
};
const install = (Vue) => {
Vue.prototype.$httpApi = ApiManager
Vue.prototype.$httpApi = ApiManager
}
export default {
install
install
}
-74
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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)
},
}
-30
View File
@@ -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`)
},
}
-31
View File
@@ -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
View File
@@ -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`)
},
}
-67
View File
@@ -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)
},
}
-22
View File
@@ -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`)
},
}
-40
View File
@@ -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
View File
@@ -1 +0,0 @@
+185
View File
@@ -0,0 +1,185 @@
import {
getPersonalToken
} from '@/utils/token.js'
import HttpHandler from '@/common/http/request.js'
import qs from 'qs'
import {
getAppConfigs
} from '@/config/index.js'
import { getNologinEmail, getOpenid } from "@/utils/auth";
export default {
getPostList: (params) => {
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/posts`, params)
},
getPostByName: (name) => {
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/posts/${name}`, {}, {
header: {
'Wechat-Session-Id': getOpenid(),
'nologin-email': getNologinEmail()
}
})
},
getPostListByKeyword: (params) => {
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/indices/-/search`, 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}`, {})
},
getCategoryPostList: (name, params) => {
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/categories/${name}/posts`, params)
},
getPostCommentList: (params) => {
return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/comments`, 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)
},
getTagList: (params) => {
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/tags`, params)
},
getPostByTagName: (tagName, params) => {
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/tags/${tagName}/posts`, params)
},
getMomentList: (params) => {
return HttpHandler.Get(`/apis/api.moment.halo.run/v1alpha1/moments`, params, {
custom: {
personalToken: getPersonalToken()
}
})
},
getMomentByName: (name) => {
return HttpHandler.Get(`/apis/api.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/api.photo.halo.run/v1alpha1/photogroups`, params)
},
getPhotoListByGroupName: (params) => {
return HttpHandler.Get(`/apis/api.photo.halo.run/v1alpha1/photos`, params)
},
getFriendLinkGroupList: (params) => {
return HttpHandler.Get(`/apis/api.link.halo.run/v1alpha1/linkgroups`, params)
},
getFriendLinkList: (params) => {
return HttpHandler.Get(`/apis/api.link.halo.run/v1alpha1/links`, params)
},
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': getOpenid(),
'nologin-email': getNologinEmail()
}
})
},
createVerificationCode: () => {
return HttpHandler.Get(`/apis/tools.muyin.site/v1alpha1/restrict-read/create`, null, {
header: {
'Authorization': getAppConfigs().pluginConfig.toolsPlugin?.Authorization,
'Wechat-Session-Id': getOpenid(),
}
})
},
submitLink(form) {
return HttpHandler.Post(`/apis/linkssubmit.muyin.site/v1alpha1/submit`, form, {
header: {
'Authorization': getAppConfigs().pluginConfig.linksSubmitPlugin?.Authorization,
'Wechat-Session-Id': getOpenid(),
}
})
},
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, {})
},
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)
},
getVoteDetail: (name) => {
return HttpHandler.Get(`/apis/api.vote.kunkunyu.com/v1alpha1/votes/${name}/detail`, {})
},
getVoteUserList: (name) => {
return HttpHandler.Get(`/apis/api.vote.kunkunyu.com/v1alpha1/votes/${name}/user-list`, {})
},
submitVote: (name, data, canAnonymously = true) => {
return HttpHandler.Post(`/apis/api.vote.kunkunyu.com/v1alpha1/votes/${name}/submit`, data, {
custom: {
personalToken: canAnonymously ? undefined : getPersonalToken()
}
})
},
checkPluginAvailable: (name) => {
return HttpHandler.Get(`/apis/api.plugin.halo.run/v1alpha1/plugins/${name}/available`, {})
},
getDoubanDetail: (url) => {
return HttpHandler.Get(`/apis/api.douban.moony.la/v1alpha1/doubanmovies/-/getDoubanDetail`, { url })
},
postTrackersCounter: (data) => {
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/trackers/counter`, data)
},
}
+10
View File
@@ -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`, {})
},
}
+35
View File
@@ -0,0 +1,35 @@
/**
* Halo 数据看板插件
* @link https://www.halo.run/store/apps/app-rtnbbgfk
*/
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 {
/**
* 获取图表统计数据
* @description - 标签、分类、文章发布趋势、评论活跃用户、获取热门文章top10
*/
getChartData: () => {
return HttpHandler.Get(`/apis/api.data.statistics.xhhao.com/v1alpha1/chart/data`,{})
},
/**
* 获取Github配置信息
*/
getGithubConfig:()=>{
return HttpHandler.Get('/apis/api.data.statistics.xhhao.com/v1alpha1/github/config',{})
},
/**
* 获取 Uptime Kuma 状态页面数据
*/
getUptimeStatus:()=>{
return HttpHandler.Get('/apis/api.data.statistics.xhhao.com/v1alpha1/github/config',{})
}
}
+4 -4
View File
@@ -1,5 +1,5 @@
/**
* 功能:请求工具
* 功能:请求工具
* 作者:小莫唐尼
* 邮箱:studio@925i.cn
* 时间:2022年07月21日 18:58:03
@@ -10,7 +10,7 @@
* 修改时间:
*/
import HaloConfig from '@/config/halo.config.js'
import HaloTokenConfig from '@/config/uhalo.config.js'
import {
setInterceptors
} from "./interceptors.js";
@@ -21,16 +21,16 @@ const http = new Request()
http.setConfig((config) => {
// 如果是在外部浏览器调试或者编译为h5,请注释该行代码
config.baseURL = HaloConfig.apiUrl;
config.baseURL = HaloTokenConfig.BASE_API.replace(/\/+$/, "");
config.header = {
...config.header,
'api-authorization': HaloConfig.apiAuthorization,
ContentType: 'application/json',
dataType: 'json'
}
return config
})
setInterceptors(http)
export {
+125 -68
View File
@@ -9,76 +9,133 @@
* 修改人员:
* 修改时间:
*/
import {
getAdminAccessToken
} from "@/utils/auth.js";
import {
delCache
} from "@/utils/storage";
import {delCache, setCache} from "@/utils/storage";
const getCategoryNameByUrl = (url) => {
const reg = '(?<=/api/content/categories/).+(?=/posts)'
return url.match(reg)[0] || '无分类名'
}
const showCategoryInputPasswordModal = (response, category) => {
uni.showModal({
title: `[ ${category} ] 分类已加密`, // TODO 这里应该获取分类的名字,可以在弹窗之前请求后台拿到所有分类根据分类code拿到名称,但是不会在这之前发送请求
content: '',
editable: true,
placeholderText: '请输入分类密码后访问',
confirmText: '验证密码',
cancelText: '暂不访问',
showCancel: true,
cancelColor: '#999999',
confirmColor: '#03a9f4',
success: (res) => {
if (res.confirm) {
// TODO 这里如果没有输入密码点击确认应该阻止窗口关闭,但是没找到方法
if (!res.content) {
uni.showToast({
title: '提示:请输入密码', icon: 'none', success: () => {
setTimeout(() => {
showCategoryInputPasswordModal(response, category);
}, 800)
}
})
return;
}
// 根据请求URL正则匹配分类code,然后把输入的密码根据分类code放入缓存,然后在category.getCategoryPostList中获取,解决多个分类加密输入密码后点错的问题
// 目前存在一个问题,比如前两个都需要密码,如果先输入第二个的密码之后,重新进来默认打开第一个还会弹窗,所以想在弹窗标题上增加分类名字
// 另外有以下两种方式科技解决
// TODO 1.其实这里获取到密码之后可以直接发送一个请求追加上password参数,因为后台会缓存权限,后续不输入密码也可以访问,可惜不会
// TODO 2.另外也可以拿到密码之后,直接选中该分类追加password参数,重新请求,可惜也不会
setCache('APP_CATEGORY_PWD_' + category, res.content)
uni.reLaunch({
url: '/pages/tabbar/category/category'
});
} else if (res.cancel) {
}
},
})
}
export const setInterceptors = (http) => {
http.interceptors.request.use(
(config) => {
// 可使用async await 做异步操作
config.header = {
...config.header
// ... 可以直接加参数
};
if (getAdminAccessToken()) {
config.header['admin-authorization'] = getAdminAccessToken()
}
return config;
},
(config) => {
// 可使用async await 做异步操作
return Promise.reject(config);
}
);
http.interceptors.request.use((config) => {
console.log("config", config)
http.interceptors.response.use(
(response) => {
/* 对响应成功做点什么 可使用async await 做异步操作*/
// if (response.data.code !== 200) { // 服务端返回的状态码不等于200,则reject()
// return Promise.reject(response) // return Promise.reject 可使promise状态进入catch
// if (response.config.custom.verification) { // 演示自定义参数的作用
// return response.data
// }
// 可使用async await 做异步操作
config.header = {
...config.header
// ... 可以直接加参数
};
if (config.custom.personalToken) {
config.header['Authorization'] = `Bearer ${config.custom.personalToken}`
}
return config;
}, (config) => {
// 可使用async await 做异步操作
return Promise.reject(config);
});
if (response.statusCode == 200) {
return response.data;
} else {
return Promise.reject(response);
}
},
(response) => {
/* 对响应错误做点什么 statusCode !== 200*/
if (!response.data) {
return Promise.reject({
status: 500,
message: 'API接口服务异常!'
})
} else if (response.data.status == 401) {
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);
}
http.interceptors.response.use((response) => {
/* 对响应成功做点什么 可使用async await 做异步操作*/
// if (response.data.code !== 200) { // 服务端返回的状态码不等于200,则reject()
// return Promise.reject(response) // return Promise.reject 可使promise状态进入catch
// if (response.config.custom.verification) { // 演示自定义参数的作用
// return response.data
// }
}
);
if (response.statusCode == 200) {
return response.data;
} else {
return Promise.reject(response);
}
}, (response) => {
/* 对响应错误做点什么 statusCode !== 200*/
if (!response.data) {
return Promise.reject({
status: 500, message: 'API接口服务异常!'
})
} else if (response.data.status == 401) {
uni.$tm.toast(response.data.message);
// 如果是请求分类之后报401说明密码错误,那么清除该密码,下次点击会报403弹窗再次输入密码
if (response.config.url.indexOf('/api/content/categories') >= 0) {
const category = getCategoryNameByUrl(response.config.url)
delCache('APP_CATEGORY_PWD_' + category);
uni.showToast({
title: '提示:密码不正确', icon: 'none', success: () => {
setTimeout(() => {
showCategoryInputPasswordModal(response, category);
}, 800)
}
})
} else {
// 其他情况维持原来的逻辑
delCache('APP_ADMIN_LOGIN_TOKEN');
uni.$eShowModal({
title: '提示',
content: '您未登录超管账号或登录已过期,是否重新登录?',
showCancel: true,
cancelText: '否',
cancelColor: '#999999',
confirmText: '是',
confirmColor: '#03a9f4'
}).then(res => {
uni.navigateTo({
url: '/pagesB/login/login'
})
}).catch(err => {
uni.switchTab({
url: '/pages/tabbar/about/about'
})
})
}
return Promise.reject(response.data);
} else if (response.data.status == 403) {
// 如果报403是请求分类文章接口(您没有该分类的访问权限)的话说明是私密分类,需要输入密码请求
if (response.config.url.indexOf('/api/content/categories') >= 0) {
const category = getCategoryNameByUrl(response.config.url);
showCategoryInputPasswordModal(response, category);
}
return Promise.reject(response.data);
} else {
return Promise.reject(response.data);
}
});
};
+2 -4
View File
@@ -1,8 +1,6 @@
/**
* 封装各种请求方式
*/
import {
http
} from '@/common/http/index.js'
@@ -11,7 +9,7 @@ export default {
Get: (url, params, config = {}) => {
return http.get(url, {
params,
...config
...config
})
},
Post: (url, data, config = {}) => {
@@ -26,4 +24,4 @@ export default {
Delete: (url, data, config = {}) => {
return http.delete(url, data, config)
}
}
}
-23
View File
@@ -1,23 +0,0 @@
/**
*
* 可以以页面为单位来写,
* 比如首页的内容,写在index字段,个人中心写在center,共同部分写在common部分
* */
export default {
app: {
name: "alley studio",
author: "Evan Mo",
},
tabbar: {
home: "Home",
moments: "Moments",
publish: "Publish",
mall: "Mall",
mine: "Mine",
},
// 提示文本
tips: {
switchLang: "switch Lang",
},
};
-23
View File
@@ -1,23 +0,0 @@
/**
*
* 可以以页面为单位来写,
* 比如首页的内容,写在index字段,个人中心写在center,共同部分写在common部分
* */
export default {
app: {
name: "巷子工坊",
author: "小莫唐尼",
},
tabbar: {
home: "首页",
moments: "动态",
publish: "发布",
mall: "商店",
mine: "我的",
},
// 提示文本
tips: {
switchLang: "切换语言",
},
};
+34 -31
View File
@@ -2,11 +2,14 @@
* markdown配置
*/
import HaloConfig from '@/config/halo.config.js'
import {getAppConfigs} from '@/config/index.js'
import HaloTokenConfig from '@/config/uhalo.config.js'
import utils from '@/utils/index.js'
export default {
domain: HaloConfig.apiUrl,
tagStyle: {
table: `
domain: HaloTokenConfig.BASE_API,
tagStyle: {
table: `
table-layout: fixed;
border-collapse:collapse;
margin-bottom: 18px;
@@ -17,17 +20,17 @@ export default {
border: 1px solid #dcdcdc;
border-radius: 4px;
`,
th: `
th: `
padding: 8px;
border-right: 1px solid var(--classE);
border-bottom: 1px solid var(--classE);
`,
td: `
td: `
padding: 8px;
border-right: 1px solid var(--classE);
border-bottom: 1px solid var(--classE);
`,
blockquote: `
blockquote: `
padding: 8px 15px;
color: #606266;
background: #f2f6fc;
@@ -36,62 +39,62 @@ export default {
line-height: 26px;
margin-bottom: 18px;
`,
ul: 'padding-left: 15px;line-height: 1.85;',
ol: 'padding-left: 15px;line-height: 1.85;',
li: 'margin-bottom: 12px;line-height: 1.85;',
h1: `
ul: 'padding-left: 15px;line-height: 1.85;',
ol: 'padding-left: 15px;line-height: 1.85;',
li: 'margin-bottom: 12px;line-height: 1.85;',
h1: `
margin: 30px 0 20px;
color: var(--main);
line-height: 24px;
position: relative;
font-size:1.25em;
font-size:1.2em;
`,
h2: `
h2: `
color: var(--main);
line-height: 24px;
position: relative;
margin: 22px 0 16px;
font-size: 1.2em;
font-size: 1.16em;
`,
h3: `
h3: `
color: var(--main);
line-height: 24px;
position: relative;
margin: 26px 0 18px;
font-size: 1.3em;
font-size: 1.14em;
`,
h4: `
h4: `
color: var(--main);
line-height: 24px;
margin-bottom: 18px;
position: relative;
font-size: 1.18em;
font-size: 1.12em;
`,
h5: `
h5: `
color: var(--main);
line-height: 24px;
margin-bottom: 14px;
position: relative;
font-size: 1em;
font-size: 1.1em;
`,
h6: `
h6: `
color: #303133;
line-height: 24px;
margin-bottom: 14px;
position: relative;
font-size: 1em;
font-size: 14px;
`,
p: `
p: `
line-height: 1.65;
margin-bottom: 14px;
font-size: 15px;
font-size: 14px;
`,
'code': ` `,
strong: 'font-weight: 700;color: rgb(248, 57, 41);',
video: 'width: 100%',
},
containStyle: 'font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;padding:12px;font-size: 16px;color: #606266;word-spacing: 0.8px;letter-spacing: 0.8px;border-radius: 6px;background-color:#FFFFFF;',
'code': ` `,
strong: 'font-weight: 700;color: rgb(248, 57, 41);',
video: 'width: 100%',
},
containStyle: 'font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;padding:12px;font-size: 14px;color: #606266;word-spacing: 0.8px;letter-spacing: 0.8px;border-radius: 6px;background-color:#FFFFFF;',
loadingGif: HaloConfig.loadingGifUrl,
emptyGif: HaloConfig.loadingEmptyUrl,
loadingGif: utils.checkImageUrl(getAppConfigs().imagesConfig.loadingGifUrl),
emptyGif: utils.checkImageUrl(getAppConfigs().imagesConfig.loadingEmptyUrl),
}
+71 -53
View File
@@ -9,59 +9,77 @@
* 修改人员:
* 修改时间:
*/
import HaloConfig from '@/config/halo.config.js';
import HaloAdConfig from '@/config/ad.config.js';
export default {
install(Vue) {
Vue.mixin({
data() {
return {
author: HaloConfig.author,
_isWechat: true,
haloAdConfig: HaloAdConfig
};
},
computed: {
// 获取全局应用设置
globalAppSettings() {
return uni.$tm.vx.getters().setting.getSettings;
}
},
created() {
// #ifdef MP-WEIXIN
this._isWechat = true;
uni.$tm.vx.commit('setWxShare', HaloConfig.wxShareConfig);
// #endif
// #ifndef MP-WEIXIN
this._isWechat = false;
// #endif
},
install(Vue) {
Vue.mixin({
data() {
return {
_isWechat: true,
_aniWaitIndex: 0
};
},
computed: {
haloConfig() {
return this.$tm.vx.getters().getConfigs;
},
haloPluginsConfig() {
return this.$tm.vx.getters().getConfigs?.pluginConfig;
},
// 获取全局应用设置
globalAppSettings() {
return uni.$tm.vx.getters().getSettings;
},
// 计算动画索引
calcAniWait() {
return (index) => {
if ((index + 1) % 10 === 0) {
this._aniWaitIndex = 1;
} else {
this._aniWaitIndex += 1;
}
return this._aniWaitIndex * 50
}
}
},
onLoad() {
this.fnResetSetAniWaitIndex()
},
created() {
// #ifdef MP-WEIXIN
this._isWechat = true;
// #endif
// #ifndef MP-WEIXIN
this._isWechat = false;
// #endif
},
onShow() {
this.fnResetSetAniWaitIndex()
},
methods: {
// 设置页面标题
fnSetPageTitle(title) {
uni.setNavigationBarTitle({
title: title || this.haloConfig?.appConfig?.startConfig?.title || "uni-halo",
})
},
methods: {
/**
* 设置页面标题
* @param {Object} title 标题
*/
fnSetPageTitle(title) {
uni.setNavigationBarTitle({
title: title || HaloConfig.title
})
},
/**
* 页面返回顶部
*/
fnToTopPage(duration = 500) {
duration = isNaN(duration) ? 500 : duration
uni.pageScrollTo({
scrollTop: 0,
duration: duration,
fail: (err) => {
console.log('err', err);
},
});
}
},
});
},
// 页面返回顶部
fnToTopPage(duration = 500) {
duration = isNaN(duration) ? 500 : duration
uni.pageScrollTo({
scrollTop: 0,
duration: duration,
fail: (err) => {
console.log('err', err);
},
});
},
// 初始化动画索引值(需要在每个页面调用)
fnResetSetAniWaitIndex() {
this._aniWaitIndex = 0
}
},
});
},
};
+55
View File
@@ -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;
+311
View File
@@ -36,3 +36,314 @@
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 {
// 全方向gapgap-{size}
.uh-gap-#{$name} {
gap: $size !important;
}
// 水平方向gapgap-x-{size}
.uh-gap-x-#{$name} {
column-gap: $size !important;
}
// 垂直方向gapgap-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;
}
+293 -245
View File
@@ -1,30 +1,23 @@
<template>
<view class="article-card " :class="cardType" @click="fnClickEvent('card')">
<view class="left">
<cache-image
class="thumbnail"
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> -->
<cache-image class="thumbnail" radius="6rpx" :url="$utils.checkThumbnailUrl(article.spec.cover)" :fileMd5="article.spec.cover" mode="aspectFill"></cache-image>
<!-- <image class="thumbnail" lazy-load :src="$utils.checkThumbnailUrl(article.spec.cover)" mode="aspectFill"></image> -->
</view>
<view class="right">
<view class="title">
<text class="is-top" v-if="article.topped">置顶</text>
<text class="title-text text-overflow">{{ article.title }}</text>
<text class="is-top bg-gradient-blue-accent" v-if="article.spec.pinned">置顶</text>
<text class="title-text text-overflow">{{ article.spec.title }}</text>
</view>
<view class="content text-overflow-2">{{ article.summary }}</view>
<view class="content text-overflow-2">{{ article.status.excerpt }}</view>
<view class="foot">
<view class="create-time">
<text class="time-label">发布时间</text>
{{ { d: article.createTime, f: 'yyyy-MM-dd' } | formatTime }}
{{ { d: article.spec.publishTime, f: 'yyyy-MM-dd' } | formatTime }}
</view>
<view class="visits">
<!-- <tm-icons :size="24" name="icon-filter-fill"></tm-icons> -->
浏览
<text class="number">{{ article.visits }}</text>
<text class="number">{{ article.stats.visit }}</text>
</view>
</view>
@@ -33,272 +26,327 @@
</template>
<script>
export default {
name: 'article-card',
props: {
from: {
type: String,
default: ''
},
article: {
type: Object,
default: () => {}
}
},
computed: {
cardType() {
// tb_image_text=上图下文
// tb_text_image=上文下图
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, 'tb_image_text'];
}
return [this.from, this.globalAppSettings.layout.home, this.globalAppSettings.layout.cardType];
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
export default {
name: 'article-card',
components: { tmTags },
props: {
from: {
type: String,
default: ''
},
article: {
type: Object,
default: () => {}
}
},
computed: {
cardType() {
// tb_image_text=上图下文
// tb_text_image=上文下图
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, '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>
<style scoped lang="scss">
.article-card {
display: flex;
box-sizing: border-box;
margin: 0 24rpx;
padding: 32rpx;
border-radius: 12rpx;
background-color: #ffff;
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
overflow: hidden;
margin-bottom: 24rpx;
&.home {
&.h_row_col2 {
margin: 12rpx;
.article-card {
display: flex;
box-sizing: border-box;
margin: 0 24rpx;
padding:22rpx 24rpx;
border-radius: 12rpx;
background-color: #ffff;
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
overflow: hidden;
margin-bottom: 24rpx;
&.h_row_col1 {
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 {
width: 100%;
height: 200rpx;
height: 340rpx;
.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);
}
}
padding-left: 0;
padding: 24rpx 0;
padding-bottom: 0;
width: 100%;
.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 {
}
justify-content: flex-start;
&.lr_text_image {
.left {
order: 2;
padding-left: 30rpx;
.create-time {
.time-label {
display: inline-block;
}
}
.visits {
margin-left: 24rpx;
}
}
}
}
.right {
order: 1;
padding-left: 0;
&.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;
}
}
}
}
}
&.tb_image_text {
flex-direction: column;
padding: 0;
&.only_text {
padding: 36rpx;
.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 {
width: 100%;
height: 300rpx;
width: 240rpx;
height: 180rpx;
.thumbnail {
::v-deep uni-image {
border-radius: 6rpx 6rpx 0 0 !important;
}
width: 100%;
height: 100%;
border-radius: 12rpx;
}
}
.right {
padding-left: 0;
padding: 24rpx;
width: 100%;
.foot {
justify-content: flex-start;
.create-time {
.time-label {
display: inline-block;
}
width: 0;
flex-grow: 1;
display: flex;
flex-direction: column;
padding-left: 30rpx;
box-sizing: border-box;
.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: 260rpx;
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 {
margin-top: 24rpx;
display: -webkit-box;
font-size: 26rpx;
color: #909399;
height: 80rpx;
margin-top: 14rpx;
line-height: 42rpx;
}
.foot {
justify-content: flex-start;
margin-top: 24rpx;
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: inline-block;
display: none;
}
}
.visits {
margin-left: 24rpx;
.number {
padding: 0 6rpx;
font-size: 26rpx;
}
}
}
}
}
.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>
</style>
@@ -0,0 +1,231 @@
<template>
<view class="card" :class="[loading]">
<view v-if="loading !== 'success'" class="card-error" @click="fnGetData()">
{{ loadingText }}
</view>
<template v-else>
<view class="tag">豆瓣</view>
<view class="flex w-full">
<view v-if="posterEmpty" class="poster round-2">无封面</view>
<image v-else class="poster round-2" :src="poster" mode="aspectFill" @error="onPosterError"></image>
<view class="box">
<view class="title text-overflow">{{ detail.spec.name }}</view>
<view class="flex" style="align-items: center; margin-top: 12rpx">
<text class="text-size-s">评分</text>
<tm-rate v-model="detail.spec.score / 2" color="orange" size="24" :margin="2" :num="5"></tm-rate>
<text class="text-size-s" style="margin-left: 4rpx">{{ detail.spec.score }}</text>
</view>
<view class="content text-overflow-2">{{ detail.spec.cardSubtitle }}</view>
<view class="flex flex-wrap" style="margin-left: -10rpx">
<tm-tags color="orange" :shadow="0" size="s" model="fill">{{ types[detail.spec.type] }}</tm-tags>
<tm-tags v-for="(gen, genIndex) in detail.spec.genres" :key="genIndex" color="light-blue" :shadow="0" size="s" model="fill">{{ gen }}</tm-tags>
</view>
</view>
</view>
<!-- 扩展内容 -->
<view class="btn-group">
<tm-button theme="bg-gradient-orange-accent" icon="icon-copy" :shadow="0" :dense="true" size="m" @click="copy('post')">原文地址</tm-button>
<tm-button theme="bg-gradient-light-blue-accent" icon="icon-copy" :shadow="0" :dense="true" size="m" @click="copy('douban')">豆瓣地址</tm-button>
<tm-button theme="bg-gradient-light-blue-accent" icon="icon-copy" :shadow="0" :dense="true" size="m" @click="copy('info')">资源信息</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 tmRate from '@/tm-vuetify/components/tm-rate/tm-rate.vue';
export default {
name: 'ArticleDouban',
components: {
tmButton,
tmTags,
tmRate
},
props: {
url: {
type: String,
default: ''
},
index: {
type: Number,
default: 0
},
article: {
type: Object,
default: () => ({})
}
},
data() {
return {
loading: 'loading',
loadingText: '加载中,请稍等...',
detail: null,
types: {
movie: '电影',
book: '图书',
music: '音乐',
game: '游戏',
drama: '舞台剧'
},
poster: '',
posterEmpty: false
};
},
created() {
this.fnGetData();
},
methods: {
onPosterError() {
if (!this.article.spec.cover) {
this.poster = '';
this.posterEmpty = true;
} else {
this.poster = this.$utils.checkImageUrl(this.article.spec.cover);
this.posterEmpty = false;
}
},
fnGetData() {
this.loadingText = '加载中,请稍等...';
this.loading = 'loading';
this.$httpApi.v2
.getDoubanDetail(this.url)
.then((res) => {
this.detail = res;
this.poster = res.spec.poster;
setTimeout(() => {
this.loading = 'success';
}, 200);
})
.catch((err) => {
console.error(err);
this.loading = 'error';
this.loadingText = '豆瓣内容加载失败,点击重试';
});
},
showToast(content) {
uni.showToast({
icon: 'none',
title: content,
mask: true
});
},
copy(type) {
if (type === 'post') {
const articleUrl = this.$baseApiUrl + (this.article?.status?.permalink ?? '');
this.$utils.copyText(articleUrl, '文章原文地址复制成功');
return;
}
if (type === 'douban') {
this.$utils.copyText(this.detail?.spec.link, '豆瓣资源地址复制成功');
return;
}
if (type === 'info') {
const content = `名称:${this.detail?.spec.name}丨其他:${this.detail?.spec.cardSubtitle}丨标签:${this.detail?.spec.genres.join('/')}丨时间:${
this.detail?.spec.pubdate
}丨评分:${this.detail?.spec.score}分丨链接:${this.detail?.spec.link}`;
this.$utils.copyText(content, '资源信息复制成功');
}
}
}
};
</script>
<style lang="scss" scoped>
.w-full {
width: 100%;
}
.wp-50 {
width: 50%;
}
.card {
position: relative;
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);
}
}
.card-error {
box-sizing: border-box;
padding: 50rpx 24rpx;
font-size: 24rpx;
border-radius: 12rpx;
text-align: center;
}
.poster {
box-sizing: border-box;
width: 180rpx;
height: 220rpx;
flex-shrink: 0;
background-color: #eee;
display: flex;
align-items: center;
justify-content: center;
font-size: 24rpx;
}
.box {
flex-grow: 1;
box-sizing: border-box;
font-size: 26rpx;
padding-left: 24rpx;
overflow: hidden;
}
.title {
box-sizing: border-box;
font-size: 32rpx;
font-weight: bold;
}
.content {
box-sizing: border-box;
margin-top: 12rpx;
line-height: 36rpx;
color: rgba(0, 0, 0, 0.85);
}
.tag {
box-sizing: border-box;
position: absolute;
right: 0;
top: 0;
font-size: 24rpx;
padding: 2rpx 12rpx;
background-color: #f5c618;
border-radius: 0 6rpx 0 12rpx;
}
.btn-group {
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 22rpx;
gap: 0 22rpx;
}
</style>
+208 -183
View File
@@ -1,197 +1,222 @@
<template>
<view class="article-min-card" :class="[globalAppSettings.layout.cardType]" @click="fnClickEvent('card')">
<view class="left">
<cache-image
class="thumbnail"
radius="12rpx"
:url="$utils.checkThumbnailUrl(article.thumbnail)"
:fileMd5="$utils.checkThumbnailUrl(article.thumbnail)"
mode="aspectFill"
></cache-image>
</view>
<view class="right">
<view class="title text-overflow">{{ article.title }}</view>
<view class="content text-overflow">{{ article.summary }}</view>
<view class="foot">
<view class="create-time">
<!-- <text class="icon iconfont icon-clock"></text> -->
<text class="time-label">发布时间</text>
{{ { d: article.createTime, f: 'yyyy-MM-dd' } | formatTime }}
</view>
<view class="visits">
<!-- <text class="icon iconfont icon-eye"></text> -->
浏览
<text class="number">{{ article.visits }}</text>
</view>
</view>
</view>
</view>
<view class="article-min-card" @click="fnClickEvent('card')">
<view class="left">
<cache-image class="thumbnail" radius="6rpx" :url="$utils.checkThumbnailUrl(article.spec.cover)" :fileMd5="article.spec.cover"
mode="aspectFill"></cache-image>
</view>
<view class="right">
<view class="title text-overflow">{{ article.spec.title }}</view>
<view class="content text-overflow">{{ article.status.excerpt }}</view>
<view class="foot">
<view class="create-time">
<text class="time-label">发布时间</text>
{{ {d: article.spec.publishTime, f: 'yyyy-MM-dd'} | formatTime }}
</view>
<view class="visits">
浏览
<text class="number">{{ article.stats.visit }}</text>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'article-min-card',
props: {
article: {
type: Object,
default: () => {}
}
},
methods: {
fnClickEvent() {
this.$emit('on-click', this.article);
}
}
name: 'article-min-card',
props: {
article: {
type: Object,
default: () => {
}
}
},
methods: {
fnClickEvent() {
this.$emit('on-click', this.article);
}
}
};
</script>
<style scoped lang="scss">
.article-min-card {
display: flex;
box-sizing: border-box;
border-radius: 12rpx;
background-color: #ffff;
overflow: hidden;
margin: 12rpx 24rpx;
margin-bottom: 24rpx;
padding: 16rpx;
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.05);
&.lr_image_text {
}
display: flex;
box-sizing: border-box;
border-radius: 12rpx;
background-color: #ffff;
overflow: hidden;
margin: 12rpx 24rpx;
margin-bottom: 24rpx;
padding: 16rpx;
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
&.lr_text_image {
.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;
}
}
}
}
&.lr_image_text {
}
.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: 24rpx;
.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;
}
}
}
}
&.lr_text_image {
.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 {
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>
+569
View File
@@ -0,0 +1,569 @@
<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 color="light-blue" :shadow="0" rounded size="s"
model="fill">{{ vote.spec._uh_type }}</tm-tags>
<tm-tags :color="vote.spec._uh_state.color" size="s" rounded :shadow="0"
model="fill">{{vote.spec._uh_state.state}}</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 || vote.spec.hasEnded">
<view v-for="(option,optionIndex) in vote.spec.options" :key="optionIndex"
class="is-voted-item" :class="[option.checked?'selected':'']" :style="{
'--percent': option._uh_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._uh_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 || vote.spec.hasEnded">
<view v-for="(option,optionIndex) in vote.spec.options" :key="optionIndex"
class="is-voted-item" :class="[option.checked?'selected':'']" :style="{
'--percent': option._uh_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._uh_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._uh_percent + '%'}">
<view class="option-item"
:class="[optionIndex==0?'option-item-left':'option-item-right']">
{{option._uh_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 || vote.spec.hasEnded">
<view v-for="(option,optionIndex) in vote.spec.options" :key="optionIndex"
class="is-voted-item" :class="[option.checked?'selected':'']" :style="{
'--percent': option._uh_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._uh_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="fnCalcIsVoted()" theme="white" text :block="true" class="w-full">您已参与投票</tm-button>
<tm-button v-else-if="vote.spec._uh_state.state==='未开始'" theme="orange" text class="w-full" :height="72"
:block="true" @click="handleSubmitTip('投票未开始')">投票未开始</tm-button>
<tm-button v-else-if="vote.spec._uh_state.state==='已结束'" theme="red" text class="w-full" :height="72"
:block="true" @click="handleSubmitTip('投票已结束')">投票已结束</tm-button>
<tm-button v-else-if="!vote.spec.canAnonymously" theme="red" :shadow="0" class="w-full" :height="72"
text :block="true" @click="handleSubmit()">不支持匿名投票</tm-button>
<tm-button v-else-if="submitForm.voteData.length===0" theme="white" text class="w-full" :height="72"
:block="true" @click="handleSubmitTip('请选择选项')">提交投票请选择选项</tm-button>
<tm-button v-else theme="light-blue" class="w-full" :height="72" :block="true" :loading="submitLoading"
:disabled="submitLoading" @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 {
VOTE_TYPES,
calcVoteState,
calcVotePercent,
voteCacheUtil
} from '@/utils/vote.js'
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: []
},
submitLoading: false
}
},
created() {
this.fnGetData();
},
methods: {
fnGetData() {
this.loadingText = "加载中,请稍等...";
this.loading = "loading";
this.$httpApi.v2
.getVoteDetail(this.voteId)
.then(res => {
this.pageTitle = "投票详情" + `${VOTE_TYPES[res.vote.spec.type]}`
const tempVoteRes = res;
tempVoteRes.vote.spec.isVoted = this.fnCalcIsVoted()
tempVoteRes.vote.spec.disabled = this.fnCalcIsVoted()
tempVoteRes.vote.spec._uh_state = calcVoteState(tempVoteRes.vote)
tempVoteRes.vote.spec._uh_type = VOTE_TYPES[tempVoteRes.vote.spec.type]
tempVoteRes.vote.spec.options.map((option, index) => {
option.value = option.id
option.label = option.title
option.isVoted = this.fnCalcIsVoted()
option.checked = this.fnCalcIsChecked(option)
option._uh_percent = calcVotePercent(tempVoteRes.vote, option);
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 = "投票内容加载失败,点击重试"
})
},
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
},
formatJsonStr(jsonStr) {
return jsonStr ? JSON.parse(jsonStr) : {}
},
handleSubmitTip(text) {
uni.showToast({
icon: "none",
title: text
})
},
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.submitLoading = true
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: "提交失败,请重试"
})
}).finally(() => {
this.submitLoading = false
})
},
handleSelectSingleOption(option) {
if (this.vote.spec._uh_state.state == '未开始') {
this.showToast(`投票未开始`)
return
}
if (this.vote.spec.hasEnded) 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._uh_state.state == '未开始') {
this.showToast(`投票未开始`)
return
}
if (this.vote.spec.hasEnded) 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>
<view style="overflow: hidden;position: fixed;width: 100%;height: 100%;pointer-events: none; top: 0;">
<view class="danmu-li" v-for="(item, index) in listData" :class="item.type" :style="item.style" :key="index">
<view class="barrage-wrap" :class="[type]">
<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="user-box">
<view class="user-img">
<view class="img-box">
<image :src="item.avatar || 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=317894666,3379114684&fm=26&gp=0.jpg'"></image>
</view>
</view>
<view class="user-text cl1">{{ item.nickName }}</view>
<view class="user-status cl1">{{ item.text }}</view>
<view class="user-img"><image class="avatar" :src="item.item.avatar"></image></view>
<view class="user-text cl1">{{ item.item.author }}</view>
<view class="user-status cl1">{{ item.item.content }}</view>
</view>
</view>
</view>
@@ -18,11 +14,17 @@
<script>
export default {
props: {
//rightToLeft leftToRight leftBottom
// rightToLeft leftToRight leftBottom
type: {
type: String,
default: 'rightToLeft'
},
list: {
type: Array,
default() {
return [];
}
},
minTime: {
type: Number,
default: 4
@@ -43,34 +45,34 @@ export default {
//
type: Number,
default: 40
},
noStacked: {
//()
type: Array,
default() {
return [];
}
}
},
data() {
return {
closeTimer: null,
listData: []
};
},
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: {
add(obj) {
this.isShow = true;
this.showFlag = true;
let data = {
item: obj.item,
...obj,
id: Date.parse(new Date()),
time: Math.ceil(Math.floor(Math.random() * (this.maxTime - this.minTime + 1) + this.minTime)),
type: this.type
};
if (this.type === 'leftBottom') {
let objData = {
item: data.item,
item: data,
type: 'leftBottomEnter',
style: {
transition: `all 0.5s`,
@@ -88,7 +90,7 @@ export default {
} else if (this.listData[i].status === 'reset') {
//
this.listData[i].style.transition = 'none';
this.listData[i].style.bottom = 0;
this.listData[i].style.bottom = '6px';
this.listData[i].status = 'reuse';
} else if (this.listData[i].status === 'recycle') {
//
@@ -105,8 +107,16 @@ export default {
if (listLen < hrackNum + 2) {
this.listData.push(objData);
}
} else if (this.type === 'rightToLeft' || this.type === 'leftToRight') {
let objData = this.horStacked(data);
} else if (this.type === 'rightToLeft') {
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) {
if (this.listData[i].delTime <= Date.parse(new Date())) {
this.repaint(i, objData.type);
@@ -118,16 +128,50 @@ export default {
this.listData.push(objData);
}
},
horStacked(data) {
return {
item: data.item,
type: this.type,
style: {
animationDuration: `${data.time}s`,
top: `${Math.ceil(Math.random() * (this.maxTop - this.minTop + 1) + this.minTop)}px`
async remove(options = {}) {
if (this.type == 'rightToLeft') {
if (this.listData.length != 0) {
const last = this.listData[this.listData.length - 1];
setTimeout(() => {
this.listData = [];
}, 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) {
setTimeout(() => {
@@ -137,8 +181,8 @@ export default {
}
};
</script>
<style></style>
<style lang="scss">
<style lang="scss" scoped>
@keyframes leftBottomEnter {
0% {
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 {
0% {
transform: translateX(-100%);
@@ -182,13 +240,38 @@ export default {
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 {
position: absolute;
width: 100%;
transform: translateX(100%);
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 {
animation-name: leftBottomEnter;
}
@@ -196,53 +279,59 @@ export default {
animation-name: leftBottomExit;
animation-fill-mode: forwards;
}
&.leftBottomExitLeft {
animation-name: leftBottomExitLeft;
animation-fill-mode: forwards;
}
&.rightToLeft {
animation-name: rightToLeft;
}
&.leftToRight {
animation-name: leftToRight;
animation-name: rightToLeft;
}
.danmu-inner {
display: inline-block;
font-size: 24rpx;
.user-box {
display: flex;
padding: 3rpx 40rpx 3rpx 10rpx;
padding: 6rpx 40rpx 6rpx 10rpx;
background: rgba(0, 0, 0, 0.3);
border-radius: 32rpx;
align-items: center;
.user-img {
.img-box {
display: flex;
image {
width: 58rpx;
height: 58rpx;
background: rgba(55, 55, 55, 1);
border-radius: 50%;
}
display: flex;
align-items: center;
justify-content: center;
.avatar {
width: 42rpx;
height: 42rpx;
background: rgba(55, 55, 55, 1);
border-radius: 50%;
}
}
.user-status {
margin-left: 10rpx;
white-space: nowrap;
font-size: 28rpx;
font-weight: 400;
color: rgba(255, 255, 255, 1);
max-width: 320rpx;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.user-text {
max-width: 100rpx;
margin-left: 10rpx;
// white-space: nowrap;
font-size: 28rpx;
font-weight: 400;
width: 80rpx;
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>
+181 -168
View File
@@ -1,185 +1,198 @@
<template>
<view class="cache-image">
<view v-if="loadStatus == 'loading'" class="img-loading" :style="[imgStyle, loadStyle]">
<!-- <text class="img-load-icon iconfont icon-loading"></text>
<text class="img-load-text">{{ loadText }}</text> -->
<image :src="loadingImgSrc" :style="[imgStyle]" mode="aspectFit"></image>
</view>
<view v-if="loadStatus == 'error'" class="img-error" :style="[imgStyle, loadErrStyle]">
<text class="img-err-icon iconfont icon-exclamation-circle"></text>
<text class="img-load-text">{{ loadErrText }}</text>
</view>
<image
v-show="loadStatus == 'success'"
:src="src"
@load="fnOnLoad"
@error="fnOnError"
:lazy-load="lazyLoad"
:style="[imgStyle]"
:mode="mode"
@click="$emit('on-click', url)"
></image>
</view>
<view class="cache-image-wrap">
<view v-if="loadStatus == 'loading'" class="img-loading" :style="[imgStyle, loadStyle]">
<!-- <text class="img-load-icon iconfont icon-loading"></text>
<text class="img-load-text">{{ loadText }}</text> -->
<image :src="loadingImgSrc" :style="[loadingImgStyle]" mode="aspectFit"></image>
</view>
<view v-if="loadStatus == 'error'" class="img-error" :style="[imgStyle, loadErrStyle]">
<!-- <text class="img-err-icon iconfont icon-exclamation-circle"></text>
<text class="img-load-text">{{ loadErrText }}</text> -->
<image class="img-error-img" :src="loadingErrorImageSrc" mode="scaleToFill"></image>
</view>
<image v-show="loadStatus == 'success'" :src="src" @load="fnOnLoad" @error="fnOnError" :lazy-load="lazyLoad"
:style="[imgStyle]" :mode="mode" @click="$emit('on-click', url)"></image>
</view>
</template>
<script>
import imageCache from '@/utils/imageCache.js';
export default {
name: 'cache-image',
props: {
url: {
type: String,
default: ''
},
lazyLoad: {
type: Boolean,
default: true
},
loadStyle: {
type: Object,
default() {
return {
backgroundColor: '#ffffff',
color: '#333'
};
}
},
loadErrStyle: {
type: Object,
default() {
return {
color: 'rgba(244, 67, 54,1)'
// backgroundColor: 'rgba(244, 67, 54,0.2)'
};
}
},
mode: {
type: String,
default: 'aspectFill'
},
loadText: {
type: String,
default: '加载中...'
},
loadErrText: {
type: String,
default: '加载失败'
},
fileMd5: {
type: String,
default: ''
},
styles: {
type: Object,
default() {
return {};
}
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '100%'
},
radius: {
type: String,
default: ''
}
},
data() {
return {
imgStyle: {},
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
};
// 查找获取图片缓存
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() {
this.loadStatus = 'error';
}
}
export default {
name: 'cache-image',
props: {
url: {
type: String,
default: ''
},
lazyLoad: {
type: Boolean,
default: true
},
loadStyle: {
type: Object,
default() {
return {
backgroundColor: '#ffffff',
color: '#333'
};
}
},
loadErrStyle: {
type: Object,
default() {
return {
color: 'rgba(244, 67, 54,1)'
// backgroundColor: 'rgba(244, 67, 54,0.2)'
};
}
},
mode: {
type: String,
default: 'aspectFill'
},
loadText: {
type: String,
default: '加载中...'
},
loadErrText: {
type: String,
default: '加载失败'
},
fileMd5: {
type: String,
default: ''
},
styles: {
type: Object,
default() {
return {};
}
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '100%'
},
radius: {
type: String,
default: ''
}
},
data() {
return {
imgStyle: {},
loadingImgStyle: {
width: '120rpx',
},
src: '', // 图片地址
loadStatus: 'loading'
};
},
computed: {
imagesConfig() {
return this.$tm.vx.getters().getConfigs.imagesConfig
},
loadingImgSrc() {
return this.$utils.checkImageUrl(this.imagesConfig.loadingGifUrl);
},
loadingErrorImageSrc() {
return this.$utils.checkImageUrl(this.imagesConfig.loadingErrUrl)
}
},
watch: {
// 监听图片md5值的变化
fileMd5(val) {
// 查找获取图片缓存
this.fnGetImageCache();
}
},
created() {
this.imgStyle = {
width: this.width,
height: this.height,
borderRadius: this.radius,
...this.styles
};
// 查找获取图片缓存
this.fnGetImageCache();
},
methods: {
// 查找获取图片缓存
async fnGetImageCache() {
// #ifdef APP-PLUS
var result = await imageCache.getImageCache(this.url, this.fileMd5);
if (result) {
this.src = result;
} else {
this.src = this.url;
}
// #endif
// #ifndef APP-PLUS
this.src = this.url;
// #endif
},
fnOnLoad() {
this.loadStatus = 'success';
},
fnOnError(e) {
this.loadStatus = 'error';
}
}
};
</script>
<style scoped lang="scss">
.cache-image {
width: 100%;
height: 100%;
.cache-image-wrap {
width: 100%;
height: 100%;
}
.img-loading,
.img-error {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-sizing: border-box;
background-color: #f2f2f2;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-sizing: border-box;
background-color: #f2f2f2;
}
.img-load-icon {
font-size: 36rpx;
animation: xhRote 0.8s infinite linear;
}
.img-load-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% {
transform: rotate(360deg);
}
.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 {
width: 100%;
border-radius: 12rpx;
}
}
.img-err-icon {
font-size: 36rpx;
}
@keyframes xhRote {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
@@ -1,63 +1,79 @@
<template>
<view class="category-mini-card">
<!-- <image class="img" lazy-load :src="$utils.checkThumbnailUrl(category.thumbnail)" mode="aspectFill"></image> -->
<cache-image
class="img"
height="120rpx"
:url="$utils.checkThumbnailUrl(category.thumbnail)"
:fileMd5="$utils.checkThumbnailUrl(category.thumbnail)"
mode="aspectFill"
></cache-image>
<text class="label">{{ category.postCount }}&nbsp;</text>
<view class="name">{{ category.name }}</view>
<cache-image class="img" height="180rpx" :url="$utils.checkThumbnailUrl(category.spec.cover,false)"
:fileMd5="$utils.checkThumbnailUrl(category.spec.cover)" mode="aspectFill"></cache-image>
<view class="content">
<view class="name">{{ category.spec.displayName }}</view>
<text class="label"> {{ category.postCount }} </text>
</view>
</view>
</template>
<script>
export default {
name: 'category-mini-card',
props: {
category: {
type: Object,
default: () => {}
export default {
name: 'category-mini-card',
props: {
category: {
type: Object,
default: () => {}
}
}
}
};
};
</script>
<style scoped lang="scss">
.category-mini-card {
display: inline-block;
width: 260rpx;
height: 180rpx;
position: relative;
border-radius: 12rpx;
background-color: #fff;
overflow: hidden;
// border: 2rpx solid #f7f7f7;
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
.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;
.category-mini-card {
display: inline-block;
width: 260rpx;
height: 180rpx;
position: relative;
border-radius: 12rpx;
background-color: #fff;
overflow: hidden;
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
position: relative;
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>
+136 -118
View File
@@ -1,147 +1,165 @@
<template>
<view class=" comment-item flex flex-col mt-30 pt-24" :class="{ 'child-comment-item': isChild, 'no-solid': !useSolid, classItem }">
<view v-if="comment" class=" comment-item flex flex-col mt-30 pt-24"
:class="{ 'child-comment-item': isChild, 'no-solid': !useSolid, classItem }">
<view class="comment-item_user flex">
<image v-if="comment.isAdmin" class="user-avatar" :src="bloggerInfo.avatar" mode="aspectFill" @error="fnOnImageError(comment)"></image>
<image v-else class="user-avatar" :src="comment.avatar" mode="aspectFill" @error="fnOnImageError(comment)"></image>
<image class="user-avatar" :class="{ 'is-radius': globalAppSettings.isAvatarRadius }"
:src="$utils.checkAvatarUrl(comment.owner.avatar, false)" mode="aspectFill"
@error="fnOnImageError(comment)"></image>
<view class="user-info pl-14">
<view class="author">
<text class="mr-6 text-grey-darken-1 text-size-m">{{ comment.author }}</text>
<tm-tags v-if="comment.isAdmin" :dense="true" color="bg-gradient-amber-accent" size="xs" model="fill">博主</tm-tags>
<tm-tags v-else :dense="true" color="bg-gradient-light-blue-lighten " size="xs" model="fill">游客</tm-tags>
<text class="mr-6 text-grey-darken-1 text-size-m">{{ comment.owner.displayName }}</text>
</view>
<view class="flex mt-4">
<view v-if="false" class="text-size-s text-grey mr-12">IP属地浙江省杭州市</view>
<view class="time text-size-xs text-grey">
<text class="">{{ $tm.dayjs(comment.createTime).format('YYYY年MM月DD日') }}</text>
<text class="ml-12">{{ $tm.dayjs(comment.createTime).fromNow(true) }}</text>
<text class="">{{ $tm.dayjs(comment.spec.creationTime).format('YYYY年MM月DD日') }}</text>
<text class="ml-12">{{ $tm.dayjs(comment.spec.creationTime).fromNow(true) }}</text>
</view>
</view>
</view>
<view v-if="useActions" class="">
<tm-button size="s" text theme="blue" @click="$emit('on-comment', { type: 'user', comment: comment })">回复</tm-button>
<tm-button size="s" text theme="grey" @click="$emit('on-copy', comment.content)"></tm-button>
<tm-button v-if="!disallowComment" size="s" text theme="blue"
@click="$emit('on-comment', { type: 'user', comment: comment })"></tm-button>
<tm-button size="s" text theme="grey" @click="$emit('on-copy', comment.spec.raw)">复制</tm-button>
</view>
</view>
<view class="comment-item_content mt-12" :class="{ 'has-bg': useContentBg, 'not-ml': isChild }" @click="$emit('on-detail', comment)" v-html="comment.content"></view>
<!-- <view v-if="useActions" class="comment-item_info text-size-s text-grey">
<text v-if="false" @click="$emit('on-todo')">点赞</text>
<text @click="$emit('on-comment', { type: 'user', comment: comment })">回复</text>
<text v-if="false" class="ml-24" @click="$emit('on-todo')">举报</text>
<text class="ml-24" @click="$emit('on-copy', comment.content)">复制内容</text>
</view> -->
<view class="comment-item_content mt-12" :class="{ 'has-bg': useContentBg, 'not-ml': isChild }"
@click="$emit('on-detail', comment)" v-html="comment.spec.raw"></view>
</view>
</template>
<script>
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
export default {
name: 'comment-item',
components: { tmTags, tmButton },
props: {
classItem: {
type: Array,
default: () => []
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
export default {
name: 'comment-item',
components: {
tmTags,
tmButton
},
useActions: {
type: Boolean,
default: true
},
useSolid: {
type: Boolean,
default: true
},
useContentBg: {
type: Boolean,
default: true
},
isChild: {
type: Boolean,
default: false
},
postId: {
type: Number,
default: null
},
comment: {
type: Object,
default: () => {}
}
},
computed: {
// 获取博主信息
bloggerInfo() {
let blogger = this.$tm.vx.getters().blogger.getBlogger;
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
return blogger;
}
},
methods: {
fnOnImageError(data) {
if (data.isAdmin) {
data.avatar = this.$haloConfig.author.avatar;
} else {
data.avatar = `${this.$haloConfig.defaultAvatarUrl}&rt=${new Date().getTime()}`;
props: {
classItem: {
type: Array,
default: () => []
},
disallowComment: {
type: Boolean,
default: false
},
useActions: {
type: Boolean,
default: true
},
useSolid: {
type: Boolean,
default: true
},
useContentBg: {
type: Boolean,
default: true
},
isChild: {
type: Boolean,
default: false
},
postName: {
type: String,
default: ""
},
comment: {
type: Object,
default: () => null
}
},
computed: {
imageConfigs() {
return this.$tm.vx.getters().getConfigs.imagesConfig;
},
bloggerInfo() {
let blogger = this.$tm.vx.getters().getConfigs.authorConfig.blogger;
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
return blogger;
}
},
methods: {
fnOnImageError(data) {
if (data && data.owner) {
if (this.imageConfigs.defaultAvatarUrl.indexOf('?') == -1) {
data.owner.avatar = `${this.imageConfigs.defaultAvatarUrl}?next-v=${new Date().getTime()}`
} else {
data.owner.avatar = `${this.imageConfigs.defaultAvatarUrl}&next-v=${new Date().getTime()}`
}
}
}
},
created() {
console.log("comment", this.comment)
}
}
};
};
</script>
<style scoped lang="scss">
.comment-item {
box-sizing: border-box;
border-top: 2rpx solid #f5f5f5;
&.child-comment-item {
padding-top: 0;
margin-left: 80rpx;
border: 0;
}
&.no-solid {
border: 0;
margin-top: 0 !important;
}
&_user {
display: flex;
align-items: center;
.user-avatar {
width: 70rpx;
height: 70rpx;
border-radius: 50%;
box-sizing: border-box;
border: 4rpx solid #ffffff;
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.05);
}
.user-info {
width: 0;
flex-grow: 1;
}
}
&_content {
font-size: 28rpx;
margin-left: 80rpx;
.comment-item {
box-sizing: border-box;
border-radius: 10rpx;
line-height: 1.8;
color: var(--main-text-color);
&.has-bg {
background-color: #fafafa;
padding: 6rpx 24rpx;
border-top: 2rpx solid #f5f5f5;
&.child-comment-item {
padding-top: 0;
margin-left: 80rpx;
border: 0;
}
&.not-ml {
&.no-solid {
border: 0;
margin-top: 0 !important;
}
&_user {
display: flex;
align-items: center;
.user-avatar {
width: 70rpx;
height: 70rpx;
box-sizing: border-box;
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.05);
border: 4rpx solid #ffffff;
border-radius: 12rpx;
&.is-radius {
border-radius: 50%;
}
}
.user-info {
width: 0;
flex-grow: 1;
}
}
&_content {
font-size: 28rpx;
margin-left: 80rpx;
box-sizing: border-box;
border-radius: 10rpx;
line-height: 1.8;
color: var(--main-text-color);
&.has-bg {
background-color: #fafafa;
padding: 6rpx 24rpx;
}
&.not-ml {
margin-left: 80rpx;
}
}
&_info {
margin-top: 6rpx;
display: flex;
align-items: center;
margin-left: 80rpx;
}
}
&_info {
margin-top: 6rpx;
display: flex;
align-items: center;
margin-left: 80rpx;
}
}
</style>
</style>
+247 -241
View File
@@ -1,266 +1,272 @@
<template>
<view class="comment-list">
<!-- 顶部区域 -->
<view class="comment-list_head">
<view class="title">
评论列表
<text class="count">{{ result.total || 0 }}</text>
<view class="comment-list">
<!-- 顶部区域 -->
<view class="comment-list_head">
<view class="title">
<text>评论列表</text>
<text class="count">{{ (result && result.total) || 0 }}</text>
</view>
<view class="refresh">
<text class="icon iconfont icon-sync-alt text-weight-s text-grey-darken-1"></text>
<text class="text-weight-s text-grey-darken-1 ml-6" style="font-size: 26rpx;" @click="fnGetData">刷新</text>
</view>
<view class="filter">
<text class="filter-item " :class="{ active: sort == 0 }" @click="fnOnSort(0)">默认</text>
<text class="filter-item " :class="{ active: sort == 1 }" @click="fnOnSort(1)">热评</text>
<!-- <text class="filter-item">全部</text> -->
</view>
</view>
<!-- <view v-if="disallowComment" class="disallow-comment"><tm-empty icon="icon-shiliangzhinengduixiang-" label="文章已开启禁止评论"></tm-empty></view> -->
<!-- 内容区域 -->
<view class="comment-list_content">
<view v-if="loading != 'success'" class="loading-wrap flex">
<view v-if="loading == 'loading'" class="loading flex flex-center flex-col">
<text class="e-loading-icon iconfont icon-loading text-blue"></text>
<view class="text-size-n text-grey-lighten-1 py-12 mt-12">加载中请稍等...</view>
</view>
<view v-else-if="loading == 'error'" class="error">
<tm-empty icon="icon-wind-cry" label="加载失败">
<tm-button theme="bg-gradient-light-blue-accent" size="m" v-if="!disallowComment" @click="fnToComment()">刷新试试</tm-button>
</tm-empty>
</view>
</view>
<block v-else>
<view class="empty pt-50" v-if="dataList.length == 0">
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无评论">
<tm-button theme="bg-gradient-light-blue-accent" size="m" v-if="!disallowComment" @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"
@on-copy="fnCopyContent"
@on-comment="fnToComment"
@on-todo="fnToDo"
@on-detail="fnShowCommetnDetail"
></comment-item>
</view>
<!-- 内容区域 -->
<view class="comment-list_content">
<view v-if="loading !== 'success'" class="loading-wrap flex">
<view v-if="loading === 'loading'" class="loading flex flex-center flex-col">
<text class="e-loading-icon iconfont icon-loading text-blue"></text>
<view class="text-size-n text-grey-lighten-1 py-12 mt-12">加载中请稍等...</view>
</view>
<view v-else-if="loading === 'error'" class="error">
<tm-empty icon="icon-wind-cry" label="加载失败">
<tm-button theme="bg-gradient-light-blue-accent" size="m" v-if="!disallowComment"
@click="fnToComment()">刷新试试
</tm-button>
</tm-empty>
</view>
</view>
<block v-else>
<tm-alerts v-if="disallowComment && dataList.length !== 0" color="red" text :margin="[0, 0]" :shadow="0"
label="Ծ‸Ծ博主已设置该文章禁止评论!" :round="3"></tm-alerts>
<view class="empty pt-50" v-if="dataList.length === 0">
<tm-empty v-if="disallowComment" icon="icon-shiliangzhinengduixiang-" label="暂无评论">
<text class="text-red text-size-s">- 文章已开启禁止评论 -</text>
</tm-empty>
<tm-empty v-else icon="icon-shiliangzhinengduixiang-" label="暂无评论">
<tm-button theme="light-blue" :dense="true" :shadow="0" size="m" @click="fnToComment(null)">抢沙发
</tm-button>
</tm-empty>
</view>
<block v-else>
<!-- 评论内容 : 目前仅支持二级评论 -->
<block v-for="(comment, index) in dataList" :key="comment.metadata.name">
<comment-item :useContentBg="false" :isChild="false" :comment="comment" :postName="postName"
:disallowComment="disallowComment" @on-copy="fnCopyContent" @on-comment="fnToComment"
@on-todo="fnToDo" @on-detail="fnShowCommentDetail"></comment-item>
<!-- 二级评论 -->
<block v-if="comment.children && comment.children.length != 0">
<block v-for="(childComment, childIndex) in comment.children" :key="childComment.id">
<comment-item
:useContentBg="false"
:isChild="true"
:comment="childComment"
:postId="postId"
@on-copy="fnCopyContent"
@on-comment="fnToComment"
@on-todo="fnToDo"
@on-detail="fnShowCommetnDetail"
></comment-item>
</block>
</block>
</block>
<view v-if="false" class="to-more-comment">
<tm-button item-class="btn" :block="true" width="90vw" theme="bg-gradient-light-blue-lighten" size="m">点击查看全部评论</tm-button>
</view>
</block>
</block>
</view>
</view>
<!-- 二级评论 -->
<block v-if="comment.replies && comment.replies.items.length !== 0">
<block v-for="(childComment, childIndex) in comment.replies.items"
:key="childComment.metadata.name">
<comment-item :useContentBg="false" :isChild="true" :comment="childComment"
:postName="postName" :disallowComment="disallowComment" @on-copy="fnCopyContent"
@on-comment="fnToComment" @on-todo="fnToDo"
@on-detail="fnShowCommentDetail"></comment-item>
</block>
</block>
</block>
<view v-if="false" class="to-more-comment">
<tm-button item-class="btn" :block="true" width="90vw" theme="bg-gradient-light-blue-lighten"
size="m">点击查看全部评论
</tm-button>
</view>
</block>
</block>
</view>
</view>
</template>
<script>
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
import tmAlerts from '@/tm-vuetify/components/tm-alerts/tm-alerts.vue';
export default {
name: 'comment-list',
components: { tmEmpty, tmButton },
props: {
// 是否禁用评论
disallowComment: {
type: Boolean,
default: false
},
postId: {
type: Number,
default: null
},
post: {
type: Object,
default: () => {}
}
},
data() {
return {
loading: 'loading',
sort: 0,
queryParams: {
sort: '',
more: true
},
api: 'getPostCommentTree',
result: {},
dataList: []
};
},
created() {
this.fnGetData();
uni.$on('comment_list_refresh', () => {
this.fnOnSort(this.sort, true);
});
},
methods: {
fnOnSort(type, refresh = false) {
if (this.sort == type && refresh == false) return;
const _api = ['getPostCommentTree', 'getPostTopCommentList'];
this.sort = type;
this.api = _api[type];
this.fnGetData();
},
fnGetData() {
this.loading = 'loading';
this.$httpApi[this.api](this.postId, {})
.then(res => {
if (res.status == 200) {
this.result = res.data;
this.dataList = res.data.content;
this.loading = 'success';
} else {
this.loading = 'error';
}
})
.catch(err => {
this.loading = 'error';
})
.finally(() => {
uni.hideLoading();
});
},
fnToDo() {
uni.$tm.toast('Halo暂未支持!');
},
fnToComment(data) {
if (this.disallowComment) {
return uni.$tm.toast('文章已禁止评论!');
}
console.log(data);
let _comment = {};
if (data) {
let { type, comment } = data;
// 来自用户
_comment = {
id: this.post.id,
parentId: comment.id,
title: comment.author,
from: 'posts',
formPage: 'comment_list',
type: 'user'
};
} else {
// 来自文章
_comment = {
id: this.post.id,
parentId: 0,
title: '评论文章:' + this.post.title,
formPage: 'comment_list',
from: 'posts',
type: 'post'
};
}
name: 'comment-list',
components: {
tmEmpty,
tmButton,
tmAlerts
},
props: {
// 是否禁用评论
disallowComment: {
type: Boolean,
default: false
},
postName: {
type: String,
default: ""
},
post: {
type: Object,
default: () => {
}
}
},
data() {
return {
loading: 'loading',
queryParams: {
group: "content.halo.run",
kind: "Post",
version: "v1alpha1",
name: "",
page: 1,
size: 50,
withReplies: true,
replySize: 10
},
result: null,
dataList: []
};
},
created() {
this.queryParams.name = this.postName;
this.fnGetData();
uni.$on('comment_list_refresh', () => {
this.fnOnSort(true);
});
},
methods: {
fnOnSort(refresh = false) {
if (refresh === false) return;
this.fnGetData();
},
fnGetData() {
this.loading = 'loading';
this.$httpApi.v2.getPostCommentList(this.queryParams)
.then(res => {
console.log("日志:", res)
this.result = res;
this.dataList = res.items;
this.loading = 'success';
this.$emit('on-loaded', this.dataList);
})
.catch(err => {
this.loading = 'error';
})
.finally(() => {
uni.hideLoading();
});
},
fnToDo() {
uni.$tm.toast('Halo暂未支持!');
},
fnToComment(data) {
if (this.disallowComment) {
return uni.$tm.toast('文章已禁止评论!');
}
let _comment = {};
console.log('data', data)
if (data) {
let {type, comment} = data;
// 来自用户
_comment = {
isComment: false,
postName: comment.metadata.name,
title: comment.owner.displayName,
from: 'posts',
formPage: 'comment_list',
type: 'user'
};
} else {
// 来自文章
_comment = {
isComment: true,
postName: this.post.metadata.name,
title: '新增评论',
formPage: 'comment_list',
from: 'posts',
type: 'post'
};
}
uni.$tm.vx.commit('comment/setCommentInfo', _comment);
this.$Router.push({
path: '/pagesA/comment/comment',
query: _comment
});
},
fnCopyContent(content) {
uni.$tm.u.setClipboardData(content);
uni.$tm.toast('内容已复制成功!');
},
this.$emit("on-comment", _comment)
},
fnCopyContent(content) {
uni.$tm.u.setClipboardData(content);
uni.$tm.toast('内容已复制成功!');
},
fnShowCommetnDetail(comment) {
this.$emit('on-comment-detail', {
postId: this.postId,
comment: comment
});
}
}
fnShowCommentDetail(comment) {
this.$emit('on-comment-detail', {
postName: this.postName,
comment: comment
});
}
}
};
</script>
<style lang="scss" scoped>
.comment-list {
&_head {
display: flex;
align-items: center;
justify-content: space-between;
position: relative;
box-sizing: border-box;
padding-left: 24rpx;
font-size: 34rpx;
font-weight: bold;
&_head {
display: flex;
align-items: center;
justify-content: space-between;
position: relative;
box-sizing: border-box;
padding-left: 24rpx;
font-size: 30rpx;
font-weight: bold;
&:before {
content: '';
position: absolute;
left: 0rpx;
top: 8rpx;
width: 8rpx;
height: 30rpx;
background-color: rgb(3, 174, 252);
border-radius: 6rpx;
}
.title {
.count {
font-size: 28rpx;
font-weight: normal;
}
}
.filter {
font-size: 26rpx;
font-weight: normal;
&:before {
content: '';
position: absolute;
left: 0rpx;
top: 8rpx;
width: 8rpx;
height: 26rpx;
background-color: rgb(3, 174, 252);
border-radius: 6rpx;
}
&-item {
margin-left: 20rpx;
color: #666;
&.active {
font-weight: bold;
color: rgb(255, 152, 0);
font-size: 26rpx;
}
}
}
}
&_content {
margin-top: 24rpx;
padding-bottom: 36rpx;
}
.title {
.count {
font-size: 28rpx;
font-weight: normal;
}
}
.filter {
font-size: 26rpx;
font-weight: normal;
&-item {
margin-left: 20rpx;
color: #666;
&.active {
font-weight: bold;
color: rgb(255, 152, 0);
font-size: 26rpx;
}
}
}
}
&_content {
margin-top: 24rpx;
padding-bottom: 36rpx;
}
}
.loading-wrap {
width: 100%;
height: 506rpx;
.loading {
width: 100%;
}
.e-loading-icon {
font-size: 100rpx;
}
.loading-wrap {
width: 100%;
height: 506rpx;
.loading {
width: 100%;
}
.e-loading-icon {
font-size: 100rpx;
}
}
.to-more-comment {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
margin-top: 80rpx;
::v-deep {
.tm-button .tm-button-btn uni-button {
height: 70rpx;
}
}
width: 100%;
display: flex;
align-items: center;
justify-content: center;
margin-top: 80rpx;
::v-deep {
.tm-button .tm-button-btn uni-button {
height: 70rpx;
}
}
}
</style>
+233
View File
@@ -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>
+2
View File
@@ -102,6 +102,8 @@
width: 100%;
box-sizing: border-box;
padding: 20rpx 24rpx;
background-color: rgba(0, 0, 0, 0.085);
backdrop-filter: blur(3rpx);
&.no-dot {
bottom: 0;
}
+122 -135
View File
@@ -2,47 +2,31 @@
<!-- 轮播图 -->
<view class="Swiper-mfw-index-box">
<view class="Swiper-mfw-index Swiper-box" :class="[dotPosition]">
<swiper
class="Swiper-mfw"
:style="{ height: height }"
:circular="true"
:indicator-dots="false"
:autoplay="autoplay"
:interval="3000"
:duration="1000"
:current="currentIndex"
:disable-touch="disable_touch"
@change="change"
>
<swiper class="Swiper-mfw" :style="{ height: height }" :circular="true" :indicator-dots="false"
:autoplay="autoplay" :interval="3000" :duration="1000" :current="currentIndex"
:disable-touch="disable_touch" @change="change">
<!-- 只需要前5条数据 -->
<swiper-item class="swiper-mfw-item" v-if="index <= (dotPosition == 'right' ? 3 : 4)" v-for="(item, index) in list" :key="index">
<!-- /*
<block v-for="(item, index) in list" :key="index">
<swiper-item class="swiper-mfw-item" v-if="index <= 4">
<!-- /*
1. 这里不需要用api控制暂停视频
2. 因为video标签上加了v-if="current==index"
3. 当current == index时才会创建视频组件
4. 否current != index则就销毁视频
*/ -->
<!-- 如果有视频则显示视频-->
<template v-if="item.mp4 && current == index">
<video
class="ImageVideo"
:id="'ImageVideo' + index"
:ref="'ImageVideo' + index"
:src="item.mp4"
:loop="true"
:muted="false"
:autoplay="current == index ? true : false"
:controls="false"
:show-fullscreen-btn="false"
:show-play-btn="false"
:enable-progress-gesture="false"
:play-strategy="0"
:poster="item.image || item.src"
></video>
</template>
<!-- 否则显示图片 -->
<image v-else :src="item.image || item.src" class="Image" mode="aspectFill" @click.stop="$emit('on-click', item)"></image>
</swiper-item>
<!-- 如果有视频则显示视频-->
<template v-if="item.mp4 && current == index">
<video class="ImageVideo" :id="'ImageVideo' + index" :ref="'ImageVideo' + index"
:src="item.mp4" :loop="true" :muted="false" :autoplay="current == index ? true : false"
:controls="false" :show-fullscreen-btn="false" :show-play-btn="false"
:enable-progress-gesture="false" :play-strategy="0"
:poster="item.image || item.src"></video>
</template>
<!-- 否则显示图片 -->
<image v-else :src="item.image || item.src" class="Image" mode="aspectFill"
@click.stop="$emit('on-click', item)"></image>
</swiper-item>
</block>
</swiper>
<!-- 指示器 [Top] -->
<view v-if="useTop" class="Swiper-indicator-box indicator-Top-box">
@@ -59,7 +43,7 @@
</view>
</view>
<view class="right-hot-ttf">
<text class="text hot-text">{{ title }}</text>
<text class="text hot-text text-overflow-2">{{ title }}</text>
</view>
</view>
</view>
@@ -79,17 +63,20 @@
</view>
<!-- 标题 -->
<view class="Top-Title">
<text class="text title-text">{{ item.title }}</text>
<text class="text title-text text-overflow-2">{{ item.title }}</text>
</view>
<!-- 用户信息 -->
<view class="Bottom-UserInfo">
<view v-if="false" class="Bottom-UserInfo">
<!-- 头像 -->
<view class="UserImage-box"><image :src="item.avatar" class="Image" mode="aspectFill"></image></view>
<view class="UserImage-box">
<image :src="item.avatar" class="Image" mode="aspectFill"></image>
</view>
<!-- 用户名 -->
<view class="textbox UserName-box">
<text class="text UserInfo">{{ item.nickname }}</text>
</view>
<view v-if="item.createTime" class="jiange-box"><text class="text jiange-text"></text></view>
<view v-if="item.createTime" class="jiange-box"><text class="text jiange-text"></text>
</view>
<view v-if="item.createTime" class="textbox UserGPS-box">
<text class="text UserInfo">发布于 {{ item.createTime }}</text>
</view>
@@ -106,18 +93,14 @@
<!-- 左边 -->
<view class="Bottom-left-Imagelist">
<block v-for="(item, index) in list" :key="index">
<view
class="Bottom-item"
v-if="Number(index) <= (dotPosition == 'right' ? 3 : 4)"
:class="currentIndex == index ? 'current' : 'no'"
@click="SwiperIndTap(index)"
>
<view class="Bottom-item" v-if="Number(index) <= 4"
:class="currentIndex == index ? 'current' : 'no'" @click="SwiperIndTap(index)">
<image :src="item.image || item.src" class="Image" mode="aspectFill"></image>
</view>
</block>
</view>
<!-- 右边 -->
<view class="Bottom-right-lili-btn">
<view v-if="false" class="Bottom-right-lili-btn">
<view class="Bottom-item is-more">
<view class="more" @click.stop="$emit('on-more')">
MORE
@@ -132,102 +115,106 @@
</template>
<script>
export default {
name: 'e-swiper',
props: {
title: {
type: String,
default: ''
},
height: {
type: String,
default: '450rpx'
},
dotPosition: {
type: String,
default: 'bottom'
},
useTop: {
type: Boolean,
default: true
},
useDot: {
type: Boolean,
default: true
},
useTitle: {
type: Boolean,
default: true
},
useUser: {
type: Boolean,
default: true
},
// 轮播图 数据列表
list: {
type: Array,
default: () => []
},
// 当前选中的项(指示器坐标位置)
current: {
type: Number,
default: 0
},
// 是否自动轮播
autoplay: {
type: Boolean,
default: false
}
},
data() {
return {
// 是否禁止用户 touch 操作
currentIndex: 0,
disable_touch: false, //touch 用户划动引起swiper变化。
date: {
year: '-',
monthEn: '-',
month: '-'
export default {
name: 'e-swiper',
props: {
title: {
type: String,
default: ''
},
height: {
type: String,
default: '450rpx'
},
dotPosition: {
type: String,
default: 'bottom'
},
useTop: {
type: Boolean,
default: true
},
useDot: {
type: Boolean,
default: true
},
useTitle: {
type: Boolean,
default: true
},
useUser: {
type: Boolean,
default: true
},
// 轮播图 数据列表
list: {
type: Array,
default: () => []
},
// 当前选中的项(指示器坐标位置)
current: {
type: Number,
default: 0
},
// 是否自动轮播
autoplay: {
type: Boolean,
default: false
}
};
},
created() {
this.currentIndex = this.current;
const date = new Date();
//将月份名称存储在数组中
const monthArray = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
},
data() {
return {
// 是否禁止用户 touch 操作
currentIndex: 0,
disable_touch: false, //touch 用户划动引起swiper变化。
date: {
year: '-',
monthEn: '-',
month: '-'
}
};
},
created() {
this.currentIndex = this.current;
const date = new Date();
//将月份名称存储在数组中
const monthArray = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov',
'Dec');
this.date.year = date.getFullYear();
let month = date.getMonth() + 1;
this.date.month = month < 10 ? '0' + month : month;
this.date.monthEn = monthArray[date.getMonth()].toUpperCase();
},
methods: {
// current 改变时会触发 change 事件,event.detail = {current: current, source: source}
change(e) {
let { current, source } = e.detail;
//只有页面自动切换,手动切换时才轮播,其他不允许
if (source === 'autoplay' || source === 'touch') {
this.date.year = date.getFullYear();
let month = date.getMonth() + 1;
this.date.month = month < 10 ? '0' + month : month;
this.date.monthEn = monthArray[date.getMonth()].toUpperCase();
},
methods: {
// current 改变时会触发 change 事件,event.detail = {current: current, source: source}
change(e) {
let {
current,
source
} = e.detail;
//只有页面自动切换,手动切换时才轮播,其他不允许
if (source === 'autoplay' || source === 'touch') {
let event = {
current: current
};
this.currentIndex = current;
this.$emit('change', event);
}
},
// 手动点击了指示器[小图模式]
SwiperIndTap(e) {
let index = e;
let event = {
current: current
current: index
};
this.currentIndex = current;
this.currentIndex = index;
this.$emit('change', event);
}
},
// 手动点击了指示器[小图模式]
SwiperIndTap(e) {
let index = e;
let event = {
current: index
};
this.currentIndex = index;
this.$emit('change', event);
}
}
};
};
</script>
<style lang="scss" scoped>
@import './e-swiper.scss';
@import './e-swiper.scss';
</style>
+479
View File
@@ -0,0 +1,479 @@
<template>
<view class="contribution-heatmap pa-24">
<view class="header">
<view class="title">
<view v-if="false" style="color: #7e7e7f">数据范围:</view>
<view>{{ dataRangeYears }}</view>
</view>
<view class="controls">
<tm-stepper v-model="currentYear" :width="220" :height="48" :min="0" :max="2099" :shadow="0" :round="2" color="light-blue" @change="changeYear"></tm-stepper>
</view>
</view>
<view class="heatmap-container">
<view class="weeks">
<view class="week-label" v-for="week in weeks" :key="week">{{ week }}</view>
</view>
<view class="heatmap-content">
<view class="months" :style="[calcContentStyle]">
<view class="month-label" v-for="month in monthLabels" :key="month.index">
{{ month.name }}
</view>
</view>
<view class="days-container" :style="[calcContentStyle]">
<view
v-for="(day, index) in displayDays"
:key="index"
class="day-cell"
:style="{ backgroundColor: getDayColor(day) }"
@click="handleDayClick(day, index)"
></view>
</view>
</view>
</view>
<view class="footer">
<view class="releases-count">
<text>累计 {{ calcAllYearCount }} </text>
<text></text>
<text>本年 {{ calcCurrentYearCount }} </text>
</view>
<view class="legend">
<text class="legend-text"></text>
<view v-for="(color, index) in intensityColors" :key="index" class="day-cell legend-day-cell" :style="{ backgroundColor: color }"></view>
<text class="legend-text"></text>
</view>
</view>
</view>
</template>
<script>
import tmStepper from '@/tm-vuetify/components/tm-stepper/tm-stepper.vue';
export default {
name: 'Heatmap',
components: {
tmStepper
},
props: {
year: {
type: Number,
default: () => new Date().getFullYear()
},
chartData: {
type: Array,
default: () => []
}
},
data() {
return {
weeks: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
intensityColors: [
'#ebedf0', // 无贡献
'#dbeafe', // 1-2次
'#93c5fd', // 3-4次
'#3b82f6', // 5-6次
'#1e40af' // 7次以上
],
displayDays: [],
showTooltip: null,
currentYear: '1900',
currentYearData: [],
yearList:[]
};
},
computed: {
dataRangeYears() {
const arr = this.chartData;
const dateField = 'name';
if (!arr || !Array.isArray(arr) || arr.length === 0) {
return { minDate: null, maxDate: null };
}
// 提取所有有效日期
const validDates = arr
.map((item) => {
if (item && item[dateField]) {
const date = new Date(item[dateField]);
return isNaN(date.getTime()) ? null : date;
}
return null;
})
.filter((date) => date !== null);
if (validDates.length === 0) {
return { minDate: null, maxDate: null };
}
// 找到最小和最大日期
const minDate = new Date(Math.min(...validDates.map((date) => date.getTime())));
const maxDate = new Date(Math.max(...validDates.map((date) => date.getTime())));
const result = {
minDate: this.formatDate(minDate),
maxDate: this.formatDate(maxDate)
};
return `${result.minDate}${result.maxDate}`;
},
// 计算内容宽度
calcContentStyle() {
const rowCount = Math.ceil(this.displayDays.length / 7);
const singleWidth = 36;
return {
width: rowCount * singleWidth + 'rpx'
};
},
//累计的发文次数
calcAllYearCount() {
return this.chartData.reduce((acc, cur) => {
return acc + cur.total;
}, 0);
},
// 统计当前年累计的发文次数
calcCurrentYearCount() {
return this.currentYearData.reduce((acc, cur) => {
return acc + cur.total;
}, 0);
},
monthLabels() {
const months = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'];
const labels = [];
if (this.displayDays.length === 0) return labels;
// 计算每个格子的总宽度(包括间距)
const cellTotalWidth = 15 + 1.5 * 2; // width + margin * 2
let currentMonth = -1;
let monthStartWeek = 0;
// 遍历所有周
const totalWeeks = Math.ceil(this.displayDays.length / 7);
for (let week = 0; week < totalWeeks; week++) {
// 找到这一周的第一个有效日期
let weekMonth = -1;
for (let day = 0; day < 7; day++) {
const dayIndex = week * 7 + day;
if (dayIndex < this.displayDays.length && this.displayDays[dayIndex].date) {
weekMonth = this.displayDays[dayIndex].date.getMonth();
break;
}
}
// 如果找到了有效月份
if (weekMonth !== -1) {
// 如果是新的月份
if (weekMonth !== currentMonth) {
// 如果不是第一个月份,先计算前一个月份的宽度
if (currentMonth !== -1) {
const weeksInMonth = week - monthStartWeek;
const width = weeksInMonth * cellTotalWidth;
labels.push({
name: months[currentMonth],
width: width,
marginLeft: monthStartWeek === 0 ? 0 : 2,
index: currentMonth
});
}
currentMonth = weekMonth;
monthStartWeek = week;
}
}
}
// 处理最后一个月份
if (currentMonth !== -1) {
const weeksInMonth = totalWeeks - monthStartWeek;
const width = weeksInMonth * cellTotalWidth;
labels.push({
name: months[currentMonth],
width: width,
marginLeft: monthStartWeek === 0 ? 0 : 2,
index: currentMonth
});
}
return labels;
}
},
watch: {
year: {
immediate: true,
handler(newYear) {
this.generateDisplayData(newYear);
}
},
chartData: {
deep: true,
handler(newData) {
this.mergeContributionData(newData);
}
}
},
created() {
this.initYearList()
this.filterAndSetCurrentYearData(this.year);
},
methods: {
initYearList(){
for (var index = 1900; index < 2099; index++) {
this.yearList.push(index)
}
this.yearList = this.yearList.reverse();
},
filterAndSetCurrentYearData(year) {
this.currentYear = year;
this.currentYearData = this.chartData.filter((x) => x.name.includes(this.currentYear));
this.generateDisplayData(year);
},
generateDisplayData(year) {
const startDate = new Date(year, 0, 1);
const endDate = new Date(year, 11, 31);
const days = [];
// 计算第一周的偏移量(确保周一开始)
let firstDay = startDate.getDay();
firstDay = firstDay === 0 ? 6 : firstDay - 1; // 将周日(0)转换为6,周一(1)转换为0
// 添加空白填充,使第一周从周一开始
for (let i = 0; i < firstDay; i++) {
days.push({ date: null, count: 0 });
}
// 生成一年的日期
let currentDate = new Date(startDate);
while (currentDate <= endDate) {
// 默认无贡献
days.push({
date: new Date(currentDate),
count: 0
});
currentDate.setDate(currentDate.getDate() + 1);
}
this.displayDays = days;
this.mergeContributionData(this.currentYearData);
},
mergeContributionData(contributionData) {
if (!contributionData || contributionData.length === 0) return;
// 将传入的数据合并到显示数据中
const dataMap = new Map();
contributionData.forEach((item) => {
const dateStr = this.formatDate(item.date);
dataMap.set(dateStr, item.total);
});
this.displayDays.forEach((day) => {
if (day.date) {
const dateStr = this.formatDate(day.date);
if (dataMap.has(dateStr)) {
day.count = dataMap.get(dateStr);
}
}
});
},
formatDate(date) {
date = new Date(date);
// 将日期格式化为 YYYY-MM-DD
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
},
formatDisplayDate(date) {
// 将日期格式化为中文显示格式
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
return `${year}${month}${day}`;
},
getDayColor(day) {
if (day.count === 0) return this.intensityColors[0];
if (day.count <= 2) return this.intensityColors[1];
if (day.count <= 4) return this.intensityColors[2];
if (day.count <= 6) return this.intensityColors[3];
return this.intensityColors[4];
},
getTooltipText(day) {
if (!day.date) return '无数据';
const dateStr = this.formatDisplayDate(day.date);
if (day.count === 0) {
return `${dateStr}: 发布 0 篇文章`;
} else {
return `${dateStr}: 发布 ${day.count} 篇文章`;
}
},
handleDayClick(day, index) {
uni.showToast({
icon: 'none',
title: this.getTooltipText(day)
});
},
changeYear(value) {
this.filterAndSetCurrentYearData(value);
this.$emit('year-change', value);
}
}
};
</script>
<style scoped>
.contribution-heatmap {
box-sizing: border-box;
width: 100%;
background-color: #fff;
border-radius: 12rpx;
box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.12), 0 2rpx 4rpx rgba(0, 0, 0, 0.24);
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30rpx;
}
.title {
font-size: 24rpx;
font-weight: 500;
color: #000;
border: 2rpx solid #ebedf0;
border-radius: 10rpx;
padding: 8rpx 12rpx;
}
.controls {
display: flex;
align-items: center;
gap: 30rpx;
}
.year-selector {
display: flex;
align-items: center;
gap: 16rpx;
}
.year-btn {
background: none;
border: none;
cursor: pointer;
color: #0969da;
font-size: 28rpx;
padding: 8rpx 16rpx;
border-radius: 6rpx;
}
.year-btn:hover {
background-color: #f6f8fa;
}
.year-display {
font-size: 28rpx;
font-weight: 600;
min-width: 120rpx;
text-align: center;
}
.legend {
display: flex;
align-items: center;
gap: 2rpx;
font-size: 24rpx;
border: 2rpx solid #ebedf0;
border-radius: 10rpx;
padding: 8rpx 3rpx;
}
.legend-text {
margin: 0 10rpx;
}
.legend-day-cell {
width: 24rpx!important;
height: 24rpx!important;
}
.heatmap-container {
width: 100%;
display: flex;
padding-bottom: 20rpx;
}
.weeks {
margin-top: -2rpx;
flex-shrink: 0;
display: flex;
flex-direction: column;
margin-right: 10rpx;
padding-top: 48rpx;
}
.week-label {
font-size: 24rpx;
color: #7e7e7f;
height: 30rpx;
line-height: 30rpx;
margin-bottom: 6rpx;
text-align: right;
}
.months {
width: 100%;
display: flex;
margin-bottom: 10rpx;
}
.month-label {
flex: 1;
flex-shrink: 0;
font-size: 24rpx;
color: #7e7e7f;
text-align: center;
}
.heatmap-content {
width: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
overflow-x: auto;
}
.days-container {
display: flex;
flex-direction: column;
flex-wrap: wrap;
height: 252rpx; /* 7行 * 30rpx + 7行 * 6rpx间距 */
}
.day-cell {
width: 32rpx;
height: 32rpx;
border-radius: 4rpx;
margin: 3rpx;
background-color: #ebedf0;
position: relative;
}
.footer {
margin-top: 12rpx;
font-size: 24rpx;
color: #586069;
display: flex;
justify-content: space-between;
align-items: center;
}
.releases-count{
display: flex;
gap: 0 6rpx;
box-sizing: border-box;
border: 2rpx solid #ebedf0;
border-radius: 10rpx;
padding: 8rpx 12rpx;
font-size: 24rpx;
}
</style>
-177
View File
@@ -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().blogger.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>
-15
View File
@@ -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>
-735
View File
@@ -1,735 +0,0 @@
export default{
data(){
return{
system_info:{}, //system info
canvas_width:0, //canvas width px
canvas_height:0, //canvas height px
ctx:null, //canvas object
canvas_id:null, //canvas id
hidden:false,//Whether to hide canvas
scale:1,//canvas scale
r_canvas_scale:1,
if_ctx:true
}
},
methods:{
/**
* save r-canvas.vue object
* @param {Object} that
*/
// saveThis(that){
// rCanvasThis = that
// },
/**
* Draw round rect text
* @param {Object} config
* @param {Number} config.x x坐标
* @param {Number} config.y y坐标
* @param {Number} config.w 宽度
* @param {Number} config.h 高度
* @param {Number} config.radius 圆角弧度
* @param {String} config.fill_color 矩形颜色
*/
fillRoundRect(config) {
return new Promise((resolve,reject)=>{
let x = this.compatibilitySize(parseFloat(config.x)*this.scale)
let y = this.compatibilitySize(parseFloat(config.y)*this.scale)
let w = this.compatibilitySize(parseFloat(config.w)*this.scale)
let h = this.compatibilitySize(parseFloat(config.h)*this.scale)
let radius = config.radius?parseFloat(config.radius)*this.scale:10*this.scale
let fill_color = config.fill_color || "black"
// The diameter of the circle must be less than the width and height of the rectangle
if (2 * radius > w || 2 * radius > h) {
reject("The diameter of the circle must be less than the width and height of the rectangle")
return false;
}
this.ctx.save();
this.ctx.translate(x, y);
//
this.drawRoundRectPath({
w: w,
h: h,
radius: radius
});
this.ctx.fillStyle = fill_color
this.ctx.fill();
this.ctx.restore();
resolve()
})
},
/**
* Draws the sides of a rounded rectangle
* @param {Object} config
* @param {Number} config.w 宽度
* @param {Number} config.h 高度
* @param {Number} config.radius 圆角弧度
*/
drawRoundRectPath(config) {
this.ctx.beginPath(0);
this.ctx.arc(config.w - config.radius, config.h - config.radius, config.radius, 0, Math.PI / 2);
this.ctx.lineTo(config.radius, config.h);
this.ctx.arc(config.radius, config.h - config.radius, config.radius, Math.PI / 2, Math.PI);
this.ctx.lineTo(0, config.radius);
this.ctx.arc(config.radius, config.radius, config.radius, Math.PI, Math.PI * 3 / 2);
this.ctx.lineTo(config.w - config.radius, 0);
this.ctx.arc(config.w - config.radius, config.radius, config.radius, Math.PI * 3 / 2, Math.PI * 2);
this.ctx.lineTo(config.w, config.h - config.radius);
this.ctx.closePath();
},
/**
* Draw special Text,line wrapping is not supported
* @param {Object} config
* @param {String} config.text 文字
* @param {Number} config.x x坐标
* @param {Number} config.y y坐标
* @param {String} config.font_color 文字颜色
* @param {String} config.font_family 文字字体
* @param {Number} config.font_size 文字大小(px
*/
drawSpecialText(params){
let general = params.general
let list = params.list
return new Promise(async (resolve,reject)=>{
if(!general){
reject("general cannot be empty:101")
return;
}else if(list && list.length>0){
for(let i in list){
if(i != 0){
let font_size = list[i-1].font_size?parseFloat(list[i-1].font_size):20
this.ctx.setFontSize(font_size)
general.x = parseFloat(general.x) + this.ctx.measureText(list[i-1].text).width
}
list[i].x = general.x
list[i].y = general.y + (list[i].margin_top?parseFloat(list[i].margin_top):0)
await this.drawText(list[i])
}
resolve()
}else{
reject("The length of config arr is less than 0")
return;
}
})
},
/**
* array delete empty
* @param {Object} arr
*/
arrDeleteEmpty(arr){
let newArr = []
for(let i in arr){
if(arr[i]){
newArr.push(arr[i])
}
}
return newArr
},
/**
* Draw Text,support line
* @param {Object} config
* @param {String} config.text 文字
* @param {Number} config.max_width 文字最大宽度(大于宽度自动换行)
* @param {Number} config.line_height 文字上下行间距
* @param {Number} config.x x坐标
* @param {Number} config.y y坐标
* @param {String} config.font_color 文字颜色
* @param {String} config.font_family 文字字体 默认值:Arial
* @param {String} config.text_align 文字对齐方式(left/center/right
* @param {Number} config.font_size 文字大小(px
* @param {Boolean} config.line_through_height 中划线大小
* @param {Boolean} config.line_through_color 中划线颜色
* @param {String} config.font_style 规定文字样式
* @param {String} config.font_variant 规定字体变体
* @param {String} config.font_weight 规定字体粗细
* @param {String} config.line_through_cap 线末端类型
* @param {String} config.line_clamp 最大行数
* @param {String} config.line_clamp_hint 超过line_clamp后,尾部显示的自定义标识 如 ...
* @param {String} config.is_line_break 是否开启换行符换行
*
*/
drawText(config,configuration = {}){
configuration['line_num'] = configuration.line_num?configuration.line_num:0
configuration['text_width'] = configuration.text_width?configuration.text_width:0
return new Promise(async (resolve,reject)=>{
if(config.text){
let draw_width = 0,draw_height = 0,draw_x = config.x,draw_y = config.y
let font_size = config.font_size?(parseFloat(config.font_size)*this.scale):(20*this.scale)
let font_color = config.font_color || "#000"
let font_family = config.font_family || "Arial"
let line_height = config.line_height || config.font_size || 20
let text_align = config.text_align || "left"
let font_weight = config.font_weight || "normal"
let font_variant = config.font_variant || "normal"
let font_style = config.font_style || "normal"
let line_clamp_hint = config.line_clamp_hint || '...'
let lineBreakJoinText = ""
let max_width = config.max_width?parseFloat(config.max_width)*this.scale:0
// checkout is line break
if(config.is_line_break){
let splitTextArr = config.text.split(/[\n]/g)
if(splitTextArr && splitTextArr.length > 0){
let newSplitTextArr = this.arrDeleteEmpty(splitTextArr)
if(newSplitTextArr && newSplitTextArr.length > 0){
lineBreakJoinText = newSplitTextArr.slice(1).join("\n")
config.text = newSplitTextArr[0]
}else{
reject("Text cannot be empty:103")
return
}
}else{
reject("Text cannot be empty:102")
return
}
}
this.ctx.setFillStyle(font_color) // color
this.ctx.textAlign = text_align;
this.ctx.font = `${font_style} ${font_variant} ${font_weight} ${parseInt(font_size)}px ${font_family}`
if(configuration.text_width >= this.ctx.measureText(config.text).width){
draw_width = configuration.text_width
}else if(max_width > 0){
draw_width = max_width < this.ctx.measureText(config.text).width ? this.resetCompatibilitySize(max_width) : this.resetCompatibilitySize(this.ctx.measureText(config.text).width)
}else{
draw_width = this.ctx.measureText(config.text).width
}
configuration.text_width = draw_width / this.scale
if( max_width && this.compatibilitySize(this.ctx.measureText(config.text).width) > this.compatibilitySize(max_width)){
let current_text = ""
let text_arr = config.text.split("")
for(let i in text_arr){
if( this.compatibilitySize(this.ctx.measureText(current_text+text_arr[i]).width) > this.compatibilitySize(max_width) ){
// Hyphenation that is greater than the drawable width continues to draw
if(config.line_clamp && parseInt(config.line_clamp) == 1){
// Subtracting the current_text tail width from the line_clamp_hint width
let current_text_arr = current_text.split('')
let json_current_text = ''
while(true){
current_text_arr = current_text_arr.slice(1)
json_current_text = current_text_arr.join('')
if(this.compatibilitySize(this.ctx.measureText(json_current_text).width) <= this.compatibilitySize(this.ctx.measureText(line_clamp_hint).width)){
current_text = current_text.replace(json_current_text,'')
break;
}
}
configuration.line_num += 1
this.ctx.setFontSize(parseInt(this.compatibilitySize(font_size))) // font size
this.ctx.fillText(current_text + line_clamp_hint, this.compatibilitySize(parseFloat(config.x)*this.scale), this.compatibilitySize(parseFloat(config.y)*this.scale));
}else{
configuration.line_num += 1
this.ctx.setFontSize(parseInt(this.compatibilitySize(font_size))) // font size
this.ctx.fillText(current_text, this.compatibilitySize(parseFloat(config.x)*this.scale), this.compatibilitySize(parseFloat(config.y)*this.scale));
config.text = text_arr.slice(i).join("")
config.y = config.y + line_height
if(config.line_clamp){
config.line_clamp = parseInt(config.line_clamp) - 1
}
await this.drawText(config,configuration)
}
break;
}else{
current_text = current_text+text_arr[i]
}
}
}else{
if(config.line_through_height){
let x = parseFloat(config.x)*this.scale
let w
let y = parseFloat(config.y)*this.scale - (font_size / 2.6)
if(text_align == "left"){
w = this.ctx.measureText(config.text).width/1.1 + parseFloat(config.x)*this.scale
}else if(text_align == "right"){
w = parseFloat(config.x)*this.scale - this.ctx.measureText(config.text).width/1.1
}else if(text_align == "center"){
x = parseFloat(config.x)*this.scale - this.ctx.measureText(config.text).width / 1.1 / 2
w = parseFloat(config.x)*this.scale + this.ctx.measureText(config.text).width / 1.1 / 2
}
this.drawLineTo({
x:x,
y:y,
w:w,
h:y,
line_width:config.line_through_height,
line_color:config.line_through_color,
line_cap:config.line_through_cap
})
}
configuration.line_num += 1
this.ctx.setFontSize(parseInt(this.compatibilitySize(font_size))) // font size
this.ctx.fillText(config.text, this.compatibilitySize(parseFloat(config.x)*this.scale), this.compatibilitySize(parseFloat(config.y)*this.scale));
if(config.line_clamp){
config.line_clamp = parseInt(config.line_clamp) - 1
}
}
if(lineBreakJoinText){
await this.drawText({...config,text:lineBreakJoinText,y:config.y + line_height},configuration)
}
draw_height = config.font_size * configuration.line_num
draw_width = configuration.text_width
resolve({draw_width,draw_height,draw_x,draw_y})
}else{
reject("Text cannot be empty:101")
}
})
},
/**
* Draw Line
* @param {Object} config
* @param {Object} config.x x坐标
* @param {Object} config.y y坐标
* @param {Object} config.w 线的宽度
* @param {Object} config.h 线的高度
* @param {Object} config.line_width 线的宽度
* @param {Object} config.line_color 线条颜色
*/
drawLineTo(config){
let x = this.compatibilitySize(config.x)
let y = this.compatibilitySize(config.y)
let w = this.compatibilitySize(config.w)
let h = this.compatibilitySize(config.h)
let line_width = config.line_width?parseFloat(config.line_width)*this.scale:1*this.scale
let line_color = config.line_color || "black"
let line_cap = config.line_cap || "butt"
this.ctx.beginPath()
this.ctx.lineCap = line_cap
this.ctx.lineWidth = line_width
this.ctx.strokeStyle = line_color
this.ctx.moveTo(x,y)
this.ctx.lineTo(w,h)
this.ctx.stroke()
},
/**
* Compatibility px
* @param {Object} size
*/
compatibilitySize(size) {
let canvasSize = (parseFloat(size) / 750) * this.system_info.windowWidth
canvasSize = parseFloat(canvasSize * 2)
return canvasSize
},
/**
* Restore compatibility px
* @param {Object} size
*/
resetCompatibilitySize(size) {
let canvasSize = (parseFloat(size/2)/this.system_info.windowWidth) * 750
return canvasSize
},
/**
* Init canvas
*/
init(config){
return new Promise(async (resolve,reject)=>{
if(!config.canvas_id){
reject("Canvas ID cannot be empty, please refer to the usage example")
return;
}
this.hidden = config.hidden
this.canvas_id = config.canvas_id
let system_info = await uni.getSystemInfoSync()
this.system_info = system_info
this.scale = config.scale&&parseFloat(config.scale)>0?parseInt(config.scale):1
this.canvas_width = (config.canvas_width ? this.compatibilitySize(config.canvas_width) : system_info.windowWidth) * this.scale
this.canvas_height = (config.canvas_height ? this.compatibilitySize(config.canvas_height) : system_info.windowHeight) * this.scale,
this.r_canvas_scale = 1/this.scale
this.ctx = uni.createCanvasContext(this.canvas_id,this)
this.setCanvasConfig({
global_alpha:config.global_alpha?parseFloat(config.global_alpha):1,
backgroundColor:config.background_color?config.background_color:"#fff"
})
resolve()
})
},
/**
* clear canvas all path
*/
clearCanvas(){
return new Promise(async (resolve,reject)=>{
if(!this.ctx){
reject("canvas is not initialized:101")
return
}else{
this.ctx.clearRect(0,0,parseFloat(this.canvas_width)*this.scale,parseFloat(this.canvas_height)*this.scale)
await this.draw()
resolve()
}
})
},
/**
* Set canvas config
* @param {Object} config
*/
setCanvasConfig(config){
this.ctx.globalAlpha = config.global_alpha
this.ctx.fillStyle = config.backgroundColor
this.ctx.fillRect(0, 0, parseFloat(this.canvas_width)*this.scale, parseFloat(this.canvas_height)*this.scale)
},
/**
* set canvas width
* @param {Object} width
*/
setCanvasWidth(width){
if(!width){
uni.showToast({
title:'setCanvasWidthwidth error',
icon:'none'
})
}
this.canvas_width = this.compatibilitySize(parseFloat(width)) * this.scale
this.ctx.width = this.canvas_width
},
/**
* set canvas height
* @param {Object} height
*/
setCanvasHeight(height){
if(!height){
uni.showToast({
title:'setCanvasWidthheight error',
icon:'none'
})
}
this.canvas_height = this.compatibilitySize(parseFloat(height)) * this.scale
this.ctx.height = this.canvas_height
},
/**
* Draw to filepath
*/
draw(callback){
return new Promise((resolve,reject)=>{
let stop = setTimeout(()=>{
this.ctx.draw(false,setTimeout(()=>{
uni.canvasToTempFilePath({
canvasId: this.canvas_id,
quality: 1,
success: (res)=>{
console.log('res',res)
resolve(res)
callback && callback(res)
},
fail:(err)=>{
reject(JSON.stringify(err)|| "Failed to generate poster:101")
}
},this)
},300))
clearTimeout(stop)
},300)
})
},
/**
* draw rect
* @param {Number} config.x x坐标
* @param {Number} config.y y坐标
* @param {Number} config.w 图形宽度(px)
* @param {Number} config.h 图形高度(px)
* @param {Number} config.color 图形颜色
* @param {Number} config.is_radius 是否开启圆图(1.1.6及以下版本废弃,请使用border_radius
* @param {Number} config.border_width 边框大小
* @param {Number} config.border_color 边框颜色
*
*/
drawRect(config){
return new Promise(async (resolve,reject)=>{
if(!config.border_width || config.border_width <=0){
config.border_width = 0
}else{
config.border_width = parseFloat(config.border_width)
}
if(parseFloat(config.border_width) > 0){
let sub_config = JSON.parse(JSON.stringify(config))
sub_config.border_width = 0
sub_config.w = config.w + config.border_width
sub_config.h = config.h + config.border_width
sub_config.color = config.border_color || 'black'
if(sub_config.border_radius){
sub_config.border_radius = parseFloat(sub_config.border_radius) + parseFloat(config.border_width) / 2
}
await this.drawRect(sub_config)
}
let color = config.color || 'white'
config.x = (parseFloat(config.x) + config.border_width / 2)
config.y = (parseFloat(config.y) + config.border_width / 2)
config['color'] = color
this.ctx.fillStyle = color;
if(config.is_radius || config.border_radius){
this.setNativeBorderRadius(config)
this.ctx.fill()
}else{
console.log('config.border_width',config.border_width)
this.ctx.fillRect(this.compatibilitySize(config.x*this.scale),this.compatibilitySize(config.y*this.scale),this.compatibilitySize(parseFloat(config.w)*this.scale),this.compatibilitySize(parseFloat(config.h)*this.scale))
}
resolve()
})
},
/**
* Draw image
* @param {Object} config
* @param {String} config.url 图片链接
* @param {Number} config.x x坐标
* @param {Number} config.y y坐标
* @param {Number} config.w 图片宽度(px)
* @param {Number} config.h 图片高度(px)
* @param {Number} config.border_width 边大小
* @param {Number} config.border_color 边颜色
* @param {Number} config.is_radius 是否开启圆图(1.1.6及以下版本废弃,请使用border_radius
* @param {Number} config.border_radius 圆角弧度
*/
drawImage(config){
return new Promise(async (resolve,reject)=>{
if(config.url){
let type = 0 // 1、network image 2、native image 3、base64 image
let image_url
let reg = /^https?/ig;
if(reg.test(config.url)){
type = 1
}else{
if((config.url.indexOf("data:image/png;base64") != -1) || config.url.indexOf("data:image/jpeg;base64") != -1 || config.url.indexOf("data:image/gif;base64") != -1){
type = 3
}else{
type = 2
}
}
if(type == 1){
// network image
await this.downLoadNetworkFile(config.url).then(res=>{ // two function
image_url = res
}).catch(err=>{
reject(err)
return;
})
}else if(type == 2){
// native image
const imageInfoResult = await uni.getImageInfo({
src: config.url
});
try{
if(imageInfoResult.length <= 1){
reject(imageInfoResult[0].errMsg + ':404')
return
}
}catch(e){
reject(e+':500')
return
}
let base64 = await this.urlToBase64({url:imageInfoResult[1].path})
// #ifdef MP-WEIXIN
await this.base64ToNative({url:base64}).then(res=>{
image_url = res
}).catch(err=>{
reject(JSON.stringify(err)+":501")
return;
})
// #endif
// #ifndef MP-WEIXIN
image_url = base64
// #endif
}else if(type == 3){
// #ifdef MP-WEIXIN
await this.base64ToNative({url:config.url}).then(res=>{
image_url = res
}).catch(err=>{
reject(JSON.stringify(err)+":500")
return;
})
// #endif
// #ifndef MP-WEIXIN
image_url = config.url
// #endif
}else{
reject("Other Type Errors:101")
return
}
if(config.border_width){
let border_radius = 0
if(config.border_radius){
let multiple = config.w / config.border_radius
border_radius = (parseFloat(config.w) + parseFloat(config.border_width)) / multiple
}
// drawRect
await this.drawRect({
x:parseFloat(config.x) - parseFloat(config.border_width)/2,
y:parseFloat(config.y) - parseFloat(config.border_width)/2,
w:parseFloat(config.w) + parseFloat(config.border_width),
h:parseFloat(config.h) + parseFloat(config.border_width),
color:config.border_color,
border_radius:border_radius,
border_width:config.border_width,
is_radius:config.is_radius
})
}
if(config.border_radius){
config.color = config.color?config.color:'rgba(0,0,0,0)'
// 圆角有白边,+0.5的误差
config.w = config.w + 0.3
config.h = config.h + 0.3
this.setNativeBorderRadius(config)
}else if(config.is_radius){
//已废弃 is_radius
this.ctx.setStrokeStyle("rgba(0,0,0,0)")
this.ctx.save()
this.ctx.beginPath()
this.ctx.arc(this.compatibilitySize(parseFloat(config.x)*this.scale+parseFloat(config.w)*this.scale/2), this.compatibilitySize(parseFloat(config.y)*this.scale+parseFloat(config.h)*this.scale/2), this.compatibilitySize(parseFloat(config.w)*this.scale/2), 0, 2 * Math.PI, false)
this.ctx.stroke();
this.ctx.clip()
}
await this.ctx.drawImage(image_url,this.compatibilitySize(parseFloat(config.x)*this.scale),this.compatibilitySize(parseFloat(config.y)*this.scale),this.compatibilitySize(parseFloat(config.w)*this.scale),this.compatibilitySize(parseFloat(config.h)*this.scale))
this.ctx.restore() //Restore previously saved drawing context
resolve()
}else{
let err_msg = "Links cannot be empty:101"
reject(err_msg)
}
})
},
/**
* base64 to native available path
* @param {Object} config
*/
base64ToNative(config){
return new Promise((resolve,reject)=>{
let fileName = new Date().getTime()
var filePath = `${wx.env.USER_DATA_PATH}/${fileName}_rCanvas.png`
wx.getFileSystemManager().writeFile({
filePath: filePath,
data: config.url.replace(/^data:\S+\/\S+;base64,/, ''),
encoding: 'base64',
success: function() {
resolve(filePath)
},
fail: function(error) {
reject(error)
}
})
})
},
/**
* native url to base64
* @param {Object} config
*/
urlToBase64(config){
return new Promise(async (resolve,reject)=>{
if (typeof window != 'undefined') {
await this.downLoadNetworkFile(config.url).then(res=>{ // two function
resolve(res)
}).catch(err=>{
reject(err)
})
}else if (typeof plus != 'undefined') {
plus.io.resolveLocalFileSystemURL(config.url,(obj)=>{
obj.file((file)=>{
let fileReader = new plus.io.FileReader()
fileReader.onload = (res)=>{
resolve(res.target.result)
}
fileReader.onerror = (err)=>{
reject(err)
}
fileReader.readAsDataURL(file)
}, (err)=>{
reject(err)
})
},(err)=>{
reject(err)
})
}else if(typeof wx != 'undefined'){
wx.getFileSystemManager().readFile({
filePath: config.url,
encoding: 'base64',
success: function(res) {
resolve('data:image/png;base64,' + res.data)
},
fail: function(error) {
reject(error)
}
})
}
})
},
setNativeBorderRadius(config){
let border_radius = config.border_radius?(parseFloat(config.border_radius)*this.scale):(20*this.scale)
if ((parseFloat(config.w)*this.scale) < 2 * border_radius) border_radius = (parseFloat(config.w)*this.scale) / 2;
if ((parseFloat(config.h)*this.scale) < 2 * border_radius) border_radius = (parseFloat(config.h)*this.scale) / 2;
this.ctx.beginPath();
this.ctx.moveTo(this.compatibilitySize((parseFloat(config.x)*this.scale) + border_radius), this.compatibilitySize((parseFloat(config.y)*this.scale)));
this.ctx.arcTo(this.compatibilitySize((parseFloat(config.x)*this.scale) + (parseFloat(config.w)*this.scale)), this.compatibilitySize((parseFloat(config.y)*this.scale)), this.compatibilitySize((parseFloat(config.x)*this.scale) + (parseFloat(config.w)*this.scale)), this.compatibilitySize((parseFloat(config.y)*this.scale) + (parseFloat(config.h)*this.scale)), this.compatibilitySize(border_radius));
this.ctx.arcTo(this.compatibilitySize((parseFloat(config.x)*this.scale) + (parseFloat(config.w)*this.scale)), this.compatibilitySize((parseFloat(config.y)*this.scale) + (parseFloat(config.h)*this.scale)), this.compatibilitySize((parseFloat(config.x)*this.scale)), this.compatibilitySize((parseFloat(config.y)*this.scale) + (parseFloat(config.h)*this.scale)), this.compatibilitySize(border_radius));
this.ctx.arcTo((this.compatibilitySize(parseFloat(config.x)*this.scale)), this.compatibilitySize((parseFloat(config.y)*this.scale) + (parseFloat(config.h)*this.scale)), this.compatibilitySize((parseFloat(config.x)*this.scale)), this.compatibilitySize((parseFloat(config.y)*this.scale)), this.compatibilitySize(border_radius));
this.ctx.arcTo(this.compatibilitySize((parseFloat(config.x)*this.scale)), this.compatibilitySize((parseFloat(config.y)*this.scale)), this.compatibilitySize((parseFloat(config.x)*this.scale) + (parseFloat(config.w)*this.scale)), this.compatibilitySize((parseFloat(config.y)*this.scale)), this.compatibilitySize(border_radius));
this.ctx.closePath();
this.ctx.strokeStyle = config.color || config.border_color || 'rgba(0,0,0,0)'; // 设置绘制边框的颜色
this.ctx.stroke();
this.ctx.save()
this.ctx.clip();
},
/**
* Download network file
* @param {Object} url : download url
*/
downLoadNetworkFile(url){
return new Promise((resolve,reject)=>{
uni.downloadFile({
url,
success:(res)=>{
if(res.statusCode == 200){
resolve(res.tempFilePath)
}else{
reject("Download Image Fail:102")
}
},
fail:(err)=>{
reject("Download Image Fail:101")
}
})
})
},
/**
* Save image to natice
* @param {Object} filePath native imageUrl
*/
saveImage(filePath){
return new Promise((resolve,reject)=>{
if(!filePath){
reject("FilePath cannot be null:101")
return;
}
// #ifdef H5
var createA = document.createElement("a");
createA.download = filePath;
createA.href = filePath;
document.body.appendChild(createA);
createA.click();
createA.remove();
resolve()
// #endif
// #ifndef H5
uni.saveImageToPhotosAlbum({
filePath: filePath,
success:(res)=>{
resolve(res)
},
fail:(err)=>{
reject(err)
}
})
// #endif
})
}
}
}
-26
View File
@@ -1,26 +0,0 @@
<template>
<view>
<view class="r-canvas-component" :style="{width:canvas_width/scale+'px',height:canvas_height/scale+'px'}" :class="{'hidden':hidden}">
<canvas class="r-canvas" v-if="canvas_id" :canvas-id="canvas_id" :id="canvas_id" :style="{width:canvas_width+'px',height:canvas_height+'px','transform': `scale(${r_canvas_scale})`}"></canvas>
</view>
</view>
</template>
<script>
import rCanvasJS from "./r-canvas.js"
export default {
mixins:[rCanvasJS]
}
</script>
<style>
.r-canvas{
transform-origin: 0 0;
}
.r-canvas-component{
overflow: hidden;
}
.r-canvas-component.hidden{
position: fixed;
top:-5000upx;
}
</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>
+85
View File
@@ -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>
@@ -1,784 +0,0 @@
<template>
<view v-show="show" class="t-wrapper" @touchmove.stop.prevent="moveHandle">
<view class="t-mask" :class="{active:active}" @click.stop="close"></view>
<view class="t-box" :class="{active:active}">
<view class="t-header">
<view class="t-header-button" @click="close">取消</view>
<view class="t-header-button" @click="confirm">确认</view>
</view>
<view class="t-color__box" :style="{ background: 'rgb(' + bgcolor.r + ',' + bgcolor.g + ',' + bgcolor.b + ')'}">
<view class="t-background boxs" @touchstart="touchstart($event, 0)" @touchmove="touchmove($event, 0)" @touchend="touchend($event, 0)">
<view class="t-color-mask"></view>
<view class="t-pointer" :style="{ top: site[0].top - 8 + 'px', left: site[0].left - 8 + 'px' }"></view>
</view>
</view>
<view class="t-control__box">
<view class="t-control__color">
<view class="t-control__color-content" :style="{ background: 'rgba(' + rgba.r + ',' + rgba.g + ',' + rgba.b + ',' + rgba.a + ')' }"></view>
</view>
<view class="t-control-box__item">
<view class="t-controller boxs" @touchstart="touchstart($event, 1)" @touchmove="touchmove($event, 1)" @touchend="touchend($event, 1)">
<view class="t-hue">
<view class="t-circle" :style="{ left: site[1].left - 12 + 'px' }"></view>
</view>
</view>
<view class="t-controller boxs" @touchstart="touchstart($event, 2)" @touchmove="touchmove($event, 2)" @touchend="touchend($event, 2)">
<view class="t-transparency">
<view class="t-circle" :style="{ left: site[2].left - 12 + 'px' }"></view>
</view>
</view>
</view>
</view>
<view class="t-result__box">
<view v-if="mode" class="t-result__item">
<view class="t-result__box-input">{{hex}}</view>
<view class="t-result__box-text">HEX</view>
</view>
<template v-else>
<view class="t-result__item">
<view class="t-result__box-input">{{rgba.r}}</view>
<view class="t-result__box-text">R</view>
</view>
<view class="t-result__item">
<view class="t-result__box-input">{{rgba.g}}</view>
<view class="t-result__box-text">G</view>
</view>
<view class="t-result__item">
<view class="t-result__box-input">{{rgba.b}}</view>
<view class="t-result__box-text">B</view>
</view>
<view class="t-result__item">
<view class="t-result__box-input">{{rgba.a}}</view>
<view class="t-result__box-text">A</view>
</view>
</template>
<view class="t-result__item t-select" @click="select">
<view class="t-result__box-input">
<view>切换</view>
<view>模式</view>
</view>
</view>
</view>
<view class="t-alternative">
<view class="t-alternative__item" v-for="(item,index) in colorList" :key="index">
<view class="t-alternative__item-content" :style="{ background: 'rgba(' + item.r + ',' + item.g + ',' + item.b + ',' + item.a + ')' }"
@click="selectColor(item)">
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
props: {
color: {
type: Object,
default () {
return {
r: 0,
g: 0,
b: 0,
a: 0
}
}
},
spareColor: {
type: Array,
default () {
return []
}
}
},
data() {
return {
show: false,
active: false,
// rgba 颜色
rgba: {
r: 0,
g: 0,
b: 0,
a: 1
},
// hsb 颜色
hsb: {
h: 0,
s: 0,
b: 0
},
site: [{
top: 0,
left: 0
}, {
left: 0
}, {
left: 0
}],
index: 0,
bgcolor: {
r: 255,
g: 0,
b: 0,
a: 1
},
hex: '#000000',
mode: true,
colorList: [{
r: 244,
g: 67,
b: 54,
a: 1
}, {
r: 233,
g: 30,
b: 99,
a: 1
}, {
r: 156,
g: 39,
b: 176,
a: 1
}, {
r: 103,
g: 58,
b: 183,
a: 1
}, {
r: 63,
g: 81,
b: 181,
a: 1
}, {
r: 33,
g: 150,
b: 243,
a: 1
}, {
r: 3,
g: 169,
b: 244,
a: 1
}, {
r: 0,
g: 188,
b: 212,
a: 1
}, {
r: 0,
g: 150,
b: 136,
a: 1
}, {
r: 76,
g: 175,
b: 80,
a: 1
}, {
r: 139,
g: 195,
b: 74,
a: 1
}, {
r: 205,
g: 220,
b: 57,
a: 1
}, {
r: 255,
g: 235,
b: 59,
a: 1
}, {
r: 255,
g: 193,
b: 7,
a: 1
}, {
r: 255,
g: 152,
b: 0,
a: 1
}, {
r: 255,
g: 87,
b: 34,
a: 1
}, {
r: 121,
g: 85,
b: 72,
a: 1
}, {
r: 158,
g: 158,
b: 158,
a: 1
}, {
r: 0,
g: 0,
b: 0,
a: 0.5
}, {
r: 0,
g: 0,
b: 0,
a: 0
}, ]
};
},
created() {
this.rgba = this.color;
if (this.spareColor.length !== 0) {
this.colorList = this.spareColor;
}
},
methods: {
/**
* 初始化
*/
init() {
// hsb 颜色
this.hsb = this.rgbToHex(this.rgba);
// this.setColor();
this.setValue(this.rgba);
},
moveHandle() {},
open() {
this.show = true;
this.$nextTick(() => {
this.init();
setTimeout(() => {
this.active = true;
setTimeout(() => {
this.getSelectorQuery();
}, 350)
}, 50)
})
},
close() {
this.active = false;
this.$nextTick(() => {
setTimeout(() => {
this.show = false;
}, 500)
})
},
confirm() {
this.close();
this.$emit('confirm', {
rgba: this.rgba,
hex: this.hex
})
},
// 选择模式
select() {
this.mode = !this.mode
},
// 常用颜色选择
selectColor(item) {
this.setColorBySelect(item)
},
touchstart(e, index) {
const {
pageX,
pageY
} = e.touches[0];
this.pageX = pageX;
this.pageY = pageY;
this.setPosition(pageX, pageY, index);
},
touchmove(e, index) {
const {
pageX,
pageY
} = e.touches[0];
this.moveX = pageX;
this.moveY = pageY;
this.setPosition(pageX, pageY, index);
},
touchend(e, index) {},
/**
* 设置位置
*/
setPosition(x, y, index) {
this.index = index;
const {
top,
left,
width,
height
} = this.position[index];
// 设置最大最小值
this.site[index].left = Math.max(0, Math.min(parseInt(x - left), width));
if (index === 0) {
this.site[index].top = Math.max(0, Math.min(parseInt(y - top), height));
// 设置颜色
this.hsb.s = parseInt((100 * this.site[index].left) / width);
this.hsb.b = parseInt(100 - (100 * this.site[index].top) / height);
this.setColor();
this.setValue(this.rgba);
} else {
this.setControl(index, this.site[index].left);
}
},
/**
* 设置 rgb 颜色
*/
setColor() {
const rgb = this.HSBToRGB(this.hsb);
this.rgba.r = rgb.r;
this.rgba.g = rgb.g;
this.rgba.b = rgb.b;
},
/**
* 设置二进制颜色
* @param {Object} rgb
*/
setValue(rgb) {
this.hex = '#' + this.rgbToHex(rgb);
},
setControl(index, x) {
const {
top,
left,
width,
height
} = this.position[index];
if (index === 1) {
this.hsb.h = parseInt((360 * x) / width);
this.bgcolor = this.HSBToRGB({
h: this.hsb.h,
s: 100,
b: 100
});
this.setColor()
} else {
this.rgba.a = (x / width).toFixed(1);
}
this.setValue(this.rgba);
},
/**
* rgb 转 二进制 hex
* @param {Object} rgb
*/
rgbToHex(rgb) {
let hex = [rgb.r.toString(16), rgb.g.toString(16), rgb.b.toString(16)];
hex.map(function(str, i) {
if (str.length == 1) {
hex[i] = '0' + str;
}
});
return hex.join('');
},
setColorBySelect(getrgb) {
const {
r,
g,
b,
a
} = getrgb;
let rgb = {}
rgb = {
r: r ? parseInt(r) : 0,
g: g ? parseInt(g) : 0,
b: b ? parseInt(b) : 0,
a: a ? a : 0,
};
this.rgba = rgb;
this.hsb = this.rgbToHsb(rgb);
this.changeViewByHsb();
},
changeViewByHsb() {
const [a, b, c] = this.position;
this.site[0].left = parseInt(this.hsb.s * a.width / 100);
this.site[0].top = parseInt((100 - this.hsb.b) * a.height / 100);
this.setColor(this.hsb.h);
this.setValue(this.rgba);
this.bgcolor = this.HSBToRGB({
h: this.hsb.h,
s: 100,
b: 100
});
this.site[1].left = this.hsb.h / 360 * b.width;
this.site[2].left = this.rgba.a * c.width;
},
/**
* hsb 转 rgb
* @param {Object} 颜色模式 H(hues)表示色相,S(saturation)表示饱和度,Bbrightness)表示亮度
*/
HSBToRGB(hsb) {
let rgb = {};
let h = Math.round(hsb.h);
let s = Math.round((hsb.s * 255) / 100);
let v = Math.round((hsb.b * 255) / 100);
if (s == 0) {
rgb.r = rgb.g = rgb.b = v;
} else {
let t1 = v;
let t2 = ((255 - s) * v) / 255;
let t3 = ((t1 - t2) * (h % 60)) / 60;
if (h == 360) h = 0;
if (h < 60) {
rgb.r = t1;
rgb.b = t2;
rgb.g = t2 + t3;
} else if (h < 120) {
rgb.g = t1;
rgb.b = t2;
rgb.r = t1 - t3;
} else if (h < 180) {
rgb.g = t1;
rgb.r = t2;
rgb.b = t2 + t3;
} else if (h < 240) {
rgb.b = t1;
rgb.r = t2;
rgb.g = t1 - t3;
} else if (h < 300) {
rgb.b = t1;
rgb.g = t2;
rgb.r = t2 + t3;
} else if (h < 360) {
rgb.r = t1;
rgb.g = t2;
rgb.b = t1 - t3;
} else {
rgb.r = 0;
rgb.g = 0;
rgb.b = 0;
}
}
return {
r: Math.round(rgb.r),
g: Math.round(rgb.g),
b: Math.round(rgb.b)
};
},
rgbToHsb(rgb) {
let hsb = {
h: 0,
s: 0,
b: 0
};
let min = Math.min(rgb.r, rgb.g, rgb.b);
let max = Math.max(rgb.r, rgb.g, rgb.b);
let delta = max - min;
hsb.b = max;
hsb.s = max != 0 ? 255 * delta / max : 0;
if (hsb.s != 0) {
if (rgb.r == max) hsb.h = (rgb.g - rgb.b) / delta;
else if (rgb.g == max) hsb.h = 2 + (rgb.b - rgb.r) / delta;
else hsb.h = 4 + (rgb.r - rgb.g) / delta;
} else hsb.h = -1;
hsb.h *= 60;
if (hsb.h < 0) hsb.h = 0;
hsb.s *= 100 / 255;
hsb.b *= 100 / 255;
return hsb;
},
getSelectorQuery() {
const views = uni.createSelectorQuery().in(this);
views
.selectAll('.boxs')
.boundingClientRect(data => {
if (!data || data.length === 0) {
setTimeout(() => this.getSelectorQuery(), 20)
return
}
this.position = data;
// this.site[0].top = data[0].height;
// this.site[0].left = 0;
// this.site[1].left = data[1].width;
// this.site[2].left = data[2].width;
this.setColorBySelect(this.rgba);
})
.exec();
}
},
watch: {
spareColor(newVal) {
this.colorList = newVal;
}
}
};
</script>
<style>
.t-wrapper {
position: fixed;
top: 0;
bottom: 0;
left: 0;
width: 100%;
box-sizing: border-box;
z-index: 9999;
}
.t-box {
width: 100%;
position: absolute;
bottom: 0;
padding: 30upx 0;
padding-top: 0;
background: #fff;
transition: all 0.3s;
transform: translateY(100%);
}
.t-box.active {
transform: translateY(0%);
}
.t-header {
display: flex;
justify-content: space-between;
width: 100%;
height: 100upx;
border-bottom: 1px #eee solid;
box-shadow: 1px 0 2px rgba(0, 0, 0, 0.1);
background: #fff;
}
.t-header-button {
display: flex;
align-items: center;
width: 150upx;
height: 100upx;
font-size: 30upx;
color: #666;
padding-left: 20upx;
}
.t-header-button:last-child {
justify-content: flex-end;
padding-right: 20upx;
}
.t-mask {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.6);
z-index: -1;
transition: all 0.3s;
opacity: 0;
}
.t-mask.active {
opacity: 1;
}
.t-color__box {
position: relative;
height: 400upx;
background: rgb(255, 0, 0);
overflow: hidden;
box-sizing: border-box;
margin: 0 20upx;
margin-top: 20upx;
box-sizing: border-box;
}
.t-background {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(to right, #fff, rgba(255, 255, 255, 0));
}
.t-color-mask {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 400upx;
background: linear-gradient(to top, #000, rgba(0, 0, 0, 0));
}
.t-pointer {
position: absolute;
bottom: -8px;
left: -8px;
z-index: 2;
width: 15px;
height: 15px;
border: 1px #fff solid;
border-radius: 50%;
}
.t-show-color {
width: 100upx;
height: 50upx;
}
.t-control__box {
margin-top: 50upx;
width: 100%;
display: flex;
padding-left: 20upx;
box-sizing: border-box;
}
.t-control__color {
flex-shrink: 0;
width: 100upx;
height: 100upx;
border-radius: 50%;
background-color: #fff;
background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee),
linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee);
background-size: 36upx 36upx;
background-position: 0 0, 18upx 18upx;
border: 1px #eee solid;
overflow: hidden;
}
.t-control__color-content {
width: 100%;
height: 100%;
}
.t-control-box__item {
display: flex;
flex-direction: column;
justify-content: space-between;
width: 100%;
padding: 0 30upx;
}
.t-controller {
position: relative;
width: 100%;
height: 16px;
background-color: #fff;
background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee),
linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee);
background-size: 32upx 32upx;
background-position: 0 0, 16upx 16upx;
}
.t-hue {
width: 100%;
height: 100%;
background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
}
.t-transparency {
width: 100%;
height: 100%;
background: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgb(0, 0, 0));
}
.t-circle {
position: absolute;
/* right: -10px; */
top: -2px;
width: 20px;
height: 20px;
box-sizing: border-box;
border-radius: 50%;
background: #fff;
box-shadow: 0 0 2px 1px rgba(0, 0, 0, 0.1);
}
.t-result__box {
margin-top: 20upx;
padding: 10upx;
width: 100%;
display: flex;
box-sizing: border-box;
}
.t-result__item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 10upx;
width: 100%;
box-sizing: border-box;
}
.t-result__box-input {
padding: 10upx 0;
width: 100%;
font-size: 28upx;
box-shadow: 0 0 1px 1px rgba(0, 0, 0, 0.1);
color: #999;
text-align: center;
background: #fff;
}
.t-result__box-text {
margin-top: 10upx;
font-size: 28upx;
line-height: 2;
}
.t-select {
flex-shrink: 0;
width: 150upx;
padding: 0 30upx;
}
.t-select .t-result__box-input {
border-radius: 10upx;
border: none;
color: #999;
box-shadow: 1px 1px 2px 1px rgba(0, 0, 0, 0.1);
background: #fff;
}
.t-select .t-result__box-input:active {
box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.1);
}
.t-alternative {
display: flex;
flex-wrap: wrap;
/* justify-content: space-between; */
width: 100%;
padding-right: 10upx;
box-sizing: border-box;
}
.t-alternative__item {
margin-left: 12upx;
margin-top: 10upx;
width: 50upx;
height: 50upx;
border-radius: 10upx;
background-color: #fff;
background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee),
linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee);
background-size: 36upx 36upx;
background-position: 0 0, 18upx 18upx;
border: 1px #eee solid;
overflow: hidden;
}
.t-alternative__item-content {
width: 50upx;
height: 50upx;
background: rgba(255, 0, 0, 0.5);
}
.t-alternative__item:active {
transition: all 0.3s;
transform: scale(1.1);
}
</style>
+252
View File
@@ -0,0 +1,252 @@
<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 color="light-blue" :shadow="0" rounded size="s" model="fill">{{ vote.spec._uh_type}}</tm-tags>
</view>
<view class="title text-overflow">
{{ vote.spec.title }}
</view>
</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>
</view>
<view class="vote-card-foot flex flex-between">
<view class="left flex">
<tm-tags :color="vote.spec._uh_state.color" size="s" rounded :shadow="0"
model="text">{{vote.spec._uh_state.state}}</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._uh_state.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
}
}
}
</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>
-20
View File
@@ -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, // 是否启用
}
}
-121
View File
@@ -1,121 +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博客基础域名或者是Halo后台管理系统api地址)
apiAuthorization: '', // Halo中-系统-博客设置-切换到高级选项-API设置-Access key
title: '', // 博客标题
miniCodeImageUrl: '', // 小程序码地址
start: { // 首次启动页配置
title: 'uni-halo', // 标题
bg: '', // 留空则使用默认 开屏首页背景,可以是颜色值或者图片图片地址
logo: 'https://b.925i.cn/uni_halo/uni_halo_logo.png', // logo
desc1: '全新UI,准备出发', // 描述信息1
desc2: '新触动 新感受 新体验', // 描述信息2
btnText: '全新触发' // 按钮文字
},
author: {
name: '', // 昵称
avatar: '', // 头像地址
motto: '', // 格言
},
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',
]
}
+90
View File
@@ -0,0 +1,90 @@
// 应用设置存储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: {
votePlugin: {},
toolsPlugin: {},
linksPlugin:{},
linksSubmitPlugin: {},
doubanPlugin: {
position: 'bottom'
},
},
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))
}
-7
View File
@@ -1,7 +0,0 @@
/**
* 配置key
*/
export default {
SHEET_LEAVING: 'leaving', // 留言板
}
-8
View File
@@ -1,8 +0,0 @@
/**
* 页面配置
*/
import AppKeys from './keys.js'
export default {
[AppKeys.SHEET_LEAVING]: 65, // 留言板页面ID
}
+12
View File
@@ -0,0 +1,12 @@
/** 应用基础配置 */
const UHaloBaseConfig = Object.freeze({
/** 基础请求域名:你的Halo博客基础域名,注意,域名后面不能带有斜杠【/】 */
// BASE_API: "",
// 示例:
BASE_API: "http://localhost:8090",
// todo:可能有其他配置
})
export default UHaloBaseConfig;
+177
View File
@@ -0,0 +1,177 @@
{
"home": {
"bannerList": [
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
}
],
"categoryList": [
{
"title": "uni-halo",
"desc": "",
"cover": "/upload/uni_halo_ad_cover.png",
"time": ""
},
{
"title": "uni-halo",
"desc": "",
"cover": "/upload/uni_halo_ad_cover.png",
"time": ""
},
{
"title": "uni-halo",
"desc": "",
"cover": "/upload/uni_halo_ad_cover.png",
"time": ""
},
{
"title": "uni-halo",
"desc": "",
"cover": "/upload/uni_halo_ad_cover.png",
"time": ""
}
],
"postList": [
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
}
]
},
"category": {
"list": [
{
"title": "uni-halo",
"desc": "",
"cover": "/upload/uni_halo_ad_cover.png",
"time": ""
},
{
"title": "uni-halo",
"desc": "",
"cover": "/upload/uni_halo_ad_cover.png",
"time": ""
},
{
"title": "uni-halo",
"desc": "",
"cover": "/upload/uni_halo_ad_cover.png",
"time": ""
},
{
"title": "uni-halo",
"desc": "",
"cover": "/upload/uni_halo_ad_cover.png",
"time": ""
}
]
},
"moments": {
"list": [
{
"content": "你好啊,这是我的一条生活记录",
"time": "2024-05-25 08:59:00",
"images": [
"/upload/uni_halo_ad_cover.png",
"/upload/uni_halo_ad_cover.png",
"/upload/uni_halo_ad_cover.png"
]
}
]
},
"gallery": {
"list": [
"/upload/uni_halo_ad_cover.png",
"/upload/uni_halo_ad_cover.png",
"/upload/uni_halo_ad_cover.png",
"/upload/uni_halo_ad_cover.png"
]
},
"archives": {
"list": [
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
},
{
"title": "uni-halo2.0)开源啦!!!",
"desc": "uni-halo 2.0 已独立兼容 Halo2.x 应用,欢迎小伙伴们体验。",
"cover": "/upload/uni_halo_ad_cover.png",
"time": "2024-05-25 08:59:00"
}
]
}
}
+5 -45
View File
@@ -1,14 +1,10 @@
import App from "./App";
import Vue from "vue";
import {
router,
RouterMount
} from './router/router.js'
Vue.use(router)
// 挂载全局工具类
import utils from "./utils/index.js";
Vue.prototype.$utils = utils;
uni.$utils = utils;
// 全局统一样式的对话框
import Fy from '@/js_sdk/fy-showModal/index.js'
@@ -29,29 +25,7 @@ for (let fKey in AppFilters) {
// 引用tmUI2.x框架
import tmVuetify from "./tm-vuetify";
Vue.use(tmVuetify);
// i18n部分的配置
// 引入语言包,注意路径
import Chinese from "@/common/locales/zh.js";
import English from "@/common/locales/en.js";
// 引入并使用vue-i18n
import VueI18n from "vue-i18n";
Vue.use(VueI18n);
// 构造i18n对象
const i18n = new VueI18n({
// 默认语言,这里的local属性,对应message中的zh、en属性
locale: uni.getStorageSync("Default_Lang") || "zh",
// 引入语言文件
messages: {
// 这里的属性名是任意的,您也可以把zh设置为cn等,只是后续切换语言时
// 要标识这里的语言属性,如:this.$i18n.locale = zh|en|cn|xxx
zh: Chinese,
en: English,
},
});
// 引入请求库
import {
http
@@ -62,27 +36,13 @@ Vue.prototype.$http = http;
import ApiManager from '@/api/index.js'
Vue.use(ApiManager);
import HaloConfig from '@/config/halo.config.js'
Vue.prototype.$haloConfig = HaloConfig
Vue.prototype.$baseApiUrl = HaloConfig.apiUrl
import HaloAdConfig from '@/config/ad.config.js'
Vue.prototype.$haloAdConfig = HaloAdConfig
// 由于微信小程序的运行机制问题,需声明如下一行,H5和APP非必填
Vue.prototype._i18n = i18n;
import HaloTokenConfig from '@/config/uhalo.config.js'
Vue.prototype.$baseApiUrl = HaloTokenConfig.BASE_API
Vue.config.productionTip = false;
App.mpType = "app";
const app = new Vue({
i18n,
...App,
});
// app.$mount();
// #ifdef H5
RouterMount(app, router, '#app')
// #endif
// #ifndef H5
app.$mount(); //为了兼容小程序及app端必须这样写才有效果
// #endif
app.$mount();
+91 -12
View File
@@ -2,8 +2,8 @@
"name" : "uni-halo",
"appid" : "__UNI__5748B6E",
"description" : "uni-halo博客:基于halo开源博客系统API开发的多端博客。",
"versionName" : "1.0.0",
"versionCode" : 100,
"versionName" : "2.0.10",
"versionCode" : 210,
"transformPx" : false,
/* 5+App */
"app-plus" : {
@@ -110,6 +110,9 @@
}
}
}
},
"uniStatistics" : {
"enable" : false
}
},
/* */
@@ -121,37 +124,113 @@
"urlCheck" : false,
"minified" : true
},
"usingComponents" : true
"usingComponents" : true,
"uniStatistics" : {
"enable" : false
}
},
"mp-alipay" : {
"usingComponents" : true
"usingComponents" : true,
"uniStatistics" : {
"enable" : false
}
},
"mp-baidu" : {
"usingComponents" : true
"usingComponents" : true,
"uniStatistics" : {
"enable" : false
}
},
"mp-toutiao" : {
"usingComponents" : true
"usingComponents" : true,
"uniStatistics" : {
"enable" : false
}
},
"uniStatistics" : {
"enable" : false
"enable" : false,
"version" : "2"
},
"vueVersion" : "2",
"h5" : {
"title" : "uni-halo",
"devServer" : {
"https" : false,
"disableHostCheck" : true,
"proxy" : {
"/api" : {
"target" : "https://b.925i.cn",
"/apis" : {
"target" : "https://blog.xiaoxiaomo.cn",
"changeOrigin" : true,
"secure" : false,
"pathRewrite" : {
"^/api" : ""
"^/apis" : "/apis"
}
}
}
},
"optimization" : {
"preload" : true,
"treeShaking" : {
"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
}
}
}
+18 -4
View File
@@ -1,9 +1,23 @@
{
"devDependencies": {
"vue-i18n": "^9.1.10"
"name": "uni-halo",
"version": "2.0.10",
"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",
"dependencies": {
"uni-read-pages": "^1.0.5",
"uni-simple-router": "^2.0.8-beta.4"
"qs": "^6.12.1"
}
}
+243 -408
View File
@@ -20,11 +20,12 @@
}
}
}
}, {
},
{
"path": "pages/tabbar/category/category",
"style": {
"navigationBarTitleText": "分类",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
"color": "#03a9f4",
@@ -32,7 +33,8 @@
}
}
}
}, {
},
{
"path": "pages/tabbar/gallery/gallery",
"style": {
"navigationBarTitleText": "图库",
@@ -44,10 +46,11 @@
}
}
}
}, {
"path": "pages/tabbar/links/links",
},
{
"path": "pages/tabbar/moments/moments",
"style": {
"navigationBarTitleText": "友链",
"navigationBarTitleText": "瞬间",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
@@ -56,7 +59,8 @@
}
}
}
}, {
},
{
"path": "pages/tabbar/about/about",
"style": {
"navigationBarTitleText": "关于",
@@ -69,7 +73,8 @@
}
}
}
}, {
},
{
"path": "uni_modules/uni-upgrade-center-app/pages/upgrade-popup",
"style": {
"disableScroll": true,
@@ -89,403 +94,231 @@
"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": "start/start",
"style": {
"navigationBarTitleText": "uni-halo",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
}, {
"path": "love/love",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
"color": "#03a9f4",
"style": "circle"
}
}
}
}, {
"path": "archives/archives",
"style": {
"navigationBarTitleText": "文章归档",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
"color": "#03a9f4",
"style": "circle"
}
}
}
}, {
"path": "journal/journal",
"style": {
"navigationBarTitleText": "个人日记",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
"color": "#03a9f4",
"style": "circle"
}
}
}
}, {
"path": "leaving/leaving",
"style": {
"navigationBarTitleText": "留言板",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
"color": "#03a9f4",
"style": "circle"
}
}
}
}, {
"path": "articles/articles",
"style": {
"navigationBarTitleText": "文章列表",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
"color": "#03a9f4",
"style": "circle"
}
}
}
}, {
"path": "category-detail/category-detail",
"style": {
"navigationBarTitleText": "分类详情",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
"color": "#03a9f4",
"style": "circle"
}
}
}
}, {
"path": "comment/comment",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
},
"meta": {
"auth": "login"
{
"path": "article-detail/article-detail",
"style": {
"navigationBarTitleText": "内容详情",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
"color": "#03a9f4",
"style": "circle"
}
}
}
},
{
"path": "love/love",
"style": {
"navigationBarTitleText": "恋爱日记",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"app-plus": {
"pullToRefresh": {
"color": "#03a9f4",
"style": "circle"
}
}
}
},
{
"path": "love/list",
"style": {
"navigationBarTitleText": "恋爱清单",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "love/album",
"style": {
"navigationBarTitleText": "恋爱相册",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
"color": "#03a9f4",
"style": "circle"
}
}
}
},
{
"path": "love/journey",
"style": {
"navigationBarTitleText": "我们的故事",
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
},
{
"path": "archives/archives",
"style": {
"navigationBarTitleText": "归档",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
"color": "#03a9f4",
"style": "circle"
}
}
}
},
{
"path": "friend-links/friend-links",
"style": {
"navigationBarTitleText": "友情链接",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
"color": "#03a9f4",
"style": "circle"
}
}
}
},
{
"path": "articles/articles",
"style": {
"navigationBarTitleText": "内容搜索",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
"color": "#03a9f4",
"style": "circle"
}
}
}
},
{
"path": "category-detail/category-detail",
"style": {
"navigationBarTitleText": "分类详情",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
"color": "#03a9f4",
"style": "circle"
}
}
}
},
{
"path": "disclaimers/disclaimers",
"style": {
"navigationBarTitleText": "免责声明",
"enablePullDownRefresh": false
}
},
{
"path": "contact/contact",
"style": {
"navigationBarTitleText": "联系博主",
"enablePullDownRefresh": false
}
},
{
"path": "about/about",
"style": {
"navigationBarTitleText": "关于博客",
"enablePullDownRefresh": false
}
},
{
"path": "setting/setting",
"style": {
"navigationBarTitleText": "设置",
"enablePullDownRefresh": false
}
},
{
"path": "tags/tags",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "tag-detail/tag-detail",
"style": {
"navigationBarTitleText": "标签详情",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
"color": "#03a9f4",
"style": "circle"
}
}
}
},
{
"path": "submit-link/submit-link",
"style": {
"navigationBarTitleText": "友链提交",
"enablePullDownRefresh": false
}
},
{
"path": "moment-detail/moment-detail",
"style": {
"navigationBarTitleText": "瞬间详情",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
"color": "#03a9f4",
"style": "circle"
}
}
}
},
{
"path": "votes/votes",
"style": {
"navigationBarTitleText": "投票列表",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
"color": "#03a9f4",
"style": "circle"
}
}
}
},
{
"path": "vote-detail/vote-detail",
"style": {
"navigationBarTitleText": "投票详情",
"enablePullDownRefresh": true,
"app-plus": {
"pullToRefresh": {
"color": "#03a9f4",
"style": "circle"
}
}
}
},
{
"path": "data-visual/data-visual",
"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
}
}]
]
},
{
"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",
@@ -493,7 +326,6 @@
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}]
}
],
@@ -504,7 +336,7 @@
"backgroundColor": "#F8F8F8"
},
"tabBar": {
"backgroundColor": "white",
"backgroundColor": "#fff",
"borderStyle": "white",
"color": "#303133",
"selectedColor": "#03a9f4",
@@ -519,17 +351,20 @@
"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": "友链"
}, {
"pagePath": "pages/tabbar/moments/moments",
"text": "瞬间"
},
{
"iconPath": "static/tabbar/select_mine.png",
"selectedIconPath": "static/tabbar/select_mine_active.png",
"pagePath": "pages/tabbar/about/about",
@@ -537,4 +372,4 @@
}
]
}
}
}
+119 -7
View File
@@ -1,25 +1,137 @@
<template>
<view class="app-page"></view>
<view class="app-page flex flex-center">
<PluginUnavailable v-if="!uniHaloPluginAvailable" :pluginId="uniHaloPluginId" :error-text="uniHaloPluginAvailableError" :use-border="false" :use-decoration="false" />
</view>
</template>
<script>
import pluginAvailableMixin from '@/common/mixins/pluginAvailable.js';
import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue';
const homePagePath = '/pages/tabbar/home/home';
const startPagePath = '/pagesA/start/start';
const articleDetailPath = '/pagesA/article-detail/article-detail';
const _DEV_ = false;
const _DEV_TO_TYPE_ = 'page';
const _DEV_TO_PATH_ = '/pagesA/data-visual/data-visual';
export default {
onLoad() {
this.fnCheckHadStarted();
mixins: [pluginAvailableMixin],
components: {
PluginUnavailable
},
computed: {
configs() {
return this.$tm.vx.getters().getConfigs;
}
},
async onLoad(options) {
// 本地开发,快速跳转页面,发布请设置 _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;
}
// 检查插件
this.setPluginId(this.NeedPluginIds.PluginUniHalo);
this.setPluginError('阿偶,检测到当前插件没有安装或者启用,无法启动 uni-halo 哦,请联系管理员');
if (!(await this.checkPluginAvailable())) return;
// 获取配置
uni.$tm.vx
.actions('config/fetchConfigs')
.then(async (res) => {
if (options.scene) {
if ('' !== options.scene) {
const postId = await this.getPostIdByQRCode(options.scene);
if (postId) {
uni.redirectTo({
url: articleDetailPath + `?name=${postId}`,
animationType: 'slide-in-right'
});
}
}
}
// #ifdef MP-WEIXIN
// uni.$tm.vx.commit('setWxShare', res.shareConfig);
// #endif
// 获取mockjson
if (res.auditConfig.auditModeEnabled) {
if (res.auditConfig.auditModeData.jsonUrl) {
await uni.$tm.vx.actions('config/fetchMockJson');
} else {
const mockJson = uni.$utils.checkJsonAndParse(res.auditConfig.auditModeData.jsonData);
if (mockJson.ok) {
uni.$tm.vx.commit('config/setMockJson', mockJson.jsonData);
}
}
}
// 进入检查
this.fnCheckShowStarted();
})
.catch((err) => {
uni.switchTab({
url: homePagePath
});
});
},
methods: {
// 检查是否已经启动过
fnCheckHadStarted() {
fnCheckShowStarted() {
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: '/pages/tabbar/home/home'
url: homePagePath
});
} else {
uni.redirectTo({
url: '/pagesA/start/start'
url: startPagePath
});
}
},
async getPostIdByQRCode(key) {
const response = await this.$httpApi.v2.getQRCodeInfo(key);
if (response) {
if (response && response.postId) {
return response.postId;
}
}
return null;
}
}
};
</script>
<style lang="scss" scoped>
.app-page {
width: 100vw;
height: 100vh;
}
</style>
File diff suppressed because it is too large Load Diff
+446 -216
View File
@@ -1,242 +1,472 @@
<template>
<view class="app-page">
<view v-if="loading != 'success'" class="loading-wrap">
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
</view>
<view v-else class="content flex">
<view v-if="categoryList.length == 0" class="category-empty flex flex-center">
<tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有文章分类~"></tm-empty>
</view>
<block v-else>
<tm-sliderNav :list="categoryList" color="light-blue" rang-key="name" @change="fnOnCategoryChange"></tm-sliderNav>
<scroll-view
class="right-content pt-12 pb-12"
:scroll-y="true"
:scroll-top="scrollTop"
:scroll-with-animation="true"
:refresher-enabled="true"
:refresher-triggered="triggered"
:refresher-threshold="60"
@refresherrefresh="fnGetData(true)"
@scrolltolower="fnGetData(false)"
@scroll="fnOnScroll"
@touchmove.stop
@touchstart="fnOnTouchStart"
@touchend="fnOnTouchEnd"
@touchcancel="fnOnTouchEnd"
>
<view v-if="dataList.length == 0" class="article-empty flex flex-center">
<tm-empty icon="icon-shiliangzhinengduixiang-" label="该分类下暂无文章~"></tm-empty>
</view>
<view class="app-page" :style="{
padding:calcShowType==='list-post'? 0 : '24rpx 0'
}">
<view v-if="loading !== 'success'" class="loading-wrap">
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
</view>
<!-- 内容区域 -->
<view v-else class="app-page-content" :class="[calcShowType==='list-post'?'list-post':'']">
<view v-if="dataList.length === 0" class="content-empty flex flex-center" style="height: 70vh;">
<!-- 空布局 -->
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
</view>
<block v-else>
<block v-if="calcAuditModeEnabled || calcShowType==='list'">
<tm-translate v-for="(item, index) in dataList" :key="index"
style="box-sizing: border-box;width: 50%;padding: 0 8rpx;" animation-name="fadeUp"
:wait="calcAniWait(index)">
<view class="catgory-card" :style="{backgroundImage:`url(${item.spec.cover})`}">
<view class="content" @click="handleToCategory(item)">
<view style="font-size: 32rpx;color: #ffffff;">{{ item.spec.displayName }}</view>
<view v-if="!calcAuditModeEnabled"
style="font-size: 24rpx;color: #ffffff;margin-top: 6rpx;">
{{ item.postCount }} 篇文章
</view>
</view>
</view>
</tm-translate>
<view class="load-text">{{ loadMoreText }}</view>
</block>
<view v-else-if="calcShowType==='list-post'" class="fulled flex" style="min-height:100vh">
<view class="bg-white" :style="{height: '100%'}">
<tm-sliderNav :list="categoryList" bg-color="white" color="light-blue" rang-key="displayName"
@change="fnOnCategoryChange"></tm-sliderNav>
</view>
<scroll-view class="right-content pt-12 pb-12" :scroll-y="true" :scroll-top="scrollTop"
:scroll-with-animation="true" :refresher-enabled="true" :refresher-triggered="triggered"
:refresher-threshold="60" refresher-background="#fafafa"
@refresherrefresh="fnGetPostByCategory(true)" @scrolltolower="fnGetPostByCategory(false)"
@scroll="fnOnScroll" @touchmove.stop @touchstart="fnOnTouchStart" @touchend="fnOnTouchEnd"
@touchcancel="fnOnTouchEnd">
<view v-if="postList.length === 0" class="article-empty flex flex-center">
<tm-empty :size="120" icon="icon-shiliangzhinengduixiang-" label="该分类下暂无文章~"></tm-empty>
</view>
<block v-else>
<block v-for="(post, index) in postList" :key="post.spec.publishTime">
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)">
<article-min-card :article="post" @on-click="fnToArticleDetail"></article-min-card>
</tm-translate>
</block>
<view class="load-text">{{ loadMoreText }}</view>
</block>
</scroll-view>
</view>
<block v-else>
<block v-for="(article, index) in dataList" :key="article.createTime">
<!-- 文章卡片 -->
<tm-translate animation-name="fadeUp" :wait="(index + 1) * 50">
<article-min-card :article="article" @on-click="fnToArticleDetail"></article-min-card>
</tm-translate>
</block>
<view class="load-text">{{ loadMoreText }}</view>
</block>
</scroll-view>
</block>
</view>
<tm-flotbutton v-if="dataList.length > 10" color="light-blue" @click="fnToTopScroll" size="m" icon="icon-angle-up"></tm-flotbutton>
</view>
<view class="flot-buttons">
<tm-button @click="fnScrollTop" size="m" :fab="true" theme="light-blue"
icon="icon-angle-up"></tm-button>
<tm-button v-if="!calcAuditModeEnabled" @click="fnChangeShowType" size="m" :fab="true" theme="light-blue"
:icon="calcShowType==='list'?'icon-align-left':'icon-all'"></tm-button>
</view>
</block>
</view>
</view>
</template>
<script>
import throttle from '@/utils/throttle.js';
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.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 MarkdownConfig from '@/common/markdown/markdown.config.js';
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
import tmFlowLayout from '@/tm-vuetify/components/tm-flowLayout/tm-flowLayout.vue';
import tmSliderNav from '@/tm-vuetify/components/tm-sliderNav/tm-sliderNav.vue';
import ArticleMinCard from '@/components/article-min-card/article-min-card.vue';
export default {
components: {
tmSkeleton,
tmTranslate,
tmFlotbutton,
tmEmpty,
tmFlowLayout,
tmSliderNav,
ArticleMinCard
},
data() {
return {
loading: 'loading',
queryParams: {
size: 10,
page: 0,
slug: ''
},
categoryList: [],
result: null,
dataList: [],
isLoadMore: false,
loadMoreText: '',
scrollTop: 0,
tempScrollTop: 0,
scrollTimeout: null,
triggered: false
};
},
components: {
tmSkeleton,
tmButton,
tmTranslate,
tmEmpty,
mpHtml,
tmFlowLayout,
tmSliderNav,
ArticleMinCard
},
data() {
return {
markdownConfig: MarkdownConfig,
loading: 'loading',
queryParams: {
size: 20,
page: 1,
fieldSelector: ['spec.hideFromList=false']
},
hasNext: false,
dataList: [],
categoryList: [],
isLoadMore: false,
loadMoreText: '加载中...',
currentCategoryConfig: {
type: "list"
},
currentCategoryName: "",
postQueryParams: {
size: 10,
page: 0,
},
postList: [],
triggered: false,
scrollTop: 0,
tempScrollTop: 0,
scrollTimeout: null,
};
},
computed: {
haloConfigs() {
return this.$tm.vx.getters().getConfigs;
},
calcAuditModeEnabled() {
return this.haloConfigs.auditConfig.auditModeEnabled
},
mockJson() {
return this.$tm.vx.getters().getMockJson;
},
categoryConfig() {
return this.haloConfigs.pageConfig.categoryConfig
},
calcShowType() {
return this.currentCategoryConfig.type
}
},
watch: {
categoryConfig: {
deep: true,
immediate: true,
handler(newVal) {
console.log("执行了", newVal)
if (!newVal) return;
this.currentCategoryConfig = newVal
this.handleInitPage()
},
}
},
onPullDownRefresh() {
this.isLoadMore = false;
this.queryParams.page = 0;
this.fnGetData();
},
onReachBottom(e) {
if (this.calcAuditModeEnabled) {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
return
}
if (this.hasNext) {
if (this.calcShowType === 'list') {
onLoad() {
this.fnSetPageTitle('文章分类');
this.fnGetAllCategory();
},
onPullDownRefresh() {
this.queryParams.page = 0;
this.isLoadMore = false;
this.fnGetData();
},
onReachBottom(e) {
if (this.result.hasNext) {
this.queryParams.page += 1;
this.isLoadMore = true;
this.fnGetData(false);
} else {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
},
methods: {
fnOnCategoryChange(e) {
this.queryParams.slug = this.categoryList[e].slug;
this.fnToTopScroll();
this.dataList = [];
this.fnGetData();
},
this.queryParams.page += 1;
} else {
this.postQueryParams.page += 1;
}
this.isLoadMore = true;
this.fnGetData();
} else {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
},
methods: {
fnChangeShowType() {
if (this.calcShowType === 'list-post') {
this.currentCategoryConfig.type = 'list'
} else {
this.currentCategoryConfig.type = 'list-post'
}
this.handleInitPage();
},
handleResetInit() {
this.postList = []
this.dataList = []
this.categoryList = []
this.queryParams.page = 0;
this.postQueryParams.page = 0;
this.hasNext = false
this.isLoadMore = false
this.loadMoreText = '加载中...'
this.currentCategoryName = ""
this.triggered = false
this.fnResetSetAniWaitIndex()
},
handleInitPage() {
this.handleResetInit()
if (this.calcShowType === 'list-post') {
this.queryParams.size = 99999
}
this.fnGetData();
},
fnGetData() {
if (this.calcAuditModeEnabled) {
this.categoryConfig.type = "list"
this.dataList = this.mockJson.category.list.map((item) => {
return {
metadata: {
name: Date.now() * Math.random(),
},
spec: {
displayName: item.title,
cover: this.$utils.checkImageUrl(item.cover)
},
postCount: 0
}
});
this.loading = 'success';
this.loadMoreText = '呜呜,没有更多数据啦~';
uni.hideLoading();
uni.stopPullDownRefresh();
return;
}
uni.showLoading({
mask: true,
title: '加载中...'
});
//
if (!this.isLoadMore) {
this.loading = 'loading';
}
this.loadMoreText = '加载中...';
this.$httpApi.v2
.getCategoryList(this.queryParams)
.then(res => {
if (this.calcShowType === 'list') {
this.loading = 'success';
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
//
this.hasNext = res.hasNext;
fnGetAllCategory() {
this.loading = 'loading';
uni.showLoading({
mask: true,
title: '加载中...'
});
this.$httpApi
.getCategoryList({ more: true })
.then(res => {
this.categoryList = res.data;
if (res.data.length != 0) {
this.queryParams.slug = res.data[0].slug;
this.triggered = false;
this.loading = 'success';
this.fnGetData(true, false);
}
})
.catch(err => {
console.error(err);
this.loading = 'error';
})
.finally(() => {
uni.hideLoading();
uni.stopPullDownRefresh();
});
},
fnGetData(isPulldownRefresh = true, triggered = true) {
if (!isPulldownRefresh) {
if (this.result.hasNext) {
this.queryParams.page += 1;
} else {
return uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
} else {
this.queryParams.page = 0;
if (triggered) {
this.triggered = true;
}
}
const tempItems = res.items.map(item => {
item.postCount = item.postCount ?? 0
item.spec.cover = this.$utils.checkThumbnailUrl(item.spec.cover, true)
return item;
})
this.$httpApi
.getCategoryPostList(this.queryParams.slug, this.queryParams)
.then(res => {
this.result = res.data;
if (this.isLoadMore) {
this.dataList = this.dataList.concat(tempItems);
} else {
this.dataList = tempItems;
}
} else {
this.dataList = res.items
this.categoryList = res.items.map(item => {
return {
...item,
displayName: item.spec.displayName,
name: item.metadata.name,
postCount: item.postCount ?? 0
}
})
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.dataList = this.dataList.concat(res.data.content);
} else {
this.dataList = res.data.content;
}
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
})
.catch(err => {
this.loadMoreText = '加载失败!';
})
.finally(() => {
this.triggered = false;
});
},
//
fnToArticleDetail(article) {
uni.navigateTo({
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
animationType: 'slide-in-right'
});
},
fnOnScroll(e) {
this.tempScrollTop = e.detail.scrollTop;
},
fnToTopScroll() {
uni.pageScrollTo({
scrollTop: 0,
duration: 500
});
this.scrollTop = 0;
this.tempScrollTop = 0;
},
fnOnTouchStart() {
clearTimeout(this.scrollTimeout);
},
fnOnTouchEnd() {
this.scrollTimeout = setTimeout(() => {
this.scrollTop = this.tempScrollTop;
}, 500);
}
}
this.$httpApi.v2
.getCategoryPostList(this.currentCategoryName, this.postQueryParams)
.then(res => {
this.hasNext = res.hasNext;
if (!isPulldownRefresh) {
this.postList = this.postList.concat(res.items);
} else {
this.postList = res.items;
}
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
})
.catch(err => {
this.loadMoreText = '加载失败!';
})
.finally(() => {
this.triggered = false;
});
},
fnOnCategoryChange(e) {
this.fnResetSetAniWaitIndex();
this.currentCategoryName = this.dataList[e].metadata.name;
this.fnToTopScroll();
this.postList = [];
this.fnGetPostByCategory();
},
fnOnScroll(e) {
this.tempScrollTop = e.detail.scrollTop;
},
fnToTopScroll() {
uni.pageScrollTo({
scrollTop: 0,
duration: 500
});
this.scrollTop = 0;
this.tempScrollTop = 0;
},
fnOnTouchStart() {
clearTimeout(this.scrollTimeout);
},
fnOnTouchEnd() {
this.scrollTimeout = setTimeout(() => {
this.scrollTop = this.tempScrollTop;
}, 500);
},
//
fnToArticleDetail(post) {
uni.navigateTo({
url: '/pagesA/article-detail/article-detail?name=' + post.metadata.name,
animationType: 'slide-in-right'
});
},
fnScrollTop() {
if (this.calcShowType === 'list') {
this.fnToTopPage()
} else {
this.fnToTopScroll()
}
}
}
};
</script>
<style lang="scss" scoped>
.app-page {
width: 100vw;
min-height: 100vh;
display: flex;
flex-direction: column;
background-color: #fff;
width: 100vw;
display: flex;
flex-direction: column;
padding: 24rpx 0;
}
.content {
height: 100vh;
background-color: #fafafa;
}
.category-empty {
width: 100%;
height: 70vh;
}
.article-empty {
width: 100%;
height: 70vh;
}
.right-content {
// width: calc(100vw - 144rpx);
width: calc(100vw - 190rpx);
height: 100vh;
background-color: #fff;
white-space: nowrap;
.auditModeEnabled {
width: 100%;
height: 80vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.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>
+374 -302
View File
@@ -1,325 +1,397 @@
<template>
<view class="app-page" :class="{ 'is-balck grey-darken-6': isBlackTheme }">
<!-- 顶部切换 -->
<view class="e-fixed" v-if="category.list.length > 2">
<tm-tabs color="light-blue" v-model="category.activeIndex" :list="category.list" align="left" @change="fnOnCategoryChange"></tm-tabs>
</view>
<!-- 占位区域 -->
<view style="width: 100vw;height: 90rpx;"></view>
<!-- 加载区域 -->
<view v-if="loading != 'success'" class="loading-wrap">
<tm-skeleton model="card"></tm-skeleton>
<tm-skeleton model="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 class="app-page" :class="[uniHaloPluginPageClass]">
<PluginUnavailable v-if="!uniHaloPluginAvailable" :pluginId="uniHaloPluginId"
:error-text="uniHaloPluginAvailableError" />
<template v-else>
<!-- 顶部切换 -->
<view class="e-fixed" v-if="category.list.length > 0">
<tm-tabs color="light-blue" :shadow="0" v-model="category.activeIndex" range-key="displayName"
:list="category.list" align="left" @change="fnOnCategoryChange($event, false)"></tm-tabs>
</view>
<block v-else>
<tm-flowLayout v-if="globalAppSettings.gallery.useWaterfull" @click="fnOnClick" ref="wafll">
<template v-slot:left="{ hdata }">
<tm-translate animation-name="fadeUp">
<view class="round-3 shadow-2 overflow white">
<tm-images :previmage="true" :src="hdata.item.image"></tm-images>
<view class="pa-10 text-size-s">
<view class="text-overflow-2">
<tm-tags color="bg-gradient-amber-accent" :shadow="0" :dense="true" size="s" model="fill">{{ hdata.item.team }}</tm-tags>
<text class="pl-6">{{ hdata.item.name }}</text>
</view>
<view v-if="hdata.item.description" class="ma-10">{{ hdata.item.description }}</view>
<view v-if="hdata.item.location" class="mt-10 text-grey-lighten-1">
<tm-icons name="icon-position-fill"></tm-icons>
<text class="pl-5">{{ hdata.item.location }}</text>
</view>
<view class="flex-between mt-12 flex-center">
<view>
<text class="text-size-xs text-red ml-5">{{ hdata.item.likes }}</text>
<text class="text-size-xs text-red ml-5">喜欢</text>
</view>
<view class="pl-10 text-size-xs text-grey-lighten-1">{{ hdata.item.takeTime }}</view>
</view>
<!-- 占位区域 -->
<view v-if="category.list.length > 0" style="width: 100vw;height: 90rpx;"></view>
<!-- 加载区域 -->
<view v-if="loading == 'loading'" class="loading-wrap">
<tm-skeleton model="card"></tm-skeleton>
<tm-skeleton model="card"></tm-skeleton>
<tm-skeleton model="card"></tm-skeleton>
<tm-skeleton model="card"></tm-skeleton>
</view>
<view v-else-if="loading == 'error'" class="flex flex-col flex-center" style="width:100%;height:60vh;">
<tm-empty icon="icon-wind-cry" label="阿偶,获取数据失败了~">
<tm-button theme="light-blue" size="m" :shadow="0" @click="fnGetData(true)">刷新试试</tm-button>
</tm-empty>
</view>
<!-- 内容区域 -->
<view v-else class="content">
<k-touch-listen class="touch-listen-content" @touchLeft="touchLeft" @touchRight="touchRight">
<view v-if="dataList.length === 0" class="content-empty">
<!-- 空布局 -->
<tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有分享图片~"></tm-empty>
</view>
<block v-else>
<block v-if="galleryConfig.useWaterfall">
<!--瀑布流-->
<tm-flowLayout-custom ref="wafll" style="width: 100%;"
@click="fnOnFlowClick"></tm-flowLayout-custom>
</block>
<!-- 列表 -->
<block v-else>
<tm-translate v-for="(item, index) in dataList" :key="index"
style="box-sizing: border-box;padding: 6rpx;width: 50%;height: 250rpx;"
animation-name="fadeUp" :wait="calcAniWait(index)">
<view style="border-radius: 12rpx;overflow: hidden;width: 100%;height: 250rpx;">
<image style="width: 100%;height: 100%;" mode="aspectFill" :src="item.spec.url"
@click="fnPreview(item)" />
</view>
</view>
</tm-translate>
</template>
<template v-slot:right="{ hdata }">
<tm-translate animation-name="fadeUp">
<view class="round-3 shadow-2 overflow white">
<tm-images :previmage="true" :src="hdata.item.image"></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>
</tm-translate>
</block>
<view class="load-text">{{ loadMoreText }}</view>
</block>
</block>
<tm-flotbutton @click="fnToTopPage" color="light-blue" size="m" icon="icon-angle-up"></tm-flotbutton>
<view class="load-text">{{ loadMoreText }}</view>
</block>
</view>
</k-touch-listen>
</view>
<view v-if="!calcAuditModeEnabled" class="flot-buttons">
<tm-button v-if="loading == 'error'" @click="fnGetCategory" size="m" :fab="true" theme="light-blue"
icon="icon-sync-alt"></tm-button>
<tm-button @click="fnToTopPage" size="m" :fab="true" theme="light-blue"
icon="icon-angle-up"></tm-button>
</view>
</template>
</view>
</template>
<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 tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue';
import tmFlowLayout from '@/tm-vuetify/components/tm-flowLayout/tm-flowLayout.vue';
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
import tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue';
import tmFlowLayoutCustom from '@/tm-vuetify/components/tm-flowLayout-custom/tm-flowLayout-custom.vue';
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
export default {
components: {
tmSkeleton,
tmTranslate,
tmFlotbutton,
tmTags,
tmEmpty,
tmIcons,
tmImages,
tmFlowLayout,
tmTabs
},
data() {
return {
isBlackTheme: false,
loading: 'loading',
category: {
activeIndex: 0,
activeValue: '',
list: []
},
queryParams: {
size: 10,
page: 0,
team: null,
keyword: ''
},
cache: {
import pluginAvailable from "@/common/mixins/pluginAvailable.js"
import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue'
export default {
options: {
multipleSlots: true
},
mixins: [pluginAvailable],
components: {
tmSkeleton,
tmTranslate,
tmFlotbutton,
tmTags,
tmEmpty,
tmIcons,
tmImages,
tmFlowLayoutCustom,
tmTabs,
tmButton,
PluginUnavailable
},
data() {
return {
isBlackTheme: false,
loading: 'loading',
category: {
activeIndex: 0,
activeValue: '',
list: []
},
queryParams: {
size: 10,
page: 1,
group: ""
},
isLoadMore: false,
loadMoreText: '',
hasNext: false,
dataList: [],
total: 0
lock: false
};
},
computed: {
galleryConfig() {
return this.$tm.vx.getters().getConfigs.pageConfig.galleryConfig;
},
isLoadMore: false,
loadMoreText: '',
result: {},
dataList: []
};
},
filters: {
filterTakeTime(val) {
return uni.$tm.dayjs(val).format('DD/MM/YYYY');
}
},
watch: {
globalAppSettings: {
deep: true,
handler() {
// this.isLoadMore = false;
// this.queryParams.page = 0;
// this.dataList = [];
// this.cache.list = [];
// this.cache.total = 0;
haloConfigs() {
return this.$tm.vx.getters().getConfigs;
},
mockJson() {
return this.$tm.vx.getters().getMockJson;
},
calcAuditModeEnabled() {
return this.haloConfigs.auditConfig.auditModeEnabled
},
},
watch: {
galleryConfig: {
async handler(newValue, oldValue) {
if (!newValue) return;
this.fnSetPageTitle(newValue.pageTitle);
this.fnGetCategory();
},
deep: true,
immediate: true
}
}
},
onLoad() {
this.fnSetPageTitle('个人图库');
this.fnGetCategory();
},
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: {
fnOnCategoryChange(index) {
this.dataList = [];
if (index == 0) {
this.queryParams.team = null;
},
async onLoad() {
//
this.setPluginId(this.NeedPluginIds.PluginPhotos)
this.setPluginError("阿偶,检测到当前插件没有安装或者启用,无法使用图库功能哦,请联系管理员")
await this.checkPluginAvailable()
},
onPullDownRefresh() {
if (!this.uniHaloPluginAvailable) {
uni.hideLoading();
uni.stopPullDownRefresh();
return
}
this.dataList = []
this.isLoadMore = false;
this.queryParams.page = 1;
this.fnGetData(true);
},
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(false);
} else {
this.queryParams.team = this.category.list[index];
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
this.queryParams.page = 0;
this.fnToTopPage();
this.fnGetData();
},
fnGetCategory() {
this.$httpApi.getPhotoTeams().then(res => {
this.category.list = ['全部', ...res.data];
});
},
fnGetData() {
uni.showLoading({
mask: true,
title: '加载中...'
});
//
if (!this.isLoadMore) {
this.loading = 'loading';
}
this.loadMoreText = '';
this.$httpApi
.getPhotoListByPage(this.queryParams)
.then(res => {
if (res.status == 200) {
this.loading = 'success';
this.result = res.data;
if (res.data.content.length != 0) {
const _list = res.data.content.map((item, index) => {
item['image'] = this.$utils.checkImageUrl(item.thumbnail);
item['model'] = 'text';
item['takeTime'] = this.$tm.dayjs(item['takeTime']).format('DD/MM/YYYY');
return item;
});
this.fnCacheDataList(_list);
if (this.globalAppSettings.gallery.useWaterfull) {
this.dataList = _list;
this.$nextTick(() => {
this.$refs.wafll.pushData(_list);
});
} else {
this.dataList = this.dataList.concat(_list);
methods: {
fnGetDataByCategory(index) {
this.fnResetSetAniWaitIndex();
this.queryParams.group = this.category.list[index].name;
this.queryParams.page = 1;
this.fnToTopPage();
this.dataList = [];
this.fnGetData(true);
},
fnOnCategoryChange(index) {
if (this.lock) {
// uni.showToast({
// title: "...",
// icon: "none"
// })
return;
}
this.fnGetDataByCategory(index)
},
fnGetCategory() {
if (this.calcAuditModeEnabled) {
this.fnGetData(true);
return
}
this.$httpApi.v2.getPhotoGroupList({
page: 1,
size: 0
}).then(res => {
this.category.list = res.map(item => {
return {
name: item.metadata.name,
displayName: item.spec.displayName,
priority: item.spec.priority
}
}).sort((a, b) => a.priority - b.priority)
this.category.list.unshift({
name: undefined,
displayName: '全部',
priority: 0
});
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];
}
},
})
//
fnOnClick(data) {
console.log('点击数据', data);
},
//
fnPreview(item, index) {
uni.previewImage({
current: index,
urls: this.dataList.map(x => x.image),
indicator: 'number',
loop: true
});
this.loading = 'success';
if (this.galleryConfig.useWaterfall) {
this.$nextTick(() => {
if (isClearWaterfall) {
this.$refs.wafll.clear()
}
setTimeout(() => {
this.$refs.wafll.pushData(this.dataList)
}, 50)
})
}
this.loadMoreText = '呜呜,没有更多数据啦~';
uni.hideLoading();
uni.stopPullDownRefresh();
this.lock = false;
return;
}
//
if (!this.isLoadMore) {
this.loading = 'loading';
}
this.loadMoreText = '';
this.$httpApi.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)
}
}
}
};
};
</script>
<style lang="scss">
.app-page {
width: 100vw;
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;
<style lang="scss" scoped>
.app-page {
width: 100vw;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
padding-bottom: 24rpx;
background-color: #fafafa;
}
}
.loading-wrap {
box-sizing: border-box;
padding: 24rpx;
}
</style>
.content {
width: 100%;
display: flex;
flex-wrap: wrap;
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>
+687 -402
View File
File diff suppressed because it is too large Load Diff
-347
View File
@@ -1,347 +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">
<!-- 空数据 -->
<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">
<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">
<!-- 艳丽版本 -->
<view
v-if="!globalAppSettings.links.useSimple"
class="info flex pa-36"
:class="{ 'border-b-1': linkIndex != team.children.length - 1 }"
@click="fnOnLinkEvent(link)"
>
<view class="link-logo"><cache-image class="link-logo_img" radius="12rpx" :url="link.logo" :fileMd5="link.logo" mode="aspectFill"></cache-image></view>
<view class="flex flex-col pl-30 info-detail">
<view class="link-card_name text-size-l text-weight-b text-red">{{ link.name }}</view>
<view class="poup-tag ml--10 mt-6">
<tm-tags color="bg-gradient-amber-accent" :shadow="0" size="s" model="fill">ID{{ link.id }}</tm-tags>
<tm-tags color=" bg-gradient-light-blue-lighten" :shadow="0" size="s" model="fill">{{ link.team }}</tm-tags>
</view>
<view class="link-card_desc text-overflow text-size-s mt-4">博客简介{{ link.description || '这个博主很懒,没写简介~' }}</view>
</view>
</view>
<!-- 简洁版本 -->
<view v-else class="link-card flex ml-24 mr-24 pt-24 pb-24" @click="fnOnLinkEvent(link)">
<image class="logo shadow-6" :src="link.logo" mode="aspectFill"></image>
<view class="info pl-24">
<view class="name text-size-g">{{ link.name }}</view>
<view class="desc mt-12 text-size-s text-grey-darken-1">{{ link.description }}</view>
<view v-if="false" class="link mt-12 text-size-m text-grey-darken-1">
<text class="iconfont icon-link mr-6 text-size-s"></text>
{{ link.url }}
</view>
</view>
</view>
</block>
</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';
import findCnChart from '@/tm-vuetify/tool/function/findCnChart.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 _firstChart = _team ? _team.substring(0, 1) : '';
const _links = item.links.map(link => {
this.linkTotal += 1;
link.logo = this.$utils.checkAvatarUrl(link.logo);
return link;
});
return {
title: _team,
index: findCnChart(_firstChart),
children: _links
};
});
// this.result = _result.reverse();
setTimeout(() => {
this.loading = 'success';
}, 500);
} else {
setTimeout(() => {
this.loading = 'error';
}, 500);
}
})
.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>
+410
View File
@@ -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>
-134
View File
@@ -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
View File
@@ -1,94 +1,99 @@
<template>
<view class="app-page bg-white flex flex-col">
<view v-if="uni_halo_logo" class="logo mt-40 pt-40"><image class="logo-img round-3" :src="uni_halo_logo" mode="aspectFill"></image></view>
<view class="mt-12 text-weight-b text-size-lg" :class="{ 'mt-40 pt-40': !uni_halo_logo }">uni-halo</view>
<view class="mt-12 text-size-s text-grey-darken-3"></view>
<view class="list-group mt-48" style="width: 100%;">
<tm-grouplist :shadow="0" :margin="0" :borderBottom="true">
<tm-listitem title="开源组织" :font-size="28" @click="$utils.copyText('https://www.ialley.cn', '巷子工坊官网已复制成功!')">
<text class="text-size-s" slot="rightValue">巷子工坊</text>
</tm-listitem>
<tm-listitem title="开源作者" :font-size="28" @click="$utils.copyText('https://b.925i.cn', '作者博客地址已复制')">
<text class="text-size-s" slot="rightValue">小莫唐尼</text>
</tm-listitem>
<tm-listitem title="作者博客" :font-size="28" @click="$utils.copyText('https://b.925i.cn', '作者博客地址已复制')">
<text class="text-size-s text-overflow" slot="rightValue">https://b.925i.cn</text>
</tm-listitem>
<tm-listitem title="文档地址" :font-size="28" @click="$utils.copyText('https://uni-halo.925i.cn', '项目码云仓库已复制')">
<text class="text-size-s text-overflow" slot="rightValue">https://uni-halo.925i.cn</text>
</tm-listitem>
<tm-listitem title="码云仓库" :font-size="28" @click="$utils.copyText('https://gitee.com/ialley-workshop-open/uni-halo', '码云仓库地址已复制')">
<text class="text-size-s text-overflow" slot="rightValue">https://gitee.com/ialley-workshop-open/uni-halo</text>
</tm-listitem>
<tm-listitem title="Github" :font-size="28" @click="$utils.copyText('https://github.com/ialley-workshop-open/uni-halo', 'Github地址已复制')">
<text class="text-size-s text-overflow" slot="rightValue">https://github.com/ialley-workshop-open/uni-halo</text>
</tm-listitem>
</tm-grouplist>
</view>
<view class="copyright bg-white text-size-xs text-align-center text-grey-darken-1 pa-36">
<view class="">根据 AGPL-3.0 协议开源</view>
<view class="mt-8"> 2022 uni-halo 开源项目丨巷子工坊@小莫唐尼 </view>
</view>
</view>
<view class="app-page bg-white flex flex-col">
<view class="logo mt-40 pt-40">
<image class="logo-img round-3" src="https://uni-halo.925i.cn/logo.png" mode="aspectFill"></image>
</view>
<view class="mt-12 text-weight-b text-size-lg">uni-halo</view>
<view class="mt-12 text-size-s text-grey-darken-3"></view>
<view class="list-group mt-48" style="width: 100%;">
<tm-grouplist :shadow="0" :margin="0" :borderBottom="true">
<tm-listitem title="开源组织" :font-size="28" @click="$utils.copyText('https://www.ialley.cn', '巷子工坊官网已复制成功!')">
<text class="text-size-s" slot="rightValue">巷子工坊</text>
</tm-listitem>
<tm-listitem title="开源作者" :font-size="28" @click="$utils.copyText('https://www.xiaoxiaomo.cn', '作者主页地址已复制')">
<text class="text-size-s" slot="rightValue">小莫唐尼</text>
</tm-listitem>
<tm-listitem title="作者博客" :font-size="28" @click="$utils.copyText('https://blog.xiaoxiaomo.cn', '作者博客地址已复制')">
<text class="text-size-s text-overflow" slot="rightValue">https://blog.xiaoxiaomo.cn</text>
</tm-listitem>
<tm-listitem title="文档地址" :font-size="28" @click="$utils.copyText('https://uni-halo.925i.cn', '项目码云仓库已复制')">
<text class="text-size-s text-overflow" slot="rightValue">https://uni-halo.925i.cn</text>
</tm-listitem>
<tm-listitem title="码云仓库" :font-size="28"
@click="$utils.copyText('https://gitee.com/ialley-workshop-open/uni-halo', '码云仓库地址已复制')">
<text class="text-size-s text-overflow" slot="rightValue">https://gitee.com/ialley-workshop-open/uni-halo</text>
</tm-listitem>
<tm-listitem title="Github" :font-size="28"
@click="$utils.copyText('https://github.com/ialley-workshop-open/uni-halo', 'Github地址已复制')">
<text class="text-size-s text-overflow" slot="rightValue">https://github.com/ialley-workshop-open/uni-halo</text>
</tm-listitem>
</tm-grouplist>
</view>
<view class="copyright bg-white text-size-xs text-align-center text-grey-darken-1 pa-36">
<view class="">根据 AGPL-3.0 协议开源</view>
<view class="mt-8"> 2022 uni-halo 开源项目丨巷子工坊@小莫唐尼 </view>
</view>
</view>
</template>
<script>
import tmGrouplist from '@/tm-vuetify/components/tm-grouplist/tm-grouplist.vue';
import tmListitem from '@/tm-vuetify/components/tm-listitem/tm-listitem.vue';
export default {
components: {
tmGrouplist,
tmListitem
},
computed: {
uni_halo_logo() {
return getApp().globalData.uni_halo_logo;
}
},
onLoad() {
this.fnSetPageTitle('关于项目');
},
methods: {}
components: {
tmGrouplist,
tmListitem
},
onLoad() {
this.fnSetPageTitle('关于项目');
},
methods: {}
};
</script>
<style scoped lang="scss">
.app-page {
width: 100vw;
height: 100vh;
box-sizing: border-box;
align-items: center;
.logo-img {
width: 160rpx;
height: 160rpx;
}
.info {
margin-left: 90rpx;
margin-right: 90rpx;
}
.copyright {
width: 100vw;
position: fixed;
bottom: 0;
left: 0;
box-sizing: border-box;
}
width: 100vw;
height: 100vh;
box-sizing: border-box;
align-items: center;
.label {
display: inline-block;
min-width: 140rpx;
}
.logo-img {
width: 160rpx;
height: 160rpx;
}
.info {
margin-left: 90rpx;
margin-right: 90rpx;
}
.copyright {
width: 100vw;
position: fixed;
bottom: 0;
left: 0;
box-sizing: border-box;
}
.label {
display: inline-block;
min-width: 140rpx;
}
}
.text-overflow {
width: calc(100vw - 300rpx);
text-align: right;
width: calc(100vw - 300rpx);
text-align: right;
}
.list-group {
::v-deep {
.left {
width: 160rpx;
min-width: 160rpx;
}
}
::v-deep {
.left {
width: 160rpx;
min-width: 160rpx;
}
}
}
</style>
+559 -299
View File
@@ -1,69 +1,85 @@
<template>
<view class="app-page">
<view class="e-fixed"><tm-tabs color="light-blue" v-model="tab.activeIndex" :list="tab.list" align="center" @change="fnOnTabChange"></tm-tabs></view>
<!-- 占位区域 -->
<view style="width: 100vw;height: 90rpx;"></view>
<view class="app-page">
<!-- 骨架屏加载区域 -->
<view v-if="loading != 'success'" class="loading-wrap">
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
</view>
<view class="e-fixed">
<tm-tabs color="light-blue" v-model="tab.activeIndex" :list="tab.list" align="center"
@change="fnOnTabChange"></tm-tabs>
</view>
<!-- 占位区域 -->
<view style="width: 100vw;height: 90rpx;"></view>
<!-- 加载完成区域 -->
<block v-else>
<view v-if="dataList.length == 0" class="list-empty flex flex-center"><tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无归档的文章"></tm-empty></view>
<view v-else class="e-timeline tm-timeline mt-24">
<block v-for="(item, index) in dataList" :key="index">
<view class="tm-timeline-item tm-timeline-item--leftDir">
<view style="width: 160rpx;">
<view
:style="{ width: '24rpx', height: '24rpx' }"
:class="[black_tmeme ? 'bk' : '']"
class="flex-center rounded tm-timeline-jidian border-white-a-2 grey-lighten-2 light-blue shadow-primary-4"
></view>
<view
:style="{ marginTop: '-24rpx' }"
:class="[index !== dataList.length - 1 ? 'tm-timeline-item-boder' : '', black_tmeme ? 'bk' : '']"
class="grey-lighten-2"
></view>
</view>
<view class="tm-timeline-item-content relative">
<view class="tm-timeline-item-left">
<view class="time text-weight-b mb-24">
{{ item.year }}
<block v-if="tab.activeIndex == 0">{{ item.month }}</block>
<text class="text-size-s text-grey-darken-1 ml-24">共发布 {{ item.posts.length }} 篇文章</text>
</view>
<block v-if="item.posts.length != 0">
<block v-for="(post, postIndex) in item.posts" :key="post.id">
<tm-translate animation-name="fadeUp" :wait="(postIndex + 1) * 50">
<view class="flex post shadow-3 pa-24 mb-24" :class="[globalAppSettings.layout.cardType]" @click="fnToArticleDetail(post)">
<image class="post-thumbnail" :src="$utils.checkThumbnailUrl(post.thumbnail)" mode="aspectFill"></image>
<view class="post-info pl-20">
<view class="post-info_title text-overflow">{{ post.title }}</view>
<view class="post-info_summary text-overflow-2 mt-12 text-size-s text-grey-darken-1">{{ post.summary }}</view>
<view class="post-info_time mt-12 text-size-s text-grey-darken-1">
<text class="iconfont icon-clock text-size-s mr-6"></text>
<text class="time-label">发布时间</text>
{{ { d: post.createTime, f: 'yyyy年MM月dd日 星期w' } | formatTime }}
</view>
</view>
</view>
</tm-translate>
</block>
</block>
<view v-else class="post-empty text-size-m text-grey-darken-1">该日期下暂无归档文章</view>
</view>
</view>
</view>
</block>
</view>
<!-- 返回顶部 -->
<tm-flotbutton @click="fnToTopPage" size="m" color="bg-gradient-light-blue-accent" icon="icon-angle-up"></tm-flotbutton>
</block>
</view>
<!-- 骨架屏加载区域 -->
<view v-if="loading !== 'success'" class="loading-wrap">
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
</view>
<!-- 加载完成区域 -->
<block v-else>
<view v-if="dataList.length === 0" class="list-empty flex flex-center">
<tm-empty v-if="calcAuditModeEnabled" icon="icon-shiliangzhinengduixiang-" label="暂无归档的内容"></tm-empty>
<tm-empty v-else icon="icon-shiliangzhinengduixiang-" label="暂无归档的文章"></tm-empty>
</view>
<view v-else class="e-timeline tm-timeline mt-24">
<block v-for="(item, index) in dataList" :key="index">
<view class="tm-timeline-item tm-timeline-item--leftDir">
<view style="width: 160rpx;">
<view :style="{ width: '24rpx', height: '24rpx' }" :class="[black_tmeme ? 'bk' : '']"
class="flex-center rounded tm-timeline-jidian border-white-a-2 grey-lighten-2 light-blue shadow-primary-4">
</view>
<view :style="{ marginTop: '-24rpx' }"
:class="[index !== dataList.length - 1 ? 'tm-timeline-item-boder' : '', black_tmeme ? 'bk' : '']"
class="grey-lighten-2"></view>
</view>
<view class="tm-timeline-item-content relative">
<view class="tm-timeline-item-left">
<view class="flex time text-weight-b mb-24">
<text>{{ item.year }}</text>
<text v-if="tab.activeIndex === 0">{{ item.month }}</text>
<view v-if="calcAuditModeEnabled" class="text-size-s text-grey-darken-1 ml-12">
{{ item.posts.length }} 篇内容
</view>
<view v-else class="text-size-s text-grey-darken-1 ml-12">
{{ item.posts.length }} 篇文章
</view>
</view>
<block v-if="item.posts.length !== 0">
<block v-for="(post, postIndex) in item.posts" :key="post.metadata.name">
<view class="flex post shadow-3 pa-24 mb-24"
:class="[globalAppSettings.layout.cardType]"
@click="fnToArticleDetail(post)">
<image class="post-thumbnail"
:src="$utils.checkThumbnailUrl(post.spec.cover)" mode="aspectFill">
</image>
<view class="post-info pl-20">
<view class="post-info_title text-overflow">{{ post.spec.title }}
</view>
<view
class="post-info_summary text-overflow-2 mt-12 text-size-s text-grey-darken-1">
{{ post.status.excerpt }}
</view>
<view class="post-info_time mt-12 text-size-s text-grey-darken-1">
<text class="iconfont icon-clock text-size-s mr-6"></text>
<text class="time-label">发布时间</text>
{{ {d: post.spec.publishTime, f: 'yyyy年MM月dd日 星期w'} | formatTime }}
</view>
</view>
</view>
</block>
</block>
<view v-else class="post-empty text-size-m text-grey-darken-1">该日期下暂无归档文章</view>
</view>
</view>
</view>
</block>
</view>
<view class="load-text mt-12">{{ loadMoreText }}</view>
<!-- 返回顶部 -->
<tm-flotbutton @click="fnToTopPage" size="m" color="bg-gradient-light-blue-accent"
icon="icon-angle-up"></tm-flotbutton>
</block>
</view>
</template>
<script>
@@ -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 tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
import qs from 'qs'
export default {
components: {
tmSkeleton,
tmTranslate,
tmFlotbutton,
tmTabs,
tmEmpty
},
data() {
return {
loading: 'loading',
tab: {
activeIndex: 0,
list: ['按月份查看', '按年份查看']
},
queryParams: {
size: 10,
page: 0
},
result: null,
dataList: [],
api: 'getMonthArchives'
};
},
computed: {
black_tmeme: function() {
return this.$tm.vx.state().tmVuetify.black;
},
color_tmeme: function() {
return this.$tm.vx.state().tmVuetify.color;
}
},
created() {
this.fnGetData();
},
onPullDownRefresh() {
this.fnGetData();
this.queryParams.page = 0;
},
components: {
tmSkeleton,
tmTranslate,
tmFlotbutton,
tmTabs,
tmEmpty
},
data() {
return {
loading: 'loading',
tab: {
activeIndex: 0,
list: ['按月份查看', '按年份查看']
},
queryParams: {
size: 10,
page: 1
},
result: {},
cacheDataList: [], //
dataList: [], //
isLoadMore: false,
loadMoreText: "加载中..."
};
},
computed: {
black_tmeme: function () {
return this.$tm.vx.state().tmVuetify.black;
},
color_tmeme: function () {
return this.$tm.vx.state().tmVuetify.color;
},
haloConfigs() {
return this.$tm.vx.getters().getConfigs;
},
mockJson() {
return this.$tm.vx.getters().getMockJson;
},
calcAuditModeEnabled() {
return this.haloConfigs.auditConfig.auditModeEnabled
},
},
created() {
this.fnGetData();
},
onPullDownRefresh() {
this.isLoadMore = false;
this.queryParams.page = 1;
this.fnGetData();
},
onReachBottom(e) {
if (this.calcAuditModeEnabled) {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
return
}
if (this.result.hasNext) {
this.queryParams.page += 1;
this.isLoadMore = true;
this.fnGetData();
} else {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
},
methods: {
fnOnTabChange(index) {
this.fnResetSetAniWaitIndex();
this.queryParams.page = 0;
this.dataList = this.handleGetShowDataList(this.handleGetPosts(this.cacheDataList))
this.fnToTopPage();
},
fnGetData() {
if (this.calcAuditModeEnabled) {
const dataList = this.mockJson.archives.list.map(item => {
const date = new Date(item.time)
const year = date.getFullYear()
const month = date.getMonth() + 1
return {
metadata: {
name: Date.now() * Math.random(),
labels: {
"content.halo.run/archive-year": year,
"content.halo.run/archive-month": month
}
},
spec: {
pinned: false,
cover: item.cover,
title: item.title,
publishTime: item.time
},
status: {
excerpt: item.desc
},
stats: {
visit: 0
}
}
});
const posts = this.handleGetPosts(dataList)
this.dataList = []
this.cacheDataList = dataList;
this.dataList = this.handleGetShowDataList(posts)
this.loading = 'success';
this.loadMoreText = '呜呜,没有更多数据啦~';
uni.hideLoading();
uni.stopPullDownRefresh();
return;
}
if (this.isLoadMore) {
uni.showLoading({
title: "加载中..."
})
} else {
this.loading = 'loading';
}
this.loadMoreText = "加载中...";
const paramsStr = qs.stringify(this.queryParams, {
allowDots: true,
encodeValuesOnly: true,
skipNulls: true,
encode: true,
arrayFormat: 'repeat'
})
uni.request({
url: this.$baseApiUrl + '/apis/api.content.halo.run/v1alpha1/posts?' + paramsStr,
method: 'GET',
success: (res) => {
const data = res.data;
this.result = data;
const posts = this.handleGetPosts(data.items)
const showDataList = this.handleGetShowDataList(posts)
if (this.isLoadMore) {
this.cacheDataList = this.handleUniqueCacheDatalist([
...this.cacheDataList, ...data.items
]);
this.handleMergeDataList2(showDataList)
} else {
this.dataList = []
this.cacheDataList = data.items;
this.dataList = showDataList
}
methods: {
fnOnTabChange(index) {
// todo:
const _api = ['getMonthArchives', 'getYearArchives'];
this.api = _api[index];
this.queryParams.page = 0;
this.fnGetData();
},
fnGetData() {
this.loading = 'loading';
uni.showLoading({
mask: true,
title: '加载中...'
});
this.$httpApi[this.api](this.queryParams)
.then(res => {
this.result = res.data;
this.dataList = res.data;
setTimeout(() => {
this.loading = 'success';
}, 500);
})
.catch(err => {
console.error(err);
this.loading = 'error';
})
.finally(() => {
setTimeout(() => {
uni.hideLoading();
uni.stopPullDownRefresh();
}, 500);
});
},
//
fnToArticleDetail(article) {
uni.navigateTo({
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
animationType: 'slide-in-right'
});
}
}
this.loading = 'success';
this.loadMoreText = data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
uni.hideLoading();
uni.stopPullDownRefresh();
},
fail: (err) => {
this.loading = 'error';
this.loadMoreText = '加载失败,请下拉刷新!';
uni.$tm.toast(err.message || '数据加载失败!');
uni.hideLoading();
uni.stopPullDownRefresh();
}
})
},
//
handleGetPosts(dataList) {
const posts = {}
const postLabelYearKey = "content.halo.run/archive-year"
const postLabelMonthKey = "content.halo.run/archive-month"
dataList.forEach(item => {
let postItemKey = ""
if (this.tab.activeIndex === 0) {
postItemKey =
`${item.metadata.labels[postLabelYearKey]}-${item.metadata.labels[postLabelMonthKey]}`
} else {
postItemKey = `${item.metadata.labels[postLabelYearKey]}`
}
if (posts[postItemKey]) {
posts[postItemKey].push(item)
} else {
posts[postItemKey] = [item]
}
})
return posts;
},
//
handleGetShowDataList(posts) {
const dataListResult = []
Object.keys(posts).forEach((key) => {
const postData = {
sort: 0,
key: key,
year: key,
month: "",
posts: posts[key]
}
if (this.tab.activeIndex == 0) {
const splitDate = key.split("-")
postData.year = splitDate[0]
postData.month = splitDate[1]
postData.sort = Number(key.replace("-", ""))
} else {
postData.sort = Number(key)
}
dataListResult.push(postData)
})
dataListResult.sort((a, b) => {
return Number(b.sort) - Number(a.sort)
})
return dataListResult;
},
handleMergeDataList(list1, list2) {
// list1key
let merged = list1.reduce((acc, item) => {
acc[item.key] = {
...item
};
return acc;
}, {});
// list2posts
list2.forEach(item => {
if (merged[item.key]) {
// keyposts
merged[item.key].posts = [...merged[item.key].posts, ...item.posts];
} else {
// key
merged[item.key] = {
...item
};
}
});
//
return Object.values(merged);
},
handleMergeDataList2(list) {
list.forEach((item, index) => {
const find = this.dataList.find(x => x.key == item.key)
if (find) {
item.posts.forEach(post => {
if (!find.posts.find(x => x.metadata.name == post.metadata.name)) {
find.posts.push(post)
}
})
}
})
list.forEach(post => {
if (!this.dataList.find(x => x.key === post.key)) {
this.dataList.push(post)
}
})
this.dataList.sort((a, b) => {
return Number(b.sort) - Number(a.sort)
})
},
handleUniqueCacheDatalist(dataList) {
const seen = new Set();
return dataList.filter(item => {
return seen.has(item.metadata.name) ? false : seen.add(item.metadata.name);
});
},
fnToArticleDetail(article) {
if (this.calcAuditModeEnabled) {
return;
}
uni.navigateTo({
url: '/pagesA/article-detail/article-detail?name=' + article.metadata.name,
animationType: 'slide-in-right'
});
}
}
};
</script>
<style lang="scss" scoped>
.app-page {
width: 100vw;
min-height: 100vh;
display: flex;
flex-direction: column;
background-color: #fafafd;
width: 100vw;
min-height: 100vh;
display: flex;
flex-direction: column;
background-color: #fafafd;
}
.auditModeEnabled {
width: 100%;
height: 80vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.loading-wrap {
padding: 24rpx;
padding: 24rpx;
}
.list-empty {
width: 100vw;
height: 100vh;
width: 100vw;
height: 100vh;
}
.statistics {
background-color: #ffffff;
background-color: #ffffff;
}
.e-timeline {
::v-deep {
.tm-timeline-item > view:first-child {
width: 110rpx !important;
}
.tm-timeline-item-left {
max-width: 580rpx !important;
width: 100% !important;
}
}
::v-deep {
.tm-timeline-item > view:first-child {
width: 110rpx !important;
}
.tm-timeline-item-left {
max-width: 580rpx !important;
width: 100% !important;
}
}
}
.tm-timeline {
.tm-timeline-item {
.tm-timeline-item-left,
.tm-timeline-item-right {
width: 200rpx;
flex-shrink: 0;
}
.tm-timeline-item {
.tm-timeline-item-content {
display: flex;
justify-content: center;
align-items: flex-start;
align-content: flex-start;
}
.tm-timeline-jidian {
margin: auto;
}
&.tm-timeline-item--leftDir {
display: flex;
flex-flow: row;
&.endright {
justify-content: flex-end;
}
.tm-timeline-item-left,
.tm-timeline-item-right {
width: auto;
max-width: 400rpx;
}
.tm-timeline-item-boder {
height: 100%;
width: 1px;
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;
}
}
}
.tm-timeline-item-left,
.tm-timeline-item-right {
width: 200rpx;
flex-shrink: 0;
}
.tm-timeline-item-content {
display: flex;
justify-content: center;
align-items: flex-start;
align-content: flex-start;
}
.tm-timeline-jidian {
margin: auto;
}
&.tm-timeline-item--leftDir {
display: flex;
flex-flow: row;
&.endright {
justify-content: flex-end;
}
.tm-timeline-item-left,
.tm-timeline-item-right {
width: auto;
max-width: 400rpx;
}
.tm-timeline-item-boder {
height: 100%;
width: 1px;
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 {
width: 560rpx;
border-radius: 12rpx;
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;
width: 560rpx;
border-radius: 12rpx;
background-color: #fff;
&_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;
}
}
&.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 {
.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 {
border-radius: 6rpx;
width: 200rpx;
height: 170rpx;
border-radius: 6rpx;
width: 200rpx;
height: 170rpx;
}
.post-info {
width: 0;
flex-grow: 1;
&_title {
color: #303133;
font-size: 28rpx;
font-weight: bold;
}
&_summary {
display: -webkit-box;
line-height: 1.6;
}
&_time {
.time-label {
display: none;
}
}
width: 0;
flex-grow: 1;
&_title {
color: #303133;
font-size: 28rpx;
font-weight: bold;
}
&_summary {
display: -webkit-box;
line-height: 1.6;
}
&_time {
.time-label {
display: none;
}
}
}
.time {
align-items: center;
}
</style>
File diff suppressed because it is too large Load Diff
+218 -176
View File
@@ -1,203 +1,245 @@
<template>
<view class="app-page" :class="{ 'is-balck grey-darken-6': isBlackTheme }">
<!-- 顶部切换 -->
<view class="e-fixed shadow-2">
<tm-search v-model="queryParams.keyword" :round="24" :shadow="0" color="light-blue" insert-color="light-blue" :clear="true" @confirm="fnOnSearch"></tm-search>
<tm-tabs color="light-blue" :shadow="0" v-model="tab.activeIndex" :list="tab.list" align="center" @change="fnOnTabChange"></tm-tabs>
</view>
<!-- 占位区域 -->
<view style="width: 100vw;height: 184rpx;"></view>
<!-- 加载区域 -->
<view v-if="loading != 'success'" class="loading-wrap pa-24">
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
</view>
<!-- 内容区域 -->
<view v-else class="content">
<view v-if="dataList.length == 0" class="content-empty flex flex-center">
<!-- 空布局 -->
<tm-empty icon="icon-shiliangzhinengduixiang-" label="该分类下暂无数据"></tm-empty>
<view class="app-page" :class="[uniHaloPluginPageClass]">
<PluginUnavailable v-if="!uniHaloPluginAvailable" :pluginId="uniHaloPluginId"
:error-text="uniHaloPluginAvailableError" />
<template v-else>
<!-- 顶部切换 -->
<view class="e-fixed shadow-1">
<tm-search v-model="queryParams.keyword" :round="24" :shadow="0" color="light-blue"
insert-color="light-blue" :clear="true" @input="fnOnSearch" @confirm="fnOnSearch"></tm-search>
<tm-tabs v-if="false" color="light-blue" :shadow="0" v-model="tab.activeIndex" :list="tab.list"
align="center" @change="fnOnTabChange"></tm-tabs>
</view>
<block v-else>
<block v-for="(article, index) in dataList" :key="article.id">
<!-- 文章卡片 -->
<tm-translate animation-name="fadeUp" :wait="(index + 1) * 50">
<article-card :article="article" @on-click="fnToArticleDetail"></article-card>
<!-- 广告区域 -->
<view v-if="haloAdConfig.articles.use && (index + 1) % haloAdConfig.frequency == 0" class="ad-wrap ma-24">
<!-- #ifdef MP-WEIXIN -->
<ad v-if="haloAdConfig.unitId" :unit-id="haloAdConfig.unitId"></ad>
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<ad v-if="haloAdConfig.adpid" :adpid="haloAdConfig.adpid"></ad>
<!-- #endif -->
<!-- 占位区域 -->
<view style="width: 100vw;height: 100rpx;"></view>
<!-- 加载区域 -->
<view v-if="loading == 'loading'" class="loading-wrap pa-24">
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
</view>
<view v-else-if="loading == 'error'" class="content-empty flex flex-center">
<tm-empty icon="icon-wind-cry" label="搜索异常"></tm-empty>
</view>
<!-- 内容区域 -->
<view v-else class="content">
<view v-if="dataList.length == 0" class="content-empty flex flex-center">
<!-- 空布局 -->
<tm-empty v-if="!queryParams.keyword" icon="icon-shiliangzhinengduixiang-"
label="请输入关键词搜索"></tm-empty>
<tm-empty v-else icon="icon-shiliangzhinengduixiang-"
:label="`未搜到 ${queryParams.keyword} 相关内容`"></tm-empty>
</view>
<block v-else>
<tm-translate v-for="(item, index) in dataList" :key="item.metadataName" animation-name="fadeUp"
:wait="calcAniWait(index)">
<view class="article-card" @click="fnToDetail(item)">
<view class="mb-12 flex flex-start">
<view class="flex-shrink ml--12">
<tm-tags v-if="isArticle(item)" color="blue" size="n" model="text">文章</tm-tags>
<tm-tags v-else color="green" size="n" model="text">瞬间</tm-tags>
</view>
<text class="ml-2 text-overflow text-size-n text-weight-b"
style="color: #333;">{{ item.title }}</text>
</view>
<mp-html class="evan-markdown" lazy-load :domain="markdownConfig.domain"
:loading-img="markdownConfig.loadingGif" :scroll-table="true" :selectable="true"
:tag-style="markdownConfig.tagStyle" :content="item.description || item.content"
:markdown="true" :showLineNumber="true" :showLanguageName="true"
:copyByLongPress="true" />
<view class="mt-12 flex flex-center flex-between">
<text style="font-size: 24rpx;color:#888">
最近更新时间{{ {d: item.updateTimestamp, f: 'yyyy年MM月dd日 HH点mm分ss秒'} | formatTime }}
</text>
<!-- <tm-tags v-if="isArticle(item)" color="blue" size="n" model="text">文章</tm-tags>
<tm-tags v-else color="green" size="n" model="text">瞬间</tm-tags> -->
</view>
</view>
</tm-translate>
</block>
<tm-flotbutton @click="fnToTopPage" size="m" color="light-blue" icon="icon-angle-up"></tm-flotbutton>
<view class="load-text">{{ loadMoreText }}</view>
</block>
</view>
<tm-flotbutton @click="fnToTopPage" size="m" color="light-blue"
icon="icon-angle-up"></tm-flotbutton>
</block>
</view>
</template>
</view>
</template>
<script>
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
import tmSearch from '@/tm-vuetify/components/tm-search/tm-search.vue';
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
import tmSearch from '@/tm-vuetify/components/tm-search/tm-search.vue';
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
import tmTabs from '@/tm-vuetify/components/tm-tabs/tm-tabs.vue';
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
export default {
components: {
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();
},
import MarkdownConfig from '@/common/markdown/markdown.config.js';
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
onReachBottom(e) {
if (this.result.hasNext) {
this.queryParams.page += 1;
this.isLoadMore = true;
this.fnGetData();
} else {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
},
methods: {
fnOnTabChange(index) {
this.dataList = [];
const _sorts = {
0: '',
1: 'topPriority,createTime,desc',
2: 'topPriority,visits,desc',
3: 'topPriority,updateTime,desc',
4: 'topPriority,likes,desc'
import pluginAvailableMixin from "@/common/mixins/pluginAvailable.js"
import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue'
export default {
mixins: [pluginAvailableMixin],
components: {
tmSkeleton,
tmSearch,
tmTranslate,
tmTabs,
tmFlotbutton,
tmEmpty,
tmTags,
mpHtml,
PluginUnavailable
},
data() {
return {
markdownConfig: MarkdownConfig,
loading: 'loading',
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() {
this.queryParams.page = 0;
this.isLoadMore = false;
this.fnGetData();
computed: {
haloConfigs() {
return this.$tm.vx.getters().getConfigs;
},
calcAuditModeEnabled() {
return this.haloConfigs.auditConfig.auditModeEnabled
},
},
fnGetData() {
uni.showLoading({
mask: true,
title: '加载中...'
});
//
if (!this.isLoadMore) {
this.loading = 'loading';
async onLoad() {
this.fnSetPageTitle('内容搜索');
//
this.setPluginId(this.NeedPluginIds.PluginSearchWidget)
this.setPluginError("阿偶,检测到当前插件没有安装或者启用,无法使用搜索功能哦,请联系管理员")
if (!await this.checkPluginAvailable()) return
if (!this.queryParams.keyword) {
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);
});
},
//
fnToArticleDetail(article) {
uni.navigateTo({
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
animationType: 'slide-in-right'
});
onPullDownRefresh() {
if (!this.uniHaloPluginAvailable) {
uni.hideLoading();
uni.stopPullDownRefresh();
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>
<style lang="scss" scoped>
.app-page {
width: 100vw;
min-height: 100vh;
display: flex;
flex-direction: column;
padding-bottom: 24rpx;
background-color: #fafafd;
.app-page {
width: 100vw;
min-height: 100vh;
display: flex;
flex-direction: column;
padding-bottom: 24rpx;
background-color: #fafafd;
&.is-balck {
background-color: #212121;
&.is-balck {
background-color: #212121;
}
}
.content {
padding-top: 24rpx;
}
}
.content {
padding-top: 24rpx;
.content-empty {
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>
+144 -122
View File
@@ -1,24 +1,30 @@
<template>
<view class="app-page">
<view v-if="loading != 'success'" class="loading-wrap">
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
</view>
<block v-else>
<view class="empty" v-if="dataList.length == 0"><tm-empty icon="icon-shiliangzhinengduixiang-" label="该分类下暂无文章"></tm-empty></view>
<block v-else>
<block v-for="(article, index) in dataList" :key="article.createTime">
<!-- 文章卡片 -->
<tm-translate animation-name="fadeUp" :wait="(index + 1) * 50"><article-card :article="article" @on-click="fnToArticleDetail"></article-card></tm-translate>
</block>
<view class="load-text">{{ loadMoreText }}</view>
</block>
<view class="app-page">
<view v-if="loading != 'success'" class="loading-wrap">
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
</view>
<block v-else>
<view class="empty" v-if="dataList.length == 0">
<tm-empty icon="icon-shiliangzhinengduixiang-"
label="该分类下暂无文章"></tm-empty>
</view>
<block v-else>
<block v-for="(article, index) in dataList" :key="article.createTime">
<!-- 文章卡片 -->
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)">
<article-card :article="article"
@on-click="fnToArticleDetail"></article-card>
</tm-translate>
</block>
<view class="load-text">{{ loadMoreText }}</view>
</block>
<tm-flotbutton @click="fnToTopPage" color="light-blue" size="m" icon="icon-angle-up"></tm-flotbutton>
</block>
</view>
<tm-flotbutton @click="fnToTopPage" color="light-blue" size="m" icon="icon-angle-up"></tm-flotbutton>
</block>
</view>
</template>
<script>
@@ -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 tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
import ArticleCard from '@/components/article-card/article-card.vue';
export default {
components: {
tmSkeleton,
tmTranslate,
tmFlotbutton,
tmEmpty,
ArticleCard
},
data() {
return {
loading: 'loading',
queryParams: {
size: 10,
page: 0
},
slug: '',
pageTitle: '加载中...',
result: null,
dataList: [],
isLoadMore: false,
loadMoreText: ''
};
},
onLoad(e) {
this.slug = e.slug;
this.pageTitle = e.name;
this.fnGetData();
},
onPullDownRefresh() {
this.isLoadMore = false;
this.queryParams.page = 0;
this.fnGetData();
},
onReachBottom(e) {
if (this.result.hasNext) {
this.queryParams.page += 1;
this.isLoadMore = true;
this.fnGetData();
} else {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
},
methods: {
fnGetData() {
uni.showLoading({
mask: true,
title: '加载中...'
});
//
if (!this.isLoadMore) {
this.loading = 'loading';
}
this.loadMoreText = '加载中...';
this.$httpApi
.getCategoryPostList(this.slug, this.queryParams)
.then(res => {
this.fnSetPageTitle(this.pageTitle + ` (共${res.data.total}篇)`);
this.result = res.data;
if (this.isLoadMore) {
this.dataList = this.dataList.concat(res.data.content);
} else {
this.dataList = res.data.content;
}
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
setTimeout(() => {
this.loading = 'success';
}, 500);
})
.catch(err => {
console.error(err);
this.loading = 'error';
this.loadMoreText = '加载失败,请下拉刷新!';
})
.finally(() => {
setTimeout(() => {
uni.hideLoading();
uni.stopPullDownRefresh();
}, 500);
});
},
//
fnToArticleDetail(article) {
uni.navigateTo({
url: '/pagesA/article-detail/article-detail?articleId=' + article.id,
animationType: 'slide-in-right'
});
}
}
export default {
components: {
tmSkeleton,
tmTranslate,
tmFlotbutton,
tmEmpty,
ArticleCard
},
data() {
return {
loading: 'loading',
queryParams: {
size: 10,
page: 0
},
name: '',
pageTitle: '加载中...',
hasNext: false,
dataList: [],
isLoadMore: false,
loadMoreText: ''
};
},
onLoad(e) {
this.name = e.name;
this.pageTitle = e.title;
this.fnGetData();
},
onPullDownRefresh() {
this.isLoadMore = false;
this.queryParams.page = 0;
this.fnGetData();
},
onShareAppMessage() {
return {
title: this.pageTitle,
path: `/pagesA/category-detail/category-detail?name=${this.name}&title=${this.pageTitle}`
}
},
onShareTimeline() {
return {
title: this.pageTitle,
path: `/pagesA/category-detail/category-detail?name=${this.name}&title=${this.pageTitle}`
}
},
onReachBottom(e) {
if (this.hasNext) {
this.queryParams.page += 1;
this.isLoadMore = true;
this.fnGetData();
} else {
uni.showToast({
icon: 'none',
title: '没有更多数据了'
});
}
},
methods: {
fnGetData() {
// uni.showLoading({
// mask: true,
// title: '...'
// });
//
if (!this.isLoadMore) {
this.loading = 'loading';
}
this.loadMoreText = '加载中...';
this.$httpApi.v2
.getCategoryPostList(this.name, this.queryParams)
.then(res => {
console.log("请求成功:", res)
this.fnSetPageTitle(`${this.pageTitle} (共${res.total}篇)`);
this.hasNext = res.hasNext;
if (this.isLoadMore) {
this.dataList = this.dataList.concat(res.items);
} else {
this.dataList = res.items;
}
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
setTimeout(() => {
this.loading = 'success';
}, 500);
})
.catch(err => {
console.error(err);
this.loading = 'error';
this.loadMoreText = '加载失败,请下拉刷新!';
})
.finally(() => {
setTimeout(() => {
uni.hideLoading();
uni.stopPullDownRefresh();
}, 500);
});
},
//
fnToArticleDetail(article) {
uni.navigateTo({
url: '/pagesA/article-detail/article-detail?name=' + article.metadata.name,
animationType: 'slide-in-right'
});
}
}
};
</script>
<style lang="scss">
.app-page {
width: 100vw;
min-height: 100vh;
display: flex;
flex-direction: column;
padding: 24rpx 0;
background-color: #fafafd;
width: 100vw;
min-height: 100vh;
display: flex;
flex-direction: column;
padding: 24rpx 0;
background-color: #fafafd;
}
.loading-wrap {
padding: 0 24rpx;
min-height: 100vh;
padding: 0 24rpx;
min-height: 100vh;
}
.empty {
height: 60vh;
display: flex;
align-items: center;
justify-content: center;
height: 60vh;
display: flex;
align-items: center;
justify-content: center;
}
</style>
-163
View File
@@ -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().user.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
View File
@@ -1,252 +1,279 @@
<template>
<view class="app-page flex flex-col felx-center bg-white">
<!-- 信息 -->
<view class="profile flex flex-col flex-center pa-36">
<view class="avatar"><image class="avatar-img" :src="bloggerInfo.avatar" mode="aspectFill"></image></view>
<view class="nickname mt-24 text-weight-b text-size-g">{{ bloggerInfo.nickname }}</view>
<view class="desc mt-24 text-size-m text-grey-darken-3">{{ bloggerInfo.description || '这个博主很懒,竟然没写介绍~' }}</view>
<!-- 联系图标 -->
<view class="mt-24 contact-icons">
<!-- 放全部似乎显得有点拥挤 -->
<!-- <block v-for="(item, index) in result" :key="index"><text v-if="item.value" class="halocoloricon" :class="[item.icon, { 'ml-12': index != 0 }]"></text></block> -->
<!-- 考虑放几个常用的就行 -->
<text class="halocoloricon halocoloricon-qq"></text>
<text class="ml-12 halocoloricon halocoloricon-wechat"></text>
<text class="ml-12 halocoloricon halocoloricon-GitHub"></text>
<text class="ml-12 halocoloricon halocoloricon-gitee"></text>
<text class="ml-12 halocoloricon halocoloricon-ic_email_round"></text>
</view>
<view v-if="false" class="mt-24 ">
<tm-button theme="bg-gradient-light-blue-accent" size="m" openType="contact">在线客服联系</tm-button>
<tm-button theme="bg-gradient-orange-accent" size="m" @click="fnOnToWeb">访问PC端博客</tm-button>
</view>
</view>
<!-- 社交联系方式列表 -->
<view class="contact ma-50 mt-0 pt-12">
<block v-for="(item, index) in result" :key="index">
<view v-if="item.value" class="item mt-24 flex" @click="fnOnClick(item)">
<view class="left">
<text class="icon halocoloricon" :class="[item.icon]"></text>
<text class="name">{{ item.name }}</text>
</view>
<view class="right flex-1">{{ item.value }}</view>
</view>
</block>
</view>
</view>
<view class="app-page flex flex-col felx-center bg-white">
<!-- 信息 -->
<view class="profile flex flex-col flex-center pa-36">
<view class="avatar">
<image class="avatar-img" :src="bloggerInfo.avatar" mode="aspectFill"></image>
</view>
<view class="nickname mt-24 text-weight-b text-size-g">{{ bloggerInfo.nickname }}</view>
<view class="desc mt-24 text-size-m text-grey-darken-3">
{{ bloggerInfo.description || '这个博主很懒,竟然没写介绍~' }}
</view>
<!-- 联系图标 -->
<view class="mt-24 contact-icons">
<!-- 放全部似乎显得有点拥挤 -->
<!-- <block v-for="(item, index) in result" :key="index"><text v-if="item.value" class="halocoloricon" :class="[item.icon, { 'ml-12': index != 0 }]"></text></block> -->
<!-- 考虑放几个常用的就行 -->
<text class="halocoloricon halocoloricon-qq"></text>
<!-- #ifndef MP-QQ -->
<text class="ml-12 halocoloricon halocoloricon-wechat"></text>
<!-- #endif -->
<text class="ml-12 halocoloricon halocoloricon-GitHub"></text>
<text class="ml-12 halocoloricon halocoloricon-gitee"></text>
<text class="ml-12 halocoloricon halocoloricon-ic_email_round"></text>
</view>
</view>
<!-- 社交联系方式列表 -->
<view class="contact ma-50 mt-0 pt-12">
<block v-if="calcIsNotEmpty">
<block v-for="(item, index) in result" :key="index">
<view v-if="item.value" class="item mt-24 flex" @click="fnOnClick(item)">
<view class="left">
<text class="icon halocoloricon" :class="[item.icon]"></text>
<text class="name">{{ item.name }}</text>
</view>
<view class="right flex-1">{{ item.value }}</view>
</view>
</block>
</block>
<view v-else class="mt-12 pt-12">
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无联系方式"/>
</view>
</view>
</view>
</template>
<script>
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
export default {
components: {
tmSkeleton,
tmButton
},
data() {
return {
loading: 'loading',
queryParams: {
size: 10,
page: 0
},
result: [
{
key: 'qq',
icon: 'halocoloricon-qq',
name: '企鹅号',
value: ''
},
{
key: 'wechat',
icon: 'halocoloricon-wechat',
name: '微信号',
value: ''
},
{
key: 'github',
icon: 'halocoloricon-GitHub',
name: 'Github',
value: ''
},
{
key: 'gitee',
icon: 'halocoloricon-gitee',
name: 'Gitee',
value: ''
},
{
key: 'bilibili',
icon: 'halocoloricon-bilibili',
name: 'Bilibili',
value: ''
},
{
key: 'csdn',
icon: 'halocoloricon-csdn1',
name: 'CSDN',
value: ''
},
{
key: 'blog',
icon: 'halocoloricon-url-monitor',
name: '博客地址',
value: ''
},
{
key: 'juejin',
icon: 'halocoloricon-juejin',
name: '掘金地址',
value: ''
},
components: {
tmSkeleton,
tmButton,
tmEmpty
},
data() {
return {
loading: 'loading',
queryParams: {
size: 10,
page: 0
},
result: [
{
key: 'qq',
icon: 'halocoloricon-qq',
name: '企鹅号',
value: ''
},
{
key: 'wechat',
icon: 'halocoloricon-wechat',
name: '微信号',
value: ''
},
{
key: 'github',
icon: 'halocoloricon-GitHub',
name: 'Github',
value: ''
},
{
key: 'gitee',
icon: 'halocoloricon-gitee',
name: 'Gitee',
value: ''
},
{
key: 'bilibili',
icon: 'halocoloricon-bilibili',
name: 'Bilibili',
value: ''
},
{
key: 'csdn',
icon: 'halocoloricon-csdn1',
name: 'CSDN',
value: ''
},
{
key: 'blog',
icon: 'halocoloricon-url-monitor',
name: '博客地址',
value: ''
},
{
key: 'juejin',
icon: 'halocoloricon-juejin',
name: '掘金地址',
value: ''
},
{
key: 'weibo',
icon: 'halocoloricon-social-weibo',
name: '微博地址',
value: ''
},
{
key: 'email',
icon: 'halocoloricon-ic_email_round',
name: '邮箱地址',
value: ''
}
]
};
},
computed: {
//
bloggerInfo() {
let blogger = this.$tm.vx.getters().blogger.getBlogger;
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
return blogger;
}
},
onLoad() {
this.fnSetPageTitle('联系博主');
},
created() {
this.fnGetData();
},
methods: {
fnGetData() {
for (let key in this.$haloConfig.social) {
this.result.find(x => x.key == key).value = this.$haloConfig.social[key];
}
},
fnOnToWeb() {
uni.navigateTo({
url:
'/pagesC/website/website?data=' +
JSON.stringify({
title: this.$haloConfig.title,
url: this.$haloConfig.social.blog
})
});
},
fnOnClick(item) {
if (this.globalAppSettings.contact.isLinkCopy && this.$utils.checkIsUrl(item.value)) {
uni.navigateTo({
url:
'/pagesC/website/website?data=' +
JSON.stringify({
title: item.name,
url: item.value
})
});
} else {
this.$utils.copyText(item.value, item.name + ' 已复制!');
}
}
}
{
key: 'weibo',
icon: 'halocoloricon-social-weibo',
name: '微博地址',
value: ''
},
{
key: 'email',
icon: 'halocoloricon-ic_email_round',
name: '邮箱地址',
value: ''
}
]
};
},
computed: {
authorConfig() {
return this.$tm.vx.getters().getConfigs.authorConfig;
},
bloggerInfo() {
let blogger = this.authorConfig.blogger;
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
return blogger;
},
socialConfig() {
return this.authorConfig.social;
},
calcIsNotEmpty() {
return this.result.some((item) => item.value !== "");
}
},
watch: {
socialConfig: {
handler(newVal) {
if (!newVal) return;
this.fnGetData();
},
deep: true,
immediate: true
}
},
onLoad() {
this.fnSetPageTitle('联系博主');
},
methods: {
fnGetData() {
for (let key in this.socialConfig) {
if (key === 'enabled') {
continue;
}
this.result.find(x => x.key === key).value = this.socialConfig[key];
}
},
fnOnClick(item) {
this.$utils.copyText(item.value, item.name + ' 已复制!');
// if (this.globalAppSettings.contact.isLinkCopy && this.$utils.checkIsUrl(item.value)) {
// uni.navigateTo({
// url: '/pagesC/website/website?data=' +
// JSON.stringify({
// title: item.name,
// url: item.value
// })
// });
// } else {
// this.$utils.copyText(item.value, item.name + ' ');
// }
}
}
};
</script>
<style lang="scss" scoped>
.app-page {
width: 100vw;
min-height: 100vh;
box-sizing: border-box;
padding-top: 160rpx;
width: 100vw;
min-height: 100vh;
box-sizing: border-box;
padding-top: 160rpx;
}
.profile {
.avatar {
width: 170rpx;
height: 170rpx;
position: relative;
box-sizing: border-box;
border-radius: 50%;
border: 6rpx solid #fff;
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.07);
overflow: hidden;
&-img {
width: 100%;
height: 100%;
}
}
.nickname {
font-size: 38rpx;
}
}
.contact-icons {
.halocoloricon {
font-size: 42rpx;
}
}
.contact {
box-sizing: border-box;
border-top: 2rpx solid #f2f2f2;
.item {
box-sizing: border-box;
border-radius: 12rpx;
background-color: #fafafa;
// background-color: rgba(0, 0, 0, 0.05);
// padding-bottom: 12rpx;
// border-bottom: 2rpx solid #eee;
padding: 16rpx;
.left {
position: relative;
width: 140rpx;
display: flex;
align-items: center;
box-sizing: border-box;
// background-color: rgba(0, 0, 0, 0.03);
border-radius: 12rpx 0 0 12rpx;
&::after {
display: none;
content: ':';
position: absolute;
right: 18rpx;
top: 50%;
transform: translateY(-50%);
font-size: 24rpx;
color: #666;
}
.icon {
font-size: 24rpx;
}
.name {
margin-left: 10rpx;
color: #555;
font-size: 24rpx;
}
}
.right {
width: 0;
display: flex;
align-items: center;
flex-wrap: wrap;
box-sizing: border-box;
word-wrap: break-word;
word-break: break-all;
font-size: 24rpx;
box-sizing: border-box;
padding-left: 12rpx;
}
}
.profile {
.avatar {
width: 170rpx;
height: 170rpx;
position: relative;
box-sizing: border-box;
border-radius: 50%;
border: 6rpx solid #fff;
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.07);
overflow: hidden;
&-img {
width: 100%;
height: 100%;
}
}
.nickname {
font-size: 38rpx;
}
}
.contact-icons {
.halocoloricon {
font-size: 42rpx;
}
}
.contact {
box-sizing: border-box;
border-top: 2rpx solid #f2f2f2;
.item {
box-sizing: border-box;
border-radius: 12rpx;
background-color: #fafafa;
// background-color: rgba(0, 0, 0, 0.05);
// padding-bottom: 12rpx;
// border-bottom: 2rpx solid #eee;
padding: 16rpx;
.left {
position: relative;
width: 140rpx;
display: flex;
align-items: center;
box-sizing: border-box;
// background-color: rgba(0, 0, 0, 0.03);
border-radius: 12rpx 0 0 12rpx;
&::after {
display: none;
content: ':';
position: absolute;
right: 18rpx;
top: 50%;
transform: translateY(-50%);
font-size: 24rpx;
color: #666;
}
.icon {
font-size: 24rpx;
}
.name {
margin-left: 10rpx;
color: #555;
font-size: 24rpx;
}
}
.right {
width: 0;
display: flex;
align-items: center;
flex-wrap: wrap;
box-sizing: border-box;
word-wrap: break-word;
word-break: break-all;
font-size: 24rpx;
box-sizing: border-box;
padding-left: 12rpx;
}
}
}
</style>
+549
View File
@@ -0,0 +1,549 @@
<template>
<view class="app-page flex flex-col pa-24" :class="[uniHaloPluginPageClass]">
<PluginUnavailable v-if="!uniHaloPluginAvailable" :pluginId="uniHaloPluginId" :error-text="uniHaloPluginAvailableError" />
<template v-else>
<!-- 加载区域 -->
<view v-if="loading == 'loading'" class="loading-wrap pa-24">
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
<tm-skeleton model="listAvatr"></tm-skeleton>
</view>
<view v-else-if="loading == 'error'" class="content-empty flex flex-center">
<tm-empty icon="icon-wind-cry" label="加载异常"></tm-empty>
</view>
<!-- 内容区域 -->
<view v-else class="content flex flex-col uh-gap-y-12">
<!-- 标签统计 -->
<view class="card bg-white pa-24 round-4">
<view class="card-head flex items-center justify-between">
<view class="card-head_title flex items-end uh-gap-x-4">
<text class="card-head_text">标签统计</text>
<text class="card-head_subtext">(全部标签的文章数量占比)</text>
</view>
<view @click="tagChart.isExpand = !tagChart.isExpand">
<tm-icons v-if="tagChart.isExpand" :size="24" name="icon-angle-down" color="gray"></tm-icons>
<tm-icons v-else :size="24" name="icon-angle-up" color="gray"></tm-icons>
</view>
</view>
<view v-show="tagChart.isExpand" class="card-body flex">
<view class="chart-box">
<qiun-data-charts :type="tagChart.type" :opts="tagChart.opts" :chartData="tagChart.data" :tooltipFormat="tagChart.tooltipFormat" />
</view>
</view>
</view>
<!-- 分类统计 -->
<view class="card bg-white pa-24 round-4">
<view class="card-head flex items-center justify-between">
<view class="card-head_title flex items-end uh-gap-x-4">
<text class="card-head_text">分类统计</text>
<text class="card-head_subtext">(全部分类的文章数量占比)</text>
</view>
<view @click="categoryChart.isExpand = !categoryChart.isExpand">
<tm-icons v-if="categoryChart.isExpand" :size="24" name="icon-angle-down" color="gray"></tm-icons>
<tm-icons v-else :size="24" name="icon-angle-up" color="gray"></tm-icons>
</view>
</view>
<view v-show="categoryChart.isExpand" class="card-body flex">
<view class="chart-box">
<qiun-data-charts
:canvasId="categoryChart.id"
:canvas2d="true"
:ontouch="true"
:type="categoryChart.type"
:opts="categoryChart.opts"
:chartData="categoryChart.data"
:tooltipFormat="categoryChart.tooltipFormat"
/>
</view>
</view>
</view>
<!-- 文章发布趋势 -->
<view class="card bg-white pa-24 round-4">
<view class="card-head flex items-center justify-between">
<view class="card-head_title flex items-end uh-gap-x-4">
<text class="card-head_text">文章发布趋势</text>
<text class="card-head_subtext">(按日期统计文章发布数量)</text>
</view>
<view @click="trandArticleChart.isExpand = !trandArticleChart.isExpand">
<tm-icons v-if="trandArticleChart.isExpand" :size="24" name="icon-angle-down" color="gray"></tm-icons>
<tm-icons v-else :size="24" name="icon-angle-up" color="gray"></tm-icons>
</view>
</view>
<view v-show="trandArticleChart.isExpand" class="card-body flex">
<heatmap style="width: 100%" :chartData="trandArticleChart.data"></heatmap>
</view>
</view>
<!-- 评论活跃用户 -->
<view class="card bg-white pa-24 round-4">
<view class="card-head flex items-center justify-between">
<view class="card-head_title flex items-end uh-gap-x-4">
<text class="card-head_text">评论活跃用户</text>
<text class="card-head_subtext">(按评论作者统计评论数量)</text>
</view>
<view @click="userCommentsChart.isExpand = !userCommentsChart.isExpand">
<tm-icons v-if="userCommentsChart.isExpand" :size="24" name="icon-angle-down" color="gray"></tm-icons>
<tm-icons v-else :size="24" name="icon-angle-up" color="gray"></tm-icons>
</view>
</view>
<view v-show="userCommentsChart.isExpand" class="card-body flex">
<view class="chart-box">
<qiun-data-charts
:canvasId="userCommentsChart.id"
:canvas2d="true"
:ontouch="true"
:type="userCommentsChart.type"
:opts="userCommentsChart.opts"
:chartData="userCommentsChart.data"
:tooltipFormat="userCommentsChart.tooltipFormat"
/>
</view>
</view>
</view>
<!-- 热门文章 Top10 -->
<view class="card bg-white pa-24 round-4">
<view class="card-head flex items-center justify-between">
<view class="card-head_title flex items-end uh-gap-x-4">
<text class="card-head_text">热门文章前10</text>
<text class="card-head_subtext">(按访问量排序的热门文章)</text>
</view>
<view @click="top10ArticlesChart.isExpand = !top10ArticlesChart.isExpand">
<tm-icons v-if="top10ArticlesChart.isExpand" :size="24" name="icon-angle-down" color="gray"></tm-icons>
<tm-icons v-else :size="24" name="icon-angle-up" color="gray"></tm-icons>
</view>
</view>
<view class="card-body flex">
<view class="chart-box">
<qiun-data-charts
:canvasId="top10ArticlesChart.id"
:canvas2d="true"
:ontouch="true"
:type="top10ArticlesChart.type"
:opts="top10ArticlesChart.opts"
:chartData="top10ArticlesChart.data"
:tooltipFormat="top10ArticlesChart.tooltipFormat"
/>
</view>
</view>
</view>
</view>
</template>
</view>
</template>
<script>
import dataStatisticsApi from '@/api/v2/plugin.data-statistics.js';
import { NeedPluginIds, NeedPlugins, checkNeedPluginAvailable } from '@/utils/plugin.js';
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
import tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
import pluginAvailableMixin from '@/common/mixins/pluginAvailable.js';
import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue';
import heatmap from '@/components/heatmap/heatmap.vue';
export default {
mixins: [pluginAvailableMixin],
name: 'DataVisual',
components: {
tmSkeleton,
tmTranslate,
tmEmpty,
tmButton,
tmIcons,
heatmap,
PluginUnavailable
},
data() {
return {
loading: 'loading',
statistics: null,
tagChart: {
id: 'tagChart',
isExpand: true,
type: 'ring',
data: {},
tooltipFormat: 'tooltipTag',
opts: {
rotate: false,
rotateLock: false,
color: ['#3B82F6', '#10B981', '#F59E0B', '#EF4444', '#8B5CF6', '#EC4899', '#14B8A6', '#F97316', '#ea7ccc', '#0EA5E9'],
padding: [5, 5, 5, 5],
dataLabel: false,
legend: {
show: false,
position: 'right',
lineHeight: 18,
fontSize: 12
},
title: {
name: '',
fontSize: 16,
color: '#666666'
},
subtitle: {
name: '',
fontSize: 12,
color: '#eee'
},
extra: {
ring: {
ringWidth: 36,
activeOpacity: 0.5,
activeRadius: 10,
offsetAngle: -90,
labelWidth: 15,
border: true,
borderWidth: 1,
borderColor: '#FFFFFF'
},
tooltip: {
legendShape: 'circle',
fontSize: 11
}
}
}
},
categoryChart: {
id: 'categoryChart',
isExpand: true,
type: 'line',
data: {},
tooltipFormat: 'tooltipCategory',
opts: {
color: ['#3B82F6', '#10B981', '#F59E0B', '#EF4444', '#8B5CF6', '#EC4899', '#14B8A6', '#F97316', '#ea7ccc', '#0EA5E9'],
padding: [20, 15, 10, 15],
touchMoveLimit: 24,
enableScroll: true,
legend: {
show: false
},
xAxis: {
disableGrid: true,
fontSize: 11,
scrollShow: true,
itemCount: 6,
boundaryGap: 'center',
format: 'xAxisCategory'
},
yAxis: {
gridType: 'dash',
dashLength: 4,
data: [
{
fontSize: 11
}
]
},
extra: {
line: {
type: 'curve',
width: 2,
activeType: 'hollow'
},
tooltip: {
legendShape: 'circle',
fontSize: 11
}
}
}
},
trandArticleChart: {
isExpand: true,
type: 'hotmap',
data: [],
opts: {}
},
userCommentsChart: {
id: 'userCommentsChart',
isExpand: true,
loading: true,
type: 'column',
data: {},
tooltipFormat: 'tooltipUserComments',
opts: {
color: ['#EF4444', '#F59E0B', '#14B8A6', '#3B82F6', '#10B981', '#8B5CF6', '#EC4899', '#F97316', '#ea7ccc', '#0EA5E9'],
padding: [20, 15, 10, 10],
touchMoveLimit: 24,
enableScroll: true,
legend: {
show: false
},
xAxis: {
disableGrid: true,
boundaryGap: 'justify',
fontSize: 10,
scrollShow: true,
itemCount: 5,
format: 'xAxisUserComments'
},
yAxis: {
gridType: 'dash',
dashLength: 4,
data: [
{
min: 0,
fontSize: 11
}
]
},
extra: {
column: {
type: 'group',
width: 22,
activeBgColor: '#000000',
activeBgOpacity: 0.08,
linearType: 'custom',
seriesGap: 5,
linearOpacity: 0.7,
barBorderCircle: true,
customColor: ['#F59E0B']
},
tooltip: {
legendShape: 'circle',
fontSize: 11
}
}
}
},
top10ArticlesChart: {
id: 'top10ArticlesChart',
isExpand: true,
type: 'column',
data: {},
tooltipFormat: 'tooltipTop10Articles',
opts: {
color: ['#EF4444', '#F59E0B', '#14B8A6', '#3B82F6', '#10B981', '#8B5CF6', '#EC4899', '#F97316', '#ea7ccc', '#0EA5E9'],
padding: [20, 15, 10, 10],
touchMoveLimit: 24,
enableScroll: true,
legend: {
show: false
},
xAxis: {
disableGrid: true,
boundaryGap: 'justify',
fontSize: 10,
scrollShow: true,
itemCount: 5,
format: 'xAxisTop10Article'
},
yAxis: {
gridType: 'dash',
dashLength: 4,
data: [
{
min: 0,
fontSize: 11
}
]
},
extra: {
column: {
type: 'group',
width: 22,
activeBgColor: '#000000',
activeBgOpacity: 0.08,
linearType: 'custom',
seriesGap: 5,
linearOpacity: 0.7,
barBorderCircle: true,
customColor: ['#F59E0B']
},
tooltip: {
legendShape: 'circle',
fontSize: 11
}
}
}
}
};
},
async onReady() {
//
this.setPluginId(this.NeedPluginIds.PluginDataStatistics);
this.setPluginError('阿偶,检测到当前插件没有安装或者启用,无法使用功能哦,请联系管理员');
if (!(await this.checkPluginAvailable())) return;
this.fnGetData();
},
onPullDownRefresh() {
if (!this.uniHaloPluginAvailable) {
uni.hideLoading();
uni.stopPullDownRefresh();
return;
}
this.fnGetData();
},
methods: {
fnGetData() {
uni.showLoading({
mask: true,
title: '加载中...'
});
//
if (!this.isLoadMore) {
this.loading = 'loading';
}
this.loadMoreText = '加载中...';
dataStatisticsApi
.getChartData()
.then((res) => {
console.log('获取到统计数据:', res);
this.statistics = res;
this.handleTagChart();
this.handleCategoriesChart();
this.handleTrendArticlesChart();
this.handleUserCommentsChart();
this.handleTop10ArticlesChart();
this.loading = 'success';
})
.catch((err) => {
console.error(err);
this.loading = 'error';
this.loadMoreText = '加载失败,请下拉刷新!';
})
.finally(() => {
setTimeout(() => {
uni.hideLoading();
uni.stopPullDownRefresh();
}, 100);
});
},
//
handleTagChart() {
const data = this.statistics.tags.sort((a, b) => b.count - a.count);
this.tagChart.data = {
series: [
{
data: data.map((item) => {
return {
name: item.name,
value: item.count
};
})
}
]
};
},
//
handleCategoriesChart() {
const data = this.statistics.categories.sort((a, b) => b.total - a.total);
const seriesItemData = data.map((item) => item.total);
if (Math.max(...seriesItemData) < 10) {
this.categoryChart.opts.yAxis.data[0].max = 10;
}
this.categoryChart.data = {
categories: data.map((item) => item.name),
series: [
{
name: '分类',
data: seriesItemData
}
]
};
},
//
handleTrendArticlesChart() {
this.trandArticleChart.data = this.statistics.articles;
},
//
handleUserCommentsChart() {
this.userCommentsChart.loading = true;
const data = this.statistics.comments.sort((a, b) => b.count - a.count).slice(0, 10);
const seriesItemData = data.map((item) => item.count);
if (Math.max(...seriesItemData) < 10) {
this.userCommentsChart.opts.yAxis.data[0].max = 10;
}
this.userCommentsChart.data = {
categories: data.map((item) => item.username),
series: [
{
name: '评论',
data: seriesItemData
}
]
};
this.userCommentsChart.loading = false;
},
// TOP10
handleTop10ArticlesChart() {
const data = this.statistics.top10Articles.sort((a, b) => b.views - a.views).slice(0, 10);
const seriesItemData = data.map((item) => item.views);
if (Math.max(...seriesItemData) < 10) {
this.top10ArticlesChart.opts.yAxis.data[0].max = 10;
}
this.top10ArticlesChart.data = {
categories: data.map((item) => item.name),
series: [
{
name: '评论',
data: seriesItemData
}
]
};
}
}
};
</script>
<style lang="scss" scoped>
.app-page {
box-sizing: border-box;
width: 100vw;
min-height: 100vh;
color: #353437;
}
.card {
box-sizing: border-box;
background-color: rgba(255, 255, 255, 0.95);
box-shadow: 0 0 12rpx rgba(226, 232, 240, 0.35);
backdrop-filter: blur(6rpx);
// border: 2rpx solid #e8edf4;
}
.card-head {
font-size: 32rpx;
font-weight: bold;
&_title {
}
&_text {
box-sizing: border-box;
position: relative;
padding-left: 24rpx;
font-size: 30rpx;
&:before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 8rpx;
height: 70%;
background-color: #03a9f4;
border-radius: 12rpx;
}
}
&_subtext {
font-size: 26rpx;
font-weight: normal;
color: #6b7280;
}
}
.card-body {
box-sizing: border-box;
margin-top: 24rpx;
width: 100%;
overflow: hidden;
background-color: #fcfdfe;
border: 2rpx solid #e9eef3;
border-radius: 12rpx;
}
.chart-box {
width: 100%;
height: 320rpx;
}
</style>
+47 -30
View File
@@ -1,42 +1,59 @@
<template>
<view class="app-page bg-white round-3 pa-46">
<view class="text-weight-b text-size-lg text-align-center"> 本博客免责声明 </view>
<view v-if="false" class="text-size-s text-align-center mt-12 text-grey-darken-1"> 博主{{ bloggerInfo.nickname }} </view>
<view class="mt-32">1本博客属于个人非赢利性质的网站所有转载的文章都以遵循原作者的版权声明注明了文章来源</view>
<view class="mt-24">2如果原文没有版权声明按照目前互联网开放的原则本博客将在不通知作者的情况下转载文章</view>
<view class="mt-24">3如果原文明确注明禁止转载本博客将不会转载</view>
<view class="mt-24">
4如果本博客转载的文章不符合作者的版权声明或者作者不想让本博客转载您的文章请邮件告知
<text class="text-bg-gradient-light-blue-accent ml-12 mr-12 " @click="$utils.copyText(bloggerInfo.email, '邮箱复制成功!')">
<text class="iconfont icon-mail-fill text-size-m mr-6"></text>
{{ bloggerInfo.email }}
</text>
博主将会在第一时间删除相关信息
</view>
<view class="mt-24">5本博客转载文章仅为留作备份和知识点分享的目的</view>
<view class="mt-24">6本博客将尽力确保所提供信息的准确性及可靠性但不保证信息的正确性和完整性且不对因信息的不正确或遗漏导致的任何损失或损害承担相关责任</view>
<view class="mt-24">
7本博客所发布转载的文章其版权均归原作者所有如其他自媒体网站或个人从本博客下载使用请在转载有关文章时务必尊重该文章的著作权保留本博客注明的原文来源或者自行去原文处复制版权声明并自负版权等法律责任
</view>
<view class="mt-24">8本博客的所有原创文章皆可以任意转载但转载时务必请注明出处</view>
<view class="mt-24">9尊重原创知识共享</view>
</view>
<view class="app-page bg-white round-3 pa-46">
<!-- 通过配置 -->
<view v-if="disclaimersContent" style="min-height: 100%;" v-html="disclaimersContent"></view>
<!-- 静态写法 -->
<block v-else>
<view class="text-weight-b text-size-lg text-align-center"> 本博客免责声明 </view>
<view v-if="false" class="text-size-s text-align-center mt-12 text-grey-darken-1"> 博主{{ bloggerInfo.nickname }} </view>
<view class="mt-32">1本博客属于个人非盈利性质的网站所有转载的文章都以遵循原作者的版权声明注明了文章来源</view>
<view class="mt-24">2如果原文没有版权声明按照目前互联网开放的原则本博客将在不通知作者的情况下转载文章</view>
<view class="mt-24">3如果原文明确注明禁止转载本博客将不会转载</view>
<view class="mt-24">
4如果本博客转载的文章不符合作者的版权声明或者作者不想让本博客转载您的文章请邮件告知
<text class="text-bg-gradient-light-blue-accent ml-12 mr-12 " @click="$utils.copyText(bloggerInfo.email, '电子邮箱已复制到剪贴板!')">
<text class="iconfont icon-mail-fill text-size-m mr-6"></text>
{{ bloggerInfo.email }}
</text>
博主将会在第一时间删除相关信息
</view>
<view class="mt-24">5本博客转载文章仅为留作备份和知识点分享的目的</view>
<view class="mt-24">
6本博客将尽力确保所提供信息的准确性及可靠性但不保证信息的正确性和完整性且不对因信息的不正确或遗漏导致的任何损失或损害承担相关责任
</view>
<view class="mt-24">
7本博客所发布转载的文章其版权均归原作者所有如其他自媒体网站或个人从本博客下载使用请在转载有关文章时务必尊重该文章的著作权保留本博客注明的原文来源或者自行去原文处复制版权声明并自负版权等法律责任
</view>
<view class="mt-24">8本博客的所有原创文章皆可以任意转载但转载时务必请注明出处</view>
<view class="mt-24">9尊重原创知识共享</view>
</block>
</view>
</template>
<script>
export default {
computed: {
bloggerInfo() {
return this.$tm.vx.getters().blogger.getBlogger;
}
}
computed: {
haloConfigs() {
return this.$tm.vx.getters().getConfigs
},
disclaimersContent() {
const basicConfig = this.haloConfigs.basicConfig;
return basicConfig?.disclaimers.content
},
bloggerInfo() {
const blogger = this.haloConfigs.authorConfig.blogger;
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar)
return blogger;
},
}
};
</script>
<style scoped lang="scss">
.app-page {
line-height: 1.65;
font-size: 30rpx;
color: var(--main-text-color);
line-height: 1.65;
font-size: 30rpx;
color: var(--main-text-color);
}
</style>
+457
View File
@@ -0,0 +1,457 @@
<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 => {
console.log("友情链接分组数据:", res);
this.linkGroupList = res;
this.fnGetData()
})
.catch(err => {
console.error(err);
this.loading = 'error';
this.loadMoreText = 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>
-133
View File
@@ -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>
-270
View File
@@ -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>
+383
View File
@@ -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>

Some files were not shown because too many files have changed in this diff Show More