融合PK头像头像功能
This commit is contained in:
427
src/components/pk-mini/chat/MiniPKMessage.vue
Normal file
427
src/components/pk-mini/chat/MiniPKMessage.vue
Normal file
@@ -0,0 +1,427 @@
|
||||
<template>
|
||||
<div class="chat-message-mini-pk">
|
||||
<!-- 用户A -->
|
||||
<div class="userA">
|
||||
<div class="Avatar">
|
||||
<img class="AvatarImg" :src="ArticleDetailsA.anchorIcon" alt="" />
|
||||
<div class="name">{{ ArticleDetailsA.anchorId }}</div>
|
||||
</div>
|
||||
<div class="genderAndCountry">
|
||||
<div class="gender" :style="{ background: ArticleDetailsA.sex == 1 ? '#59D8DB' : '#F3876F' }">
|
||||
{{ ArticleDetailsA.sex == 1 ? $t('pkMini.man') : $t('pkMini.woman') }}
|
||||
</div>
|
||||
<div class="Country">{{ ArticleDetailsA.country }}</div>
|
||||
</div>
|
||||
<div class="time">
|
||||
{{ $t('pkMini.PKTime') + TimestamptolocalTime(PkIDInfodata.pkTime * 1000) }}
|
||||
</div>
|
||||
<div class="PKinformation">
|
||||
<div class="gold">
|
||||
<img class="gold-img" src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/gold.png" alt="" />
|
||||
<div class="sessions-content">
|
||||
{{ $t('pkMini.GoldCoin') }}
|
||||
<div class="gold-num">{{ ArticleDetailsA.coin }}K</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sessions">
|
||||
<img class="sessions-img" src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/session.png" alt="" />
|
||||
<div class="sessions-content">
|
||||
{{ $t('pkMini.session') }}
|
||||
<div class="gold-num">{{ PkIDInfodata.pkNumber + $t('pkMini.match') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Remarks">{{ $t('pkMini.Note') + ArticleDetailsA.remark }}</div>
|
||||
</div>
|
||||
|
||||
<!-- VS -->
|
||||
<div class="messageVS">
|
||||
<img class="messageVS-img" src="@/assets/pk-mini/messageVS.png" alt="" />
|
||||
</div>
|
||||
|
||||
<!-- 用户B -->
|
||||
<div class="userB">
|
||||
<div class="Avatar">
|
||||
<img class="AvatarImg" :src="ArticleDetailsB.anchorIcon" alt="" />
|
||||
<div class="name">{{ ArticleDetailsB.anchorId }}</div>
|
||||
</div>
|
||||
<div class="genderAndCountry">
|
||||
<div class="gender" :style="{ background: ArticleDetailsB.sex == 1 ? '#59D8DB' : '#F3876F' }">
|
||||
{{ ArticleDetailsB.sex == 1 ? $t('pkMini.man') : $t('pkMini.woman') }}
|
||||
</div>
|
||||
<div class="Country">{{ ArticleDetailsB.country }}</div>
|
||||
</div>
|
||||
<div class="time">
|
||||
{{ $t('pkMini.PKTime') + TimestamptolocalTime(PkIDInfodata.pkTime * 1000) }}
|
||||
</div>
|
||||
<div class="PKinformation">
|
||||
<div class="gold">
|
||||
<img class="gold-img" src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/gold.png" alt="" />
|
||||
<div class="sessions-content">
|
||||
{{ $t('pkMini.GoldCoin') }}
|
||||
<div class="gold-num">{{ ArticleDetailsB.coin }}K</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sessions">
|
||||
<img class="sessions-img" src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/session.png" alt="" />
|
||||
<div class="sessions-content">
|
||||
{{ $t('pkMini.session') }}
|
||||
<div class="gold-num">{{ PkIDInfodata.pkNumber + $t('pkMini.match') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Remarks">{{ $t('pkMini.Note') + ArticleDetailsB.remark }}</div>
|
||||
</div>
|
||||
|
||||
<!-- 按钮 -->
|
||||
<div class="btn" v-if="PkIDInfodata.pkStatus === 0 && ArticleDetailsB.senderId != info.id">
|
||||
<div class="messagebtn-left" @click="agree()">{{ $t('pkMini.agree') }}</div>
|
||||
<div class="messagebtn-right" @click="refuse()">{{ $t('pkMini.Refuse') }}</div>
|
||||
</div>
|
||||
<div v-if="PkIDInfodata.pkStatus === 1" class="messageHint">{{ $t('pkMini.HaveAgreedToTheInvitation') }}</div>
|
||||
<div v-if="PkIDInfodata.pkStatus === 2" class="messageHint">{{ $t('pkMini.HaveRefusedTheInvitation') }}</div>
|
||||
<div v-if="PkIDInfodata.pkStatus === 0 && ArticleDetailsB.senderId == info.id" class="messageHint">
|
||||
{{ $t('pkMini.WaitForTheOtherPartyResponse') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 同意邀请提示弹窗 -->
|
||||
<el-dialog v-model="agreedialog" center :title="$t('pkMini.Hint')" width="400" align-center>
|
||||
<div class="dialog-content">
|
||||
<div class="dialog-content-text">
|
||||
<div>{{ $t('pkMini.AfterASuccessfulInvitationThePKCannotBeModifiedOrDeletedPleaseOperateWithCaution') }}</div>
|
||||
</div>
|
||||
<div class="myanchor-dialog-btn">
|
||||
<div class="remindermyAnchorDialogReset" @click="agreedialog = false">{{ $t('pkMini.Cancel') }}</div>
|
||||
<div class="remindermyAnchorDialogConfirm" @click="agreedialogConfirm">{{ $t('pkMini.Confirm') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 拒绝邀请提示弹窗 -->
|
||||
<el-dialog v-model="refusedialog" center :title="$t('pkMini.Hint')" width="400" align-center>
|
||||
<div class="dialog-content">
|
||||
<div class="dialog-content-text">
|
||||
<div>{{ $t('pkMini.AreYouSureYouWantToDeclineThisInvitation') }}</div>
|
||||
</div>
|
||||
<div class="myanchor-dialog-btn">
|
||||
<div class="remindermyAnchorDialogReset" @click="refusedialog = false">{{ $t('pkMini.Cancel') }}</div>
|
||||
<div class="remindermyAnchorDialogConfirm" @click="refusedialogConfirm">{{ $t('pkMini.Confirm') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, onMounted } from 'vue'
|
||||
import { queryPkRecord, pkArticleDetail, updatePkRecordStatus } from '@/api/pk-mini'
|
||||
import { getPromiseStorage } from '@/utils/pk-mini/storage'
|
||||
import { TimestamptolocalTime } from '@/utils/pk-mini/timeConversion'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const info = ref({})
|
||||
const PkIDInfodata = ref({})
|
||||
const ArticleDetailsA = ref({})
|
||||
const ArticleDetailsB = ref({})
|
||||
const agreedialog = ref(false)
|
||||
const refusedialog = ref(false)
|
||||
const newValitem = ref({})
|
||||
|
||||
function agreedialogConfirm() {
|
||||
updatePkRecordStatus({
|
||||
id: newValitem.value.payload.customData.id,
|
||||
pkStatus: 1
|
||||
}).then(() => {
|
||||
ElMessage.success('同意成功')
|
||||
PkIDInfodata.value.pkStatus = 1
|
||||
agreedialog.value = false
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
function refusedialogConfirm() {
|
||||
updatePkRecordStatus({
|
||||
id: newValitem.value.payload.customData.id,
|
||||
pkStatus: 2
|
||||
}).then(() => {
|
||||
ElMessage.success('拒绝成功')
|
||||
PkIDInfodata.value.pkStatus = 2
|
||||
refusedialog.value = false
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
function agree() {
|
||||
agreedialog.value = true
|
||||
}
|
||||
|
||||
function refuse() {
|
||||
refusedialog.value = true
|
||||
}
|
||||
|
||||
watch(() => props.item, (newVal) => {
|
||||
newValitem.value = newVal
|
||||
queryPkRecord({ id: newVal.payload.customData.id }).then((res) => {
|
||||
PkIDInfodata.value = res
|
||||
}).catch(() => {})
|
||||
|
||||
pkArticleDetail({
|
||||
id: newVal.payload.customData.pkIdA,
|
||||
userId: info.value.id,
|
||||
from: 2
|
||||
}).then((res) => {
|
||||
ArticleDetailsA.value = res
|
||||
}).catch(() => {})
|
||||
|
||||
pkArticleDetail({
|
||||
id: newVal.payload.customData.pkIdB,
|
||||
userId: info.value.id,
|
||||
from: 2
|
||||
}).then((res) => {
|
||||
ArticleDetailsB.value = res
|
||||
}).catch(() => {})
|
||||
}, { immediate: true })
|
||||
|
||||
onMounted(() => {
|
||||
getPromiseStorage('user').then((res) => {
|
||||
info.value = res
|
||||
}).catch(() => {})
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.chat-message-mini-pk {
|
||||
width: 325px;
|
||||
height: 820px;
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background-color: #ffffff;
|
||||
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.messageVS {
|
||||
width: 67px;
|
||||
height: 67px;
|
||||
margin-top: -33.5px;
|
||||
margin-bottom: -33.5px;
|
||||
z-index: 2;
|
||||
}
|
||||
.messageVS-img {
|
||||
width: 67px;
|
||||
height: 67px;
|
||||
}
|
||||
.userA {
|
||||
width: 90%;
|
||||
height: 335px;
|
||||
background-color: #c0e8e8;
|
||||
border-top-left-radius: 20px;
|
||||
border-top-right-radius: 20px;
|
||||
margin-top: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.Avatar {
|
||||
width: 90%;
|
||||
height: 50px;
|
||||
margin-top: 15px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.AvatarImg {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.name {
|
||||
width: calc(100% - 60px);
|
||||
margin-left: 10px;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.genderAndCountry {
|
||||
width: 90%;
|
||||
height: 30px;
|
||||
margin-top: 15px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.gender {
|
||||
font-size: 14px;
|
||||
padding: 5px 20px;
|
||||
background-color: #999;
|
||||
border-radius: 20px;
|
||||
color: #fff;
|
||||
}
|
||||
.Country {
|
||||
font-size: 14px;
|
||||
padding: 5px 20px;
|
||||
background-color: #e4f9f9;
|
||||
border-radius: 20px;
|
||||
color: #03aba8;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.time {
|
||||
width: 90%;
|
||||
height: 20px;
|
||||
margin-top: 10px;
|
||||
font-size: 14px;
|
||||
color: #999999;
|
||||
}
|
||||
.PKinformation {
|
||||
width: 90%;
|
||||
height: 50px;
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
}
|
||||
.gold, .sessions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.gold-img, .sessions-img {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
.sessions-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #999;
|
||||
font-size: 14px;
|
||||
}
|
||||
.gold-num {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
margin-left: 5px;
|
||||
}
|
||||
.Remarks {
|
||||
width: 90%;
|
||||
height: 90px;
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.userB {
|
||||
width: 90%;
|
||||
height: 315px;
|
||||
background-color: #f8e4e0;
|
||||
border-bottom-left-radius: 20px;
|
||||
border-bottom-right-radius: 20px;
|
||||
padding-top: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.btn {
|
||||
margin-top: 20px;
|
||||
width: 90%;
|
||||
height: 50px;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
.messageHint {
|
||||
margin-top: 20px;
|
||||
width: 90%;
|
||||
height: 50px;
|
||||
font-size: 20px;
|
||||
color: #999;
|
||||
text-align: center;
|
||||
line-height: 50px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.messagebtn-left {
|
||||
width: 100px;
|
||||
height: 50px;
|
||||
background-color: #f0836c;
|
||||
border-radius: 10px;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
line-height: 50px;
|
||||
cursor: pointer;
|
||||
transition: all 0.4s ease;
|
||||
}
|
||||
.messagebtn-left:hover {
|
||||
transform: scale(1.05);
|
||||
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
.messagebtn-right {
|
||||
width: 100px;
|
||||
height: 50px;
|
||||
background-color: #4fcacd;
|
||||
border-radius: 10px;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
line-height: 50px;
|
||||
cursor: pointer;
|
||||
transition: all 0.4s ease;
|
||||
}
|
||||
.messagebtn-right:hover {
|
||||
transform: scale(1.05);
|
||||
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
.dialog-content {
|
||||
width: 100%;
|
||||
height: 300px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.dialog-content-text {
|
||||
width: 90%;
|
||||
height: 200px;
|
||||
background-color: #c0e8e8;
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #03aba8;
|
||||
border: 1px solid #03aba8;
|
||||
}
|
||||
.myanchor-dialog-btn {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.remindermyAnchorDialogReset {
|
||||
width: 150px;
|
||||
height: 40px;
|
||||
margin-top: 30px;
|
||||
text-align: center;
|
||||
line-height: 40px;
|
||||
background: linear-gradient(0deg, #e4ffff, #ffffff);
|
||||
color: #03aba8;
|
||||
font-size: 18px;
|
||||
border-radius: 100px;
|
||||
border: 1px solid #4fcacd;
|
||||
cursor: pointer;
|
||||
}
|
||||
.remindermyAnchorDialogConfirm {
|
||||
width: 150px;
|
||||
height: 40px;
|
||||
margin-top: 30px;
|
||||
text-align: center;
|
||||
line-height: 40px;
|
||||
background: linear-gradient(0deg, #4fcacd, #5fdbde);
|
||||
color: #ffffff;
|
||||
font-size: 18px;
|
||||
border-radius: 100px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user