From e02d6534d2dba4b8adcbb80e37cc77bf8bddd26c Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期三, 09 三月 2022 16:50:48 +0800
Subject: [PATCH] update#136137: [諮詢度表現] 顧問詳細資訊API 前端調整串接

---
 PAMapp/shared/services/my-consultant.service.ts |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/PAMapp/shared/services/my-consultant.service.ts b/PAMapp/shared/services/my-consultant.service.ts
index c27a41d..3d4dd78 100644
--- a/PAMapp/shared/services/my-consultant.service.ts
+++ b/PAMapp/shared/services/my-consultant.service.ts
@@ -1,8 +1,9 @@
+import _ from "lodash";
+
 import { http } from "./httpClient";
-
-import { AgentInfo } from '~/assets/ts/models/agent-info.model';
+import { AgentInfo } from '~/shared/models/agent-info.model';
 import { Consultant } from "../models/consultant.model";
-
+import { Appointment } from "../models/appointment.model";
 class MyConsultantService {
 
   async getFavoriteConsultantList(): Promise<Consultant[]> {
@@ -24,6 +25,28 @@
     return http.get('/consultant/detail', {params:{agentNo:agentNo}}).then((res) => res.data);
   }
 
+  // 蝘駁憿批��
+  async deleteConsultant(agentId: string) {
+    return http.delete(`/consultant/favorite/${agentId}`);
+  }
+
+  // 璅�撌脰蝯�
+  markAsContact(appointmentId: number): Promise<Appointment> {
+    return http.post(`/appointment/markAsContacted/${appointmentId}`).then(res => res.data);
+  }
+
+  // ���“�����
+  getConsultantAvatar(agentNo:string):Promise<string>{
+    return http.get(`/consultant/avatar/${agentNo}`,{ responseType : 'arraybuffer' })
+      .then( response => {
+        const toBase64 = window.btoa(
+                          _.reduce( new Uint8Array(response.data),(data,byte) =>
+                            data + String.fromCharCode(byte),'')
+                        );
+        const imgSrc = `data:image/png;base64,${toBase64}`;
+        return imgSrc;
+    });
+  }
 }
 
 export default new MyConsultantService();

--
Gitblit v1.8.0