mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
fixe theme changing
This commit is contained in:
@@ -92,11 +92,6 @@ export class AppComponent {
|
||||
}
|
||||
})
|
||||
|
||||
this.storageservice.get('theme').then((theme) =>{
|
||||
console.log('THEME: ', theme)
|
||||
this.ThemeService.setTheme(theme)
|
||||
})
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export class EditProfilePage implements OnInit {
|
||||
constructor(private modalController:ModalController,
|
||||
private animationController: AnimationController,
|
||||
public platform: Platform,
|
||||
private backgroundservice: BackgroundService,
|
||||
private BackgroundService: BackgroundService,
|
||||
public ThemeService: ThemeService
|
||||
) {}
|
||||
|
||||
@@ -118,6 +118,7 @@ export class EditProfilePage implements OnInit {
|
||||
|
||||
changeTheme(name) {
|
||||
this.ThemeService.setTheme(name)
|
||||
this.BackgroundService.paint();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,10 +59,7 @@ export class LoginPage implements OnInit {
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.storageservice.get('theme').then((theme) =>{
|
||||
|
||||
this.ThemeService.setTheme(theme)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
togglePassword() {
|
||||
|
||||
@@ -19,8 +19,18 @@ export class BackgroundService {
|
||||
) { }
|
||||
|
||||
online() {
|
||||
if (this.themeservice.currentTheme == 'gov') {
|
||||
|
||||
this.paint()
|
||||
|
||||
this.callBacks.forEach((e) => {
|
||||
if (e.type == 'Online') {
|
||||
e.funx()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
paint() {
|
||||
if (this.themeservice.currentTheme == 'gov') {
|
||||
document.body.style.setProperty(`--color`, "#d9d9d9");
|
||||
document.body.style.setProperty(`--color2`, "#f0f0f0");
|
||||
document.body.style.setProperty(`--color3`, "#d9d9d9");
|
||||
@@ -36,12 +46,6 @@ export class BackgroundService {
|
||||
document.body.style.setProperty(`--color5`, "#45BAFF");
|
||||
this.storageservice.store('networkCheckStore','online');
|
||||
}
|
||||
|
||||
this.callBacks.forEach((e) => {
|
||||
if (e.type == 'Online') {
|
||||
e.funx()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
offline() {
|
||||
@@ -67,54 +71,4 @@ export class BackgroundService {
|
||||
}
|
||||
|
||||
|
||||
greyTheme() {
|
||||
document.body.style.setProperty(`--color`, "#D9D9D9");
|
||||
document.body.style.setProperty(`--color2`, "#f0f0f0");
|
||||
document.body.style.setProperty(`--color3`, "#D9D9D9");
|
||||
document.body.style.setProperty(`--color4`, "#d9d9d9ee");
|
||||
document.body.style.setProperty(`--color5`, "#ececec");
|
||||
|
||||
document.body.style.setProperty(`--header-container-background`, "#fff");
|
||||
document.body.style.setProperty(`--headercolor`, "#000");
|
||||
|
||||
document.body.style.setProperty(`--login-background`, "linear-gradient(180deg, #c63527 60%, #000 100%) !important");
|
||||
document.body.style.setProperty(`--button-hover`, "#ffb81c");
|
||||
document.body.style.setProperty(`--inicio-open-page-from-box`, "#c63527");
|
||||
document.body.style.setProperty(`--header-tab-top-border`, "#000");
|
||||
document.body.style.setProperty(`--header-tab-text-white`, "rgb(0, 0, 0)");
|
||||
document.body.style.setProperty(`--header-tab-text-white`, "rgb(0, 0, 0)");
|
||||
|
||||
document.body.style.setProperty(`--header-bottom-line-background`, "rgb(255, 0, 0)");
|
||||
document.body.style.setProperty(`--header-bottom-line-background-image`, "linear-gradient(to right, #C63527, #FFB81C, #FFC72C)");
|
||||
}
|
||||
|
||||
blueTheme() {
|
||||
|
||||
document.body.style.setProperty(`--color`, "#0782C9");
|
||||
document.body.style.setProperty(`--color2`, "#45BAFF");
|
||||
document.body.style.setProperty(`--color3`, "#0782C9");
|
||||
document.body.style.setProperty(`--color4`, "#0782c9f0");
|
||||
document.body.style.setProperty(`--color5`, "#f7f5f2");
|
||||
|
||||
document.body.style.setProperty(`--header-container-background`, "linear-gradient(270deg, var(--color2) 0%, var(--color3) 23.44%, var(--color4) 78.13%, var(--color5) 100%) !important");
|
||||
document.body.style.setProperty(`--headercolor`, "#000");
|
||||
|
||||
document.body.style.setProperty(`--header-bottom-line-background`, "linear-gradient(270deg, var(--color2) 0%, var(--color3) 23.44%, var(--color4) 78.13%, var(--color5) 100%) !important");
|
||||
document.body.style.setProperty(`--header-bottom-line-background-image`, "linear-gradient(270deg, var(--color2) 0%, var(--color3) 23.44%, var(--color4) 78.13%, var(--color5) 100%) !important");
|
||||
|
||||
document.body.style.setProperty(`--login-background`, "linear-gradient(180deg, #42b9fe 0%, #0782c9 100%) !importantt");
|
||||
document.body.style.setProperty(`--button-hover`, "#42b9fe");
|
||||
document.body.style.setProperty(`--inicio-open-page-from-box`, "#42b9fe");
|
||||
document.body.style.setProperty(`--header-tab-top-border`, "white");
|
||||
document.body.style.setProperty(`--header-tab-text-white`, "white");
|
||||
|
||||
}
|
||||
|
||||
default() {
|
||||
document.body.style.setProperty(`--color`, "#0782C9");
|
||||
document.body.style.setProperty(`--color2`, "#45BAFF");
|
||||
document.body.style.setProperty(`--color3`, "#0782C9");
|
||||
document.body.style.setProperty(`--color4`, "#0782c9f0");
|
||||
document.body.style.setProperty(`--color5`, "#45BAFF");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { StorageService } from 'src/app/services/storage.service';
|
||||
|
||||
import { localstoreService } from '../store/localstore.service';
|
||||
import { AES, enc, SHA1 } from 'crypto-js'
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -12,20 +13,39 @@ export class ThemeService {
|
||||
'tribunal'
|
||||
]
|
||||
|
||||
currentTheme = 'gov'
|
||||
currentTheme: 'gov' | 'default' | 'tribunal' = 'gov'
|
||||
keyName: string
|
||||
|
||||
constructor(private storageservice: StorageService) { }
|
||||
constructor(
|
||||
private storageservice: StorageService
|
||||
) {
|
||||
|
||||
this.keyName = (SHA1(this.constructor.name)).toString()
|
||||
let restore = localstoreService.get(this.keyName, {
|
||||
theme: "gov"
|
||||
})
|
||||
|
||||
this.setTheme(restore.theme)
|
||||
|
||||
}
|
||||
|
||||
setTheme(theme: 'gov' | 'default' | 'tribunal') {
|
||||
|
||||
document.body.classList.remove("gov");
|
||||
document.body.classList.remove("default");
|
||||
document.body.classList.remove("tribunal");
|
||||
document.body.classList.add(theme);
|
||||
this.currentTheme = theme
|
||||
|
||||
this.storageservice.store('theme',theme);
|
||||
document.body.classList.add(theme);
|
||||
this.currentTheme = theme;
|
||||
|
||||
localstoreService.set(this.keyName, {
|
||||
theme: theme
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
saveTheme() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user