保誠-保戶業務員媒合平台
Benson
2021-12-30 0d13a8e22cfd29bcb4360f2f5d6ed0c2e38e1052
PAMapp/shared/services/my-consultant.service.ts
@@ -1,8 +1,7 @@
import { http } from "./httpClient";
import { AgentInfo } from '~/shared/models/agent-info.model';
import { Consultant } from "../models/consultant.model";
import _ from "lodash";
class MyConsultantService {
  async getFavoriteConsultantList(): Promise<Consultant[]> {
@@ -37,6 +36,18 @@
    return http.post(`/appointment/markAsContacted/${appointmentId}`);
  }
  // 取得顧問頭像
  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();