添加zorro,alain样例
This commit is contained in:
@ -9,7 +9,6 @@ import { Injectable, Injector } from '@angular/core';
|
||||
import { Observable, zip } from 'rxjs';
|
||||
import { catchError, switchMap } from 'rxjs/operators';
|
||||
import { CoreService } from 'src/app/core/core.service';
|
||||
import { EAEncryptUtil } from '../../utils';
|
||||
import { BaseService } from '../core/base.service';
|
||||
|
||||
@Injectable({
|
||||
@ -61,7 +60,7 @@ export class EAPlatformService extends BaseService {
|
||||
getPlatformStatus(): number {
|
||||
const encryptStatus = this.coreSrv.cacheSrv.getNone<string>(this._cachePlatformStatusKey);
|
||||
try {
|
||||
const status = EAEncryptUtil.deencryptByDeAES(encryptStatus);
|
||||
// const status = EAEncryptUtil.deencryptByDeAES(encryptStatus);
|
||||
return +status;
|
||||
} catch (error) {
|
||||
return 0;
|
||||
@ -118,8 +117,8 @@ export class EAPlatformService extends BaseService {
|
||||
}
|
||||
|
||||
// 加密并保存平台状态
|
||||
const ciphertext = EAEncryptUtil.encryptByEnAES(status.toString());
|
||||
this.coreSrv.cacheSrv.set(this._cachePlatformStatusKey, ciphertext);
|
||||
// const ciphertext = EAEncryptUtil.encryptByEnAES(status.toString());
|
||||
// this.coreSrv.cacheSrv.set(this._cachePlatformStatusKey, ciphertext);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -101,7 +101,7 @@ export class EAUserService extends BaseService {
|
||||
if (res?.token) {
|
||||
this.cacheSrv.set(cacheConf.token, res.token);
|
||||
this.doAfterLogin();
|
||||
this.eventSrv.event.emit(eventConf.reflesh_login_status);
|
||||
// this.eventSrv.event.emit(eventConf.reflesh_login_status);
|
||||
this.router.navigate([this.ar.snapshot.queryParams.returnUrl || '/']);
|
||||
}
|
||||
});
|
||||
@ -117,7 +117,7 @@ export class EAUserService extends BaseService {
|
||||
if (res?.token) {
|
||||
this.tokenSrv.set({ token: res.token });
|
||||
this.doAfterLogin();
|
||||
this.eventSrv.event.emit(eventConf.reflesh_login_status, this.ar.snapshot.queryParams.returnUrl || '/');
|
||||
// this.eventSrv.event.emit(eventConf.reflesh_login_status, this.ar.snapshot.queryParams.returnUrl || '/');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -11,19 +11,19 @@ import { cacheConf } from '@conf/cache.conf';
|
||||
import { CacheService } from '@delon/cache';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { distinctUntilChanged } from 'rxjs/operators';
|
||||
|
||||
import { ICacheObj } from '../../interfaces/core/i-cache-obj';
|
||||
import { EADateUtil } from '../../utils';
|
||||
import { EAEncryptUtil } from '../../utils/encrypt.util';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class EACacheService {
|
||||
// 监听最后操作时间值变化
|
||||
private listen$ = new BehaviorSubject<number>(0);
|
||||
private listen = this.listen$.asObservable();
|
||||
constructor(private service: CacheService) {
|
||||
this.listen.pipe(distinctUntilChanged()).subscribe((res) => {
|
||||
this.listen.pipe(distinctUntilChanged()).subscribe(res => {
|
||||
this.set(cacheConf.last_operation_time, res);
|
||||
});
|
||||
}
|
||||
@ -44,11 +44,11 @@ export class EACacheService {
|
||||
pd: new Date().getTime(),
|
||||
data,
|
||||
vld,
|
||||
encrypt,
|
||||
encrypt
|
||||
};
|
||||
if (encrypt) {
|
||||
// 加密
|
||||
cahceObj.data = EAEncryptUtil.encryptByEnAES(JSON.stringify(data));
|
||||
// cahceObj.data = EAEncryptUtil.encryptByEnAES(JSON.stringify(data));
|
||||
}
|
||||
this.service.set(key, cahceObj);
|
||||
// 更新系统最后操作时间
|
||||
@ -86,10 +86,11 @@ export class EACacheService {
|
||||
|
||||
// 判断是否加密
|
||||
if (cacheObj.encrypt) {
|
||||
const encryptJson = EAEncryptUtil.deencryptByDeAES(cacheObj.data);
|
||||
// const encryptJson = EAEncryptUtil.deencryptByDeAES(cacheObj.data);
|
||||
// 更新系统最后操作时间
|
||||
this.refleshLastOperationTime();
|
||||
return JSON.parse(encryptJson);
|
||||
// return JSON.parse(encryptJson);
|
||||
return;
|
||||
}
|
||||
|
||||
// 更新系统最后操作时间
|
||||
|
||||
@ -12,8 +12,6 @@ import * as EventEmitter from 'eventemitter3';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class EAEventService {
|
||||
event: EventEmitter;
|
||||
constructor() {
|
||||
this.event = new EventEmitter();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user