保誠-保戶業務員媒合平台
劉鈞霖
2021-12-15 95d0e5524c3ab1e55a9909e2c38e7cc35901220f
[ Update ] :新增 pamService class 將 consultant interface 移出
新增13個檔案
248 ■■■■■ 已變更過的檔案
PAMapp/assets/ts/models/UserReviewsConsultantsParams.ts 4 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/assets/ts/models/agentOfStrictQuery.ts 12 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/assets/ts/models/appointmentParams.ts 12 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/assets/ts/models/clientInfo.ts 18 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/assets/ts/models/editAppointmentParams.model.ts 12 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/assets/ts/models/fastQueryParams.model.ts 7 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/assets/ts/models/loginRequest.model.ts 7 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/assets/ts/models/loginSuccessToken.model.ts 4 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/assets/ts/models/loginVerify.model.ts 9 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/assets/ts/models/otpInfo.model.ts 9 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/assets/ts/models/registerInfo.ts 10 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/assets/ts/models/strictQueryParams.ts 12 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/assets/ts/services/pamService.service.ts 132 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/assets/ts/models/UserReviewsConsultantsParams.ts
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,4 @@
export interface UserReviewsConsultantsParams{
  appointmentId:number,
  score:number,
}
PAMapp/assets/ts/models/agentOfStrictQuery.ts
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,12 @@
export interface AgentOfStrictQuery {
  agentNo: string;
  name: string;
  img: string;
  expertise: string[];
  avgScore: number;
  contactStatus: null;
  updateTime: null;
  seniority: string;
  new: boolean;
}
PAMapp/assets/ts/models/appointmentParams.ts
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,12 @@
export interface AppointmentParams {
  phone: string;
  email: string;
  contactType: string;
  gender: string;
  age: string;
  job: string;
  requirement: string;
  hopeContactTime: string;
  agentNo: string;
}
PAMapp/assets/ts/models/clientInfo.ts
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,18 @@
export interface ClientInfo {
  id: number;
  phone: string;
  email: string;
  contactType: string;
  gender: string;
  age: string;
  job: string;
  requirement: string;
  communicateStatus: string;
  hopeContactTime: string;
  otherRequirement: string;
  appointmentDate: Date;
  agentNo: string;
  customerId: number;
  name: string;
}
PAMapp/assets/ts/models/editAppointmentParams.model.ts
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,12 @@
export interface editAppointmentParams {
  id: number,
  phone: string,
  email: string,
  contactType: string,
  gender: string,
  age: string,
  job: string,
  requirement: string,
  hopeContactTime: string,
  otherRequirement: null
}
PAMapp/assets/ts/models/fastQueryParams.model.ts
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,7 @@
export interface FastQueryParams {
  gender: string;
  communicationStyles: string[];
  avgScore: number;
  status: string;
}
PAMapp/assets/ts/models/loginRequest.model.ts
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,7 @@
export interface LoginRequest {
  /** "SMS"=手機,"EMAIL"=email */
  loginType: string;
  /** è‹¥loginTypeå¡«SMS則該欄帶入手機、EMAIL則帶入郵件信箱 */
  account: string;
}
PAMapp/assets/ts/models/loginSuccessToken.model.ts
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,4 @@
export interface LoginSuccessToken {
  id_token: string;
}
PAMapp/assets/ts/models/loginVerify.model.ts
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,9 @@
export interface LoginVerify {
  /** å¯å¸¶å…¥æ‰‹æ©Ÿæˆ–email */
  account: string;
  /** ç”±otp的api回的index key */
  indexKey: string;
  /** ç”±æ‰‹æ©Ÿæˆ–信箱收到的認證碼 */
  otpCode: string;
}
PAMapp/assets/ts/models/otpInfo.model.ts
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,9 @@
export interface OtpInfo {
  /** ç”¨æ–¼å¸¶å…¥otp認證時 */
  indexKey: string;
  /** Otp是否有成功發送 */
  success: boolean;
  failCode: string;
  failReason: string;
}
PAMapp/assets/ts/models/registerInfo.ts
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,10 @@
export interface RegisterInfo {
  phone?: string;
  email?: string;
  indexKey: string;
  otpCode: string;
  name: string;
  /** "SMS":Otp發送手機,"EMAIL":Otp發email */
  contactType: string;
}
PAMapp/assets/ts/models/strictQueryParams.ts
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,12 @@
export interface StrictQueryParams {
  gender: string;
  avgScore: number;
  status: string; //phase 1 disable
  area: string;
  requirements: string[];
  otherRequirement: string;
  seniority: string;
  popularTags: string[];
  otherPopularTags: string;
}
PAMapp/assets/ts/services/pamService.service.ts
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,132 @@
import { AxiosResponse } from 'axios';
import { http } from "./httpClient";
import { editAppointmentParams } from '../models/editAppointmentParams.model';
import { AppointmentDetail } from '../models/AppointmentDetail';
import { ConsultantLoginInfo } from '../models/ConsultantLoginInfo';
import { UserSetting } from '../models/account.model';
import { FastQueryParams } from '../models/quickFilter.model';
import { LoginRequest } from "../models/loginRequest.model";
import { OtpInfo } from "../models/otpInfo.model";
import { Consultant } from '../models/consultant.model';
import { RegisterInfo } from '../models/registerInfo';
import { LoginVerify } from '../models/loginVerify.model';
import { StrictQueryParams } from '../models/strictQueryParams';
import { AppointmentParams } from '../models/appointmentParams';
import { UserReviewsConsultantsParams } from '../models/UserReviewsConsultantsParams';
import { LoginSuccessToken } from '../models/loginSuccessToken.model';
import { AgentOfStrictQuery } from '../models/agentOfStrictQuery';
import _ from "lodash";
class PamService {
  constructor() {}
  /** é¡§å®¢ç™»å…¥-發送OTP **/
  sendOtp(loginInfo: LoginRequest):Promise<AxiosResponse<OtpInfo>> {
    return http.post('/otp/sendOtp', loginInfo).then( res => res.data );
  }
  /** é¡§å®¢ç™»å…¥-驗證OTP **/
  loginVerify(loginVerify: LoginVerify):Promise<AxiosResponse<any>>{
    return http.post('/otp/verify', loginVerify);
  }
  /** é¡§å®¢è¨»å†Š **/
  register(registerInfo: RegisterInfo):Promise<AxiosResponse<any>>{
    return http.post('/otp/register', registerInfo);
  }
  /** æŽ¨è–¦ä¿éšªé¡§å• **/
  recommend():Promise<AxiosResponse<Consultant[]>>{
    return http.get('/consultant/recommend');
  }
  /** å¿«é€Ÿç¯©é¸ **/
  fastQuery(data: FastQueryParams):Promise<AxiosResponse<Consultant[]>>{
    return http.post('/consultant/fastQuery', data)
  }
  /** åš´é¸é…å° **/
  strictQuery(data:StrictQueryParams):Promise<AxiosResponse<AgentOfStrictQuery[]>>{
    return http.post('/consultant/strictQuery', data)
  }
  /** åŠ å…¥é¡§å• **/
  addFavoriteConsultant(agentNoList: string[]):Promise<AxiosResponse<any>>{
    return http.post('/consultant/favorite', {agentNoList})
  }
  /** é ç´„前詢問 **/
  appointmentDemand(data: AppointmentParams):Promise<AxiosResponse<any>> {
    return http.post('/appointment/customer/create', data)
  }
  /** é¡§å•è©³ç´°è³‡è¨Š **/
  getConsultantDetail(agentNo:string):Promise<AxiosResponse<any>>{
    return http.get('/consultant/detail', {params:{agentNo:agentNo}})
  }
  /** ç§»é™¤é¡§å• **/
  deleteConsultant(agentId: string):Promise<AxiosResponse<any>>{
    return http.delete('/consultant/favorite/'+agentId);
  }
  /** å–得驗證碼圖片 **/
  getImgOfVerification():Promise<string>{
    return http.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;
    });
  }
  /** é©—證碼-驗證 **/
  getVerificationStatus(imgCode:string):Promise<AxiosResponse<boolean>>{
    return http.get('/login/validate/verify_img_code/'+imgCode);
  }
  /** é¡§å•ç™»å…¥ **/
  logInToConsultant(consultantDto:ConsultantLoginInfo):Promise<AxiosResponse<LoginSuccessToken>>{
    return http.post('/ehttp/authenticate',consultantDto);
  }
  /** å–得預約單細節 **/
  getAppointmentDetail(apointmentId: number):Promise<AxiosResponse<AppointmentDetail>> {
    return http.get('/appointment/getDetail/'+apointmentId)
  }
  /** å–得使用者帳號資訊 **/
  getUserAccountSetting():Promise<AxiosResponse<UserSetting>>{
    return http.get<UserSetting>('/customer/info');
  }
  /** æ›´æ–°ä½¿ç”¨è€…帳號資訊 **/
  updateAccountSetting(params: any):Promise<AxiosResponse<any>> {
    return http.put('/customer/info', params);
  }
  //客戶進行滿意度評分
  userReviewsConsultants(data: UserReviewsConsultantsParams):Promise<AxiosResponse<any>> {
    return http.post('/satisfaction/create', data);
  }
  // å–消預約
  cancelAppointment(appointment: number):Promise<AxiosResponse<any>>{
    return http.delete('/appointment/'+appointment);
  }
  // ç·¨è¼¯é ç´„
  editAppointment(editAppointmentParams:editAppointmentParams):Promise<AxiosResponse<any>>{
    return http.put('/appointment', editAppointmentParams);
  }
}
export default new PamService();