新版本官网优化完成

This commit is contained in:
2025-02-12 16:37:07 +08:00
parent 43a2e17a80
commit 3efdbfc662
547 changed files with 23001 additions and 28169 deletions

View File

@@ -1,22 +1,22 @@
import request from '@/utils/request';
import request from '~/utils/request';
import type {ApiResult, PageResult} from '@/api';
import type {CmsProductComment, CmsProductCommentParam} from './model';
import {SERVER_API_URL} from '@/config/index';
/**
* 分页查询产品评论
*/
export async function pageCmsProductComment(params: CmsProductCommentParam) {
const res = await request.get<ApiResult<PageResult<CmsProductComment>>>(
SERVER_API_URL + '/cms/cms-product-comment/page',
'/cms/cms-product-comment/page',
{
params
}
);
if (res.data.code === 0) {
return res.data.data;
if (res.code === 0) {
return res.data;
}
return Promise.reject(new Error(res.data.message));
return Promise.reject(new Error(res.message));
}
/**
@@ -24,15 +24,15 @@ export async function pageCmsProductComment(params: CmsProductCommentParam) {
*/
export async function listCmsProductComment(params?: CmsProductCommentParam) {
const res = await request.get<ApiResult<CmsProductComment[]>>(
SERVER_API_URL + '/cms/cms-product-comment',
'/cms/cms-product-comment',
{
params
}
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
if (res.code === 0 && res.data) {
return res.data;
}
return Promise.reject(new Error(res.data.message));
return Promise.reject(new Error(res.message));
}
/**
@@ -40,13 +40,13 @@ export async function listCmsProductComment(params?: CmsProductCommentParam) {
*/
export async function addCmsProductComment(data: CmsProductComment) {
const res = await request.post<ApiResult<unknown>>(
SERVER_API_URL + '/cms/cms-product-comment',
'/cms/cms-product-comment',
data
);
if (res.data.code === 0) {
return res.data.message;
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.data.message));
return Promise.reject(new Error(res.message));
}
/**
@@ -54,42 +54,42 @@ export async function addCmsProductComment(data: CmsProductComment) {
*/
export async function updateCmsProductComment(data: CmsProductComment) {
const res = await request.put<ApiResult<unknown>>(
SERVER_API_URL + '/cms/cms-product-comment',
'/cms/cms-product-comment',
data
);
if (res.data.code === 0) {
return res.data.message;
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.data.message));
return Promise.reject(new Error(res.message));
}
/**
* 删除产品评论
*/
export async function removeCmsProductComment(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
SERVER_API_URL + '/cms/cms-product-comment/' + id
const res = await request.del<ApiResult<unknown>>(
'/cms/cms-product-comment/' + id
);
if (res.data.code === 0) {
return res.data.message;
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.data.message));
return Promise.reject(new Error(res.message));
}
/**
* 批量删除产品评论
*/
export async function removeBatchCmsProductComment(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
SERVER_API_URL + '/cms/cms-product-comment/batch',
const res = await request.del<ApiResult<unknown>>(
'/cms/cms-product-comment/batch',
{
data
}
);
if (res.data.code === 0) {
return res.data.message;
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.data.message));
return Promise.reject(new Error(res.message));
}
/**
@@ -97,10 +97,10 @@ export async function removeBatchCmsProductComment(data: (number | undefined)[])
*/
export async function getCmsProductComment(id: number) {
const res = await request.get<ApiResult<CmsProductComment>>(
SERVER_API_URL + '/cms/cms-product-comment/' + id
'/cms/cms-product-comment/' + id
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
if (res.code === 0 && res.data) {
return res.data;
}
return Promise.reject(new Error(res.data.message));
return Promise.reject(new Error(res.message));
}