From 75fd8a02c058f6a51e3c5ea36d997c157c070793 Mon Sep 17 00:00:00 2001
From: wayne <wayne8692wayne8692@gmail.com>
Date: 星期三, 24 十一月 2021 16:02:32 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 PAMapp/assets/ts/api/consultant.ts |   67 +++++++++++++++++++++++++++------
 1 files changed, 55 insertions(+), 12 deletions(-)

diff --git a/PAMapp/assets/ts/api/consultant.ts b/PAMapp/assets/ts/api/consultant.ts
index ff47e80..382a492 100644
--- a/PAMapp/assets/ts/api/consultant.ts
+++ b/PAMapp/assets/ts/api/consultant.ts
@@ -1,10 +1,26 @@
 import { service } from '~/assets/ts/api/share';
 import { AxiosResponse } from 'axios';
 import { AppointmentDetail } from '../models/AppointmentDetail';
+import { ConsultantLoginInfo } from '../models/ConsultantLoginInfo';
 
 // 憿批恥��(TODO: OTP隤����� ���蝙�)
 export function login(user: any) {
     return service.post('/authenticate', user)
+}
+
+// 憿批恥��-��TP
+export function sendOtp(loginInfo: LoginRequest) {
+    return service.post<OtpInfo>('/otp/sendOtp', loginInfo).then(res => res.data)
+}
+
+// 憿批恥��-撽�tp銝衣�
+export function loginVerify(loginVerify: LoginVerify) {
+    return service.post('/otp/verify', loginVerify)
+}
+
+// 憿批恥閮餃��
+export function register(registerInfo: RegisterInfo) {
+    return service.post('/otp/register', registerInfo)
 }
 
 // ��靽憿批��
@@ -76,13 +92,8 @@
 }
 
 // 憿批��
-export function logInToConsultant(consultantDto:ConsultantLoginInfo):Promise<boolean>{
-    console.log('consultantDto',consultantDto);
-    return new Promise((resolve, reject)=>{
-        setTimeout(()=>{
-            resolve(true);
-        },1000)
-    })
+export function logInToConsultant(consultantDto:ConsultantLoginInfo):Promise<AxiosResponse<RequestOfLoginSuccess>>{
+    return service.post('/eService/authenticate',consultantDto);
 }
 
 // �����蝝啁�
@@ -91,11 +102,6 @@
         Authorization: 'Bearer ' + localStorage.getItem('id_token')
     }
     return service.get('/appointment/getDetail/'+apointmentId, {headers})
-}
-export interface ConsultantLoginInfo{
-    account:string,
-    password:string,
-    verificationCode:string,
 }
 export interface Consultants {
     agentNo: string,
@@ -163,4 +169,41 @@
     seniority:     string;
     new:           boolean;
 }
+export interface RequestOfLoginSuccess{
+    id_token:string;
+}
 
+export interface LoginRequest {
+    /** "SMS"=�����"EMAIL"=email */
+    loginType: string,
+    /** �loginType憛俟MS��府甈葆�����MAIL��葆��隞嗡縑蝞� */
+    account: string,
+}
+
+export interface OtpInfo {
+    /** ��撣嗅otp隤��� */
+    indexKey: string,
+    /** Otp�������� */
+    success: boolean,
+    failCode: string,
+    failReason: string,
+}
+
+export interface LoginVerify {
+    /** �撣嗅����mail */
+    account: string,
+    /** �otp��pi���ndex key */
+    indexKey: string,
+    /** �����縑蝞望�����Ⅳ */
+    otpCode: string
+}
+
+export interface RegisterInfo {
+    phone?: string,
+    email?: string,
+    indexKey: string,
+    otpCode: string,
+    name: string,
+    /** "SMS"嚗tp������"EMAIL":Otp�email */
+    contactType: string
+}
\ No newline at end of file

--
Gitblit v1.8.0