提交 e0bc6424 作者: 龚洪江

修复:跨域代理,商品页面

上级 746a63de
#请求接口地址
#VITE_REQUEST_BASE_URL='https://www.iuav.shop'
VITE_REQUEST_BASE_URL='https://test.iuav.shop'
VITE_REQUEST_BASE_URL='/api'
#旧版接口地址
#VITE_REQUEST_BASE_URL='https://iuav.mmcuav.cn'
#VITE_REQUEST_BASE_URL='https://test.iuav.mmcuav.cn'
......
......@@ -30,4 +30,18 @@ export class ProduceManageAPI {
static editProductSku = (data: unknown) => {
return axios.post('uavgoods/product/spec/editProductSku', data);
};
// 产品规格管理---删除规格
static removeProductSpec = (params: unknown) => {
return axios.get('uavgoods/product/spec/removeProductSpec', { params });
};
// 产品sku管理-编辑单个产品sku时的信息回显
static getProductSkuDetail = (params: unknown) => {
return axios.get('uavgoods/product/spec/getProductSkuDetail', { params });
};
// 产品sku管理-产品规格管理-分页列表
static listPageProductSpec = (params: unknown) => {
return axios.get('uavgoods/product/spec/listPageProductSpec', { params });
};
}
import { useEffect, useState } from 'react';
import { RoleAPI } from '@/api';
import { limitEntity } from '@/api/modules/role';
function useOptionShow(id: number) {
// const [show, setShow] = useState<boolean>(false);
return (JSON.parse(localStorage.getItem('routeList') as string) || []).some(
(v: limitEntity) => v.id === id,
);
// useEffect(() => {
// RoleAPI.getListCuserMenuInfo().then((res: any) => {
// const bol: boolean = res.result.some((v: limitEntity) => v.id === id);
// setShow(bol);
// });
// }, []);
// return show;
}
export default useOptionShow;
import SearchBox, { searchColumns } from '~/components/search-box';
import { useState } from 'react';
import { Button, Card, Table } from 'antd';
import {
ArrowDownOutlined,
ArrowUpOutlined,
DeleteOutlined,
PlusOutlined,
} from '@ant-design/icons';
import { ColumnsType } from 'antd/es/table';
const GoodsList = () => {
const tabList = [
{
key: '1',
tab: '全部',
},
{
key: '2',
tab: '上架中',
},
{
key: '3',
tab: '仓库中',
},
];
const [activeTabKey, setActiveTabKey] = useState<string>('1');
const [searchColumns] = useState<searchColumns[]>([
{
label: '商品名称',
placeholder: '请输入商品名称',
name: '',
type: 'input',
},
{
label: '所属目录',
placeholder: '请选择所属目录',
name: '',
type: 'select',
options: [],
},
{
label: '创建时间',
placeholder: '请输入选择创建时间',
name: '',
type: 'rangePicker',
},
]);
const tableColumns: ColumnsType<any> = [
{ title: '序号', align: 'center' },
{ title: '图片', align: 'center' },
{ title: '商品名称', align: 'center' },
{ title: '所属目录', align: 'center' },
{ title: '创建时间', align: 'center' },
{ title: '状态', align: 'center' },
{
title: '操作',
align: 'center',
render: () => (
<>
<Button type='link'>编辑</Button>
<Button type='link'>详情</Button>
</>
),
},
];
const [tableData] = useState<{ id: number }[]>([{ id: 1 }]);
const onTabChange = (key: string) => {
setActiveTabKey(key);
};
return (
<div className='goods-list'>
<SearchBox
search={searchColumns}
child={
<Button type='primary' icon={<PlusOutlined />}>
新增商品
</Button>
}
/>
<Card tabList={tabList} activeTabKey={activeTabKey} onTabChange={onTabChange}>
<div className='header-operate' style={{ marginBottom: '10px' }}>
<Button type='primary' style={{ marginRight: '10px' }} icon={<ArrowUpOutlined />}>
上架
</Button>
<Button type='primary' style={{ marginRight: '10px' }} icon={<ArrowDownOutlined />}>
下架
</Button>
<Button danger icon={<DeleteOutlined />}>
删除
</Button>
</div>
<Table columns={tableColumns} bordered dataSource={tableData} />
</Card>
</div>
);
};
export default GoodsList;
......@@ -23,7 +23,7 @@ function IndustryList() {
// 路由操作
const navigate = useNavigate();
// 表格数据
const [tableData, setTableData] = useState<IndustrySkuType[]>([]);
const [tableData, setTableData] = useState<any>([{ id: 1 }]);
// 加载中
const [loading, setLoading] = useState<boolean>(false);
// 行业列表
......@@ -33,7 +33,7 @@ function IndustryList() {
// 跳转详情
const handleDetail = (record: { id: number }) => {
navigate({
pathname: '/goodsManage/industryManage/detail',
pathname: '/mallManage/industryDetail',
search: `id=${record.id}`,
});
// console.log(record);
......@@ -69,27 +69,15 @@ function IndustryList() {
render: (text: string, record) => {
return (
<div>
{btnDetail ? (
<Button type='link' onClick={() => handleDetail(record)}>
详情
</Button>
) : (
''
)}
{btnEdit ? (
<Button type='link' onClick={() => handleEdit(record)}>
编辑
</Button>
) : (
''
)}
{btnDelete ? (
<Button type='link' onClick={() => openDeleteModal(record)}>
删除
</Button>
) : (
''
)}
</div>
);
},
......@@ -234,11 +222,11 @@ function IndustryList() {
// componentDidMount
useEffect(() => {
query = {};
(async () => {
await getFirstIndustryTypeInfo();
await getTableList();
})();
// query = {};
// (async () => {
// await getFirstIndustryTypeInfo();
// await getTableList();
// })();
}, []);
return (
......
import CommonGoodsList from '~/components/goods/commonGoodsList';
const GoodsList = () => {
return (
<div className='goods-list'>
<CommonGoodsList />
</div>
);
};
export default GoodsList;
......@@ -24,7 +24,7 @@ function ProduceManage() {
// 路由操作
const navigate = useNavigate();
// 表格数据
const [tableData, setTableData] = useState<ProductSkuType[]>([]);
const [tableData, setTableData] = useState<any>([{ id: 1 }]);
// 加载中
const [loading, setLoading] = useState<boolean>(false);
// 产品类型下拉列表
......@@ -42,7 +42,7 @@ function ProduceManage() {
// 跳转详情
const handleDetail = (record: ProductSkuType) => {
navigate({
pathname: '/goodsManage/productManage/detail',
pathname: '/mallManage/produceDetail',
search: `id=${record.id}`,
});
};
......@@ -104,27 +104,15 @@ function ProduceManage() {
render: (text: string, record) => {
return (
<div>
{btnDetail ? (
<Button type='link' onClick={() => handleDetail(record)}>
详情
</Button>
) : (
''
)}
{btnEdit ? (
<Button type='link' onClick={() => handleEdit(record)}>
编辑
</Button>
) : (
''
)}
{btnDelete ? (
<Button type='link' onClick={() => handleDelete(record)}>
删除
</Button>
) : (
''
)}
</div>
);
},
......@@ -220,12 +208,12 @@ function ProduceManage() {
};
// componentDidMount
useEffect(() => {
query = {};
getMakeList();
getDescList();
(async () => {
await getTableList();
})();
// query = {};
// getMakeList();
// getDescList();
// (async () => {
// await getTableList();
// })();
}, []);
return (
......
import CommonGoodsList from '~/components/goods/commonGoodsList';
const RentList = () => {
return (
<div className='rent-list'>
<CommonGoodsList />
</div>
);
};
export default RentList;
......@@ -36,18 +36,25 @@ import CustomMoneyView from '~/pages/customManage/customMoney';
import CustomMoneyDetail from '~/pages/customManage/customMoney/detail';
// 活动
const ActivityList = React.lazy(() => import('src/pages/activityManage/activityList')); //活动管理
// 服务
const ServiceListView = React.lazy(() => import('~/pages/mallManage/serviceManage/serviceList'));
//商品管理
const ServiceListView = React.lazy(() => import('~/pages/mallManage/serviceManage/serviceList')); //服务列表
const ServiceDetailView = React.lazy(
() => import('~/pages/mallManage/serviceManage/serviceDetail'),
);
); //服务详情
const ServiceIntroduceView = React.lazy(
() => import('~/pages/mallManage/serviceManage/serviceIntroduce'),
);
// 产品
const ProduceListView = React.lazy(() => import('~/pages/mallManage/produceManage/produceList'));
// 行业
const IndustryListView = React.lazy(() => import('~/pages/mallManage/industryManage/industryList'));
); //服务介绍
const RentListView = React.lazy(() => import('~/pages/mallManage/rentGoods/rentList')); //租赁列表
const MallGoodsView = React.lazy(() => import('~/pages/mallManage/mallGoods/goodsList')); //商城商品
const ProduceListView = React.lazy(() => import('~/pages/mallManage/produceManage/produceList')); //产品列表
const ProduceDetailView = React.lazy(
() => import('~/pages/mallManage/produceManage/produceDetail'),
); //产品详情
const IndustryListView = React.lazy(() => import('~/pages/mallManage/industryManage/industryList')); //行业列表
const IndustryDetailView = React.lazy(
() => import('~/pages/mallManage/industryManage/industryDetail'),
); //行业详情
// 订单
const ProductOrderView = React.lazy(() => import('src/pages/orderManage/productOrder')); //销售订单
......@@ -202,23 +209,61 @@ export const routerList: Array<RouteObjectType> = [
},
},
{
path: '/mallManage/rentList',
element: withLoadingComponent(<RentListView />),
meta: {
id: 10130,
icon: <SmileOutlined />,
title: '租赁商品',
},
},
{
path: '/mallManage/mallGoods',
element: withLoadingComponent(<MallGoodsView />),
meta: {
id: 10140,
icon: <SmileOutlined />,
title: '商城商品',
},
},
{
path: '/mallManage/produceList',
element: withLoadingComponent(<ProduceListView />),
meta: {
id: 10130,
id: 10150,
icon: <SmileOutlined />,
title: '产品管理',
},
},
{
path: '/mallManage/produceDetail',
element: withLoadingComponent(<ProduceDetailView />),
meta: {
id: 10160,
icon: <SmileOutlined />,
title: '产品详情',
hidden: true,
},
},
{
path: '/mallManage/industryList',
element: withLoadingComponent(<IndustryListView />),
meta: {
id: 10140,
id: 10170,
icon: <SmileOutlined />,
title: '行业方案',
},
},
{
path: '/mallManage/industryDetail',
element: withLoadingComponent(<IndustryDetailView />),
meta: {
id: 10180,
icon: <SmileOutlined />,
title: '行业详情',
hidden: true,
},
},
],
},
{
......
......@@ -9,6 +9,13 @@ export default defineConfig({
plugins: [react(), tsconfigPaths()],
server: {
host: '0.0.0.0',
proxy: {
'/api': {
target: 'https://test.iuav.shop',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
},
},
envDir: resolve(__dirname, 'env'),
resolve: {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论