Files
tk-mini-program/unpackage/dist/dev/mp-weixin/pages/Mine/minecomponents/anchorLibrary.js
pengxiaolong 0044f8f334 优化代码
2025-09-29 20:48:31 +08:00

148 lines
4.4 KiB
JavaScript

"use strict";
const common_vendor = require("../../../common/vendor.js");
const components_request = require("../../../components/request.js");
const anchorLibrary = () => "./addStreamer/addStreamer.js";
const modifyStreamer = () => "./modifyStreamer/modifyStreamer.js";
const _sfc_main = {
data() {
return {
userinfo: {},
AnchorList: [],
triggered: false,
modifyStreamerMessage: {}
};
},
onLoad() {
common_vendor.index.getStorage({
key: "userinfo",
success: (res) => {
this.userinfo = res.data;
this.getAnchorList();
}
});
},
onShareAppMessage(res) {
if (res.from === "menu") {
return {
title: "分享",
path: "/pages/Home/Home"
};
}
},
methods: {
// 重新编辑主播信息
onRecompose(item) {
this.modifyStreamerMessage = item;
this.$refs.modifyStreamer.open();
},
// 删除主播信息
onExpurgate(item) {
components_request.request({
url: "anchor/deleteMyAnchor",
method: "POST",
data: {
id: item.id
},
userInfo: true
}).then((res) => {
this.triggered = false;
if (res.code == 200) {
common_vendor.index.showToast({
title: "删除成功",
icon: "success",
duration: 2e3
});
this.getAnchorList();
} else {
common_vendor.index.showToast({
title: res.msg,
icon: "success",
duration: 2e3
});
}
});
},
//获取主播列表
getAnchorList() {
components_request.request({
url: "anchor/list",
method: "POST",
data: {
id: this.userinfo.id
},
userInfo: true
}).then((res) => {
this.triggered = false;
if (res.code == 200) {
this.AnchorList = res.data;
} else {
common_vendor.index.__f__("log", "at pages/Mine/minecomponents/anchorLibrary.vue:180", res.msg);
}
});
},
//打开弹窗,添加主播
openPopupQuantity() {
this.$refs.createModule.open();
},
// 下拉刷新
onRefresherRefresh() {
this.triggered = true;
this.getAnchorList();
},
// 返回上一页
onBack() {
common_vendor.wx$1.navigateBack({
delta: 1
});
}
},
components: {
anchorLibrary,
modifyStreamer
}
};
if (!Array) {
const _component_uni_card = common_vendor.resolveComponent("uni-card");
const _component_anchorLibrary = common_vendor.resolveComponent("anchorLibrary");
const _component_modifyStreamer = common_vendor.resolveComponent("modifyStreamer");
(_component_uni_card + _component_anchorLibrary + _component_modifyStreamer)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: common_vendor.o((...args) => $options.onBack && $options.onBack(...args)),
b: $data.AnchorList.length !== 0
}, $data.AnchorList.length !== 0 ? {
c: common_vendor.f($data.AnchorList, (item, index, i0) => {
return common_vendor.e({
a: item.headerIcon,
b: common_vendor.t(item.anchorId),
c: item.gender === 2
}, item.gender === 2 ? {} : {}, {
d: common_vendor.t(item.gender === 1 ? "男" : "女"),
e: item.gender === 1 ? 1 : "",
f: item.gender === 2 ? 1 : "",
g: common_vendor.t(item.country),
h: common_vendor.o(($event) => $options.onRecompose(item), index),
i: common_vendor.o(($event) => $options.onExpurgate(item), index),
j: index,
k: "daea6b33-0-" + i0
});
}),
d: common_vendor.o((...args) => $options.onRefresherRefresh && $options.onRefresherRefresh(...args)),
e: $data.triggered
} : {}, {
f: common_vendor.o(($event) => $options.openPopupQuantity()),
g: common_vendor.sr("createModule", "daea6b33-1"),
h: common_vendor.o($options.getAnchorList),
i: common_vendor.sr("modifyStreamer", "daea6b33-2"),
j: common_vendor.o($options.getAnchorList),
k: common_vendor.p({
message: $data.modifyStreamerMessage
})
});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-daea6b33"]]);
_sfc_main.__runtimeHooks = 2;
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pages/Mine/minecomponents/anchorLibrary.js.map