Bläddra i källkod

提交

master
gwbvipvip 6 månader sedan
förälder
incheckning
4eb0ce7156
6 ändrade filer med 105 tillägg och 26 borttagningar
  1. +9
    -1
      config/proxy.js
  2. +1
    -1
      src/global_data.js
  3. +26
    -4
      src/pages/authorization/platformAuthorization/index.jsx
  4. +8
    -2
      src/pages/authorization/platformAuthorization/services.js
  5. +50
    -18
      src/pages/authorization/storeAuthorization/index.jsx
  6. +11
    -0
      src/pages/authorization/storeAuthorization/services.js

+ 9
- 1
config/proxy.js Visa fil

@@ -9,13 +9,21 @@
export default { export default {
dev: { dev: {
'/kitchbase/': { '/kitchbase/': {
target: 'http://localhost:5006/',
target: 'http://localhost:5009/',
changeOrigin: true, changeOrigin: true,
secure: false, //关闭证书验证 secure: false, //关闭证书验证
pathRewrite: { pathRewrite: {
'/kitchbase/': '', '/kitchbase/': '',
}, },
}, },
'/kitchorder/': {
target: 'http://localhost:5007',
changeOrigin: true,
secure: false, //关闭证书验证
pathRewrite: {
'/kitchorder/': '',
},
},
// Nginx发布的时候需要配置 // Nginx发布的时候需要配置
'/cos/':{ '/cos/':{
target: 'https://hbl-test-1305371387.cos.ap-chengdu.myqcloud.com', target: 'https://hbl-test-1305371387.cos.ap-chengdu.myqcloud.com',


+ 1
- 1
src/global_data.js Visa fil

@@ -10,7 +10,7 @@ export function getDataBaseUrl() {
} }


export function GetkitchbaseUrl() { export function GetkitchbaseUrl() {
return '/kitchbase';
return '/kitchorder';
} }





+ 26
- 4
src/pages/authorization/platformAuthorization/index.jsx Visa fil

@@ -11,7 +11,7 @@ dayjs.extend(localeData);
const dateFormat = 'YYYY/MM/DD'; const dateFormat = 'YYYY/MM/DD';
const { Paragraph, Text } = Typography; const { Paragraph, Text } = Typography;


import { PageAuthorization, AddAuthorization, UpdateAuthorization, UpdateAuthTime } from "./services"
import { PageAuthorization, AddAuthorization, UpdateAuthorization, UpdateAuthTime,DelAuthorization } from "./services"
const App = () => { const App = () => {


const actionRef = useRef(); const actionRef = useRef();
@@ -34,16 +34,17 @@ const App = () => {
dataIndex: 'key', dataIndex: 'key',
valueType: 'textarea', valueType: 'textarea',
search: false, search: false,
width:300,
render: (text) => <Paragraph style={{ display: 'inline' }} copyable>{text}</Paragraph>, render: (text) => <Paragraph style={{ display: 'inline' }} copyable>{text}</Paragraph>,
}, },
{ {
title: '有效日期', title: '有效日期',
dataIndex: 'periodValidity', dataIndex: 'periodValidity',
valueType: 'textarea', valueType: 'textarea',
width:200,
search: false, search: false,
render: (_, record) => { render: (_, record) => {
return <span>{record.periodValidity == null ? "长期有效" : record.periodValidity}</span>
var time=dayjs(record.periodValidity, dateFormat).format('YYYY-MM-DD');
return <span>{record.periodValidity == null ? "长期有效" : time}</span>
} }
}, },
{ {
@@ -87,7 +88,28 @@ const App = () => {
form.setFieldsValue({ id: record.id, autho:aa, periodValidity: time }); form.setFieldsValue({ id: record.id, autho:aa, periodValidity: time });
handleModalVisible(true); handleModalVisible(true);
}}>更新授权时间</a>
}}>更新授权时间</a>,
<Popconfirm
type="primary"
key="primary"
title="确认删除吗?"
okText="是"
cancelText="否"
onConfirm={() => {
DelAuthorization(record.id).then((r) => {
if (r.statusCode == 200 && r.data) {
actionRef.current.reload();
message.success("删除成功");
} else {
message.error(r.errors || "删除失败");
}
});
}}
onCancel={() => { }}
>
<a href="#">删除</a>
</Popconfirm>


], ],
}, },


+ 8
- 2
src/pages/authorization/platformAuthorization/services.js Visa fil

@@ -34,6 +34,12 @@ export async function UpdateAuthorization(data) {
}); });
} }
/** 删除授权码 */
export async function DelAuthorization(data) {
return request(getDataBaseUrl()+`/api/authorization/delauthorization?id=`+data, {
method: 'POST',
data: data,
});
}





+ 50
- 18
src/pages/authorization/storeAuthorization/index.jsx Visa fil

@@ -1,5 +1,5 @@
import React, { useState, useRef, useEffect } from 'react'; import React, { useState, useRef, useEffect } from 'react';
import { Modal, Button, message, Popconfirm, Typography, Select } from 'antd';
import { Modal, Button, message, Popconfirm, Typography, Select,Form,Input,Radio,DatePicker} from 'antd';
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import ProTable from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table';
@@ -12,13 +12,14 @@ dayjs.extend(localeData);
const dateFormat = 'YYYY/MM/DD'; const dateFormat = 'YYYY/MM/DD';
const { Paragraph, Text } = Typography; const { Paragraph, Text } = Typography;


import { PageStoreAuthorization, AddStoreAuthorization, UpdateStoreAuthorization, UpdateStoreAuthTime, GetStoreList } from "./services"
import { PageStoreAuthorization, AddStoreAuthorization, UpdateStoreAuthorization, UpdateStoreAuthTime, GetStoreList,DelStoreAuthTime } from "./services"
const App = () => { const App = () => {


const actionRef = useRef(); const actionRef = useRef();
const [ModalVisible, handleModalVisible] = useState(false); const [ModalVisible, handleModalVisible] = useState(false);
const [currentRow, setCurrentRow] = useState(); const [currentRow, setCurrentRow] = useState();
const [storeList, setStoreList] = useState([]); const [storeList, setStoreList] = useState([]);
const [form] = Form.useForm();


//初始化数据 //初始化数据
useEffect(() => { useEffect(() => {
@@ -51,32 +52,36 @@ const App = () => {
tip: '规则名称是唯一的 key' tip: '规则名称是唯一的 key'
}, },
{ {
title: '授权码',
dataIndex: 'key',
title: '店铺',
dataIndex: 'storeName',
valueType: 'textarea', valueType: 'textarea',
width:200,
search: false, search: false,
render: (text) => <Paragraph style={{ display: 'inline' }} copyable>{text}</Paragraph>,
}, },
{ {
title: '店铺',
dataIndex: 'storeName',
title: '授权码',
dataIndex: 'key',
valueType: 'textarea', valueType: 'textarea',
search: false, search: false,
render: (text) => <Paragraph style={{ display: 'inline' }} copyable>{text}</Paragraph>,
}, },
{ {
title: '有效日期', title: '有效日期',
dataIndex: 'periodValidity', dataIndex: 'periodValidity',
valueType: 'textarea',
valueType: 'date',
width:150,
search: false, search: false,
render: (_, record) => { render: (_, record) => {
return <span>{record.periodValidity == null ? "长期有效" : record.periodValidity}</span>
var time=dayjs(record.periodValidity, dateFormat).format('YYYY-MM-DD');
return <span>{record.periodValidity == null ? "长期有效" : time}</span>
} }
}, },
{ {
title: '修改时间', title: '修改时间',
dataIndex: 'updateAt', dataIndex: 'updateAt',
valueType: 'textarea', valueType: 'textarea',
width: 200,
width: 150,
search: false search: false
}, },
{ {
@@ -84,7 +89,7 @@ const App = () => {
dataIndex: 'option', dataIndex: 'option',
valueType: 'option', valueType: 'option',
fixed: 'right', fixed: 'right',
width: 450,
width: 250,
render: (_, record) => [ render: (_, record) => [
<Popconfirm <Popconfirm
type="primary" type="primary"
@@ -105,7 +110,36 @@ const App = () => {
}} }}
onCancel={() => { }} onCancel={() => { }}
> >
<a href="#">更新</a>
<a href="#">更新授权码</a>
</Popconfirm>,
<a href="#" onClick={() => {
setCurrentRow(record);
var aa = record.periodValidity == null ? "cqyx" : "gdsj";
var time=record.periodValidity == null ?null:dayjs(record.periodValidity, dateFormat);
form.setFieldsValue({ id: record.id, autho:aa, periodValidity: time,storeId:record.storeId });
handleModalVisible(true);
}}>更新授权时间</a>,
<Popconfirm
type="primary"
key="primary"
title="确认删除吗?"
okText="是"
cancelText="否"
onConfirm={async () => {
await DelStoreAuthTime(record.id).then((r) => {
if (r.statusCode == 200 && r.data) {
message.success("删除成功");
actionRef.current.reload();

} else {
message.error(r.errors || "删除失败");
}
});
}}
onCancel={() => { }}
>
<a href="#">删除</a>
</Popconfirm>, </Popconfirm>,


], ],
@@ -155,7 +189,7 @@ const App = () => {


<Form form={form} onFinish={(values) => { <Form form={form} onFinish={(values) => {
if (values.id) { if (values.id) {
UpdateAuthTime(values).then((r) => {
UpdateStoreAuthTime(values).then((r) => {
if (r.statusCode == 200 && r.data) { if (r.statusCode == 200 && r.data) {
message.success("修改成功"); message.success("修改成功");
actionRef.current.reload(); actionRef.current.reload();
@@ -167,7 +201,7 @@ const App = () => {
}); });


} else { } else {
AddAuthorization(values).then((r) => {
AddStoreAuthorization(values).then((r) => {
if (r.statusCode == 200 && r.data) { if (r.statusCode == 200 && r.data) {
message.success("添加成功"); message.success("添加成功");
actionRef.current.reload(); actionRef.current.reload();
@@ -185,11 +219,9 @@ const App = () => {
<Form.Item name="id" hidden={true}> <Form.Item name="id" hidden={true}>
<Input /> <Input />
</Form.Item> </Form.Item>
<Form.Item name="id" hidden={true}>
<Select style={{ width: 470, }} onChange={(value) => { setCurrentRow(value); }} options={storeList} />
<Form.Item name="storeId" label="店铺" rules={[{ required: true, }]}>
<Select style={{ width: 330, }} onChange={(value) => { setCurrentRow(value); }} options={storeList} />
</Form.Item> </Form.Item>


<Form.Item name="autho" label="授权时间" rules={[{ required: true, }]} > <Form.Item name="autho" label="授权时间" rules={[{ required: true, }]} >
<Radio.Group > <Radio.Group >
<Radio value="cqyx"> 长期有效 </Radio> <Radio value="cqyx"> 长期有效 </Radio>


+ 11
- 0
src/pages/authorization/storeAuthorization/services.js Visa fil

@@ -34,6 +34,17 @@ export async function UpdateStoreAuthorization(data) {
}); });
} }


/** 删除店铺授权码 */
export async function DelStoreAuthTime(data) {
return request(GetkitchbaseUrl()+`/api/authorization/delstoreauthorization?id=`+data, {
method: 'POST',
data: data,
});
}





/** 获取店铺列表 */ /** 获取店铺列表 */
export async function GetStoreList(data) { export async function GetStoreList(data) {


Laddar…
Avbryt
Spara