|
|
|
@ -3,18 +3,19 @@ import { Router, NavigationEnd } from '@angular/router';
|
|
|
|
|
import { filter } from 'rxjs/operators'; |
|
|
|
|
import { NavChangeService } from '../../service/navChange.service'; |
|
|
|
|
import { CacheTokenService } from '../../service/cache-token.service' //引入服务
|
|
|
|
|
import { CookieService } from 'ngx-cookie-service'; |
|
|
|
|
|
|
|
|
|
import { NzMessageService } from 'ng-zorro-antd/message'; |
|
|
|
|
import { SignalRAspNetCoreHelper } from '../../../shared/helpers/SignalRAspNetCoreHelper'; |
|
|
|
|
import { NzNotificationService } from 'ng-zorro-antd/notification'; |
|
|
|
|
import { GetOutOfLineDetailsComponent } from '../today-warning/get-out-of-line-details/get-out-of-line-details.component'; |
|
|
|
|
import { NzModalService } from 'ng-zorro-antd/modal'; |
|
|
|
|
import { HttpClient } from '@angular/common/http'; |
|
|
|
|
import { ChangePasswordComponent } from '../change-password/change-password.component'; |
|
|
|
|
import { ChangePasswordComponent, MyValidators } from '../change-password/change-password.component'; |
|
|
|
|
import { listRefreshService } from '../../service/listRefresh.service'; |
|
|
|
|
import { DisposeequipmentComponent } from '../warning-statistics-list/disposeequipment/disposeequipment.component'; |
|
|
|
|
declare var abp: any |
|
|
|
|
import * as moment from 'moment'; |
|
|
|
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; |
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-home', |
|
|
|
|
templateUrl: './home.component.html', |
|
|
|
@ -22,8 +23,16 @@ import * as moment from 'moment';
|
|
|
|
|
}) |
|
|
|
|
export class HomeComponent implements OnInit { |
|
|
|
|
@ViewChild('warning', { static: false }) template?: TemplateRef<{}>; |
|
|
|
|
passwordValidateForm!: FormGroup; |
|
|
|
|
constructor(private listRefreshService: listRefreshService, private http: HttpClient, private router: Router, private navChangeService: NavChangeService, public token: CacheTokenService, |
|
|
|
|
private cookieService: CookieService, private message: NzMessageService, private notificationService: NzNotificationService, private modal: NzModalService, private viewContainerRef: ViewContainerRef) { } |
|
|
|
|
private message: NzMessageService, private notificationService: NzNotificationService, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private fb: FormBuilder) { |
|
|
|
|
const { password } = MyValidators; |
|
|
|
|
this.passwordValidateForm = this.fb.group({ |
|
|
|
|
oldpassword: [null, [Validators.required]], |
|
|
|
|
newpassword: [null, [Validators.required, password]], |
|
|
|
|
affirmpassword: [null, [Validators.required, password]] |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
isGasStationNav: boolean |
|
|
|
|
isGasStation: boolean |
|
|
|
@ -84,8 +93,44 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
this.userName = JSON.parse(sessionStorage.getItem('userdata')).userName |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.changePasswordPopup() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//初次登陆修改密码弹窗
|
|
|
|
|
isVisible = false |
|
|
|
|
isConfirmLoading = false |
|
|
|
|
changePasswordPopup() { |
|
|
|
|
this.isVisible = true |
|
|
|
|
} |
|
|
|
|
handleOk(): void { |
|
|
|
|
console.log(this.passwordValidateForm) |
|
|
|
|
if (this.passwordValidateForm.invalid) { |
|
|
|
|
this.message.create('warning', `输入格式不正确`); |
|
|
|
|
} else { |
|
|
|
|
if (this.passwordValidateForm.value.newpassword != this.passwordValidateForm.value.affirmpassword) { |
|
|
|
|
this.message.create('warning', '两次密码输入不一致!'); |
|
|
|
|
} else { |
|
|
|
|
this.isConfirmLoading = true; |
|
|
|
|
let body = { |
|
|
|
|
currentPassword: this.passwordValidateForm.value.oldpassword, |
|
|
|
|
newPassword: this.passwordValidateForm.value.newpassword |
|
|
|
|
} |
|
|
|
|
this.http.post('/api/services/app/User/ChangePassword', body).subscribe(data => { |
|
|
|
|
this.message.create('success', '修改成功!'); |
|
|
|
|
this.isConfirmLoading = false; |
|
|
|
|
this.isVisible = false; |
|
|
|
|
//清除sessionStorage
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, err => { |
|
|
|
|
this.message.create('warning', err.error.error.message); |
|
|
|
|
this.isConfirmLoading = false; |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reloadPage = (userNotification) => { |
|
|
|
|
console.log('abp.notifications.received收到通知', userNotification); |
|
|
|
@ -111,7 +156,6 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
this.messageId.push(obj) |
|
|
|
|
} |
|
|
|
|
isVisible = false |
|
|
|
|
|
|
|
|
|
modalData |
|
|
|
|
look(item) { |
|
|
|
@ -305,11 +349,7 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
this.message.create('success', `退出成功`); |
|
|
|
|
this.token.delete() |
|
|
|
|
sessionStorage.clear() |
|
|
|
|
// window.localStorage.clear()
|
|
|
|
|
|
|
|
|
|
localStorage.removeItem("isautologin") |
|
|
|
|
this.cookieService.set("token", '', new Date(new Date().getTime() + 1), '/'); |
|
|
|
|
this.cookieService.set("refreshToken", '', new Date(new Date().getTime() + 1), '/'); |
|
|
|
|
this.router.navigate(['/login']) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|