Files
tk-mini-program/unpackage/dist/dev/mp-weixin/pages/Mine/minecomponents/pkInformation.js
pengxiaolong e464d99af5 优化页面
2025-06-17 22:04:18 +08:00

245 lines
7.8 KiB
JavaScript

"use strict";
const common_vendor = require("../../../common/vendor.js");
const components_request = require("../../../components/request.js");
const components_formatDate = require("../../../components/formatDate.js");
const components_DifferenceArray = require("../../../components/DifferenceArray.js");
const Recompose = () => "./recompose/recompose2.js";
const _sfc_main = {
data() {
return {
pkList: [],
userinfo: {},
page: 0,
createModule: null,
parentMessage: null,
triggered: false,
pickerArray: [],
index: 0,
topPinnedPersondata: {},
Topdate: 0
};
},
onLoad() {
common_vendor.index.getStorage({
key: "userinfo",
success: (res) => {
this.userinfo = res.data;
common_vendor.index.__f__("log", "at pages/Mine/minecomponents/pkInformation.vue:145", this.userinfo);
this.getpkList();
}
});
},
mounted() {
this.createModule = this.$refs.createModule;
},
methods: {
// 刷新
onRefresherRefresh() {
this.page = 0;
this.pkList = [];
this.getpkList();
this.triggered = true;
},
// 下拉加载
onScrollToLower() {
this.page++;
this.getpkList();
},
// 返回
onBack() {
common_vendor.index.navigateBack({
delta: 1
});
},
//时间格式化
formatDate: components_formatDate.formatDate,
// 获取pk列表
getpkList() {
components_request.request({
url: "user/queryMyAllPkData",
method: "POST",
data: {
userId: this.userinfo.id,
page: this.page,
size: 10
},
userInfo: true
}).then((res) => {
if (res.code == 200) {
this.pkList.push(...res.data);
common_vendor.index.__f__("log", "at pages/Mine/minecomponents/pkInformation.vue:188", this.pkList);
this.triggered = false;
} else {
common_vendor.index.__f__("log", "at pages/Mine/minecomponents/pkInformation.vue:191", res.msg);
}
});
},
// 打开修改窗口
onRecompose(item) {
this.parentMessage = item;
this.createModule.open();
},
// 置顶
onTop(item) {
this.pickerArray = components_DifferenceArray.DifferenceArray(item.pkTime);
this.$refs.popup.open("center");
this.topPinnedPersondata = item;
},
bindPickerChange(e) {
this.index = e.detail.value;
},
closePopup() {
this.$refs.popup.close();
this.index = 0;
this.pickerArray = [];
this.topPinnedPersondata = {};
},
onTopConfirm() {
if (Math.ceil(Date.now() / 1e3 + Number(this.pickerArray[this.index]) * 3600) <= this.topPinnedPersondata.pkTime) {
this.Topdate = Math.ceil(Date.now() / 1e3 + Number(this.pickerArray[this.index]) * 3600);
} else {
this.Topdate = this.topPinnedPersondata.pkTime;
}
common_vendor.index.__f__("log", "at pages/Mine/minecomponents/pkInformation.vue:221", this.Topdate, this.topPinnedPersondata.id);
components_request.request({
url: "user/pinToTop",
method: "POST",
data: {
articleId: this.topPinnedPersondata.id,
pinExpireTime: this.Topdate
},
userInfo: true
}).then((res) => {
if (res.code == 200) {
this.onRefresherRefresh();
common_vendor.index.showToast({
title: res.msg,
icon: "none",
duration: 3e3
});
this.closePopup();
} else {
common_vendor.index.showToast({
title: res.msg,
icon: "none",
duration: 3e3
});
}
});
},
//取消置顶
onOutTop(item) {
components_request.request({
url: "user/cancelPin",
method: "POST",
data: {
articleId: item.id
},
userInfo: true
}).then((res) => {
if (res.code == 200) {
this.onRefresherRefresh();
common_vendor.index.showToast({
title: res.data,
icon: "none",
duration: 3e3
});
} else {
common_vendor.index.__f__("log", "at pages/Mine/minecomponents/pkInformation.vue:267", res.msg);
}
});
},
// 删除pk
onExpurgate(item) {
components_request.request({
url: "pk/deletePkDataWithId",
method: "POST",
data: {
id: item.id
},
userInfo: true
}).then((res) => {
if (res.code == 200) {
this.onRefresherRefresh();
common_vendor.index.showToast({
title: "删除成功",
icon: "none",
duration: 2e3
});
} else {
common_vendor.index.__f__("log", "at pages/Mine/minecomponents/pkInformation.vue:289", res.msg);
}
});
}
},
components: {
Recompose
}
};
if (!Array) {
const _component_uni_card = common_vendor.resolveComponent("uni-card");
const _component_Recompose = common_vendor.resolveComponent("Recompose");
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
(_component_uni_card + _component_Recompose + _easycom_uni_popup2)();
}
const _easycom_uni_popup = () => "../../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
if (!Math) {
_easycom_uni_popup();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.o$1((...args) => $options.onBack && $options.onBack(...args)),
b: common_vendor.f($data.pkList, (item, index, i0) => {
return common_vendor.e({
a: item.anchorIcon,
b: common_vendor.t(item.anchorId),
c: item.sex === "2"
}, item.sex === "2" ? {} : {}, {
d: common_vendor.t(item.sex === "1" ? "男" : "女"),
e: item.sex === "1" ? 1 : "",
f: item.sex === "2" ? 1 : "",
g: common_vendor.t(item.country),
h: common_vendor.t(item.coin),
i: common_vendor.t($options.formatDate(item.pkTime)),
j: item.inviteStatus === 0
}, item.inviteStatus === 0 ? common_vendor.e({
k: item.isPin === false
}, item.isPin === false ? {
l: common_vendor.o$1(($event) => $options.onTop(item), index)
} : {}, {
m: item.isPin === true
}, item.isPin === true ? {
n: common_vendor.o$1(($event) => $options.onOutTop(item), index)
} : {}, {
o: common_vendor.o$1(($event) => $options.onRecompose(item), index),
p: common_vendor.o$1(($event) => $options.onExpurgate(item), index)
}) : {}, {
q: index,
r: "36b7ee78-0-" + i0
});
}),
c: common_vendor.o$1((...args) => $options.onRefresherRefresh && $options.onRefresherRefresh(...args)),
d: common_vendor.o$1((...args) => $options.onScrollToLower && $options.onScrollToLower(...args)),
e: $data.triggered,
f: common_vendor.sr("createModule", "36b7ee78-1"),
g: common_vendor.o$1($options.onRefresherRefresh),
h: common_vendor.p({
message: $data.parentMessage
}),
i: common_vendor.t($data.pickerArray[$data.index]),
j: $data.pickerArray,
k: $data.index,
l: common_vendor.o$1((...args) => $options.bindPickerChange && $options.bindPickerChange(...args)),
m: common_vendor.o$1((...args) => $options.onTopConfirm && $options.onTopConfirm(...args)),
n: common_vendor.o$1((...args) => $options.closePopup && $options.closePopup(...args)),
o: common_vendor.sr("popup", "36b7ee78-2"),
p: common_vendor.p({
type: "center",
["border-radius"]: "10px 10px 0 0"
})
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-36b7ee78"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pages/Mine/minecomponents/pkInformation.js.map