| | |
| | | import axios from 'axios'; |
| | | import { AxiosRequestConfig, AxiosError, AxiosResponse } from 'axios'; |
| | | import { MessageBox } from 'element-ui'; |
| | | import { functionsIn } from 'lodash'; |
| | | import Router from 'vue-router'; |
| | | |
| | | export const service = axios.create({ |
| | | baseURL: process.env.BASE_URL |
| | | }) |
| | | |
| | | service.interceptors.request.use(function (config: AxiosRequestConfig) { |
| | | return config; |
| | | }, function (error: AxiosError) { |
| | | return Promise.reject(error); |
| | | }); |
| | | |
| | | service.interceptors.response.use(function (response: AxiosResponse) { |
| | | return response; |
| | | }, function (error: AxiosError) { |
| | | return Promise.reject(error); |
| | | }); |
| | | import { service } from '~/assets/ts/api/share'; |
| | | import { AxiosResponse } from 'axios'; |
| | | import { AppointmentDetail } from '../models/AppointmentDetail'; |
| | | import { ConsultantLoginInfo } from '../models/ConsultantLoginInfo'; |
| | | |
| | | // 顧客登入(TODO: OTP認證開發前 暫時使用) |
| | | export function login(user: any) { |
| | |
| | | |
| | | // 推薦保險顧問 |
| | | export function recommend() { |
| | | return service.get('/consultant/recommend') |
| | | return service.get<Consultants[]>('/consultant/recommend') |
| | | .then(res => res.data); |
| | | } |
| | | |
| | | // 我的顧問清單 |
| | |
| | | const headers = { |
| | | Authorization: 'Bearer ' + localStorage.getItem('id_token') |
| | | } |
| | | return service.get('/consultant/favorite', {headers}); |
| | | return service.get<Consultants[]>('/consultant/favorite', {headers}) |
| | | .then(res => res.data); |
| | | } |
| | | |
| | | // 快速篩選 |
| | |
| | | } |
| | | |
| | | // 嚴選配對 |
| | | export function strictQuery(data:StrictQueryParams):Promise<AxiosResponse<AgentOfStrictQuery>>{ |
| | | export function strictQuery(data:StrictQueryParams):Promise<AxiosResponse<AgentOfStrictQuery[]>>{ |
| | | return service.post('/consultant/strictQuery', data) |
| | | } |
| | | |
| | |
| | | const headers = { |
| | | Authorization: 'Bearer ' + localStorage.getItem('id_token') |
| | | } |
| | | return service.post('/appointment/customer/create', data ,{headers}) |
| | | return service.post('/appointment/customer/create', data, {headers}) |
| | | } |
| | | |
| | | //顧問詳細資訊 |
| | |
| | | return service.get('/consultant/detail', {params:{agentNo:agentNo}}) |
| | | } |
| | | |
| | | // 取得所有預約清單 |
| | | export function getMyAppointmentList():Promise<AxiosResponse<ClientInfo>> { |
| | | // 移除顧問 |
| | | export function deleteConsultant(agentId: string) { |
| | | const headers = { |
| | | Authorization: 'Bearer ' + localStorage.getItem('id_token') |
| | | } |
| | | return service.get('/consultant/getMyAppointment', {headers}); |
| | | return service.delete('/consultant/favorite/'+agentId, {headers}) |
| | | } |
| | | |
| | | // 忘記密碼網址 |
| | |
| | | }) |
| | | } |
| | | |
| | | // 取得驗證碼圖片 |
| | | // 取得驗證碼圖片 |
| | | export function getVerificationCodeImg():Promise<string>{ |
| | | return new Promise((resolve, reject)=>{ |
| | | resolve(''); |
| | | }) |
| | | } |
| | | } |
| | | |
| | | // 顧問登入 |
| | | export function logInToConsultant(consultantDto:ConsultantLoginInfo):Promise<boolean>{ |
| | | console.log('consultantDto',consultantDto); |
| | | return new Promise((resolve, reject)=>{ |
| | | setTimeout(()=>{ |
| | | resolve(true); |
| | | },1000) |
| | | }) |
| | | export function logInToConsultant(consultantDto:ConsultantLoginInfo):Promise<AxiosResponse<RequestOfLoginSuccess>>{ |
| | | return service.post('/eService/authenticate',consultantDto); |
| | | } |
| | | export interface ConsultantLoginInfo{ |
| | | account:string, |
| | | password:string, |
| | | verificationCode:string, |
| | | |
| | | // 取得預約單細節 |
| | | export function getAppointmentDetail(apointmentId: number):Promise<AxiosResponse<AppointmentDetail>> { |
| | | const headers = { |
| | | Authorization: 'Bearer ' + localStorage.getItem('id_token') |
| | | } |
| | | return service.get('/appointment/getDetail/'+apointmentId, {headers}) |
| | | } |
| | | export interface Consultants { |
| | | agentNo: string, |
| | |
| | | updateTime: Date, |
| | | seniority: string, |
| | | contactStatus?: string; |
| | | latestAppointmentId: number; |
| | | role: string; |
| | | image?: string; |
| | | expertises?: string; |
| | | } |
| | | |
| | | export interface FastQueryParams { |
| | |
| | | status: string |
| | | } |
| | | |
| | | export interface AppointmentRequests { |
| | | connectDevices: any[], |
| | | hopeContactTime: any, |
| | | email?: string, |
| | | job?: string, |
| | | otherJob?: string, |
| | | gender?: string, |
| | | myQuestion: any[], |
| | | age?: string, |
| | | } |
| | | export interface AppointmentParams { |
| | | phone: string, |
| | | email: string, |
| | | phone?: string, |
| | | email?: string, |
| | | contactType: string, |
| | | gender: string, |
| | | age: string, |
| | | job: string, |
| | | gender?: string, |
| | | age?: string, |
| | | job?: string, |
| | | requirement: string, |
| | | hopeContactTime: string, |
| | | otherRequirement: string, |
| | | hopeContactTime?: string, |
| | | agentNo: string |
| | | } |
| | | export interface StrictQueryParams{ |
| | |
| | | new: boolean; |
| | | } |
| | | |
| | | 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 |
| | | } |