no message

This commit is contained in:
A1300399510
2024-01-02 19:03:39 +08:00
parent d7915dd321
commit 5ad39c3e39
9 changed files with 281 additions and 52 deletions

View File

@@ -5,9 +5,11 @@
<Meta name="description" :content="seo['description']" />
</Head>
<Header></Header>
<!-- scrollTopValue -->
<!-- <div class="content flexflex" :style="{ position: scrollTopValue > 88 ? 'fixed' : '' }"> -->
<div class="content flexflex">
<div class="left">
<div class="left" @scroll="handleListScroll">
<div class="school-box flexcenter">
<a class="school-box-icon" :href="info['school']?.['url']" target="_blank"><img class="school-icon" v-if="info['school']?.['image']" :src="info['school']?.['image']" /></a>
<a class="school-name" :href="info['school']?.['url']" target="_blank">{{ info["school"]?.["name"] }}</a>
@@ -20,7 +22,7 @@
个面经
</div>
<div class="mj-list">
<a class="mj-item flexflex" :class="{ pitch: pitchIndex == index }" v-for="(item, index) in relatedlist" :key="index" @click.prevent="handleItem(item['uniqid'])" :href="`./details/${item['uniqid']}`">
<a class="mj-item flexflex" :class="{ pitch: pitchIndex == index }" v-for="(item, index) in relatedlist" :key="index" @click.stop.prevent="handleItem(item['uniqid'])" :href="`./details/${item['uniqid']}`">
<img class="item-bj" src="@/assets/img/item-bj.svg" />
<div class="mj-header flexacenter">
<img class="mj-avatar" :src="item['avatar']" />
@@ -244,7 +246,7 @@
</div>
</div>
<!-- 还有几个 -->
<div class="comments-also flexacenter" v-if="item['childnum'] >= 3 && item['childnum'] > item['child'].length" @click="alsoCommentsData(index)">
<div class="comments-also flexacenter" v-if="item['childnum'] > item['child'].length" @click="alsoCommentsData(index)">
<div class="">还有{{ item["childnum"] - item["child"].length }}条回复</div>
<img class="also-icon" src="@/assets/img/arrow-circular-gray.png" />
</div>
@@ -256,7 +258,7 @@
</div>
</div>
<div class="floor-area flexacenter">
<div class="floor-area flexacenter" v-if="floorAreaState">
<div class="floor-content flexacenter">
<div class="floor-left flexacenter">
<div class="item flexacenter" @click="handleLike">
@@ -327,15 +329,47 @@ let uniqid = route.params.id
onMounted(() => {
// window.addEventListener("scroll", handleScroll)
getDetails()
openObserverBottom()
})
watch(route, () => {
clearAllData()
nextTick(() => getDetails())
})
// watch(route, () => {
// clearAllData()
// nextTick(() => getDetails())
// })
let floorAreaState = ref(false) // 底部操作显示状态
// 开启一个监听最底部是否在可视窗口内
const openObserverBottom = () => {
// 获取目标元素的引用
const target = document.querySelector("section.index-footer")
if (!target) {
openObserverBottom()
return
}
// 创建一个 Intersection Observer 实例
const observer = new IntersectionObserver(
(entries, observer) => {
entries.forEach(entry => {
if (entry.isIntersecting) floorAreaState.value = false
else floorAreaState.value = true
})
},
{
root: null,
threshold: 0.5,
}
)
// 开始观察目标元素
observer.observe(target)
}
// 清空全部数据
const clearAllData = () => {
uniqid = route.params.id
info.value = {}
qrcode.value = ""
iscollection.value = 0
@@ -426,19 +460,31 @@ const CalculateSelectedList = () => {
// 左侧列表数据
let relatedlist = ref([])
let relatedcount = ref(0)
let relatedpage = ref(1)
let relatedloading = false
let pitchIndex = ref(null) // 列表选中 index
const getRelatedlistHttp = () => {
relatedlistHttp({ token, page: 1 }).then(res => {
if (relatedloading || relatedpage.value == 0) return
relatedloading = true
relatedlistHttp({ token, page: relatedpage.value }).then(res => {
if (res.code != 200) return
let data = res.data
relatedlist.value = data.data
relatedlist.value = relatedlist.value.concat(data.data)
relatedcount.value = data.count
// if (data.count > re) relatedpage
// page++
if (relatedlist.value.length >= data["count"]) relatedpage.value = 0
else relatedpage.value++
CalculateSelectedList()
}).finally(() => {
relatedloading = false
})
}
@@ -497,7 +543,18 @@ const alsoCommentsData = (index, ind) => {
}).then(res => {
if (res.code != 200) return
let data = res.data
targetCommentItem.child = targetCommentItem.child.concat(data.data)
let childData = targetCommentItem.child.concat(data.data)
// console.log(childData['id'], "childData")
// childData.forEach(element => {
// console.log(element["id"])
// })
const filteredData = childData.filter((obj, index, self) => {
// 检查当前对象在数组中的第一个索引是否与当前索引相等
return self.findIndex(item => item.id == obj.id) == index
})
targetCommentItem.child = filteredData
targetCommentItem["childnum"] = data.count
if (targetCommentItem.child.length == data["count"]) page = 0
@@ -543,12 +600,18 @@ const commentLike = (index, i) => {
})
}
let scrollTopValue = ref(0)
// 监听滚动到底部
const handleScroll = () => {
return
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop
console.log("scrollTop", scrollTop)
scrollTopValue.value = scrollTop
return
const scrollHeight = document.documentElement.scrollHeight
const clientHeight = document.documentElement.clientHeight
// console.log(scrollTop + clientHeight >= scrollHeight - 40)
@@ -600,7 +663,7 @@ const submitAnswerComments = (index, i) => {
isdisplay.value = true
if (i != null) {
console.log("111", targetCommentList[index]["child"][i])
// console.log("111", targetCommentList[index]["child"][i])
let targetData = {
id: data["commentid"],
@@ -614,7 +677,7 @@ const submitAnswerComments = (index, i) => {
...data,
}
console.log("targetData", targetData)
// console.log("targetData", targetData)
targetCommentList[index]["child"].unshift(targetData)
targetCommentList[index]["childnum"]++
@@ -738,10 +801,11 @@ const router = useRouter()
// 处理点击列表
const handleItem = uni => {
// router.push(`/details/${uni}`)
// return
router.push(`/details/${uni}`)
// return
uniqid = uni
// info.value = {}
info.value["message"] = ""
info.value["subject"] = ""
@@ -782,7 +846,8 @@ const report = token => {
}
provide("reportAlertShow", reportAlertShow)
provide("clearAllData", clearAllData)
provide("getDetails", getDetails)
// seo的
if (process.server) {
try {
@@ -826,7 +891,7 @@ const isBrowser = computed(() => {
// 点击发送信息
const sendMessage = uin => {
console.log("uin", uin)
// console.log("uin", uin)
redirectToExternalWebsite(`https://bbs.gter.net/home.php?mod=space&showmsg=1&uid=${uin}`)
}
@@ -842,6 +907,22 @@ const redirectToExternalWebsite = url => {
link.target = "_blank"
link.click()
}
if (!process.server) {
// watchEffect(() => {
// if (route.path) {
// clearAllData()
// nextTick(() => getDetails())
// }
// })
}
// 全部的启动到底部
const handleListScroll = e => {
const el = e.target
if (el.scrollHeight - el.scrollTop >= el.clientHeight + 40) return
getRelatedlistHttp()
}
</script>
<style lang="less" scoped>
@@ -850,6 +931,11 @@ const redirectToExternalWebsite = url => {
margin: 0 auto 100px;
background: #fff;
border-radius: 15px;
// position: sticky;
// top: 30px;
// left: 50%;
// transform: translateX(-50%);
.left {
width: 376px;
border-right: 16px solid #f6f6f6;
@@ -1096,6 +1182,7 @@ const redirectToExternalWebsite = url => {
.details-value {
color: #000000;
white-space: break-spaces;
word-wrap: break-word;
// width: 693px;
&.date {
font-weight: 900;
@@ -1189,6 +1276,12 @@ const redirectToExternalWebsite = url => {
&::placeholder {
color: #aaaaaa;
}
&::-webkit-scrollbar {
width: 0 !important;
}
scrollbar-width: none;
-ms-overflow-style: none;
}
.post-ok {

View File

@@ -53,7 +53,7 @@
<div class="time-box item-input-box flexacenter">
<el-config-provider :locale="zhCn">
<el-date-picker v-model="info.interviewtime" type="date" placeholder="请选择" size="large" class="flex1 flexacenter" :clear-icon="{}" value-format="YYYY-MM-DD" />
<el-date-picker v-model="info.interviewtime" type="date" placeholder="请选择" size="large" class="flex1 flexacenter" :clear-icon="{}" value-format="YYYY-MM-DD" :disabled-date="setDisabled" />
</el-config-provider>
<img class="calendar-icon" src="@/assets/img/calendar-icon.svg" />
</div>
@@ -110,7 +110,18 @@ import { ElMessage } from "element-plus"
import zhCn from "element-plus/dist/locale/zh-cn.mjs"
const router = useRouter()
let aaa = ref(1703001600000)
const pickerOptions = {
disabledDate(time) {
const today = new Date()
const date = new Date(time)
console.log(date > today)
return date > today
},
}
const setDisabled = time => {
return time.getTime() > Date.now() // 可选历史天、可选当前天、不可选未来天
}
onMounted(() => {
getInit()
@@ -221,7 +232,7 @@ const cutVisible = () => {
// 提交发布
const submit = (status = 1) => {
console.log(info.value)
console.log(info.value, "status", status)
publishSubmitHttp({ info: info.value, token, status }).then(res => {
if (res.code != 200) {
ElMessage.error(res.message)