@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.
Files changed (37) hide show
  1. package/.editorconfig +16 -0
  2. package/.gitignore +17 -0
  3. package/.opencode/commands/push-yw.md +8 -0
  4. package/.prettierrc +11 -0
  5. package/AGENTS.md +28 -0
  6. package/README.md +15 -0
  7. package/index.html +12 -0
  8. package/mock/activity.ts +306 -0
  9. package/opencode.json +11 -0
  10. package/package.json +78 -27
  11. package/public/cdn/antd.min.css +10 -0
  12. package/public/cdn/antd.min.js +26 -0
  13. package/public/cdn/axios.min.js +3 -0
  14. package/public/cdn/lodash.min.js +140 -0
  15. package/public/cdn/moment.min.js +2 -0
  16. package/public/cdn/react-dom.development.min.js +1 -0
  17. package/public/cdn/react-dom.production.min.js +245 -0
  18. package/public/cdn/react.development.min.js +1 -0
  19. package/public/cdn/react.production.min.js +31 -0
  20. package/src/App.tsx +34 -0
  21. package/src/global.css +44 -0
  22. package/src/layouts/index.tsx +50 -0
  23. package/src/main.tsx +11 -0
  24. package/src/pages/404.tsx +5 -0
  25. package/src/pages/activityCenter/activitySystemManagement/add.tsx +209 -0
  26. package/src/pages/activityCenter/activitySystemManagement/addPages/components/ChannelLinkModal.tsx +167 -0
  27. package/src/pages/activityCenter/activitySystemManagement/addPages/components/CustomLink.tsx +41 -0
  28. package/src/pages/activityCenter/activitySystemManagement/addPages/components/CustomPage.tsx +79 -0
  29. package/src/pages/activityCenter/activitySystemManagement/addPages/components/SystemPage.tsx +40 -0
  30. package/src/pages/activityCenter/activitySystemManagement/addPages/index.tsx +32 -0
  31. package/src/pages/activityCenter/activitySystemManagement/index.tsx +195 -0
  32. package/tsconfig.json +23 -0
  33. package/typings.d.ts +10 -0
  34. package/vite.config.ts +32 -0
  35. package/public/extensions.rar +0 -0
  36. package/public/wetype_installer_official_p_48.exe +0 -0
  37. /package/{src/index.tsx → mock/.gitkeep} +0 -0
package/.editorconfig ADDED
@@ -0,0 +1,16 @@
1
+ # http://editorconfig.org
2
+ root = true
3
+
4
+ [*]
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ charset = utf-8
9
+ trim_trailing_whitespace = true
10
+ insert_final_newline = true
11
+
12
+ [*.md]
13
+ trim_trailing_whitespace = false
14
+
15
+ [Makefile]
16
+ indent_style = tab
package/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
+
3
+ # dependencies
4
+ /node_modules
5
+ /npm-debug.log*
6
+ /yarn-error.log
7
+ /yarn.lock
8
+ /package-lock.json
9
+
10
+ # production
11
+ /dist
12
+
13
+ # misc
14
+ .DS_Store
15
+
16
+ # vite
17
+ /vite.config.ts.timestamp-*
@@ -0,0 +1,8 @@
1
+ ---
2
+ description: 自动发布到npm
3
+ agent: build
4
+ model: opencode/mimo-v2.5-free
5
+ ---
6
+
7
+ 修改 package.json 里的 version 字段,版本号加 1
8
+ 执行`pnpm pub`
package/.prettierrc ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "singleQuote": true,
3
+ "trailingComma": "all",
4
+ "printWidth": 80,
5
+ "overrides": [
6
+ {
7
+ "files": ".prettierrc",
8
+ "options": { "parser": "json" }
9
+ }
10
+ ]
11
+ }
package/AGENTS.md ADDED
@@ -0,0 +1,28 @@
1
+ # Code Snippet
2
+
3
+ ## Tech Stack
4
+ - Vite 8 + React 17 + TypeScript
5
+ - React Router 6
6
+ - Ant Design Pro Layout
7
+ - vite-plugin-mock (API mocking)
8
+ - Prettier (pre-commit via lint-staged)
9
+
10
+ ## Commands
11
+ - Install: `pnpm`
12
+ - Dev: `pnpm start` (runs `vite`, port 8000)
13
+ - Build: `pnpm build` (runs `vite build`)
14
+ - Preview: `pnpm preview` (runs `vite preview`)
15
+ - No lint/typecheck scripts defined
16
+
17
+ ## Key Conventions
18
+ - Path aliases: `@/` → `src/`
19
+ - Prettier: single quotes, trailing commas
20
+ - `src/pages/` contains route components
21
+ - `mock/` contains vite-plugin-mock API mocks
22
+ - Routing defined in `src/App.tsx` (React Router 6)
23
+ - Entry point: `src/main.tsx`
24
+
25
+ ## Gotchas
26
+ - React 17 (not 18) — uses `ReactDOM.render`, no concurrent features
27
+ - No ESLint config — formatting only enforced via Prettier
28
+ - `vite-plugin-mock` only active in dev mode (`command === 'serve'`)
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # umi project
2
+
3
+ ## Getting Started
4
+
5
+ Install dependencies,
6
+
7
+ ```bash
8
+ $ yarn
9
+ ```
10
+
11
+ Start the dev server,
12
+
13
+ ```bash
14
+ $ yarn start
15
+ ```
package/index.html ADDED
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Code Snippet</title>
7
+ </head>
8
+ <body>
9
+ <div id="root"></div>
10
+ <script type="module" src="/src/main.tsx"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,306 @@
1
+ import { MockMethod } from 'vite-plugin-mock';
2
+
3
+ let channelLinkList = [
4
+ { id: 1, pageId: 1, nameCn: '商家A', nameEn: 'a', link: '/paths/detail?id=1&filed=a', createTime: '2026-03-01 10:00:00' },
5
+ { id: 2, pageId: 1, nameCn: '商家B', nameEn: 'b', link: '/paths/detail?id=1&filed=b', createTime: '2026-03-02 11:00:00' },
6
+ { id: 3, pageId: 1, nameCn: '商家C', nameEn: 'c', link: '/paths/detail?id=1&filed=c', createTime: '2026-03-03 12:00:00' },
7
+ ];
8
+ let channelLinkIdCounter = 4;
9
+
10
+ let activityList = [
11
+ {
12
+ id: 1,
13
+ name: '春季内购会',
14
+ startTime: '2026-03-01 00:00:00',
15
+ endTime: '2026-06-01 23:59:59',
16
+ section: '新机',
17
+ status: '进行中',
18
+ ipTags: ['品牌A'],
19
+ otherTags: '春季',
20
+ shopTypes: ['总部', '进口'],
21
+ categoryTags: ['机械加工', '木材加工', '电子制造'],
22
+ strategyTags: ['常态化'],
23
+ industryTags: ['制造业'],
24
+ customTags: '',
25
+ targetGroup: 'all',
26
+ selectedGroup: '',
27
+ supportFactoryRegister: 'no',
28
+ createTime: '2026-02-15 10:00:00',
29
+ },
30
+ {
31
+ id: 2,
32
+ name: '感恩季',
33
+ startTime: '2026-07-01 00:00:00',
34
+ endTime: '2026-07-31 23:59:59',
35
+ section: '新机、二手',
36
+ status: '未开始',
37
+ ipTags: [],
38
+ otherTags: '',
39
+ shopTypes: ['总部', '经销商'],
40
+ categoryTags: ['金属成型'],
41
+ strategyTags: ['拉新'],
42
+ industryTags: [],
43
+ customTags: '',
44
+ targetGroup: 'select',
45
+ selectedGroup: 'VIP客户',
46
+ supportFactoryRegister: 'no',
47
+ createTime: '2026-06-10 14:30:00',
48
+ },
49
+ {
50
+ id: 3,
51
+ name: '年终大促',
52
+ startTime: '2025-12-01 00:00:00',
53
+ endTime: '2025-12-31 23:59:59',
54
+ section: '新机',
55
+ status: '已结束',
56
+ ipTags: ['品牌B', '品牌C'],
57
+ otherTags: '年终',
58
+ shopTypes: ['总部'],
59
+ categoryTags: ['印刷包装', '纺织机械'],
60
+ strategyTags: ['促销', '促活'],
61
+ industryTags: ['轻工业'],
62
+ customTags: '限时折扣',
63
+ targetGroup: 'all',
64
+ selectedGroup: '',
65
+ supportFactoryRegister: 'no',
66
+ createTime: '2025-11-15 09:00:00',
67
+ },
68
+ ];
69
+
70
+ let idCounter = 4;
71
+
72
+ function calcStatus(startTime: string, endTime: string) {
73
+ const now = Date.now();
74
+ const start = new Date(startTime).getTime();
75
+ const end = new Date(endTime).getTime();
76
+ if (now < start) return '未开始';
77
+ if (now > end) return '已结束';
78
+ return '进行中';
79
+ }
80
+
81
+ export default [
82
+ {
83
+ url: '/api/activity/list',
84
+ method: 'get',
85
+ response: ({ query }) => {
86
+ const {
87
+ current = 1,
88
+ pageSize = 10,
89
+ name,
90
+ startTime,
91
+ endTime,
92
+ section,
93
+ ipTag,
94
+ otherTag,
95
+ } = query;
96
+ let filtered = [...activityList];
97
+
98
+ if (name) {
99
+ filtered = filtered.filter((item) => item.name.includes(name));
100
+ }
101
+ if (section) {
102
+ filtered = filtered.filter((item) => item.section.includes(section));
103
+ }
104
+ if (ipTag) {
105
+ filtered = filtered.filter((item) =>
106
+ item.ipTags.some((t) => t.includes(ipTag)),
107
+ );
108
+ }
109
+ if (otherTag) {
110
+ filtered = filtered.filter((item) => item.otherTags.includes(otherTag));
111
+ }
112
+ if (startTime) {
113
+ filtered = filtered.filter(
114
+ (item) => new Date(item.startTime) >= new Date(startTime),
115
+ );
116
+ }
117
+ if (endTime) {
118
+ filtered = filtered.filter(
119
+ (item) => new Date(item.endTime) <= new Date(endTime),
120
+ );
121
+ }
122
+
123
+ filtered = filtered.map((item) => ({
124
+ ...item,
125
+ status: calcStatus(item.startTime, item.endTime),
126
+ }));
127
+
128
+ const start = (Number(current) - 1) * Number(pageSize);
129
+ const end = start + Number(pageSize);
130
+
131
+ return {
132
+ success: true,
133
+ data: {
134
+ list: filtered.slice(start, end),
135
+ total: filtered.length,
136
+ current: Number(current),
137
+ pageSize: Number(pageSize),
138
+ },
139
+ };
140
+ },
141
+ },
142
+ {
143
+ url: '/api/activity/add',
144
+ method: 'post',
145
+ response: ({ body }) => {
146
+ const data = body;
147
+ const newItem = {
148
+ id: idCounter++,
149
+ ...data,
150
+ status: calcStatus(data.startTime, data.endTime),
151
+ createTime: new Date().toISOString().replace('T', ' ').slice(0, 19),
152
+ };
153
+ activityList.push(newItem);
154
+ return { success: true, data: newItem };
155
+ },
156
+ },
157
+ {
158
+ url: '/api/activity/update',
159
+ method: 'post',
160
+ response: ({ body }) => {
161
+ const { id, ...rest } = body;
162
+ const index = activityList.findIndex((item) => item.id === id);
163
+ if (index !== -1) {
164
+ activityList[index] = {
165
+ ...activityList[index],
166
+ ...rest,
167
+ status: calcStatus(rest.startTime || activityList[index].startTime, rest.endTime || activityList[index].endTime),
168
+ };
169
+ return { success: true, data: activityList[index] };
170
+ } else {
171
+ return { success: false, message: '活动不存在' };
172
+ }
173
+ },
174
+ },
175
+ {
176
+ url: '/api/activity/delete',
177
+ method: 'post',
178
+ response: ({ body }) => {
179
+ const { id } = body;
180
+ activityList = activityList.filter((item) => item.id !== id);
181
+ return { success: true };
182
+ },
183
+ },
184
+ {
185
+ url: '/api/activity/systemPageList',
186
+ method: 'get',
187
+ response: ({ query }) => {
188
+ const { current = 1, pageSize = 10, name } = query;
189
+ let list = [
190
+ { id: 1, name: '春季内购会-工业品专场', path: '/paths/detail?id=1', status: '已通过', updateTime: '' },
191
+ { id: 2, name: '春季内购会-进口设备', path: '/paths/detail?id=2', status: '待提审', updateTime: '' },
192
+ { id: 3, name: '春季内购会-新机专场', path: '/paths/detail?id=3', status: '已通过', updateTime: '' },
193
+ ];
194
+ if (name) {
195
+ list = list.filter((item) => item.name.includes(name));
196
+ }
197
+ const start = (Number(current) - 1) * Number(pageSize);
198
+ return {
199
+ success: true,
200
+ data: { list: list.slice(start, start + Number(pageSize)), total: list.length },
201
+ };
202
+ },
203
+ },
204
+ {
205
+ url: '/api/activity/customPageList',
206
+ method: 'get',
207
+ response: ({ query }) => {
208
+ const { current = 1, pageSize = 10, name, id: pageId } = query;
209
+ let list = [
210
+ { id: 1, name: '春季内购会-工业品专场', path: '/paths/detail?id=1', status: '已通过', activity: '春季内购会', canShare: true, updateTime: '' },
211
+ { id: 2, name: '春季内购会-进口设备', path: '/paths/detail?id=2', status: '待提审', activity: '春季内购会', canShare: true, updateTime: '' },
212
+ { id: 3, name: '年终大促-主会场', path: '/paths/detail?id=3', status: '已通过', activity: '年终大促', canShare: false, updateTime: '' },
213
+ ];
214
+ if (name) {
215
+ list = list.filter((item) => item.name.includes(name));
216
+ }
217
+ if (pageId) {
218
+ list = list.filter((item) => String(item.id) === String(pageId));
219
+ }
220
+ const start = (Number(current) - 1) * Number(pageSize);
221
+ return {
222
+ success: true,
223
+ data: { list: list.slice(start, start + Number(pageSize)), total: list.length },
224
+ };
225
+ },
226
+ },
227
+ {
228
+ url: '/api/activity/customLinkList',
229
+ method: 'get',
230
+ response: ({ query }) => {
231
+ const { current = 1, pageSize = 10 } = query;
232
+ const list = [
233
+ { id: 1, type: '小程序', path: '/paths/detail?id=1', updateTime: '' },
234
+ { id: 2, type: 'H5链接', path: '/paths/detail?id=2', updateTime: '' },
235
+ { id: 3, type: '小程序', path: '/paths/detail?id=3', updateTime: '' },
236
+ ];
237
+ const start = (Number(current) - 1) * Number(pageSize);
238
+ return {
239
+ success: true,
240
+ data: { list: list.slice(start, start + Number(pageSize)), total: list.length },
241
+ };
242
+ },
243
+ },
244
+ {
245
+ url: '/api/activity/channelLinkList',
246
+ method: 'get',
247
+ response: ({ query }) => {
248
+ const { current = 1, pageSize = 10, pageId } = query;
249
+ let list = [
250
+ { id: 1, pageId: 1, nameCn: '商家A', nameEn: 'a', link: '/paths/detail?id=1&filed=a', createTime: '2026-03-01 10:00:00' },
251
+ { id: 2, pageId: 1, nameCn: '商家B', nameEn: 'b', link: '/paths/detail?id=1&filed=b', createTime: '2026-03-02 11:00:00' },
252
+ { id: 3, pageId: 1, nameCn: '商家C', nameEn: 'c', link: '/paths/detail?id=1&filed=c', createTime: '2026-03-03 12:00:00' },
253
+ ];
254
+ if (pageId) {
255
+ list = list.filter((item) => String(item.pageId) === String(pageId));
256
+ }
257
+ const start = (Number(current) - 1) * Number(pageSize);
258
+ return {
259
+ success: true,
260
+ data: { list: list.slice(start, start + Number(pageSize)), total: list.length },
261
+ };
262
+ },
263
+ },
264
+ {
265
+ url: '/api/activity/channelLink/add',
266
+ method: 'post',
267
+ response: ({ body }) => {
268
+ const data = body;
269
+ const newItem = {
270
+ id: channelLinkIdCounter++,
271
+ ...data,
272
+ link: `/paths/detail?id=${data.pageId}&filed=${data.nameEn}`,
273
+ createTime: new Date().toISOString().replace('T', ' ').slice(0, 19),
274
+ };
275
+ channelLinkList.push(newItem);
276
+ return { success: true, data: newItem };
277
+ },
278
+ },
279
+ {
280
+ url: '/api/activity/channelLink/update',
281
+ method: 'post',
282
+ response: ({ body }) => {
283
+ const { id, ...rest } = body;
284
+ const index = channelLinkList.findIndex((item) => item.id === id);
285
+ if (index !== -1) {
286
+ channelLinkList[index] = {
287
+ ...channelLinkList[index],
288
+ ...rest,
289
+ link: `/paths/detail?id=${channelLinkList[index].pageId}&filed=${rest.nameEn || channelLinkList[index].nameEn}`,
290
+ };
291
+ return { success: true, data: channelLinkList[index] };
292
+ } else {
293
+ return { success: false, message: '渠道链接不存在' };
294
+ }
295
+ },
296
+ },
297
+ {
298
+ url: '/api/activity/channelLink/delete',
299
+ method: 'post',
300
+ response: ({ body }) => {
301
+ const { id } = body;
302
+ channelLinkList = channelLinkList.filter((item) => item.id !== id);
303
+ return { success: true };
304
+ },
305
+ },
306
+ ] as MockMethod[];
package/opencode.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://opencode.ai/config.json",
3
+ "instructions": [".opencode/rules/*.md"],
4
+ "agent": {
5
+ "build": {
6
+ "tools": {
7
+ "cjy-mcp-context7*": true
8
+ }
9
+ }
10
+ }
11
+ }
package/package.json CHANGED
@@ -1,27 +1,78 @@
1
- {
2
- "name": "@lxzy/code-snippet",
3
- "version": "0.0.5",
4
- "description": "none",
5
- "license": "MIT",
6
- "author": "ywwb",
7
- "main": "./dist/esm/index.js",
8
- "module": "./dist/esm/index.js",
9
- "types": "./dist/esm/index.d.ts",
10
- "files": [
11
- "src",
12
- "public"
13
- ],
14
- "scripts": {
15
- "build": "father build",
16
- "prepublishOnly": "",
17
- "pub": "npm publish"
18
- },
19
- "dependencies": {},
20
- "devDependencies": {},
21
- "peerDependencies": {},
22
- "publishConfig": {
23
- "access": "public",
24
- "registry": "https://registry.npmjs.org/"
25
- },
26
- "authors": []
27
- }
1
+ {
2
+ "name": "@lxzy/code-snippet",
3
+ "version": "0.0.7",
4
+ "files": [
5
+ "*",
6
+ "!dist",
7
+ "!.env.local",
8
+ "!*.log",
9
+ "!.DS_Store",
10
+ "!yarn.lock",
11
+ "!package-lock.json"
12
+ ],
13
+ "scripts": {
14
+ "start": "vite",
15
+ "build": "vite build",
16
+ "preview": "vite preview",
17
+ "pub": "npm publish"
18
+ },
19
+ "dependencies": {
20
+ "@ant-design/icons": "^4.7.0",
21
+ "@ant-design/pro-descriptions": "^1.10.0",
22
+ "@ant-design/pro-form": "^1.52.0",
23
+ "@ant-design/pro-layout": "^6.32.0",
24
+ "@ant-design/pro-list": "^1.21.44",
25
+ "@ant-design/pro-table": "^2.61.0",
26
+ "@wangeditor/editor": "^5.1.23",
27
+ "@wangeditor/editor-for-react": "^1.0.6",
28
+ "ahooks": "^3.1.9",
29
+ "ali-oss": "^6.16.0",
30
+ "antd": "^4.22.7",
31
+ "axios": "^1.18.1",
32
+ "classnames": "^2.3.0",
33
+ "clipboard": "^2.0.8",
34
+ "core-decorators": "^0.20.0",
35
+ "crypto-js": "^4.1.1",
36
+ "dayjs": "^1.11.0",
37
+ "echarts": "^5.4.3",
38
+ "eta": "^1.12.3",
39
+ "exceljs": "^4.3.0",
40
+ "fs-extra": "^10.0.0",
41
+ "got": "^11.8.2",
42
+ "jotai": "^1.6.1",
43
+ "lodash": "^4.17.0",
44
+ "lodash-es": "^4.17.21",
45
+ "moment": "^2.29.0",
46
+ "number-precision": "^1.5.2",
47
+ "omit.js": "^2.0.2",
48
+ "rc-menu": "^9.1.0",
49
+ "rc-util": "^5.16.0",
50
+ "react": "^17.0.0",
51
+ "react-avatar-editor": "^13.0.2",
52
+ "react-beautiful-dnd": "^13.1.0",
53
+ "react-color": "^2.19.3",
54
+ "react-dev-inspector": "^1.7.0",
55
+ "react-dom": "^17.0.0",
56
+ "react-helmet-async": "^1.2.0",
57
+ "react-infinite-scroll-component": "^6.1.0",
58
+ "react-router-dom": "^6.3.0",
59
+ "swagger-typescript-api": "10.0.2",
60
+ "unstated-next": "^1.1.0",
61
+ "validator": "^13.7.0",
62
+ "wangeditor": "^4.7.11"
63
+ },
64
+ "devDependencies": {
65
+ "@types/node": "^22.1.0",
66
+ "@types/react": "^17.0.0",
67
+ "@types/react-dom": "^17.0.0",
68
+ "@vitejs/plugin-react": "^6.0.0",
69
+ "esbuild": "^0.28.0",
70
+ "less": "^4.6.7",
71
+ "lint-staged": "^10.0.7",
72
+ "prettier": "^2.2.0",
73
+ "typescript": "^4.1.2",
74
+ "vite": "^8.0.10",
75
+ "vite-plugin-mock": "^3.0.2",
76
+ "yorkie": "^2.0.0"
77
+ }
78
+ }