保誠-保戶業務員媒合平台
Tomas
2022-03-24 83757a31e7b1593d2cce267061722c259c0d5800
PAMapp/shared/services/my-consultant.service.ts
@@ -1,8 +1,9 @@
import { http } from "./httpClient";
import _ from "lodash";
import { http } from "./httpClient";
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[]> {
@@ -13,6 +14,10 @@
      };
      return res.data;
    });
  }
  async getAllGroupByConsultant(): Promise<Consultant[]> {
    return http.get<Consultant[]>('/appointment/customer/get_all_group_by_consultant').then((res) => res.data);
  }
  private viewMyConsultantList(): void {
@@ -29,6 +34,23 @@
    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();