no message
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
<template>
|
||||
<Head>
|
||||
<Title>寄托面经</Title>
|
||||
</Head>
|
||||
<Header></Header>
|
||||
<div class="search-result flexacenter" v-if="keyword">
|
||||
<div class="keyword flexacenter" @click="clearKeyword">{{ keyword }} <img class="keyword-icon" src="@/assets/img/cross-circle-icon.png" /></div>
|
||||
@@ -6,7 +9,7 @@
|
||||
<div class="total">共 {{ count }} 条搜索数据</div>
|
||||
</div>
|
||||
<div class="content" ref="gridContainer">
|
||||
<div class="empty-box" v-if="list.length == 0 && page == 0">
|
||||
<div class="empty-box flexcenter" v-if="list.length == 0 && page == 0">
|
||||
<empty hint="没有找到相关结果,请更换搜索关键词"></empty>
|
||||
</div>
|
||||
<template v-else>
|
||||
@@ -14,11 +17,10 @@
|
||||
</template>
|
||||
</div>
|
||||
<div class="in-end" v-if="page == 0 && list.length > 0">- 到底了 -</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {ElMessage} from "element-plus"
|
||||
import { ElMessage } from "element-plus"
|
||||
|
||||
const gridContainer = ref(null)
|
||||
let masonryInstance = null
|
||||
@@ -30,7 +32,7 @@ keyword.value = route.query["keyword"]
|
||||
watchEffect(() => {
|
||||
if (keyword.value != route.query["keyword"]) {
|
||||
// keyword.value = route.query["keyword"]
|
||||
console.log(keyword.value)
|
||||
// console.log("keyword", keyword.value)
|
||||
list.value = []
|
||||
page.value = 1
|
||||
keyword.value = route.query["keyword"]
|
||||
@@ -71,9 +73,16 @@ const getList = () => {
|
||||
if (page.value == 0 || loading) return
|
||||
|
||||
loading = true
|
||||
getListHttp({page: page.value, keyword: keyword.value})
|
||||
getListHttp({ page: page.value, keyword: keyword.value })
|
||||
.then(res => {
|
||||
if (res.code != 200) return
|
||||
if (res.code != 200) {
|
||||
page.value = 0
|
||||
ElMessage({
|
||||
message: res.message,
|
||||
type: "error",
|
||||
})
|
||||
return
|
||||
}
|
||||
// console.log("res", res.code)
|
||||
let data = res.data
|
||||
// list.value = data.data
|
||||
@@ -96,14 +105,10 @@ const getList = () => {
|
||||
getList()
|
||||
|
||||
const handleLike = token => {
|
||||
operateLikeHttp({token}).then(res => {
|
||||
operateLikeHttp({ token }).then(res => {
|
||||
if (res.code != 200) return
|
||||
let data = res.data
|
||||
|
||||
console.log("data", data)
|
||||
|
||||
console.log(list.value, "list.value")
|
||||
|
||||
list.value.forEach(element => {
|
||||
console.log(element, "element")
|
||||
if (element["token"] == token) {
|
||||
@@ -129,6 +134,24 @@ const router = useRouter()
|
||||
const clearKeyword = () => {
|
||||
router.push(`/index.html`)
|
||||
}
|
||||
|
||||
try {
|
||||
if (process.server) {
|
||||
await getListHttp({ page: 1, keyword: keyword.value }).then(res => {
|
||||
if (res.code != 200) {
|
||||
page.value = 0
|
||||
ElMessage({
|
||||
message: res.message,
|
||||
type: "error",
|
||||
})
|
||||
return
|
||||
}
|
||||
let data = res.data
|
||||
|
||||
list.value = list.value.concat(data.data || [])
|
||||
})
|
||||
}
|
||||
} catch (error) {}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
Reference in New Issue
Block a user