From c9e229a5cd67230e69f5fd89c848c102e238bd9f Mon Sep 17 00:00:00 2001 From: "DESKTOP-RQ919RC\\Pc" <1300399510@qq.com> Date: Wed, 19 Nov 2025 19:27:43 +0800 Subject: [PATCH] =?UTF-8?q?fix(bi):=20=E6=B7=BB=E5=8A=A0=E6=8A=95=E5=B8=81?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E5=BF=85=E9=A1=BB=E5=A4=A7=E4=BA=8E0?= =?UTF-8?q?=E7=9A=84=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat(item-bottom): 实现二维码弹窗自适应右侧边界 添加判断逻辑使二维码弹窗在靠近右侧边界时向左弹出 refactor(public.js): 优化ajax请求配置和登录跳转逻辑 统一设置axios默认配置,提取登录跳转函数 style(public.css): 调整QRcode-box.right的定位 修复二维码弹窗靠近右侧时的显示问题 fix(details.js): 修复粗体标记正则匹配多行内容 使用[\s\S]*?匹配可能的多行内容 refactor(index.js): 优化列表加载和滚动逻辑 移除模拟数据,添加加载状态,调整滚动加载阈值 chore: 更新html模板中的唯一标识和广告类名 --- component/bi/bi.js | 4 + component/item-bottom/item-bottom.js | 25 +++- component/item-bottom/item-bottom.txt | 4 +- component/latest-list/latest-list.js | 2 +- css/public.css | 4 +- css/public.less | 5 +- details.html | 2 +- index.html | 4 +- js/details.js | 27 +--- js/edit.js | 67 ++++++---- js/index.js | 106 +++++---------- js/public.js | 178 ++++++++++++++------------ 12 files changed, 211 insertions(+), 217 deletions(-) diff --git a/component/bi/bi.js b/component/bi/bi.js index 1e692fe..0701493 100644 --- a/component/bi/bi.js +++ b/component/bi/bi.js @@ -139,6 +139,10 @@ class BiCard extends HTMLElement { coinSubmit() { const num = Number(this.input.value || this.defaultcoinnum) || 0; + if (num <= 0) { + creationAlertBox("error", "投币数量必须大于0"); + return; + } this.fetchData(`https://api.gter.net/v2/api/forum/postTopicCoin`, { token: this.token, num, diff --git a/component/item-bottom/item-bottom.js b/component/item-bottom/item-bottom.js index afe7bdc..50476e2 100644 --- a/component/item-bottom/item-bottom.js +++ b/component/item-bottom/item-bottom.js @@ -114,17 +114,36 @@ export const itemBottom = defineComponent({ }); }; + let isright = ref(false); + const share = () => { const token = item.value.token || ""; - ajax(`/v2/api/forum/postTopicShare`, {token}); + ajax(`/v2/api/forum/postTopicShare`, { token }); + + if (!shareBoxRef.value) return + + // 1. 获取元素相对于可视窗口的位置信息 + const rect = shareBoxRef.value.getBoundingClientRect(); + + // 2. 获取可视窗口宽度(不包含滚动条,更准确) + const clientWidth = document.documentElement.clientWidth; + + // 3. 计算距离:可视窗口宽度 - 元素右边缘到左边缘的距离 + const distance = clientWidth - rect.right; + console.log('distance', distance); + + if (distance < 140) isright.value = true; + else isright.value = false; }; - return { share, QRcode, showQRcode, copyLinkClick, collectClick, item, likeClick, isLogin, isLikeGif }; + const shareBoxRef = ref(null); + + return { isright, shareBoxRef, share, QRcode, showQRcode, copyLinkClick, collectClick, item, likeClick, isLogin, isLikeGif }; }, components: { like, }, - template: `
{{ item?.commentreviews?.content || "[图]" }}
{{ item.likes || "赞" }}
{{ item.collections || "收藏" }}
{{ item.comments || "讨论" }}
{{ item.coins || "投币" }}
{{ item.shares || '转发'}}
`, + template: `
{{ item?.commentreviews?.content || "[图]" }}
{{ item.likes || "赞" }}
{{ item.collections || "收藏" }}
{{ item.comments || "讨论" }}
{{ item.coins || "投币" }}
{{ item.shares || '转发'}}
`, }); diff --git a/component/item-bottom/item-bottom.txt b/component/item-bottom/item-bottom.txt index 08b5cb2..0f7cd53 100644 --- a/component/item-bottom/item-bottom.txt +++ b/component/item-bottom/item-bottom.txt @@ -35,7 +35,7 @@
{{ item.shares || '转发'}}
-
+