| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 | 
							- <template>
 
-     <hc-app-config>
 
-         <router-view />
 
-     </hc-app-config>
 
- </template>
 
- <script setup>
 
- import { nextTick, onMounted, ref, watch } from 'vue'
 
- import { useAppStore } from '~src/store'
 
- import { detectionBrowser, getAppVersion, useOsTheme } from 'hc-vue3-ui'
 
- import { getObjValue, setElementMainColor } from 'js-fast-way'
 
- import website from '~src/config'
 
- import { useRoute } from 'vue-router'
 
- //初始变量
 
- const appStore = useAppStore()
 
- const UserTheme = ref(appStore.getTheme)
 
- const useRoutes = useRoute()
 
- //监听
 
- watch(() => [appStore.getTheme, appStore.getThemeVal, appStore.getColor], ([Theme, ThemeVal, ColorVal]) => {
 
-     UserTheme.value = Theme
 
-     setUserTheme(ThemeVal, ColorVal)
 
- })
 
- onMounted(() => {
 
-     // 监听设备连接
 
-     navigator?.usb?.addEventListener('connect', ({ device }) => {
 
-         console.log('USB 设备已连接:', device)
 
-         if (device.manufacturerName === 'CFIST') {
 
-             appStore.setIsUKey(true)
 
-         }
 
-     })
 
-     // 监听设备断开
 
-     navigator?.usb?.addEventListener('disconnect', ({ device }) => {
 
-         console.log('USB 设备已断开:', device)
 
-         if (device.manufacturerName === 'CFIST') {
 
-             appStore.setIsUKey(false)
 
-         }
 
-     })
 
- })
 
- nextTick(() => {
 
-     window.$localModel = website.localModel
 
-     setUserTheme(appStore.getThemeVal, appStore.getColor)
 
-     //生产环境下,检测更新
 
-     if (import.meta.env.PROD && appStore.isSource !== 'app') {
 
-         detectionBrowser()
 
-         getAppVersion()
 
-     }
 
-     //获取屏幕宽高
 
-     const dom = document.body
 
-     console.log('高:' + dom.clientHeight, '宽:' + dom.clientWidth)
 
- })
 
- //设置主题
 
- const setUserTheme = (theme, appColor) => {
 
-     const projectInfo = appStore.projectInfo
 
-     const id = '1891312830718746625'
 
-     let isYunNan = useRoutes?.path !== '/home/config' && projectInfo?.id === id
 
-     if (isYunNan) {
 
-         setElementMainColor('#409eff')
 
-         let colorName = 'blue'
 
-         let theme = 'light'
 
-         document.documentElement.setAttribute('class', `${theme} color-${colorName}`)
 
-         return
 
-     }
 
-     const colorVal = getObjValue(appColor)
 
-     //设置主色调
 
-     setElementMainColor(colorVal?.color)
 
-     const colorName = colorVal?.name || 'green'
 
-     //设置主题
 
-     let val = UserTheme.value
 
-     if (val === 'auto') {
 
-         theme = useOsTheme()
 
-     }
 
-     if (theme === '') {
 
-         theme = val
 
-     }
 
-   
 
-     //挂载相关样式
 
-     document.documentElement.setAttribute('class', `${theme} color-${colorName}`)
 
- }
 
- </script>
 
 
  |