@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
@@ -0,0 +1,31 @@
1
+ /** @license React v17.0.0
2
+ * react.production.min.js
3
+ *
4
+ * Copyright (c) Facebook, Inc. and its affiliates.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ (function(){'use strict';(function(c,x){"object"===typeof exports&&"undefined"!==typeof module?x(exports):"function"===typeof define&&define.amd?define(["exports"],x):(c=c||self,x(c.React={}))})(this,function(c){function x(a){if(null===a||"object"!==typeof a)return null;a=Y&&a[Y]||a["@@iterator"];return"function"===typeof a?a:null}function y(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,e=1;e<arguments.length;e++)b+="&args[]="+encodeURIComponent(arguments[e]);return"Minified React error #"+
10
+ a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function v(a,b,e){this.props=a;this.context=b;this.refs=Z;this.updater=e||aa}function ba(){}function K(a,b,e){this.props=a;this.context=b;this.refs=Z;this.updater=e||aa}function ca(a,b,e){var l,f={},c=null,da=null;if(null!=b)for(l in void 0!==b.ref&&(da=b.ref),void 0!==b.key&&(c=""+b.key),b)ea.call(b,l)&&!fa.hasOwnProperty(l)&&(f[l]=b[l]);var k=arguments.length-2;if(1===
11
+ k)f.children=e;else if(1<k){for(var h=Array(k),d=0;d<k;d++)h[d]=arguments[d+2];f.children=h}if(a&&a.defaultProps)for(l in k=a.defaultProps,k)void 0===f[l]&&(f[l]=k[l]);return{$$typeof:w,type:a,key:c,ref:da,props:f,_owner:L.current}}function va(a,b){return{$$typeof:w,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function M(a){return"object"===typeof a&&null!==a&&a.$$typeof===w}function wa(a){var b={"=":"=0",":":"=2"};return"$"+a.replace(/[=:]/g,function(a){return b[a]})}function N(a,b){return"object"===
12
+ typeof a&&null!==a&&null!=a.key?wa(""+a.key):b.toString(36)}function C(a,b,e,l,f){var c=typeof a;if("undefined"===c||"boolean"===c)a=null;var d=!1;if(null===a)d=!0;else switch(c){case "string":case "number":d=!0;break;case "object":switch(a.$$typeof){case w:case ha:d=!0}}if(d)return d=a,f=f(d),a=""===l?"."+N(d,0):l,Array.isArray(f)?(e="",null!=a&&(e=a.replace(ia,"$&/")+"/"),C(f,b,e,"",function(a){return a})):null!=f&&(M(f)&&(f=va(f,e+(!f.key||d&&d.key===f.key?"":(""+f.key).replace(ia,"$&/")+"/")+
13
+ a)),b.push(f)),1;d=0;l=""===l?".":l+":";if(Array.isArray(a))for(var k=0;k<a.length;k++){c=a[k];var h=l+N(c,k);d+=C(c,b,e,h,f)}else if(h=x(a),"function"===typeof h)for(a=h.call(a),k=0;!(c=a.next()).done;)c=c.value,h=l+N(c,k++),d+=C(c,b,e,h,f);else if("object"===c)throw b=""+a,Error(y(31,"[object Object]"===b?"object with keys {"+Object.keys(a).join(", ")+"}":b));return d}function D(a,b,e){if(null==a)return a;var l=[],c=0;C(a,l,"","",function(a){return b.call(e,a,c++)});return l}function xa(a){if(-1===
14
+ a._status){var b=a._result;b=b();a._status=0;a._result=b;b.then(function(b){0===a._status&&(b=b.default,a._status=1,a._result=b)},function(b){0===a._status&&(a._status=2,a._result=b)})}if(1===a._status)return a._result;throw a._result;}function n(){var a=ja.current;if(null===a)throw Error(y(321));return a}function O(a,b){var e=a.length;a.push(b);a:for(;;){var c=e-1>>>1,f=a[c];if(void 0!==f&&0<E(f,b))a[c]=b,a[e]=f,e=c;else break a}}function p(a){a=a[0];return void 0===a?null:a}function F(a){var b=
15
+ a[0];if(void 0!==b){var e=a.pop();if(e!==b){a[0]=e;a:for(var c=0,f=a.length;c<f;){var d=2*(c+1)-1,g=a[d],k=d+1,h=a[k];if(void 0!==g&&0>E(g,e))void 0!==h&&0>E(h,g)?(a[c]=h,a[k]=e,c=k):(a[c]=g,a[d]=e,c=d);else if(void 0!==h&&0>E(h,e))a[c]=h,a[k]=e,c=k;else break a}}return b}return null}function E(a,b){var e=a.sortIndex-b.sortIndex;return 0!==e?e:a.id-b.id}function P(a){for(var b=p(r);null!==b;){if(null===b.callback)F(r);else if(b.startTime<=a)F(r),b.sortIndex=b.expirationTime,O(q,b);else break;b=p(r)}}
16
+ function Q(a){z=!1;P(a);if(!u)if(null!==p(q))u=!0,A(R);else{var b=p(r);null!==b&&G(Q,b.startTime-a)}}function R(a,b){u=!1;z&&(z=!1,S());H=!0;var e=g;try{P(b);for(m=p(q);null!==m&&(!(m.expirationTime>b)||a&&!T());){var c=m.callback;if("function"===typeof c){m.callback=null;g=m.priorityLevel;var f=c(m.expirationTime<=b);b=t();"function"===typeof f?m.callback=f:m===p(q)&&F(q);P(b)}else F(q);m=p(q)}if(null!==m)var d=!0;else{var n=p(r);null!==n&&G(Q,n.startTime-b);d=!1}return d}finally{m=null,g=e,H=!1}}
17
+ var w=60103,ha=60106;c.Fragment=60107;c.StrictMode=60108;c.Profiler=60114;var ka=60109,la=60110,ma=60112;c.Suspense=60113;var na=60115,oa=60116;if("function"===typeof Symbol&&Symbol.for){var d=Symbol.for;w=d("react.element");ha=d("react.portal");c.Fragment=d("react.fragment");c.StrictMode=d("react.strict_mode");c.Profiler=d("react.profiler");ka=d("react.provider");la=d("react.context");ma=d("react.forward_ref");c.Suspense=d("react.suspense");na=d("react.memo");oa=d("react.lazy")}var Y="function"===
18
+ typeof Symbol&&Symbol.iterator,ya=Object.prototype.hasOwnProperty,U=Object.assign||function(a,b){if(null==a)throw new TypeError("Object.assign target cannot be null or undefined");for(var e=Object(a),c=1;c<arguments.length;c++){var d=arguments[c];if(null!=d){var g=void 0;d=Object(d);for(g in d)ya.call(d,g)&&(e[g]=d[g])}}return e},aa={isMounted:function(a){return!1},enqueueForceUpdate:function(a,b,c){},enqueueReplaceState:function(a,b,c,d){},enqueueSetState:function(a,b,c,d){}},Z={};v.prototype.isReactComponent=
19
+ {};v.prototype.setState=function(a,b){if("object"!==typeof a&&"function"!==typeof a&&null!=a)throw Error(y(85));this.updater.enqueueSetState(this,a,b,"setState")};v.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")};ba.prototype=v.prototype;d=K.prototype=new ba;d.constructor=K;U(d,v.prototype);d.isPureReactComponent=!0;var L={current:null},ea=Object.prototype.hasOwnProperty,fa={key:!0,ref:!0,__self:!0,__source:!0},ia=/\/+/g,ja={current:null},V;if("object"===typeof performance&&
20
+ "function"===typeof performance.now){var za=performance;var t=function(){return za.now()}}else{var pa=Date,Aa=pa.now();t=function(){return pa.now()-Aa}}if("undefined"===typeof window||"function"!==typeof MessageChannel){var B=null,qa=null,ra=function(){if(null!==B)try{var a=t();B(!0,a);B=null}catch(b){throw setTimeout(ra,0),b;}};var A=function(a){null!==B?setTimeout(A,0,a):(B=a,setTimeout(ra,0))};var G=function(a,b){qa=setTimeout(a,b)};var S=function(){clearTimeout(qa)};var T=function(){return!1};
21
+ d=V=function(){}}else{var Ba=window.setTimeout,Ca=window.clearTimeout;"undefined"!==typeof console&&(d=window.cancelAnimationFrame,"function"!==typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!==typeof d&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"));
22
+ var I=!1,J=null,W=-1,sa=5,ta=0;T=function(){return t()>=ta};d=function(){};V=function(a){0>a||125<a?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):sa=0<a?Math.floor(1E3/a):5};var ua=new MessageChannel,X=ua.port2;ua.port1.onmessage=function(){if(null!==J){var a=t();ta=a+sa;try{J(!0,a)?X.postMessage(null):(I=!1,J=null)}catch(b){throw X.postMessage(null),b;}}else I=!1};A=function(a){J=a;I||(I=!0,X.postMessage(null))};G=
23
+ function(a,b){W=Ba(function(){a(t())},b)};S=function(){Ca(W);W=-1}}var q=[],r=[],Da=1,m=null,g=3,H=!1,u=!1,z=!1,Ea=0;d={ReactCurrentDispatcher:ja,ReactCurrentOwner:L,IsSomeRendererActing:{current:!1},ReactCurrentBatchConfig:{transition:0},assign:U,Scheduler:{__proto__:null,unstable_ImmediatePriority:1,unstable_UserBlockingPriority:2,unstable_NormalPriority:3,unstable_IdlePriority:5,unstable_LowPriority:4,unstable_runWithPriority:function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=
24
+ 3}var c=g;g=a;try{return b()}finally{g=c}},unstable_next:function(a){switch(g){case 1:case 2:case 3:var b=3;break;default:b=g}var c=g;g=b;try{return a()}finally{g=c}},unstable_scheduleCallback:function(a,b,c){var d=t();"object"===typeof c&&null!==c?(c=c.delay,c="number"===typeof c&&0<c?d+c:d):c=d;switch(a){case 1:var e=-1;break;case 2:e=250;break;case 5:e=1073741823;break;case 4:e=1E4;break;default:e=5E3}e=c+e;a={id:Da++,callback:b,priorityLevel:a,startTime:c,expirationTime:e,sortIndex:-1};c>d?(a.sortIndex=
25
+ c,O(r,a),null===p(q)&&a===p(r)&&(z?S():z=!0,G(Q,c-d))):(a.sortIndex=e,O(q,a),u||H||(u=!0,A(R)));return a},unstable_cancelCallback:function(a){a.callback=null},unstable_wrapCallback:function(a){var b=g;return function(){var c=g;g=b;try{return a.apply(this,arguments)}finally{g=c}}},unstable_getCurrentPriorityLevel:function(){return g},get unstable_shouldYield(){return T},unstable_requestPaint:d,unstable_continueExecution:function(){u||H||(u=!0,A(R))},unstable_pauseExecution:function(){},unstable_getFirstCallbackNode:function(){return p(q)},
26
+ get unstable_now(){return t},get unstable_forceFrameRate(){return V},unstable_Profiling:null},SchedulerTracing:{__proto__:null,__interactionsRef:null,__subscriberRef:null,unstable_clear:function(a){return a()},unstable_getCurrent:function(){return null},unstable_getThreadID:function(){return++Ea},unstable_trace:function(a,b,c){return c()},unstable_wrap:function(a){return a},unstable_subscribe:function(a){},unstable_unsubscribe:function(a){}}};c.Children={map:D,forEach:function(a,b,c){D(a,function(){b.apply(this,
27
+ arguments)},c)},count:function(a){var b=0;D(a,function(){b++});return b},toArray:function(a){return D(a,function(a){return a})||[]},only:function(a){if(!M(a))throw Error(y(143));return a}};c.Component=v;c.PureComponent=K;c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=d;c.cloneElement=function(a,b,c){if(null===a||void 0===a)throw Error(y(267,a));var d=U({},a.props),e=a.key,g=a.ref,n=a._owner;if(null!=b){void 0!==b.ref&&(g=b.ref,n=L.current);void 0!==b.key&&(e=""+b.key);if(a.type&&a.type.defaultProps)var k=
28
+ a.type.defaultProps;for(h in b)ea.call(b,h)&&!fa.hasOwnProperty(h)&&(d[h]=void 0===b[h]&&void 0!==k?k[h]:b[h])}var h=arguments.length-2;if(1===h)d.children=c;else if(1<h){k=Array(h);for(var m=0;m<h;m++)k[m]=arguments[m+2];d.children=k}return{$$typeof:w,type:a.type,key:e,ref:g,props:d,_owner:n}};c.createContext=function(a,b){void 0===b&&(b=null);a={$$typeof:la,_calculateChangedBits:b,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null};a.Provider={$$typeof:ka,_context:a};return a.Consumer=
29
+ a};c.createElement=ca;c.createFactory=function(a){var b=ca.bind(null,a);b.type=a;return b};c.createRef=function(){return{current:null}};c.forwardRef=function(a){return{$$typeof:ma,render:a}};c.isValidElement=M;c.lazy=function(a){return{$$typeof:oa,_payload:{_status:-1,_result:a},_init:xa}};c.memo=function(a,b){return{$$typeof:na,type:a,compare:void 0===b?null:b}};c.useCallback=function(a,b){return n().useCallback(a,b)};c.useContext=function(a,b){return n().useContext(a,b)};c.useDebugValue=function(a,
30
+ b){};c.useEffect=function(a,b){return n().useEffect(a,b)};c.useImperativeHandle=function(a,b,c){return n().useImperativeHandle(a,b,c)};c.useLayoutEffect=function(a,b){return n().useLayoutEffect(a,b)};c.useMemo=function(a,b){return n().useMemo(a,b)};c.useReducer=function(a,b,c){return n().useReducer(a,b,c)};c.useRef=function(a){return n().useRef(a)};c.useState=function(a){return n().useState(a)};c.version="17.0.0"});
31
+ })();
package/src/App.tsx ADDED
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
3
+ import BasicLayout from '@/layouts/index';
4
+ import ActivitySystemManagement from '@/pages/activityCenter/activitySystemManagement';
5
+ import ActivitySystemManagementAddPages from '@/pages/activityCenter/activitySystemManagement/addPages';
6
+ import Page404 from '@/pages/404';
7
+
8
+ const App: React.FC = () => {
9
+ return (
10
+ <BrowserRouter>
11
+ <BasicLayout>
12
+ <Routes>
13
+ <Route
14
+ path="/"
15
+ element={
16
+ <Navigate to="/activityCenter/activitySystemManagement" replace />
17
+ }
18
+ />
19
+ <Route
20
+ path="/activityCenter/activitySystemManagement"
21
+ element={<ActivitySystemManagement />}
22
+ />
23
+ <Route
24
+ path="/activityCenter/activitySystemManagement/addPages"
25
+ element={<ActivitySystemManagementAddPages />}
26
+ />
27
+ <Route path="*" element={<Page404 />} />
28
+ </Routes>
29
+ </BasicLayout>
30
+ </BrowserRouter>
31
+ );
32
+ };
33
+
34
+ export default App;
package/src/global.css ADDED
@@ -0,0 +1,44 @@
1
+ html, body, #root {
2
+ height: 100%;
3
+ margin: 0;
4
+ padding: 0;
5
+ }
6
+
7
+ #root,
8
+ #root > div {
9
+ height: 100%;
10
+ }
11
+
12
+ .ant-pro-layout,
13
+ .ant-layout {
14
+ height: 100% !important;
15
+ }
16
+
17
+ .ant-pro-layout .ant-layout-content {
18
+ display: flex !important;
19
+ flex-direction: column !important;
20
+ flex: 1 !important;
21
+ min-height: 0 !important;
22
+ overflow: auto !important;
23
+ }
24
+
25
+ .ant-pro-page-container {
26
+ display: flex !important;
27
+ flex-direction: column !important;
28
+ flex: 1 !important;
29
+ min-height: 0 !important;
30
+ height: auto !important;
31
+ }
32
+
33
+ .ant-pro-page-container .ant-pro-page-container-children-content {
34
+ display: flex !important;
35
+ flex-direction: column !important;
36
+ flex: 1 !important;
37
+ min-height: 0 !important;
38
+ margin: 0 !important;
39
+ padding: 24px !important;
40
+ }
41
+
42
+ .ant-pro-page-container .ant-pro-page-container-children-content > div {
43
+ flex: 1 !important;
44
+ }
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ import { useNavigate } from 'react-router-dom';
3
+ import { Avatar, Dropdown, Menu, Space } from 'antd';
4
+ import ProLayout from '@ant-design/pro-layout';
5
+
6
+ const menuDataRender = (menuList: any[]) => {
7
+ return menuList.map((item) => {
8
+ const localItem = {
9
+ ...item,
10
+ children: item.children ? menuDataRender(item.children) : undefined,
11
+ };
12
+ return localItem;
13
+ });
14
+ };
15
+
16
+ const BasicLayout: React.FC<{ children: React.ReactNode }> = ({ children }) => {
17
+ const navigate = useNavigate();
18
+
19
+ return (
20
+ <ProLayout
21
+ title="Code Snippet"
22
+ logo={false}
23
+ layout="mix"
24
+ fixSiderbar
25
+ fixedHeader
26
+ route={{
27
+ path: '/',
28
+ routes: [
29
+ {
30
+ path: '/activityCenter',
31
+ name: '活动中心',
32
+ routes: [
33
+ {
34
+ path: '/activityCenter/activitySystemManagement',
35
+ name: '活动系统管理',
36
+ },
37
+ ],
38
+ },
39
+ ],
40
+ }}
41
+ menuItemRender={(item, dom) => (
42
+ <a onClick={() => navigate(item.path || '/')}>{dom}</a>
43
+ )}
44
+ >
45
+ {children}
46
+ </ProLayout>
47
+ );
48
+ };
49
+
50
+ export default BasicLayout;
package/src/main.tsx ADDED
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import App from './App';
4
+ import './global.css';
5
+
6
+ ReactDOM.render(
7
+ <React.StrictMode>
8
+ <App />
9
+ </React.StrictMode>,
10
+ document.getElementById('root'),
11
+ );
@@ -0,0 +1,5 @@
1
+ import { Result } from 'antd';
2
+
3
+ export default function Page() {
4
+ return <Result title="404"></Result>;
5
+ }
@@ -0,0 +1,209 @@
1
+ import React, { useRef } from 'react';
2
+ import { message, Row, Col } from 'antd';
3
+ import {
4
+ DrawerForm,
5
+ ProFormText,
6
+ ProFormCheckbox,
7
+ ProFormSelect,
8
+ ProFormRadio,
9
+ ProFormDependency,
10
+ ProFormDateTimeRangePicker,
11
+ } from '@ant-design/pro-form';
12
+ import moment from 'moment';
13
+ import axios from 'axios';
14
+
15
+ const sectionOptions = ['新机', '二手', '工业品', '融资'];
16
+ const shopTypeOptions = ['总部', '经销商', '进口', '国产'];
17
+ const categoryTagOptions = [
18
+ '机械加工',
19
+ '金属成型',
20
+ '塑料机械',
21
+ '印刷包装',
22
+ '纺织机械',
23
+ '食品加工',
24
+ '木材加工',
25
+ '电子制造',
26
+ '生产配套',
27
+ ];
28
+ const strategyTagOptions = ['常态化', '拉新', '促活', '促销', '品牌联合推广'];
29
+ const ipTagOptions = ['品牌A', '品牌B', '品牌C', '品牌D'];
30
+ const industryTagOptions = ['制造业', '轻工业', '重工业', '服务业', '农业'];
31
+
32
+ interface AddDrawerProps {
33
+ visible: boolean;
34
+ editingItem: any;
35
+ onClose: () => void;
36
+ onSuccess: () => void;
37
+ }
38
+
39
+ const AddDrawer: React.FC<AddDrawerProps> = ({
40
+ visible,
41
+ editingItem,
42
+ onClose,
43
+ onSuccess,
44
+ }) => {
45
+ const formRef = useRef<any>();
46
+
47
+ const handleSubmit = async (values) => {
48
+ const { timeRange, ...rest } = values;
49
+ const payload = {
50
+ ...rest,
51
+ startTime: timeRange?.[0]?.format('YYYY-MM-DD HH:mm:ss') || '',
52
+ endTime: timeRange?.[1]?.format('YYYY-MM-DD HH:mm:ss') || '',
53
+ };
54
+ if (editingItem) {
55
+ await axios.post('/api/activity/update', {
56
+ ...payload,
57
+ id: editingItem.id,
58
+ });
59
+ message.success('编辑成功');
60
+ } else {
61
+ await axios.post('/api/activity/add', payload);
62
+ message.success('新增成功');
63
+ }
64
+ onSuccess();
65
+ return true;
66
+ };
67
+
68
+ return (
69
+ <DrawerForm
70
+ title={editingItem ? '编辑活动' : '新建活动'}
71
+ visible={visible}
72
+ onVisibleChange={(v) => {
73
+ if (!v) {
74
+ onClose();
75
+ }
76
+ }}
77
+ formRef={formRef}
78
+ width="80%"
79
+ drawerProps={{ destroyOnClose: true }}
80
+ key={editingItem?.id || 'add'}
81
+ initialValues={
82
+ editingItem
83
+ ? {
84
+ ...editingItem,
85
+ timeRange:
86
+ editingItem.startTime && editingItem.endTime
87
+ ? [moment(editingItem.startTime), moment(editingItem.endTime)]
88
+ : undefined,
89
+ }
90
+ : { targetGroup: 'all', supportFactoryRegister: 'no' }
91
+ }
92
+ onFinish={handleSubmit}
93
+ >
94
+ <ProFormText
95
+ name="name"
96
+ label="活动名称"
97
+ rules={[{ required: true, message: '请输入活动名称' }]}
98
+ placeholder="请输入"
99
+ />
100
+ <ProFormDateTimeRangePicker
101
+ name="timeRange"
102
+ label="活动时间范围"
103
+ rules={[{ required: true, message: '请选择活动时间范围' }]}
104
+ fieldProps={{ style: { width: '100%' } }}
105
+ />
106
+ <ProFormCheckbox.Group
107
+ name="section"
108
+ label="所属板块"
109
+ options={sectionOptions}
110
+ rules={[{ required: true, message: '请选择所属板块' }]}
111
+ />
112
+ <ProFormCheckbox.Group
113
+ name="shopTypes"
114
+ label="参与店铺类型"
115
+ options={shopTypeOptions}
116
+ rules={[{ required: true, message: '请选择参与店铺类型' }]}
117
+ />
118
+ <div
119
+ style={{
120
+ background: '#f5f5f5',
121
+ padding: 16,
122
+ borderRadius: 4,
123
+ marginBottom: 24,
124
+ }}
125
+ >
126
+ <div style={{ fontWeight: 500, marginBottom: 12 }}>活动标签</div>
127
+ <ProFormCheckbox.Group
128
+ name="categoryTags"
129
+ label="品类标签"
130
+ options={categoryTagOptions}
131
+ />
132
+ <Row gutter={16} align="middle" style={{ marginBottom: 24 }}>
133
+ <Col>
134
+ <ProFormCheckbox.Group
135
+ name="strategyTags"
136
+ label="策略标签"
137
+ options={strategyTagOptions}
138
+ />
139
+ </Col>
140
+ <Col>
141
+ <ProFormText
142
+ name="strategyCustomInput"
143
+ noStyle
144
+ placeholder="如有多个,请用/分割"
145
+ fieldProps={{ style: { width: 200 } }}
146
+ />
147
+ </Col>
148
+ </Row>
149
+ <ProFormSelect
150
+ name="ipTags"
151
+ label="IP标签"
152
+ mode="multiple"
153
+ placeholder="请选择,多选"
154
+ fieldProps={{ style: { width: 260 } }}
155
+ options={ipTagOptions.map((t) => ({ label: t, value: t }))}
156
+ />
157
+ <ProFormSelect
158
+ name="industryTags"
159
+ label="行业标签"
160
+ placeholder="请选择"
161
+ fieldProps={{ style: { width: 200 } }}
162
+ options={industryTagOptions.map((t) => ({ label: t, value: t }))}
163
+ />
164
+ <ProFormText
165
+ name="customTags"
166
+ label="自定义标签"
167
+ placeholder="如有多个,请用/分割"
168
+ fieldProps={{ style: { width: 300 } }}
169
+ />
170
+ </div>
171
+ <ProFormRadio.Group
172
+ name="targetGroup"
173
+ label="活动人群"
174
+ options={[
175
+ { label: '全用户', value: 'all' },
176
+ { label: '选择客群', value: 'select' },
177
+ ]}
178
+ rules={[{ required: true, message: '请选择活动人群' }]}
179
+ />
180
+ <ProFormDependency name={['targetGroup']}>
181
+ {({ targetGroup }) =>
182
+ targetGroup === 'select' ? (
183
+ <ProFormSelect
184
+ name="selectedGroup"
185
+ label=" "
186
+ placeholder="请选择选定人群"
187
+ fieldProps={{ style: { width: 300 } }}
188
+ options={[
189
+ { label: 'VIP客户', value: 'VIP客户' },
190
+ { label: '新用户', value: '新用户' },
191
+ { label: '活跃用户', value: '活跃用户' },
192
+ ]}
193
+ />
194
+ ) : null
195
+ }
196
+ </ProFormDependency>
197
+ <ProFormRadio.Group
198
+ name="supportFactoryRegister"
199
+ label="支持厂商报名"
200
+ options={[
201
+ { label: '否', value: 'no' },
202
+ { label: '是', value: 'yes' },
203
+ ]}
204
+ />
205
+ </DrawerForm>
206
+ );
207
+ };
208
+
209
+ export default AddDrawer;
@@ -0,0 +1,167 @@
1
+ import React, { useRef, useState } from 'react';
2
+ import { Modal, Button, Input, message } from 'antd';
3
+ import { PlusOutlined } from '@ant-design/icons';
4
+ import ProTable from '@ant-design/pro-table';
5
+ import { ModalForm, ProFormText } from '@ant-design/pro-form';
6
+ import axios from 'axios';
7
+
8
+ interface ChannelLinkModalProps {
9
+ visible: boolean;
10
+ pageName: string;
11
+ pageId: number;
12
+ onClose: () => void;
13
+ }
14
+
15
+ const ChannelLinkModal: React.FC<ChannelLinkModalProps> = ({
16
+ visible,
17
+ pageName,
18
+ pageId,
19
+ onClose,
20
+ }) => {
21
+ const actionRef = useRef<any>();
22
+ const [addVisible, setAddVisible] = useState(false);
23
+ const [editVisible, setEditVisible] = useState(false);
24
+ const [editingItem, setEditingItem] = useState<any>(null);
25
+
26
+ const handleAdd = async (values) => {
27
+ await axios.post('/api/activity/channelLink/add', {
28
+ ...values,
29
+ pageId,
30
+ });
31
+ message.success('新增成功');
32
+ setAddVisible(false);
33
+ actionRef.current?.reload();
34
+ return true;
35
+ };
36
+
37
+ const handleEdit = async (values) => {
38
+ await axios.post('/api/activity/channelLink/update', {
39
+ ...values,
40
+ id: editingItem.id,
41
+ });
42
+ message.success('编辑成功');
43
+ setEditVisible(false);
44
+ setEditingItem(null);
45
+ actionRef.current?.reload();
46
+ return true;
47
+ };
48
+
49
+ const handleDelete = async (record) => {
50
+ await axios.post('/api/activity/channelLink/delete', { id: record.id });
51
+ message.success('删除成功');
52
+ actionRef.current?.reload();
53
+ };
54
+
55
+ return (
56
+ <>
57
+ <Modal
58
+ title={pageName}
59
+ visible={visible}
60
+ onCancel={onClose}
61
+ footer={null}
62
+ width={900}
63
+ >
64
+ <ProTable
65
+ headerTitle={false}
66
+ toolBarRender={() => [
67
+ <Button
68
+ key="add"
69
+ type="primary"
70
+ icon={<PlusOutlined />}
71
+ onClick={() => setAddVisible(true)}
72
+ >
73
+ 新建渠道链接
74
+ </Button>,
75
+ ]}
76
+ actionRef={actionRef}
77
+ rowKey="id"
78
+ request={async (params) => {
79
+ const { data: result } = await axios.get('/api/activity/channelLinkList', {
80
+ params: { ...params, pageId },
81
+ });
82
+ return {
83
+ data: result.data.list,
84
+ total: result.data.total,
85
+ success: result.success,
86
+ };
87
+ }}
88
+ columns={[
89
+ { title: '渠道中文', dataIndex: 'nameCn' },
90
+ { title: '渠道英文', dataIndex: 'nameEn' },
91
+ { title: '链接参数', dataIndex: 'link' },
92
+ { title: '创建时间', dataIndex: 'createTime' },
93
+ {
94
+ title: '操作',
95
+ valueType: 'option',
96
+ render: (_, record) => (
97
+ <>
98
+ <Button type="link" size="small">查看二维码</Button>
99
+ <Button
100
+ type="link"
101
+ size="small"
102
+ onClick={() => {
103
+ setEditingItem(record);
104
+ setEditVisible(true);
105
+ }}
106
+ >
107
+ 编辑
108
+ </Button>
109
+ <Button type="link" danger size="small" onClick={() => handleDelete(record)}>
110
+ 删除
111
+ </Button>
112
+ </>
113
+ ),
114
+ },
115
+ ]}
116
+ pagination={false}
117
+ options={false}
118
+ search={false}
119
+ />
120
+ </Modal>
121
+
122
+ <ModalForm
123
+ title="新建渠道链接"
124
+ visible={addVisible}
125
+ onVisibleChange={setAddVisible}
126
+ onFinish={handleAdd}
127
+ >
128
+ <ProFormText
129
+ name="nameCn"
130
+ label="渠道中文"
131
+ rules={[{ required: true, message: '请输入渠道中文' }]}
132
+ placeholder="请输入"
133
+ />
134
+ <ProFormText
135
+ name="nameEn"
136
+ label="渠道英文"
137
+ rules={[{ required: true, message: '请输入渠道英文' }]}
138
+ placeholder="请输入"
139
+ />
140
+ </ModalForm>
141
+
142
+ <ModalForm
143
+ title="编辑渠道链接"
144
+ visible={editVisible}
145
+ onVisibleChange={setEditVisible}
146
+ onFinish={handleEdit}
147
+ initialValues={editingItem || {}}
148
+ key={editingItem?.id}
149
+ >
150
+ <ProFormText
151
+ name="nameCn"
152
+ label="渠道中文"
153
+ rules={[{ required: true, message: '请输入渠道中文' }]}
154
+ placeholder="请输入"
155
+ />
156
+ <ProFormText
157
+ name="nameEn"
158
+ label="渠道英文"
159
+ rules={[{ required: true, message: '请输入渠道英文' }]}
160
+ placeholder="请输入"
161
+ />
162
+ </ModalForm>
163
+ </>
164
+ );
165
+ };
166
+
167
+ export default ChannelLinkModal;
@@ -0,0 +1,41 @@
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 CustomLink: React.FC = () => {
7
+ return (
8
+ <div>
9
+ <ProTable
10
+ headerTitle={false}
11
+ toolBarRender={() => [
12
+ <Button key="add" type="primary">新建自定义链接</Button>,
13
+ ]}
14
+ rowKey="id"
15
+ request={async (params) => {
16
+ const { data: result } = await axios.get('/api/activity/customLinkList', { params });
17
+ return { data: result.data.list, total: result.data.total, success: result.success };
18
+ }}
19
+ columns={[
20
+ { title: '跳转类型', dataIndex: 'type' },
21
+ { title: '页面路径', dataIndex: 'path' },
22
+ { title: '最近更新时间', dataIndex: 'updateTime' },
23
+ {
24
+ title: '操作',
25
+ valueType: 'option',
26
+ render: () => (
27
+ <>
28
+ <Button type="link" size="small">编辑</Button>
29
+ <Button type="link" danger size="small">删除</Button>
30
+ </>
31
+ ),
32
+ },
33
+ ]}
34
+ pagination={false}
35
+ options={false}
36
+ />
37
+ </div>
38
+ );
39
+ };
40
+
41
+ export default CustomLink;