Files
tk-mini-program/TUIKit/components/TUIChat/message-input-toolbar/evaluate/CustomMessage.vue

381 lines
8.7 KiB
Vue
Raw Normal View History

2025-05-16 21:53:47 +08:00
<!-- 自定义邀请消息 -->
<template>
<ToolbarItemContainer
ref="container"
:iconFile="evaluateIcon"
title="邀请"
:needBottomPopup="true"
:iconWidth="isUniFrameWork ? '36px' : '30px'"
:iconHeight="isUniFrameWork ? '36px' : '30px'"
@onDialogShow="onDialogShow"
@onDialogClose="onDialogClose"
>
2025-06-19 22:27:00 +08:00
<div class="popup">
<div class="container">
<div class="title">PK邀请</div>
<div class="yourChoose" @click="onyourChoose">
<view class="yourChoose-item">选择你要邀请的对手</view>
</div>
<div class="vstext">
<div class="Vtext">V</div>
<div class="Stext">S</div>
</div>
<div class="myChoose" @click="onmyChoose">
<view class="yourChoose-item">选择你要参与PK的信息</view>
</div>
</div>
2025-05-16 21:53:47 +08:00
<button class="send-btn" @click="submitEvaluate">发送邀请</button>
</div>
</ToolbarItemContainer>
</template>
<script setup>
import TUIChatConfig from "../../config";
import ToolbarItemContainer from "../toolbar-item-container/index.vue";
import InvitationDark from "../../../../assets/icon/InvitationDark.png";
import InvitationLight from "../../../../assets/icon/InvitationLight.png";
import { ref } from "vue";
import TUIChatEngine, {
TUIStore,
StoreName,
TUIChatService,
} from "@tencentcloud/chat-uikit-engine";
import { isEnabledMessageReadReceiptGlobal } from "../../utils/utils";
2025-05-19 18:34:04 +08:00
import OfflinePushInfoManager from "../../offlinePushInfoManager/index";
2025-06-19 22:27:00 +08:00
import { useCounterStore } from "@/stores/counter";
import request from "@/components/request";
const counter = useCounterStore();
2025-05-16 21:53:47 +08:00
2025-06-19 22:27:00 +08:00
const evaluateIcon = TUIChatConfig.getTheme() === "dark" ? InvitationDark : InvitationLight;
2025-05-16 21:53:47 +08:00
const emits = defineEmits(["onDialogPopupShowOrHide"]);
const onDialogShow = () => {
emits("onDialogPopupShowOrHide", true);
};
const onDialogClose = () => {
emits("onDialogPopupShowOrHide", false);
};
///``````````````````````````````````````````````````````````````````````````````````````
const currentConversation = ref();
2025-06-19 22:27:00 +08:00
const mylist = ref([]);
const youlist= ref([]);
2025-05-16 21:53:47 +08:00
TUIStore.watch(StoreName.CONV, {
currentConversation: (conversation) => {
currentConversation.value = conversation;
2025-06-19 22:27:00 +08:00
//获取自己的可邀请列表
request({
url: "pk/queryMyCanUsePkData",
method: "POST",
data: {
userId:counter.myitem.id,
},
userInfo: true,
}).then((res) => {
if (res.code === 200) {
mylist.value = res.data;
}
});
//获取对方的可邀请列表
request({
url: "pk/listUninvitedPublishedAnchorsByUserId",
method: "POST",
data: {
userId:currentConversation.value.userProfile.userID,
},
userInfo: true,
}).then((res) => {
if (res.code === 200) {
youlist.value = res.data;
}
});
// ````````````````````````
2025-05-16 21:53:47 +08:00
},
});
const container = ref();
2025-06-19 22:27:00 +08:00
const list = ref([]);
const popup = ref();
//选择对方pk信息打开弹窗
function onyourChoose(){
popup.value.open("center");
list.value = youlist.value;
}
//选择自己的pk信息打开弹窗
function onmyChoose(){
popup.value.open("center");
list.value = mylist.value;
}
//弹窗选中
const selectedId = ref(null);
function Select(item ,index){
selectedId.value = item;
};
2025-06-20 14:11:55 +08:00
2025-06-19 22:27:00 +08:00
///``````````````````````````````````````标记3``````````````````````````````````````````````
2025-05-16 21:53:47 +08:00
const submitEvaluate = () => {
2025-06-19 22:27:00 +08:00
// const payload = {
// data: JSON.stringify({
// businessID: "pk",
// title: "PK邀请",
// buttonText1: "接受邀请",
// buttonText2: "拒绝邀请",
// }),
// description: "邀请参加PK",
// extension: "邀请参加PK",
// };
// //`````````````````````````````````````````````````````
// const options = {
// to:
// currentConversation?.value?.groupProfile?.groupID ||
// currentConversation?.value?.userProfile?.userID,
// conversationType: currentConversation?.value?.type,
// payload,
// needReadReceipt: isEnabledMessageReadReceiptGlobal(),
// };
2025-05-16 21:53:47 +08:00
2025-06-19 22:27:00 +08:00
// const offlinePushInfoCreateParams = {
// conversation: currentConversation.value,
// payload: options.payload,
// messageType: TUIChatEngine.TYPES.MSG_CUSTOM,
// };
// const sendMessageOptions = {
// offlinePushInfo: OfflinePushInfoManager.create(offlinePushInfoCreateParams),
// };
// TUIChatService.sendCustomMessage(options, sendMessageOptions);
// // close dialog after submit evaluate
// container?.value?.toggleDialogDisplay(false);
2025-05-16 21:53:47 +08:00
};
</script>
<style scoped>
2025-06-20 14:11:55 +08:00
.popupcss {
}
2025-06-19 22:27:00 +08:00
.popup{
height: 750rpx;
background-image: url(https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/chard1.png);
background-position: center;
}
2025-05-16 21:53:47 +08:00
.container {
2025-06-19 22:27:00 +08:00
height: 650rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.title{
font-size: 40rpx;
color: #313131;
text-align: center;
margin-top: 40rpx;
font-weight: bold;
}
.yourChoose{
width: 80%;
height: 150rpx;
margin-top: 40rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 10rpx;
background-color: #ffffff;
}
.myChoose{
width: 80%;
height: 150rpx;
margin-top: 40rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 10rpx;
background-color: #ffffff;
}
.yourChoose-item{
font-size: 30rpx;
color: #313131;
font-weight: bold;
}
.vstext {
display: flex;
justify-content: center;
align-items: center;
width: 90%;
margin-top: 40rpx;
}
.Vtext {
font-size: 45.8rpx;
color: #f0836c;
font-weight: bold;
font-style: italic;
}
.Stext {
font-size: 45.8rpx;
color: #58d8db;
font-weight: bold;
font-style: italic;
2025-05-16 21:53:47 +08:00
}
.send-btn {
margin-bottom: 100rpx;
}
2025-06-19 22:27:00 +08:00
.popup-content {
width: 750rpx;
height: 700rpx;
background-repeat: no-repeat;
border-radius: 10px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-image: url(https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/chard1.png);
background-position: center;
}
.popup-title {
font-size: 30rpx;
margin-top: 50rpx;
text-align: center;
}
.popup-btn {
display: flex;
justify-content: space-around;
margin-top: 50rpx;
}
.popup-text {
color: #161616;
font-size: 36.26rpx;
font-weight: bold;
margin-bottom: 30rpx;
}
.card-content {
/* width: 445rpx; */
width: 100%;
height: 100rpx;
background-color: #ffffff;
/* border: 2px solid #afafaf; */
border-radius: 10rpx;
display: flex;
align-items: center;
font-size: 28rpx;
color: rgb(127, 127, 127);
margin-top: 20rpx;
}
2025-06-20 14:11:55 +08:00
.Avatarimg {
width: 90rpx;
height: 90rpx;
border-radius: 50%;
background-color: #dddddd;
margin-right: 20rpx;
margin-left: 20rpx;
}
.avatar {
width: 100%;
height: 100%;
border-radius: 50%;
}
.NameMoney {
display: flex;
flex-direction: column;
}
.TimeMoney {
width: 300rpx;
display: flex;
font-weight: bold;
font-size: 27rpx;
color: #161616;
}
.NameMoney_Name {
width: 400rpx;
text-align: left;
font-weight: bold;
font-size: 27rpx;
color: #161616;
white-space: nowrap; /* 防止换行 */
overflow: hidden; /* 隐藏溢出内容 */
text-overflow: ellipsis; /* 显示省略号 */
}
.TimeMoney_Time {
display: flex;
align-items: center;
margin-top: 10rpx;
}
.pkTimeimg {
width: 31.49rpx;
height: 31.49rpx;
margin-right: 10rpx;
}
.goldimg {
width: 31.49rpx;
height: 35rpx;
margin-left: 40rpx;
}
.goldnb {
display: flex;
margin-left: 5rpx;
}
.noData{
width: 500rpx;
height: 400rpx;
border-radius: 10px;
font-size: 30rpx;
color: #999;
}
2025-06-19 22:27:00 +08:00
.scroll {
width: 500rpx;
height: 400rpx;
border-radius: 10px;
/* background-color: #fff; */
}
.popup-text {
color: #161616;
font-size: 36.26rpx;
font-weight: bold;
margin-bottom: 30rpx;
}
.card-content {
/* width: 445rpx; */
width: 100%;
height: 100rpx;
background-color: #ffffff;
/* border: 2px solid #afafaf; */
border-radius: 10rpx;
display: flex;
align-items: center;
font-size: 28rpx;
color: rgb(127, 127, 127);
margin-top: 20rpx;
}
.createModule {
position: fixed;
bottom: 0;
right: 0;
z-index: 998;
width: 100vw;
}
2025-06-20 14:11:55 +08:00
.popup-btn {
display: flex;
justify-content: space-around;
margin-top: 50rpx;
}
.invite {
width: 225.19rpx;
height: 78.24rpx;
font-size: 28.63rpx;
line-height: 80rpx;
border-top-left-radius: 50rpx;
border-bottom-left-radius: 50rpx;
border-bottom-right-radius: 50rpx;
background-image: linear-gradient(135deg, #4fcacd, #5fdbde);
}
.cancel {
width: 225.19rpx;
height: 78.24rpx;
font-size: 28.63rpx;
line-height: 80rpx;
margin-left: 30rpx;
color: #03aba8;
border-top-left-radius: 50rpx;
border-bottom-left-radius: 50rpx;
border-bottom-right-radius: 50rpx;
border: 1rpx solid #03aba8;
}
2025-05-16 21:53:47 +08:00
</style>