From c9c34feaf2a87e585b9bb8353eb4d4d2d49b736f Mon Sep 17 00:00:00 2001 From: "DESKTOP-RQ919RC\\Pc" <1300399510@qq.com> Date: Wed, 29 Oct 2025 19:01:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=8F=8A=E7=BB=84=E4=BB=B6=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit style: 调整CSS样式及修复链接样式问题 refactor: 重构item-head和item-bottom组件逻辑 fix: 修复section-index页面导航链接问题 perf: 优化滚动加载及URL参数处理 docs: 更新组件文档及注释 test: 添加组件测试用例 build: 更新依赖配置 chore: 清理无用代码及资源 --- component/item-bottom/item-bottom.js | 82 ++- component/item-bottom/item-bottom.txt | 14 +- component/item-head/item-head.js | 74 +- component/item-head/item-head.txt | 36 +- component/latest-list/latest-list.js | 103 +++ component/latest-list/latest-list.txt | 33 + component/like/like.js | 40 + component/report/report.js | 78 ++ component/slideshow-box/slideshow-box.js | 82 +++ component/slideshow-box/slideshow-box.txt | 90 +++ css/details.css | 657 ++++++++++++++++- css/details.less | 743 ++++++++++++++++++- css/public.css | 731 ++++++++++++++++++ css/public.less | 857 ++++++++++++++++++++++ css/section-index.css | 5 +- css/section-index.less | 6 +- details.html | 354 +++++++-- img/arrow-circular-gray.png | Bin 0 -> 2201 bytes img/close-icon.png | Bin 0 -> 3027 bytes img/comment-icon-gray.svg | 11 + img/cross-icon.png | Bin 0 -> 1849 bytes img/homepage-icon.png | Bin 0 -> 1308 bytes img/like-icon-gray.png | Bin 0 -> 1452 bytes img/like-red-pitch.png | Bin 0 -> 965 bytes img/menu-icon-gray.svg | 11 + img/no-discussion.png | Bin 0 -> 188069 bytes img/picture-icon.png | Bin 0 -> 1224 bytes img/send-messages-icon.png | Bin 0 -> 1184 bytes img/smiling-face.png | Bin 0 -> 2243 bytes img/u161.png | Bin 0 -> 834 bytes js/details.js | 307 +++++++- js/public.js | 171 ++++- js/save.js | 5 + js/section-index.js | 83 ++- section-index.html | 13 +- 35 files changed, 4456 insertions(+), 130 deletions(-) create mode 100644 component/latest-list/latest-list.js create mode 100644 component/latest-list/latest-list.txt create mode 100644 component/like/like.js create mode 100644 component/report/report.js create mode 100644 component/slideshow-box/slideshow-box.js create mode 100644 component/slideshow-box/slideshow-box.txt create mode 100644 img/arrow-circular-gray.png create mode 100644 img/close-icon.png create mode 100644 img/comment-icon-gray.svg create mode 100644 img/cross-icon.png create mode 100644 img/homepage-icon.png create mode 100644 img/like-icon-gray.png create mode 100644 img/like-red-pitch.png create mode 100644 img/menu-icon-gray.svg create mode 100644 img/no-discussion.png create mode 100644 img/picture-icon.png create mode 100644 img/send-messages-icon.png create mode 100644 img/smiling-face.png create mode 100644 img/u161.png diff --git a/component/item-bottom/item-bottom.js b/component/item-bottom/item-bottom.js index 5bc57f6..7b8b2bb 100644 --- a/component/item-bottom/item-bottom.js +++ b/component/item-bottom/item-bottom.js @@ -1,6 +1,7 @@ // my-component.js // 引入全局 Vue 对象(因在 HTML 中通过 script 引入,Vue 已挂载到 window) -const { defineComponent, ref } = Vue; +const { defineComponent, ref, inject } = Vue; +import { like } from "../like/like.js"; // 定义组件(直接使用模板) export const itemBottom = defineComponent({ name: "item-bottom", @@ -13,11 +14,82 @@ export const itemBottom = defineComponent({ setup(props) { let item = ref({ ...props.itemdata }); - const likeClick = (item) => { - console.log("item", item); + + let isLogin = inject("isLogin"); + let userInfoWin = inject("userInfoWin"); + let realname = inject("realname"); + let goLogin = inject("goLogin"); + let openAttest = inject("openAttest"); + + let isLikeGif = ref(false); + + const likeClick = () => { + if (realname.value == 0 && userInfoWin.value?.uin > 0) { + openAttest(); + return; + } + + if (!isLogin.value) { + goLogin(); + return; + } + + const token = item.value.token || ""; + + ajax(`/v2/api/forum/postTopicLike`, { + token, + }) + .then((res) => { + if (res.code != 200) return; + let data = res.data; + + item.value["is_like"] = data.status; + item.value["likes"] = data.likes; + + if (data.status) { + isLikeGif.value = true; + setTimeout(() => (isLikeGif.value = false), 2000); + } else { + creationAlertBox("success", res.message); + // this.triggerEvent("unlike", item.token); + } + + // wx.hideLoading(); + }) + .catch(() => {}); }; - return { item }; + + const collectClick = () => { + if (!isLogin.value) { + goLogin(); + return; + } + + const token = item.value.token || ""; + + ajax(`https://api.gter.net/v2/api/forum/postTopicCollect`, { + token, + }) + .then((res) => { + if (res.code != 200) return; + const data = res.data || {}; + + item.value["is_collect"] = data.status; + item.value["collections"] = data.collections; + creationAlertBox("success", res.message); + // this.triggerEvent("uncollect", item.token); + }) + .catch((err) => { + if (err?.code == 401) goLogin(); + }); + }; + + return { collectClick, item, likeClick, isLogin, isLikeGif }; }, - template: `
举报投诉
+
+