refactor Setting

This commit is contained in:
Timi
2026-04-30 11:04:28 +08:00
parent 28f0eabff2
commit ff3297e879
15 changed files with 239 additions and 231 deletions

View File

@@ -5,7 +5,21 @@
</template>
<script lang="ts" setup>
import { Copyright } from "timi-web";
import {axios, Copyright, SettingMapper} from "timi-web";
import CommonAPI from "../src/api/CommonAPI";
onMounted(async () => {
const result = await CommonAPI.settingMap({
"SYSTEM": [
"SETTING_TTL"
]
});
SettingMapper.appendSettingMap(result);
console.log(SettingMapper.getValue("SYSTEM", "SETTING_TTL").value);
})
</script>
<style lang="less" scoped>
.root {

View File

@@ -1,6 +1,23 @@
import { createApp } from "vue";
import {createApp} from "vue";
import Root from "./Root.vue";
import { VPopup } from "timi-web"; // 本地开发
import {axios, Network, VPopup} from "timi-web";
axios.defaults.baseURL = import.meta.env.VITE_API;
axios.interceptors.request.use((config) => {
const token = "V8khmLKkec1ahtjzFm2kx65wvmHob8N5lonqfUy3SsfxJ2HevYi8tLrxrL1iprcl";
if (token) {
if (config.method === "get") {
config.params = {
token,
...config.params
};
}
config.headers.set({ "Token": token });
}
return config;
}, (error: any) => {
return Promise.reject(error);
});
const app = createApp(Root);
app.directive("popup", VPopup);

View File

@@ -5,3 +5,11 @@ declare module "*.vue" {
}
declare module "prismjs";
interface ImportMetaEnv {
readonly VITE_API: string;
}
interface ImportMeta {
readonly env: ImportMetaEnv
}