"use strict";
const common_vendor = require("../../common/vendor.js");
const stores_permission = require("../../stores/permission.js");
require("../../utils/storage.js");
require("../../utils/constant.js");
require("../../utils/request.js");
require("../../stores/user.js");
require("../../utils/auth.js");
require("../../config.js");
require("../../utils/errorCode.js");
require("../../utils/common.js");
if (!Array) {
  const _easycom_u_tabbar_item2 = common_vendor.resolveComponent("u-tabbar-item");
  const _easycom_u_tabbar2 = common_vendor.resolveComponent("u-tabbar");
  (_easycom_u_tabbar_item2 + _easycom_u_tabbar2)();
}
const _easycom_u_tabbar_item = () => "../../node-modules/uview-plus/components/u-tabbar-item/u-tabbar-item.js";
const _easycom_u_tabbar = () => "../../node-modules/uview-plus/components/u-tabbar/u-tabbar.js";
if (!Math) {
  (Home + Equipment + Commodity + Account + _easycom_u_tabbar_item + _easycom_u_tabbar)();
}
const Home = () => "./components/home.js";
const Equipment = () => "./components/equipment.js";
const Commodity = () => "./components/commodity.js";
const Account = () => "./components/account.js";
const _sfc_main = {
  __name: "home",
  setup(__props) {
    const current = common_vendor.ref(0);
    common_vendor.ref(null);
    const tabName = common_vendor.ref(null);
    const tabIcon = common_vendor.ref({
      "平台运维": ["../../static/images/tabbar/home.png", "../../static/images/tabbar/home_.png"],
      "质检&出厂": ["../../static/images/tabbar/equipment.png", "../../static/images/tabbar/equipment_.png"],
      "数据中心": ["../../static/images/tabbar/commodity.png", "../../static/images/tabbar/commodity_.png"],
      "商户运营": ["../../static/images/tabbar/mine.png", "../../static/images/tabbar/mine_.png"]
      // '商管端': ['../../static/images/tabbar/equipment.png', '../../static/images/tabbar/equipment_.png'],
    });
    const menu = common_vendor.ref(stores_permission.usePermissionStore().permissions_menu);
    const list = common_vendor.computed(() => {
      let list2 = [];
      menu.value.forEach((i) => {
        list2.push({
          name: i.meta.title,
          id: i.id
        });
      });
      return list2;
    });
    common_vendor.onShow(() => {
      const updateManager = common_vendor.wx$1.getUpdateManager();
      updateManager.onUpdateReady(function() {
        common_vendor.wx$1.showModal({
          title: "更新检测",
          content: "检测到新版本，是否重启小程序？",
          success: function(res) {
            if (res.confirm) {
              updateManager.applyUpdate();
            }
          }
        });
      });
      updateManager.onUpdateFailed(function() {
        common_vendor.wx$1.showModal({
          title: "已有新版本咯",
          content: "请您删除当前小程序，重新打开呦~",
          showCancel: false
        });
      });
    });
    common_vendor.onLoad((o) => {
      console.log("onLoad", o);
    });
    function tabChange(e) {
      current.value = e;
    }
    function tabClick(e) {
      tabName.value = e.name;
    }
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: current.value == 0
      }, current.value == 0 ? {
        b: common_vendor.sr("homeRef", "2070ea1e-0"),
        c: common_vendor.o(_ctx.play)
      } : {}, {
        d: current.value == 1
      }, current.value == 1 ? {
        e: common_vendor.sr("equipmentRef", "2070ea1e-1")
      } : {}, {
        f: current.value == 2
      }, current.value == 2 ? {
        g: common_vendor.sr("commodityRef", "2070ea1e-2")
      } : {}, {
        h: current.value == 3
      }, current.value == 3 ? {
        i: common_vendor.sr("accountRef", "2070ea1e-3")
      } : {}, {
        j: common_vendor.unref(list) && common_vendor.unref(list).length > 0
      }, common_vendor.unref(list) && common_vendor.unref(list).length > 0 ? {
        k: common_vendor.f(common_vendor.unref(list), (item, k0, i0) => {
          return {
            a: tabIcon.value[item.name][1],
            b: tabIcon.value[item.name][0],
            c: item.id,
            d: common_vendor.o(($event) => tabClick(item), item.id),
            e: "2070ea1e-5-" + i0 + ",2070ea1e-4",
            f: common_vendor.p({
              text: item.name
            })
          };
        }),
        l: common_vendor.o(tabChange),
        m: common_vendor.p({
          value: current.value,
          fixed: true,
          safeAreaInsetBottom: true
        })
      } : {});
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "F:/兴元/开门柜项目/平台端管理系统小程序/src/pages/globalPages/home.vue"]]);
wx.createPage(MiniProgramPage);
