| | |
| | | } |
| | | |
| | | declare const uni = Taro |
| | | |
| | | |
New file |
| | |
| | | declare module '@life-payment/components' { |
| | | interface RequestConfig extends GlobalType.RequestConfig { |
| | | showNavigationBarLoading?: boolean; |
| | | showLoading?: boolean; |
| | | mock?: boolean; |
| | | customErrorHandler?: (error: any) => boolean; |
| | | } |
| | | } |
| | | |
| | | export {} |
| | |
| | | export * from './lifeRecharge'; |
| | | export * from './plugin'; |
| | | export * from './lifeRechargeServices'; |
| | | export * from './types'; |
| | |
| | | import { BlLifeRechargeServices } from './lifeRechargeServices'; |
| | | import { BlLifeRechargeServices, PhoneMesssageCodeLoginInput } from './lifeRechargeServices'; |
| | | import { IRequest, BlLifeRechargeOptions } from './types'; |
| | | |
| | | export class BlLifeRecharge<T extends IRequest> { |
| | | export class BlLifeRecharge<T extends IRequest = IRequest> { |
| | | services: BlLifeRechargeServices<T>; |
| | | isLogin = false; |
| | | |
| | | constructor(options: BlLifeRechargeOptions<T>) { |
| | | this.services = new BlLifeRechargeServices(options); |
| | | } |
| | | |
| | | login(body: PhoneMesssageCodeLoginInput) { |
| | | let res = this.services.lifePayPhoneMesssageCodeLogin(body); |
| | | this.isLogin = true; |
| | | return res; |
| | | } |
| | | |
| | | getRechargeParValue(amount: number, rate: number) { |
| | | return (amount * rate).toFixed(2); |
| | | } |
| | |
| | | import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'; |
| | | import { IRequest, BlLifeRechargeServicesOptions } from './types'; |
| | | |
| | | export interface PhoneMesssageCodeLoginInput { |
| | | /** 手机号 */ |
| | | phoneNumber: string; |
| | | /** 验证码 */ |
| | | code: string; |
| | | } |
| | | |
| | | export interface RequestConfig {} |
| | | |
| | | export class BlLifeRechargeServices<T extends IRequest> { |
| | | request: T; |
| | | private request: T; |
| | | constructor({ request }: BlLifeRechargeServicesOptions<T>) { |
| | | this.request = request; |
| | | } |
| | | |
| | | private async lifePayPhoneMesssageCodeLogin( |
| | | body: PhoneMesssageCodeLoginInput, |
| | | options?: RequestConfig |
| | | ) { |
| | | return this.request<string>('/api/Account/LifePayPhoneMesssageCodeLogin', { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | | }, |
| | | data: body, |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | a() {} |
| | | } |