no message

This commit is contained in:
A1300399510 2023-12-25 18:39:49 +08:00
parent 4607702bdc
commit c80cee6eb0
11 changed files with 879 additions and 389 deletions

View File

@ -5,7 +5,7 @@
<template> <template>
<div> <div>
<!-- <NuxtWelcome /> --> <!-- <NuxtWelcome /> -->
<RouterView></RouterView> <RouterView :key="$route.fullPath"></RouterView>
</div> </div>
</template> </template>

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="empty-box flexcenter"> <div class="empty-box-list flexcenter">
<div class="dot-list flexacenter"> <div class="dot-list flexacenter">
<img class="item" src="@/assets/img/dot-yellow.svg" /> <img class="item" src="@/assets/img/dot-yellow.svg" />
<img class="item" src="@/assets/img/dot-yellow.svg" /> <img class="item" src="@/assets/img/dot-yellow.svg" />
@ -20,7 +20,7 @@ let props = defineProps({
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.empty-box { .empty-box-list {
// width: 690px; // width: 690px;
// height: 490px; // height: 490px;
background-color: #ffffff; background-color: #ffffff;

View File

@ -14,8 +14,8 @@
</div> </div>
</div> </div>
<div class="my-btn-list flexacenter"> <div class="my-btn-list flexacenter">
<div class="my-btn-item flexcenter">我的收藏</div> <div class="my-btn-item flexcenter" @click="handleUser('collect')">我的收藏</div>
<div class="my-btn-item flexcenter">我的面经</div> <div class="my-btn-item flexcenter" @click="handleUser('mj')">我的面经</div>
</div> </div>
<div class="sponsor-btn flexcenter" @click="goPublish"> <div class="sponsor-btn flexcenter" @click="goPublish">
<img class="add-icon" src="@/assets/img/add-icon.svg" /> <img class="add-icon" src="@/assets/img/add-icon.svg" />
@ -25,8 +25,7 @@
</div> </div>
</header> </header>
<MyPopup v-if="false"></MyPopup> <MyPopup ref="MyPopupRef" :count="count"></MyPopup>
</template> </template>
<script setup> <script setup>
@ -37,15 +36,16 @@ let keyword = ref("")
onMounted(() => { onMounted(() => {
getHistoricalSearchList() getHistoricalSearchList()
getUser() // getUser()
}) })
let count = ref({})
const getUser = () => { const getUser = () => {
MyUserInfoHttp().then(res => { MyUserInfoHttp().then(res => {
if (res.code != 200) return if (res.code != 200) return
let data = res.data let data = res.data
console.log("data", data) count.value = data["count"]
let count = data['count']
}) })
} }
@ -82,7 +82,7 @@ const setHistoricalSearchList = () => {
// //
const searchClick = () => { const searchClick = () => {
router.push(`/index.html?keyword=${keyword.value}`) router.push(`/index.html?keyword=${keyword.value || ""}`)
setHistoricalSearchList() setHistoricalSearchList()
searchBlur() searchBlur()
} }
@ -111,6 +111,14 @@ const handleClickClear = () => {
let historicalSearchState = ref(false) // let historicalSearchState = ref(false) //
let historicalSearchList = ref([]) // let historicalSearchList = ref([]) //
let MyPopupRef = ref(null)
//
const handleUser = key => {
if (Object.keys(count.value).length === 0) getUser()
MyPopupRef.value.cutMy(key)
}
</script> </script>
<style scoped lang="less"> <style scoped lang="less">

View File

@ -1,44 +1,53 @@
<template> <template>
<div class="popup-mask flexcenter"> <el-dialog v-model="show" width="750px" align-center class="dialog-box">
<!-- <div class="popup-mask flexcenter"> -->
<div class="box flexflex"> <div class="box flexflex">
<img class="cross" src="@/assets/img/cross-icon.png" alt @click="cutMy('')" />
<div class="tba-list flexcenter"> <div class="tba-list flexcenter">
<div class="tab-item pitch flexcenter"> <div class="tab-item flexcenter" :class="{ pitch: MyPopupState == 'collect' }" @click="cutMy('collect')">
我的收藏 我的收藏
<div class="value">12</div> <div class="value">{{ count["collect"] }}</div>
</div> </div>
<div class="tab-item flexcenter"> <div class="tab-item flexcenter" :class="{ pitch: MyPopupState == 'mj' }" @click="cutMy('mj')">
我的面经 我的面经
<div class="value">12</div> <div class="value">{{ count["publish"] }}</div>
</div> </div>
</div> </div>
<div class="empty-box flexcenter" v-if="false"><Empty></Empty></div> <div class="empty-box flexcenter" v-if="showList.length == 0">
<div class="content"> <Empty></Empty>
<div class="item flexflex" v-for="(item, index) in 10" :key="index"> </div>
<div class="content" v-else @scroll="handleListScroll">
<div class="item flexflex" v-for="(item, index) in showList" :key="index" @click="goDetails(item['uniqid'])">
<div class="left flexflex"> <div class="left flexflex">
<div class="name">香港理工大学</div> <div class="name">{{ item["school"] }}</div>
<div class="info-box flexflex"> <div class="info-box flexflex">
<div class="info-item flexacenter" v-for="item in 2" :key="item"> <div class="info-item flexacenter" v-if="item['profession']">
<div class="info-item-name">专业</div> <div class="info-item-name">专业</div>
<div class="info-item-value">Electrical and Electronics Engineering</div> <div class="info-item-value">{{ item["profession"] }}</div>
</div>
<div class="info-item flexacenter" v-if="item['project']">
<div class="info-item-name">项目</div>
<div class="info-item-value">{{ item["project"] }}</div>
</div> </div>
</div> </div>
<div class="text-box flexacenter"> <div class="text-box flexacenter">
我是本专业+跨专业申请中大是直接给了推研所没啥经验分享主要是港大和港科的面经 <div class="text-time">1小时前发布</div>
<div class="text-message flex1 ellipsis">{{ item["message"] }}</div>
</div> </div>
</div> </div>
<div class="operate-area flexacenter"> <div class="operate-area flexacenter">
<!-- <img class="delete-icon" src="@/assets/img/delete-icon.svg" /> --> <img class="delete-icon" v-if="MyPopupState == 'collect'" src="@/assets/img/delete-icon.svg" />
<div class="anonymous-box flexacenter"> <div class="anonymous-box flexacenter" v-else @click="openAnonymousState(index)">
<div class="text">公开</div> <div class="text">{{ item["anonymous"] == 1 ? "匿名" : "公开" }}</div>
<img class="arrow-icon" src="@/assets/img/arrow-gray.svg" /> <img class="arrow-icon" src="@/assets/img/arrow-gray.svg" />
<div class="state-popup flexflex" v-if="false"> <div class="state-popup flexflex" v-if="item['anonymousState']" @click.stop="">
<div class="state-popup-item flexacenter flex1 pitch"> <div class="state-popup-item flexacenter flex1" :class="{ 'pitch': item['anonymous'] == 0 }" @click="handleAnonymousState(item['token'], index)">
<div class="">公开发表</div> <div class>公开发表</div>
<img class="state-popup-icon" src="@/assets/img/tick-green.svg" /> <img class="state-popup-icon" src="@/assets/img/tick-green.svg" />
</div> </div>
<div class="state-popup-item flexacenter flex1"> <div class="state-popup-item flexacenter flex1" :class="{ 'pitch': item['anonymous'] == 1 }" @click="handleAnonymousState(item['token'], index)">
<div class="">匿名发表</div> <div class>匿名发表</div>
<img class="state-popup-icon" src="@/assets/img/tick-green.svg" /> <img class="state-popup-icon" src="@/assets/img/tick-green.svg" />
</div> </div>
</div> </div>
@ -47,9 +56,106 @@
</div> </div>
</div> </div>
</div> </div>
</div> </el-dialog>
<!-- </div> -->
</template> </template>
<script setup></script> <script setup>
let props = defineProps({
// MyPopupState: String, // collect mj
count: Object,
})
let show = ref(false)
const router = useRouter()
let MyPopupState = ref("") // collect mj
onMounted(() => {
// if (MyPopupState.value == "collect") getCollect();
// else if (MyPopupState.value == "mj") getPublish();
})
//
let showList = ref([])
let collectList = []
const getCollect = () => {
MyUserCollectHttp({}).then(res => {
if (res.code != 200) return
let data = res.data
collectList = collectList.concat(data.data)
showList.value = collectList
})
}
let publishList = []
let publisPage = 1
let publisloading = false
const getPublish = () => {
if (publisPage == 0 && !publisloading) return
publisloading = true
MyUserPublishHttp({ limit: 4, page: publisPage })
.then(res => {
if (res.code != 200) return
let data = res.data
publishList = publishList.concat(data.data)
if (publishList.length < data["count"]) publisPage++
else publisPage = 0
showList.value = publishList
})
.finally(() => (publisloading = false))
}
//
const cutMy = key => {
if (key == "collect" && collectList.length == 0) getCollect()
else if (key == "mj" && publishList.length == 0) getPublish()
if (key == "collect") showList.value = collectList
else if (key == "mj") showList.value = publishList
MyPopupState.value = key
if (MyPopupState.value) show.value = true
else show.value = false
}
//
const openAnonymousState = index => {
publishList.forEach(element => {
element["anonymousState"] = false
})
publishList[index]["anonymousState"] = true
showList.value = [...publishList]
}
//
const handleAnonymousState = (token, index) => {
console.log("token", token, index)
}
//
const handleListScroll = e => {
const el = e.target
//
if (el.scrollHeight - el.scrollTop !== el.clientHeight) return
if (MyPopupState.value == "collect") getCollect()
if (MyPopupState.value == "mj") getPublish()
}
//
const goDetails = uniqid => {
router.push(`/details/${uniqid}`)
}
//stateplay
defineExpose({
cutMy,
})
// const emit = defineEmits(["cutMy"]);
</script>
<style lang="less" scoped> <style lang="less" scoped>
.popup-mask { .popup-mask {
width: 100vw; width: 100vw;
@ -62,7 +168,9 @@
max-height: none; max-height: none;
border: none; border: none;
outline: none; outline: none;
.box { z-index: 1;
}
.box {
width: 750px; width: 750px;
height: 606px; height: 606px;
background-color: rgba(255, 255, 255, 1); background-color: rgba(255, 255, 255, 1);
@ -72,6 +180,16 @@
box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.117647058823529); box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.117647058823529);
flex-direction: column; flex-direction: column;
padding: 30px 30px 46px; padding: 30px 30px 46px;
position: relative;
.cross {
position: absolute;
top: 12px;
right: 12px;
width: 12px;
height: 12px;
cursor: pointer;
}
.tba-list { .tba-list {
font-size: 16px; font-size: 16px;
@ -119,7 +237,7 @@
// background: #000000; // background: #000000;
overflow: auto; overflow: auto;
padding-right: 10px; padding-right: 10px;
padding-bottom: 20px; padding-bottom: 35px;
.item { .item {
// flex-direction: column; // flex-direction: column;
border-bottom: 1px dotted #ebebeb; border-bottom: 1px dotted #ebebeb;
@ -172,11 +290,24 @@
.text-box { .text-box {
width: 580px; width: 580px;
height: 45px; height: 45px;
line-height: 45px;
background-color: rgba(246, 246, 246, 1); background-color: rgba(246, 246, 246, 1);
border-radius: 5px; border-radius: 5px;
color: #000000; color: #000000;
font-size: 13px; font-size: 13px;
padding: 0 16px; padding: 0 16px;
.text-time {
color: #7f7f7f;
padding-right: 16px;
position: relative;
&::after {
content: "|";
position: absolute;
right: 8px;
color: #d7d7d7;
}
}
} }
} }
.operate-area { .operate-area {
@ -246,6 +377,18 @@
} }
} }
} }
}
</style>
<style lang="less">
.dialog-box {
header {
display: none;
}
border-radius: 10px;
.el-dialog__body {
padding: 0;
} }
} }
</style> </style>

View File

@ -30,11 +30,11 @@ export const detailsCommentListHttp = query => {
} }
// 详情数据 - 获取子评论数据 // 详情数据 - 获取子评论数据
export const detailsChildCommentListHttp = query => { export const detailsChildCommentListHttp = query => {
return Http.post("https://ask.gter.net/api/comment/childrenList", query) return Http.post("/api/comment/childrenList", query)
} }
// 详情数据 - 提交评论 // 详情数据 - 提交评论
export const detailsSubmitommentListHttp = query => { export const detailsSubmitommentListHttp = query => {
return Http.post("https://ask.gter.net/api/comment/submit", query) return Http.post("/api/comment/submit", query)
} }
// 发布相关 - 发布问题初始化,编辑 // 发布相关 - 发布问题初始化,编辑
@ -42,6 +42,11 @@ export const publishInitHttp = query => {
return Http.post("/api/publish", query) return Http.post("/api/publish", query)
} }
// 发布相关 - 发布问题初始化,编辑
export const publishSchoolSearchHttp = query => {
return Http.post("https://offer.gter.net/miniprogram/InterviewExperience/schoolSearch", query)
}
// 我的 - 用户信息 // 我的 - 用户信息
export const MyUserInfoHttp = query => { export const MyUserInfoHttp = query => {
return Http.post("/api/user", query) return Http.post("/api/user", query)
@ -51,3 +56,8 @@ export const MyUserInfoHttp = query => {
export const MyUserPublishHttp = query => { export const MyUserPublishHttp = query => {
return Http.post("/api/user/publish", query) return Http.post("/api/user/publish", query)
} }
// 数据操作 - 收藏
export const MyUserCollectHttp = query => {
return Http.post("/api/user/collect", query)
}

229
package-lock.json generated
View File

@ -7,7 +7,9 @@
"name": "nuxt-app", "name": "nuxt-app",
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
"masonry-layout": "^4.2.2" "axios": "^1.6.2",
"masonry-layout": "^4.2.2",
"qs": "^6.11.2"
}, },
"devDependencies": { "devDependencies": {
"@element-plus/nuxt": "^1.0.7", "@element-plus/nuxt": "^1.0.7",
@ -3912,6 +3914,11 @@
"integrity": "sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==", "integrity": "sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==",
"dev": true "dev": true
}, },
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"node_modules/autoprefixer": { "node_modules/autoprefixer": {
"version": "10.4.16", "version": "10.4.16",
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.16.tgz", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.16.tgz",
@ -3949,6 +3956,16 @@
"postcss": "^8.1.0" "postcss": "^8.1.0"
} }
}, },
"node_modules/axios": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz",
"integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==",
"dependencies": {
"follow-redirects": "^1.15.0",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
},
"node_modules/b4a": { "node_modules/b4a": {
"version": "1.6.4", "version": "1.6.4",
"resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz", "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz",
@ -4216,6 +4233,19 @@
"url": "https://github.com/sponsors/isaacs" "url": "https://github.com/sponsors/isaacs"
} }
}, },
"node_modules/call-bind": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz",
"integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==",
"dependencies": {
"function-bind": "^1.1.2",
"get-intrinsic": "^1.2.1",
"set-function-length": "^1.1.1"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/camelcase": { "node_modules/camelcase": {
"version": "6.3.0", "version": "6.3.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
@ -4518,6 +4548,17 @@
"integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==",
"dev": true "dev": true
}, },
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/commander": { "node_modules/commander": {
"version": "7.2.0", "version": "7.2.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
@ -4904,6 +4945,19 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/define-data-property": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz",
"integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==",
"dependencies": {
"get-intrinsic": "^1.2.1",
"gopd": "^1.0.1",
"has-property-descriptors": "^1.0.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/define-lazy-prop": { "node_modules/define-lazy-prop": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",
@ -4919,6 +4973,14 @@
"integrity": "sha512-Vy2wmG3NTkmHNg/kzpuvHhkqeIx3ODWqasgCRbKtbXEN0G+HpEEv9BtJLp7ZG1CZloFaC41Ah3ZFbq7aqCqMeQ==", "integrity": "sha512-Vy2wmG3NTkmHNg/kzpuvHhkqeIx3ODWqasgCRbKtbXEN0G+HpEEv9BtJLp7ZG1CZloFaC41Ah3ZFbq7aqCqMeQ==",
"dev": true "dev": true
}, },
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/delegates": { "node_modules/delegates": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
@ -5407,6 +5469,25 @@
"integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==",
"dev": true "dev": true
}, },
"node_modules/follow-redirects": {
"version": "1.15.3",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz",
"integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==",
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
"engines": {
"node": ">=4.0"
},
"peerDependenciesMeta": {
"debug": {
"optional": true
}
}
},
"node_modules/foreground-child": { "node_modules/foreground-child": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz",
@ -5435,6 +5516,19 @@
"url": "https://github.com/sponsors/isaacs" "url": "https://github.com/sponsors/isaacs"
} }
}, },
"node_modules/form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/fraction.js": { "node_modules/fraction.js": {
"version": "4.3.7", "version": "4.3.7",
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz", "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz",
@ -5507,7 +5601,6 @@
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"dev": true,
"funding": { "funding": {
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
@ -5550,6 +5643,20 @@
"node": "6.* || 8.* || >= 10.*" "node": "6.* || 8.* || >= 10.*"
} }
}, },
"node_modules/get-intrinsic": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz",
"integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==",
"dependencies": {
"function-bind": "^1.1.2",
"has-proto": "^1.0.1",
"has-symbols": "^1.0.3",
"hasown": "^2.0.0"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-port-please": { "node_modules/get-port-please": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/get-port-please/-/get-port-please-3.1.1.tgz", "resolved": "https://registry.npmjs.org/get-port-please/-/get-port-please-3.1.1.tgz",
@ -5694,6 +5801,17 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/gopd": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
"integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
"dependencies": {
"get-intrinsic": "^1.1.3"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/graceful-fs": { "node_modules/graceful-fs": {
"version": "4.2.11", "version": "4.2.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
@ -5740,6 +5858,39 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/has-property-descriptors": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz",
"integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==",
"dependencies": {
"get-intrinsic": "^1.2.2"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
"integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-symbols": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-unicode": { "node_modules/has-unicode": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
@ -5756,7 +5907,6 @@
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz",
"integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==",
"dev": true,
"dependencies": { "dependencies": {
"function-bind": "^1.1.2" "function-bind": "^1.1.2"
}, },
@ -6791,6 +6941,25 @@
"node": ">=10.0.0" "node": ">=10.0.0"
} }
}, },
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dependencies": {
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mimic-fn": { "node_modules/mimic-fn": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",
@ -7740,6 +7909,14 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/object-inspect": {
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
"integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/ofetch": { "node_modules/ofetch": {
"version": "1.3.3", "version": "1.3.3",
"resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.3.3.tgz", "resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.3.3.tgz",
@ -8588,6 +8765,11 @@
"integrity": "sha512-/XJ368cyBJ7fzLMwLKv1e4vLxOju2MNAIokcr7meSaNcVbWz/CPcW22cP04mwxOErdA5mwjA8Q6w/cdAQxVn7Q==", "integrity": "sha512-/XJ368cyBJ7fzLMwLKv1e4vLxOju2MNAIokcr7meSaNcVbWz/CPcW22cP04mwxOErdA5mwjA8Q6w/cdAQxVn7Q==",
"dev": true "dev": true
}, },
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
},
"node_modules/prr": { "node_modules/prr": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
@ -8595,6 +8777,20 @@
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"node_modules/qs": {
"version": "6.11.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz",
"integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==",
"dependencies": {
"side-channel": "^1.0.4"
},
"engines": {
"node": ">=0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/queue-microtask": { "node_modules/queue-microtask": {
"version": "1.2.3", "version": "1.2.3",
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
@ -9238,6 +9434,20 @@
"integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
"dev": true "dev": true
}, },
"node_modules/set-function-length": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz",
"integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==",
"dependencies": {
"define-data-property": "^1.1.1",
"get-intrinsic": "^1.2.1",
"gopd": "^1.0.1",
"has-property-descriptors": "^1.0.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/setprototypeof": { "node_modules/setprototypeof": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
@ -9274,6 +9484,19 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/side-channel": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
"dependencies": {
"call-bind": "^1.0.0",
"get-intrinsic": "^1.0.2",
"object-inspect": "^1.9.0"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/signal-exit": { "node_modules/signal-exit": {
"version": "3.0.7", "version": "3.0.7",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",

View File

@ -19,6 +19,8 @@
"vue-router": "^4.2.5" "vue-router": "^4.2.5"
}, },
"dependencies": { "dependencies": {
"masonry-layout": "^4.2.2" "axios": "^1.6.2",
"masonry-layout": "^4.2.2",
"qs": "^6.11.2"
} }
} }

View File

@ -9,9 +9,7 @@
<div class="content flexflex"> <div class="content flexflex">
<div class="left"> <div class="left">
<div class="school-box flexcenter"> <div class="school-box flexcenter">
<a :href="info['school']?.['url']" target="_blank"> <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>
<img class="school-icon" :src="info['school']?.['image']" />
</a>
<a class="school-name" :href="info['school']?.['url']" target="_blank">{{ info["school"]?.["name"] }}</a> <a class="school-name" :href="info['school']?.['url']" target="_blank">{{ info["school"]?.["name"] }}</a>
<a class="school-en-name" :href="info['school']?.['url']" target="_blank">{{ info["school"]?.["enname"] }}</a> <a class="school-en-name" :href="info['school']?.['url']" target="_blank">{{ info["school"]?.["enname"] }}</a>
</div> </div>
@ -22,7 +20,7 @@
个面经 个面经
</div> </div>
<div class="mj-list"> <div class="mj-list">
<div class="mj-item flexflex" :class="{pitch: pitchIndex == index}" v-for="(item, index) in relatedlist" :key="index" @click="handleItem(item['uniqid'])"> <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']}`">
<img class="item-bj" src="@/assets/img/item-bj.svg" /> <img class="item-bj" src="@/assets/img/item-bj.svg" />
<div class="mj-header flexacenter"> <div class="mj-header flexacenter">
<img class="mj-avatar" :src="item['avatar']" /> <img class="mj-avatar" :src="item['avatar']" />
@ -44,7 +42,7 @@
<div class="info-value flex1 ellipsis">{{ item["interviewtime"] }}</div> <div class="info-value flex1 ellipsis">{{ item["interviewtime"] }}</div>
</div> </div>
</div> </div>
</div> </a>
</div> </div>
</div> </div>
<div class="right flex1"> <div class="right flex1">
@ -58,7 +56,7 @@
</div> </div>
<div class="mj-header-right flexacenter"> <div class="mj-header-right flexacenter">
<img class="eye-icon" src="@/assets/img/eye-icon.svg" /> <img class="eye-icon" src="@/assets/img/eye-icon.svg" />
96 {{ info["views"] }}
</div> </div>
</div> </div>
</div> </div>
@ -93,7 +91,7 @@
<div class="details-top">面试过程及内容</div> <div class="details-top">面试过程及内容</div>
<div class="details-list"> <div class="details-list">
<div class="details-list-item flexacenter"> <div class="details-list-item flexacenter">
<div class="details-value describe" :class="{'unlock-unlock': !isdisplay}" v-if="info['message']"> <div class="details-value describe" :class="{ 'unlock-unlock': !isdisplay }" v-if="info['message']">
{{ info["message"] }} {{ info["message"] }}
<div class="unlock-mask flexflex"> <div class="unlock-mask flexflex">
<div class="">作者设置了浏览限制</div> <div class="">作者设置了浏览限制</div>
@ -112,13 +110,19 @@
<div class="comment-box"> <div class="comment-box">
<div class="comment-title flexacenter"> <div class="comment-title flexacenter">
讨论 讨论
<div class="value">{{ commentCount }}</div> <div class="value">{{ commentCount || "" }}</div>
</div> </div>
<div class="post-comment flexacenter"> <div class="post-comment flexacenter">
<textarea class="post-input flex1" placeholder="说说你的想法或疑问…" v-model="commentInputTop"></textarea> <textarea class="post-input flex1" placeholder="说说你的想法或疑问…" v-model="commentInputTop"></textarea>
<div class="post-ok flexcenter" @click="submitAnswerComments">OK</div> <div class="post-ok flexcenter" @click="submitAnswerComments()">发送</div>
</div> </div>
<template v-if="isEmptyState">
<div class="empty-box">
<Empty hint="说说你的观点吧"></Empty>
</div>
</template>
<template v-else>
<div class="comment-list"> <div class="comment-list">
<div class="comment-item flexflex" v-for="(item, index) in commentList" :key="index"> <div class="comment-item flexflex" v-for="(item, index) in commentList" :key="index">
<img class="comment-avatar" :src="item['avatar']" /> <img class="comment-avatar" :src="item['avatar']" />
@ -197,8 +201,8 @@
</div> </div>
</div> </div>
</div> </div>
<div class="comment-end" v-if="commentPage == 0 && commentList.length != 0">· End ·</div> <div class="comment-end" v-if="commentPage == 0 && commentList.length != 0">· End ·</div>
</template>
</div> </div>
</div> </div>
@ -264,6 +268,7 @@
</template> </template>
<script setup> <script setup>
import { ElMessage } from "element-plus"
const route = useRoute() const route = useRoute()
let uniqid = route.params.id let uniqid = route.params.id
@ -273,6 +278,34 @@ onMounted(() => {
getDetails() getDetails()
}) })
watch(route, () => {
clearAllData()
nextTick(() => getDetails())
})
//
const clearAllData = () => {
info.value = {}
qrcode.value = ""
iscollection.value = 0
isdisplay.value = true
islike.value = 0
ismyself.value = 0
relatedlist.value = []
relatedcount.value = 0
pitchIndex.value = null
seo.value = {}
commentCount.value = 0
commentPage.value = 1
commentList.value = []
commentLoading = false
token = ""
}
let floorRightState = ref(false) // let floorRightState = ref(false) //
const handleFloorRight = value => { const handleFloorRight = value => {
@ -290,7 +323,7 @@ let islike = ref(0) // 是否点赞
let ismyself = ref(0) // let ismyself = ref(0) //
const getDetails = () => { const getDetails = () => {
detailsHttp({uniqid}).then(res => { detailsHttp({ uniqid }).then(res => {
if (res.code != 200) return if (res.code != 200) return
let data = res.data let data = res.data
token = data["token"] token = data["token"]
@ -303,7 +336,6 @@ const getDetails = () => {
qrcode.value = data["share"]["qrcode"] qrcode.value = data["share"]["qrcode"]
getCommentListHttp() getCommentListHttp()
if (relatedlist.value.length == 0) getRelatedlistHttp() if (relatedlist.value.length == 0) getRelatedlistHttp()
else CalculateSelectedList() else CalculateSelectedList()
}) })
@ -339,7 +371,7 @@ let relatedcount = ref(0)
let pitchIndex = ref(null) // index let pitchIndex = ref(null) // index
const getRelatedlistHttp = () => { const getRelatedlistHttp = () => {
relatedlistHttp({token, page: 1}).then(res => { relatedlistHttp({ token, page: 1 }).then(res => {
if (res.code != 200) return if (res.code != 200) return
let data = res.data let data = res.data
@ -357,15 +389,16 @@ let commentPage = ref(1)
let commentList = ref([]) let commentList = ref([])
let commentLoading = false let commentLoading = false
let token = "" let token = ""
let isEmptyState = ref(false) //
// //
const getCommentListHttp = () => { const getCommentListHttp = () => {
console.log(commentPage.value, "commentPage.value")
if (commentPage.value == 0 || commentLoading) return if (commentPage.value == 0 || commentLoading) return
commentLoading = true commentLoading = true
detailsCommentListHttp({ detailsCommentListHttp({
page: commentPage.value, // page: commentPage.value,
childlimit: 1, // childlimit: 1,
limit: commentPage.value == 1 ? 3 : 10, // limit: commentPage.value == 1 ? 3 : 10,
token, token,
}) })
.then(res => { .then(res => {
@ -374,6 +407,9 @@ const getCommentListHttp = () => {
let data = res.data let data = res.data
commentCount.value = data["count"] commentCount.value = data["count"]
if (data["count"] == 0) isEmptyState.value = true
else isEmptyState.value = false
commentList.value = commentList.value.concat(data["data"]) commentList.value = commentList.value.concat(data["data"])
if (commentList.value.length == data["count"]) commentPage.value = 0 if (commentList.value.length == data["count"]) commentPage.value = 0
@ -386,9 +422,7 @@ const getCommentListHttp = () => {
const alsoCommentsData = (index, ind) => { const alsoCommentsData = (index, ind) => {
// const targetAnswerList = [...answerList.value] // const targetAnswerList = [...answerList.value]
// console.log(commentList.value[index]) let targetCommentItem = { ...commentList.value[index] }
let targetCommentItem = {...commentList.value[index]}
console.log(targetCommentItem, "targetCommentItem")
const token = targetCommentItem["token"] const token = targetCommentItem["token"]
const parentid = targetCommentItem["id"] const parentid = targetCommentItem["id"]
let page = targetCommentItem["childPage"] ?? 1 let page = targetCommentItem["childPage"] ?? 1
@ -402,14 +436,12 @@ const alsoCommentsData = (index, ind) => {
}).then(res => { }).then(res => {
if (res.code != 200) return if (res.code != 200) return
let data = res.data let data = res.data
// console.log("data", data)
targetCommentItem.child = targetCommentItem.child.concat(data.data) targetCommentItem.child = targetCommentItem.child.concat(data.data)
targetCommentItem["childnum"] = data.count targetCommentItem["childnum"] = data.count
if (targetCommentItem.child.length == data["count"]) page = 0 if (targetCommentItem.child.length == data["count"]) page = 0
else page++ else page++
targetCommentItem["childPage"] = page targetCommentItem["childPage"] = page
commentList.value[index] = targetCommentItem commentList.value[index] = targetCommentItem
@ -457,17 +489,20 @@ let commentInput = ref("")
// - // -
const submitAnswerComments = (index, i) => { const submitAnswerComments = (index, i) => {
console.log(index, "index")
// answerList.value[index]['commentState'] = true // answerList.value[index]['commentState'] = true
const targetCommentList = [...commentList.value] const targetCommentList = [...commentList.value]
let content = "" let content = ""
let parentid = 0 let parentid = null
let token = targetCommentList[index]["token"] let targetToken = ""
if (index) targetToken = targetCommentList[index]["token"]
console.log("index", index, targetCommentList[index]) else targetToken = token
if (index == null) content = commentInputTop.value if (index == null) content = commentInputTop.value
else content = commentInput.value else content = commentInput.value
console.log("content", content)
if (i != null) { if (i != null) {
parentid = targetCommentList[index]["child"][i]["id"] parentid = targetCommentList[index]["child"][i]["id"]
} else if (index != null) { } else if (index != null) {
@ -478,15 +513,13 @@ const submitAnswerComments = (index, i) => {
detailsSubmitommentListHttp({ detailsSubmitommentListHttp({
content, content,
token, token: targetToken,
parentid, // parentid,
}).then(res => { }).then(res => {
if (res.code != 200) return if (res.code != 200) return
let data = res.data let data = res.data
console.log("data", data) console.log("data", data)
return
if (i != null) { if (i != null) {
let targetData = { let targetData = {
id: data["commentid"], id: data["commentid"],
@ -495,25 +528,13 @@ const submitAnswerComments = (index, i) => {
islike: 0, islike: 0,
likenum: 0, likenum: 0,
reply: { reply: {
nickname: targetAnswerList[index]["commentList"][ind]["child"][i]["nickname"], nickname: targetCommentList[index]["child"][i]["nickname"],
}, },
...data, ...data,
} }
targetAnswerList[index]["commentList"][ind]["child"].unshift(targetData) targetCommentList[index]["child"].unshift(targetData)
targetAnswerList[index]["commentList"][ind]["childnum"]++ targetCommentList[index]["childnum"]++
} else if (ind != null) {
let targetData = {
id: data["commentid"],
content,
isauthor: 1,
islike: 0,
likenum: 0,
reply: [],
...data,
}
targetAnswerList[index]["commentList"][ind]["child"].unshift(targetData)
targetAnswerList[index]["commentList"][ind]["childnum"]++
} else { } else {
let targetData = { let targetData = {
id: data["commentid"], id: data["commentid"],
@ -524,15 +545,15 @@ const submitAnswerComments = (index, i) => {
...data, ...data,
child: [], child: [],
} }
targetAnswerList[index]["commentList"].unshift(targetData) targetCommentList.unshift(targetData)
targetAnswerList[index]["commentCount"]++ commentCount.value++
} }
targetAnswerList[index]["commentnum"] = data["count"] commentList.value = targetCommentList
ElMessage({
closeAnswerCommentsChild() message: res.message,
type: "success",
handleMsg("success", res["message"] || "操作成功") })
}) })
} }
@ -546,14 +567,11 @@ const timestampToDate = timestamp => {
return `${year}-${month}-${day}` return `${year}-${month}-${day}`
} }
onUnmounted(() => { onUnmounted(() => window.removeEventListener("scroll", handleScroll))
window.removeEventListener("scroll", handleScroll)
})
// url // url
const getFullUrl = () => { const getFullUrl = () => {
if (typeof window === "undefined") return if (typeof window === "undefined") return
return window.location.href return window.location.href
} }
@ -586,12 +604,9 @@ let copyText = text => {
// //
const handleLike = () => { const handleLike = () => {
console.log("like") operateLikeHttp({ token }).then(res => {
operateLikeHttp({token}).then(res => {
console.log("res", res)
if (res.code != 200) return if (res.code != 200) return
let data = res.data let data = res.data
console.log("data", data)
info.value["likenum"] = data["count"] info.value["likenum"] = data["count"]
islike.value = data["status"] islike.value = data["status"]
@ -604,20 +619,51 @@ const handleLike = () => {
// //
const handleCollect = () => { const handleCollect = () => {
operateCollectHttp({token}).then(res => { operateCollectHttp({ token }).then(res => {
console.log("res", res)
if (res.code != 200) return if (res.code != 200) return
let data = res.data let data = res.data
info.value["favnum"] = data["count"] info.value["favnum"] = data["count"]
iscollection.value = data["status"] iscollection.value = data["status"]
ElMessage({
message: res["message"],
type: "success",
})
}) })
} }
const router = useRouter()
// //
const handleItem = uni => { const handleItem = uni => {
// router.push(`/details/${uni}`)
uniqid = uni uniqid = uni
getDetails()
info.value = {}
qrcode.value = ""
iscollection.value = 0
isdisplay.value = true
islike.value = 0
ismyself.value = 0
commentCount.value = 0
commentPage.value = 1
commentList.value = []
commentLoading = false
token = ""
// clearAllData()
nextTick(() => getDetails())
// replaceState(uni)
}
// url
const replaceState = uni => {
if (typeof window === "undefined") return
// URL
window.history.pushState({}, "", `${window.location.origin}/details/${uni}`)
} }
</script> </script>
@ -631,26 +677,35 @@ const handleItem = uni => {
width: 376px; width: 376px;
border-right: 16px solid #f6f6f6; border-right: 16px solid #f6f6f6;
padding-top: 30px; padding-top: 30px;
height: calc(100vh - 70px);
overflow: auto;
.school-box { .school-box {
flex-direction: column; flex-direction: column;
margin-bottom: 40px; margin-bottom: 40px;
text-align: center; text-align: center;
.school-box-icon {
height: 52px;
.school-icon { .school-icon {
width: 40px; width: 40px;
height: 40px; height: 40px;
margin-bottom: 12px; margin-bottom: 12px;
} }
}
.school-name { .school-name {
font-weight: 650; font-weight: 650;
font-size: 15px; font-size: 15px;
color: #000000; color: #000000;
margin-bottom: 7px; margin-bottom: 7px;
height: 28px;
} }
.school-en-name { .school-en-name {
color: #555555; color: #555555;
font-size: 13px; font-size: 13px;
height: 18px;
} }
} }
@ -762,6 +817,16 @@ const handleItem = uni => {
} }
.right { .right {
height: calc(100vh - 70px);
overflow: auto;
&::-webkit-scrollbar {
width: 0 !important;
}
scrollbar-width: none;
-ms-overflow-style: none;
.header { .header {
padding: 30px 45px 25px; padding: 30px 45px 25px;
border-bottom: 1px solid #ebebeb; border-bottom: 1px solid #ebebeb;
@ -885,6 +950,7 @@ const handleItem = uni => {
justify-content: flex-end; justify-content: flex-end;
padding-bottom: 38px; padding-bottom: 38px;
line-height: normal; line-height: normal;
// display: none;
> div { > div {
margin-top: 7px; margin-top: 7px;
@ -946,12 +1012,16 @@ const handleItem = uni => {
height: 60px; height: 60px;
background-color: rgba(98, 177, 255, 1); background-color: rgba(98, 177, 255, 1);
color: #fff; color: #fff;
font-size: 13px; font-size: 14px;
cursor: pointer; cursor: pointer;
border-radius: 6px; border-radius: 6px;
} }
} }
.empty-box {
padding: 80px 0 110px;
}
.comment-list { .comment-list {
margin-bottom: 78px; margin-bottom: 78px;
.comment-item { .comment-item {

View File

@ -107,7 +107,6 @@
<script setup> <script setup>
import zhCn from "element-plus/dist/locale/zh-cn.mjs" import zhCn from "element-plus/dist/locale/zh-cn.mjs"
console.log("zhCn", zhCn)
const state1 = ref("") const state1 = ref("")
@ -125,6 +124,21 @@ const getInit = () => {
} }
const querySearch = (queryString, cb) => { const querySearch = (queryString, cb) => {
// https://offer.gter.net/miniprogram/InterviewExperience/schoolSearch
publishSchoolSearchHttp({ keyword: queryString }).then(res => {
// console.log("res", res)
if (res.code != 200) return
let data = res.data
console.log(data, "data")
data.forEach(element => {
console.log(element, "element")
element['value']
})
cb(data)
})
return
const results = queryString ? restaurants.value.filter(createFilter(queryString)) : restaurants.value const results = queryString ? restaurants.value.filter(createFilter(queryString)) : restaurants.value
// call callback function to return suggestions // call callback function to return suggestions
cb(results) cb(results)
@ -137,13 +151,13 @@ const createFilter = queryString => {
} }
const loadAll = () => { const loadAll = () => {
return [ return [
{value: "vue", link: "https://github.com/vuejs/vue"}, { value: "vue", link: "https://github.com/vuejs/vue" },
{value: "element", link: "https://github.com/ElemeFE/element"}, { value: "element", link: "https://github.com/ElemeFE/element" },
{value: "cooking", link: "https://github.com/ElemeFE/cooking"}, { value: "cooking", link: "https://github.com/ElemeFE/cooking" },
{value: "mint-ui", link: "https://github.com/ElemeFE/mint-ui"}, { value: "mint-ui", link: "https://github.com/ElemeFE/mint-ui" },
{value: "vuex", link: "https://github.com/vuejs/vuex"}, { value: "vuex", link: "https://github.com/vuejs/vuex" },
{value: "vue-router", link: "https://github.com/vuejs/vue-router"}, { value: "vue-router", link: "https://github.com/vuejs/vue-router" },
{value: "babel", link: "https://github.com/babel/babel"}, { value: "babel", link: "https://github.com/babel/babel" },
] ]
} }

View File

@ -1,11 +1,11 @@
{ {
// https://nuxt.com/docs/guide/concepts/typescript // https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json", "extends": "./.nuxt/tsconfig.json",
"compilerOptions": { // "compilerOptions": {
"baseUrl": ".", // "baseUrl": ".",
"paths": { // "paths": {
"~/*": ["./*"], // "~/*": ["./*"],
"@/*": ["./*"] // "@/*": ["./*"]
} // }
} // }
} }

View File

@ -1,54 +1,74 @@
import axios from 'axios';
import QS from 'qs';
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
const baseUrl = "https://interviewexperience.gter.net";
// 指定后端返回的基本数据类型
const fetch = async (url, options) => { axios.defaults.baseURL = 'https://interviewexperience.gter.net'
await nextTick(); //解决刷新页面useFetch无返回 axios.defaults.emulateJSON = true
url = url.indexOf('https://') > -1 ? url : baseUrl + url; axios.defaults.withCredentials = true
options['headers'] = { axios.interceptors.request.use( //响应拦截
authorization: "7a89997c2ccd8cb5ed8cb20d843dafdd" async config => {
// 开发时登录用的,可以直接替换小程序的 authorization
config['headers']['authorization'] = "pa5o1v493ed5mahrcio66267e2"
return config;
},
error => {
return Promise.error(error);
})
// 响应拦截器
axios.interceptors.response.use(response => {
if (response.status === 200) return Promise.resolve(response); //进行中
else return Promise.reject(response); //失败
}, error => { // 服务器状态码不是200的情况
if (error.response.status) {
switch (error.response.status) {
// 401: 未登录
case 401:
// goTologin() // 跳转登录页面
break
default:
} }
// 9c92af854f552bbd2aab43230bcf8438 headers authorization return Promise.reject(error.response);
}
});
/**
* get方法对应get请求
* @param {String} url [请求的url地址]
* @param {Object} params [请求时携带的参数]
*/
const get = (url, params) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
useFetch(url, { ...options }) axios.get(url, {
.then(({ data, error }) => { params,
if (error.value) { }).then(res => {
reject(error.value); resolve(res.data);
return; }).catch(err => {
} reject(err.data)
const value = data.value; })
if (value.code === 201) {
ElMessage({
message: value.message,
type: "error",
}); });
} }
resolve(value); /**
* post方法对应post请求
* @param {String} url [请求的url地址]
* @param {Object} params [请求时携带的参数]
*/
const post = (url, params) => {
return new Promise((resolve, reject) => {
//是将对象 序列化成URL的形式以&进行拼接
axios.post(url, QS.stringify(params)).then(res => {
resolve(res.data);
}).catch(err => {
if (err.data.code == 401) {
resolve(err.data);
} else reject(err.data)
}) })
.catch((err) => {
reject(err);
}); });
}); }
};
export default new (class Http {
get(url, params) {
return fetch(url, { method: "get", params });
}
post(url, body) {
return fetch(url, { method: "post", body });
}
put(url, body) {
return fetch(url, { method: "put", body });
}
delete(url, body) {
return fetch(url, { method: "delete", body });
}
})();
export default {
get,
post,
}