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

26
app.html Normal file
View File

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>面经</title>
</head>
<body>
<div style="display:none;">
<script type="text/javascript" src="//v1.cnzz.com/z_stat.php?id=1281224882&amp;web_id=1281224882"></script>
<script type="text/javascript">
let _hmt = _hmt || [];
let hmthmt = 11(function () {
let hm = document.createElement("script");
hm.src = "//hm.baidu.com/hm.js?4bd66cbe45a640b607fe46c48f658746";
let s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
</div>
</body>
</html>

55
app.vue
View File

@ -3,11 +3,58 @@
/details/{id} 详情 -->
<template>
<div>
<!-- <NuxtWelcome /> -->
<RouterView :key="$route.fullPath"></RouterView>
</div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<!-- <RouterView :key="$route.fullPath"></RouterView> -->
<RouterView></RouterView>
</template>
<script setup>
const route = useRoute()
watchEffect(() => {
if (typeof window !== "undefined" && route.path) {
if (window._hmt) window._hmt.push(["_trackPageview", route.fullPath])
if (window._czc) {
let location = window.location
let contentUrl = location.pathname + location.hash
let refererUrl = "/"
window._czc.push(["_trackPageview", contentUrl, refererUrl])
window._czc.push(["_setAutoPageview", false])
}
}
})
onMounted(() => {
// determineIsLogin()
})
let isNeedLogin = ref(false) //
//
const determineIsLogin = () => {
let count = 0
let timer = setInterval(() => {
if (Object.keys(window["userInfoWin"]).length !== 0) {
clearInterval(timer)
if (window["userInfoWin"]["uid"]) isNeedLogin.value = false
}
count++
if (count >= 10) clearInterval(timer)
}, 100)
}
//
const goLogin = () => {
if (typeof window === "undefined") return
if (Object.keys(window["userInfoWin"]).length !== 0) {
if (window["userInfoWin"]["uid"]) isNeedLogin.value = false
else ajax_login()
} else ajax_login()
}
provide("isNeedLogin", isNeedLogin)
provide("goLogin", goLogin)
</script>
<style lang="less">
* {

View File

@ -34,13 +34,17 @@ import { useRoute } from "vue-router"
const router = useRouter()
const route = useRoute()
let isNeedLogin = inject("isNeedLogin")
let goLogin = inject("goLogin")
let keyword = ref("")
onMounted(() => {
getHistoricalSearchList()
keyword.value = route.query["keyword"]
})
let clearAllData = inject("clearAllData")
console.log("clearAllData", clearAllData)
let count = ref({})
const getUser = () => {
@ -61,6 +65,11 @@ const goIndex = () => {
}
//
const goPublish = () => {
if (isNeedLogin.value) {
goLogin()
return
}
router.push(`/publish`)
}
@ -117,6 +126,10 @@ let historicalSearchList = ref([]) // 历史记录数据
let MyPopupRef = ref(null)
//
const handleUser = key => {
if (isNeedLogin.value) {
goLogin()
return
}
if (Object.keys(count.value).length === 0) getUser()
MyPopupRef.value.cutMy(key)
}
@ -125,8 +138,8 @@ const handleUser = key => {
<style scoped lang="less">
header.header {
min-width: 1200px;
padding-top: 30px;
margin-bottom: 51px;
padding-top: 42px;
margin-bottom: 40px;
.header-box {
margin: 0 auto;
@ -134,8 +147,8 @@ header.header {
justify-content: space-between;
.logo-icon {
width: 103px;
height: 50px;
// width: 103px;
height: 36px;
cursor: pointer;
}

View File

@ -61,7 +61,7 @@ const handleLike = (uniqid, token) => {
// height: 278px;
background-color: rgb(255, 255, 255);
border-radius: 8px;
padding: 20px 20px 25px;
padding: 20px 19px 25px 20px;
cursor: pointer;
margin-bottom: 20px;
@ -83,11 +83,11 @@ const handleLike = (uniqid, token) => {
.list {
flex-direction: column;
margin-bottom: 16px;
margin-bottom: 14px;
.item {
&:not(:last-of-type) {
margin-bottom: 10px;
margin-bottom: 8px;
}
.item-name {
@ -110,7 +110,7 @@ const handleLike = (uniqid, token) => {
background: #f2f2f2;
border: 1px solid #f6f6f6;
padding: 12px;
margin-bottom: 12px;
margin-bottom: 11px;
transition: all 0.3s;
&:hover {

View File

@ -67,6 +67,7 @@ let props = defineProps({
let show = ref(false)
const router = useRouter()
const route = useRoute()
let MyPopupState = ref("") // collect mj
@ -152,18 +153,14 @@ const closeAllAnonymousState = () => {
}
//
const handleAnonymousState = (token, index, anonymous) => {
console.log("token", token, index)
changeAnonymousHttp({ token, anonymous }).then(res => {
console.log("res", res)
if (res.code != 200) return
publishList[index]["anonymous"] = anonymous
showList.value = [...publishList]
closeAllAnonymousState()
ElMessage({
message: res.message,
type: "success",
})
ElMessage.success(res.message)
})
}
@ -176,9 +173,20 @@ const handleListScroll = e => {
if (MyPopupState.value == "mj") getPublish()
}
let clearAllData = inject("clearAllData")
let getDetails = inject("getDetails")
//
const goDetails = uniqid => {
router.push(`/details/${uniqid}`)
let path = route["path"] || ""
if (path.indexOf("/details/") != -1) {
clearAllData()
nextTick(() => getDetails())
}
router.replace(`/details/${uniqid}`)
show.value = false
MyPopupState.value = ""
}
//stateplay
@ -191,7 +199,6 @@ defineExpose({
//
const cancelCollection = (token, index) => {
MyUserDeleteCollectHttp({ token }).then(res => {
console.log("res", res)
if (res.code != 200) {
ElMessage.error(res.message)
return
@ -200,7 +207,6 @@ const cancelCollection = (token, index) => {
collectList.splice(index, 1)
collectCount.value--
console.log(collectList, "collectList")
showList.value = [...collectList]
})
}

View File

@ -1,5 +1,43 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
ssr: true,
devtools: { enabled: true },
modules: ["@element-plus/nuxt"],
app: {
head: {
link: [{ rel: "stylesheet", href: "//bbs.gter.net/data/cache/style_2_common.css?Z62" }],
script: [
{ src: "https://app.gter.net/bottom?tpl=header&menukey=mj" },
{ src: "https://app.gter.net/bottom?tpl=footer", body: true },
{
src: "//bbs.gter.net/static/js/common.js",
body: true,
charset: "gb2312",
},
{
innerHTML: `
window.userInfoWin = {}
STYLEID = "2";
STATICURL = "static/";
IMGDIR = "https://bbs.gter.net/template/archy_plt8/image";
VERHASH = "Z62";
charset = "gbk";
discuz_uid = "0";
cookiepre = "4B5x_c0ae_";
cookiedomain = "gter.net";
cookiepath = "/";
showusercard = "1";
attackevasive = "0";
disallowfloat = "";
creditnotice = ",";
defaultstyle = "";
REPORTURL = "aHR0cDovL2Jicy5ndGVyLm5ldC9mb3J1bS5waHA/dGlkPTI0MDYzNTYmZ290bz1sYXN0cG9zdA==";
SITEURL = "https://ask.gter.net/";
JSPATH = "static/js/";`,
type: "text/javascript",
charset: "utf-8",
},
],
},
},
})

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)

View File

@ -10,7 +10,7 @@ axios.defaults.withCredentials = true
axios.interceptors.request.use( //响应拦截
async config => {
// 开发时登录用的,可以直接替换小程序的 authorization
config['headers']['authorization'] = "pa5o1v493ed5mahrcio66267e2"
// config['headers']['authorization'] = "pa5o1v493ed5mahrcio66267e2"
return config;
},
error => {
@ -40,13 +40,7 @@ axios.interceptors.response.use(response => {
*/
const get = (url, params) => {
return new Promise((resolve, reject) => {
axios.get(url, {
params,
}).then(res => {
resolve(res.data);
}).catch(err => {
reject(err.data)
})
axios.get(url, { params }).then(res => resolve(res.data)).catch(err => reject(err.data))
});
}
/**
@ -58,6 +52,7 @@ const post = (url, params) => {
return new Promise((resolve, reject) => {
//是将对象 序列化成URL的形式以&进行拼接
axios.post(url, QS.stringify(params)).then(res => resolve(res.data)).catch(err => {
// console.log(err, "err");
if (err.data.code == 401) resolve(err.data);
else reject(err.data)
})