@@ -2,9 +2,8 @@ import { defineStore } from 'pinia'
22import { store } from '@/stores/index'
33// import { defaultFont, list } from '@/api/font'
44import { request } from '@/utils/request'
5- import colorFunctions from 'less/lib/less/functions/color.js'
6- import colorTree from 'less/lib/less/tree/color.js'
7- import { setTitle } from '@/utils/utils'
5+
6+ import { setTitle , setCurrentColor } from '@/utils/utils'
87
98const basePath = import . meta. env . VITE_API_BASE_URL
109const baseUrl = basePath + '/system/appearance/picture/'
@@ -32,7 +31,6 @@ interface AppearanceState {
3231 loaded : boolean
3332 showDemoTips ?: boolean
3433 demoTipsContent ?: string
35- community : boolean
3634 fontList ?: Array < { name : string ; id : string ; isDefault : boolean } >
3735}
3836
@@ -65,7 +63,6 @@ export const useAppearanceStore = defineStore('appearanceStore', {
6563 loaded : false ,
6664 showDemoTips : false ,
6765 demoTipsContent : '' ,
68- community : true ,
6966 fontList : [ ] ,
7067 }
7168 } ,
@@ -142,9 +139,6 @@ export const useAppearanceStore = defineStore('appearanceStore', {
142139 getDemoTipsContent ( ) : string {
143140 return this . demoTipsContent !
144141 } ,
145- getCommunity ( ) : boolean {
146- return this . community
147- } ,
148142 getShowAi ( ) : boolean {
149143 return isBtnShow ( this . showAi ! )
150144 } ,
@@ -208,7 +202,7 @@ export const useAppearanceStore = defineStore('appearanceStore', {
208202 setLoaded ( data : boolean ) {
209203 this . loaded = data
210204 } ,
211- async setAppearance ( isDataEaseBi ?: boolean ) {
205+ async setAppearance ( ) {
212206 // const desktop = wsCache.get('app.desktop')
213207 // if (desktop) {
214208 // this.loaded = true
@@ -252,43 +246,28 @@ export const useAppearanceStore = defineStore('appearanceStore', {
252246 // document.title = ''
253247 // }
254248 const obj = LicenseGenerator . getLicense ( )
255- if ( obj ?. status !== 'valid' ) return
249+ if ( obj ?. status !== 'valid' ) {
250+ setCurrentColor ( '#1CBA90' )
251+ document . title = 'SQLBot'
252+ setLinkIcon ( )
253+ return
254+ }
256255 const resData = await request . get ( '/system/appearance' )
257256 this . loaded = true
258257 if ( ! resData ?. length ) {
259- if ( ! isDataEaseBi ) {
260- document . title = 'SQLBot'
261- setLinkIcon ( )
262- }
263258 return
264259 }
265- const data : AppearanceState = { loaded : false , community : true }
266- let isCommunity = false
260+ const data : AppearanceState = { loaded : false }
267261 resData . forEach ( ( item : KeyValue ) => {
268262 ; (
269263 data as {
270264 [ key : string ] : any
271265 }
272266 ) [ item . pkey ] = item . pval
273- if ( item . pkey === 'community' ) {
274- isCommunity = true
275- }
276267 } )
277- data . community = isCommunity
278- this . community = data . community
279- if ( this . community ) {
280- this . showDemoTips = data . showDemoTips
281- this . demoTipsContent = data . demoTipsContent
282- this . loaded = true
283- setLinkIcon ( )
284- return
285- }
268+
286269 this . navigate = data . navigate
287- this . mobileLogin = data . mobileLogin
288- this . mobileLoginBg = data . mobileLoginBg
289270 this . help = data . help
290- this . showAi = data . showAi
291- this . showCopilot = data . showCopilot
292271 this . showDoc = data . showDoc
293272 this . showAbout = data . showAbout
294273 this . navigateBg = data . navigateBg
@@ -300,53 +279,12 @@ export const useAppearanceStore = defineStore('appearanceStore', {
300279 : this . isBlue
301280 ? '#3370ff'
302281 : '#1CBA90'
303- document . documentElement . style . setProperty ( '--ed-color-primary' , currentColor )
304- document . documentElement . style . setProperty ( '--van-blue' , currentColor )
305- document . documentElement . style . setProperty (
306- '--ed-color-primary-light-5' ,
307- colorFunctions
308- . mix ( new colorTree ( 'ffffff' ) , new colorTree ( currentColor . substr ( 1 ) ) , { value : 40 } )
309- . toRGB ( )
310- )
311- document . documentElement . style . setProperty (
312- '--ed-color-primary-light-3' ,
313- colorFunctions
314- . mix ( new colorTree ( 'ffffff' ) , new colorTree ( currentColor . substr ( 1 ) ) , { value : 15 } )
315- . toRGB ( )
316- )
317-
318- document . documentElement . style . setProperty (
319- '--ed-color-primary-60' ,
320- colorFunctions
321- . mix ( new colorTree ( 'ffffff' ) , new colorTree ( currentColor . substr ( 1 ) ) , { value : 60 } )
322- . toRGB ( )
323- )
324-
325- document . documentElement . style . setProperty (
326- '--ed-color-primary-80' ,
327- colorFunctions
328- . mix ( new colorTree ( 'ffffff' ) , new colorTree ( currentColor . substr ( 1 ) ) , { value : 80 } )
329- . toRGB ( )
330- )
331- document . documentElement . style . setProperty ( '--ed-color-primary-1a' , `${ currentColor } 1a` )
332- document . documentElement . style . setProperty ( '--ed-color-primary-14' , `${ currentColor } 14` )
333- document . documentElement . style . setProperty ( '--ed-color-primary-33' , `${ currentColor } 33` )
334- document . documentElement . style . setProperty ( '--ed-color-primary-99' , `${ currentColor } 99` )
335- document . documentElement . style . setProperty (
336- '--ed-color-primary-dark-2' ,
337- colorFunctions
338- . mix ( new colorTree ( '000000' ) , new colorTree ( currentColor . substr ( 1 ) ) , { value : 15 } )
339- . toRGB ( )
340- )
341-
282+ setCurrentColor ( currentColor )
342283 this . bg = data . bg
343284 this . login = data . login
344285 this . slogan = data . slogan
345286 this . web = data . web
346287 this . name = data . name
347- this . foot = data . foot
348- this . footContent = data . footContent
349- if ( isDataEaseBi ) return
350288 if ( this . name ) {
351289 document . title = this . name
352290 setTitle ( this . name )
0 commit comments