优化页面

This commit is contained in:
pengxiaolong
2025-05-27 21:05:01 +08:00
parent cf8728f0d7
commit e682754922
28 changed files with 2742 additions and 2434 deletions

View File

@@ -21,19 +21,50 @@ import topNavigation from "../../components/topNavigation/topNavigation";
import Advertisement from "../../components/Advertisement/Advertisement";
import contentList from "../../components/contentList/contentList";
import tabBar from "../../components/tabBar/tabBar";
import TUIlogin from "../../components/TUILogin.js";
import TencentCloudChat from "@tencentcloud/chat";
export default {
inject: ['$global'],
inject: ["$global"],
data() {
return {};
return {
info: {},
myuserSig: "",
chatInfo: {},
};
},
onLoad() {
// this.requestSomething();
uni.getStorage({
key: "userinfo",
success: (res) => {
this.info = res.data;
uni.getStorage({
key: "myuserSig",
success: (res) => {
this.myuserSig = res.data;
uni.getStorage({
key: "chatInfo",
success: (res) => {
this.chatInfo = res.data;
TUIlogin(this.chatInfo.appId, this.info.id, this.myuserSig.userSig);
// let options = {
// SDKAppID: this.chatInfo.appId,
// };
// console.log("`````````````````````````````````````````", this.chatInfo);
// let chat = TencentCloudChat.create(options);
// console.log("chat````````````````````````````````````````", this.chat);
// chat.login({ userID: String(this.info.id), userSig: this.myuserSig.userSig });
},
});
},
});
},
});
},
methods: {
goAdvertisement(){
goAdvertisement() {
// this.$global.lastPage = getCurrentPages().router;
uni.navigateTo({ url: '/pages/pkDetail/pkDetail' })
}
uni.navigateTo({ url: "/pages/pkDetail/pkDetail" });
},
},
components: {
topNavigation,

View File

@@ -98,6 +98,7 @@
<view class="time">
<uni-datetime-picker
type="datetime"
hide-second="true"
v-model="datetimesingle"
@change="changeLog"
/>

View File

@@ -41,9 +41,22 @@
<scroll-view scroll-y="true" class="scroll">
<!-- <uni-card v-for="(item, index) in list"> -->
<view class="card" v-for="(item, index) in list">
<view class="card-content">
</view>
<view
class="card-content"
@click="Select(item.id, index)"
:style="{
border: selectedId === item.id ? '2px solid red' : '2px solid #afafaf',
}"
>
<image class="avatar" :src="item.anchorIcon" mode="scaleToFill" />
<view class="NameMoney">
<view class="NameMoney_Name">{{ item.anchorId }}</view>
<view class="TimeMoney">
<view>{{ TimeFormatting(item.pkTime) }}</view>
<view>金币:{{ item.coin }}</view>
</view>
</view>
</view>
</view>
<!-- `````````````` -->
</scroll-view>
@@ -57,17 +70,30 @@
<NewAddedPk class="createModule" ref="createModule"></NewAddedPk>
</template>
<script>
<script lang="ts">
import formatDate from "../../components/formatDate.js";
import VerifyLogin from "../../components/VerifyLogin.js";
import TimeFormatting from "../../components/TimeFormatting.js";
// import VerifyLogin from "../../components/VerifyLogin.js";
import NewAddedPk from "../../pages/NewAddedPk/NewAddedPk.vue";
import request from "../../components/request.js";
import { isEnabledMessageReadReceiptGlobal } from "../../TUIKit/components/TUIChat/utils/utils.js";
import OfflinePushInfoManager from "../../TUIKit/components/TUIChat/offlinePushInfoManager/index.js";
import TUIChatEngine, {
TUIStore,
StoreName,
TUIChatService,
} from "@tencentcloud/chat-uikit-engine";
export default {
data() {
return {
item: {},
id: 0,
InvitingPartyEventID: null,
list: [],
selectedId: null,
InvitingPartyEventindex: null,
chatInfo: {},
currentConversation: null,
};
},
onLoad(options) {
@@ -85,9 +111,27 @@ export default {
this.id = res.data.id;
},
});
uni.getStorage({
key: "chatInfo",
success: (res) => {
this.chatInfo = res.data;
},
});
},
methods: {
formatDate: formatDate,
TimeFormatting: TimeFormatting,
Select(id, index) {
if (this.selectedId === id) {
this.selectedId = null;
this.InvitingPartyEventID = null;
this.InvitingPartyEventindex = null;
} else {
this.selectedId = this.selectedId === id ? null : id;
this.InvitingPartyEventID = id;
this.InvitingPartyEventindex = index;
}
},
Returnfunc() {
uni.navigateBack({
delta: 1,
@@ -95,32 +139,69 @@ export default {
},
open() {
this.$refs.popup.open("center");
this.userlist()
this.userlist();
},
invite() {
if (this.item.pkTime !== this.list[this.InvitingPartyEventindex].pkTime) {
uni.showToast({
icon: "none",
title: "请保持时间一致",
});
return;
}
// 发送邀请消息
const payload = {
data: JSON.stringify({
businessID: "pk",
title: "PK邀请",
buttonText1: "接受邀请",
buttonText2: "拒绝邀请",
}),
description: "邀请参加PK",
extension: "邀请参加PK",
};
TUIStore.watch(StoreName.CONV, {
currentConversation: (conversation) => {
this.currentConversation = conversation;
},
});
const options = {
to: `C2C${this.list[this.InvitingPartyEventindex].senderId}`,
conversationType: this.currentConversation?.value?.type,
payload,
needReadReceipt:isEnabledMessageReadReceiptGlobal(),
};
const offlinePushInfoCreateParams = {
conversation: this.currentConversation,
payload: options.payload,
messageType: TUIChatEngine.TYPES.MSG_CUSTOM,
};
const sendMessageOptions = {
offlinePushInfo: OfflinePushInfoManager.create(offlinePushInfoCreateParams),
};
TUIChatService.sendCustomMessage(options, sendMessageOptions);
/////////
},
close() {
this.$refs.popup.close();
},
openChat() {
//判断用户是否登录
VerifyLogin().then(() => {
// 打开聊天页面
const conversationID = `C2C${this.item.senderId}`;
uni.redirectTo({
url: `/TUIKit/components/TUIChat/index?conversationID=${conversationID}`,
});
// 打开聊天页面
const conversationID = `C2C${this.item.senderId}`;
uni.redirectTo({
url: `/TUIKit/components/TUIChat/index?conversationID=${conversationID}`,
});
},
async userlist() {
uni.showLoading({
title: "加载中...",
mask: true,
});
const res = await request({
url: "pk/queryMyPkData",
url: "pk/queryMyCanUsePkData",
method: "POST",
data: {
userId: this.id,
@@ -128,13 +209,13 @@ export default {
userInfo: true,
});
if (res.code === 200) {
if(res.data.length !== 0){
if (res.data.length !== 0) {
uni.hideLoading();
console.log("res.data",res.data);
this.list = res.data;
}else{
console.log("res.data", res.data);
this.list = res.data;
} else {
uni.hideLoading();
this.openPopupQuantity()
this.openPopupQuantity();
}
} else {
uni.hideLoading();
@@ -151,8 +232,8 @@ export default {
},
},
components: {
NewAddedPk
}
NewAddedPk,
},
};
</script>
@@ -233,12 +314,8 @@ export default {
.scroll {
width: 470rpx;
height: 500rpx;
border: 1px solid #afafaf;
border: 2px solid #afafaf;
border-radius: 10px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.card {
margin-top: 10rpx;
@@ -246,15 +323,35 @@ export default {
}
.card-content {
width: 445rpx;
height: 70rpx;
border: 1px solid #afafaf;
height: 75rpx;
/* border: 2px solid #afafaf; */
border-radius: 10px;
display: flex;
font-size: 28rpx;
color: rgb(127, 127, 127);
}
.createModule {
position: fixed;
bottom: 0;
right: 0;
z-index: 998;
width: 100vw;
}
.avatar {
width: 60rpx;
height: 60rpx;
border-radius: 50%;
}
.TimeMoney {
width: 300rpx;
display: flex;
justify-content: space-between;
}
.NameMoney {
display: flex;
flex-direction: column;
}
.NameMoney_Name {
text-align: left;
}
.createModule{
position: fixed;
bottom: 0;
right: 0;
z-index: 998;
width: 100vw;
}
</style>