From 91dab6d4467429a49907513c47f874ed8e14c4bd Mon Sep 17 00:00:00 2001 From: A1300399510 <1300399510@qq.com> Date: Fri, 31 Oct 2025 01:28:16 +0800 Subject: [PATCH] no message --- component/hot-tag/hot-tag.js | 21 ++ component/hot-tag/hot-tag.txt | 10 + component/item-bottom/item-bottom.js | 11 +- component/item-bottom/item-bottom.txt | 14 +- component/item-forum/item-forum.js | 1 - css/public.css | 33 +++ css/public.less | 39 +++ css/search.css | 58 +++++ css/search.less | 73 ++++++ homepage-me.html | 343 ++++++++++++++------------ img/triangle-orange.svg | 6 + img/well-number.svg | 6 + js/homepage-me.js | 112 +++++++-- js/save.js | 2 + js/search.js | 64 ++++- search.html | 64 +++-- 16 files changed, 639 insertions(+), 218 deletions(-) create mode 100644 component/hot-tag/hot-tag.js create mode 100644 component/hot-tag/hot-tag.txt create mode 100644 img/triangle-orange.svg create mode 100644 img/well-number.svg diff --git a/component/hot-tag/hot-tag.js b/component/hot-tag/hot-tag.js new file mode 100644 index 0000000..2a9d26d --- /dev/null +++ b/component/hot-tag/hot-tag.js @@ -0,0 +1,21 @@ +// my-component.js +// 引入全局 Vue 对象(因在 HTML 中通过 script 引入,Vue 已挂载到 window) +const { defineComponent, ref } = Vue; +// 定义组件(直接使用模板) +export const hotTag = defineComponent({ + name: "hot-tag", + props: { + itemdata: { + type: Object, + default: () => {}, + }, + }, + + setup(props) { + return {}; + }, + + components: {}, + + template: `
热门标签
热门标签
`, +}); diff --git a/component/hot-tag/hot-tag.txt b/component/hot-tag/hot-tag.txt new file mode 100644 index 0000000..4b1e9ba --- /dev/null +++ b/component/hot-tag/hot-tag.txt @@ -0,0 +1,10 @@ +
+
+ + 热门标签 +
+
+
热门标签
+
+ +
\ No newline at end of file diff --git a/component/item-bottom/item-bottom.js b/component/item-bottom/item-bottom.js index 6ad174a..3b9674c 100644 --- a/component/item-bottom/item-bottom.js +++ b/component/item-bottom/item-bottom.js @@ -52,6 +52,7 @@ export const itemBottom = defineComponent({ return; } let data = res.data; + creationAlertBox("success", res.message); item.value["is_like"] = data.status; item.value["likes"] = data.likes; @@ -59,11 +60,10 @@ export const itemBottom = defineComponent({ if (data.status) { isLikeGif.value = true; setTimeout(() => (isLikeGif.value = false), 2000); - } else { - creationAlertBox("success", res.message); - // this.triggerEvent("unlike", item.token); } + if (data.status == 0) cancelOperate("like", token); + // wx.hideLoading(); }) .catch(() => {}); @@ -91,8 +91,7 @@ export const itemBottom = defineComponent({ item.value["collections"] = data.collections; creationAlertBox("success", res.message); // 调用父组件的方法 - cancelOperate(token); - // this.triggerEvent("uncollect", item.token); + if (data.status == 0) cancelOperate("collection", token); }) .catch((err) => { if (err?.code == 401) goLogin(); @@ -106,5 +105,5 @@ export const itemBottom = defineComponent({ like, }, - template: `
{{ item?.commentreviews?.content }}
{{ item.likes || "赞" }}
{{ item.collections || "收藏" }}
{{ item.comments || "讨论" }}
{{ item.coins || "投币" }}
转发
`, + template: `
{{ item?.commentreviews?.content || "[图]" }}
{{ item.likes || "赞" }}
{{ item.collections || "收藏" }}
{{ item.comments || "讨论" }}
{{ item.coins || "投币" }}
转发
`, }); diff --git a/component/item-bottom/item-bottom.txt b/component/item-bottom/item-bottom.txt index 64eecaf..4d94b16 100644 --- a/component/item-bottom/item-bottom.txt +++ b/component/item-bottom/item-bottom.txt @@ -1,7 +1,13 @@
-
{{ item?.commentreviews?.content }}
-
+
{{ item?.commentreviews?.content || "[图]" }}
+ +
@@ -20,7 +26,7 @@
{{ item.comments || "讨论" }}
-
+
{{ item.coins || "投币" }}
@@ -31,4 +37,4 @@
- \ No newline at end of file + diff --git a/component/item-forum/item-forum.js b/component/item-forum/item-forum.js index a98ecfe..b697718 100644 --- a/component/item-forum/item-forum.js +++ b/component/item-forum/item-forum.js @@ -16,7 +16,6 @@ export const itemForum = defineComponent({ setup(props) { let res = props.itemdata || {}; - console.log("res", res); res.content = res?.content?.replace(/\[.*?\]/g, ""); res.content = res?.content?.replace(/\<.*?\>/g, ""); res.content = res?.content?.replace(/\[.*?\../g, ""); diff --git a/css/public.css b/css/public.css index 4d71b56..96b2941 100644 --- a/css/public.css +++ b/css/public.css @@ -1394,3 +1394,36 @@ body { .head-top .post-list .post-item:not(:last-child) { margin-right: 10px; } +.hot-tag { + background-color: #ffffff; + border: 1px solid #e9eef2; + border-radius: 10px; + padding: 21px; +} +.hot-tag .hot-tag-title { + font-family: "PingFangSC-Semibold", "PingFang SC Semibold", "PingFang SC", sans-serif; + font-weight: 650; + font-style: normal; + font-size: 16px; + color: #000000; + position: relative; +} +.hot-tag .hot-tag-title .icon { + position: absolute; + top: 50%; + transform: translateY(-50%); + left: -21px; + width: 10px; + height: 18px; +} +.hot-tag .list .item { + line-height: 36px; + color: #333333; + font-size: 14px; + height: 32px; + line-height: 32px; + padding: 0 14px; + background-color: #f6f6f6; + border: #f2f2f2; + border-radius: 16px; +} diff --git a/css/public.less b/css/public.less index f8bd67a..c897915 100644 --- a/css/public.less +++ b/css/public.less @@ -1654,3 +1654,42 @@ body { } } } + +.hot-tag { + background-color: rgba(255, 255, 255, 1); + border: 1px solid rgba(233, 238, 242, 1); + border-radius: 10px; + padding: 21px; + .hot-tag-title { + font-family: "PingFangSC-Semibold", "PingFang SC Semibold", "PingFang SC", sans-serif; + font-weight: 650; + font-style: normal; + font-size: 16px; + color: #000000; + + position: relative; + + .icon { + position: absolute; + top: 50%; + transform: translateY(-50%); + left: -21px; + width: 10px; + height: 18px; + } + } + + .list { + .item { + line-height: 36px; + color: #333333; + font-size: 14px; + height: 32px; + line-height: 32px; + padding: 0 14px; + background-color: rgba(246, 246, 246, 1); + border: rgba(242, 242, 242, 1); + border-radius: 16px; + } + } +} diff --git a/css/search.css b/css/search.css index f767622..3fca160 100644 --- a/css/search.css +++ b/css/search.css @@ -2,3 +2,61 @@ width: 1200px; margin: 0 auto; } +#search .label-title { + margin-bottom: 24px; +} +#search .label-title .icon { + width: 25px; + height: 20px; + margin-right: 12px; +} +#search .label-title .text { + font-family: "PingFangSC-Semibold", "PingFang SC Semibold", "PingFang SC", sans-serif; + font-weight: 650; + font-style: normal; + font-size: 28px; + color: #000000; +} +#search .classify { + margin-bottom: 16px; +} +#search .classify .item { + width: 50px; + height: 32px; + line-height: 32px; + text-align: center; + background-color: #ffffff; + border: 1px solid #f2f2f2; + border-radius: 12px; + color: #333333; + cursor: pointer; + font-size: 15px; +} +#search .classify .item.pitch { + background-color: #d35110; + color: #ffffff; +} +#search .classify .item:not(:last-child) { + margin-right: 10px; +} +#search .quantity { + font-size: 14px; + line-height: 26px; + color: #555; + margin-bottom: 14px; +} +#search .quantity .line { + width: 1px; + height: 14px; + background-color: #aaaaaa; + margin: 0 10px; +} +#search .quantity .num { + font-family: "PingFangSC-Semibold", "PingFang SC Semibold", "PingFang SC", sans-serif; + font-weight: 650; + color: #000000; + margin: 0 10px; +} +#search .matter .sidebar-box { + width: 219px; +} diff --git a/css/search.less b/css/search.less index a7c27af..479fd24 100644 --- a/css/search.less +++ b/css/search.less @@ -1,4 +1,77 @@ #search { width: 1200px; margin: 0 auto; + + .label-title { + margin-bottom: 24px; + + .icon { + width: 25px; + height: 20px; + margin-right: 12px; + } + + .text { + font-family: "PingFangSC-Semibold", "PingFang SC Semibold", "PingFang SC", sans-serif; + font-weight: 650; + font-style: normal; + font-size: 28px; + color: #000000; + } + } + + .classify { + margin-bottom: 16px; + .item { + width: 50px; + height: 32px; + line-height: 32px; + text-align: center; + background-color: rgba(255, 255, 255, 1); + border: 1px solid rgba(242, 242, 242, 1); + border-radius: 12px; + color: #333333; + cursor: pointer; + font-size: 15px; + + &.pitch { + background-color: rgba(211, 81, 16, 1); + color: #ffffff; + } + + &:not(:last-child) { + margin-right: 10px; + } + } + } + + .quantity { + font-size: 14px; + line-height: 26px; + color: #555; + margin-bottom: 14px; + + .line { + width: 1px; + height: 14px; + background-color: #aaaaaa; + margin: 0 10px; + } + + .num { + font-family: "PingFangSC-Semibold", "PingFang SC Semibold", "PingFang SC", sans-serif; + font-weight: 650; + color: #000000; + margin: 0 10px; + } + } + + .matter { + .matter-content { + } + + .sidebar-box { + width: 219px; + } + } } diff --git a/homepage-me.html b/homepage-me.html index 730ab97..f45f609 100644 --- a/homepage-me.html +++ b/homepage-me.html @@ -1,174 +1,193 @@ + + + + 个人主页 + + + + + - - - - Document - - - - - + +
+ - -
- +
+ + 首页 + +
我的主页
+
-
- - 首页 - -
我的主页
-
+
+
+
+ 用户头像 -
-
-
- 用户头像 - -

{{ info.nickname }}

-

- UID: {{ info.uin }} - -

-
- -
- - -
-
{{ gtercoin }}
-
寄托币
+

{{ info.nickname }}

+

+ UID: {{ info.uin }} + +

- - 关于寄托币 - - -
-
-

勋章 {{ medallist.length }}

-
- +
+ + +
+
{{ gtercoin }}
+
寄托币
+
+ + 关于寄托币 + + +
+ +
+

勋章 {{ medallist.length }}

+
+ +
+
+
+
+
+ +
+ 用户头像 + {{ info.nickname }} + +
+ + +
+
+ 注册时间 + 2019-7-26 16:38 +
+
+ 最后登录 + 2025-10-16 10:32 +
+
+ 在线时长 + 1304 小时 +
+
+ 上次访问 IP + 116.237.182.149 -- 上海长宁区 +
+
+ Email + skysuper007@qq.com + 未认证 +
+
+ 手机号 + 15934271290 + 已认证 +
+
+ 累计签到 + 1341 天 +
+
+ 本月签到 + 6 天 +
+
+ 寄托币 + {{ gtercoin }} +
+
+ + +
+ +
+ + +
+
+ + + {{ item.school }} +
+
+
+ +
+
+
{{ item.text }}
+
+ +
+
{{ item.text }}
+
+ +
+ 共 +
{{ total }}
+ 个收藏 +
+
+ 共 +
{{ total }}
+ 个创作,获得 +
{{ 000 }}
+ 个赞 +
+
+ 共 +
{{ total }}
+ 个评论,获得 +
{{ 000 }}
+ 个赞 +
+
+ 共 +
{{ total }}
+ 个点赞 +
+
系统会为你保留最近7天的浏览记录:
+ + +
+ +
+ +
+ +
- 暂无内容 -
+
+ +
加载更多…
-
-
- -
- 用户头像 - {{ info.nickname }} - -
- - -
-
- 注册时间 - 2019-7-26 16:38 -
-
- 最后登录 - 2025-10-16 10:32 -
-
- 在线时长 - 1304 小时 -
-
- 上次访问 IP - 116.237.182.149 -- 上海长宁区 -
-
- Email - skysuper007@qq.com - 未认证 -
-
- 手机号 - 15934271290 - 已认证 -
-
- 累计签到 - 1341 天 -
-
- 本月签到 - 6 天 -
-
- 寄托币 - {{ gtercoin }} -
-
- - -
- -
- - -
-
- - - {{ item.school }} -
-
-
- -
-
-
{{ item.text }}
-
- -
-
{{ item.text }}
-
- -
- 共
{{ total }}
个创作 -
- - - -
- -
- -
- -
- 暂无内容 -
-
- -
加载更多…
-
-
-
- - - - - - \ No newline at end of file + + + + + diff --git a/img/triangle-orange.svg b/img/triangle-orange.svg new file mode 100644 index 0000000..34ecaa8 --- /dev/null +++ b/img/triangle-orange.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/img/well-number.svg b/img/well-number.svg new file mode 100644 index 0000000..2cfc490 --- /dev/null +++ b/img/well-number.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/js/homepage-me.js b/js/homepage-me.js index 2a8e4dc..e80f8e0 100644 --- a/js/homepage-me.js +++ b/js/homepage-me.js @@ -10,11 +10,51 @@ import { headTop } from "../component/head-top/head-top.js"; const appSectionIndex = createApp({ setup() { onMounted(() => { + getUserInfoWin(); + init(); + + window.addEventListener("scroll", handleScroll); }); + const handleScroll = () => { + const scrollTop = document.documentElement.scrollTop || document.body.scrollTop; + + const scrollHeight = document.documentElement.scrollHeight; + const clientHeight = document.documentElement.clientHeight; + + // 列表下 滑动到底部 获取新数据 + if (scrollTop + clientHeight >= scrollHeight - 40) getList(); + }; + let isLogin = ref(true); let realname = ref(1); // 是否已经实名 + let userInfoWin = ref({ + authority: ["comment.edit", "comment.delete", "offercollege.hide", "offersummary.hide", "mj.hide", "topic:manager", "topic:hide"], + avatar: "https://nas.gter.net:9008/avatar/97K4EWIMLrsbGTWXslC2WFVSEKWOikN42jDKLNjtax7HL4xtfMOJSdU9oWFhY2E~/middle?random=1761733169", + groupid: 3, + nickname: "肖荣豪", + realname: 1, + token: "01346a38444d71aaadb3adad52b52c39", + uid: 500144, + uin: 4238049, + }); + + let permissions = ref([]); + + const getUserInfoWin = () => { + const checkUser = () => { + const user = window.userInfoWin; + if (!user) return; + document.removeEventListener("getUser", checkUser); + realname.value = user.realname; + userInfoWin.value = user; + if (user?.uin > 0 || user?.uid > 0) isLogin.value = true; + permissions.value = user?.authority || []; + }; + document.addEventListener("getUser", checkUser); + }; + const openAttest = () => { const handleAttestClose = () => { document.removeEventListener("closeAttest", handleAttestClose); @@ -35,6 +75,7 @@ const appSectionIndex = createApp({ }; provide("isLogin", isLogin); + provide("userInfoWin", userInfoWin); provide("realname", realname); provide("openAttest", openAttest); provide("goLogin", goLogin); @@ -45,6 +86,7 @@ const appSectionIndex = createApp({ let medallist = ref([]); let introduction = ref(""); + let avatar = ""; const init = () => { ajax(`/v2/api/forum/postUserDetail`) .then((res) => { @@ -63,12 +105,12 @@ const appSectionIndex = createApp({ info.value = data.info || {}; medallist.value = data.medal || []; introduction.value = data?.urls?.introduction; + avatar = data?.info?.avatar || ""; getCount(); + getList(); }) .catch(() => {}); - - getCollectList(); }; let createCount = ref(0); @@ -189,30 +231,68 @@ const appSectionIndex = createApp({ let page = ref(1); let total = ref(0); - const getCollectList = () => { - const limit = 10; - ajax("/v2/api/forum/postUserCollect", { + let loading = ref(false); + const getList = () => { + if (page.value == 0 || loading.value) return; + loading.value = true; + let url = `/v2/api/forum/postUserCollect`; + if (typeValue.value == "comment") url = `/v2/api/forum/postUserComment`; + if (typeValue.value == "like") url = `/v2/api/forum/postUserLike`; + if (typeValue.value == "footprint") url = `/v2/api/forum/postUserFootprint`; + + ajax(url, { page: page.value, type: classify.value, - }).then((res) => { - if (res.code != 200) return; - const data = res.data || []; - console.log("data", data); - total.value = data.count; - list.value = [...list.value, ...data.data]; - page.value = data.count > data.page * limit ? page.value + 1 : 0; - }); + }) + .then((res) => { + if (res.code != 200) return; + const data = res.data || []; + + let targetList = data.data || []; + + targetList.forEach((element) => element.comment_list?.forEach((ele) => (ele["avatar"] = avatar))); + + total.value = data.count; + list.value = [...list.value, ...targetList]; + page.value = list.value.length >= data.count ? 0 : page.value + 1; + }) + .finally(() => (loading.value = false)); }; - const cancelOperate = (token) => { - console.log("token", token); + // 取消操作后的删除 + const cancelOperate = (type, token) => { + if (typeValue.value != type) return; + const index = list.value.findIndex((item) => item.token == token); + if (index == -1) return; + list.value.splice(index, 1); + total.value--; }; provide("cancelOperate", cancelOperate); + const classifyChange = (type) => { + if (classify.value == type) return; + page.value = 1; + list.value = []; + total.value = 0; + classify.value = type; + getList(); + }; + + const typeChange = (type) => { + if (typeValue.value == type) return; + typeValue.value = type; + page.value = 1; + list.value = []; + total.value = 0; + classify.value = ""; + + getList(); + }; + const copy = (text) => copyUid(text); - return { total, list, classifyList, classify, typeValue, typeList, creationType, gtercoin, info, medallist, schoolTags, introduction, copy }; + return { typeChange, page, loading, classifyChange, total, list, classifyList, classify, typeValue, typeList, creationType, gtercoin, info, medallist, schoolTags, introduction, copy }; }, }); diff --git a/js/save.js b/js/save.js index 52183f5..c85fad8 100644 --- a/js/save.js +++ b/js/save.js @@ -25,6 +25,8 @@ const watchList = { "../component/slideshow-box/slideshow-box.txt": "../component/slideshow-box/slideshow-box.js", // 监听 head-top.txt,同步到 head-top.js "../component/head-top/head-top.txt": "../component/head-top/head-top.js", + // 监听 hot-tag.txt,同步到 hot-tag.js + "../component/hot-tag/hot-tag.txt": "../component/hot-tag/hot-tag.js", // 可添加更多文件(格式:'txt路径': 'js路径') // './component/other/other.txt': './component/other/other.js', diff --git a/js/search.js b/js/search.js index a274938..26a1102 100644 --- a/js/search.js +++ b/js/search.js @@ -1,23 +1,71 @@ const { createApp, ref, onMounted, nextTick, onUnmounted, computed, watch, provide } = Vue; import { itemForum } from "../component/item-forum/item-forum.js"; +import { headTop } from "../component/head-top/head-top.js"; +import { hotTag } from "../component/hot-tag/hot-tag.js"; const appSearch = createApp({ setup() { onMounted(() => { const params = getUrlParams(); const id = params.section || ""; - if (id) { - section.value = id; - init(); - } - - section.value = id; // init(); }); - return {}; + const classifyList = ref([ + { + text: "全部", + type: "", + }, + { + text: "帖子", + type: "thread", + }, + { + text: "Offer", + type: "offer", + }, + { + text: "总结", + type: "offer_summary", + }, + { + text: "面经", + type: "interviewexperience", + }, + { + text: "投票", + type: "vote", + }, + { + text: "租房", + type: "tenement", + }, + ]); + + let classify = ref(""); + + const classifyChange = (type) => { + if (classify.value == type) return; + + classify.value = type; + }; + + let tabList = ref({ + all: "全部", + thread: "论坛", + offer: "Offer", + offer_summary: "总结", + interviewexperience: "面经", + vote: "投票", + }); + + let tabValue = ref("all"); + + return { tabValue, tabList, classifyChange, classifyList, classify }; }, }); appSearch.component("item-forum", itemForum); -appSearch.mount("#sectionIndex"); +appSearch.component("head-top", headTop); +appSearch.component("hot-tag", hotTag); +appSearch.mount("#search"); diff --git a/search.html b/search.html index d11fccf..e295c65 100644 --- a/search.html +++ b/search.html @@ -1,27 +1,49 @@ + + + + 搜索 + + + + + - - - - 搜索 - - - - - + + + + + + + +