保誠-保戶業務員媒合平台
HelenHuang
2021-12-06 20b87b7eab9c600e2445548c4306ea1b8b37b275
PAMapp/assets/ts/api/consultant.ts
@@ -2,6 +2,9 @@
import { AxiosResponse } from 'axios';
import { AppointmentDetail } from '../models/AppointmentDetail';
import { ConsultantLoginInfo } from '../models/ConsultantLoginInfo';
import _ from 'lodash';
import { UserSetting } from '../models/account.model';
import { Consultants } from '~/assets/ts/models/consultant.model';
// 顧客登入(TODO: OTP認證開發前 暫時使用)
export function login(user: any) {
@@ -77,18 +80,19 @@
    return service.delete('/consultant/favorite/'+agentId, {headers})
}
// 忘記密碼網址
export function getForgotPasswordLink():Promise<string>{
    return new Promise((resolve, reject)=>{
        resolve('https://www.google.com/');
    })
// 取得驗證碼圖片
export function getImgOfVerification():Promise<string>{
  return service.get('/login/validate/get_img_code',{ responseType : 'arraybuffer' })
    .then(response=>{
      const toBase64 = window.btoa(_.reduce(new Uint8Array(response.data),(data,byte)=>data + String.fromCharCode(byte),''));
      const imgSrc = `data:image/jpeg;base64,${toBase64}`;
      return imgSrc;
  });
}
// 取得驗證碼圖片
export function getVerificationCodeImg():Promise<string>{
    return new Promise((resolve, reject)=>{
        resolve('');
    })
// 驗證碼 驗證
export function getVerificationStatus(imgCode:string):Promise<AxiosResponse<boolean>>{
  return service.get('/login/validate/verify_img_code/'+imgCode);
}
// 顧問登入
@@ -103,49 +107,64 @@
    }
    return service.get('/appointment/getDetail/'+apointmentId, {headers})
}
export interface Consultants {
    agentNo: string,
    name: string,
    img: string,
    new: boolean,
    avgScore: number,
    expertise: string[],
    updateTime: Date,
    seniority: string,
    contactStatus?: string;
    latestAppointmentId: number;
    role: string;
    image?: string;
    expertises?: string;
//取得使用者帳號資訊
export function getUserAccountSetting() : Promise<UserSetting> {
    const headers = {
        Authorization: 'Bearer ' + localStorage.getItem('id_token')
    }
    return service.get<UserSetting>('/customer/info', {headers}).then(res => res.data);
}
//更新使用者帳號資訊
export function updateAccountSetting(params: any) : any {
    const headers = {
        Authorization: 'Bearer ' + localStorage.getItem('id_token')
    }
    return service.put('/customer/info', params ,{headers}).then(res => res.data);
}
//客戶進行滿意度評分
export function userReviewsConsultants(data: UserReviewsConsultantsParams) {
    const headers = {
        Authorization: 'Bearer ' + localStorage.getItem('id_token')
    }
    return service.post('/satisfaction/create', data ,{headers});
}
export interface FastQueryParams {
    gender: string,
    gender             : string,
    communicationStyles: string[],
    avgScore: number,
    status: string
    avgScore           : number,
    status             : string
}
export interface AppointmentRequests {
  connectDevices: any[],
  hopeContactTime: any,
  email?: string,
  job?: string,
  otherJob?: string,
  gender?: string,
  myQuestion: any[],
  age?: string,
    phone          : string,
    email          : string,
    contactType    : string,
    gender         : string,
    age            : string,
    job            : string,
    requirement    : string[],
    hopeContactTime: ContactTime[],
    agentNo        : string,
}
export interface ContactTime {
  selectWeekOptions : string[],
  selectTimesOptions: string[]
}
export interface AppointmentParams {
    phone?: string,
    email?: string,
    contactType: string,
    gender?: string,
    age?: string,
    job?: string,
    requirement: string,
    hopeContactTime?: string,
    agentNo: string
    phone          : string,
    email          : string,
    contactType    : string,
    gender         : string,
    age            : string,
    job            : string,
    requirement    : string,
    hopeContactTime: string,
    agentNo        : string
}
export interface StrictQueryParams{
    gender:           string;
@@ -168,6 +187,9 @@
    updateTime:    null;
    seniority:     string;
    new:           boolean;
}
export interface RequestOfLoginSuccess{
  id_token: string;
}
export interface LoginRequest {
@@ -203,4 +225,9 @@
    name: string,
    /** "SMS":Otp發送手機,"EMAIL":Otp發email */
    contactType: string
}
export interface UserReviewsConsultantsParams{
    appointmentId:number,
    score:number,
}