Files
tk-mini-program/pages/PKMessageprocessing/PKMessageprocessing.vue

588 lines
15 KiB
Vue
Raw Normal View History

2025-06-03 22:12:34 +08:00
<template>
<view class="container">
<view class="background">
<image
style="width: 100%; height: 100%"
2025-06-10 23:06:51 +08:00
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/HomeBackground.png"
2025-06-03 22:12:34 +08:00
mode="scaleToFill"
/>
</view>
<view class="Navigation">
<view class="Return" @click="goBack">
2025-07-25 16:39:52 +08:00
<image
class="Return"
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Return.png"
mode="scaleToFill"
/>
2025-06-03 22:12:34 +08:00
</view>
</view>
<view class="Content">
<!-- 发布者 -->
<view class="sender">
<view class="sengderIcon">
<image class="Icon" :src="SenderData.anchorIcon" mode="scaleToFill" />
</view>
<view class="Individual">
2025-08-05 22:05:56 +08:00
<view class="name">{{ SenderData.disPlayId }}</view>
2025-06-03 22:12:34 +08:00
<view class="GenderAndAge">
<view class="male" v-if="SenderData.sex === '1'">
<view>
<image
style="width: 20rpx; height: 20rpx"
2025-06-10 23:06:51 +08:00
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/male.png"
2025-06-03 22:12:34 +08:00
mode="scaleToFill"
/>
</view>
2025-06-06 22:36:41 +08:00
<view class="age"> {{ SenderData.sex == 1 ? "男" : "女" }} </view>
2025-06-03 22:12:34 +08:00
</view>
<view class="female" v-else>
<view>
<image
style="width: 20rpx; height: 20rpx"
2025-06-10 23:06:51 +08:00
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/female.png"
2025-06-03 22:12:34 +08:00
mode="scaleToFill"
/>
</view>
2025-06-06 22:36:41 +08:00
<view class="age">{{ SenderData.sex == 1 ? "男" : "女" }}</view>
2025-06-03 22:12:34 +08:00
</view>
</view>
<view class="nation">{{ SenderData.country }}</view>
</view>
<view class="Time">PK时间:{{ formatDate(SenderData.pkTime) }}</view>
<view class="SessionAndGoldCoin">
<view class="goldCoin">
<image
style="width: 72rpx; height: 72rpx; margin-left: 36rpx; margin-right: 32rpx"
2025-06-10 23:06:51 +08:00
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/gold.png"
2025-06-03 22:12:34 +08:00
mode="scaleToFill"
/>
<view class="goldcard">
<view class="goldnumber">{{ SenderData.coin }}</view>
<view class="goldtext">金币</view>
</view>
</view>
<view class="Session">
<image
style="width: 72rpx; height: 72rpx; margin-left: 36rpx; margin-right: 32rpx"
2025-06-10 23:06:51 +08:00
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/session.png"
2025-06-03 22:12:34 +08:00
mode="scaleToFill"
/>
<view class="goldcard">
<view class="goldnumber">{{ SenderData.pkNumber }}</view>
<view class="goldtext">PK场数</view>
</view>
</view>
</view>
</view>
<!-- 被邀请者 -->
<view class="sender">
<view class="sengderIcon">
<image class="Icon" :src="ReceiverData.anchorIcon" mode="scaleToFill" />
</view>
<view class="Individual">
2025-08-05 22:05:56 +08:00
<view class="name">{{ ReceiverData.disPlayId }}</view>
2025-06-03 22:12:34 +08:00
<view class="GenderAndAge">
<view class="male" v-if="ReceiverData.sex === '1'">
<view>
<image
style="width: 20rpx; height: 20rpx"
2025-06-10 23:06:51 +08:00
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/male.png"
2025-06-03 22:12:34 +08:00
mode="scaleToFill"
/>
</view>
2025-06-06 22:36:41 +08:00
<view class="age"> {{ ReceiverData.sex == 1 ? "男" : "女" }} </view>
2025-06-03 22:12:34 +08:00
</view>
<view class="female" v-else>
<view>
<image
style="width: 20rpx; height: 20rpx"
2025-06-10 23:06:51 +08:00
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/female.png"
2025-06-03 22:12:34 +08:00
mode="scaleToFill"
/>
</view>
2025-06-06 22:36:41 +08:00
<view class="age">{{ ReceiverData.sex == 1 ? "男" : "女" }}</view>
2025-06-03 22:12:34 +08:00
</view>
</view>
<view class="nation">{{ ReceiverData.country }}</view>
</view>
<view class="Time">PK时间:{{ formatDate(ReceiverData.pkTime) }}</view>
<view class="SessionAndGoldCoin">
<view class="goldCoin">
<image
style="width: 72rpx; height: 72rpx; margin-left: 36rpx; margin-right: 32rpx"
2025-06-10 23:06:51 +08:00
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/gold.png"
2025-06-03 22:12:34 +08:00
mode="scaleToFill"
/>
<view>
<view class="goldnumber">{{ ReceiverData.coin }}</view>
<view class="goldtext">金币</view>
</view>
</view>
<view class="Session">
<image
style="width: 72rpx; height: 72rpx; margin-left: 36rpx; margin-right: 32rpx"
2025-06-10 23:06:51 +08:00
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/session.png"
2025-06-03 22:12:34 +08:00
mode="scaleToFill"
/>
<view>
<view class="goldnumber">{{ ReceiverData.pkNumber }}</view>
<view class="goldtext">PK场数</view>
</view>
</view>
</view>
</view>
2025-06-11 22:16:44 +08:00
<!-- 邀请信息 -->
2025-08-05 22:05:56 +08:00
<view class="flex">
2025-07-25 16:39:52 +08:00
<view
class="button"
v-if="PkIDInfodata.pkStatus === 0 && ReceiverData.senderId !== id"
>
2025-06-20 21:55:09 +08:00
<button class="accept" @click="AcceptHint()">接受邀请</button>
<button class="reject" @click="RefuseHint()">拒绝邀请</button>
2025-06-03 22:12:34 +08:00
</view>
2025-08-05 22:05:56 +08:00
</view>
<view class="flex">
2025-07-25 16:39:52 +08:00
<view
v-if="ReceiverData.senderId === id && PkIDInfodata.pkStatus === 0"
class="button buttontext"
>等待对方接受邀请</view
>
2025-08-05 22:05:56 +08:00
</view>
<view class="flex">
2025-06-09 19:18:38 +08:00
<view v-if="PkIDInfodata.pkStatus === 1" class="button buttontext">已接受邀请</view>
2025-08-05 22:05:56 +08:00
</view>
<view class="flex">
2025-06-09 19:18:38 +08:00
<view v-if="PkIDInfodata.pkStatus === 2" class="button buttontext">已拒绝邀请</view>
2025-06-03 22:12:34 +08:00
</view>
2025-08-05 22:05:56 +08:00
</view>
2025-06-03 22:12:34 +08:00
</view>
2025-08-05 22:05:56 +08:00
2025-06-20 21:55:09 +08:00
<uni-popup ref="popups" type="center" border-radius="10px 10px 0 0">
<view class="popup-Hintcontent">
<view class="popup-text">提示</view>
<view class="popup-texts">邀请成功后的pk不可修改不可删除请谨慎操作</view>
<view class="popup-btn">
<button class="invite" type="primary" @click="operation(1)">确认</button>
<button class="cancel" type="default" @click="closeHint()">取消</button>
</view>
</view>
</uni-popup>
<uni-popup ref="Refusepopup" type="center" border-radius="10px 10px 0 0">
<view class="popup-Hintcontent">
<view class="popup-text">提示</view>
<view class="popup-texts">您确定要拒绝该邀请吗</view>
<view class="popup-btn">
<button class="invite" type="primary" @click="operation(2)">确认</button>
<button class="cancel" type="default" @click="RefuseHintcloseHint()">取消</button>
</view>
</view>
</uni-popup>
2025-06-03 22:12:34 +08:00
</template>
<script>
import request from "../../components/request.js";
import formatDate from "../../components/formatDate.js";
export default {
data() {
return {
customData: {},
SenderData: {},
ReceiverData: {},
2025-06-09 19:18:38 +08:00
PkIDInfodata: {},
2025-06-11 22:16:44 +08:00
id: "",
2025-06-03 22:12:34 +08:00
};
},
onLoad(options) {
2025-06-11 22:16:44 +08:00
uni.getStorage({
key: "userinfo",
success: (res) => {
this.id = res.data.id;
},
});
2025-06-03 22:12:34 +08:00
this.customData = JSON.parse(options.customData);
2025-07-21 22:10:59 +08:00
setTimeout(() => {
this.getPkIDInfo();
2025-07-25 16:39:52 +08:00
this.getPkyourInfo();
this.getPkmineInfo();
}, 1000);
2025-06-03 22:12:34 +08:00
},
2025-06-23 22:00:46 +08:00
onShareAppMessage(res) {
2025-07-25 16:39:52 +08:00
if (res.from === "menu") {
2025-06-23 22:00:46 +08:00
return {
2025-07-25 16:39:52 +08:00
title: "分享",
path: `${
getCurrentPages()[getCurrentPages().length - 1].route
}?customData=${JSON.stringify(this.customData)}`,
};
2025-06-23 22:00:46 +08:00
}
},
2025-06-03 22:12:34 +08:00
methods: {
2025-06-09 19:18:38 +08:00
//根据当前消息ID查询pk信息
async getPkIDInfo() {
const res = await request({
url: "pk/singleRecord",
method: "POST",
data: {
id: this.customData.id,
},
2025-07-25 16:39:52 +08:00
userInfo: true,
2025-06-09 19:18:38 +08:00
}).then((res) => {
2025-07-21 22:10:59 +08:00
console.log(res.data);
2025-06-09 19:18:38 +08:00
this.PkIDInfodata = res.data;
});
},
2025-06-03 22:12:34 +08:00
//发布者
async getPkyourInfo() {
const res = await request({
url: "pk/pkInfoDetail",
method: "POST",
data: {
id: this.customData.pkIdA,
2025-07-25 16:39:52 +08:00
userId: this.id,
from: 2,
2025-06-03 22:12:34 +08:00
},
2025-06-23 22:00:46 +08:00
userInfo: false,
2025-06-03 22:12:34 +08:00
}).then((res) => {
2025-07-25 16:39:52 +08:00
console.log(res);
if (res.code === 200) {
console.log(res.data);
this.SenderData = res.data;
}else{
wx.showToast({
title: "获取发布者信息失败",
icon: "none",
duration: 2000,
});
}
2025-06-03 22:12:34 +08:00
});
},
//被邀请者
async getPkmineInfo() {
const res = await request({
url: "pk/pkInfoDetail",
method: "POST",
data: {
id: this.customData.pkIdB,
2025-07-25 16:39:52 +08:00
userId: this.id,
from: 2,
2025-06-03 22:12:34 +08:00
},
2025-06-23 22:00:46 +08:00
userInfo: false,
2025-06-03 22:12:34 +08:00
}).then((res) => {
2025-07-25 16:39:52 +08:00
if (res.code === 200) {
2025-06-20 21:55:09 +08:00
console.log(res.data);
2025-06-03 22:12:34 +08:00
this.ReceiverData = res.data;
2025-07-25 16:39:52 +08:00
}else{
wx.showToast({
title: "获取被邀请者信息失败",
icon: "none",
duration: 2000,
});
}
2025-06-03 22:12:34 +08:00
});
},
2025-06-19 22:27:00 +08:00
//返回上一页
2025-06-03 22:12:34 +08:00
goBack() {
wx.navigateBack({
delta: 1,
});
},
formatDate: formatDate,
2025-06-20 21:55:09 +08:00
//接受邀请提示
2025-07-25 16:39:52 +08:00
AcceptHint() {
this.$refs.popups.open("center");
2025-06-20 21:55:09 +08:00
},
2025-07-25 16:39:52 +08:00
closeHint() {
2025-06-20 21:55:09 +08:00
this.$refs.popups.close();
},
//拒绝邀请提示
2025-07-25 16:39:52 +08:00
RefuseHint() {
this.$refs.Refusepopup.open("center");
2025-06-20 21:55:09 +08:00
},
2025-07-25 16:39:52 +08:00
RefuseHintcloseHint() {
2025-06-20 21:55:09 +08:00
this.$refs.Refusepopup.close();
},
//操作
2025-06-03 22:12:34 +08:00
async operation(status) {
const res = await request({
2025-06-06 22:36:41 +08:00
url: "pk/updatePkStatus",
2025-06-03 22:12:34 +08:00
method: "POST",
data: {
2025-06-09 19:18:38 +08:00
id: this.customData.id,
2025-06-06 22:36:41 +08:00
pkStatus: status,
2025-06-03 22:12:34 +08:00
},
2025-06-09 19:18:38 +08:00
userInfo: true,
2025-06-03 22:12:34 +08:00
}).then((res) => {
const Hinttext = status === 1 ? "接受邀请成功" : "拒绝邀请成功";
if (res.code === 200) {
2025-07-25 16:39:52 +08:00
this.getPkIDInfo();
this.$refs.popups.close();
this.$refs.Refusepopup.close();
wx.showToast({
title: Hinttext,
icon: "success",
duration: 2000,
});
wx.navigateBack({
delta: 1,
});
} else {
wx.showToast({
title: "操作失败",
icon: "none",
duration: 2000,
});
2025-06-03 22:12:34 +08:00
}
});
},
},
};
</script>
<style scoped>
.background {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -1;
}
.Navigation {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 200rpx;
display: flex;
align-items: center;
padding: 0 60rpx;
z-index: 1;
}
.Return {
width: 60rpx;
height: 60rpx;
margin-top: 20rpx;
}
.Content {
position: absolute;
top: 200rpx;
left: 0;
right: 0;
bottom: 0;
display: flex;
flex-direction: column;
align-items: center;
}
.sender {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
2025-08-05 22:05:56 +08:00
margin-top: 10rpx;
2025-06-03 22:12:34 +08:00
}
.sengderIcon {
width: 150rpx;
height: 150rpx;
border-radius: 50%;
background-color: #fff;
display: flex;
justify-content: center;
align-items: center;
}
.Icon {
width: 100%;
height: 100%;
border-radius: 50%;
}
.Individual {
display: flex;
justify-content: center;
align-items: center;
margin-top: 34.35rpx;
}
.name {
font-size: 30.53rpx;
color: #161616;
margin-right: 16.22rpx;
}
.nation {
width: 56.3rpx;
height: 29.58rpx;
font-size: 17.18rpx;
color: #666666;
text-align: center;
line-height: 29.58rpx;
background-color: #fff;
border-radius: 50rpx;
padding: 6rpx 12rpx;
display: flex;
justify-content: center;
align-items: center;
}
.male {
width: 56.3rpx;
height: 29.58rpx;
background-color: #5bced1;
border-radius: 50rpx;
display: flex;
justify-content: center;
align-items: center;
padding: 6rpx 12rpx;
margin-right: 12rpx;
}
.female {
width: 56.3rpx;
height: 29.58rpx;
background-color: #f3876f;
border-radius: 50rpx;
display: flex;
justify-content: center;
align-items: center;
padding: 6rpx 12rpx;
margin-right: 12rpx;
}
.age {
font-size: 17.18rpx;
color: #fff;
margin-left: 4rpx;
}
.Time {
color: #666666;
font-size: 26.72rpx;
margin-top: 48.7rpx;
}
.goldCoin {
2025-06-10 23:06:51 +08:00
background-image: url("https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Backgroundofgoldcoins.png");
2025-06-03 22:12:34 +08:00
width: 334.83rpx;
height: 124.05rpx;
margin-right: 21rpx;
display: flex;
align-items: center;
}
.Session {
2025-06-10 23:06:51 +08:00
background-image: url("https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Fieldnumberbackground.png");
2025-06-03 22:12:34 +08:00
width: 334.83rpx;
height: 124.05rpx;
display: flex;
align-items: center;
}
.SessionAndGoldCoin {
display: flex;
justify-content: center;
align-items: center;
margin-top: 60rpx;
display: flex;
justify-content: center;
}
.goldtext {
font-size: 28.63rpx;
color: #929292;
}
.goldnumber {
font-size: 34.35rpx;
color: #161616;
font-weight: bold;
}
.goldcard {
display: flex;
flex-direction: column;
align-items: center;
}
2025-08-05 22:05:56 +08:00
.flex{
position: fixed;
left: 0;
right: 0;
bottom: 15px;
}
2025-06-03 22:12:34 +08:00
.button {
display: flex;
justify-content: center;
align-items: center;
}
2025-07-25 16:39:52 +08:00
.buttontext {
2025-06-09 19:18:38 +08:00
font-size: 40rpx;
color: #666666;
font-weight: bold;
}
2025-06-03 22:12:34 +08:00
.accept {
width: 325.38rpx;
height: 77.29rpx;
margin-right: 35.5rpx;
border-radius: 50rpx;
background-color: #fff;
border: 1rpx solid #03aba8;
color: #03aba8;
font-size: 28.63rpx;
line-height: 77.29rpx;
}
.reject {
width: 325.38rpx;
height: 77.29rpx;
border-radius: 50rpx;
background-color: #03aba8;
border: 1rpx solid #03aba8;
color: #fff;
font-size: 28.63rpx;
line-height: 77.29rpx;
}
2025-07-25 16:39:52 +08:00
.popup-Hintcontent {
2025-06-20 21:55:09 +08:00
width: 600rpx;
height: 500rpx;
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-text {
color: #161616;
font-size: 36.26rpx;
font-weight: bold;
margin-bottom: 30rpx;
}
2025-07-25 16:39:52 +08:00
.popup-texts {
2025-06-20 21:55:09 +08:00
margin-left: 50rpx;
color: #7e7e7e;
font-size: 26rpx;
margin-right: 50rpx;
margin-top: 70rpx;
margin-bottom: 70rpx;
}
.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-06-03 22:12:34 +08:00
</style>