소스 검색

提交

master
gwbvipvip 8 달 전
부모
커밋
4eb0ce7156
6개의 변경된 파일105개의 추가작업 그리고 26개의 파일을 삭제
  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 파일 보기

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


+ 1
- 1
src/global_data.js 파일 보기

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

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



+ 26
- 4
src/pages/authorization/platformAuthorization/index.jsx 파일 보기

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

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

const actionRef = useRef();
@@ -34,16 +34,17 @@ const App = () => {
dataIndex: 'key',
valueType: 'textarea',
search: false,
width:300,
render: (text) => <Paragraph style={{ display: 'inline' }} copyable>{text}</Paragraph>,
},
{
title: '有效日期',
dataIndex: 'periodValidity',
valueType: 'textarea',
width:200,
search: false,
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 });
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 파일 보기

@@ -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 파일 보기

@@ -1,5 +1,5 @@
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 { PlusOutlined } from '@ant-design/icons';
import ProTable from '@ant-design/pro-table';
@@ -12,13 +12,14 @@ dayjs.extend(localeData);
const dateFormat = 'YYYY/MM/DD';
const { Paragraph, Text } = Typography;

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

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

//初始化数据
useEffect(() => {
@@ -51,32 +52,36 @@ const App = () => {
tip: '规则名称是唯一的 key'
},
{
title: '授权码',
dataIndex: 'key',
title: '店铺',
dataIndex: 'storeName',
valueType: 'textarea',
width:200,
search: false,
render: (text) => <Paragraph style={{ display: 'inline' }} copyable>{text}</Paragraph>,
},
{
title: '店铺',
dataIndex: 'storeName',
title: '授权码',
dataIndex: 'key',
valueType: 'textarea',
search: false,
render: (text) => <Paragraph style={{ display: 'inline' }} copyable>{text}</Paragraph>,
},
{
title: '有效日期',
dataIndex: 'periodValidity',
valueType: 'textarea',
valueType: 'date',
width:150,
search: false,
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: '修改时间',
dataIndex: 'updateAt',
valueType: 'textarea',
width: 200,
width: 150,
search: false
},
{
@@ -84,7 +89,7 @@ const App = () => {
dataIndex: 'option',
valueType: 'option',
fixed: 'right',
width: 450,
width: 250,
render: (_, record) => [
<Popconfirm
type="primary"
@@ -105,7 +110,36 @@ const App = () => {
}}
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>,

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

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

} else {
AddAuthorization(values).then((r) => {
AddStoreAuthorization(values).then((r) => {
if (r.statusCode == 200 && r.data) {
message.success("添加成功");
actionRef.current.reload();
@@ -185,11 +219,9 @@ const App = () => {
<Form.Item name="id" hidden={true}>
<Input />
</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 name="autho" label="授权时间" rules={[{ required: true, }]} >
<Radio.Group >
<Radio value="cqyx"> 长期有效 </Radio>


+ 11
- 0
src/pages/authorization/storeAuthorization/services.js 파일 보기

@@ -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) {


불러오는 중...
취소
저장