diff --git a/src/app/reportshows/reportshow/reportshow.component.ts b/src/app/reportshows/reportshow/reportshow.component.ts index 9bdb2d5..d4c6b45 100644 --- a/src/app/reportshows/reportshow/reportshow.component.ts +++ b/src/app/reportshows/reportshow/reportshow.component.ts @@ -12,6 +12,8 @@ import { Simuser } from '../../Interface/userinfo'; import { user1 } from '../../Interface/mock-user'; import {UserInfoProfile} from '../../others-personal-center/display-container/personal-information/userinfoprofile'; import {USERINFOPROFILE} from '../../others-personal-center/display-container/personal-information/mock-userinfoprofile'; +import {ApiResult} from '../../Interface/ApiResult'; +import {HttpService} from '../../http.service'; @Component({ selector: 'app-reportshow', @@ -27,6 +29,15 @@ export class ReportshowComponent implements OnInit { selectedcomments: Socialcomments; user = USER; user1 = user1; + constructor(private http: HttpService) { } + + Initlikecolor() { + const __this = this; + const callback = function(result: ApiResult) { + __this.socialcomments = result.data; + }; + this.http.get_report_list_by_userid(1, callback); + } changecolor(): void { const Like = document.getElementById('change1'); @@ -50,7 +61,6 @@ export class ReportshowComponent implements OnInit { } } - constructor() { } ngOnInit() { diff --git a/src/app/reportshows/reportshowother/reportshowother.component.ts b/src/app/reportshows/reportshowother/reportshowother.component.ts index f88cf32..1225cc5 100644 --- a/src/app/reportshows/reportshowother/reportshowother.component.ts +++ b/src/app/reportshows/reportshowother/reportshowother.component.ts @@ -11,6 +11,8 @@ import { user1 } from '../../Interface/mock-user'; import {variable} from '@angular/compiler/src/output/output_ast'; import {isLineBreak} from 'codelyzer/angular/sourceMappingVisitor'; import {ReportshowsModule} from '../reportshows.module'; +import {HttpService} from '../../http.service'; +import {ApiResult} from '../../Interface/ApiResult'; @Component({ selector: 'app-reportshowother', @@ -27,6 +29,15 @@ export class ReportshowotherComponent implements OnInit { user = USER; user1 = user1; me = ME; + constructor(private http: HttpService) { } + + Initlikecolor() { + const __this = this; + const callback = function(result: ApiResult) { + __this.socialcomments = result.data; + }; + this.http.get_report_list_by_userid(1, callback); + } changecolor(): void { const Like = document.getElementById('change1'); @@ -34,6 +45,7 @@ export class ReportshowotherComponent implements OnInit { Like.classList.remove('anticon-like-o'); Like.classList.add('anticon-like'); Like.style.color = 'blue'; + } else if (Like.classList.contains('anticon-like')) { Like.classList.remove('anticon-like'); Like.classList.add('anticon-like-o'); @@ -50,7 +62,6 @@ export class ReportshowotherComponent implements OnInit { } } - constructor() { } ngOnInit() { }