From 834f3cd503d8a9774223fcc9bc141ba113ac35a9 Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Fri, 2 Sep 2022 10:08:25 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=E6=BB=9A=E5=8A=A8=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../station-task-apply.component.html | 2 +- .../station-task-apply.component.ts | 11 +++++++++-- .../station-task-execution.component.html | 2 +- .../station-task-execution.component.ts | 7 ++++++- .../station-weekly-plan.component.html | 2 +- .../station-weekly-plan.component.ts | 10 ++++++++-- src/app/method.service.ts | 14 +++++++++++++- src/app/service/cache-token.service.ts | 2 +- 8 files changed, 40 insertions(+), 10 deletions(-) diff --git a/src/app/home/task/station-task-apply/station-task-apply.component.html b/src/app/home/task/station-task-apply/station-task-apply.component.html index 002d85f..f29ae54 100644 --- a/src/app/home/task/station-task-apply/station-task-apply.component.html +++ b/src/app/home/task/station-task-apply/station-task-apply.component.html @@ -11,7 +11,7 @@ diff --git a/src/app/home/task/station-task-apply/station-task-apply.component.ts b/src/app/home/task/station-task-apply/station-task-apply.component.ts index 9e562a9..0ab3679 100644 --- a/src/app/home/task/station-task-apply/station-task-apply.component.ts +++ b/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 diff --git a/src/app/home/task/station-task-execution/station-task-execution.component.html b/src/app/home/task/station-task-execution/station-task-execution.component.html index 4c81089..6808698 100644 --- a/src/app/home/task/station-task-execution/station-task-execution.component.html +++ b/src/app/home/task/station-task-execution/station-task-execution.component.html @@ -11,7 +11,7 @@ diff --git a/src/app/home/task/station-task-execution/station-task-execution.component.ts b/src/app/home/task/station-task-execution/station-task-execution.component.ts index df1272b..5d2307e 100644 --- a/src/app/home/task/station-task-execution/station-task-execution.component.ts +++ b/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 diff --git a/src/app/home/task/station-weekly-plan/station-weekly-plan.component.html b/src/app/home/task/station-weekly-plan/station-weekly-plan.component.html index 7560c8e..12f5846 100644 --- a/src/app/home/task/station-weekly-plan/station-weekly-plan.component.html +++ b/src/app/home/task/station-weekly-plan/station-weekly-plan.component.html @@ -11,7 +11,7 @@ diff --git a/src/app/home/task/station-weekly-plan/station-weekly-plan.component.ts b/src/app/home/task/station-weekly-plan/station-weekly-plan.component.ts index e254528..39d3a31 100644 --- a/src/app/home/task/station-weekly-plan/station-weekly-plan.component.ts +++ b/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 diff --git a/src/app/method.service.ts b/src/app/method.service.ts index b807d2c..2a1329c 100644 --- a/src/app/method.service.ts +++ b/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((resolve, reject) => { + this.http.get('/api/Notifications').subscribe((data: any) => { + resolve(data) + }) + }) + } + + + } diff --git a/src/app/service/cache-token.service.ts b/src/app/service/cache-token.service.ts index 195e28d..e2e7999 100644 --- a/src/app/service/cache-token.service.ts +++ b/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') }