bannner.ts
1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { AnyObject, QueryForParams, ServiceResponse } from '@/types/global';
import { Banner } from '@/utils/model';
import axios from 'axios';
export default class useBannerApi {
static roleOption = [
{ value: 'UnLogin', label: '未登录' },
{ value: 'Visitor', label: '游客' },
{ value: 'Singer', label: '音乐人' },
{ value: 'Business', label: '经纪人' },
{ value: 'Project', label: '厂牌管理员' },
{ value: 'System', label: '平台管理员' },
];
static statusOption = [
{ value: 0, label: '下架' },
{ value: 1, label: '上架' },
];
static scopeOption = [{ value: 1, label: '首页banner' }];
static typeOption = [
{ value: 1, label: '普通' },
{ value: 2, label: '外链' },
{ value: 3, label: '交互' },
{ value: 4, label: '自定义H5' },
];
static get(params?: QueryForParams): Promise<ServiceResponse<Banner[]>> {
return axios.get('system/banners', { params });
}
static async create(data: AnyObject): Promise<Banner> {
return axios.post('system/banners', data).then((res) => Promise.resolve(res.data));
}
static async update(id: number, data: AnyObject): Promise<Banner> {
return axios.put(`system/banners/${id}`, data).then((res) => Promise.resolve(res.data));
}
static async changeStatus(id: number, data: { status: number }) {
return axios.put(`system/banners/${id}/change-status`, data);
}
static async destroy(id: number) {
return axios.delete(`system/banners/${id}`).then((res) => Promise.resolve(res.data));
}
}