优化页面
This commit is contained in:
219
unpackage/dist/dev/mp-weixin/pages/Home/Home.js
vendored
Normal file
219
unpackage/dist/dev/mp-weixin/pages/Home/Home.js
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const components_TUILogin = require("../../components/TUILogin.js");
|
||||
const components_request = require("../../components/request.js");
|
||||
const components_formatDate = require("../../components/formatDate.js");
|
||||
const stores_counter = require("../../stores/counter.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: 1
|
||||
// 列表类型 1 当天 2 大于当天
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.pkList({ type: 2 });
|
||||
this.pkList({ type: 1 });
|
||||
},
|
||||
onLoad() {
|
||||
common_vendor.index.getStorage({
|
||||
key: "userinfo",
|
||||
success: (res) => {
|
||||
this.info = res.data;
|
||||
counter.$patch({ myitem: this.info });
|
||||
common_vendor.index.getStorage({
|
||||
key: "myuserSig",
|
||||
success: (res2) => {
|
||||
this.myuserSig = res2.data;
|
||||
common_vendor.index.getStorage({
|
||||
key: "chatInfo",
|
||||
success: (res3) => {
|
||||
this.chatInfo = res3.data;
|
||||
common_vendor.index.__f__("log", "at pages/Home/Home.vue:111", "chatInfo", this.chatInfo);
|
||||
components_TUILogin.TUIlogin(this.chatInfo.appId, this.info.id, this.myuserSig.userSig);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
setTimeout(() => {
|
||||
common_vendor.index.switchTab({ url: "/pages/Home/Home" });
|
||||
}, 1e3);
|
||||
},
|
||||
methods: {
|
||||
goMakeAppointmentPK() {
|
||||
this.listtype = 1;
|
||||
this.list = this.MakeAppointmentPKlist;
|
||||
},
|
||||
goRealTimePk() {
|
||||
this.listtype = 2;
|
||||
this.list = this.RealTimePklist;
|
||||
},
|
||||
goAdvertisement() {
|
||||
common_vendor.index.navigateTo({ url: "/pages/pkDetail/pkDetail" });
|
||||
},
|
||||
onRefresherRefresh() {
|
||||
this.page = 0;
|
||||
this.list = [];
|
||||
if (this.listtype === 1) {
|
||||
this.MakeAppointmentPKlist = [];
|
||||
} else {
|
||||
this.RealTimePklist = [];
|
||||
}
|
||||
this.triggered = true;
|
||||
this.pkList({ type: this.listtype });
|
||||
},
|
||||
async goDetail(item) {
|
||||
common_vendor.index.showLoading({
|
||||
title: "加载中...",
|
||||
mask: true
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/Home/Home.vue:152", "id", item.id, this.info.id);
|
||||
const res = await components_request.request({
|
||||
url: "pk/pkInfoDetail",
|
||||
method: "POST",
|
||||
data: {
|
||||
id: item.id,
|
||||
userId: this.info.id
|
||||
},
|
||||
userInfo: true
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/Home/Home.vue:163", "res", res);
|
||||
this.detailsdata = res.data;
|
||||
if (res.code === 200) {
|
||||
if (res.data.length !== 0) {
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.__f__("log", "at pages/Home/Home.vue:168", "res.data", res.data);
|
||||
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
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/Home/Home.vue:206", res);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onScrollToLower() {
|
||||
this.page++;
|
||||
this.pkList({ type: this.listtype });
|
||||
},
|
||||
components: {
|
||||
topNavigation,
|
||||
Advertisement,
|
||||
tabBar
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _component_top_navigation = common_vendor.resolveComponent("top-navigation");
|
||||
const _component_advertisement = common_vendor.resolveComponent("advertisement");
|
||||
const _component_uni_card = common_vendor.resolveComponent("uni-card");
|
||||
const _easycom_tabBar2 = common_vendor.resolveComponent("tabBar");
|
||||
(_component_top_navigation + _component_advertisement + _component_uni_card + _easycom_tabBar2)();
|
||||
}
|
||||
const _easycom_tabBar = () => "../../components/tabBar/tabBar.js";
|
||||
if (!Math) {
|
||||
_easycom_tabBar();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.o$1($options.goRealTimePk),
|
||||
b: common_vendor.o$1($options.goMakeAppointmentPK),
|
||||
c: common_vendor.o$1((...args) => $options.goAdvertisement && $options.goAdvertisement(...args)),
|
||||
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$1(($event) => $options.goDetail(item), index),
|
||||
j: index,
|
||||
k: "7ffebbf4-2-" + i0
|
||||
});
|
||||
})
|
||||
} : {}, {
|
||||
f: $data.list.length === 0
|
||||
}, $data.list.length === 0 ? {} : {}, {
|
||||
g: common_vendor.o$1((...args) => $options.onRefresherRefresh && $options.onRefresherRefresh(...args)),
|
||||
h: common_vendor.o$1((...args) => _ctx.onScrollToLower && _ctx.onScrollToLower(...args)),
|
||||
i: $data.triggered,
|
||||
j: common_vendor.p({
|
||||
tabIndex: 0
|
||||
})
|
||||
});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-7ffebbf4"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/Home/Home.js.map
|
||||
Reference in New Issue
Block a user