Files
tk-mini-program/unpackage/dist/dev/mp-weixin/pages/pkDetail/pkDetail.js

198 lines
6.7 KiB
JavaScript
Raw Normal View History

2025-05-22 16:21:07 +08:00
"use strict";
const common_vendor = require("../../common/vendor.js");
2025-05-22 22:05:55 +08:00
const components_formatDate = require("../../components/formatDate.js");
2025-05-27 21:05:01 +08:00
const components_TimeFormatting = require("../../components/TimeFormatting.js");
2025-05-27 13:06:24 +08:00
const components_request = require("../../components/request.js");
2025-05-27 21:05:01 +08:00
const TUIKit_components_TUIChat_utils_utils = require("../../TUIKit/components/TUIChat/utils/utils.js");
const TUIKit_components_TUIChat_offlinePushInfoManager_index = require("../../TUIKit/components/TUIChat/offlinePushInfoManager/index.js");
2025-05-22 22:05:55 +08:00
const common_assets = require("../../common/assets.js");
2025-05-27 13:06:24 +08:00
const NewAddedPk = () => "../NewAddedPk/NewAddedPk2.js";
2025-05-22 16:21:07 +08:00
const _sfc_main = {
data() {
return {
2025-05-27 13:06:24 +08:00
item: {},
id: 0,
2025-05-27 21:05:01 +08:00
InvitingPartyEventID: null,
list: [],
selectedId: null,
InvitingPartyEventindex: null,
chatInfo: {},
currentConversation: null
2025-05-22 16:21:07 +08:00
};
},
onLoad(options) {
const eventChannel = this.getOpenerEventChannel();
eventChannel.on("itemDetail", (data) => {
this.item = data.item;
2025-05-27 21:05:01 +08:00
common_vendor.index.__f__("log", "at pages/pkDetail/pkDetail.vue:105", "接收到的数据:", this.item);
2025-05-27 13:06:24 +08:00
});
common_vendor.index.getStorage({
key: "userinfo",
success: (res) => {
this.id = res.data.id;
}
2025-05-22 16:21:07 +08:00
});
2025-05-27 21:05:01 +08:00
common_vendor.index.getStorage({
key: "chatInfo",
success: (res) => {
this.chatInfo = res.data;
}
});
2025-05-22 16:21:07 +08:00
},
2025-05-22 22:05:55 +08:00
methods: {
formatDate: components_formatDate.formatDate,
2025-05-27 21:05:01 +08:00
TimeFormatting: components_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;
}
},
2025-05-22 22:05:55 +08:00
Returnfunc() {
common_vendor.index.navigateBack({
delta: 1
});
},
open() {
this.$refs.popup.open("center");
2025-05-27 13:06:24 +08:00
this.userlist();
2025-05-22 22:05:55 +08:00
},
invite() {
2025-05-27 21:05:01 +08:00
var _a, _b;
if (this.item.pkTime !== this.list[this.InvitingPartyEventindex].pkTime) {
common_vendor.index.showToast({
icon: "none",
title: "请保持时间一致"
});
return;
}
const payload = {
data: JSON.stringify({
businessID: "pk",
title: "PK邀请",
buttonText1: "接受邀请",
buttonText2: "拒绝邀请"
}),
description: "邀请参加PK",
extension: "邀请参加PK"
};
common_vendor.Jt.watch(common_vendor.o.CONV, {
currentConversation: (conversation) => {
this.currentConversation = conversation;
}
});
const options = {
to: `C2C${this.list[this.InvitingPartyEventindex].senderId}`,
conversationType: (_b = (_a = this.currentConversation) == null ? void 0 : _a.value) == null ? void 0 : _b.type,
payload,
needReadReceipt: TUIKit_components_TUIChat_utils_utils.isEnabledMessageReadReceiptGlobal()
};
const offlinePushInfoCreateParams = {
conversation: this.currentConversation,
payload: options.payload,
messageType: common_vendor.qt.TYPES.MSG_CUSTOM
};
const sendMessageOptions = {
offlinePushInfo: TUIKit_components_TUIChat_offlinePushInfoManager_index.OfflinePushInfoManager.create(offlinePushInfoCreateParams)
};
common_vendor.Qt.sendCustomMessage(options, sendMessageOptions);
2025-05-22 22:05:55 +08:00
},
close() {
this.$refs.popup.close();
},
openChat() {
2025-05-27 21:05:01 +08:00
const conversationID = `C2C${this.item.senderId}`;
common_vendor.index.redirectTo({
url: `/TUIKit/components/TUIChat/index?conversationID=${conversationID}`
2025-05-22 22:05:55 +08:00
});
2025-05-27 13:06:24 +08:00
},
async userlist() {
common_vendor.index.showLoading({
title: "加载中...",
mask: true
});
const res = await components_request.request({
2025-05-27 21:05:01 +08:00
url: "pk/queryMyCanUsePkData",
2025-05-27 13:06:24 +08:00
method: "POST",
data: {
userId: this.id
},
userInfo: true
});
if (res.code === 200) {
if (res.data.length !== 0) {
common_vendor.index.hideLoading();
2025-05-27 21:05:01 +08:00
common_vendor.index.__f__("log", "at pages/pkDetail/pkDetail.vue:214", "res.data", res.data);
2025-05-27 13:06:24 +08:00
this.list = res.data;
} else {
common_vendor.index.hideLoading();
this.openPopupQuantity();
}
} else {
common_vendor.index.hideLoading();
common_vendor.index.showToast({
title: "加载失败",
icon: "none",
duration: 2e3
});
}
},
openPopupQuantity() {
this.$refs.createModule.open();
2025-05-22 22:05:55 +08:00
}
2025-05-27 13:06:24 +08:00
},
components: {
NewAddedPk
2025-05-22 22:05:55 +08:00
}
2025-05-22 16:21:07 +08:00
};
2025-05-22 22:05:55 +08:00
if (!Array) {
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
2025-05-27 13:06:24 +08:00
const _component_NewAddedPk = common_vendor.resolveComponent("NewAddedPk");
(_easycom_uni_popup2 + _component_NewAddedPk)();
2025-05-22 22:05:55 +08:00
}
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
if (!Math) {
_easycom_uni_popup();
}
2025-05-22 16:21:07 +08:00
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
2025-05-22 22:05:55 +08:00
a: common_assets._imports_0,
b: common_vendor.o$1((...args) => $options.Returnfunc && $options.Returnfunc(...args)),
c: common_assets._imports_1,
d: common_vendor.t($data.item.anchorId),
e: common_vendor.t($data.item.sex === 1 ? "男" : "女"),
f: common_vendor.t($data.item.country),
g: common_vendor.t($data.item.coin),
h: common_vendor.t($options.formatDate($data.item.pkTime)),
i: common_vendor.t($data.item.remark),
j: common_vendor.o$1(($event) => $options.openChat()),
k: common_vendor.o$1(($event) => $options.open()),
2025-05-27 13:06:24 +08:00
l: common_vendor.f($data.list, (item, index, i0) => {
2025-05-27 21:05:01 +08:00
return {
a: item.anchorIcon,
b: common_vendor.t(item.anchorId),
c: common_vendor.t($options.TimeFormatting(item.pkTime)),
d: common_vendor.t(item.coin),
e: common_vendor.o$1(($event) => $options.Select(item.id, index)),
f: $data.selectedId === item.id ? "2px solid red" : "2px solid #afafaf"
};
2025-05-27 13:06:24 +08:00
}),
m: common_vendor.o$1(($event) => $options.invite()),
n: common_vendor.o$1(($event) => $options.close()),
o: common_vendor.sr("popup", "9639f721-0"),
p: common_vendor.p({
2025-05-22 22:05:55 +08:00
type: "center",
["border-radius"]: "10px 10px 0 0"
2025-05-27 13:06:24 +08:00
}),
q: common_vendor.sr("createModule", "9639f721-1")
2025-05-22 16:21:07 +08:00
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-9639f721"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/pkDetail/pkDetail.js.map