@fmdevui/fm-dev
Version:
Page level components developed based on Element Plus.
58 lines (54 loc) • 2.54 kB
JavaScript
;
var index$1 = require('../storage/index.js');
var pinia = require('pinia');
require('../../stores/index.js');
var index$2 = require('../const/index.js');
require('../../api/index.js');
var index$3 = require('../emit/index.js');
var themeConfig = require('../../stores/themeConfig.js');
var index = require('../../api/sys/index.js');
async function loadSysInfo(tenantid) {
const storesThemeConfig = themeConfig.useThemeConfig();
const { themeConfig: themeConfig$1 } = pinia.storeToRefs(storesThemeConfig);
const [err, res] = await index.feature(index.useSysApi().getSysInfo(Number(tenantid)));
if (err) {
themeConfig$1.value.logoUrl = "logo.png";
index$1.Local.remove(index$2.PUB.themeConfig);
index$1.Local.set(index$2.PUB.themeConfig, storesThemeConfig.themeConfig);
return;
} else {
if (res.data.type != "success" || res.data.result == null) return;
const data = res.data.result;
themeConfig$1.value.logoUrl = data.logo;
themeConfig$1.value.globalTitle = data.title;
themeConfig$1.value.globalViceTitle = data.viceTitle;
themeConfig$1.value.globalViceTitleMsg = data.viceDesc;
themeConfig$1.value.icp = data.icp;
themeConfig$1.value.icpUrl = data.icpUrl;
themeConfig$1.value.isWatermark = data.watermark != null;
themeConfig$1.value.watermarkText = data.watermark;
themeConfig$1.value.copyright = data.copyright;
themeConfig$1.value.version = data.version;
themeConfig$1.value.primary = data.themeColor;
themeConfig$1.value.layout = data.layout;
themeConfig$1.value.animation = data.animation;
themeConfig$1.value.secondVer = data.secondVer;
themeConfig$1.value.captcha = data.captcha;
themeConfig$1.value.forceChangePassword = data.forceChangePassword;
themeConfig$1.value.passwordExpirationTime = data.passwordExpirationTime;
themeConfig$1.value.i18NSwitch = data.i18NSwitch;
themeConfig$1.value.idleTimeout = data.idleTimeout;
themeConfig$1.value.onlineNotice = data.onlineNotice;
window.__env__.VITE_SM_PUBLIC_KEY = data.publicKey;
updateFavicon(data.logo);
index$3.default.emit("updateIdleTimeoutchange", themeConfig$1.value.idleTimeout ?? 0);
index$1.Local.remove(index$2.PUB.themeConfig);
index$1.Local.set(index$2.PUB.themeConfig, storesThemeConfig.themeConfig);
}
}
const updateFavicon = (url) => {
const favicon = document.getElementById("favicon");
favicon.href = url ? url : "data:;base64,=";
};
exports.loadSysInfo = loadSysInfo;
exports.updateFavicon = updateFavicon;