Browse Source

add:material model and api

dev
powersir 1 year ago
parent
commit
a771d681c5
4 changed files with 95 additions and 1 deletions
  1. +1
    -0
      src/models/index.ts
  2. +1
    -1
      src/models/material-classify.data.ts
  3. +67
    -0
      src/models/material.data.ts
  4. +26
    -0
      src/request/service/material.ts

+ 1
- 0
src/models/index.ts View File

@@ -19,6 +19,7 @@ export * from './category.data.ts'
export * from './material-classify.data.ts'
export * from './goods-classify.data.ts'
export * from './goods-attr.data.ts'
export * from './material.data.ts'

export interface ResponseDTO<T>{
code: number;


+ 1
- 1
src/models/material-classify.data.ts View File

@@ -1,4 +1,4 @@
export interface MaterialClassifyVO {\
export interface MaterialClassifyVO {
id: number;
classifyName: string;
createTime: Date;


+ 67
- 0
src/models/material.data.ts View File

@@ -0,0 +1,67 @@
export interface MaterialVO {
/**
* 素材分类_id
*/
classifyId: number;
/**
* 主键
*/
id: number;
/**
* 素材高度(px)
*/
materialHeight?: number;
/**
* 文件库_id
*/
materialImgId: number;
/**
* 素材文件名称
*/
materialName?: string;
/**
* 素材备注/描述
*/
materialRemark?: string;
/**
* 素材大小(字节 / b)
*/
materialSize?: number;
/**
* 素材宽度(px)
*/
materialWidth?: number;
/**
* sku编码
*/
skuCode: string;
/**
* spu编码
*/
spuCode: string;
}


/**
* MaterialPageQueryDTO,管理后台 - 素材分页 Request DTO
*/
export interface MaterialPageQueryVO extends PageParam {
/**
* 素材分类_id集合
*/
classifyIds?: number[];
/**
* 素材文件名称
*/
materialName?: string;
}


/**
* MaterialCreateReqBatchDTO,管理后台 - 素材创建 Request DTO
*/
export interface MaterialCreateReqBatchVO {
classifyId: number;
files: string[];
materialRemark: string;
}

+ 26
- 0
src/request/service/material.ts View File

@@ -0,0 +1,26 @@
import request from '@/request';
import { MaterialVO, MaterialPageQueryVO, MaterialCreateReqBatchVO, PageData } from '@/models';

const BASE_URL = '/admin-api/material';

export default {
//更新素材
updateMaterial: (material: MaterialVO) => {
return request.post(`${BASE_URL}/update`, material);
},

//获得素材分页数据
getMaterialPageData: (query: MaterialPageQueryVO) => {
return request.post<PageData<MaterialVO>>(`${BASE_URL}/page`, query);
},

//批量删除素材
deleteMaterialBatch: (ids: string[]) => {
return request.post(`${BASE_URL}/deleteBatch`, ids);
},

//创建素材
createMaterialBatch: (material: MaterialCreateReqBatchVO) => {
return request.post(`${BASE_URL}/createBatch`, material);
},
}

Loading…
Cancel
Save