import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {ConfigService} from '../../service/config.service';

@Component({
  selector: 'app-share',
  templateUrl: './share.component.html',
  styleUrls: ['./share.component.less']
})
export class ShareComponent implements OnInit {
  params: { participantId: string; campaignId: string; reqChannel: number } | undefined = undefined;

  constructor(
    private activatedRoute: ActivatedRoute,
    public config: ConfigService
  ) {
  }

  ngOnInit(): void {
    document.body.style.background = '#FFFFFF';
    // url获取参数
    this.activatedRoute.queryParams.subscribe(res => {
      if (res) {
        if (res.participantId && res.campaignId && res.reqChannel) {
          // participantId 邀请人id；campaignId 活动id  ; reqChannel：渠道 int
          this.params = {
            participantId: res.participantId,
            campaignId: res.campaignId,
            reqChannel: Number(res.reqChannel),
          };
        }
      }
    });
  }
}
