This commit is contained in:
pengxiaolong
2025-07-21 22:10:59 +08:00
parent 31527ba8a6
commit 7116e57fc3
157 changed files with 2793 additions and 405 deletions

View File

@@ -157,6 +157,12 @@ export default {
width: 100%;
height: 93%;
}
.scroll ::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.card{
width: 570rpx;
background-color: #ffffff;

View File

@@ -592,6 +592,12 @@ export default {
justify-content: center;
align-items: center;
}
.scroll ::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.content-list {
display: flex;
align-items: center;

View File

@@ -571,6 +571,12 @@ export default {
flex-direction: column;
align-items: center;
}
.scroll ::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.PKInformation {
margin-top: 48.5rpx;
}

View File

@@ -361,6 +361,12 @@ export default {
width: 750rpx;
height: 1100rpx;
}
.scroll ::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.contentcard {
width: 694.66rpx;
height: 161.26rpx;

View File

@@ -236,6 +236,12 @@ export default {
height: 1300rpx;
width: 100%;
}
.scroll ::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.empty{
position: absolute;
top: 200rpx;

View File

@@ -392,6 +392,12 @@ export default {
height: 1300rpx;
width: 100%;
}
.scroll ::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.no-data{
position: absolute;
top: 200rpx;

View File

@@ -299,6 +299,12 @@ export default {
flex-direction: column;
align-items: center;
}
.scroll ::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.nodata {
width: 100%;
height: 100%;

View File

@@ -163,6 +163,12 @@ export default {
height: 100%;
width: 750rpx;
}
.scroll ::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.empty{
height: 100%;
width: 750rpx;

View File

@@ -717,6 +717,12 @@ export default {
width: 90%;
height: 500rpx;
}
.scroll ::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.card {
margin-top: 15rpx;
}

View File

@@ -124,6 +124,12 @@ export default {
width: 100%;
height: 100%;
}
.scroll ::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.serviceProtocolContent{
width: 100%;
height: 100%;

View File

@@ -689,6 +689,12 @@ export default {
width: 90%;
height: 500rpx;
}
.scroll ::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.card{
margin-top: 15rpx;
}

View File

@@ -179,7 +179,6 @@ export default {
};
},
onLoad(options) {
uni.getStorage({
key: "userinfo",
success: (res) => {
@@ -187,10 +186,11 @@ export default {
},
});
this.customData = JSON.parse(options.customData);
console.log("customData", this.customData);
setTimeout(() => {
this.getPkIDInfo();
this.getPkyourInfo();
this.getPkmineInfo();
this.getPkIDInfo();
}, 500);
},
onShareAppMessage(res) {
if (res.from === 'menu') {
@@ -211,6 +211,7 @@ export default {
},
userInfo: true
}).then((res) => {
console.log(res.data);
this.PkIDInfodata = res.data;
});
},

View File

@@ -19,6 +19,7 @@
import request from "../../components/request.js";
import postFile from "../../components/postFile.js";
import generateFileName from "../../components/generateFileName.js";
import { goEasylogin,goEasylogout } from "../../components/goEasyTool/tool.js";
export default {
inject: ["$global"],
@@ -64,6 +65,7 @@ export default {
},
// 微信登录
wxLogin(e) {
goEasylogout(this.$goeasy);
uni.showLoading({
title: "修改中...",
mask: true,
@@ -91,6 +93,7 @@ export default {
icon: "success",
});
uni.setStorageSync("userinfo", ress.data.info);
goEasylogin(this.$goeasy,String(ress.data.info.id),ress.data.info.headerIcon,ress.data.info.nickName);
uni.hideLoading();
//```````````````````````````````````````````````````````````````````````登录成功后跳转回原页面 或 首页
uni.navigateBack({

View File

@@ -34,12 +34,8 @@
show-scrollbar="false"
scroll-y="true"
class="scroll"
refresher-enabled="true"
refresher-threshold="40"
@refresherrefresh="onRefresherRefresh"
lower-threshold="100"
@scrolltolower="onScrollToLower"
:refresher-triggered="triggered"
upper-threshold="100"
@scrolltoupper="onScrollToUpper"
:scroll-into-view="ElementPositioning"
@scroll="onScroll"
>
@@ -49,11 +45,50 @@
:key="item.id"
:id="item.id"
>
<view class="chat-time"v-if="checkInterval(item.timestamp)">{{
<view class="chat-time" v-if="item.timestampStatus">{{
TimeFormatting(item.timestamp)
}}</view>
<view class="chat-avatar">
<!-- <textmessage :messagetext="item.payload.text"></textmessage> -->
<!-- 对方消息 -->
<view class="oppositeChatNews" v-if="item.senderId == userId">
<image class="chat-avatarImg" :src="avatar" mode="scaleToFill" />
<view class="oppositesharpCorner">
<view class="oppositeSharpCornercion"></view>
</view>
<view class="oppositeChatNewsContent">
<!-- 消息类型 -->
<textmessage
v-if="item.type == 'text'"
:messagetext="item.payload.text"
></textmessage>
<customPKMessage
v-if="item.type == 'pk'"
:message="item.payload"
></customPKMessage>
</view>
</view>
<!-- 自己消息 -->
<view class="myChatNews" v-if="item.senderId == userinfo.id">
<image
class="chat-avatarImg"
:src="userinfo.headerIcon"
mode="scaleToFill"
/>
<view class="mysharpCorner">
<view class="mySharpCornercion"></view>
</view>
<view class="myChatNewsContent">
<!-- 消息类型 -->
<textmessage
v-if="item.type == 'text'"
:messagetext="item.payload.text"
></textmessage>
<customPKMessage
v-if="item.type == 'pk'"
:message="item.payload"
></customPKMessage>
</view>
</view>
</view>
</view>
</scroll-view>
@@ -64,10 +99,10 @@
id:inputComponent
:style="{
bottom:
MoreStatus || KeyboardHeight != 0
MoreStatus || KeyboardHeight > 300
? MoreStatus
? '650rpx'
: KeyboardHeight != 0
: KeyboardHeight > 300
? KeyboardHeight + 'rpx'
: '0'
: '0',
@@ -102,10 +137,10 @@
class="MoreComponent"
:style="{
bottom:
MoreStatus || KeyboardHeight != 0
MoreStatus || KeyboardHeight > 300
? MoreStatus
? '0'
: KeyboardHeight != 0
: KeyboardHeight > 300
? '0'
: KeyboardHeight + 'rpx'
: '-650rpx',
@@ -131,9 +166,14 @@
@click.stop
:style="{ bottom: MoreItemStatus == null ? '-1000rpx' : '0' }"
>
<!-- 更多相关消息组件 -->
<!-- 自定义消息组件 -->
<InvitationComponents
v-if="MoreItemStatus == 'Invitation'"
:oppositeId="userId"
:myId="userinfo.id"
:avatar="avatar"
:nickname="nickname"
@refreshMessage="refreshMessage"
></InvitationComponents>
</view>
</view>
@@ -142,13 +182,18 @@
<script>
import textmessage from "./messageComponent/textmessage";
import customPKMessage from "./messageComponent/customPKMessage";
import InvitationComponents from "./moreMessageComponents/InvitationComponents";
import { generateId } from "../../../components/ChatId.js";
import TimeFormatting from "../../../components/TimeFormatting.js";
import picturesVideosMessages from "../../../components/picturesVideosMessages.js";
import audioMessages from "../../../components/audioMessages.js";
import request from "../../../components/request.js";
import {
getConversationMessages,
sendMessage,
messageRead,
sendCustomMessage,
} from "../../../components/goEasyTool/tool.js";
import GoEasy from "goeasy";
export default {
@@ -156,7 +201,6 @@ export default {
return {
userId: "", // 对方用户id
nickname: "", // 对方用户昵称
triggered: false, // 下拉刷新状态
avatar: "", // 对方用户头像
chatList: [], // 聊天记录
userinfo: {}, // 自己用户信息
@@ -175,7 +219,18 @@ export default {
onPage: false, // 是否在页面
timer: null, // 定时器
lastTimestamp: null, // 上一次刷新时间戳
LastTime: null, // 最后聊天记录的时间戳
MoreMessageList: [],
Record: null, // 定位记录
myitem: null, //直接发送自定义消息的我的选中主播
youritem: null, //直接发送自定义消息的对方选中主播
type: null, //直接发送自定义消息的消息类型
popUpList: [
{
name: "相册",
icon: "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Album.png",
type: "Album",
},
{
name: "邀请",
icon: "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/chat_invite.png",
@@ -186,6 +241,9 @@ export default {
},
onShow() {
this.onPage = true;
uni.onKeyboardHeightChange((res) => {
this.KeyboardHeight = res.height * 2 - this.ioshide;
});
},
onHide() {
this.onPage = false;
@@ -194,21 +252,40 @@ export default {
uni.getStorage({
key: "userinfo",
success: (res) => {
this.userinfo = res;
this.userinfo = res.data;
},
});
this.userId = options.userId;
this.nickname = options.nickname;
this.avatar = options.avatar;
this.type = options.type;
try {
this.myitem = JSON.parse(options.myitem);
this.youritem = JSON.parse(options.youritem);
} catch (e) {}
if (this.type == "pk") {
setTimeout(() => {
this.sendCustomMessage();
}, 500);
}
// 获取和对方用户的聊天记录
getConversationMessages(this.$goeasy, this.userId, null).then((res) => {
this.chatList = res.map((item) => {
item.id = generateId();
item.timestampStatus = this.checkInterval(item.timestamp);
return item;
});
console.log("获取和对方用户的聊天记录", this.chatList);
setTimeout(() => {
this.ElementPositioning = this.chatList[this.chatList.length - 1].id;
if (this.chatList.length > 0) {
this.ElementPositioning = this.chatList[this.chatList.length - 1].id;
this.LastTime = this.chatList[0].timestamp;
} else {
uni.showToast({
title: "您和对方暂无聊天记录,快去聊天吧",
icon: "none",
duration: 2000,
});
}
}, 300);
const query = uni.createSelectorQuery().in(this);
query
@@ -230,6 +307,62 @@ export default {
this.getscrollviewheight();
},
methods: {
//直接发送自定义消息
sendCustomMessage() {
request({
url: "pk/createPkRecord",
method: "POST",
data: {
pkIdA: this.youritem.id,
pkIdB: this.myitem.id,
userIdA: this.userId,
userIdB: this.userinfo.id,
pkTime: this.youritem.pkTime,
pkNumber: this.youritem.pkNumber,
anchorIdA: this.youritem.anchorId,
anchorIdB: this.myitem.anchorId,
anchorIconA: this.youritem.anchorIcon,
anchorIconB: this.myitem.anchorIcon,
piIdA: this.youritem.id,
piIdB: this.myitem.id,
},
userInfo: true,
}).then((res) => {
if (res.code == 200) {
const customData = {
id: res.data.id,
pkIdA: this.youritem.id,
pkIdB: this.myitem.id,
};
let order = {
customData: customData,
link: "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/pk.png",
text: "PK邀请消息",
};
sendCustomMessage(
this.$goeasy,
this.type,
this.userId,
order,
this.avatar,
this.nickname
).then((res) => {
this.ElementPositioning = res.id = generateId();
res.timestampStatus = this.checkInterval(res.timestamp);
this.chatList.push(res);
uni.showToast({
title: "发送成功",
icon: "none",
});
});
} else {
uni.showToast({
title: res.msg,
icon: "none",
});
}
});
},
//时间显示
checkInterval(timestamp) {
if (!this.lastTimestamp) {
@@ -243,7 +376,6 @@ export default {
this.lastTimestamp = timestamp;
return true;
}
return false;
},
@@ -270,17 +402,37 @@ export default {
this.Scrolling = false;
}
},
//获取更多聊天记录
onScrollToUpper() {
this.lastTimestamp = null;
getConversationMessages(this.$goeasy, this.userId, this.LastTime).then((res) => {
this.Record = this.chatList[0].id;
this.MoreMessageList = res.map((item) => {
item.id = generateId();
item.timestampStatus = this.checkInterval(item.timestamp);
return item;
});
});
setTimeout(() => {
this.chatList = [...this.MoreMessageList, ...this.chatList];
console.log("获取更多聊天记录", this.chatList);
this.LastTime = this.chatList[0].timestamp;
this.ElementPositioning = this.Record;
}, 300);
},
//监听已读消息
onMessageRead(message) {
console.log("已读消息", message);
console.log("1已读消息", message);
},
//监听接受消息
onPrivateMessageReceived(message) {
if (!this.Scrolling) {
this.ElementPositioning = message.id = generateId();
message.timestampStatus = this.checkInterval(message.timestamp);
this.judgescrollTop = false;
} else {
message.id = generateId();
message.timestampStatus = this.checkInterval(message.timestamp);
}
this.chatList.push(message);
if (this.onPage) {
@@ -301,6 +453,7 @@ export default {
).then((res) => {
console.log("发送成功", res);
this.ElementPositioning = res.id = generateId();
res.timestampStatus = this.checkInterval(res.timestamp);
this.chatList.push(res);
this.judgescrollTop = false;
});
@@ -308,7 +461,15 @@ export default {
this.ButtonStatus = false;
}
},
//自定义消息发送返回处理
refreshMessage(message) {
this.MoreItemStatus = null;
this.ElementPositioning = message.message.id = generateId();
message.timestampStatus = this.checkInterval(message.message.timestamp);
this.chatList.push(message.message);
this.judgescrollTop = false;
this.MoreStatus = false;
},
//ios兼容
getIOSDeviceType() {
const systemInfo = uni.getSystemInfoSync();
@@ -343,7 +504,36 @@ export default {
},
//更多消息类型弹窗点击事件
onMoreItem(type) {
this.MoreItemStatus = type;
if (type == "Album") {
this.onSendMedia(); //发送图片,视频消息
} else {
this.MoreItemStatus = type;
}
},
//发送图片,视频消息
onSendMedia() {
//picturesVideosMessages
uni.chooseMedia({
count: 9,
mediaType: ["image", "video"],
sourceType: ["album", "camera"],
maxDuration: 60,
camera: "front",
success(res) {
console.log(res.tempFiles);
if (res.tempFiles.fileType == "image") {
}else if (res.tempFiles.fileType == "video") {
}
},
});
},
//发送音频消息
onSendAudio() {
//audioMessages
},
// 获取键盘高度
onFocus(event) {
@@ -355,7 +545,6 @@ export default {
this.judgescrollTop = false;
}
this.getscrollviewheight();
this.KeyboardHeight = event.detail.height * 2 - this.ioshide;
const query = uni.createSelectorQuery().in(this);
query
.select(".inputComponent")
@@ -366,7 +555,6 @@ export default {
},
//键盘消失
onBlur(event) {
this.KeyboardHeight = 0;
const query = uni.createSelectorQuery().in(this);
query
.select(".inputComponent")
@@ -402,6 +590,7 @@ export default {
components: {
textmessage,
InvitationComponents,
customPKMessage,
},
};
</script>
@@ -451,6 +640,12 @@ export default {
height: 100%;
padding: 0% 2% 0% 2%;
}
.scroll ::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.inputComponent {
position: absolute;
left: 0;
@@ -460,14 +655,15 @@ export default {
padding: 15rpx 15rpx 37.5rpx 15rpx;
display: flex;
align-items: flex-end;
transition: bottom 0.1s ease;
transition: bottom 0.25s ease;
}
.chat-card {
width: 100%;
height: auto;
margin-bottom: 20rpx;
margin-top: 20rpx;
margin-bottom: 10rpx;
margin-top: 10rpx;
padding: 10rpx;
/* background-color: #ffffff; */
}
.chat-time {
width: 100%;
@@ -483,6 +679,66 @@ export default {
.chat-avatar {
width: 100%;
height: auto;
display: flex;
align-items: flex-start;
}
.oppositeChatNews {
width: 100%;
display: flex;
align-items: flex-start;
}
.oppositesharpCorner {
width: 20rpx;
height: 80rpx;
display: flex;
flex-direction: row-reverse;
align-items: center;
}
.oppositeSharpCornercion {
width: 0;
height: 0;
border-top: 13rpx solid transparent;
border-right: 13rpx solid #ffffff;
border-bottom: 13rpx solid transparent;
}
.oppositeChatNewsContent {
width: auto;
height: auto;
background-color: #ffffff;
border-radius: 10rpx;
max-width: 450rpx;
}
.myChatNews {
width: 100%;
display: flex;
flex-direction: row-reverse;
align-items: flex-start;
margin-right: 15rpx;
}
.mysharpCorner {
width: 20rpx;
height: 80rpx;
display: flex;
align-items: center;
}
.mySharpCornercion {
width: 0;
height: 0;
border-top: 13rpx solid transparent;
border-left: 13rpx solid #7bbd0093;
border-bottom: 13rpx solid transparent;
}
.myChatNewsContent {
width: auto;
height: auto;
background-color: #7bbd0093;
border-radius: 20rpx;
max-width: 450rpx;
}
.chat-avatarImg {
width: 80rpx;
height: 80rpx;
border-radius: 10rpx;
}
.textareacomponent {
width: 570rpx;
@@ -523,7 +779,7 @@ export default {
left: 0;
right: 0;
height: 650rpx;
transition: bottom 0.1s ease;
transition: bottom 0.25s ease;
background-color: #ffffff;
}
.Morecontent {
@@ -557,14 +813,15 @@ export default {
left: 0;
right: 0;
bottom: 0;
transition: top 0.1s ease;
transition: top 0.25s ease;
z-index: 1000;
}
.popUpInvitationContent {
position: absolute;
left: 0;
right: 0;
height: 1000rpx;
transition: bottom 0.1s ease;
transition: bottom 0.25s ease;
background-color: #ffffff;
border-top-left-radius: 40rpx;
border-top-right-radius: 40rpx;

View File

@@ -0,0 +1,48 @@
<template>
<!-- 自定义PK消息组件模板 -->
<view class="custom-pk-message" @click="onTap">
<image
:src="message.link"
mode="scaleToFill"
style="width: 100%;height: 100%;"
/>
</view>
</template>
<script>
export default {
props: {
message: {
type: String,
default: ''
}
},
data() {
return {
title: 'Hello'
}
},
onLoad() {
// 页面加载时执行
},
methods: {
// 方法定义
onTap() {
uni.navigateTo({
url: `/pages/PKMessageprocessing/PKMessageprocessing?customData=${JSON.stringify(this.message.customData)}`,
});
}
}
}
</script>
<style scoped>
.custom-pk-message{
width: 385rpx;
height: 195rpx;
padding: 20rpx;
background-color: #ffffff;
border-radius: 20rpx;
margin:19rpx 15rpx 19rpx 15rpx;;
}
</style>

View File

@@ -25,7 +25,9 @@
<style scoped>
.messagetext{
font-size: 16px;
font-size: 34rpx;
color: #333;
letter-spacing: 1rpx;
padding: 19rpx 30rpx 19rpx 30rpx;
}
</style>

View File

@@ -1,29 +1,622 @@
<template>
<view class="chat-more-message-invitation">
<view class="chat-more-message-invitation" @click.stop>
<!-- 对方主播 -->
<view class="chat-more-message-invitation-title">邀请对方参与PK</view>
<view class="oppositeAnchor" @click="showPopup(1)">
<view class="card" v-if="oppositselect != null">
<view class="card-select-select">
<view class="Avatarimg-select">
<image class="avatar" :src="oppositselect.anchorIcon" mode="scaleToFill" />
</view>
<view class="NameMoney">
<view class="TimeMoney">
<view class="NameMoney_Name-select">{{ oppositselect.anchorId }}</view>
</view>
<view class="TimeMoney_Time">
<view class="pkTimeimg">
<image
style="width: 31.49rpx; height: 31.49rpx; margin-top: 3rpx"
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/time.png"
mode="scaleToFill"
/>
</view>
<view>{{ TimeFormatting(oppositselect.pkTime) }}</view>
<view class="goldimg">
<image
style="width: 31.49rpx; height: 31.49rpx; margin-top: 4rpx"
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/species.png"
mode="scaleToFill"
/>
</view>
<view class="goldnb">{{ oppositselect.coin }}K</view>
</view>
</view>
</view>
</view>
<view class="noselect" v-if="oppositselect == null"
>点击选择您要参与PK的对方主播</view
>
</view>
<view class="footervs">
<view class="footervs_left">V</view>
<view class="footervs_right">S</view>
</view>
<view class="oppositeAnchor" @click="showPopup(0)">
<view class="card" v-if="myselect != null">
<view class="card-select-select">
<view class="Avatarimg-select">
<image class="avatar" :src="myselect.anchorIcon" mode="scaleToFill" />
</view>
<view class="NameMoney">
<view class="TimeMoney">
<view class="NameMoney_Name-select">{{ myselect.anchorId }}</view>
</view>
<view class="TimeMoney_Time">
<view class="pkTimeimg">
<image
style="width: 31.49rpx; height: 31.49rpx; margin-top: 3rpx"
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/time.png"
mode="scaleToFill"
/>
</view>
<view>{{ TimeFormatting(myselect.pkTime) }}</view>
<view class="goldimg">
<image
style="width: 31.49rpx; height: 31.49rpx; margin-top: 4rpx"
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/species.png"
mode="scaleToFill"
/>
</view>
<view class="goldnb">{{ myselect.coin }}K</view>
</view>
</view>
</view>
</view>
<view class="noselect" v-if="myselect == null">点击选择您要参与的主播</view>
</view>
<view class="Sendpkbtn" @click="sendMessage()"> 发送PK消息 </view>
</view>
<!-- 弹出框 -->
<uni-popup
class="popup"
ref="oppositepopup"
background-color="#fff"
@change="change"
border-radius="30px"
>
<view class="popup-content">
<view class="popup-title">{{
select == 1 ? "点击选择您要参与PK的对方主播" : "点击选择您要参与的主播"
}}</view>
<scroll-view
show-scrollbar="false"
scroll-y="true"
class="scroll"
v-if="list.length > 0"
>
<!-- -->
<view class="card" v-for="(item, index) in list" :key="index">
<view
class="card-content"
@click="Select(item.id, index)"
:style="{
background: selectedId === item.id ? '#b8ff8c74' : '#ffffff',
}"
>
<view class="Avatarimg">
<image class="avatar" :src="item.anchorIcon" mode="scaleToFill" />
</view>
<view class="NameMoney">
<view class="TimeMoney">
<view class="NameMoney_Name">{{ item.anchorId }}</view>
</view>
<view class="TimeMoney_Time">
<view class="pkTimeimg">
<image
style="width: 31.49rpx; height: 31.49rpx; margin-top: 3rpx"
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/time.png"
mode="scaleToFill"
/>
</view>
<view>{{ TimeFormatting(item.pkTime) }}</view>
<view class="goldimg">
<image
style="width: 31.49rpx; height: 31.49rpx; margin-top: 4rpx"
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/species.png"
mode="scaleToFill"
/>
</view>
<view class="goldnb">{{ item.coin }}K</view>
</view>
</view>
</view>
</view>
<!-- -->
</scroll-view>
<view class="nodata" v-if="list.length == 0">{{
select == 1 ? "对方还没有发布过pk" : "您还没有发布过pk"
}}</view>
<view class="popup-btn">
<button class="invite" type="primary" @click="invite()">确定</button>
<button class="cancel" type="default" @click="close()">取消</button>
</view>
</view>
</uni-popup>
<uni-popup
ref="confirmpopup"
background-color="#fff"
@change="change"
border-radius="30px"
>
<view class="popup-content">
<view class="popup-title">提示</view>
<view class="popup-content-text">
<view class="popup-content-text-content">您确定要发送PK邀请消息吗邀请成功后的pk不可修改不可删除请谨慎操作</view>
</view>
<view class="popup-btn">
<button class="invite" type="primary" @click="send()">确定</button>
<button class="cancel" type="default" @click="confirmClose()">取消</button>
</view>
</view>
</uni-popup>
</template>
<script>
export default {
data() {
return {
}
import request from "../../../../components/request.js";
import TimeFormatting from "../../../../components/TimeFormatting.js";
import { sendCustomMessage } from "../../../../components/goEasyTool/tool.js";
export default {
props: {
oppositeId: {
type: String,
required: true,
},
myId: {
type: String,
required: true,
},
nickname: {
type: String,
required: true,
},
avatar: {
type: String,
required: true,
},
},
data() {
return {
select: null, // 选择主播对象1:对方主播0自己主播
mylist: [], // 自己主播列表
oppositlist: [], // 对方主播列表
selectedId: null, // 选择的主播id
selectIndex: null, // 选择的主播索引
myselect: null, // 自己选择的主播对象
oppositselect: null, // 对方选择的主播对象
list: [], // 渲染的主播列表
};
},
created() {
this.getAnchorList(this.oppositeId);
this.getAnchorList(this.myId);
},
methods: {
//发送pk消息
send() {
request({
url: "pk/createPkRecord",
method: "POST",
data: {
pkIdA: this.oppositselect.id,
pkIdB: this.myselect.id,
userIdA: this.oppositeId,
userIdB: this.myId,
pkTime: this.oppositselect.pkTime,
pkNumber: this.oppositselect.pkNumber,
anchorIdA: this.oppositselect.anchorId,
anchorIdB: this.myselect.anchorId,
anchorIconA: this.oppositselect.anchorIcon,
anchorIconB: this.myselect.anchorIcon,
piIdA: this.oppositselect.id,
piIdB: this.myselect.id,
},
onLoad() {
// 页面加载时执行
},
methods: {
// 方法定义
userInfo: true,
}).then((res) => {
if (res.code == 200) {
const customData = {
id: res.data.id,
pkIdA: this.oppositselect.id,
pkIdB: this.myselect.id,
};
let order = {
customData: customData,
link: "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/pk.png",
text: "PK邀请消息",
};
let type = "pk";
sendCustomMessage(
this.$goeasy,
type,
this.oppositeId,
order,
this.avatar,
this.nickname
).then((res) => {
this.$emit("refreshMessage", { message: res });
});
this.$refs.confirmpopup.close();
this.$refs.oppositepopup.close();
this.myselect = null;
this.oppositselect = null;
uni.showToast({
title: "发送成功",
icon: "none",
});
} else {
uni.showToast({
title: res.msg,
icon: "none",
});
}
}
});
},
confirmClose() {
this.$refs.confirmpopup.close();
},
//发送pk消息
sendMessage() {
if (this.myselect && this.oppositselect) {
this.$refs.confirmpopup.open("center");
} else {
uni.showToast({
title: "请选择相应的主播",
icon: "none",
});
}
},
//选中
Select(id, index) {
if (this.selectedId === id) {
this.selectedId = null;
this.selectIndex = null;
} else {
this.selectedId = this.selectedId === id ? null : id;
this.selectIndex = index;
}
},
//取消
close() {
this.$refs.oppositepopup.close();
},
//确定
invite() {
if (this.selectedId) {
if (this.select == 1) {
this.oppositselect = this.oppositlist[this.selectIndex];
this.selectedId = null;
this.selectIndex = null;
} else {
this.myselect = this.mylist[this.selectIndex];
this.selectedId = null;
this.selectIndex = null;
}
} else {
uni.showToast({
title: "请选择主播",
icon: "none",
});
}
this.$refs.oppositepopup.close();
},
TimeFormatting: TimeFormatting,
//获取主播列表
getAnchorList(id) {
request({
url: "pk/listUninvitedPublishedAnchorsByUserId",
method: "POST",
data: {
userId: id,
},
userInfo: false,
}).then((res) => {
if (res.code == 200) {
if (id == this.myId) {
this.mylist = res.data;
console.log("mylist", this.mylist);
} else {
this.oppositlist = res.data;
console.log("oppositlist", this.oppositlist);
}
} else {
uni.showToast({
title: res.msg,
icon: "none",
});
}
});
},
showPopup(select) {
if (select == 1) {
this.list = this.oppositlist;
} else {
this.list = this.mylist;
}
this.select = select;
this.$refs.oppositepopup.open("center");
},
},
};
</script>
<style scoped>
.chat-more-message-invitation {
width: 100%;
height: 100%;
border-radius: 40rpx;
}
</style>
<style scoped>
.chat-more-message-invitation-title {
font-size: 60rpx;
width: 100%;
height: 100rpx;
text-align: center;
line-height: 100rpx;
font-weight: bold;
margin-top: 70rpx;
letter-spacing: 5rpx;
font-style: italic;
background-image: linear-gradient(135deg, #4fcacd, #5fdbde); /* 渐变方向和颜色 */
-webkit-background-clip: text; /* Chrome/Safari */
background-clip: text; /* Firefox/Edge */
color: transparent; /* 文字本身透明,显示背景渐变 */
-webkit-text-fill-color: transparent; /* 兼容旧版 Webkit */
}
.chat-more-message-invitation {
width: 100%;
height: 100%;
border-radius: 40rpx;
display: flex;
flex-direction: column;
align-items: center;
background-image: url(https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/chard1.png);
}
.oppositeAnchor {
width: 600rpx;
height: 150rpx;
background-color: rgb(255, 255, 255);
border-radius: 20rpx;
margin-top: 50rpx;
margin-bottom: 50rpx;
border: 2rpx solid #e4e4e4;
}
.footervs {
width: 100%;
height: 100rpx;
display: flex;
justify-content: center;
align-items: center;
}
.footervs_left {
font-size: 50rpx;
color: #ff65e5;
font-weight: bold;
font-style: italic;
}
.footervs_right {
font-size: 50rpx;
color: #65e8ff;
font-weight: bold;
font-style: italic;
}
.popup-title {
width: 100%;
height: 100rpx;
color: #000;
font-size: 40rpx;
text-align: center;
line-height: 100rpx;
font-weight: bold;
margin-top: 10rpx;
}
.popup-content-text {
width: 600rpx;
height: 450rpx;
display: flex;
justify-content: center;
align-items: center;
}
.popup-content-text-content{
color: #999;
font-size: 28rpx;
text-align: center;
font-weight: bold;
line-height: 70rpx;
}
.popup-content {
width: 700rpx;
height: 730rpx;
background-color: #fff;
border-radius: 30rpx;
background-image: url(https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/chard1.png);
background-position: center;
display: flex;
flex-direction: column;
align-items: center;
}
/* card */
.scroll {
width: 600rpx;
height: 450rpx;
border-radius: 10px;
/* background-color: #f5f5f5; */
}
.scroll ::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.nodata {
width: 600rpx;
height: 450rpx;
border-radius: 10px;
text-align: center;
line-height: 450rpx;
font-size: 30rpx;
color: #999;
font-weight: bold;
}
.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;
}
.card-select-select {
width: 100%;
height: 150rpx;
background-color: #ffffff;
border-radius: 20rpx;
display: flex;
align-items: center;
font-size: 28rpx;
color: rgb(127, 127, 127);
}
.card-select {
/* width: 445rpx; */
width: 100%;
height: 100%;
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;
}
.noselect {
width: 100%;
height: 100%;
background-color: #ffffff;
border-radius: 20rpx;
text-align: center;
line-height: 150rpx;
font-size: 30rpx;
color: #999;
font-weight: bold;
}
.Avatarimg {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
background-color: #dddddd;
margin-right: 20rpx;
margin-left: 20rpx;
}
.Avatarimg-select {
width: 100rpx;
height: 100rpx;
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; /* 显示省略号 */
}
.NameMoney_Name-select {
width: 500rpx;
text-align: left;
font-weight: bold;
font-size: 32rpx;
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;
}
.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;
}
.Sendpkbtn {
width: 90%;
height: 100rpx;
margin-top: 50rpx;
background-image: linear-gradient(135deg, #4fcacd, #5fdbde);
color: #ffffff;
font-weight: bold;
border-radius: 60rpx;
font-size: 35rpx;
text-align: center;
line-height: 100rpx;
font-weight: bold;
letter-spacing: 6rpx;
}
</style>

View File

@@ -10,45 +10,74 @@
<view class="title">消息</view>
</view>
<view class="content">
<scroll-view show-scrollbar="false" scroll-y="true" class="scroll">
<scroll-view
show-scrollbar="false"
scroll-y="true"
class="scroll"
v-if="Conversationobj.conversations.length > 0"
refresher-enabled="true"
refresher-threshold="40"
@refresherrefresh="onRefresherRefresh"
:refresher-triggered="triggered"
>
<view class="card" v-for="item in Conversationobj.conversations" :key="item.userId">
<uni-swipe-action>
<uni-swipe-action-item>
<view class="cardContent" @click="goChat(item.userId,item.data.nickname,item.data.avatar)">
<image
class="cardImg"
:src="item.data.avatar"
mode="scaleToFill"
/>
<view class="cardUnread" v-if="item.unread>0">{{ item.unread > 99 ? '99+':item.unread }}</view>
<view class="cardnameandtimeandNews">
<uni-swipe-action-item>
<view
class="cardContent"
@click="goChat(item.userId, item.data.nickname, item.data.avatar)"
>
<image class="cardImg" :src="item.data.avatar" mode="scaleToFill" />
<view class="cardUnread" v-if="item.unread > 0">{{
item.unread > 99 ? "99+" : item.unread
}}</view>
<view class="cardnameandtimeandNews">
<view class="cardnameandtime">
<view class="cardname">{{ item.data.nickname }}</view>
<view class="cardtime">{{TimeFormatting(item.lastMessage.timestamp)}}</view>
<view class="cardname">{{ item.data.nickname }}</view>
<view class="cardtime">{{
TimeFormatting(item.lastMessage.timestamp)
}}</view>
</view>
<view class="cardNews">
{{ item.lastMessage.payload.text }}
{{ item.lastMessage.payload.text }}
</view>
</view>
</view>
</view>
<template v-slot:right>
<view class="rightPosition">
<view class="topPosition">置顶</view>
<view class="Delete">删除</view>
</view>
</template>
</uni-swipe-action-item>
</uni-swipe-action>
<template v-slot:right>
<view class="rightPosition">
<view v-if="!item.top" class="topPosition" @click="goTop(item, true)"
>置顶</view
>
<view v-if="item.top" class="topPosition" @click="goTop(item, false)"
>取消置顶</view
>
<view class="Delete" @click="deleteConversation(item)">删除</view>
</view>
</template>
</uni-swipe-action-item>
</uni-swipe-action>
</view>
</scroll-view>
<view class="scroll" v-if="Conversationobj.conversations.length == 0">
<view class="nodata">
<view class="nodatatext">您还没有跟其他人的聊天快去聊天吧</view>
</view>
</view>
</view>
<!-- tanber -->
<view class="tabBar">
<tabBar :tabIndex="3"></tabBar>
</view>
<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()">确认</button>
<button class="cancel" type="default" @click="RefuseHintcloseHint()">取消</button>
</view>
</view>
</uni-popup>
</template>
<script>
@@ -56,12 +85,16 @@ import tabBar from "../../components/tabBar/tabBar";
import TimeFormatting from "../../components/TimeFormatting.js";
import {
getConversationList,
conversationTop,
conversationDelete,
} from "../../components/goEasyTool/tool.js";
import GoEasy from 'goeasy'
import GoEasy from "goeasy";
export default {
data() {
return {
Conversationobj: {},
Conversationobj: { conversations: [] },
DeleteSession: {},
triggered: false,
};
},
onLoad() {
@@ -75,13 +108,50 @@ export default {
im.on(GoEasy.IM_EVENT.CONVERSATIONS_UPDATED, this.onConversationsUpdated);
},
methods: {
//下拉刷新
onRefresherRefresh() {
this.triggered = true;
getConversationList(this.$goeasy).then((res) => {
this.Conversationobj = res;
this.triggered = false;
});
},
//删除会话
operation() {
conversationDelete(this.$goeasy, this.DeleteSession).then((res) => {
uni.showToast({
title: "删除成功",
icon: "none",
});
this.$refs.Refusepopup.close();
});
},
//关闭提示框
RefuseHintcloseHint() {
this.$refs.Refusepopup.close();
this.DeleteSession = {};
},
//删除会话
deleteConversation(item) {
this.DeleteSession = item;
this.$refs.Refusepopup.open("center");
},
//置顶会话
goTop(item, top) {
conversationTop(this.$goeasy, item, top).then((res) => {
uni.showToast({
title: top ? "置顶成功" : "取消置顶成功",
icon: "none",
});
});
},
//监听会话列表变化
onConversationsUpdated(conversations){
onConversationsUpdated(conversations) {
this.Conversationobj = conversations;
},
TimeFormatting:TimeFormatting,
TimeFormatting: TimeFormatting,
//跳转聊天页面
goChat(userId,nickname,avatar) {
goChat(userId, nickname, avatar) {
wx.navigateTo({
url: `/pages/index/chat/chat?userId=${userId}&nickname=${nickname}&avatar=${avatar}`,
});
@@ -126,6 +196,29 @@ export default {
height: 100%;
padding: 0% 5% 0% 5%;
}
.scroll ::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.nodata {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.nodatatext {
font-size: 30rpx;
color: #999;
}
.scroll ::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.card {
width: 100%;
height: 150rpx;
@@ -133,19 +226,19 @@ export default {
border-radius: 20rpx;
margin-top: 20rpx;
}
.cardContent{
height: 150rpx;
width: 100%;
display: flex;
align-items: center;
.cardContent {
height: 150rpx;
width: 100%;
display: flex;
align-items: center;
}
.cardImg{
height: 110rpx;
width: 110rpx;
border-radius: 20rpx;
margin-left: 20rpx;
.cardImg {
height: 110rpx;
width: 110rpx;
border-radius: 20rpx;
margin-left: 20rpx;
}
.cardUnread{
.cardUnread {
width: 30rpx;
height: 30rpx;
border-radius: 15rpx;
@@ -157,56 +250,109 @@ export default {
margin-top: -100rpx;
margin-left: -15rpx;
}
.cardnameandtimeandNews{
width: 500rpx;
height: 110rpx;
margin-left: 20rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
.cardnameandtimeandNews {
width: 500rpx;
height: 110rpx;
margin-left: 20rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.cardnameandtime{
width: 100%;
display: flex;
justify-content: space-between;
.cardnameandtime {
width: 100%;
display: flex;
justify-content: space-between;
}
.cardNews{
width: 500rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-bottom: 10rpx;
font-size: 28rpx;
color: #333;
.cardNews {
width: 500rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-bottom: 10rpx;
font-size: 28rpx;
color: #333;
}
.cardname{
font-size: 30rpx;
color: #100e0f;
font-weight: bold;
.cardname {
font-size: 30rpx;
color: #100e0f;
font-weight: bold;
}
.cardtime{
font-size: 24rpx;
color: #999;
.cardtime {
font-size: 24rpx;
color: #999;
}
.rightPosition{
height: 150rpx;
width: 300rpx;
display: flex;
.rightPosition {
height: 150rpx;
width: 300rpx;
display: flex;
}
.topPosition{
height: 150rpx;
width: 150rpx;
background-color: #f5a623;
text-align: center;
line-height: 150rpx;
.topPosition {
height: 150rpx;
width: 150rpx;
background-color: #f5a623;
text-align: center;
line-height: 150rpx;
}
.Delete{
height: 150rpx;
width: 150rpx;
background-color: #f54323;
text-align: center;
line-height: 150rpx;
border-top-right-radius: 20rpx;
border-bottom-right-radius: 20rpx;
.Delete {
height: 150rpx;
width: 150rpx;
background-color: #f54323;
text-align: center;
line-height: 150rpx;
border-top-right-radius: 20rpx;
border-bottom-right-radius: 20rpx;
}
.popup-Hintcontent {
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;
}
.popup-texts {
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;
}
</style>

View File

@@ -312,9 +312,9 @@ export default {
// 发送邀请消息
const myitem = JSON.stringify(this.list[this.InvitingPartyEventindex]);
const youritem = JSON.stringify(this.item);
// uni.redirectTo({
// url: `/pages/index/chat/chat?userId=${this.item}&nickname=${nickname}&avatar=${avatar}&myitem=${myitem}&youritem=${youritem}&type=pk`,
// });
uni.redirectTo({
url: `/pages/index/chat/chat?userId=${this.chatPartnerinfo.id}&nickname=${this.chatPartnerinfo.nickName}&avatar=${this.chatPartnerinfo.headerIcon}&myitem=${myitem}&youritem=${youritem}&type=pk`,
});
},
// 打开邀请弹窗
close() {
@@ -433,6 +433,12 @@ export default {
border-radius: 10px;
/* background-color: #fff; */
}
.scroll ::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.popup-text {
color: #161616;
font-size: 36.26rpx;