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

@@ -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 = ""
}
//暴露state和play方法
@@ -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]
})
}