import { createApp } from 'vue' import ElementPlus from 'element-plus' import zhCn from 'element-plus/es/locale/lang/zh-cn' import * as ElementPlusIconsVue from '@element-plus/icons-vue' import 'element-plus/dist/index.css' import App from './App.vue' import './style.css' const app = createApp(App) // 全量注册图标,模板中可直接 使用 for (const [key, component] of Object.entries(ElementPlusIconsVue)) { app.component(key, component) } app.use(ElementPlus, { locale: zhCn }).mount('#app') /* ============================================================ 皮肤(skin):只切 token,不改组件。 precision = 冷灰 + 压深天蓝的精密工作台(默认) cream = 奶油极简治愈风(旧皮肤,保留可切换) 切换:localStorage['37du.skin'] = 'precision' | 'cream' ============================================================ */ const SKIN_KEY = '37du.skin' const SKINS = ['cream', 'precision'] function initSkin() { let skin = 'precision' try { skin = localStorage.getItem(SKIN_KEY) || 'precision' } catch (_) { /* 隐私模式等 */ } if (!SKINS.includes(skin)) skin = 'precision' document.documentElement.dataset.skin = skin } // 在挂载前应用,避免首屏闪一下默认皮肤 initSkin() /* ============================================================ 奶油涂鸦装饰层:fixed 浮于页面顶层,仅视觉点缀。 可开关:localStorage['37du.doodles'] = 'off'(登录页顶部 ✿ 按钮同源) 注意:涂鸦是奶油皮肤专属装饰,precision 皮肤下由 CSS 整体隐藏。 ============================================================ */ const DOODLES = { squiggle: '' + '' + '', cloud: '' + '', sparkles: '' + '' + '' + '', heart: '' + '', plant: '' + '' + '' + '', sun: '' + '' + '' + '', } function initDoodles() { if (document.getElementById('dsh-doodles')) return const wrap = document.createElement('div') wrap.id = 'dsh-doodles' // [类型, left, top, 水平翻转] const spots = [ ['squiggle', '6%', '12%', false], ['cloud', '88%', '8%', false], ['sun', '93%', '40%', false], ['sparkles', '78%', '66%', false], ['heart', '5%', '68%', false], ['plant', '13%', '36%', true], ] for (const [name, left, top, flip] of spots) { const el = document.createElement('span') el.className = 'doodle' el.style.left = left el.style.top = top el.innerHTML = DOODLES[name] || DOODLES.sparkles if (flip) el.querySelector('svg').style.transform = 'scaleX(-1)' wrap.appendChild(el) } document.body.appendChild(wrap) let on = 'on' try { on = localStorage.getItem('37du.doodles') || 'on' } catch (_) {} document.documentElement.classList.toggle('no-doodles', on === 'off') } // 应用挂载后注入(body 已存在),不阻塞首屏 initDoodles()