import { Mobile, UserName } from '../../passport/util/loginType'; export abstract class VerifyInfo { protected _verifyCode: string; protected constructor(code: string) {this._verifyCode = code; } } // 将 验证代码 封装为 密码 export class Password extends VerifyInfo { constructor(password: string) { super(password); } get password(): string { return this._verifyCode; } set password(value: string) { this._verifyCode = value; } } // 将 验证代码 封装为 短信 export class SMS extends VerifyInfo { constructor(str: string) { super(str); } get sms(): string { return this._verifyCode; } set sms(value: string) { this._verifyCode = value; } } export class VerifyInfoFactory { public static CreatePassward(str: string) { return new Password(str); } public static CreateSMS(str: string) { return new SMS(str); } }