first commit
This commit is contained in:
commit
db5762abd4
687 files changed
+171307
No files matched your search
@@ -0,0 +1,47 @@
|
||||
import { ref } from "vue";
|
||||
import { computed } from "vue";
|
||||
import { useState } from "#app";
|
||||
import { useApi } from "~/lib/auth.js";
|
||||
var i = null;
|
||||
function a() {
|
||||
let a = useState(`site-config`, () => null),
|
||||
o = ref(``);
|
||||
async function s() {
|
||||
if (((o.value = ``), a.value)) return a.value;
|
||||
i ||= useApi()
|
||||
.get(`/common`, void 0, !1, {
|
||||
timeoutMs: 1e4,
|
||||
})
|
||||
.then((e) => ((a.value = e), e))
|
||||
.catch((e) => {
|
||||
throw ((i = null), e);
|
||||
});
|
||||
try {
|
||||
return await i;
|
||||
} catch (e) {
|
||||
return (
|
||||
(o.value = e instanceof Error ? e.message : `加载站点配置失败`),
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
let c = (e) => e === 1 || e === `1` || e === !0;
|
||||
return {
|
||||
config: a,
|
||||
error: o,
|
||||
load: s,
|
||||
on: c,
|
||||
maintenance: computed(() => c(a.value?.maintenance_mode)),
|
||||
rechargeClosed: computed(
|
||||
() => a.value != null && !c(a.value.recharge_open),
|
||||
),
|
||||
lockedFields: computed(
|
||||
() => a.value?.prohibit_user_information_changes ?? [],
|
||||
),
|
||||
siteName: computed(() => a.value?.website_name || `破碎工坊云`),
|
||||
scanLoginEnabled: computed(() =>
|
||||
c(a.value?.plugin_configuration?.mp_weixin_notice?.scan_login),
|
||||
),
|
||||
};
|
||||
}
|
||||
export { a as t };
|
||||
Reference in new issue
Block a user