479 lines
16 KiB
JavaScript
479 lines
16 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 stores_counter = require("../../stores/counter.js");
|
|
const components_NationalDictionary = require("../../components/NationalDictionary.js");
|
|
const components_goEasyTool_tool = require("../../components/goEasyTool/tool.js");
|
|
const topNavigation = () => "../../components/topNavigation/topNavigation.js";
|
|
const Advertisement = () => "../../components/Advertisement/Advertisement.js";
|
|
const tabBar = () => "../../components/tabBar/tabBar.js";
|
|
const counter = stores_counter.useCounterStore();
|
|
const _sfc_main = {
|
|
inject: ["$global"],
|
|
data() {
|
|
return {
|
|
info: {},
|
|
myuserSig: "",
|
|
chatInfo: {},
|
|
page: 0,
|
|
//页码
|
|
size: 10,
|
|
//每页条数
|
|
list: [],
|
|
// 列表数据
|
|
detailsdata: {},
|
|
//详情数据
|
|
triggered: false,
|
|
//下拉刷新标识
|
|
RealTimePklist: [],
|
|
// PK大厅列表数据
|
|
MakeAppointmentPKlist: [],
|
|
// 今日PK列表数据
|
|
listtype: 2,
|
|
// 列表类型 1 当天 2 大于当天
|
|
filterable: true,
|
|
//是否可搜索
|
|
Country: components_NationalDictionary.optionsArray,
|
|
countrys: "",
|
|
//国家
|
|
genders: 0,
|
|
//性别
|
|
Gender: [
|
|
{ label: "男", value: 1 },
|
|
{ label: "女", value: 2 }
|
|
],
|
|
minNumberCoins: "",
|
|
//最小金币数
|
|
maxNumberCoins: "",
|
|
//最大金币数
|
|
mindatetimesingle: "",
|
|
//最小PK时间
|
|
maxdatetimesingle: "",
|
|
//最大PK时间
|
|
HintCion: false,
|
|
//金币提示信息
|
|
HintTime: false,
|
|
//时间提示信息
|
|
ConfirmStatus: false
|
|
//确认弹窗状态
|
|
};
|
|
},
|
|
onShareAppMessage(res) {
|
|
if (res.from === "menu") {
|
|
return {
|
|
title: "分享",
|
|
path: getCurrentPages()[getCurrentPages().length - 1].route
|
|
};
|
|
}
|
|
},
|
|
onShow() {
|
|
this.page = 0;
|
|
this.list = [];
|
|
this.MakeAppointmentPKlist = [];
|
|
this.RealTimePklist = [];
|
|
this.pkList({ type: 2 });
|
|
this.pkList({ type: 1 });
|
|
},
|
|
onLoad() {
|
|
this.AutomaticCleaning();
|
|
common_vendor.index.getStorage({
|
|
key: "userinfo",
|
|
success: (res) => {
|
|
this.info = res.data;
|
|
common_vendor.index.__f__("log", "at pages/Home/Home.vue:258", "userinfo", this.info);
|
|
counter.$patch({ myitem: this.info });
|
|
components_goEasyTool_tool.goEasylogin(this.$goeasy, String(this.info.id), this.info.headerIcon, this.info.nickName);
|
|
}
|
|
});
|
|
},
|
|
methods: {
|
|
//自动清理
|
|
AutomaticCleaning() {
|
|
const lastCleanTime = common_vendor.index.getStorageSync("last_clean_time") || 0;
|
|
const now = Date.now();
|
|
if (now - lastCleanTime < 7 * 24 * 3600 * 1e3)
|
|
return;
|
|
components_request.request({
|
|
url: "user/logout",
|
|
method: "POST",
|
|
data: {
|
|
id: this.info.id
|
|
},
|
|
userInfo: false
|
|
}).then((res) => {
|
|
common_vendor.index.clearStorage();
|
|
common_vendor.index.setStorageSync("last_clean_time", now);
|
|
});
|
|
},
|
|
//关闭弹窗(取消)
|
|
closePopup() {
|
|
this.$refs.popup.close();
|
|
},
|
|
//格式化日期
|
|
dateformat(date) {
|
|
const isoString = date.replace(" ", "T");
|
|
const timestamp = Date.parse(isoString);
|
|
if (isNaN(timestamp)) {
|
|
throw new Error(`Invalid date format: ${this.datetimesingle}`);
|
|
}
|
|
return Math.floor(timestamp / 1e3);
|
|
},
|
|
//确认弹窗
|
|
confirm() {
|
|
this.ConfirmStatus = true;
|
|
if (this.minNumberCoins === "" && this.maxNumberCoins !== "" || this.minNumberCoins !== "" && this.maxNumberCoins === "") {
|
|
this.HintCion = true;
|
|
return;
|
|
}
|
|
if (this.mindatetimesingle === "" && this.maxdatetimesingle !== "" || this.mindatetimesingle !== "" && this.maxdatetimesingle === "") {
|
|
this.HintTime = true;
|
|
return;
|
|
}
|
|
if (this.genders === 0 && this.countrys === "" && this.minNumberCoins === "" && this.maxNumberCoins === "" && this.mindatetimesingle === "" && this.maxdatetimesingle === "") {
|
|
if (this.listtype === 1) {
|
|
this.MakeAppointmentPKlist = [];
|
|
} else {
|
|
this.RealTimePklist = [];
|
|
}
|
|
this.list = [];
|
|
this.pkList({ type: this.listtype });
|
|
this.closePopup();
|
|
return;
|
|
}
|
|
this.closePopup();
|
|
this.page = 0;
|
|
this.list = [];
|
|
if (this.listtype === 1) {
|
|
this.MakeAppointmentPKlist = [];
|
|
let condition = {
|
|
type: this.listtype
|
|
};
|
|
if (this.genders !== 0) {
|
|
condition.sex = this.genders;
|
|
}
|
|
if (this.minNumberCoins !== "") {
|
|
condition.coin = {
|
|
start: this.minNumberCoins
|
|
};
|
|
}
|
|
if (this.maxNumberCoins !== "") {
|
|
condition.coin.end = this.maxNumberCoins;
|
|
}
|
|
if (this.mindatetimesingle !== "") {
|
|
condition.pkTime = {
|
|
start: this.mindatetimesingle
|
|
};
|
|
}
|
|
if (this.maxdatetimesingle !== "") {
|
|
condition.pkTime.end = this.maxdatetimesingle;
|
|
}
|
|
if (this.countrys !== "") {
|
|
condition.country = this.countrys;
|
|
}
|
|
this.pkList(condition);
|
|
} else {
|
|
this.RealTimePklist = [];
|
|
let condition = {};
|
|
if (this.genders !== 0) {
|
|
condition.sex = this.genders;
|
|
}
|
|
if (this.minNumberCoins !== "") {
|
|
condition.coin = {
|
|
start: this.minNumberCoins
|
|
};
|
|
}
|
|
if (this.maxNumberCoins !== "") {
|
|
condition.coin.end = this.maxNumberCoins;
|
|
}
|
|
if (this.mindatetimesingle !== "") {
|
|
condition.pkTime = {
|
|
start: this.dateformat(this.mindatetimesingle)
|
|
};
|
|
}
|
|
if (this.maxdatetimesingle !== "") {
|
|
condition.pkTime.end = this.dateformat(this.maxdatetimesingle);
|
|
}
|
|
if (this.countrys !== "") {
|
|
condition.country = this.countrys;
|
|
}
|
|
this.pkList(condition);
|
|
}
|
|
},
|
|
//清空弹窗
|
|
clear() {
|
|
this.genders = 0;
|
|
this.countrys = "";
|
|
this.minNumberCoins = "";
|
|
this.maxNumberCoins = "";
|
|
this.mindatetimesingle = "";
|
|
this.maxdatetimesingle = "";
|
|
this.ConfirmStatus = false;
|
|
},
|
|
//获取国家
|
|
country(item) {
|
|
this.countrys = item.value;
|
|
},
|
|
//获取性别
|
|
gender(item) {
|
|
this.genders = item.value;
|
|
},
|
|
// 打开弹窗(筛选条件)
|
|
goScreening() {
|
|
this.$refs.popup.open("right");
|
|
},
|
|
//今日
|
|
goMakeAppointmentPK() {
|
|
this.listtype = 1;
|
|
this.list = this.MakeAppointmentPKlist;
|
|
this.clear();
|
|
},
|
|
//大厅
|
|
goRealTimePk() {
|
|
this.listtype = 2;
|
|
this.list = this.RealTimePklist;
|
|
this.clear();
|
|
},
|
|
goAdvertisement() {
|
|
common_vendor.index.navigateTo({ url: "/pages/pkDetail/pkDetail" });
|
|
},
|
|
onScrollToLower() {
|
|
this.page++;
|
|
this.pkList({ type: this.listtype });
|
|
},
|
|
//下拉刷新
|
|
onRefresherRefresh() {
|
|
this.page = 0;
|
|
this.list = [];
|
|
if (this.listtype === 1) {
|
|
this.MakeAppointmentPKlist = [];
|
|
} else {
|
|
this.RealTimePklist = [];
|
|
}
|
|
this.triggered = true;
|
|
if (this.ConfirmStatus) {
|
|
if (this.genders === 0 && this.countrys === "" && this.minNumberCoins === "" && this.maxNumberCoins === "" && this.mindatetimesingle === "" && this.maxdatetimesingle === "") {
|
|
this.pkList({ type: this.listtype });
|
|
} else {
|
|
if (this.minNumberCoins === "" && this.maxNumberCoins !== "" || this.minNumberCoins !== "" && this.maxNumberCoins === "") {
|
|
this.pkList({ type: this.listtype });
|
|
return;
|
|
}
|
|
if (this.mindatetimesingle === "" && this.maxdatetimesingle !== "" || this.mindatetimesingle !== "" && this.maxdatetimesingle === "") {
|
|
this.pkList({ type: this.listtype });
|
|
return;
|
|
}
|
|
this.confirm();
|
|
}
|
|
} else {
|
|
this.pkList({ type: this.listtype });
|
|
}
|
|
},
|
|
async goDetail(item) {
|
|
common_vendor.index.showLoading({
|
|
title: "加载中...",
|
|
mask: true
|
|
});
|
|
const res = await components_request.request({
|
|
url: "pk/pkInfoDetail",
|
|
method: "POST",
|
|
data: {
|
|
id: item.id,
|
|
userId: this.info.id,
|
|
from: 1
|
|
},
|
|
userInfo: false
|
|
});
|
|
this.detailsdata = res.data;
|
|
if (res.code === 200) {
|
|
if (res.data.length !== 0) {
|
|
common_vendor.index.hideLoading();
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/pkDetail/pkDetail",
|
|
success: (res2) => {
|
|
res2.eventChannel.emit("itemDetail", {
|
|
item: this.detailsdata
|
|
});
|
|
}
|
|
});
|
|
} else {
|
|
common_vendor.index.hideLoading();
|
|
this.openPopupQuantity();
|
|
}
|
|
} else {
|
|
common_vendor.index.hideLoading();
|
|
common_vendor.index.showToast({
|
|
title: "加载失败",
|
|
icon: "none",
|
|
duration: 2e3
|
|
});
|
|
}
|
|
},
|
|
formatDate: components_formatDate.formatDate,
|
|
async pkList(condition) {
|
|
const res = await components_request.request({
|
|
url: "pk/pkList",
|
|
method: "POST",
|
|
data: {
|
|
status: 0,
|
|
page: this.page,
|
|
size: this.size,
|
|
condition,
|
|
userId: this.info.id
|
|
},
|
|
userInfo: false
|
|
});
|
|
if (res.code === 200) {
|
|
this.triggered = false;
|
|
if (condition.type === 1) {
|
|
this.MakeAppointmentPKlist.push(...res.data);
|
|
if (condition.type == this.listtype) {
|
|
this.list = this.MakeAppointmentPKlist;
|
|
}
|
|
} else {
|
|
this.RealTimePklist.push(...res.data);
|
|
if (condition.type == this.listtype) {
|
|
this.list = this.RealTimePklist;
|
|
}
|
|
if (condition.type == null) {
|
|
this.list = this.RealTimePklist;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
components: {
|
|
topNavigation,
|
|
Advertisement,
|
|
tabBar
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _component_top_navigation = common_vendor.resolveComponent("top-navigation");
|
|
const _component_uni_card = common_vendor.resolveComponent("uni-card");
|
|
const _easycom_tabBar2 = common_vendor.resolveComponent("tabBar");
|
|
const _easycom_wht_select2 = common_vendor.resolveComponent("wht-select");
|
|
const _easycom_uni_number_box2 = common_vendor.resolveComponent("uni-number-box");
|
|
const _easycom_uni_datetime_picker2 = common_vendor.resolveComponent("uni-datetime-picker");
|
|
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
|
|
(_component_top_navigation + _component_uni_card + _easycom_tabBar2 + _easycom_wht_select2 + _easycom_uni_number_box2 + _easycom_uni_datetime_picker2 + _easycom_uni_popup2)();
|
|
}
|
|
const _easycom_tabBar = () => "../../components/tabBar/tabBar.js";
|
|
const _easycom_wht_select = () => "../../uni_modules/wht-select/components/wht-select/wht-select.js";
|
|
const _easycom_uni_number_box = () => "../../uni_modules/uni-number-box/components/uni-number-box/uni-number-box.js";
|
|
const _easycom_uni_datetime_picker = () => "../../uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.js";
|
|
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
|
|
if (!Math) {
|
|
(_easycom_tabBar + _easycom_wht_select + _easycom_uni_number_box + _easycom_uni_datetime_picker + _easycom_uni_popup)();
|
|
}
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return common_vendor.e({
|
|
a: common_vendor.o($options.goRealTimePk),
|
|
b: common_vendor.o($options.goMakeAppointmentPK),
|
|
c: common_vendor.o($options.goScreening),
|
|
d: $data.list.length !== 0
|
|
}, $data.list.length !== 0 ? {
|
|
e: common_vendor.f($data.list, (item, index, i0) => {
|
|
return common_vendor.e({
|
|
a: item.anchorIcon,
|
|
b: common_vendor.t(item.disPlayId),
|
|
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($options.formatDate(item.pkTime)),
|
|
h: common_vendor.t(item.coin + "K"),
|
|
i: common_vendor.o(($event) => $options.goDetail(item), index),
|
|
j: item.isPin === true ? "2px solid #eeff00" : "2px solid #f5f5f5",
|
|
k: index,
|
|
l: "7ffebbf4-1-" + i0
|
|
});
|
|
})
|
|
} : {}, {
|
|
f: $data.list.length === 0
|
|
}, $data.list.length === 0 ? {} : {}, {
|
|
g: common_vendor.o((...args) => $options.onRefresherRefresh && $options.onRefresherRefresh(...args)),
|
|
h: common_vendor.o((...args) => $options.onScrollToLower && $options.onScrollToLower(...args)),
|
|
i: $data.triggered,
|
|
j: common_vendor.o(($event) => $options.onRefresherRefresh()),
|
|
k: common_vendor.p({
|
|
tabIndex: 0
|
|
}),
|
|
l: common_vendor.o($options.country),
|
|
m: common_vendor.p({
|
|
backgroundColor: "#ffffff",
|
|
placeholderColor: "#666666",
|
|
textColor: "#666666",
|
|
borderColor: "#a3a3a3",
|
|
options: $data.Country,
|
|
filterable: $data.filterable,
|
|
placeholder: "请选择国家",
|
|
value: $data.countrys
|
|
}),
|
|
n: common_vendor.o($options.gender),
|
|
o: common_vendor.p({
|
|
backgroundColor: "#ffffff",
|
|
placeholderColor: "#666666",
|
|
textColor: "#666666",
|
|
borderColor: "#a3a3a3",
|
|
options: $data.Gender,
|
|
placeholder: "性别",
|
|
value: $data.genders
|
|
}),
|
|
p: $data.genders === 0
|
|
}, $data.genders === 0 ? {} : {}, {
|
|
q: $data.genders === 1
|
|
}, $data.genders === 1 ? {} : {}, {
|
|
r: $data.genders === 2
|
|
}, $data.genders === 2 ? {} : {}, {
|
|
s: common_vendor.o(($event) => $data.minNumberCoins = $event),
|
|
t: common_vendor.p({
|
|
max: 9999999999,
|
|
background: "ffffff",
|
|
modelValue: $data.minNumberCoins
|
|
}),
|
|
v: $data.minNumberCoins == "" && $data.HintCion === true
|
|
}, $data.minNumberCoins == "" && $data.HintCion === true ? {} : {}, {
|
|
w: common_vendor.o(($event) => $data.maxNumberCoins = $event),
|
|
x: common_vendor.p({
|
|
max: 9999999999,
|
|
background: "#ffffff",
|
|
modelValue: $data.maxNumberCoins
|
|
}),
|
|
y: $data.maxNumberCoins == "" && $data.HintCion === true
|
|
}, $data.maxNumberCoins == "" && $data.HintCion === true ? {} : {}, {
|
|
z: $data.listtype === 2
|
|
}, $data.listtype === 2 ? common_vendor.e({
|
|
A: common_vendor.o(($event) => $data.mindatetimesingle = $event),
|
|
B: common_vendor.p({
|
|
type: "datetime",
|
|
["hide-second"]: "true",
|
|
modelValue: $data.mindatetimesingle
|
|
}),
|
|
C: $data.mindatetimesingle == "" && $data.HintTime === true
|
|
}, $data.mindatetimesingle == "" && $data.HintTime === true ? {} : {}) : {}, {
|
|
D: $data.listtype === 2
|
|
}, $data.listtype === 2 ? common_vendor.e({
|
|
E: common_vendor.o(($event) => $data.maxdatetimesingle = $event),
|
|
F: common_vendor.p({
|
|
type: "datetime",
|
|
["hide-second"]: "true",
|
|
modelValue: $data.maxdatetimesingle
|
|
}),
|
|
G: $data.maxdatetimesingle == "" && $data.HintTime === true
|
|
}, $data.maxdatetimesingle == "" && $data.HintTime === true ? {} : {}) : {}, {
|
|
H: common_vendor.o((...args) => $options.closePopup && $options.closePopup(...args)),
|
|
I: common_vendor.o((...args) => $options.confirm && $options.confirm(...args)),
|
|
J: common_vendor.o((...args) => $options.clear && $options.clear(...args)),
|
|
K: common_vendor.sr("popup", "7ffebbf4-3"),
|
|
L: common_vendor.p({
|
|
position: "right"
|
|
})
|
|
});
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-7ffebbf4"]]);
|
|
_sfc_main.__runtimeHooks = 2;
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/Home/Home.js.map
|