From 6113447582a1be54184b490e534c6a7af5fe498f Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Tue, 31 May 2022 16:40:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E8=87=AA=E5=BB=BA=E7=AB=99?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=88=B0=E8=AF=9D=E8=B4=B9=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pipes/recharge-price/price-status.pipe.ts | 19 +++++++++++++++ .../recharge-price/recharge-platform.pipe.ts | 23 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/app/pipes/recharge-price/price-status.pipe.ts create mode 100644 src/app/pipes/recharge-price/recharge-platform.pipe.ts diff --git a/src/app/pipes/recharge-price/price-status.pipe.ts b/src/app/pipes/recharge-price/price-status.pipe.ts new file mode 100644 index 0000000..e110c73 --- /dev/null +++ b/src/app/pipes/recharge-price/price-status.pipe.ts @@ -0,0 +1,19 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'priceStatus' +}) +export class PriceStatusPipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 1: + return '上线中'; + case 2: + return '已售空'; + case 3: + return '编辑中'; + } + } + +} diff --git a/src/app/pipes/recharge-price/recharge-platform.pipe.ts b/src/app/pipes/recharge-price/recharge-platform.pipe.ts new file mode 100644 index 0000000..5897009 --- /dev/null +++ b/src/app/pipes/recharge-price/recharge-platform.pipe.ts @@ -0,0 +1,23 @@ +import {Pipe, PipeTransform} from '@angular/core'; + +@Pipe({ + name: 'rechargePlatform' +}) +export class RechargePlatformPipe implements PipeTransform { + + transform(value: string): unknown { + const array = value.split('-'); + let string = ''; + for (const i of array) { + if (Number(i) === 1) { + string = string + '尖椒,'; + } + if (Number(i) === 2) { + string = string + '龙阅,'; + } + + } + return string.substring(0 , string.length - 1); + } + +}