194 lines
5.8 KiB
JavaScript
194 lines
5.8 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const common_assets = require("../../common/assets.js");
|
|
const common_js_util = require("../../common/js/util.js");
|
|
if (!Array) {
|
|
const _easycom_uni_grid_item2 = common_vendor.resolveComponent("uni-grid-item");
|
|
const _easycom_uni_grid2 = common_vendor.resolveComponent("uni-grid");
|
|
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
|
|
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
|
|
(_easycom_uni_grid_item2 + _easycom_uni_grid2 + _easycom_uni_icons2 + _easycom_uni_popup2)();
|
|
}
|
|
const _easycom_uni_grid_item = () => "../../uni_modules/uni-grid/components/uni-grid-item/uni-grid-item.js";
|
|
const _easycom_uni_grid = () => "../../uni_modules/uni-grid/components/uni-grid/uni-grid.js";
|
|
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
|
|
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
|
|
if (!Math) {
|
|
(_easycom_uni_grid_item + _easycom_uni_grid + _easycom_uni_icons + _easycom_uni_popup)();
|
|
}
|
|
const _sfc_main = {
|
|
__name: "footerMenu",
|
|
props: {
|
|
page: {
|
|
type: String
|
|
},
|
|
// 主题 dark黑色 light白色的
|
|
subject: {
|
|
type: String,
|
|
default: "light"
|
|
}
|
|
},
|
|
setup(__props) {
|
|
const {
|
|
proxy
|
|
} = common_vendor.getCurrentInstance();
|
|
const userinfo = common_vendor.computed(() => {
|
|
let resuilt = common_vendor.index.$store.state.userinfo;
|
|
return resuilt;
|
|
});
|
|
const mode = common_vendor.computed(() => common_vendor.index.$store.state.tabbarMode);
|
|
const menu = common_vendor.computed(() => {
|
|
let arr = [
|
|
{
|
|
page: "index",
|
|
type: "option",
|
|
name: "视频",
|
|
pagePath: "pages/index/index"
|
|
},
|
|
{
|
|
page: "shop",
|
|
type: "option",
|
|
name: "商城",
|
|
pagePath: "pages/shop/shop"
|
|
},
|
|
{
|
|
type: "middle",
|
|
name: ""
|
|
},
|
|
{
|
|
page: "news",
|
|
type: "option",
|
|
name: "消息",
|
|
pagePath: "pages/news/news"
|
|
}
|
|
];
|
|
switch (mode.value) {
|
|
case "default":
|
|
arr[2].pagePath = "pages/release/video";
|
|
arr.push({
|
|
page: "mine",
|
|
type: "option",
|
|
name: "我的",
|
|
pagePath: "pages/mine/homepage"
|
|
});
|
|
break;
|
|
case "shop":
|
|
arr[2].pagePath = "pages/merchant/commodity-release/index";
|
|
arr.push({
|
|
page: "mine",
|
|
type: "option",
|
|
name: "个人中心",
|
|
pagePath: "pages/mine/mine"
|
|
});
|
|
break;
|
|
}
|
|
return arr;
|
|
});
|
|
let safeHeight = common_vendor.ref(0);
|
|
const showMenu = common_vendor.computed(() => {
|
|
let result = [];
|
|
if (userinfo.value.userId) {
|
|
result.push({
|
|
name: "发布视频",
|
|
img: "/static/footerMenu1.png",
|
|
url: "/pages/release/video"
|
|
});
|
|
}
|
|
return result;
|
|
});
|
|
common_vendor.onMounted(() => {
|
|
addListener();
|
|
common_vendor.index.hideTabBar();
|
|
common_vendor.index.getSystemInfo().then((rs) => {
|
|
safeHeight.value = rs.safeArea + "px";
|
|
});
|
|
});
|
|
common_vendor.onUnmounted(() => {
|
|
common_vendor.index.$off("changeMine");
|
|
});
|
|
function addListener() {
|
|
common_vendor.index.$on("changeMine", (value) => {
|
|
common_vendor.index.$store.commit("setState", {
|
|
key: "tabbarMode",
|
|
value
|
|
});
|
|
});
|
|
}
|
|
function handleMenu(item) {
|
|
if (item.type != "middle") {
|
|
common_vendor.index.switchTab({
|
|
url: `/${item.pagePath}`
|
|
});
|
|
return;
|
|
}
|
|
proxy.$refs.alert.open();
|
|
}
|
|
function handleAlert(ev) {
|
|
const index = ev.detail.index;
|
|
const item = showMenu.value[index];
|
|
if (item.url) {
|
|
common_vendor.index.navigateTo({
|
|
url: item.url
|
|
});
|
|
} else
|
|
common_js_util.util.alert("敬请期待");
|
|
proxy.$refs.alert.close();
|
|
}
|
|
return (_ctx, _cache) => {
|
|
return {
|
|
a: common_vendor.unref(safeHeight),
|
|
b: common_vendor.f(menu.value, (item, index, i0) => {
|
|
return common_vendor.e({
|
|
a: item.type == "option"
|
|
}, item.type == "option" ? {
|
|
b: common_vendor.t(item.name),
|
|
c: item.page === __props.page ? 1 : ""
|
|
} : item.type === "middle" ? common_vendor.e({
|
|
e: __props.subject == "dark"
|
|
}, __props.subject == "dark" ? {
|
|
f: common_assets._imports_0$11
|
|
} : __props.subject == "light" ? {
|
|
h: common_assets._imports_1$3
|
|
} : {}, {
|
|
g: __props.subject == "light"
|
|
}) : {}, {
|
|
d: item.type === "middle",
|
|
i: index,
|
|
j: common_vendor.o$1(($event) => handleMenu(item), index)
|
|
});
|
|
}),
|
|
c: common_vendor.unref(safeHeight),
|
|
d: common_vendor.f(showMenu.value, (item, index, i0) => {
|
|
return {
|
|
a: item.img,
|
|
b: common_vendor.t(item.name),
|
|
c: index,
|
|
d: "0ddfa1ce-2-" + i0 + ",0ddfa1ce-1",
|
|
e: common_vendor.p({
|
|
index
|
|
})
|
|
};
|
|
}),
|
|
e: common_vendor.o$1(handleAlert),
|
|
f: common_vendor.p({
|
|
column: 4,
|
|
highlight: true,
|
|
showBorder: false
|
|
}),
|
|
g: common_vendor.o$1(($event) => _ctx.$refs.alert.close()),
|
|
h: common_vendor.p({
|
|
type: "bottom",
|
|
size: "50rpx",
|
|
color: "#999"
|
|
}),
|
|
i: common_vendor.sr("alert", "0ddfa1ce-0"),
|
|
j: common_vendor.p({
|
|
type: "bottom"
|
|
}),
|
|
k: common_vendor.n(__props.subject)
|
|
};
|
|
};
|
|
}
|
|
};
|
|
wx.createComponent(_sfc_main);
|