feat(manage): 新增推荐页配置模块(7 槽位整屏选片 + zip 导出)
This commit is contained in:
@@ -24,6 +24,7 @@ export * from './profitSharing'
|
||||
export * from './refund'
|
||||
export * from './partner'
|
||||
export * from './content-package'
|
||||
export * from './recommend-page'
|
||||
export * from './partner-card'
|
||||
export * from './openapiCallLog'
|
||||
export * from './auditLog'
|
||||
|
||||
107
src/api/manage/recommend-page.ts
Normal file
107
src/api/manage/recommend-page.ts
Normal file
@@ -0,0 +1,107 @@
|
||||
import http from '@/utils/httpRequest'
|
||||
import type { ManageListResponse, ManageResponse, ManagePageParams } from './types'
|
||||
|
||||
/**
|
||||
* 推荐页配置(设备厂商 1920×1080 整屏电影推荐页)
|
||||
* 后端文档:/manage/recommend-page
|
||||
*/
|
||||
|
||||
/** 推荐页期次(列表项) */
|
||||
export interface RecommendPageItem {
|
||||
id: number
|
||||
name: string
|
||||
remark?: string
|
||||
deleteFlag?: string
|
||||
createdAt?: string
|
||||
updatedAt?: string
|
||||
}
|
||||
|
||||
/** 槽位定义(/slot-definitions 返回,固定 7 个) */
|
||||
export interface RecommendSlotDefinition {
|
||||
slotCode: string
|
||||
/** MAIN-主推 / PORTRAIT-竖图 / LANDSCAPE-横图 / MORE-更多入口 */
|
||||
slotType: 'MAIN' | 'PORTRAIT' | 'LANDSCAPE' | 'MORE'
|
||||
width: number
|
||||
height: number
|
||||
defaultActionType?: string
|
||||
mediaRequired?: boolean
|
||||
posterField?: string
|
||||
}
|
||||
|
||||
/** 槽位详情(/info/{id} 返回的解析后 slots 数组项) */
|
||||
export interface RecommendSlotInfo {
|
||||
slotCode: string
|
||||
slotType: string
|
||||
width: number
|
||||
height: number
|
||||
contentcode?: string | null
|
||||
mediaName?: string
|
||||
posterUrl?: string
|
||||
customPoster?: boolean
|
||||
actionType?: string
|
||||
actionParam?: string
|
||||
rawMedia?: any
|
||||
}
|
||||
|
||||
/** 推荐页详情(slots 已解析为数组,前端渲染用 data.slots) */
|
||||
export interface RecommendPageDetail {
|
||||
recommendPage: RecommendPageItem
|
||||
slots: RecommendSlotInfo[]
|
||||
}
|
||||
|
||||
/** 保存时的槽位数据(只传必要字段,影片名/海报由后端从橘视厅同步) */
|
||||
export interface RecommendSlotSaveData {
|
||||
slotCode: string
|
||||
contentcode?: string
|
||||
/** 自定义海报 URL;slot_07 必填,其余槽位留空用默认 */
|
||||
posterUrl?: string
|
||||
/** 自定义拉起命令(一般不填,用后端默认值) */
|
||||
actionParam?: string
|
||||
}
|
||||
|
||||
/** 保存推荐页请求体(有 id 更新,无 id 新建) */
|
||||
export interface RecommendPageSaveData {
|
||||
id?: number | null
|
||||
name: string
|
||||
remark?: string
|
||||
slots: RecommendSlotSaveData[]
|
||||
}
|
||||
|
||||
/** 列表查询参数 */
|
||||
export interface RecommendPageListParams extends ManagePageParams {
|
||||
name?: string
|
||||
}
|
||||
|
||||
/** 分页列表 */
|
||||
export function getRecommendPageList(params?: RecommendPageListParams): Promise<ManageListResponse<RecommendPageItem>> {
|
||||
return http.get(http.adornUrl('/manage/recommend-page/list'), { params: http.adornParams(params || {}) }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 槽位定义(渲染线框用) */
|
||||
export function getRecommendSlotDefinitions(): Promise<ManageResponse<{ slots: Record<string, RecommendSlotDefinition> }>> {
|
||||
return http.get(http.adornUrl('/manage/recommend-page/slot-definitions'), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 详情(slots 已解析为数组) */
|
||||
export function getRecommendPageInfo(id: number): Promise<ManageResponse<RecommendPageDetail>> {
|
||||
return http.get(http.adornUrl(`/manage/recommend-page/info/${id}`), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 新建或更新(有 id 更新,无 id 新建) */
|
||||
export function saveRecommendPage(data: RecommendPageSaveData): Promise<ManageResponse<{ recommendPage: RecommendPageItem }>> {
|
||||
return http.post(http.adornUrl('/manage/recommend-page/save'), http.adornData(data)).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 软删除(body 为 id 数组) */
|
||||
export function deleteRecommendPage(ids: number[]): Promise<ManageResponse> {
|
||||
return http.post(http.adornUrl('/manage/recommend-page/delete'), http.adornData(ids, false)).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 导出 zip 交付包(blob 下载;后端实时下载裁剪 7 张海报,耗时约 5~15 秒) */
|
||||
export function exportRecommendPage(id: number) {
|
||||
return http.get(http.adornUrl(`/manage/recommend-page/export/${id}`), {
|
||||
params: http.adornParams(),
|
||||
responseType: 'blob',
|
||||
timeout: 60 * 1000
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user