feat: 优化页面布局和交互体验

- 使用sticky定位替代fixed定位,提升滚动体验
- 添加视频播放图标和图片展示功能
- 实现搜索框热门关键词轮播效果
- 优化编辑器链接插入功能
- 调整组件样式和布局细节
This commit is contained in:
DESKTOP-RQ919RC\Pc
2025-11-10 19:06:58 +08:00
parent b7feedb350
commit 5cdbeb249f
26 changed files with 517 additions and 373 deletions

View File

@@ -1,6 +1,6 @@
// my-component.js
// 引入全局 Vue 对象(因在 HTML 中通过 script 引入Vue 已挂载到 window
const { defineComponent, ref, onMounted, nextTick } = Vue;
const { defineComponent, ref, onMounted, onUnmounted, nextTick } = Vue;
// 定义组件(直接使用模板)
export const headTop = defineComponent({
@@ -13,10 +13,95 @@ export const headTop = defineComponent({
},
setup(props) {
// 轮播相关状态
let currentIndex = ref(0); // 当前显示的关键词索引
let carouselTimer = ref(null); // 轮播定时器
let isPaused = ref(false); // 是否暂停轮播
onMounted(() => {
getHistorySearch();
// 写一个函数 ,判断本地缓存有没有 wConfig 并判断 是否过一天 如果过了一天 则更新 wConfig
checkWConfig();
// 启动轮播
startCarousel();
});
// 启动轮播函数
const startCarousel = () => {
// 清除已有的定时器
if (carouselTimer.value) {
clearInterval(carouselTimer.value);
}
// 设置新的定时器,每秒滚动一次
carouselTimer.value = setInterval(() => {
if (!searchInputState.value && hotSearchWords.value.length > 1) {
// 当滚动到复制的数据部分时,进行无缝切换
if (currentIndex.value >= hotSearchWords.value.length - 1) {
// 先滚动到复制的数据
currentIndex.value++;
// 在下一帧,当动画完成后,立即切换回对应的数据索引位置,但不带动画
setTimeout(() => {
if (!searchInputState.value) {
currentIndex.value = 0;
// 强制重新渲染以重置位置
nextTick(() => {
// 继续正常滚动
});
}
}, 2300);
} else {
currentIndex.value++;
}
}
}, 2300);
};
// 暂停轮播
const pauseCarousel = () => {
isPaused.value = true;
};
// 恢复轮播
const resumeCarousel = () => {
isPaused.value = false;
};
// 组件卸载时清理定时器
const onUnmounted = () => {
if (carouselTimer.value) {
clearInterval(carouselTimer.value);
}
};
let hotSearchWords = ref([]);
const checkWConfig = () => {
const wConfig = JSON.parse(localStorage.getItem("wConfig")) || {};
if (wConfig.time) {
const time = new Date(wConfig.time);
const now = new Date();
if (now - time > 24 * 60 * 60 * 1000) getWConfig();
else {
hotSearchWords.value = wConfig.hotSearchWords || [];
}
} else {
getWConfig();
}
};
const getWConfig = () => {
ajaxGet("/v2/api/config/website").then((res) => {
if (res.code == 200) {
let data = res["data"] || {};
hotSearchWords.value = data.hotSearchWords || {};
data.time = new Date().toISOString();
localStorage.setItem("wConfig", JSON.stringify(data));
}
});
};
let state = ref(0); // 是否已经签到
let userInfoWinTimerCount = 0;
@@ -50,19 +135,18 @@ export const headTop = defineComponent({
// console.log("page", page.value);
let input = ref("");
let defaultSearchText = ref("屯特");
let historySearchList = ref([]); // 历史搜索数据
// 获取历史搜索
const getHistorySearch = () => {
const data = JSON.parse(localStorage.getItem("history-search")) || [];
console.log("data", data);
historySearchList.value = data;
};
// 跳转搜索
const searchEvent = (value) => {
const kw = value || input.value || defaultSearchText.value;
const kw = value || input.value || hotSearchWords.value[currentIndex.value]?.keyword || "";
if (!kw) return;
historySearchList.value.unshift(kw);
historySearchList.value = [...new Set(historySearchList.value)];
if (historySearchList.value.length > 10) historySearchList.value = historySearchList.value.splice(0, 10);
@@ -87,8 +171,8 @@ export const headTop = defineComponent({
}, 200);
};
return { historySearchList, searchEvent, searchInputState, searchHistoryShowState, searchInputFocus, searchInputBlur, page, pitchState, state, signIn, input, defaultSearchText };
return { hotSearchWords, historySearchList, searchEvent, searchInputState, searchHistoryShowState, searchInputFocus, searchInputBlur, page, pitchState, state, signIn, input, currentIndex, pauseCarousel, resumeCarousel };
},
template: `<div class="head-top flexacenter"> <a href="/" class="flexacenter" target="_blank"> <img class="logo" src="https://oss.gter.net/logo" alt="" /> </a> <div class="flex1"></div> <div class="input-box flexacenter" :class="{'pitch': searchInputState}"> <input class="input flex1" type="text" :placeholder="'大家都在搜:' + defaultSearchText" @keyup.enter="searchEvent()" v-model="input" @focus="searchInputFocus" @blur="searchInputBlur" /> <img class="icon" src="/img/search-icon.svg" @click="searchEvent()" /> <div class="search-box-history" v-if="searchHistoryShowState"> <div class="search-box-history-title">历史搜索</div> <div class="search-box-history-list"> <div class="search-box-history-item one-line-display" v-for="(item,index) in historySearchList " :key="index" @click="searchEvent(item)">{{ item }}</div> </div> </div> </div> <div class="post-list flexacenter" v-if="page == 'details'"> <a href="/publish" target="_blank" style="margin-right: 10px"> <img class="post-item" src="/img/post-thread.png" /> </a> <a href="https://offer.gter.net/post" target="_blank" style="margin-right: 10px"> <img class="post-item" src="/img/post-offer.png" /> </a> <a href="https://offer.gter.net/post/summary" target="_blank" style="margin-right: 10px"> <img class="post-item" src="/img/post-summary.png" /> </a> <a href="https://interviewexperience.gter.net/publish" target="_blank" style="margin-right: 10px"> <img class="post-item" src="/img/post-mj.png" /> </a> <a href="https://vote.gter.net/publish" target="_blank" style="margin-right: 10px"> <img class="post-item" src="/img/post-vote.png" /> </a> </div> <template v-else> <div class="sign-in sign-in-no flexacenter" v-if="state == 0" @click="signIn()" v-cloak> <img class="sign-in-bj" src="/img/sign-in-bj.svg" /> <img class="coin-bj" src="/img/coin-bj.svg" /> <img class="coin-icon" src="/img/coin-icon.png" /> <span class="text flex1">签到领寄托币</span> <div class="sign-go flexcenter"> <img class="sign-go-bj" src="/img/sign-go.svg" /> GO </div> <img class="petal1" src="/img/petal1.png" /> <img class="petal2" src="/img/petal2.png" /> <img class="petal3" src="/img/petal3.png" /> </div> <div class="sign-in sign-in-already flexcenter" v-else> <img class="sign-icon" src="/img/sign-icon.png" /> <span>已签到,明天再来</span> </div> </template></div>`,
template: `<div class="head-top flexacenter"> <a href="/" class="flexacenter" target="_blank"> <img class="logo" src="https://oss.gter.net/logo" alt="" /> </a> <div class="flex1"></div> <div class="input-box flexacenter" :class="{'pitch': searchInputState}"> <div v-if="!searchInputState" class="placeholder-box" :style="{transform: 'translateY(-' + currentIndex * 36 + 'px)', transition: 'transform .3s ease'}"> <div class="item one-line-display" v-for="(item,index) in hotSearchWords" :key="index">大家都在搜:{{ item.keyword }}</div> <div class="item one-line-display" v-for="(item,index) in hotSearchWords.slice(0, 2)" :key="'copy-' + index">大家都在搜:{{ item.keyword }}</div> </div> <input class="input flex1" type="text" @keyup.enter="searchEvent()" v-model="input" @focus="searchInputFocus" @blur="searchInputBlur" /> <img class="icon" src="/img/search-icon.svg" @click="searchEvent()" /> <div class="search-box-history" v-if="searchHistoryShowState"> <div class="search-box-history-title">历史搜索</div> <div class="search-box-history-list"> <div class="search-box-history-item one-line-display" v-for="(item,index) in historySearchList " :key="index" @click="searchEvent(item)">{{ item }}</div> </div> </div> </div> <div class="post-list flexacenter" v-if="page == 'details'"> <a href="/publish" target="_blank" style="margin-right: 10px"> <img class="post-item" src="/img/post-thread.png" /> </a> <a href="https://offer.gter.net/post" target="_blank" style="margin-right: 10px"> <img class="post-item" src="/img/post-offer.png" /> </a> <a href="https://offer.gter.net/post/summary" target="_blank" style="margin-right: 10px"> <img class="post-item" src="/img/post-summary.png" /> </a> <a href="https://interviewexperience.gter.net/publish" target="_blank" style="margin-right: 10px"> <img class="post-item" src="/img/post-mj.png" /> </a> <a href="https://vote.gter.net/publish" target="_blank" style="margin-right: 10px"> <img class="post-item" src="/img/post-vote.png" /> </a> </div> <template v-else> <div class="sign-in sign-in-no flexacenter" v-if="state == 0" @click="signIn()" v-cloak> <img class="sign-in-bj" src="/img/sign-in-bj.svg" /> <img class="coin-bj" src="/img/coin-bj.svg" /> <img class="coin-icon" src="/img/coin-icon.png" /> <span class="text flex1">签到领寄托币</span> <div class="sign-go flexcenter"> <img class="sign-go-bj" src="/img/sign-go.svg" /> GO </div> <img class="petal1" src="/img/petal1.png" /> <img class="petal2" src="/img/petal2.png" /> <img class="petal3" src="/img/petal3.png" /> </div> <div class="sign-in sign-in-already flexcenter" v-else> <img class="sign-icon" src="/img/sign-icon.png" /> <span>已签到,明天再来</span> </div> </template></div>`,
});

View File

@@ -4,42 +4,22 @@
</a>
<div class="flex1"></div>
<div class="input-box flexacenter" :class="{'pitch': searchInputState}">
<input class="input flex1" type="text" :placeholder="'大家都在搜:' + defaultSearchText" @keyup.enter="searchEvent()" v-model="input" @focus="searchInputFocus" @blur="searchInputBlur" />
<img class="icon" src="/img/search-icon.svg" @click="searchEvent()" />
<div v-if="!searchInputState" class="placeholder-box" :style="{transform: 'translateY(-' + currentIndex * 36 + 'px)', transition: 'transform .3s ease'}">
<div class="item one-line-display" v-for="(item,index) in hotSearchWords" :key="index">大家都在搜:{{ item.keyword }}</div>
<div class="item one-line-display" v-for="(item,index) in hotSearchWords.slice(0, 2)" :key="'copy-' + index">大家都在搜:{{ item.keyword }}</div>
</div>
<input class="input flex1" type="text" @keyup.enter="searchEvent()" v-model="input" @focus="searchInputFocus" @blur="searchInputBlur" /> <img class="icon" src="/img/search-icon.svg" @click="searchEvent()" />
<div class="search-box-history" v-if="searchHistoryShowState">
<div class="search-box-history-title">历史搜索</div>
<div class="search-box-history-list">
<div class="search-box-history-item one-line-display" v-for="(item,index) in historySearchList " :key="index" @click="searchEvent(item)">{{ item }}</div>
</div>
</div>
</div>
</div>
<div class="post-list flexacenter" v-if="page == 'details'">
<a href="/publish" target="_blank" style="margin-right: 10px">
<img class="post-item" src="/img/post-thread.png" />
</a>
<a href="https://offer.gter.net/post" target="_blank" style="margin-right: 10px">
<img class="post-item" src="/img/post-offer.png" />
</a>
<a href="https://offer.gter.net/post/summary" target="_blank" style="margin-right: 10px">
<img class="post-item" src="/img/post-summary.png" />
</a>
<a href="https://interviewexperience.gter.net/publish" target="_blank" style="margin-right: 10px">
<img class="post-item" src="/img/post-mj.png" />
</a>
<a href="https://vote.gter.net/publish" target="_blank" style="margin-right: 10px">
<img class="post-item" src="/img/post-vote.png" />
</a>
</div>
<template v-else>
<div class="sign-in sign-in-no flexacenter" v-if="state == 0" @click="signIn()" v-cloak>
<img class="sign-in-bj" src="/img/sign-in-bj.svg" />
<img class="coin-bj" src="/img/coin-bj.svg" />
<img class="coin-icon" src="/img/coin-icon.png" />
<span class="text flex1">签到领寄托币</span>
<div class="post-list flexacenter" v-if="page == 'details'"> <a href="/publish" target="_blank" style="margin-right: 10px"> <img class="post-item" src="/img/post-thread.png" /> </a> <a href="https://offer.gter.net/post" target="_blank" style="margin-right: 10px"> <img class="post-item" src="/img/post-offer.png" /> </a> <a href="https://offer.gter.net/post/summary" target="_blank" style="margin-right: 10px"> <img class="post-item" src="/img/post-summary.png" /> </a> <a href="https://interviewexperience.gter.net/publish" target="_blank" style="margin-right: 10px"> <img class="post-item" src="/img/post-mj.png" /> </a> <a href="https://vote.gter.net/publish" target="_blank" style="margin-right: 10px"> <img class="post-item" src="/img/post-vote.png" /> </a> </div> <template v-else>
<div class="sign-in sign-in-no flexacenter" v-if="state == 0" @click="signIn()" v-cloak> <img class="sign-in-bj" src="/img/sign-in-bj.svg" /> <img class="coin-bj" src="/img/coin-bj.svg" /> <img class="coin-icon" src="/img/coin-icon.png" /> <span class="text flex1">签到领寄托币</span>
<div class="sign-go flexcenter">
<img class="sign-go-bj" src="/img/sign-go.svg" />
GO
<img class="sign-go-bj" src="/img/sign-go.svg" /> GO
</div>
<img class="petal1" src="/img/petal1.png" />
<img class="petal2" src="/img/petal2.png" />
@@ -50,4 +30,4 @@
<span>已签到,明天再来</span>
</div>
</template>
</div>
</div>

View File

@@ -36,5 +36,5 @@ export const itemForum = defineComponent({
itemHead,
},
template: `<div class="item-box item-forum"> <item-head :itemdata="item" :page="page"></item-head> <a v-if="item.title" class="title" :href="item.url" target="_blank">{{ item.title }}</a> <a class="message two-line-display" :href="item.url" target="_blank">{{ item.content }}</a> <item-bottom :itemdata="item" :page="page"></item-bottom></div>`,
template: `<div class="item-box item-forum"> <item-head :itemdata="item" :page="page"></item-head> <a v-if="item.title" class="title" :href="item.url" target="_blank">{{ item.title }}</a> <a class="message two-line-display" :href="item.url" target="_blank">{{ item.content }}</a> <a class="picture flexacenter" :href="item.url" target="_blank" v-if="item.images?.length != 0 || item.videos?.length != 0"> <img class="picture-item" v-for="(item, index) in item.images" :key="index" :src="item.url" alt=""> <div class="picture-videos"> <img class="picture-item" v-for="(item, index) in item.videos" :key="index" :src="item.posterurl" alt=""> <img class="icon-play" src="/img/videoplay.png" alt=""> </div> </a> <item-bottom :itemdata="item" :page="page"></item-bottom></div>`,
});

View File

@@ -1,8 +1,15 @@
<div class="item-box item-forum">
<item-head :itemdata="item" :page="page"></item-head>
<a v-if="item.title" class="title" :href="item.url" target="_blank">{{ item.title }}</a>
<a class="message two-line-display" :href="item.url" target="_blank">{{ item.content }}</a>
<a class="picture flexacenter" :href="item.url" target="_blank" v-if="item.images?.length != 0 || item.videos?.length != 0">
<img class="picture-item" v-for="(item, index) in item.images" :key="index" :src="item.url" alt="">
<div class="picture-videos">
<img class="picture-item" v-for="(item, index) in item.videos" :key="index" :src="item.posterurl" alt="">
<img class="icon-play" src="/img/videoplay.png" alt="">
</div>
</a>
<item-bottom :itemdata="item" :page="page"></item-bottom>
</div>

View File

@@ -162,5 +162,5 @@ export const itemHead = defineComponent({
report,
},
template: `<div class="item-head flexacenter" ref="itemHead"> <div class="user-box flexacenter" @click="goPersonalHomepage(item?.user?.uin, item?.user?.uid)"> <img class="avatar" :src="item?.user?.avatar || item.avatar" /> <div class="name">{{ item?.user?.nickname || item.nickname || "匿名用户" }}</div> <img class="group" v-if="item.user?.groupimage" :src="item.user?.groupimage" /> </div> <div class="time">{{ timestamp }}</div> <div class="flex1"></div> <div class="circlePen flexcenter" @click="openedit(item.type)" v-if="page == 'edit' && (item.type == 'offer' || item.type == 'offer_summary')"> <img class="icon" src="/img/pen-icon.png" /> </div> <div class="flexacenter" style="position: relative;"> <div class="anonymous-box flexcenter" @click.stop="cutAnonymous" v-if="page == 'edit' && (item.type == 'vote' || item.type == 'interviewexperience')"> <span v-if="item.anonymous == 0">公开</span> <span v-else>匿名</span> </div> <!-- 是否 公开发表 --> <template v-if="anonymousState"> <div class="mask" @click.stop="cutAnonymous"></div> <div class="isPublicityBox"> <div class="isPublicity-item" :class="{'green': item.anonymous == 0}" @click.stop="cutAnonymousState(0)">公开发表 <img v-if="item.anonymous == 0" class="isPublicityIcon" src="/img/u1829.svg"></image> </div> <div class="isPublicity-item" :class="{'green': item.anonymous != 0}" @click.stop="cutAnonymousState(1)">匿名发表 <img v-if="item.anonymous != 0" class="isPublicityIcon" src="/img/u1829.svg"></image> </div> </div> </template> </div> <div class="view flexacenter"> <img class="icon" src="/img/eye-icon.svg" /> <div class="text">{{ item.views }}</div> </div> <div v-if="item.type != 'tenement'" class="btn flexcenter" @click.stop="cutShow"> <img class="icon" src="/img/dot-dot-dot-gray.png" /> </div> <div v-if="show"> <div class="mask" @click.stop="cutShow"></div> <div class="operate"> <div class="item" @click.stop="report">举报</div> <template v-if="ismanager"> <div class="item" @click.stop="hide">{{ item.hidden == 0 ? "隐藏" : "显示" }}</div> <div class="item" @click.stop="recommend">{{ item.recommend == 1 ? "取消" : "" }}推荐</div> <div class="item" @click.stop="essence">{{ item.best == 1 ? "取消" : "" }}精华</div> </template> <template v-if="item.type == 'thread' && item.ismyself"> <div class="item" @click.stop="edit">编辑</div> <div class="item" @click.stop="deleteItem">删除</div> </template> <div class="item" v-if="page == 'edit' && item.type == 'vote'" @click.stop="deleteItem">删除</div> </div> </div></div><div class="label flexflex" v-if="sectionn?.length || tags?.length || item.recommend == 1 || item.best == 1"> <img class="item icon" v-if="item.recommend == 1 && item.best != 1" src="/img/recommend-icon.png" /> <img class="item icon" v-if="item.best == 1" src="/img/essence-icon.png" /> <a class="item blue" v-for="(item, index) in sectionn" :key="item" :href="'/section/' + item.uniqid" target="_blank">{{ item.name }}</a> <a class="item" v-for="(item, index) in tags" :key="item" :href="'/tag/' + item" target="_blank">{{ item }}</a></div><report v-if="reportState" :itemdata="item"></report>`,
template: `<div class="item-head flexacenter" ref="itemHead"> <div class="user-box flexacenter" @click="goPersonalHomepage(item?.user?.uin, item?.user?.uid)"> <img class="avatar" :src="item?.user?.avatar || item.avatar" /> <div class="name">{{ item?.user?.nickname || item.nickname || "匿名用户" }}</div> <img class="group" v-if="item.user?.groupimage" :src="item.user?.groupimage" /> </div> <div class="time">{{ timestamp }}</div> <div class="flex1"></div> <div class="circlePen flexcenter" @click="openedit(item.type)" v-if="page == 'edit' && (item.type == 'offer' || item.type == 'offer_summary')"> <img class="icon" src="/img/pen-icon.png" /> </div> <div class="flexacenter" style="position: relative;"> <div class="anonymous-box flexcenter" @click.stop="cutAnonymous" v-if="page == 'edit' && (item.type == 'vote' || item.type == 'interviewexperience')"> <span v-if="item.anonymous == 0">公开</span> <span v-else>匿名</span> </div> <!-- 是否 公开发表 --> <template v-if="anonymousState"> <div class="mask" @click.stop="cutAnonymous"></div> <div class="isPublicityBox"> <div class="isPublicity-item" :class="{'green': item.anonymous == 0}" @click.stop="cutAnonymousState(0)">公开发表 <img v-if="item.anonymous == 0" class="isPublicityIcon" src="/img/u1829.svg"></image> </div> <div class="isPublicity-item" :class="{'green': item.anonymous != 0}" @click.stop="cutAnonymousState(1)">匿名发表 <img v-if="item.anonymous != 0" class="isPublicityIcon" src="/img/u1829.svg"></image> </div> </div> </template> </div> <div class="view flexacenter"> <img class="icon" src="/img/eye-icon.svg" /> <div class="text">{{ item.views }}</div> </div> <div v-if="item.type != 'tenement'" class="btn flexcenter" @click.stop="cutShow"> <img class="icon" src="/img/dot-dot-dot-gray.png" /> </div> <div v-if="show"> <div class="mask" @click.stop="cutShow"></div> <div class="operate"> <div class="item" @click.stop="report">举报</div> <template v-if="ismanager"> <div class="item" @click.stop="hide">{{ item.hidden == 0 ? "隐藏" : "显示" }}</div> <div class="item" @click.stop="recommend">{{ item.recommend == 1 ? "取消" : "" }}推荐</div> <div class="item" @click.stop="essence">{{ item.best == 1 ? "取消" : "" }}精华</div> </template> <template v-if="item.type == 'thread' && item.ismyself"> <div class="item" @click.stop="edit">编辑</div> <div class="item" @click.stop="deleteItem">删除</div> </template> <div class="item" v-if="page == 'edit' && item.type == 'vote'" @click.stop="deleteItem">删除</div> </div> </div></div><div class="label flexflex" v-if="sectionn?.length || tags?.length || item.recommend == 1 || item.best == 1"> <img class="item icon" v-if="item.recommend == 1" src="/img/recommend-icon.png" /> <img class="item icon" v-if="item.best == 1" src="/img/essence-icon.png" /> <a class="item blue" v-for="(item, index) in sectionn" :key="item" :href="'/section/' + item.uniqid" target="_blank">{{ item.name }}</a> <a class="item" v-for="(item, index) in tags" :key="item" :href="'/tag/' + item" target="_blank">{{ item }}</a></div><report v-if="reportState" :itemdata="item"></report>`,
});

View File

@@ -62,7 +62,7 @@
</div>
<div class="label flexflex" v-if="sectionn?.length || tags?.length || item.recommend == 1 || item.best == 1">
<img class="item icon" v-if="item.recommend == 1 && item.best != 1" src="/img/recommend-icon.png" />
<img class="item icon" v-if="item.recommend == 1" src="/img/recommend-icon.png" />
<img class="item icon" v-if="item.best == 1" src="/img/essence-icon.png" />
<a class="item blue" v-for="(item, index) in sectionn" :key="item" :href="'/section/' + item.uniqid" target="_blank">{{ item.name }}</a>
<a class="item" v-for="(item, index) in tags" :key="item" :href="'/tag/' + item" target="_blank">{{ item }}</a>

View File

@@ -5,29 +5,34 @@ body {
margin: 0;
padding: 0;
}
.container {
.bi-container {
width: 1027px;
height: 755px;
border: 1px solid #e4e4e4;
border-radius: 11px;
margin: 20px;
padding-top: 22px;
margin-top: 20px;
}
.container * {
.bi-container * {
padding: 0;
margin: 0;
}
.title {
.bi-container .bi-icon {
width: 29px;
height: 32px;
margin-right: 8px;
background-image: url(../img/bi-icon.png);
background-size: contain;
background-repeat: no-repeat;
}
.bi-container .title {
display: flex;
align-items: center;
margin: 0 12px 20px;
}
.title img {
.bi-container .title img {
width: 29px;
height: 34px;
margin-right: 8px;
}
.title h2 {
.bi-container .title h2 {
font-family: PingFangSC-Semibold, "PingFang SC Semibold", "PingFang SC", sans-serif;
font-weight: 650;
font-style: normal;
@@ -35,18 +40,17 @@ body {
color: #000000;
line-height: 30px;
}
/* 主标题样式扩展 */
.bi-main-title {
.bi-container .bi-main-title {
display: flex;
align-items: center;
margin: 0 12px 20px;
}
.bi-main-title-icon {
.bi-container .bi-main-title-icon {
width: 29px;
height: 34px;
margin-right: 8px;
}
.bi-main-title-heading {
.bi-container .bi-main-title-heading {
font-family: PingFangSC-Semibold, "PingFang SC Semibold", "PingFang SC", sans-serif;
font-weight: 650;
font-style: normal;
@@ -54,13 +58,12 @@ body {
color: #000000;
line-height: 30px;
}
/* 寄托币表格样式扩展 */
.bi-table {
.bi-container .bi-table {
width: calc(100% - 24px);
border-collapse: collapse;
margin: 0 12px 25px;
}
.bi-table-header {
.bi-container .bi-table-header {
background-color: #f5f5f5;
font-weight: bold;
font-family: PingFangSC-Semibold, "PingFang SC Semibold", "PingFang SC", sans-serif;
@@ -71,87 +74,65 @@ body {
text-align: center;
height: 33px;
}
.bi-table-header.bi-table-event {
/* 事件列特殊样式 */
}
.bi-table-header.bi-table-reward {
/* 奖励列特殊样式 */
}
.bi-table-header.bi-table-limit {
/* 上限列特殊样式 */
}
.bi-table-body {
/* 表格主体样式 */
}
.bi-table-row:nth-child(even) {
.bi-container .bi-table-row:nth-child(even) {
background-color: #f5f5f5;
}
.bi-table-cell {
.bi-container .bi-table-cell {
color: #333333;
font-size: 14px;
text-align: center;
height: 33px;
}
.bi-table-cell.bi-table-event {
/* 事件单元格样式 */
}
.bi-table-cell.bi-table-reward {
/* 奖励单元格样式 */
}
.bi-table-cell.bi-table-limit {
/* 上限单元格样式 */
}
.supplement {
.bi-container .supplement {
margin: 0 12px 30px;
}
.supplement h3 {
.bi-container .supplement h3 {
font-weight: bold;
font-size: 14px;
line-height: 25px;
}
.supplement ul {
.bi-container .supplement ul {
list-style-type: none;
padding: 0;
margin: 0;
}
.supplement li {
.bi-container .supplement li {
font-size: 14px;
line-height: 25px;
}
/* 补充说明样式扩展 */
.bi-supplement {
.bi-container .bi-supplement {
margin: 0 12px 30px;
}
.bi-supplement-title {
.bi-container .bi-supplement-title {
font-weight: bold;
font-size: 14px;
line-height: 25px;
}
.bi-supplement-list {
.bi-container .bi-supplement-list {
list-style-type: none;
padding: 0;
margin: 0;
}
.bi-supplement-item {
.bi-container .bi-supplement-item {
font-size: 14px;
line-height: 25px;
}
.divider {
.bi-container .divider {
height: 1px;
background-color: #eee;
margin-bottom: 37px;
}
.usage {
.bi-container .usage {
display: flex;
flex-direction: column;
margin-bottom: 8px;
}
.usage img {
.bi-container .usage img {
width: 29px;
height: 34px;
margin-right: 8px;
}
.usage h3 {
.bi-container .usage h3 {
font-family: PingFangSC-Semibold, "PingFang SC Semibold", "PingFang SC", sans-serif;
font-weight: 650;
font-style: normal;
@@ -159,31 +140,30 @@ body {
color: #000000;
line-height: 30px;
}
.usage ul {
.bi-container .usage ul {
list-style-type: none;
padding: 0 0 0 32px;
margin: 0;
}
.usage li {
.bi-container .usage li:not(:last-child) {
margin-bottom: 4px;
}
/* 寄托币用途样式扩展 */
.bi-usage {
.bi-container .bi-usage {
display: flex;
flex-direction: column;
margin-bottom: 8px;
margin-bottom: 35px;
}
.bi-usage-title {
.bi-container .bi-usage-title {
display: flex;
align-items: center;
margin-bottom: 10px;
margin-bottom: 0 12px 20px;
}
.bi-usage-icon {
.bi-container .bi-usage-icon {
width: 29px;
height: 34px;
margin-right: 8px;
}
.bi-usage-heading {
.bi-container .bi-usage-heading {
font-family: PingFangSC-Semibold, "PingFang SC Semibold", "PingFang SC", sans-serif;
font-weight: 650;
font-style: normal;
@@ -191,12 +171,12 @@ body {
color: #000000;
line-height: 30px;
}
.bi-usage-list {
.bi-container .bi-usage-list {
list-style-type: none;
padding: 0 0 0 32px;
margin: 0;
}
.bi-usage-item {
.bi-container .bi-usage-item {
margin-bottom: 4px;
font-size: 14px;
color: #333;

View File

@@ -5,238 +5,150 @@ body {
margin: 0;
padding: 0;
}
.container {
.bi-container {
width: 1027px;
height: 755px;
border: 1px solid rgb(228, 228, 228);
border-radius: 11px;
margin: 20px;
// height: 755px;
padding-top: 22px;
margin-top: 20px;
* {
padding: 0;
margin: 0;
}
}
.title {
display: flex;
align-items: center;
margin: 0 12px 20px;
img {
.bi-icon {
width: 29px;
height: 34px;
height: 32px;
margin-right: 8px;
background-image: url(../img/bi-icon.png);
background-size: contain;
background-repeat: no-repeat;
}
h2 {
font-family: PingFangSC-Semibold, "PingFang SC Semibold", "PingFang SC", sans-serif;
font-weight: 650;
font-style: normal;
font-size: 16px;
color: rgb(0, 0, 0);
line-height: 30px;
}
}
.title {
display: flex;
align-items: center;
margin: 0 12px 20px;
/* 主标题样式扩展 */
.bi-main-title {
display: flex;
align-items: center;
margin: 0 12px 20px;
&-icon {
width: 29px;
height: 34px;
margin-right: 8px;
}
&-heading {
font-family: PingFangSC-Semibold, "PingFang SC Semibold", "PingFang SC", sans-serif;
font-weight: 650;
font-style: normal;
font-size: 16px;
color: rgb(0, 0, 0);
line-height: 30px;
}
}
// .table {
// width: calc(100% - 24px);
// border-collapse: collapse;
// margin: 0 12px 25px;
// }
// .table th,
// .table td {
// text-align: center;
// height: 33px;
// }
// .table th {
// background-color: #f5f5f5;
// font-weight: bold;
// font-family: PingFangSC-Semibold, "PingFang SC Semibold", "PingFang SC", sans-serif;
// font-weight: 650;
// font-style: normal;
// font-size: 14px;
// color: rgb(0, 0, 0);
// }
// .table td {
// color: rgb(51, 51, 51);
// font-size: 14px;
// }
// .table tr:nth-child(even) {
// background-color: rgb(245, 245, 245);
// }
/* 寄托币表格样式扩展 */
.bi-table {
width: calc(100% - 24px);
border-collapse: collapse;
margin: 0 12px 25px;
&-header {
background-color: #f5f5f5;
font-weight: bold;
font-family: PingFangSC-Semibold, "PingFang SC Semibold", "PingFang SC", sans-serif;
font-weight: 650;
font-style: normal;
font-size: 14px;
color: rgb(0, 0, 0);
text-align: center;
height: 33px;
&.bi-table-event {
/* 事件列特殊样式 */
img {
width: 29px;
height: 34px;
margin-right: 8px;
}
&.bi-table-reward {
/* 奖励列特殊样式 */
}
&.bi-table-limit {
/* 上限列特殊样式 */
h2 {
font-family: PingFangSC-Semibold, "PingFang SC Semibold", "PingFang SC", sans-serif;
font-weight: 650;
font-style: normal;
font-size: 16px;
color: rgb(0, 0, 0);
line-height: 30px;
}
}
&-body {
/* 表格主体样式 */
}
.bi-main-title {
display: flex;
align-items: center;
margin: 0 12px 20px;
&-row {
&:nth-child(even) {
background-color: rgb(245, 245, 245);
&-icon {
width: 29px;
height: 34px;
margin-right: 8px;
}
&-heading {
font-family: PingFangSC-Semibold, "PingFang SC Semibold", "PingFang SC", sans-serif;
font-weight: 650;
font-style: normal;
font-size: 16px;
color: rgb(0, 0, 0);
line-height: 30px;
}
}
&-cell {
color: rgb(51, 51, 51);
font-size: 14px;
text-align: center;
height: 33px;
.bi-table {
width: calc(100% - 24px);
border-collapse: collapse;
margin: 0 12px 25px;
&.bi-table-event {
/* 事件单元格样式 */
&-header {
background-color: #f5f5f5;
font-weight: bold;
font-family: PingFangSC-Semibold, "PingFang SC Semibold", "PingFang SC", sans-serif;
font-weight: 650;
font-style: normal;
font-size: 14px;
color: rgb(0, 0, 0);
text-align: center;
height: 33px;
}
&.bi-table-reward {
/* 奖励单元格样式 */
&-row {
&:nth-child(even) {
background-color: rgb(245, 245, 245);
}
}
&.bi-table-limit {
/* 上限单元格样式 */
&-cell {
color: rgb(51, 51, 51);
font-size: 14px;
text-align: center;
height: 33px;
}
}
}
.supplement {
margin: 0 12px 30px;
}
.supplement h3 {
font-weight: bold;
font-size: 14px;
line-height: 25px;
}
.supplement ul {
list-style-type: none;
padding: 0;
margin: 0;
}
.supplement li {
font-size: 14px;
line-height: 25px;
}
/* 补充说明样式扩展 */
.bi-supplement {
margin: 0 12px 30px;
&-title {
.supplement {
margin: 0 12px 30px;
}
.supplement h3 {
font-weight: bold;
font-size: 14px;
line-height: 25px;
}
&-list {
.supplement ul {
list-style-type: none;
padding: 0;
margin: 0;
}
&-item {
.supplement li {
font-size: 14px;
line-height: 25px;
}
}
.divider {
height: 1px;
background-color: #eee;
margin-bottom: 37px;
}
.usage {
display: flex;
flex-direction: column;
margin-bottom: 8px;
}
.usage img {
width: 29px;
height: 34px;
margin-right: 8px;
}
.usage h3 {
font-family: PingFangSC-Semibold, "PingFang SC Semibold", "PingFang SC", sans-serif;
font-weight: 650;
font-style: normal;
font-size: 16px;
color: rgb(0, 0, 0);
line-height: 30px;
}
.usage ul {
list-style-type: none;
padding: 0 0 0 32px;
margin: 0;
}
.usage li {
margin-bottom: 4px;
}
/* 寄托币用途样式扩展 */
.bi-usage {
display: flex;
flex-direction: column;
margin-bottom: 8px;
.bi-supplement {
margin: 0 12px 30px;
&-title {
display: flex;
align-items: center;
margin-bottom: 10px;
&-title {
font-weight: bold;
font-size: 14px;
line-height: 25px;
}
&-list {
list-style-type: none;
padding: 0;
margin: 0;
}
&-item {
font-size: 14px;
line-height: 25px;
}
}
&-icon {
.divider {
height: 1px;
background-color: #eee;
margin-bottom: 37px;
}
.usage {
display: flex;
flex-direction: column;
margin-bottom: 8px;
}
.usage img {
width: 29px;
height: 34px;
margin-right: 8px;
}
&-heading {
.usage h3 {
font-family: PingFangSC-Semibold, "PingFang SC Semibold", "PingFang SC", sans-serif;
font-weight: 650;
font-style: normal;
@@ -244,16 +156,51 @@ body {
color: rgb(0, 0, 0);
line-height: 30px;
}
&-list {
.usage ul {
list-style-type: none;
padding: 0 0 0 32px;
margin: 0;
}
&-item {
.usage li:not(:last-child) {
margin-bottom: 4px;
font-size: 14px;
color: #333;
}
.bi-usage {
display: flex;
flex-direction: column;
margin-bottom: 35px;
&-title {
display: flex;
align-items: center;
margin-bottom: 0 12px 20px;
}
&-icon {
width: 29px;
height: 34px;
margin-right: 8px;
}
&-heading {
font-family: PingFangSC-Semibold, "PingFang SC Semibold", "PingFang SC", sans-serif;
font-weight: 650;
font-style: normal;
font-size: 16px;
color: rgb(0, 0, 0);
line-height: 30px;
}
&-list {
list-style-type: none;
padding: 0 0 0 32px;
margin: 0;
}
&-item {
margin-bottom: 4px;
font-size: 14px;
color: #333;
}
}
}

View File

@@ -7,6 +7,8 @@
margin-bottom: 50px;
}
#details .matter .matter-left {
position: sticky;
z-index: 1;
width: 890px;
margin-right: 20px;
}
@@ -171,6 +173,9 @@
#details .matter .matter-left .html img {
max-width: 100%;
}
#details .matter .matter-left .html video {
margin: 0 auto;
}
#details .matter .matter-left .last-time {
color: #aaaaaa;
font-size: 13px;
@@ -226,7 +231,7 @@
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-top: 8px solid #000000;
border-top: 8px solid #ffffff;
position: absolute;
bottom: -8px;
left: 50%;
@@ -326,10 +331,8 @@
#details .matter .matter-left .related .list .item .text {
width: 352px;
}
#details .matter .sidebar-box.fixed {
position: fixed;
right: calc((100% - 1200px) / 2);
bottom: 10px;
#details .matter .sidebar-box {
position: sticky;
}
#details .matter .sidebar-box .adv {
width: 291px;

View File

@@ -7,6 +7,8 @@
margin-bottom: 50px;
.matter-left {
position: sticky;
z-index: 1;
width: 890px;
margin-right: 20px;
@@ -197,6 +199,10 @@
img {
max-width: 100%;
}
video {
margin: 0 auto;
}
}
.last-time {
@@ -259,7 +265,7 @@
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-top: 8px solid #000000;
border-top: 8px solid #ffffff;
position: absolute;
bottom: -8px;
left: 50%;
@@ -385,11 +391,12 @@
}
.sidebar-box {
&.fixed {
position: fixed;
right: calc((100% - 1200px) / 2);
bottom: 10px;
}
position: sticky;
// &.fixed {
// position: fixed;
// right: calc((100% - 1200px) / 2);
// bottom: 10px;
// }
.adv {
width: 291px;

View File

@@ -474,6 +474,8 @@
}
#appIndex .matter .matter-content {
margin-right: 12px;
position: sticky;
z-index: 1;
}
#appIndex .matter .matter-content .forum-sections-list {
position: relative;
@@ -523,10 +525,8 @@
#appIndex .matter .matter-content .item-box {
margin-bottom: 12px;
}
#appIndex .matter .sidebar.fixed {
position: fixed;
right: calc((100% - 1200px) / 2);
bottom: 10px;
#appIndex .matter .sidebar {
position: sticky;
}
#appIndex .matter .sidebar .ad-item {
display: block;

View File

@@ -565,6 +565,9 @@
.matter-content {
margin-right: 12px;
position: sticky;
z-index: 1;
.forum-sections-list {
position: relative;
width: 897px;
@@ -624,11 +627,12 @@
}
.sidebar {
&.fixed {
position: fixed;
right: calc((100% - 1200px) / 2);
bottom: 10px;
}
position: sticky;
// &.fixed {
// position: fixed;
// right: calc((100% - 1200px) / 2);
// bottom: 10px;
// }
.ad-item {
display: block;

View File

@@ -247,6 +247,27 @@ body {
margin-bottom: 15px;
display: block;
}
.item-box.item-forum .picture {
overflow: auto;
}
.item-box.item-forum .picture .picture-videos {
position: relative;
}
.item-box.item-forum .picture .picture-videos .icon-play {
position: absolute;
left: calc(50% - 5px);
top: 50%;
transform: translate(-50%, -50%);
width: 40px;
}
.item-box.item-forum .picture .picture-item {
height: 100px;
border-radius: 10px;
display: block;
}
.item-box.item-forum .picture .picture-item:not(:last-child) {
margin-right: 10px;
}
.item-box.item-offer {
font-size: 14px;
color: #333333;
@@ -571,7 +592,6 @@ body {
overflow: auto;
}
.item-box.item-tenement .picture .picture-item {
width: 120px;
height: 100px;
border-radius: 10px;
}
@@ -1446,6 +1466,8 @@ body {
.head-top {
margin-top: 20px;
margin-bottom: 30px;
position: relative;
z-index: 2;
}
.head-top .logo {
height: 52px;
@@ -1461,16 +1483,33 @@ body {
margin-right: 20px;
transition: all 0.3s;
position: relative;
overflow: hidden;
}
.head-top .input-box.pitch {
border-color: #000;
}
.head-top .input-box .placeholder-box {
position: absolute;
top: 0;
left: 0;
width: calc(100% - 33px);
height: 100%;
z-index: 1;
}
.head-top .input-box .placeholder-box .item {
height: 100%;
line-height: 40px;
padding: 0 15px;
color: #7f7f7f;
font-size: 14px;
}
.head-top .input-box .input {
border: none;
outline: none;
height: 100%;
background-color: transparent;
font-size: 14px;
z-index: 2;
}
.head-top .input-box .icon {
width: 18px;

View File

@@ -291,6 +291,32 @@ body {
margin-bottom: 15px;
display: block;
}
.picture {
overflow: auto;
.picture-videos {
position: relative;
.icon-play {
position: absolute;
left: calc(50% - 5px);
top: 50%;
transform: translate(-50%, -50%);
width: 40px;
}
}
.picture-item {
// width: 120px;
height: 100px;
border-radius: 10px;
display: block;
&:not(:last-child) {
margin-right: 10px;
}
}
}
}
&.item-offer {
@@ -679,7 +705,7 @@ body {
.picture {
overflow: auto;
.picture-item {
width: 120px;
// width: 120px;
height: 100px;
border-radius: 10px;
@@ -1725,6 +1751,8 @@ body {
.head-top {
margin-top: 20px;
margin-bottom: 30px;
position: relative;
z-index: 2;
.logo {
height: 52px;
@@ -1741,17 +1769,36 @@ body {
margin-right: 20px;
transition: all 0.3s;
position: relative;
overflow: hidden;
&.pitch {
border-color: #000;
}
.placeholder-box {
position: absolute;
top: 0;
left: 0;
width: calc(100% - 33px);
height: 100%;
z-index: 1;
.item {
height: 100%;
line-height: 40px;
padding: 0 15px;
color: #7f7f7f;
font-size: 14px;
}
}
.input {
border: none;
outline: none;
height: 100%;
background-color: transparent;
font-size: 14px;
z-index: 2;
}
.icon {

View File

@@ -62,6 +62,8 @@
}
#search-tag .matter .matter-content {
margin-right: 12px;
position: sticky;
z-index: 1;
}
#search-tag .matter .matter-content .list-box .item-box {
margin-bottom: 12px;
@@ -114,6 +116,7 @@
}
#search-tag .matter .sidebar-box {
width: 291px;
position: sticky;
}
#search-tag .matter .sidebar-box.fixed {
position: fixed;

View File

@@ -68,9 +68,11 @@
.matter {
align-items: flex-start;
.matter-content {
margin-right: 12px;
position: sticky;
z-index: 1;
.list-box {
.item-box {
@@ -135,6 +137,7 @@
.sidebar-box {
width: 291px;
position: sticky;
&.fixed {
position: fixed;

View File

@@ -69,11 +69,8 @@
}
#search .matter .matter-content {
margin-right: 12px;
}
#search .matter .matter-content.fixed {
position: fixed;
left: calc((100% - 1200px) / 2);
bottom: 10px;
position: sticky;
z-index: 1;
}
#search .matter .matter-content .list-box .item-box {
margin-bottom: 12px;
@@ -126,9 +123,5 @@
}
#search .matter .sidebar-box {
width: 291px;
}
#search .matter .sidebar-box.fixed {
position: fixed;
left: calc((100% - 1200px) / 2 + 909px);
bottom: 10px;
position: sticky;
}

View File

@@ -79,12 +79,14 @@
.matter-content {
margin-right: 12px;
position: sticky;
z-index: 1;
&.fixed {
position: fixed;
left: calc((100% - 1200px) / 2);
bottom: 10px;
}
// &.fixed {
// position: fixed;
// left: calc((100% - 1200px) / 2);
// bottom: 10px;
// }
.list-box {
.item-box {
@@ -149,14 +151,15 @@
.sidebar-box {
width: 291px;
position: sticky;
&.fixed {
position: fixed;
// right: calc((100% - 1200px) / 2);
// left: 909px;
left: calc((100% - 1200px) / 2 + 909px);
bottom: 10px;
}
// &.fixed {
// position: fixed;
// // right: calc((100% - 1200px) / 2);
// // left: 909px;
// left: calc((100% - 1200px) / 2 + 909px);
// bottom: 10px;
// }
}
}
}

View File

@@ -198,6 +198,8 @@
}
#sectionIndex .matter .matter-content .details-box .content-box {
margin-right: 12px;
position: sticky;
z-index: 1;
}
#sectionIndex .matter .matter-content .details-box .content-box .selectives-box {
width: 100%;
@@ -321,10 +323,8 @@
color: #7f7f7f;
margin-top: 10px;
}
#sectionIndex .matter .matter-content .details-box .sidebar-box.fixed {
position: fixed;
right: calc((100% - 1200px) / 2);
bottom: 10px;
#sectionIndex .matter .matter-content .details-box .sidebar-box {
position: sticky;
}
#sectionIndex .matter .matter-content .details-box .sidebar-box .adv {
display: block;

View File

@@ -224,6 +224,8 @@
.content-box {
margin-right: 12px;
position: sticky;
z-index: 1;
.selectives-box {
width: 100%;
@@ -372,11 +374,12 @@
// }
.sidebar-box {
&.fixed {
position: fixed;
right: calc((100% - 1200px) / 2);
bottom: 10px;
}
position: sticky;
// &.fixed {
// position: fixed;
// right: calc((100% - 1200px) / 2);
// bottom: 10px;
// }
.adv {
display: block;

BIN
img/videoplay.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -170,7 +170,7 @@
</div>
<item-forum :itemdata="item" v-for="(item, index) in list" :key="index"></item-forum>
</div>
<div class="sidebar">
<div class="sidebar" :style="{'top': sidebarHeight + 'px'}" ref="sidebarRef">
<a class="adv" href="" target="_blank">
<img class="adv-icon" src="https://o.x-php.com/bbs/common/cf/1709075xdbbbvjd8cbxvdd.jpg" alt="26Fall祈福求offer得offer" />
</a>

View File

@@ -1,5 +1,5 @@
// 简单版本的论坛编辑器,确保图片插入功能正常
const { createApp, ref, computed, onMounted, nextTick } = Vue;
const { createApp, ref, computed, onMounted, nextTick, onUnmounted } = Vue;
import { headTop } from "../component/head-top/head-top.js";
const editApp = createApp({
@@ -11,6 +11,14 @@ const editApp = createApp({
cUpload();
init();
// 添加selectionchange事件监听当鼠标选中区域内容时更新lastSelection
document.addEventListener("selectionchange", handleSelectionChange);
});
// 组件卸载时移除事件监听
onUnmounted(() => {
document.removeEventListener("selectionchange", handleSelectionChange);
});
let isLogin = ref(true);
@@ -201,6 +209,8 @@ const editApp = createApp({
let isEmpty = ref(true);
const onEditorInput = (event) => {
console.log("onEditorInput");
const selection = window.getSelection();
if (selection.rangeCount > 0) {
@@ -289,6 +299,22 @@ const editApp = createApp({
isEmpty.value = text.length == 0 && !editorRef.value.querySelector("img");
};
// 处理选中文本变化的函数
const handleSelectionChange = () => {
const selection = window.getSelection();
// 确保有选中内容且选中区域在编辑器内
if (selection.rangeCount > 0) {
const range = selection.getRangeAt(0);
// 检查选中区域是否在编辑器内
const commonAncestor = range.commonAncestorContainer;
if (editorRef.value.contains(commonAncestor)) {
console.log("选中区域在编辑器内", range);
lastSelection = range;
}
}
};
const isPTitle = ref(false);
const paragraphTitle = () => {
@@ -501,7 +527,6 @@ const editApp = createApp({
linkState.value = false;
linkText.value = "";
linkUrl.value = "";
};
const insertLink = () => {
@@ -513,6 +538,10 @@ const editApp = createApp({
a.href = linkUrl.value;
a.target = "_blank";
a.textContent = linkText.value;
console.log("insertLink", lastSelection);
// 先删除选中的内容,再插入链接
lastSelection.deleteContents();
lastSelection.insertNode(a);
// 移动光标到元素后面并确保光标位置被正确设置和获取

View File

@@ -163,6 +163,8 @@ const appIndex = createApp({
// 列表下 滑动到底部 获取新数据
if (scrollTop + clientHeight >= scrollHeight - 40) getList();
sidebarHeight.value = -(sidebarRef.value.offsetHeight - window.innerHeight);
};
let offerlist = ref([]); // offer 列表滚动 数据
@@ -289,7 +291,10 @@ const appIndex = createApp({
BiComponent.initComponent();
};
return { clickbtn, interviewexperience, vote, offer, topicHandpickedList, list, sectionList, popList, custom_2AdvRef, ongoingbj, pastList, offerMouseover, offerMouseout, offerlist, offerListRef };
const sidebarRef = 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 };
},
});

View File

@@ -229,30 +229,37 @@ const appSearch = createApp({
const matterFixed = ref(false);
const handleScroll = () => {
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
const clientHeight = window.innerHeight;
const sideHeight = sidebarRef.value.offsetHeight;
const matterTop = matterRef.value.offsetTop;
const matterHeight = matterContentRef.value.offsetHeight;
matterHeight.value = -(document.querySelector(".matter-content").offsetHeight - window.innerHeight);
sidebarHeight.value = -(document.querySelector(".sidebar-box").offsetHeight - window.innerHeight);
console.log("sideHeight", sideHeight);
console.log("matterHeight", matterHeight);
if (sideHeight < matterHeight) {
// 侧边栏滚动固定
if (scrollTop >= matterTop + sideHeight - clientHeight) sidebarFixed.value = true;
else sidebarFixed.value = false;
} else {
if (scrollTop >= matterTop + matterHeight - clientHeight) matterFixed.value = true;
else matterFixed.value = false;
}
// const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
// const clientHeight = window.innerHeight;
// const sideHeight = sidebarRef.value.offsetHeight;
// const matterTop = matterRef.value.offsetTop;
// const matterHeight = matterContentRef.value.offsetHeight;
// console.log("sideHeight", sideHeight);
// console.log("matterHeight", matterHeight);
// if (sideHeight < matterHeight) {
// // 侧边栏滚动固定
// if (scrollTop >= matterTop + sideHeight - clientHeight) sidebarFixed.value = true;
// else sidebarFixed.value = false;
// } else {
// if (scrollTop >= matterTop + matterHeight - clientHeight) matterFixed.value = true;
// else matterFixed.value = false;
// }
};
const matterRef = ref(null);
const sidebarRef = ref(null);
const matterContentRef = ref(null);
return { matterFixed, matterContentRef, sidebarFixed, matterRef, sidebarRef, loading, typeValue, kwValue, startSearch, kw, maxPage, prevPage, nextPage, tabValue, cutTab, tabList, count, list, page, pagination, cutPage };
let sidebarHeight = ref(0);
let matterHeight = ref(0);
return { matterHeight, sidebarHeight, matterFixed, matterContentRef, sidebarFixed, matterRef, sidebarRef, loading, typeValue, kwValue, startSearch, kw, maxPage, prevPage, nextPage, tabValue, cutTab, tabList, count, list, page, pagination, cutPage };
},
});
appSearch.component("item-forum", itemForum);

View File

@@ -41,7 +41,7 @@
</div>
<div class="matter flexflex">
<div class="matter-content flex1">
<div class="matter-content flex1" :style="{'top': matterHeight + 'px'}">
<div class="list-box" v-if="list.length != 0">
<template v-for="(item,index) in list" :key="index">
<item-offer v-if=" item.type == 'offer'" :itemdata="item"></item-offer>
@@ -68,7 +68,7 @@
<img @click="nextPage" v-else v-else class="arrows" src="./img/arrows-gray-deep.svg" alt="" />
</div>
</div>
<div class="sidebar-box">
<div class="sidebar-box" :style="{'top': sidebarHeight + 'px'}">
<hot-search></hot-search>
<hot-tag></hot-tag>
<slideshow-box></slideshow-box>