no message

This commit is contained in:
A1300399510
2024-01-25 19:29:12 +08:00
parent 89020a40b7
commit bd7c792cbe
970 changed files with 119575 additions and 101 deletions

View File

@@ -60,7 +60,7 @@
</div>
</div>
<div class="option-area" v-else>
<div class="option-item flexflex" :class="{ 'pitch': item.selected }" v-for="(item, index) in option" :key="item.id" @click="handleUnvoteVote(index, item.selected)">
<div class="option-item flexflex" :class="{ 'pitch': item.selected, 'cursor-no': info.status == 0 }" v-for="(item, index) in option" :key="item.id" @click="handleUnvoteVote(index, item.selected)">
<div class="flexflex" style="padding: 2px 0px;">
<div class="option-number flexcenter">{{ index + 1 }}</div>
<img class="tick-icon" src="@/assets/img/tick-black.svg" />
@@ -129,11 +129,53 @@ provide("qrcode", qrcode)
provide("isLoaded", isLoaded)
provide("haveVotedValue", haveVotedValue)
const getDetails = () => {
const getDetails = async () => {
// const { data1, pending1, error1, refresh1 } = await useAsyncData("mountains", () =>
// $fetch("https://vote.gter.net/api/details", {
// params: {
// uniqid: id,
// },
// })
// )
// const { data, pending, error, refresh } = await useFetch(`https://vote.gter.net/api/details`, {
// key: "details",
// body: {
// uniqid: id,
// },
// method: "post",
// })
// const { data, pending, error, refresh } = await useFetch(`https://vote.gter.net/api/details`, {
// method: "post",
// body: {
// uniqid: id,
// },
// })
// let datadata = data.value.data
// info.value = datadata["info"]
// isvote.value = datadata["isvote"]
// iscollection.value = datadata["iscollection"]
// islike.value = datadata["islike"]
// ismyself.value = datadata["ismyself"]
// option.value = datadata["option"]
// qrcode.value = datadata.share?.qrcode
// token.value = datadata["token"]
// seo.value = datadata.seo
// isLoaded.value = true
// datadata["option"].forEach(element => {
// if (element.selected) haveVotedValue.value = element.value
// })
// return
detailsHttp({ uniqid: id }).then(res => {
if (res.code != 200) {
ElMessage.error(res.message)
router.push("/index.html")
goToURL("/index.html", false)
return
}
@@ -154,10 +196,26 @@ const getDetails = () => {
data["option"].forEach(element => {
if (element.selected) haveVotedValue.value = element.value
})
// haveVotedValue
})
}
// watch(
// () => route.path,
// (newValue, oldValue) => {
// // 在这里处理route.path的变化
// 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])
// }
// }
// }
// )
provide("getDetails", getDetails)
// 点击发送信息
@@ -237,7 +295,7 @@ const handleUnvoteVote = (index, selected) => {
goLogin()
return
}
if (selected == 0) return
if (selected == 0 || info.value.status == 0) return
cancelPopoverState.value = true
unvoteVoteIndex = index
}
@@ -332,9 +390,38 @@ const floorCommentBtn = type => {
provide("floorCommentInput", floorCommentInput)
provide("floorCommentBtn", floorCommentBtn)
// 只刷新数据
const refreshDataOnly = () => {
clearAllData()
getDetails()
}
provide("refreshDataOnly", refreshDataOnly)
try {
if (process.server) {
// // const { data, pending, error, refresh } = await useFetch("https://vote.gter.net/api/details", {
// // query: { uniqid: id },
// // method: "post",
// // server: true,
// // })
// // const { data, pending, error, refresh } = await useFetch(`https://vote.gter.net/api/details`, {
// // method: "post",
// // body: {
// // uniqid: id + "111",
// // },
// // })
// const { data, pending, error, refresh } = await useFetch(`https://vote.gter.net/api/details`, {
// key: "details",
// body: {
// uniqid: id,
// },
// method: "post",
// })
// console.log("-------------分割线-------------------")
await detailsHttp({ uniqid: id }).then(res => {
// console.log("res", res)
if (res.code != 200) {
ElMessage.error(res.message)
router.push("/index.html")
@@ -559,6 +646,10 @@ try {
}
}
&.cursor-no {
cursor: no-drop;
}
.serial {
display: none;
}

View File

@@ -8,8 +8,7 @@
<div class="halving-line"></div>
<div class="search-result"> {{ count }} 条搜索数据</div>
</div>
<div class="vote-list-box" ref="gridContainer">
<div class="vote-list-box" :class="{ 'firstdata': firstdataState }" ref="gridContainer" v-loading="loading">
<a class="vote-item" target="_blank" :href="`/details/${item['uniqid']}`" v-for="(item, index) in list" :key="index" :class="{ 'isvote': item['isvote'] == 1 || item['status'] == 0 }" :style="{ '--main-color': colourValue[item.uniqidIndex]['main'], '--bg-color': colourValue[item.uniqidIndex]['bg'], '--bc-color': colourValue[item.uniqidIndex]['bc'] }">
<div class="vote-title">
<div class="vote-state" v-if="item['status'] == 1">进行中</div>
@@ -44,7 +43,7 @@
</div>
</div>
</a>
<div class="empty-box flexcenter" v-if="keyword && list.length == 0"><Empty :isNeedIssue="true"></Empty></div>
<div class="empty-box flexcenter" v-if="keyword && list.length == 0 && !loading"><Empty :isNeedIssue="true"></Empty></div>
</div>
</template>
<script setup>
@@ -57,10 +56,12 @@ import { useRoute } from "vue-router"
const route = useRoute()
const router = useRouter()
let keyword = ref("")
let page = 1 // 投票页数从 1 开始
let page = ref(1) // 投票页数从 1 开始
let count = ref(0)
let list = ref([])
let loading = false // 加载中
let loading = ref(false) // 加载中
const firstdataState = ref(true)
keyword.value = route.query["keyword"]
const gridContainer = ref(null)
@@ -77,13 +78,13 @@ onMounted(async () => {
})
const getList = () => {
if (page == 0 || loading) return
if (page.value == 0 || loading.value) return
loading = true
getListHttp({ page, keyword: keyword.value })
loading.value = true
getListHttp({ page: page.value, keyword: keyword.value })
.then(res => {
if (res.code != 200) {
page = 0
page.value = 0
ElMessage.error(res.message)
return
}
@@ -94,15 +95,17 @@ const getList = () => {
})
list.value = list.value.concat(data.data)
count.value = data.count
if (data.count > list.value.length) page++
else page = 0
if (data.count > list.value.length) page.value++
else page.value = 0
firstdataState.value = false
nextTick(() => {
masonryInstance.reloadItems()
masonryInstance.layout()
})
})
.finally(() => (loading = false))
.finally(() => (loading.value = false))
}
const handleScroll = () => {
@@ -134,6 +137,11 @@ const handleLike = (token, index) => {
})
}
// 使用 process.client 判断是否在浏览器环境下
const isServer = computed(() => {
return process.server // 使用 process.client 判断是否在浏览器环境下
})
// 点击关闭搜索
const closeKeyword = () => router.push("./index.html")
@@ -141,7 +149,7 @@ watch(
() => route.query,
() => {
keyword.value = route.query["keyword"]
page = 1
page.value = 1
list.value = []
count.value = 0
getList()
@@ -150,7 +158,7 @@ watch(
try {
if (process.server) {
await getListHttp({ page, keyword: keyword.value }).then(res => {
await getListHttp({ page: 1, keyword: keyword.value }).then(res => {
let data = res.data
data.data.forEach(element => {
let uniqidEnd = element["uniqid"].charAt(element["uniqid"].length - 1)
@@ -158,10 +166,6 @@ try {
})
list.value = list.value.concat(data.data)
count.value = data.count
if (data.count > list.value.length) page++
else page = 0
console.log("keyword", keyword.value)
})
}
} catch (error) {}
@@ -205,6 +209,15 @@ try {
display: flex;
flex-wrap: wrap;
min-height: 100vh;
&.firstdata {
.vote-item {
margin-right: 22.5px;
&:nth-of-type(3n) {
margin-right: 0;
}
}
}
.vote-item {
width: 385px;
background-color: rgba(255, 255, 255, 1);