This commit is contained in:
Peter Maquiran
2022-06-21 16:59:28 +01:00
parent 194e6f5cce
commit 270cec688d
11 changed files with 85 additions and 55 deletions
+57 -24
View File
@@ -8,36 +8,45 @@ import { AES, enc, SHA1 } from 'crypto-js'
export class DeplomasService {
private _diplomasAssinadoList = []
private _diplomasList = []
private _diplomasReviewList = []
private _diplomasGerarList = []
private _diplomasParaAssinar = []
private keyNameDiplomasAssinado: string;
private keyNameDiplomasList: string;
private keyNameDiplomasParaAssinar: string;
private keyNameDiplomasGerar: string;
private keyNameDiplomasReview: string;
private _diplomasAssinadoListCount = 0
private _diplomasListCount = 0
private _diplomasReviewCount = 0
private _diplomasGerarListCount = 0;
private _diplomasListCount = 0;
constructor() {
constructor() {
this.keyNameDiplomasAssinado = (SHA1(this.constructor.name+"diplomasAssinado")).toString()
this.keyNameDiplomasList = (SHA1(this.constructor.name+"diplomasList")).toString()
this.keyNameDiplomasReview = (SHA1(this.constructor.name+"diplomasReview")).toString()
this.keyNameDiplomasGerar = (SHA1(this.constructor.name+"diplomasGerar")).toString()
this.keyNameDiplomasParaAssinar = (SHA1(this.constructor.name+"diplomasParaAsinar")).toString()
setTimeout(() => {
setTimeout(()=>{
let restoreDiplomasAssinado = localstoreService.get(this.keyNameDiplomasAssinado, {})
let restoreDiplomasList = localstoreService.get(this.keyNameDiplomasList, {})
let restoreDiplomasReviewList = localstoreService.get(this.keyNameDiplomasList, {})
let restoreDiplomasParaAssinar = localstoreService.get(this.keyNameDiplomasParaAssinar, {})
let restoreDiplomasReviewList = localstoreService.get(this.keyNameDiplomasReview, {})
let restoreDiplomasGerarList = localstoreService.get(this.keyNameDiplomasGerar, {})
this._diplomasAssinadoList = restoreDiplomasAssinado.list || []
this._diplomasAssinadoListCount = parseInt(restoreDiplomasAssinado.count) || 0
this._diplomasList = restoreDiplomasList.list || []
this._diplomasListCount = parseInt(restoreDiplomasList.count) || 0
this._diplomasParaAssinar = restoreDiplomasParaAssinar.list || []
this._diplomasListCount = parseInt(restoreDiplomasParaAssinar.count) || 0
this._diplomasReviewList = restoreDiplomasReviewList.list || []
this._diplomasReviewCount = parseInt(restoreDiplomasReviewList.count) || 0
this._diplomasGerarList = restoreDiplomasGerarList.list || []
this._diplomasGerarListCount = parseInt(restoreDiplomasGerarList.count) || 0
}, 10)
}
@@ -60,23 +69,30 @@ export class DeplomasService {
this.saveDiplomasAssinadoList()
}
get diplomasListCount() {
get diplomasParaAssinartCount() {
return this._diplomasListCount || 0
}
set diplomasListCount(value) {
this._diplomasListCount = value
this.saveDiplomasList()
set diplomasParaAssinarCount(value) {
this._diplomasParaAssinar = value
this.saveDiplomasParaAssinar()
}
get diplomasList() {
return this._diplomasList
// get list
get diplomasParaAssinarList() {
return this._diplomasParaAssinar
}
// get list
get diplomasAssinadoList() {
return this._diplomasAssinadoList
}
// get list
get diplomasReviewList() {
return this._diplomasReviewList
}
resetDiplomasAssinadoList(value: any[]) {
this._diplomasAssinadoListCount = value.length
@@ -84,11 +100,11 @@ export class DeplomasService {
this.saveDiplomasAssinadoList()
}
resetDiplomasList(value: any[]) {
resetDiplomasParaAssinar(value: any[]) {
this._diplomasListCount = value.length
this._diplomasList = value
this.saveDiplomasList()
this._diplomasParaAssinar = value
this.saveDiplomasParaAssinar()
}
resetDiplomasReview(value: any[]) {
@@ -97,10 +113,18 @@ export class DeplomasService {
this.saveDiplomasReviewList()
}
resetDiplomaGerar(value: any[]) {
this._diplomasGerarListCount = value.length
this._diplomasGerarList = value
this.savetDiplomaGerar()
}
private saveDiplomasReviewList () {
setTimeout(()=>{
localstoreService.set(this.keyNameDiplomasList,{
localstoreService.set(this.keyNameDiplomasReview,{
list: this._diplomasReviewList,
count: this._diplomasReviewCount,
})
@@ -117,15 +141,24 @@ export class DeplomasService {
}, 10)
}
private saveDiplomasList () {
private saveDiplomasParaAssinar () {
setTimeout(()=>{
localstoreService.set(this.keyNameDiplomasList,{
list: this._diplomasList,
localstoreService.set(this.keyNameDiplomasParaAssinar,{
list: this._diplomasParaAssinar,
count: this._diplomasListCount,
})
}, 10)
}
private savetDiplomaGerar() {
setTimeout(()=>{
localstoreService.set(this.keyNameDiplomasGerar,{
list: this._diplomasGerarList,
count: this._diplomasGerarListCount,
})
}, 10)
}
}
export let DeplomasStore = new DeplomasService()