Refactor FriendsCircle component: Simplified onError handler for image loading
This commit is contained in:
44
Touchkebao/src/api/module/group.ts
Normal file
44
Touchkebao/src/api/module/group.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from "@/api/request";
|
||||
// 添加分组
|
||||
interface AddGroupData {
|
||||
groupName: string;
|
||||
groupMemo: string;
|
||||
groupType: number;
|
||||
sort: number;
|
||||
}
|
||||
export function addGroup(data: AddGroupData) {
|
||||
return request("/v1/kefu/wechatGroup/add", data, "POST");
|
||||
}
|
||||
|
||||
// 更新分组
|
||||
interface UpdateGroupData {
|
||||
id: number;
|
||||
groupName: string;
|
||||
groupMemo: string;
|
||||
groupType: number;
|
||||
sort: number;
|
||||
}
|
||||
|
||||
export function updateGroup(data: UpdateGroupData) {
|
||||
return request("/v1/kefu/wechatGroup/update", data, "POST");
|
||||
}
|
||||
|
||||
// 删除分组
|
||||
export function deleteGroup(id: number) {
|
||||
return request(`/v1/kefu/wechatGroup/delete/${id}`, null, "DELETE");
|
||||
}
|
||||
|
||||
// 获取分组列表
|
||||
export function getGroupList() {
|
||||
return request("/v1/kefu/wechatGroup/list", null, "GET");
|
||||
}
|
||||
|
||||
// 移动分组
|
||||
interface MoveGroupData {
|
||||
type: "friend" | "group";
|
||||
groupId: number;
|
||||
id: number;
|
||||
}
|
||||
export function moveGroup(data: MoveGroupData) {
|
||||
return request("/v1/kefu/wechatGroup/move", data, "POST");
|
||||
}
|
||||
@@ -84,7 +84,7 @@ const FriendsCircle: React.FC<FriendsCircleProps> = ({ wechatFriendId }) => {
|
||||
className={styles.avatar}
|
||||
src={currentKf?.avatar || defaultAvatar}
|
||||
alt="客服头像"
|
||||
onError={(e) => {
|
||||
onError={e => {
|
||||
// 如果图片加载失败,使用默认头像
|
||||
const target = e.target as HTMLImageElement;
|
||||
if (target.src !== defaultAvatar) {
|
||||
|
||||
Reference in New Issue
Block a user