fix(bi): 添加投币数量必须大于0的校验

feat(item-bottom): 实现二维码弹窗自适应右侧边界
添加判断逻辑使二维码弹窗在靠近右侧边界时向左弹出

refactor(public.js): 优化ajax请求配置和登录跳转逻辑
统一设置axios默认配置,提取登录跳转函数

style(public.css): 调整QRcode-box.right的定位
修复二维码弹窗靠近右侧时的显示问题

fix(details.js): 修复粗体标记正则匹配多行内容
使用[\s\S]*?匹配可能的多行内容

refactor(index.js): 优化列表加载和滚动逻辑
移除模拟数据,添加加载状态,调整滚动加载阈值

chore: 更新html模板中的唯一标识和广告类名
This commit is contained in:
DESKTOP-RQ919RC\Pc
2025-11-19 19:27:43 +08:00
parent f49d937f19
commit c9e229a5cd
12 changed files with 211 additions and 217 deletions

View File

@@ -2,13 +2,14 @@ const { createApp, ref, onMounted, nextTick, onUnmounted, computed, watch, provi
import { headTop } from "../component/head-top/head-top.js";
import { itemForum } from "../component/item-forum/item-forum.js";
import { latestList } from "../component/latest-list/latest-list.js";
import { loadBox } from "../component/load-box/load-box.js";
const appIndex = createApp({
setup() {
onMounted(() => getUserInfoWin());
let isLogin = ref(true);
let realname = ref(1); // 是否已经实名
let isLogin = ref(false);
let realname = ref(0); // 是否已经实名
let userInfoWin = ref({});
const getUserInfoWin = () => {
@@ -48,53 +49,7 @@ const appIndex = createApp({
provide("openAttest", openAttest);
provide("goLogin", goLogin);
let pastList = ref([
{
comments: 24,
created_at: "2025-04-14 16:08:52",
description: "''",
status: 0,
title: "25年4月美国无预警大量撤销留学生签证撤销原因是哪些我们的一些相关建议",
topicid: 253942,
uniqid: "uDqLzLTbK4Of",
},
{
comments: 24,
created_at: "2025-04-14 16:08:52",
description: "''",
status: 0,
title: "25年4月美国无预警大量撤销留学生签证撤销原因是哪些我们的一些相关建议",
topicid: 253942,
uniqid: "uDqLzLTbK4Of",
},
{
comments: 24,
created_at: "2025-04-14 16:08:52",
description: "''",
status: 0,
title: "25年4月美国无预警大量撤销留学生签证撤销原因是哪些我们的一些相关建议",
topicid: 253942,
uniqid: "uDqLzLTbK4Of",
},
{
comments: 24,
created_at: "2025-04-14 16:08:52",
description: "''",
status: 0,
title: "25年4月美国无预警大量撤销留学生签证撤销原因是哪些我们的一些相关建议",
topicid: 253942,
uniqid: "uDqLzLTbK4Of",
},
{
comments: 24,
created_at: "2025-04-14 16:08:52",
description: "''",
status: 0,
title: "25年4月美国无预警大量撤销留学生签证撤销原因是哪些我们的一些相关建议",
topicid: 253942,
uniqid: "uDqLzLTbK4Of",
},
]);
let pastList = ref([]);
onMounted(() => {
offerListScrolling();
@@ -107,10 +62,6 @@ const appIndex = createApp({
getTalkingRecommend();
getTopicHandpicked();
getTopicLatest();
setTimeout(() => {
BiComponent.initComponent('unlock');
}, 1000);
});
let ongoingbj = ref({}); // 话题数据
@@ -156,19 +107,28 @@ const appIndex = createApp({
offer.value = data.offer;
vote.value = data.vote;
interviewexperience.value = data.interviewexperience;
nextTick(() => {});
});
};
const sidebarFixed = ref(false);
const handleScroll = () => {
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
const scrollHeight = document.documentElement.scrollHeight;
const clientHeight = document.documentElement.clientHeight;
const scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
const clientHeight = window.innerHeight;
// 列表下 滑动到底部 获取新数据
if (scrollTop + clientHeight >= scrollHeight - 40) getList();
if (scrollTop + clientHeight >= scrollHeight - 200) getList();
// // 侧边栏滚动固定
// if (scrollTop >= matterRef.value.offsetTop + sidebarRef.value.offsetHeight - clientHeight) sidebarFixed.value = true;
// else sidebarFixed.value = false;
sidebarHeight.value = -(sidebarRef.value.offsetHeight - window.innerHeight);
if (sidebarHeight.value > 0) sidebarHeight.value = 12;
};
let offerlist = ref([]); // offer 列表滚动 数据
@@ -195,14 +155,20 @@ const appIndex = createApp({
let offerTimer = null;
let scrollup = null;
// offer list 滚动
const autoOfferListScroll = () => {
console.log("autoOfferListScroll");
if (typeof ScrollText !== "function") {
setTimeout(() => autoOfferListScroll(), 500);
return;
}
var scrollup = new ScrollText("offer-box");
scrollup.LineHeight = 56.5;
console.log("scrollup");
if (scrollup) return;
scrollup = new ScrollText("offer-box");
scrollup.LineHeight = 55;
scrollup.Amount = 1;
scrollup.Delay = 1;
scrollup.Start();
@@ -266,44 +232,40 @@ const appIndex = createApp({
return Object.values(groups);
};
let loading = false;
let loading = ref(false);
let page = ref(1);
let list = ref([]);
const getList = () => {
if (loading || page.value == 0) return;
loading = true;
// wx.showLoading();
if (loading.value || page.value == 0) return;
loading.value = true;
ajaxGet(`/v2/api/forum/topicLists?type=thread&page=${page.value || 1}`)
.then((res) => {
// wx.hideLoading();
if (res.code != 200) return;
let data = res.data;
list.value = list.value.concat(data.data);
page.value = data.count > data.limit * data.page ? page.value + 1 : 0;
loading = false;
loading.value = false;
})
.catch((err) => {
// wx.hideLoading();
err = err.data;
if (err.code == 401) goLogin();
loading = false;
loading.value = false;
});
};
const clickbtn = () => {
BiComponent.initComponent();
};
const sidebarRef = ref(null);
const matterRef = ref(null);
let sidebarHeight = ref(0);
return { sidebarRef, sidebarHeight, clickbtn, interviewexperience, vote, offer, topicHandpickedList, list, sectionList, popList, custom_2AdvRef, ongoingbj, pastList, offerMouseover, offerMouseout, offerlist, offerListRef };
return { sidebarHeight, matterRef, sidebarFixed, sidebarRef, loading, interviewexperience, vote, offer, topicHandpickedList, list, sectionList, popList, custom_2AdvRef, ongoingbj, pastList, offerMouseover, offerMouseout, offerlist, offerListRef };
},
});
appIndex.component("headTop", headTop);
appIndex.component("itemForum", itemForum);
appIndex.component("latestList", latestList);
appIndex.component("load-box", loadBox);
appIndex.mount("#appIndex");