no message

This commit is contained in:
A1300399510
2024-01-24 17:20:53 +08:00
parent 809d1d317a
commit 89020a40b7
7 changed files with 283 additions and 190 deletions

View File

@@ -52,43 +52,30 @@
<div class="message">{{ info.message }}</div>
<div class="hint">{{ info.status == 1 && isvote == 0 ? `已有 ${info.votes || 0} 人参与,` : `共有 ${info.votes || 0} 人参与` }} {{ `${isvote == 1 ? "你已投票" : info.status == 1 ? "参与投票即可查看实时结果" : ""}` }}</div>
<div class="option-list flexflex" v-if="info['status'] == 1 && isvote == 0">
<div class="option-item flexflex" v-for="(item, index) in option" :key="item.id" @click="handleVote(item.id, index)">
<div class="serial flexcenter">{{ index + 1 }}</div>
<span class="flex1">{{ item.value }} </span>
</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="flexflex" style="padding: 2px 0px;">
<div class="option-number flexcenter">{{ index + 1 }}</div>
<img class="tick-icon" src="@/assets/img/tick-black.svg" />
<div class="option-content flex1">{{ item.value }}</div>
</div>
<div class="option-progress flexacenter">
<div class="option-progress-step" :style="{ width: item.percentage + '%' }"></div>
<div class="option-progress-value">{{ item.count }}</div>
<ClientOnly>
<div class="option-list flexflex" v-if="info['status'] == 1 && isvote == 0">
<div class="option-item flexflex" v-for="(item, index) in option" :key="item.id" @click="handleVote(item.id, index)">
<div class="serial flexcenter">{{ index + 1 }}</div>
<span class="flex1">{{ item.value }} </span>
</div>
</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="flexflex" style="padding: 2px 0px;">
<div class="option-number flexcenter">{{ index + 1 }}</div>
<img class="tick-icon" src="@/assets/img/tick-black.svg" />
<div class="option-content flex1">{{ item.value }}</div>
</div>
<div class="option-progress flexacenter">
<div class="option-progress-step" :style="{ width: item.percentage + '%' }"></div>
<div class="option-progress-value">{{ item.count }}</div>
</div>
</div>
</div>
</ClientOnly>
</div>
<div class="right"><DetailsComments ref="commentsRef" :token="token"></DetailsComments></div>
<DetailsArea></DetailsArea>
<!-- 投票后自动评论 -->
<template v-if="false">
<el-dialog class="default-popup automatic-reviews-popup" v-model="reviewsPopoverState" width="720px" align-center autosize>
<div class="automatic-header">
<div class="automatic-title">说说您的投票理由</div>
<div class="automatic-have">已投还是申点其他的保底吧</div>
</div>
<el-input class="automatic-input" placeholder="请输入…" v-model="aaaaa" type="textarea"></el-input>
<div class="automatic-bottom flexflex">
<div class="automatic-send flexcenter">发送</div>
</div>
</el-dialog>
</template>
</div>
<el-dialog class="default-popup options-popup" v-model="cancelPopoverState" width="488px" align-center>
@@ -116,10 +103,6 @@ let id = route.params.id
const uniqidEnd = id.charAt(id.length - 1)
const uniqidIndex = base62ToDecimal(uniqidEnd) % 6
let aaaaa = ref("")
let reviewsPopoverState = ref(true)
onMounted(() => {
getDetails()
clearBottom()
@@ -136,6 +119,7 @@ let option = ref([])
let token = ref("")
let cancelPopoverState = ref(false) // 取消投票弹窗
let isLoaded = ref(false) // 是否加载了
let haveVotedValue = ref("") // 已投的值
provide("info", info)
provide("islike", islike)
@@ -143,6 +127,7 @@ provide("iscollection", iscollection)
provide("token", token)
provide("qrcode", qrcode)
provide("isLoaded", isLoaded)
provide("haveVotedValue", haveVotedValue)
const getDetails = () => {
detailsHttp({ uniqid: id }).then(res => {
@@ -153,6 +138,7 @@ const getDetails = () => {
}
let data = res.data
info.value = data["info"]
isvote.value = data["isvote"]
iscollection.value = data["iscollection"]
@@ -162,7 +148,13 @@ const getDetails = () => {
qrcode.value = data.share?.qrcode
token.value = data["token"]
seo.value = data.seo
isLoaded.value = true
data["option"].forEach(element => {
if (element.selected) haveVotedValue.value = element.value
})
// haveVotedValue
})
}
@@ -192,6 +184,13 @@ provide("TAHomePage", TAHomePage)
const commentsRef = ref(null)
let voteLoading = false
// 处理点击投票的中转
const handleVotesTransfer = index => {
const target = option.value[index]
if (info.value.status == 1 && isvote.value == 0) handleVote(target.id, index)
else handleUnvoteVote(index)
}
// 处理点击投票
const handleVote = (token, index) => {
if (isNeedLogin.value) {
@@ -211,15 +210,21 @@ const handleVote = (token, index) => {
}
let data = res.data
let optionList = data["optionList"] || []
optionList.forEach(element => {
element["selected"] = 0
})
optionList[index]["selected"] = 1
option.value = optionList
isvote.value = 1
info.value.votes = data["votes"]
const value = optionList[index]["value"]
haveVotedValue.value = value
commentsRef.value.changeCommentVoteoption(value)
ElMessage.success(res.message)
if (index != optionList.length - 1) commentsRef.value.reviewsComment(optionList[index]["value"])
})
.finally(() => (voteLoading = false))
}
@@ -256,7 +261,10 @@ const unvoteVote = () => {
}
let data = res.data
let optionList = data["optionList"] || []
optionList[unvoteVoteIndex]["selected"] = 0
// optionList[unvoteVoteIndex]["selected"] = 0
optionList.forEach(element => {
element["selected"] = 0
})
option.value = optionList
isvote.value = 0
info.value.votes = data["votes"]
@@ -312,6 +320,18 @@ const clearBottom = () => {
let topHeadRef = ref(null)
provide("topHeadRef", topHeadRef)
// 底部导航栏 的 点击评论输入值
let floorCommentInput = ref("")
// 底部导航栏 的 点击发送评论 type input back
const floorCommentBtn = type => {
if (type == "input") commentsRef.value.bottomNavigationBar(floorCommentInput.value)
else floorCommentInput.value = ""
}
provide("floorCommentInput", floorCommentInput)
provide("floorCommentBtn", floorCommentBtn)
try {
if (process.server) {
await detailsHttp({ uniqid: id }).then(res => {
@@ -500,6 +520,12 @@ try {
margin-top: 3px;
margin-right: 6px;
}
.option-progress,
.option-number,
.tick-icon {
display: none;
}
}
}
.option-area {
@@ -533,6 +559,10 @@ try {
}
}
.serial {
display: none;
}
.option-number {
font-size: 11px;
color: #ffffff;
@@ -625,6 +655,7 @@ try {
background-color: rgba(249, 93, 93, 1);
border-color: rgba(249, 93, 93, 1);
color: #fff;
margin-left: 20px;
}
&.options-no {
background-color: #fff;
@@ -634,46 +665,4 @@ try {
}
}
}
.automatic-reviews-popup {
border-radius: 10px;
.automatic-header {
padding: 20px;
border-bottom: 1px dotted #ebebeb;
.automatic-title {
font-weight: 650;
font-size: 18px;
color: #000000;
margin-bottom: 12px;
}
.automatic-have {
background-color: rgba(246, 246, 246, 1);
font-size: 12px;
color: #aaa;
width: fit-content;
}
}
.automatic-input {
.el-textarea__inner {
min-height: 256px !important;
box-shadow: none;
padding: 20px;
resize: none;
}
}
.automatic-bottom {
justify-content: flex-end;
padding: 10px;
.automatic-send {
background-color: var(--main-color);
color: #fff;
font-size: 16px;
width: 100px;
height: 40px;
border-radius: 6px;
cursor: pointer;
}
}
}
</style>