9 changed files with 353 additions and 95 deletions
@ -0,0 +1,114 @@ |
|||
import { defAbpHttp } from '/@/utils/http/abp'; |
|||
import { UserFavoriteMenuDto, UserFavoriteMenuCreateDto, UserFavoriteMenuUpdateDto } from './model'; |
|||
|
|||
const remoteService = { |
|||
name: 'Platform', |
|||
controller: 'UserFavoriteMenu', |
|||
replace: { |
|||
framework: 'Vue Vben Admin', |
|||
} |
|||
}; |
|||
|
|||
export const create = (userId: string, input: UserFavoriteMenuCreateDto) => { |
|||
input.framework = remoteService.replace.framework; |
|||
return defAbpHttp.request<UserFavoriteMenuDto>({ |
|||
service: remoteService.name, |
|||
controller: remoteService.controller, |
|||
action: 'CreateAsync', |
|||
params: { |
|||
userId: userId, |
|||
}, |
|||
data: { |
|||
input: input, |
|||
}, |
|||
}); |
|||
}; |
|||
|
|||
export const createMyFavoriteMenu = (input: UserFavoriteMenuCreateDto) => { |
|||
input.framework = remoteService.replace.framework; |
|||
return defAbpHttp.request<UserFavoriteMenuDto>({ |
|||
service: remoteService.name, |
|||
controller: remoteService.controller, |
|||
action: 'CreateMyFavoriteMenuAsync', |
|||
data: { |
|||
input: input, |
|||
}, |
|||
}); |
|||
}; |
|||
|
|||
export const del = (userId: string, menuId: string) => { |
|||
return defAbpHttp.request<void>({ |
|||
service: remoteService.name, |
|||
controller: remoteService.controller, |
|||
action: 'DeleteAsync', |
|||
params: { |
|||
userId: userId, |
|||
}, |
|||
data: { |
|||
input: { |
|||
menuId: menuId, |
|||
}, |
|||
}, |
|||
}); |
|||
}; |
|||
|
|||
export const delMyFavoriteMenu = (menuId: string) => { |
|||
return defAbpHttp.request<void>({ |
|||
service: remoteService.name, |
|||
controller: remoteService.controller, |
|||
action: 'DeleteMyFavoriteMenuAsync', |
|||
data: { |
|||
input: { |
|||
menuId: menuId, |
|||
}, |
|||
}, |
|||
}); |
|||
}; |
|||
|
|||
export const update = (userId: string, input: UserFavoriteMenuUpdateDto) => { |
|||
return defAbpHttp.request<UserFavoriteMenuDto>({ |
|||
service: remoteService.name, |
|||
controller: remoteService.controller, |
|||
action: 'UpdateAsync', |
|||
params: { |
|||
userId: userId, |
|||
}, |
|||
data: { |
|||
input: input, |
|||
}, |
|||
}); |
|||
}; |
|||
|
|||
export const updateMyFavoriteMenu = (input: UserFavoriteMenuUpdateDto) => { |
|||
return defAbpHttp.request<UserFavoriteMenuDto>({ |
|||
service: remoteService.name, |
|||
controller: remoteService.controller, |
|||
action: 'UpdateMyFavoriteMenuAsync', |
|||
data: { |
|||
input: input, |
|||
}, |
|||
}); |
|||
}; |
|||
|
|||
export const getList = (userId: string) => { |
|||
return defAbpHttp.listRequest<UserFavoriteMenuDto>({ |
|||
service: remoteService.name, |
|||
controller: remoteService.controller, |
|||
action: 'GetListAsync', |
|||
params: { |
|||
userId: userId, |
|||
framework: remoteService.replace.framework, |
|||
}, |
|||
}); |
|||
}; |
|||
|
|||
export const getMyFavoriteMenuList = () => { |
|||
return defAbpHttp.listRequest<UserFavoriteMenuDto>({ |
|||
service: remoteService.name, |
|||
controller: remoteService.controller, |
|||
action: 'GetMyFavoriteMenuListAsync', |
|||
params: { |
|||
framework: remoteService.replace.framework, |
|||
}, |
|||
}); |
|||
}; |
|||
@ -0,0 +1,28 @@ |
|||
import { AuditedEntityDto, EntityDto, IHasConcurrencyStamp } from '/@/api/model/baseModel'; |
|||
|
|||
export interface UserFavoriteMenuDto extends AuditedEntityDto, EntityDto<string> { |
|||
menuId: string; |
|||
userId: string; |
|||
aliasName?: string; |
|||
color?: string; |
|||
framework: string; |
|||
name: string; |
|||
displayName: string; |
|||
path?: string; |
|||
icon?: string; |
|||
} |
|||
|
|||
interface UserFavoriteMenuCreateOrUpdateDto { |
|||
menuId: string; |
|||
color?: string; |
|||
aliasName?: string; |
|||
icon?: string; |
|||
} |
|||
|
|||
export interface UserFavoriteMenuCreateDto extends UserFavoriteMenuCreateOrUpdateDto { |
|||
framework: string; |
|||
} |
|||
|
|||
export interface UserFavoriteMenuUpdateDto extends UserFavoriteMenuCreateOrUpdateDto, IHasConcurrencyStamp { |
|||
} |
|||
|
|||
@ -0,0 +1,49 @@ |
|||
import { useI18n } from '/@/hooks/web/useI18n'; |
|||
|
|||
export interface Menu { |
|||
id: string, |
|||
title: string; |
|||
desc?: string; |
|||
icon?: string; |
|||
color?: string; |
|||
size?: number; |
|||
path?: string; |
|||
hasDefault?: boolean; |
|||
} |
|||
|
|||
export function useDefaultMenus() { |
|||
const { t } = useI18n(); |
|||
|
|||
const defaultMenus: Menu[] = [{ |
|||
id: '0', |
|||
title: t('layout.header.home'), |
|||
icon: 'ion:home-outline', |
|||
color: '#1fdaca', |
|||
path: '/', |
|||
hasDefault: true, |
|||
},{ |
|||
id: '1', |
|||
title: t('routes.dashboard.dashboard'), |
|||
icon: 'ion:grid-outline', |
|||
color: '#bf0c2c', |
|||
path: '/dashboard/workbench', |
|||
hasDefault: true, |
|||
},{ |
|||
id: '2', |
|||
title: t('routes.basic.accountSetting'), |
|||
icon: 'ant-design:setting-outlined', |
|||
color: '#3fb27f', |
|||
path: '/account/settings', |
|||
hasDefault: true, |
|||
},{ |
|||
id: '3', |
|||
title: t('routes.basic.accountCenter'), |
|||
icon: 'ant-design:profile-outlined', |
|||
color: '#4daf1bc9', |
|||
path: '/account/center', |
|||
hasDefault: true, |
|||
} |
|||
]; |
|||
|
|||
return defaultMenus; |
|||
} |
|||
Loading…
Reference in new issue