From b26b3793418c59a0166d4ee976839cb51b507da0 Mon Sep 17 00:00:00 2001 From: "DESKTOP-RQ919RC\\Pc" <1300399510@qq.com> Date: Tue, 11 Nov 2025 19:05:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=A4=9A=E4=B8=AA?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=A0=B7=E5=BC=8F=E5=92=8C=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复论坛项图片底部间距问题 调整BI组件z-index值防止遮挡 优化视频海报展示逻辑 限制评论输入框最大高度 修复搜索框占位符显示逻辑 添加分页项样式 移除评论编辑框底部边框 优化BI组件API请求方法 --- component/bi/bi.js | 64 +++++++++++++++++++++++++---- component/bi/bi.txt | 2 +- component/head-top/head-top.js | 2 +- component/head-top/head-top.txt | 2 +- component/item-forum/item-forum.js | 2 +- component/item-forum/item-forum.txt | 10 +++-- css/bi.css | 13 ++++++ css/bi.less | 16 ++++++++ css/details.css | 8 ++-- css/details.less | 7 +++- css/public.css | 1 + css/public.less | 1 + 12 files changed, 108 insertions(+), 20 deletions(-) diff --git a/component/bi/bi.js b/component/bi/bi.js index 294b0e6..8ceee13 100644 --- a/component/bi/bi.js +++ b/component/bi/bi.js @@ -1,6 +1,6 @@ // 1. 创建组件模板和样式(内置到 JS 中,无需外部 HTML/Template) const template = document.createElement("template"); -template.innerHTML = `
该帖子已获得
个寄托币
投币
你当前共有
寄托币 [挣币攻略]
`; +template.innerHTML = `
该帖子已获得
个寄托币
投币
你当前共有
寄托币 [挣币攻略]
`; // 2. 定义组件类 class BiCard extends HTMLElement { @@ -10,7 +10,7 @@ class BiCard extends HTMLElement { this.coins = 0; this.token = ""; this.pagetpye = ""; - + // 创建 Shadow DOM 并挂载模板 this.attachShadow({ mode: "open" }); this.shadowRoot.appendChild(template.content.cloneNode(true)); @@ -50,8 +50,12 @@ class BiCard extends HTMLElement { } getCoinConfig() { - this.$ajaxget(`https://api.gter.net/v2/api/forum/getCoinConfig`).then((res) => { + this.fetchGetData(`https://api.gter.net/v2/api/forum/getCoinConfig`).then((res) => { + console.log("res", res); + const data = res.data; + console.log("data", data); + const strategy = data.config.strategy.url || 0; const mybalance = data.mybalance || 0; const defaultcoinnum = data.defaultcoinnum || 0; @@ -67,11 +71,11 @@ class BiCard extends HTMLElement { } getCoinRankList() { - this.$ajaxget(`https://api.gter.net/v2/api/forum/getCoinRankList?token=${this.token}&limit=1000`).then((res) => { + this.fetchGetData(`https://api.gter.net/v2/api/forum/getCoinRankList?token=${this.token}&limit=1000`).then((res) => { const data = res.data; this.coinListAreaEl.innerHTML = ""; const coinNubmer = data.nubmer; - if (coinNubmer == 0) return + if (coinNubmer == 0) return; const total = `
${coinNubmer}
人参与投币:
`; const coinList = data.data; @@ -98,10 +102,12 @@ class BiCard extends HTMLElement { coinSubmit() { const num = Number(this.input.value || this.defaultcoinnum) || 0; - this.$ajax(`https://api.gter.net/v2/api/forum/postTopicCoin`, { + this.fetchData(`https://api.gter.net/v2/api/forum/postTopicCoin`, { token: this.token, num, }).then((res) => { + console.log("res", res); + if (res.code == 200) creationAlertBox("success", res.message); else creationAlertBox("error", res.message); @@ -112,9 +118,9 @@ class BiCard extends HTMLElement { this.input.value = ""; const coins = data.coins; this.coinsEl.textContent = coins || 0; - + if (this.pagetpye == "forum") document.querySelector(".action-bar-item.coins .text").textContent = coins || 0; - + this.getCoinRankList(); }); } @@ -141,6 +147,48 @@ class BiCard extends HTMLElement { console.log(`用户卡片 ${this.getAttribute("username")} 已卸载`); } + fetchData(url, data) { + return new Promise((resolve, reject) => { + var xhr = new XMLHttpRequest(); + xhr.responseType = "json"; + xhr.withCredentials = true; + + xhr.open("POST", url, true); + xhr.setRequestHeader("Content-Type", "application/json"); + + if (location.hostname == "localhost") xhr.setRequestHeader("Authorization", "01346a38444d71aaadb3adad52b52c39"); + + xhr.onreadystatechange = function () { + if (xhr.readyState === 4 && xhr.status === 200) { + let response = xhr.response; + resolve(response); + } + }; + + xhr.send(JSON.stringify(data)); + }); + } + + fetchGetData(url) { + return new Promise((resolve, reject) => { + const xhr = new XMLHttpRequest(); + xhr.withCredentials = true; + + xhr.open("GET", url, true); + + if (location.hostname == "localhost") xhr.setRequestHeader("Authorization", "01346a38444d71aaadb3adad52b52c39"); + + xhr.onreadystatechange = function () { + if (xhr.readyState === 4 && xhr.status === 200) { + let response = xhr.response; + resolve(JSON.parse(response)); + } + }; + + xhr.send(); + }); + } + $ajax(url) { var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return new Promise(function (resolve, reject) { diff --git a/component/bi/bi.txt b/component/bi/bi.txt index 4d1b620..e5c95c6 100644 --- a/component/bi/bi.txt +++ b/component/bi/bi.txt @@ -50,7 +50,7 @@ width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); - z-index: 2; + z-index: 99; display: none; } diff --git a/component/head-top/head-top.js b/component/head-top/head-top.js index 0f899f4..69acd0f 100644 --- a/component/head-top/head-top.js +++ b/component/head-top/head-top.js @@ -174,5 +174,5 @@ export const headTop = defineComponent({ return { hotSearchWords, historySearchList, searchEvent, searchInputState, searchHistoryShowState, searchInputFocus, searchInputBlur, page, pitchState, state, signIn, input, currentIndex, pauseCarousel, resumeCarousel }; }, - template: `
大家都在搜:{{ item.keyword }}
大家都在搜:{{ item.keyword }}
历史搜索
{{ item }}
`, + template: `
大家都在搜:{{ item.keyword }}
大家都在搜:{{ item.keyword }}
历史搜索
{{ item }}
`, }); diff --git a/component/head-top/head-top.txt b/component/head-top/head-top.txt index 8035406..8d4b8ed 100644 --- a/component/head-top/head-top.txt +++ b/component/head-top/head-top.txt @@ -4,7 +4,7 @@
-
+
大家都在搜:{{ item.keyword }}
大家都在搜:{{ item.keyword }}
diff --git a/component/item-forum/item-forum.js b/component/item-forum/item-forum.js index f323824..60a8b48 100644 --- a/component/item-forum/item-forum.js +++ b/component/item-forum/item-forum.js @@ -36,5 +36,5 @@ export const itemForum = defineComponent({ itemHead, }, - template: ``, + template: ``, }); diff --git a/component/item-forum/item-forum.txt b/component/item-forum/item-forum.txt index 70bd061..3f0a01c 100644 --- a/component/item-forum/item-forum.txt +++ b/component/item-forum/item-forum.txt @@ -5,10 +5,12 @@ -
- - -
+
diff --git a/css/bi.css b/css/bi.css index 2ae3ff3..9f7902d 100644 --- a/css/bi.css +++ b/css/bi.css @@ -10,6 +10,19 @@ body { padding-top: 22px; margin-top: 20px; } +.bi-container .page-item { + min-width: 24px; + box-sizing: border-box; + text-align: center; + cursor: pointer; +} +.bi-container .page-item.dot { + cursor: auto; +} +.bi-container .page-item.dot:hover { + color: #333; + background-color: #eee; +} .bi-container * { padding: 0; margin: 0; diff --git a/css/bi.less b/css/bi.less index 627b6ed..1d40abf 100644 --- a/css/bi.less +++ b/css/bi.less @@ -11,6 +11,22 @@ body { padding-top: 22px; margin-top: 20px; + .page-item { + min-width: 24px; + box-sizing: border-box; + text-align: center; + cursor: pointer; + + &.dot { + cursor: auto; + + &:hover { + color: #333; + background-color: #eee; + } + } + } + * { padding: 0; margin: 0; diff --git a/css/details.css b/css/details.css index c031b0d..6ce8c57 100644 --- a/css/details.css +++ b/css/details.css @@ -661,6 +661,7 @@ padding-top: 5px; padding-bottom: 11px; resize: none; + max-height: 300px; } .answer-discuss .input-box .top .input-textarea * { background: transparent !important; @@ -683,6 +684,7 @@ padding-left: 14px; padding-top: 12px; overflow: auto; + margin-bottom: 20px; } .answer-discuss .input-box .picture-box .picture { position: relative; @@ -955,6 +957,8 @@ } .answer-discuss .comments-box .comments-item .comments-content img { border-radius: 5px; + height: 100px; + max-width: 300px; } .answer-discuss .comments-box .comments-item .comments-content .input-box { position: relative; @@ -996,6 +1000,7 @@ } .answer-discuss .comments-box .comments-item .comments-content .comments-img { height: 100px; + max-width: 300px; margin-right: 10px; margin-bottom: 13px; border-radius: 8px; @@ -1199,9 +1204,6 @@ .answer-discuss .edit-comment .box .input-box { margin-right: 0; } -.answer-discuss .edit-comment .box .input-box .bottom { - border-top: 1px solid #ebebeb; -} .answer-discuss .edit-comment .box .btn-list { padding: 15px 0; justify-content: flex-end; diff --git a/css/details.less b/css/details.less index ce4e47d..688aa9a 100644 --- a/css/details.less +++ b/css/details.less @@ -779,6 +779,7 @@ padding-top: 5px; padding-bottom: 11px; resize: none; + max-height: 300px; } .answer-discuss .input-box .top .input-textarea * { @@ -804,6 +805,7 @@ padding-left: 14px; padding-top: 12px; overflow: auto; + margin-bottom: 20px; } .answer-discuss .input-box .picture-box .picture { @@ -1123,6 +1125,8 @@ .answer-discuss .comments-box .comments-item .comments-content img { border-radius: 5px; + height: 100px; + max-width: 300px; } .answer-discuss .comments-box .comments-item .comments-content .input-box { @@ -1171,6 +1175,7 @@ .answer-discuss .comments-box .comments-item .comments-content .comments-img { height: 100px; + max-width: 300px; margin-right: 10px; margin-bottom: 13px; border-radius: 8px; @@ -1402,7 +1407,7 @@ margin-right: 0; } .answer-discuss .edit-comment .box .input-box .bottom { - border-top: 1px solid #ebebeb; + // border-top: 1px solid #ebebeb; } .answer-discuss .edit-comment .box .btn-list { padding: 15px 0; diff --git a/css/public.css b/css/public.css index 2374e1d..1e154eb 100644 --- a/css/public.css +++ b/css/public.css @@ -249,6 +249,7 @@ body { } .item-box.item-forum .picture { overflow: auto; + margin-bottom: 15px; } .item-box.item-forum .picture .picture-videos { position: relative; diff --git a/css/public.less b/css/public.less index 6f8ea7c..66a2dd2 100644 --- a/css/public.less +++ b/css/public.less @@ -294,6 +294,7 @@ body { .picture { overflow: auto; + margin-bottom: 15px; .picture-videos { position: relative;