From 253224921232ba32f77291ad23a45508ea063e86 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Tue, 9 Aug 2022 18:12:37 +0800 Subject: [PATCH] 1 --- .../pipes/integral/integral-product.pipe.ts | 19 +++++++++++++++++ src/app/pipes/integral/integral-type.pipe.ts | 21 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/app/pipes/integral/integral-product.pipe.ts create mode 100644 src/app/pipes/integral/integral-type.pipe.ts diff --git a/src/app/pipes/integral/integral-product.pipe.ts b/src/app/pipes/integral/integral-product.pipe.ts new file mode 100644 index 0000000..91a68fb --- /dev/null +++ b/src/app/pipes/integral/integral-product.pipe.ts @@ -0,0 +1,19 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'integralProduct' +}) +export class IntegralProductPipe implements PipeTransform { + + array = { + 1: ['重庆中石化' , '', '', '贵州中石化'], + 2: ['在线加油' ], + 3: ['电信' , '移动' , '联通'], + 4: ['星巴克' , '肯德基' , '会员充值'] + }; + + transform(type: number , product: number): string { + return this.array[type][product - 1]; + } + +} diff --git a/src/app/pipes/integral/integral-type.pipe.ts b/src/app/pipes/integral/integral-type.pipe.ts new file mode 100644 index 0000000..1ad396d --- /dev/null +++ b/src/app/pipes/integral/integral-type.pipe.ts @@ -0,0 +1,21 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'integralType' +}) +export class IntegralTypePipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 1: + return '卡券'; + case 2: + return '在线加油'; + case 3: + return '话费'; + case 4: + return '第三方'; + } + } + +}