地址路径修改
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// 货运人员服务 - 处理货运人员相关的数据操作
|
||||
import { DeliveryPerson } from '../types';
|
||||
import apiService from './apiService';
|
||||
import { API_BASE_URL } from './apiService';
|
||||
|
||||
/**
|
||||
* 货运人员服务类
|
||||
@@ -79,6 +80,27 @@ class DeliveryPersonService {
|
||||
}>> {
|
||||
return apiService.getDeliveryPersonOrders(deliveryPersonId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取货运人员头像URL
|
||||
* @param deliveryPersonId 货运人员ID
|
||||
* @returns 头像URL
|
||||
*/
|
||||
async getAvatarUrl(deliveryPersonId: number): Promise<string> {
|
||||
try {
|
||||
// 首先尝试获取货运人员详细信息
|
||||
const deliveryPerson = await this.getDeliveryPersonById(deliveryPersonId);
|
||||
if (deliveryPerson && deliveryPerson.avatarPath) {
|
||||
return `${API_BASE_URL}${deliveryPerson.avatarPath}`;
|
||||
}
|
||||
|
||||
// 如果货运人员信息中没有头像路径,返回默认头像
|
||||
return '/images/truck.png';
|
||||
} catch (error) {
|
||||
console.error('获取货运人员头像失败:', error);
|
||||
return '/images/truck.png';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user