| | |
| | | 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'; |
| | | |
| | | // 顧客登入(TODO: OTP認證開發前 暫時使用) |
| | | export function login(user: any) { |
| | |
| | | } |
| | | |
| | | // 我的顧問清單 |
| | | export function getFavoriteConsultant() { |
| | | export function getFavoriteConsultant():Promise<AxiosResponse<Consultants[]>> { |
| | | const headers = { |
| | | Authorization: 'Bearer ' + localStorage.getItem('id_token') |
| | | } |
| | |
| | | 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 getForgotPasswordLink():Promise<string>{ |
| | | return new Promise((resolve, reject)=>{ |
| | | resolve('https://www.google.com/'); |
| | | }) |
| | | } |
| | | |
| | | // 取得驗證碼圖片 |
| | | 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 getAppointmentDetail(apointmentId: number):Promise<AxiosResponse<AppointmentDetail>> { |
| | | const headers = { |
| | | Authorization: 'Bearer ' + localStorage.getItem('id_token') |
| | | } |
| | | return service.get('/appointment/getDetail/'+apointmentId, {headers}) |
| | | } |
| | | export interface ConsultantLoginInfo{ |
| | | account:string, |
| | | password:string, |
| | | verificationCode:string, |
| | | } |
| | | export interface Consultants { |
| | | agentNo: string, |
| | |
| | | updateTime: Date, |
| | | seniority: string, |
| | | contactStatus?: string; |
| | | latestAppointmentId: number; |
| | | } |
| | | |
| | | export interface FastQueryParams { |
| | |
| | | new: boolean; |
| | | } |
| | | |
| | | export interface ClientInfo { |
| | | export interface AppointmentDetail { |
| | | id: number, |
| | | phone: string, |
| | | email: string, |