144 lines
5.1 KiB
JavaScript
144 lines
5.1 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const components_VerifyLogin = require("../VerifyLogin.js");
|
|
const components_goEasyTool_tool = require("../goEasyTool/tool.js");
|
|
if (!Math) {
|
|
NewAddedPk();
|
|
}
|
|
const NewAddedPk = () => "../../pages/NewAddedPk/NewAddedPk2.js";
|
|
const _sfc_main = {
|
|
__name: "tabBar",
|
|
props: {
|
|
tabIndex: Number
|
|
//当前tab索引
|
|
},
|
|
setup(__props) {
|
|
const instance = common_vendor.getCurrentInstance();
|
|
const $goeasy = instance.appContext.config.globalProperties.$goeasy;
|
|
const Unread = common_vendor.ref(0);
|
|
var im = $goeasy.im;
|
|
function onConversationsUpdated(conversations) {
|
|
common_vendor.index.__f__("log", "at components/tabBar/tabBar.vue:47", "监听会话列表", conversations);
|
|
Unread.value = conversations.unreadTotal;
|
|
}
|
|
let showMiddleButton = common_vendor.ref(false);
|
|
let tabList = common_vendor.reactive([
|
|
{
|
|
iconPath: "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Pk.png",
|
|
selectedIconPath: "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/PKClick.png",
|
|
text: "PK",
|
|
pagePath: "/pages/Home/Home",
|
|
middleClass: ""
|
|
},
|
|
{
|
|
iconPath: "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Forum.png",
|
|
selectedIconPath: "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Forumclick.png",
|
|
text: "站内信",
|
|
pagePath: "/pages/Forum/Forum",
|
|
middleClass: ""
|
|
},
|
|
{
|
|
iconPath: "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/jiahao.png",
|
|
selectedIconPath: "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/jiahao.png",
|
|
text: "",
|
|
pagePath: "/pages/c/c",
|
|
middleClass: ""
|
|
},
|
|
{
|
|
iconPath: "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Message.png",
|
|
selectedIconPath: "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Messageclick.png",
|
|
text: "消息",
|
|
pagePath: "/pages/index/index",
|
|
middleClass: ""
|
|
},
|
|
{
|
|
iconPath: "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Mine.png",
|
|
selectedIconPath: "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Mineclick.png",
|
|
text: "我的",
|
|
pagePath: "/pages/Mine/Mine",
|
|
middleClass: ""
|
|
}
|
|
]);
|
|
common_vendor.onMounted(() => {
|
|
setTabBar();
|
|
setTimeout(() => {
|
|
components_goEasyTool_tool.getConversationList($goeasy).then((conversations) => {
|
|
Unread.value = conversations.unreadTotal;
|
|
});
|
|
im.on(common_vendor.jo.IM_EVENT.CONVERSATIONS_UPDATED, onConversationsUpdated);
|
|
}, 1e3);
|
|
});
|
|
common_vendor.index.getSystemInfo({
|
|
success: function(res) {
|
|
if (res.safeArea.top > 40)
|
|
;
|
|
}
|
|
});
|
|
function setTabBar() {
|
|
let tabLength = tabList.length;
|
|
if (tabLength % 2) {
|
|
showMiddleButton.value = true;
|
|
let middleIndex = Math.floor(tabLength / 2);
|
|
tabList[middleIndex].middleClass = "mid-button";
|
|
}
|
|
}
|
|
const createModule = common_vendor.ref();
|
|
function openPopupQuantity() {
|
|
createModule.value.open();
|
|
}
|
|
const disabledScroll = () => {
|
|
return false;
|
|
};
|
|
function handlePush(item, index) {
|
|
if (index === 2) {
|
|
components_VerifyLogin.VerifyLogin().then((res) => {
|
|
if (res) {
|
|
openPopupQuantity();
|
|
return;
|
|
}
|
|
});
|
|
} else if (index === 4) {
|
|
components_VerifyLogin.VerifyLogin().then((res) => {
|
|
if (res) {
|
|
common_vendor.index.switchTab({
|
|
url: "/pages/Mine/Mine",
|
|
animationType: "none"
|
|
});
|
|
}
|
|
});
|
|
} else {
|
|
common_vendor.index.switchTab({
|
|
url: item.pagePath
|
|
});
|
|
}
|
|
}
|
|
return (_ctx, _cache) => {
|
|
return {
|
|
a: common_vendor.f(common_vendor.unref(tabList), (item, index, i0) => {
|
|
return common_vendor.e({
|
|
a: __props.tabIndex == index ? item.selectedIconPath : item.iconPath,
|
|
b: index === 3 && Unread.value > 0
|
|
}, index === 3 && Unread.value > 0 ? {
|
|
c: common_vendor.t(Unread.value > 99 ? "99+" : Unread.value)
|
|
} : {}, {
|
|
d: common_vendor.t(item.text),
|
|
e: __props.tabIndex == index ? "#1DD2F9" : "#A7A3A3",
|
|
f: common_vendor.n("list-item flex flex-column flex-middle " + item.middleClass),
|
|
g: common_vendor.o(($event) => handlePush(item, index), index),
|
|
h: index
|
|
});
|
|
}),
|
|
b: common_vendor.n(common_vendor.unref(showMiddleButton) === true ? "tab-list-middle" : "tab-list-default"),
|
|
c: common_vendor.o(disabledScroll),
|
|
d: common_vendor.sr(createModule, "c497a889-0", {
|
|
"k": "createModule"
|
|
}),
|
|
e: common_vendor.o(_ctx.publishSuccesss)
|
|
};
|
|
};
|
|
}
|
|
};
|
|
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-c497a889"]]);
|
|
wx.createComponent(Component);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/tabBar/tabBar.js.map
|