提交 e0bc6424 作者: 龚洪江

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

上级 746a63de
#请求接口地址 #请求接口地址
#VITE_REQUEST_BASE_URL='https://www.iuav.shop' #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://iuav.mmcuav.cn'
#VITE_REQUEST_BASE_URL='https://test.iuav.mmcuav.cn' #VITE_REQUEST_BASE_URL='https://test.iuav.mmcuav.cn'
......
...@@ -30,4 +30,18 @@ export class ProduceManageAPI { ...@@ -30,4 +30,18 @@ export class ProduceManageAPI {
static editProductSku = (data: unknown) => { static editProductSku = (data: unknown) => {
return axios.post('uavgoods/product/spec/editProductSku', data); 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'; import { limitEntity } from '@/api/modules/role';
function useOptionShow(id: number) { function useOptionShow(id: number) {
// const [show, setShow] = useState<boolean>(false);
return (JSON.parse(localStorage.getItem('routeList') as string) || []).some( return (JSON.parse(localStorage.getItem('routeList') as string) || []).some(
(v: limitEntity) => v.id === id, (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; 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() { ...@@ -23,7 +23,7 @@ function IndustryList() {
// 路由操作 // 路由操作
const navigate = useNavigate(); const navigate = useNavigate();
// 表格数据 // 表格数据
const [tableData, setTableData] = useState<IndustrySkuType[]>([]); const [tableData, setTableData] = useState<any>([{ id: 1 }]);
// 加载中 // 加载中
const [loading, setLoading] = useState<boolean>(false); const [loading, setLoading] = useState<boolean>(false);
// 行业列表 // 行业列表
...@@ -33,7 +33,7 @@ function IndustryList() { ...@@ -33,7 +33,7 @@ function IndustryList() {
// 跳转详情 // 跳转详情
const handleDetail = (record: { id: number }) => { const handleDetail = (record: { id: number }) => {
navigate({ navigate({
pathname: '/goodsManage/industryManage/detail', pathname: '/mallManage/industryDetail',
search: `id=${record.id}`, search: `id=${record.id}`,
}); });
// console.log(record); // console.log(record);
...@@ -69,27 +69,15 @@ function IndustryList() { ...@@ -69,27 +69,15 @@ function IndustryList() {
render: (text: string, record) => { render: (text: string, record) => {
return ( return (
<div> <div>
{btnDetail ? ( <Button type='link' onClick={() => handleDetail(record)}>
<Button type='link' onClick={() => handleDetail(record)}> 详情
详情 </Button>
</Button> <Button type='link' onClick={() => handleEdit(record)}>
) : ( 编辑
'' </Button>
)} <Button type='link' onClick={() => openDeleteModal(record)}>
{btnEdit ? ( 删除
<Button type='link' onClick={() => handleEdit(record)}> </Button>
编辑
</Button>
) : (
''
)}
{btnDelete ? (
<Button type='link' onClick={() => openDeleteModal(record)}>
删除
</Button>
) : (
''
)}
</div> </div>
); );
}, },
...@@ -234,11 +222,11 @@ function IndustryList() { ...@@ -234,11 +222,11 @@ function IndustryList() {
// componentDidMount // componentDidMount
useEffect(() => { useEffect(() => {
query = {}; // query = {};
(async () => { // (async () => {
await getFirstIndustryTypeInfo(); // await getFirstIndustryTypeInfo();
await getTableList(); // await getTableList();
})(); // })();
}, []); }, []);
return ( 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() { ...@@ -24,7 +24,7 @@ function ProduceManage() {
// 路由操作 // 路由操作
const navigate = useNavigate(); const navigate = useNavigate();
// 表格数据 // 表格数据
const [tableData, setTableData] = useState<ProductSkuType[]>([]); const [tableData, setTableData] = useState<any>([{ id: 1 }]);
// 加载中 // 加载中
const [loading, setLoading] = useState<boolean>(false); const [loading, setLoading] = useState<boolean>(false);
// 产品类型下拉列表 // 产品类型下拉列表
...@@ -42,7 +42,7 @@ function ProduceManage() { ...@@ -42,7 +42,7 @@ function ProduceManage() {
// 跳转详情 // 跳转详情
const handleDetail = (record: ProductSkuType) => { const handleDetail = (record: ProductSkuType) => {
navigate({ navigate({
pathname: '/goodsManage/productManage/detail', pathname: '/mallManage/produceDetail',
search: `id=${record.id}`, search: `id=${record.id}`,
}); });
}; };
...@@ -104,27 +104,15 @@ function ProduceManage() { ...@@ -104,27 +104,15 @@ function ProduceManage() {
render: (text: string, record) => { render: (text: string, record) => {
return ( return (
<div> <div>
{btnDetail ? ( <Button type='link' onClick={() => handleDetail(record)}>
<Button type='link' onClick={() => handleDetail(record)}> 详情
详情 </Button>
</Button> <Button type='link' onClick={() => handleEdit(record)}>
) : ( 编辑
'' </Button>
)} <Button type='link' onClick={() => handleDelete(record)}>
{btnEdit ? ( 删除
<Button type='link' onClick={() => handleEdit(record)}> </Button>
编辑
</Button>
) : (
''
)}
{btnDelete ? (
<Button type='link' onClick={() => handleDelete(record)}>
删除
</Button>
) : (
''
)}
</div> </div>
); );
}, },
...@@ -220,12 +208,12 @@ function ProduceManage() { ...@@ -220,12 +208,12 @@ function ProduceManage() {
}; };
// componentDidMount // componentDidMount
useEffect(() => { useEffect(() => {
query = {}; // query = {};
getMakeList(); // getMakeList();
getDescList(); // getDescList();
(async () => { // (async () => {
await getTableList(); // await getTableList();
})(); // })();
}, []); }, []);
return ( 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'; ...@@ -36,18 +36,25 @@ import CustomMoneyView from '~/pages/customManage/customMoney';
import CustomMoneyDetail from '~/pages/customManage/customMoney/detail'; import CustomMoneyDetail from '~/pages/customManage/customMoney/detail';
// 活动 // 活动
const ActivityList = React.lazy(() => import('src/pages/activityManage/activityList')); //活动管理 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( const ServiceDetailView = React.lazy(
() => import('~/pages/mallManage/serviceManage/serviceDetail'), () => import('~/pages/mallManage/serviceManage/serviceDetail'),
); ); //服务详情
const ServiceIntroduceView = React.lazy( const ServiceIntroduceView = React.lazy(
() => import('~/pages/mallManage/serviceManage/serviceIntroduce'), () => import('~/pages/mallManage/serviceManage/serviceIntroduce'),
); ); //服务介绍
// 产品 const RentListView = React.lazy(() => import('~/pages/mallManage/rentGoods/rentList')); //租赁列表
const ProduceListView = React.lazy(() => import('~/pages/mallManage/produceManage/produceList')); const MallGoodsView = React.lazy(() => import('~/pages/mallManage/mallGoods/goodsList')); //商城商品
// 行业 const ProduceListView = React.lazy(() => import('~/pages/mallManage/produceManage/produceList')); //产品列表
const IndustryListView = React.lazy(() => import('~/pages/mallManage/industryManage/industryList')); 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')); //销售订单 const ProductOrderView = React.lazy(() => import('src/pages/orderManage/productOrder')); //销售订单
...@@ -202,23 +209,61 @@ export const routerList: Array<RouteObjectType> = [ ...@@ -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', path: '/mallManage/produceList',
element: withLoadingComponent(<ProduceListView />), element: withLoadingComponent(<ProduceListView />),
meta: { meta: {
id: 10130, id: 10150,
icon: <SmileOutlined />, icon: <SmileOutlined />,
title: '产品管理', title: '产品管理',
}, },
}, },
{ {
path: '/mallManage/produceDetail',
element: withLoadingComponent(<ProduceDetailView />),
meta: {
id: 10160,
icon: <SmileOutlined />,
title: '产品详情',
hidden: true,
},
},
{
path: '/mallManage/industryList', path: '/mallManage/industryList',
element: withLoadingComponent(<IndustryListView />), element: withLoadingComponent(<IndustryListView />),
meta: { meta: {
id: 10140, id: 10170,
icon: <SmileOutlined />, icon: <SmileOutlined />,
title: '行业方案', title: '行业方案',
}, },
}, },
{
path: '/mallManage/industryDetail',
element: withLoadingComponent(<IndustryDetailView />),
meta: {
id: 10180,
icon: <SmileOutlined />,
title: '行业详情',
hidden: true,
},
},
], ],
}, },
{ {
......
...@@ -9,6 +9,13 @@ export default defineConfig({ ...@@ -9,6 +9,13 @@ export default defineConfig({
plugins: [react(), tsconfigPaths()], plugins: [react(), tsconfigPaths()],
server: { server: {
host: '0.0.0.0', host: '0.0.0.0',
proxy: {
'/api': {
target: 'https://test.iuav.shop',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
},
}, },
envDir: resolve(__dirname, 'env'), envDir: resolve(__dirname, 'env'),
resolve: { resolve: {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论