11<script setup lang="ts">
22import {
3- Document ,
4- Menu as IconMenu ,
5- Histogram ,
6- Location ,
7- Share ,
8- ArrowDown ,
9- Guide ,
10- DataAnalysis
3+ Document ,
4+ Menu as IconMenu ,
5+ Histogram ,
6+ Location ,
7+ Share ,
8+ ArrowDown ,
9+ Guide ,
10+ DataAnalysis , Help , Setting
1111} from ' @element-plus/icons-vue'
1212import { ref , watch } from ' vue'
1313import { API } from ' ./views/net'
@@ -23,8 +23,9 @@ import { useI18n } from 'vue-i18n'
2323
2424const { t, locale : i18nLocale } = useI18n ()
2525
26- import setAsDarkTheme from ' ./theme'
26+ import { setAsDarkTheme , getThemes , setTheme , getTheme } from ' ./theme'
2727
28+ const allThemes = ref (getThemes ())
2829const asDarkMode = ref (Cache .GetPreference ().darkTheme )
2930setAsDarkTheme (asDarkMode .value )
3031watch (asDarkMode , Cache .WithDarkTheme )
@@ -87,6 +88,16 @@ const toHistoryPanel = ({ ID: selectID, panelName: historyPanelName }) => {
8788 panelName .value = historyPanelName ;
8889}
8990
91+ const settingDialogVisible = ref (false )
92+ watch (settingDialogVisible , (v : boolean ) => {
93+ if (v ) {
94+ allThemes .value = getThemes ()
95+ }
96+ })
97+ const theme = ref (getTheme ())
98+ watch (theme , (e ) => {
99+ setTheme (e )
100+ })
90101 </script >
91102
92103<template >
@@ -137,18 +148,7 @@ const toHistoryPanel = ({ ID: selectID, panelName: historyPanelName }) => {
137148 <el-main style =" padding-top : 0px ;" >
138149 <div class =" top-menu" >
139150 <el-col style =" display : flex ; align-items : center ;" >
140- <el-tag style =" font-size : 18px ;" >{{ t('language') }}</el-tag >
141- <el-dropdown trigger =" click" @command =" (command: string) => handleChangeLan(command)" >
142- <el-icon ><arrow-down /></el-icon >
143- <template #dropdown >
144- <el-dropdown-menu >
145- <el-dropdown-item command =" chinese" >中文</el-dropdown-item >
146- <el-dropdown-item command =" english" >English</el-dropdown-item >
147- </el-dropdown-menu >
148- </template >
149- </el-dropdown >
150-
151- <el-switch type =" primary" data-intro =" Switch light and dark modes" v-model =" asDarkMode" />
151+ <el-icon @click =" settingDialogVisible=true" size =" 20" ><Setting /></el-icon >
152152 </el-col >
153153 </div >
154154 <TestingPanel v-if =" panelName === 'testing'" @toHistoryPanel =" toHistoryPanel" />
@@ -164,6 +164,55 @@ const toHistoryPanel = ({ ID: selectID, panelName: historyPanelName }) => {
164164 <a :href =appVersionLink target =" _blank" rel =" noopener" >{{appVersion}}</a >
165165 </div >
166166 </el-container >
167+
168+ <el-dialog v-model =" settingDialogVisible" :title =" t('title.setting' )" width =" 50%" draggable destroy-on-close >
169+ <el-row >
170+ <el-col :span =" 4" >
171+ Theme:
172+ </el-col >
173+ <el-col :span =" 18" >
174+ <el-select v-model =" theme" placeholder =" Select a theme" >
175+ <el-option
176+ v-for =" item in allThemes"
177+ :key =" item"
178+ :label =" item"
179+ :value =" item"
180+ />
181+ </el-select >
182+ <el-icon >
183+ <el-link href =" https://github.com/LinuxSuRen/atest-ext-data-swagger/tree/master/data/theme" target =" _blank" >
184+ <Help />
185+ </el-link >
186+ </el-icon >
187+ </el-col >
188+ </el-row >
189+
190+ <el-row >
191+ <el-col :span =" 4" >
192+ Language:
193+ </el-col >
194+ <el-col :span =" 18" >
195+ <el-tag style =" font-size : 18px ;" >{{ t('language') }}</el-tag >
196+ <el-dropdown trigger =" click" @command =" (command: string) => handleChangeLan(command)" >
197+ <el-icon ><arrow-down /></el-icon >
198+ <template #dropdown >
199+ <el-dropdown-menu >
200+ <el-dropdown-item command =" chinese" >中文</el-dropdown-item >
201+ <el-dropdown-item command =" english" >English</el-dropdown-item >
202+ </el-dropdown-menu >
203+ </template >
204+ </el-dropdown >
205+ </el-col >
206+ </el-row >
207+ <el-row >
208+ <el-col :span =" 4" >
209+ Dark Mode:
210+ </el-col >
211+ <el-col :span =" 18" >
212+ <el-switch type =" primary" data-intro =" Switch light and dark modes" v-model =" asDarkMode" />
213+ </el-col >
214+ </el-row >
215+ </el-dialog >
167216</template >
168217
169218<style >
0 commit comments