1404/11/01-add dynamic config
This commit is contained in:
+19
-2
@@ -1,7 +1,7 @@
|
||||
import 'ant-design-vue/dist/antd.less'
|
||||
import './assets/css/main.less'
|
||||
import 'virtual:uno.css'
|
||||
import { computed, createApp, ref, watch } from 'vue'
|
||||
import {computed, createApp, nextTick, ref, watch} from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
import '@unocss/reset/tailwind-compat.css'
|
||||
import VueApexCharts from 'vue3-apexcharts'
|
||||
@@ -16,6 +16,7 @@ import { getMe } from '@/api/me'
|
||||
import type { NavigationGuardNext, RouteLocationNormalized } from 'vue-router'
|
||||
import { useAuthStore } from '@/store/useAuthStore'
|
||||
|
||||
|
||||
const app = createApp(App)
|
||||
app.use(createPinia())
|
||||
app.use(VueLazyLoad, {
|
||||
@@ -42,6 +43,7 @@ const currentRoute = computed(() => {
|
||||
})
|
||||
|
||||
async function start() {
|
||||
|
||||
// console.log('ffffffffffffffffffffffffffffffffffffffffff')
|
||||
if (getToken()) {
|
||||
// await userStore.getMyInfo()
|
||||
@@ -51,6 +53,7 @@ async function start() {
|
||||
}
|
||||
|
||||
}
|
||||
const win = window as Window & { isWhatsappBtnAdded?: boolean };
|
||||
|
||||
export function setTruth() {
|
||||
fingerPosition = true
|
||||
@@ -177,11 +180,25 @@ router.beforeEach(async (to, from, next) => {
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
app.mount('#app')
|
||||
// if (currentRoute.value !== '/') {
|
||||
// await start()
|
||||
// }
|
||||
|
||||
nextTick(() => {
|
||||
const color = window.__APP_CONFIG__?.user?.color
|
||||
const secondary_color = window.__APP_CONFIG__?.user?.secondary_color
|
||||
|
||||
|
||||
if (!color) {
|
||||
console.warn('Primary color not found')
|
||||
return
|
||||
}
|
||||
console.log('APP_CONFIG:', window.__APP_CONFIG__.user.color)
|
||||
document.documentElement.style.setProperty('--App-primary-color', color)
|
||||
document.documentElement.style.setProperty('--App-secondary-color', secondary_color)
|
||||
|
||||
})
|
||||
watch(currentRoute, async () => userStore.userInfo ? '' : await start())
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user