├── php-api/ # 改造后的PHP接口层 ├── java-ad-service/ # 若依框架微服务(广告+VIP+分账) ├── uniapp-reader/ # UniApp前端项目 │ ├── pages/ # 各端页面 │ └──
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { defineStore } from 'pinia'
  2. import { ref } from 'vue'
  3. export const useThemeStore = defineStore('theme', () => {
  4. const themes = ref({
  5. default: {
  6. '--primary-color': '#1890ff',
  7. '--bg-color': '#f8f9fa',
  8. '--text-color': '#333',
  9. '--header-bg': '#ffffff'
  10. },
  11. aydzBlue: {
  12. '--primary-color': '#2a5caa',
  13. '--bg-color': '#e6f7ff',
  14. '--text-color': '#1a3353',
  15. '--header-bg': '#2a5caa'
  16. },
  17. darkMode: {
  18. '--primary-color': '#52c41a',
  19. '--bg-color': '#1a1a1a',
  20. '--text-color': '#e6e6e6',
  21. '--header-bg': '#2a2a2a'
  22. }
  23. })
  24. const currentTheme = ref('default')
  25. // 初始化主题
  26. const initTheme = () => {
  27. const savedTheme = uni.getStorageSync('selectedTheme') || 'default'
  28. setTheme(savedTheme)
  29. }
  30. // 设置主题
  31. const setTheme = (themeName) => {
  32. if (!themes.value[themeName]) return
  33. currentTheme.value = themeName
  34. uni.setStorageSync('selectedTheme', themeName)
  35. // 应用CSS变量
  36. const themeVars = themes.value[themeName]
  37. Object.keys(themeVars).forEach(key => {
  38. document.documentElement.style.setProperty(key, themeVars[key])
  39. })
  40. }
  41. return { themes, currentTheme, initTheme, setTheme }
  42. })