Browse Source

[新增]滚动消息提示

非煤矿山灾害智能感知和预警系统
邵佳豪 3 years ago
parent
commit
834f3cd503
  1. 2
      src/app/home/task/station-task-apply/station-task-apply.component.html
  2. 11
      src/app/home/task/station-task-apply/station-task-apply.component.ts
  3. 2
      src/app/home/task/station-task-execution/station-task-execution.component.html
  4. 7
      src/app/home/task/station-task-execution/station-task-execution.component.ts
  5. 2
      src/app/home/task/station-weekly-plan/station-weekly-plan.component.html
  6. 10
      src/app/home/task/station-weekly-plan/station-weekly-plan.component.ts
  7. 14
      src/app/method.service.ts
  8. 2
      src/app/service/cache-token.service.ts

2
src/app/home/task/station-task-apply/station-task-apply.component.html

@ -11,7 +11,7 @@
<ul class="notice-list" id="notice-list">
<li class="info" *ngFor="let item of messageList;let key = index">
<div class="infoitem">
您有一条新的信息!
{{item.content}}
</div>
</li>
</ul>

11
src/app/home/task/station-task-apply/station-task-apply.component.ts

@ -8,6 +8,7 @@ import { TreeService } from 'src/app/service/tree.service';
import { ApplyComponent } from './apply/apply.component';
import { ApplyLookComponent } from './apply-look/apply-look.component';
import { ThisReceiver } from '@angular/compiler';
import { MethodService } from 'src/app/method.service';
@Component({
@ -18,7 +19,7 @@ import { ThisReceiver } from '@angular/compiler';
export class StationTaskApplyComponent implements OnInit {
validateForm!: FormGroup;
constructor(private fb: FormBuilder, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService, private http: HttpClient, private toTree: TreeService) { }
constructor(private fb: FormBuilder, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService, private http: HttpClient, private toTree: TreeService, private methodService: MethodService) { }
searchForm = {
taskname: '',
unitname: '',
@ -199,6 +200,7 @@ export class StationTaskApplyComponent implements OnInit {
return p
}
messageList = []
userId
ngOnInit(): void {
this.OrganizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId
@ -229,9 +231,14 @@ export class StationTaskApplyComponent implements OnInit {
//获得主协调查人员
this.getSupervisortype('main')
this.getSupervisortype('assisted')
//滚动消息
this.methodService.getNotifications().then((data: any) => {
this.messageList = data
})
}
messageList = [1, 1, 1, 1, 1]
timer
rollStart() {
var ROLL_SPEED = 100

2
src/app/home/task/station-task-execution/station-task-execution.component.html

@ -11,7 +11,7 @@
<ul class="notice-list" id="notice-list">
<li class="info" *ngFor="let item of messageList;let key = index">
<div class="infoitem">
您有一条新的信息!
{{item.content}}
</div>
</li>
</ul>

7
src/app/home/task/station-task-execution/station-task-execution.component.ts

@ -225,9 +225,14 @@ export class StationTaskExecutionComponent implements OnInit {
console.log(666, res)
this.time1 = res.day + '天' + res.hour + '小时'
})
//滚动消息
this.methodService.getNotifications().then((data: any) => {
this.messageList = data
})
}
messageList = [1, 1, 1, 1, 1]
messageList = []
timer
rollStart() {
var ROLL_SPEED = 100

2
src/app/home/task/station-weekly-plan/station-weekly-plan.component.html

@ -11,7 +11,7 @@
<ul class="notice-list" id="notice-list">
<li class="info" *ngFor="let item of messageList;let key = index">
<div class="infoitem">
您有一条新的信息!
{{item.content}}
</div>
</li>
</ul>

10
src/app/home/task/station-weekly-plan/station-weekly-plan.component.ts

@ -10,6 +10,7 @@ import { TaskDetailsComponent } from './task-details/task-details.component';
import { CreateTaskComponent } from './create-task/create-task.component';
import { differenceInCalendarDays, setHours } from 'date-fns'
import { PlanAdjustmentComponent } from '../da-oneself-plan/plan-adjustment/plan-adjustment.component';
import { MethodService } from 'src/app/method.service';
@Component({
selector: 'app-station-weekly-plan',
templateUrl: './station-weekly-plan.component.html',
@ -17,7 +18,7 @@ import { PlanAdjustmentComponent } from '../da-oneself-plan/plan-adjustment/plan
})
export class StationWeeklyPlanComponent implements OnInit {
constructor(private http: HttpClient, private modal: NzModalService, private message: NzMessageService, private viewContainerRef: ViewContainerRef) { }
constructor(private http: HttpClient, private modal: NzModalService, private message: NzMessageService, private viewContainerRef: ViewContainerRef, private methodService: MethodService) { }
OrganizationId
userId
isSupervisor
@ -381,8 +382,13 @@ export class StationWeeklyPlanComponent implements OnInit {
this.rollStart()
}, 0);
//滚动消息
this.methodService.getNotifications().then((data: any) => {
this.messageList = data
})
}
messageList = [1, 1, 1, 1, 1]
messageList = []
timer
rollStart() {
var ROLL_SPEED = 100

14
src/app/method.service.ts

@ -1,3 +1,4 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
@Injectable({
@ -5,7 +6,7 @@ import { Injectable } from '@angular/core';
})
export class MethodService {
constructor() { }
constructor(private http: HttpClient) { }
/***
@param {number} nowtime
@ -43,5 +44,16 @@ export class MethodService {
clearTimeout(this.timer);
}
//获得播报消息
async getNotifications() {
return new Promise<void>((resolve, reject) => {
this.http.get('/api/Notifications').subscribe((data: any) => {
resolve(data)
})
})
}
}

2
src/app/service/cache-token.service.ts

@ -24,7 +24,7 @@ export class CacheTokenService {
// sessionStorage.setItem("token", data.token);
// sessionStorage.setItem("refreshToken", data.refreshToken);
})
}, 60 * 3 * 1000)
}, 60 * 1000)
console.log('启动定时刷新token')
}

Loading…
Cancel
Save