import { Component, OnInit } from '@angular/core'; import {PublicService} from '../../PublicService'; import {Constants} from '../../Constant'; import {NavController} from '@ionic/angular'; @Component({ selector: 'app-security-center', templateUrl: './security-center.page.html', styleUrls: ['./security-center.page.scss'], }) export class SecurityCenterPage implements OnInit { private user = this.publicService.getCurrentUser(); private userConfig = this.user.userConfig; private openStyle = this.userConfig.defUnlocking; constructor(private readonly navController: NavController, private readonly publicService: PublicService) { } ngOnInit() { console.log(this.openStyle); } openStyleChange(){ this.userConfig.defUnlocking = this.openStyle; this.publicService.updateUserConfig(this.userConfig).then(res => { if (res.code === Constants.SUCCESS){ this.publicService.setCurrentUser(this.user); }else{ this.publicService.presentToast(res.msg); } }, err => { this.publicService.checkNetworkToast(err); }); } back(){ this.navController.back(); } }