|
|
|
"use strict";
|
|
|
|
const common_vendor = require("../../common/vendor.js");
|
|
|
|
const api_user = require("../../api/user.js");
|
|
|
|
const utils_cacheimg = require("../../utils/cacheimg.js");
|
|
|
|
const store_useStorageStore = require("../../store/useStorageStore.js");
|
|
|
|
require("../../utils/request.js");
|
|
|
|
require("../../store/index.js");
|
|
|
|
require("../../utils/functions.js");
|
|
|
|
require("../../utils/IDCardVerification.js");
|
|
|
|
require("../../utils/base64.js");
|
|
|
|
require("../../config/host.js");
|
|
|
|
require("../../utils/md5.js");
|
|
|
|
if (!Array) {
|
|
|
|
const _easycom_u_navbar2 = common_vendor.resolveComponent("u-navbar");
|
|
|
|
const _component_tips = common_vendor.resolveComponent("tips");
|
|
|
|
(_easycom_u_navbar2 + _component_tips)();
|
|
|
|
}
|
|
|
|
const _easycom_u_navbar = () => "../../uni_modules/uview-plus/components/u-navbar/u-navbar.js";
|
|
|
|
if (!Math) {
|
|
|
|
_easycom_u_navbar();
|
|
|
|
}
|
|
|
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
|
__name: "index",
|
|
|
|
setup(__props) {
|
|
|
|
const storageStore = store_useStorageStore.useStorageStore();
|
|
|
|
const { HANDLE_GETSTORAGEINFO } = storageStore;
|
|
|
|
const { storageArr } = common_vendor.storeToRefs(storageStore);
|
|
|
|
const tip = common_vendor.ref(null);
|
|
|
|
let details = common_vendor.reactive({ tablist: [] });
|
|
|
|
function gopathpage(path) {
|
|
|
|
common_vendor.index.navigateTo({
|
|
|
|
url: path
|
|
|
|
});
|
|
|
|
}
|
|
|
|
async function init() {
|
|
|
|
let tabber = common_vendor.index.getStorageSync("homerouter");
|
|
|
|
if (tabber) {
|
|
|
|
details.tablist = tabber;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
let res = await api_user.appMenuroutes({});
|
|
|
|
console.log(res, "-------------");
|
|
|
|
console.log("刷新后");
|
|
|
|
if (res.code == 200) {
|
|
|
|
getimgcache(res.data[0]);
|
|
|
|
} else {
|
|
|
|
common_vendor.index.showToast({
|
|
|
|
title: res.msg,
|
|
|
|
icon: "none"
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
async function initbuts() {
|
|
|
|
let authbut = common_vendor.index.getStorageSync("authbuts");
|
|
|
|
console.log("authbut :>> ", authbut);
|
|
|
|
if (authbut) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
let butres = await api_user.appbuttons({});
|
|
|
|
console.log(butres.data);
|
|
|
|
let qxan = [];
|
|
|
|
butres.data.map((item) => {
|
|
|
|
item.children.map((ite) => {
|
|
|
|
qxan.push({ name: ite.name, code: ite.code });
|
|
|
|
});
|
|
|
|
});
|
|
|
|
common_vendor.index.setStorageSync("authbuts", qxan);
|
|
|
|
}
|
|
|
|
common_vendor.onShow(() => {
|
|
|
|
init();
|
|
|
|
initbuts();
|
|
|
|
if (storageArr.value.length === 0)
|
|
|
|
HANDLE_GETSTORAGEINFO();
|
|
|
|
});
|
|
|
|
common_vendor.onLoad(() => {
|
|
|
|
});
|
|
|
|
common_vendor.onPullDownRefresh(() => {
|
|
|
|
const timer = setTimeout(() => {
|
|
|
|
init();
|
|
|
|
initbuts();
|
|
|
|
HANDLE_GETSTORAGEINFO();
|
|
|
|
common_vendor.index.stopPullDownRefresh();
|
|
|
|
clearTimeout(timer);
|
|
|
|
}, 500);
|
|
|
|
});
|
|
|
|
common_vendor.watchEffect(() => {
|
|
|
|
if (details.tablist.length > 0) {
|
|
|
|
common_vendor.index.setStorageSync("homerouter", details.tablist);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
async function getimgcache(list) {
|
|
|
|
let maxarr = [];
|
|
|
|
if (!list)
|
|
|
|
return;
|
|
|
|
for (let item of list.children) {
|
|
|
|
let arr = {
|
|
|
|
type: 1,
|
|
|
|
name: item.name,
|
|
|
|
minilist: []
|
|
|
|
};
|
|
|
|
for (let ite of item.children) {
|
|
|
|
let result = null;
|
|
|
|
if (ite.source != null) {
|
|
|
|
result = await utils_cacheimg.getImageCache(ite.source);
|
|
|
|
}
|
|
|
|
let obj = {
|
|
|
|
icon: result,
|
|
|
|
name: ite.name,
|
|
|
|
router: ite.path
|
|
|
|
};
|
|
|
|
arr.minilist.push(obj);
|
|
|
|
}
|
|
|
|
maxarr.push(arr);
|
|
|
|
}
|
|
|
|
details.tablist = maxarr;
|
|
|
|
console.log(details.tablist);
|
|
|
|
}
|
|
|
|
const { tablist } = common_vendor.toRefs(details);
|
|
|
|
return (_ctx, _cache) => {
|
|
|
|
return {
|
|
|
|
a: common_vendor.p({
|
|
|
|
title: "工作台",
|
|
|
|
placeholder: true,
|
|
|
|
border: "true",
|
|
|
|
leftIcon: ""
|
|
|
|
}),
|
|
|
|
b: common_vendor.f(common_vendor.unref(tablist), (item, k0, i0) => {
|
|
|
|
return {
|
|
|
|
a: common_vendor.t(item.name),
|
|
|
|
b: common_vendor.f(item.minilist, (ite, k1, i1) => {
|
|
|
|
return {
|
|
|
|
a: ite.icon,
|
|
|
|
b: common_vendor.t(ite.name),
|
|
|
|
c: common_vendor.o(($event) => gopathpage(ite.router))
|
|
|
|
};
|
|
|
|
})
|
|
|
|
};
|
|
|
|
}),
|
|
|
|
c: common_vendor.sr(tip, "0c2ea314-1", {
|
|
|
|
"k": "tip"
|
|
|
|
})
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
});
|
|
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/worksp/logpm/pages/index/index.vue"]]);
|
|
|
|
wx.createPage(MiniProgramPage);
|