Просмотр исходного кода

refactor(theme): update theme configuration to use reactive state

- Replaced persistent storage with a reactive ref for theme configuration, simplifying state management.
- Removed unnecessary imports to streamline the code and improve readability.
yb 6 дней назад
Родитель
Сommit
e6aa4b6a12
4 измененных файлов с 31 добавлено и 6 удалено
  1. 5 0
      src/locales/en.json
  2. 5 0
      src/locales/zh-cn.json
  3. 4 6
      src/store/theme.ts
  4. 17 0
      src/views/demo.vue

+ 5 - 0
src/locales/en.json

@@ -6,8 +6,10 @@
   "IP地址": "IP Address",
   "LSS": "LSS",
   "LSS ID": "LSS ID",
+  "LSS 管理": "LSS Management",
   "LSS 节点详情": "LSS Node Details",
   "LSS详情": "LSS Details",
+  "LiveStream 管理": "LiveStream Management",
   "Logo URL": "Logo URL",
   "PTZ": "PTZ",
   "RTSP URL模板": "RTSP URL Template",
@@ -19,6 +21,7 @@
   "Status": "Status",
   "Stream 测试": "Stream Test",
   "Video ID": "Video ID",
+  "WebRTC 流": "WebRTC Stream",
   "ably": "ably",
   "button.cancel": "Cancel",
   "button.confirm": "Confirm",
@@ -98,6 +101,7 @@
   "型号": "Model",
   "复制": "Copy",
   "复制失败": "Copy failed",
+  "多视频监控": "Multi-video Monitoring",
   "如何获取 Customer Subdomain": "How to get Customer Subdomain",
   "密码": "Password",
   "密码长度不能少于6位": "Password length must be at least 6 characters",
@@ -145,6 +149,7 @@
   "摄像头管理系统": "Camera Management",
   "摄像头连接失败": "Camera connection failed",
   "摄像头连接正常": "Camera connection successful",
+  "摄像头配置": "Camera Configuration",
   "播放": "Play",
   "播放器类型": "Player Type",
   "播放域名的子域名部分": "The subdomain part of the playback domain",

+ 5 - 0
src/locales/zh-cn.json

@@ -6,8 +6,10 @@
   "IP地址": "IP地址",
   "LSS": "LSS",
   "LSS ID": "LSS ID",
+  "LSS 管理": "LSS 管理",
   "LSS 节点详情": "LSS 节点详情",
   "LSS详情": "LSS详情",
+  "LiveStream 管理": "LiveStream 管理",
   "Logo URL": "Logo URL",
   "PTZ": "PTZ",
   "RTSP URL模板": "RTSP URL模板",
@@ -19,6 +21,7 @@
   "Status": "Status",
   "Stream 测试": "Stream 测试",
   "Video ID": "Video ID",
+  "WebRTC 流": "WebRTC 流",
   "ably": "ably",
   "button.cancel": "button.cancel",
   "button.confirm": "button.confirm",
@@ -98,6 +101,7 @@
   "型号": "型号",
   "复制": "复制",
   "复制失败": "复制失败",
+  "多视频监控": "多视频监控",
   "如何获取 Customer Subdomain": "如何获取 Customer Subdomain",
   "密码": "密码",
   "密码长度不能少于6位": "密码长度不能少于6位",
@@ -145,6 +149,7 @@
   "摄像头管理系统": "摄像头管理系统",
   "摄像头连接失败": "摄像头连接失败",
   "摄像头连接正常": "摄像头连接正常",
+  "摄像头配置": "摄像头配置",
   "播放": "播放",
   "播放器类型": "播放器类型",
   "播放域名的子域名部分": "播放域名的子域名部分",

+ 4 - 6
src/store/theme.ts

@@ -1,6 +1,6 @@
 import { defineStore } from 'pinia'
-import { computed, watch } from 'vue'
-import { useStorage, usePreferredDark } from '@vueuse/core'
+import { ref, computed, watch } from 'vue'
+import { usePreferredDark } from '@vueuse/core'
 import {
   themeColorPresets,
   defaultThemeColor,
@@ -25,10 +25,8 @@ const DEFAULT_CONFIG: ThemeConfig = {
 }
 
 export const useThemeStore = defineStore('theme', () => {
-  // 持久化存储主题配置
-  const config = useStorage<ThemeConfig>('theme-config', DEFAULT_CONFIG, localStorage, {
-    mergeDefaults: true
-  })
+  // 主题配置 (不持久化)
+  const config = ref<ThemeConfig>({ ...DEFAULT_CONFIG })
 
   // 系统深色模式偏好
   const prefersDark = usePreferredDark()

+ 17 - 0
src/views/demo.vue

@@ -0,0 +1,17 @@
+<script setup>
+import { useI18n } from 'vue-i18n'
+
+const { t } = useI18n()
+</script>
+
+<template>
+  <div>
+    {{ t('LSS 管理') }}
+    {{ t('LiveStream 管理') }}
+    {{ t('摄像头配置') }}
+    {{ t('WebRTC 流') }}
+    {{ t('多视频监控') }}
+  </div>
+</template>
+
+<style lang="scss" scoped></style>