@lxzy/code-snippet 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +16 -0
- package/.gitignore +17 -0
- package/.opencode/commands/push-yw.md +8 -0
- package/.prettierrc +11 -0
- package/AGENTS.md +28 -0
- package/README.md +15 -0
- package/index.html +12 -0
- package/mock/activity.ts +306 -0
- package/opencode.json +11 -0
- package/package.json +78 -27
- package/public/cdn/antd.min.css +10 -0
- package/public/cdn/antd.min.js +26 -0
- package/public/cdn/axios.min.js +3 -0
- package/public/cdn/lodash.min.js +140 -0
- package/public/cdn/moment.min.js +2 -0
- package/public/cdn/react-dom.development.min.js +1 -0
- package/public/cdn/react-dom.production.min.js +245 -0
- package/public/cdn/react.development.min.js +1 -0
- package/public/cdn/react.production.min.js +31 -0
- package/src/App.tsx +34 -0
- package/src/global.css +44 -0
- package/src/layouts/index.tsx +50 -0
- package/src/main.tsx +11 -0
- package/src/pages/404.tsx +5 -0
- package/src/pages/activityCenter/activitySystemManagement/add.tsx +209 -0
- package/src/pages/activityCenter/activitySystemManagement/addPages/components/ChannelLinkModal.tsx +167 -0
- package/src/pages/activityCenter/activitySystemManagement/addPages/components/CustomLink.tsx +41 -0
- package/src/pages/activityCenter/activitySystemManagement/addPages/components/CustomPage.tsx +79 -0
- package/src/pages/activityCenter/activitySystemManagement/addPages/components/SystemPage.tsx +40 -0
- package/src/pages/activityCenter/activitySystemManagement/addPages/index.tsx +32 -0
- package/src/pages/activityCenter/activitySystemManagement/index.tsx +195 -0
- package/tsconfig.json +23 -0
- package/typings.d.ts +10 -0
- package/vite.config.ts +32 -0
- package/public/extensions.rar +0 -0
- package/public/wetype_installer_official_p_48.exe +0 -0
- /package/{src/index.tsx → mock/.gitkeep} +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Button } from 'antd';
|
|
3
|
+
import ProTable from '@ant-design/pro-table';
|
|
4
|
+
import axios from 'axios';
|
|
5
|
+
import ChannelLinkModal from './ChannelLinkModal';
|
|
6
|
+
|
|
7
|
+
const CustomPage: React.FC = () => {
|
|
8
|
+
const [channelLinkVisible, setChannelLinkVisible] = useState(false);
|
|
9
|
+
const [currentPage, setCurrentPage] = useState<any>(null);
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<div>
|
|
13
|
+
<ProTable
|
|
14
|
+
headerTitle={false}
|
|
15
|
+
search={{ labelWidth: 'auto' }}
|
|
16
|
+
toolBarRender={() => [
|
|
17
|
+
<Button key="relate" type="primary">关联自定义页面</Button>,
|
|
18
|
+
<Button key="add" type="primary">新建页面</Button>,
|
|
19
|
+
]}
|
|
20
|
+
rowKey="id"
|
|
21
|
+
request={async (params) => {
|
|
22
|
+
const { data: result } = await axios.get('/api/activity/customPageList', { params });
|
|
23
|
+
return { data: result.data.list, total: result.data.total, success: result.success };
|
|
24
|
+
}}
|
|
25
|
+
columns={[
|
|
26
|
+
{ title: '页面名称', dataIndex: 'name' },
|
|
27
|
+
{ title: '页面路径', dataIndex: 'path' },
|
|
28
|
+
{ title: '状态', dataIndex: 'status' },
|
|
29
|
+
{ title: '关联活动', dataIndex: 'activity' },
|
|
30
|
+
{ title: '是否可分享', dataIndex: 'canShare', render: (_, record) => (record.canShare ? '是' : '否') },
|
|
31
|
+
{ title: '最近更新时间', dataIndex: 'updateTime' },
|
|
32
|
+
{
|
|
33
|
+
title: '操作',
|
|
34
|
+
valueType: 'option',
|
|
35
|
+
width: 300,
|
|
36
|
+
render: (_, record) => (
|
|
37
|
+
<>
|
|
38
|
+
<Button type="link" size="small">详情</Button>
|
|
39
|
+
<Button type="link" size="small">编辑</Button>
|
|
40
|
+
{record.status === '已通过' && <Button type="link" size="small">复制</Button>}
|
|
41
|
+
<Button type="link" danger size="small">删除</Button>
|
|
42
|
+
{record.status === '已通过' ? (
|
|
43
|
+
<Button
|
|
44
|
+
type="link"
|
|
45
|
+
size="small"
|
|
46
|
+
onClick={() => {
|
|
47
|
+
setCurrentPage(record);
|
|
48
|
+
setChannelLinkVisible(true);
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
设置渠道链接
|
|
52
|
+
</Button>
|
|
53
|
+
) : (
|
|
54
|
+
<Button type="link" size="small">提审</Button>
|
|
55
|
+
)}
|
|
56
|
+
</>
|
|
57
|
+
),
|
|
58
|
+
},
|
|
59
|
+
]}
|
|
60
|
+
pagination={false}
|
|
61
|
+
options={false}
|
|
62
|
+
/>
|
|
63
|
+
|
|
64
|
+
{channelLinkVisible && (
|
|
65
|
+
<ChannelLinkModal
|
|
66
|
+
visible={channelLinkVisible}
|
|
67
|
+
pageName={currentPage?.name || ''}
|
|
68
|
+
pageId={currentPage?.id}
|
|
69
|
+
onClose={() => {
|
|
70
|
+
setChannelLinkVisible(false);
|
|
71
|
+
setCurrentPage(null);
|
|
72
|
+
}}
|
|
73
|
+
/>
|
|
74
|
+
)}
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export default CustomPage;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button } from 'antd';
|
|
3
|
+
import ProTable from '@ant-design/pro-table';
|
|
4
|
+
import axios from 'axios';
|
|
5
|
+
|
|
6
|
+
const SystemPage: React.FC = () => {
|
|
7
|
+
return (
|
|
8
|
+
<div>
|
|
9
|
+
<ProTable
|
|
10
|
+
headerTitle={false}
|
|
11
|
+
search={{ labelWidth: 'auto' }}
|
|
12
|
+
toolBarRender={() => [
|
|
13
|
+
<Button key="add" type="primary">
|
|
14
|
+
关联系统页面
|
|
15
|
+
</Button>,
|
|
16
|
+
]}
|
|
17
|
+
rowKey="id"
|
|
18
|
+
request={async (params) => {
|
|
19
|
+
const { data: result } = await axios.get('/api/activity/systemPageList', { params });
|
|
20
|
+
return { data: result.data.list, total: result.data.total, success: result.success };
|
|
21
|
+
}}
|
|
22
|
+
columns={[
|
|
23
|
+
{ title: '页面名称', dataIndex: 'name' },
|
|
24
|
+
{ title: '页面路径', dataIndex: 'path' },
|
|
25
|
+
{ title: '状态', dataIndex: 'status' },
|
|
26
|
+
{ title: '最近更新时间', dataIndex: 'updateTime' },
|
|
27
|
+
{
|
|
28
|
+
title: '操作',
|
|
29
|
+
valueType: 'option',
|
|
30
|
+
render: () => <Button type="primary" danger size="small">删除</Button>,
|
|
31
|
+
},
|
|
32
|
+
]}
|
|
33
|
+
pagination={false}
|
|
34
|
+
options={false}
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default SystemPage;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { PageContainer } from '@ant-design/pro-layout';
|
|
3
|
+
import SystemPage from './components/SystemPage';
|
|
4
|
+
import CustomPage from './components/CustomPage';
|
|
5
|
+
import CustomLink from './components/CustomLink';
|
|
6
|
+
|
|
7
|
+
const AddPages: React.FC = () => {
|
|
8
|
+
const [activeTab, setActiveTab] = useState('system');
|
|
9
|
+
|
|
10
|
+
const tabContent = {
|
|
11
|
+
system: <SystemPage />,
|
|
12
|
+
custom: <CustomPage />,
|
|
13
|
+
link: <CustomLink />,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<PageContainer
|
|
18
|
+
title="春季内购会"
|
|
19
|
+
tabList={[
|
|
20
|
+
{ tab: '系统页面', key: 'system' },
|
|
21
|
+
{ tab: '自定义页面', key: 'custom' },
|
|
22
|
+
{ tab: '自定义链接', key: 'link' },
|
|
23
|
+
]}
|
|
24
|
+
tabActiveKey={activeTab}
|
|
25
|
+
onTabChange={(key) => setActiveTab(key)}
|
|
26
|
+
>
|
|
27
|
+
{tabContent[activeTab]}
|
|
28
|
+
</PageContainer>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default AddPages;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import React, { useRef, useState } from 'react';
|
|
2
|
+
import { Button, DatePicker, message, Modal, Select, Space } from 'antd';
|
|
3
|
+
import ProTable, { ActionType } from '@ant-design/pro-table';
|
|
4
|
+
import { useNavigate } from 'react-router-dom';
|
|
5
|
+
import axios from 'axios';
|
|
6
|
+
import AddDrawer from './add';
|
|
7
|
+
|
|
8
|
+
const ipTagOptions = ['品牌A', '品牌B', '品牌C', '品牌D'];
|
|
9
|
+
|
|
10
|
+
const ActivitySystemManagement = () => {
|
|
11
|
+
const navigate = useNavigate();
|
|
12
|
+
const actionRef = useRef<ActionType>();
|
|
13
|
+
const [drawerVisible, setDrawerVisible] = useState(false);
|
|
14
|
+
const [editingItem, setEditingItem] = useState(null);
|
|
15
|
+
|
|
16
|
+
const handleAdd = () => {
|
|
17
|
+
setEditingItem(null);
|
|
18
|
+
setDrawerVisible(true);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const handleEdit = (record) => {
|
|
22
|
+
setEditingItem(record);
|
|
23
|
+
setDrawerVisible(true);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const handleDelete = (record) => {
|
|
27
|
+
Modal.confirm({
|
|
28
|
+
title: '确认删除',
|
|
29
|
+
content: `确定要删除活动「${record.name}」吗?`,
|
|
30
|
+
onOk: async () => {
|
|
31
|
+
await axios.post('/api/activity/delete', { id: record.id });
|
|
32
|
+
message.success('删除成功');
|
|
33
|
+
actionRef.current?.reload();
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<>
|
|
40
|
+
<ProTable
|
|
41
|
+
headerTitle="活动系统管理"
|
|
42
|
+
options={false}
|
|
43
|
+
actionRef={actionRef}
|
|
44
|
+
rowKey="id"
|
|
45
|
+
search={{
|
|
46
|
+
labelWidth: 'auto',
|
|
47
|
+
defaultCollapsed: false,
|
|
48
|
+
}}
|
|
49
|
+
toolBarRender={() => [
|
|
50
|
+
<Button key="add" type="primary" onClick={handleAdd}>
|
|
51
|
+
新建活动
|
|
52
|
+
</Button>,
|
|
53
|
+
]}
|
|
54
|
+
request={async (params) => {
|
|
55
|
+
const { data: result } = await axios.get('/api/activity/list', {
|
|
56
|
+
params,
|
|
57
|
+
});
|
|
58
|
+
return {
|
|
59
|
+
data: result.data.list,
|
|
60
|
+
total: result.data.total,
|
|
61
|
+
success: result.success,
|
|
62
|
+
};
|
|
63
|
+
}}
|
|
64
|
+
columns={[
|
|
65
|
+
{ title: '活动id', dataIndex: 'id', search: false, width: 80 },
|
|
66
|
+
{
|
|
67
|
+
title: '活动名称',
|
|
68
|
+
dataIndex: 'name',
|
|
69
|
+
fieldProps: { placeholder: '请输入' },
|
|
70
|
+
width: 160,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
title: '活动时间范围',
|
|
74
|
+
dataIndex: 'timeRange',
|
|
75
|
+
search: false,
|
|
76
|
+
width: 220,
|
|
77
|
+
render: (_, record) => (
|
|
78
|
+
<div>
|
|
79
|
+
<div>{record.startTime}</div>
|
|
80
|
+
<div>{record.endTime}</div>
|
|
81
|
+
</div>
|
|
82
|
+
),
|
|
83
|
+
},
|
|
84
|
+
{ title: '板块', dataIndex: 'section', search: false, width: 140 },
|
|
85
|
+
{
|
|
86
|
+
title: '活动状态',
|
|
87
|
+
dataIndex: 'status',
|
|
88
|
+
search: false,
|
|
89
|
+
width: 100,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
title: '活动开始时间',
|
|
93
|
+
dataIndex: 'startTime',
|
|
94
|
+
hideInTable: true,
|
|
95
|
+
renderFormItem: () => (
|
|
96
|
+
<DatePicker
|
|
97
|
+
showTime
|
|
98
|
+
style={{ width: '100%' }}
|
|
99
|
+
placeholder="请选择"
|
|
100
|
+
/>
|
|
101
|
+
),
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
title: '活动结束时间',
|
|
105
|
+
dataIndex: 'endTime',
|
|
106
|
+
hideInTable: true,
|
|
107
|
+
renderFormItem: () => (
|
|
108
|
+
<DatePicker
|
|
109
|
+
showTime
|
|
110
|
+
style={{ width: '100%' }}
|
|
111
|
+
placeholder="请选择"
|
|
112
|
+
/>
|
|
113
|
+
),
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
title: '所属板块',
|
|
117
|
+
dataIndex: 'section',
|
|
118
|
+
hideInTable: true,
|
|
119
|
+
fieldProps: { placeholder: '请输入' },
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
title: 'ip标签',
|
|
123
|
+
dataIndex: 'ipTag',
|
|
124
|
+
hideInTable: true,
|
|
125
|
+
renderFormItem: () => (
|
|
126
|
+
<Select
|
|
127
|
+
mode="multiple"
|
|
128
|
+
placeholder="请选择"
|
|
129
|
+
options={ipTagOptions.map((t) => ({ label: t, value: t }))}
|
|
130
|
+
/>
|
|
131
|
+
),
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
title: '其他标签',
|
|
135
|
+
dataIndex: 'otherTag',
|
|
136
|
+
hideInTable: true,
|
|
137
|
+
fieldProps: { placeholder: '请输入' },
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
title: '创建时间',
|
|
141
|
+
dataIndex: 'createTime',
|
|
142
|
+
search: false,
|
|
143
|
+
width: 180,
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
title: '操作',
|
|
147
|
+
valueType: 'option',
|
|
148
|
+
width: 220,
|
|
149
|
+
render: (_, record) => (
|
|
150
|
+
<Space>
|
|
151
|
+
<Button
|
|
152
|
+
type="link"
|
|
153
|
+
size="small"
|
|
154
|
+
onClick={() => handleEdit(record)}
|
|
155
|
+
>
|
|
156
|
+
编辑
|
|
157
|
+
</Button>
|
|
158
|
+
<Button
|
|
159
|
+
type="link"
|
|
160
|
+
size="small"
|
|
161
|
+
onClick={() => navigate('/activityCenter/activitySystemManagement/addPages')}
|
|
162
|
+
>
|
|
163
|
+
添加页面
|
|
164
|
+
</Button>
|
|
165
|
+
<Button
|
|
166
|
+
type="link"
|
|
167
|
+
size="small"
|
|
168
|
+
danger
|
|
169
|
+
onClick={() => handleDelete(record)}
|
|
170
|
+
>
|
|
171
|
+
删除
|
|
172
|
+
</Button>
|
|
173
|
+
</Space>
|
|
174
|
+
),
|
|
175
|
+
},
|
|
176
|
+
]}
|
|
177
|
+
/>
|
|
178
|
+
<AddDrawer
|
|
179
|
+
visible={drawerVisible}
|
|
180
|
+
editingItem={editingItem}
|
|
181
|
+
onClose={() => {
|
|
182
|
+
setDrawerVisible(false);
|
|
183
|
+
setEditingItem(null);
|
|
184
|
+
}}
|
|
185
|
+
onSuccess={() => {
|
|
186
|
+
setDrawerVisible(false);
|
|
187
|
+
setEditingItem(null);
|
|
188
|
+
actionRef.current?.reload();
|
|
189
|
+
}}
|
|
190
|
+
/>
|
|
191
|
+
</>
|
|
192
|
+
);
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
export default ActivitySystemManagement;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "esnext",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"resolveJsonModule": true,
|
|
7
|
+
"importHelpers": true,
|
|
8
|
+
"jsx": "react-jsx",
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"sourceMap": true,
|
|
11
|
+
"baseUrl": "./",
|
|
12
|
+
"strict": false,
|
|
13
|
+
"noImplicitAny": false,
|
|
14
|
+
"paths": {
|
|
15
|
+
"@/*": ["src/*"]
|
|
16
|
+
},
|
|
17
|
+
"allowSyntheticDefaultImports": true,
|
|
18
|
+
"skipLibCheck": true,
|
|
19
|
+
"types": ["node"]
|
|
20
|
+
},
|
|
21
|
+
"include": ["mock/**/*", "src/**/*", "typings.d.ts", "vite.*.ts"],
|
|
22
|
+
"exclude": ["node_modules", "lib", "es", "dist", "typings"]
|
|
23
|
+
}
|
package/typings.d.ts
ADDED
package/vite.config.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
import { viteMockServe } from 'vite-plugin-mock';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
|
|
6
|
+
export default defineConfig(({ command }) => ({
|
|
7
|
+
plugins: [
|
|
8
|
+
react(),
|
|
9
|
+
viteMockServe({
|
|
10
|
+
mockPath: 'mock',
|
|
11
|
+
enable: command === 'serve',
|
|
12
|
+
}),
|
|
13
|
+
],
|
|
14
|
+
resolve: {
|
|
15
|
+
alias: {
|
|
16
|
+
'@': path.resolve(__dirname, './src'),
|
|
17
|
+
'~antd': path.resolve(__dirname, './node_modules/antd'),
|
|
18
|
+
},
|
|
19
|
+
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json'],
|
|
20
|
+
},
|
|
21
|
+
css: {
|
|
22
|
+
preprocessorOptions: {
|
|
23
|
+
less: {
|
|
24
|
+
javascriptEnabled: true,
|
|
25
|
+
math: 'always',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
server: {
|
|
30
|
+
port: 8000,
|
|
31
|
+
},
|
|
32
|
+
}));
|
package/public/extensions.rar
DELETED
|
Binary file
|
|
Binary file
|
|
File without changes
|