浏览代码

修改bug及增加模块

master
suomingxiang 5 个月前
父节点
当前提交
96e5bd44e7

+ 5
- 0
config/routes.ts 查看文件

72
         path: '/Home/banner',
72
         path: '/Home/banner',
73
         component: './Home/banner',
73
         component: './Home/banner',
74
       },
74
       },
75
+      {
76
+        name: 'introduction',
77
+        path: '/Home/introduction',
78
+        component: './Home/introduction',
79
+      },
75
     ],
80
     ],
76
   },
81
   },
77
   {
82
   {

+ 68
- 36
src/pages/Home/banner/edit.tsx 查看文件

3
   ProForm,
3
   ProForm,
4
   ProFormText,
4
   ProFormText,
5
   ProFormDigit,
5
   ProFormDigit,
6
-  ProFormRadio
6
+  ProFormRadio,
7
+  ProFormSwitch
7
 } from '@ant-design/pro-components';
8
 } from '@ant-design/pro-components';
8
-import { Form, Modal, Drawer, message, Upload, Space, Button, Switch,Input,Tooltip } from 'antd';
9
-import {InfoCircleOutlined} from '@ant-design/icons';
9
+import { Form, Modal, Drawer, message, Upload, Space, Button, Switch, Input, Tooltip } from 'antd';
10
+import { InfoCircleOutlined } from '@ant-design/icons';
10
 import { useIntl, FormattedMessage } from '@umijs/max';
11
 import { useIntl, FormattedMessage } from '@umijs/max';
11
 import { DictValueEnumObj } from '@/components/DictTag';
12
 import { DictValueEnumObj } from '@/components/DictTag';
12
 import Editor from '@/components/ueditor';
13
 import Editor from '@/components/ueditor';
22
   onSubmit: (values: any) => Promise<void>;
23
   onSubmit: (values: any) => Promise<void>;
23
   open: boolean;
24
   open: boolean;
24
   currentRow: any;
25
   currentRow: any;
25
-  sort: number;
26
-  title: string;
27
-  digest: string;
28
-  pcImg: string;
29
-  pcImgUrl: string;
30
-  mImg: string;
31
-  mImgUrl: string;
32
 };
26
 };
33
 
27
 
34
 const VideoForm: React.FC<VideoProps> = (props) => {
28
 const VideoForm: React.FC<VideoProps> = (props) => {
39
   useEffect(() => {
33
   useEffect(() => {
40
     console.log(props)
34
     console.log(props)
41
     form.resetFields();
35
     form.resetFields();
42
-    if(!props.open) return;
43
-    if(!props.currentRow) return;
44
-    const {sort,title,digest,pcImg,pcImgUrl,mImg,mImgUrl} = props.currentRow;
36
+    if (!props.open) return;
37
+    if (!props.currentRow) return;
38
+    const { sort, title, digest, pcImg, pcImgUrl, mImg, mImgUrl, upMode } = props.currentRow;
45
     if (props.currentRow) {
39
     if (props.currentRow) {
46
       form.setFieldsValue({
40
       form.setFieldsValue({
47
-        sort,title,digest,pcImg,pcImgUrl,mImg,mImgUrl
41
+        sort, title, digest, pcImg, pcImgUrl, mImg, mImgUrl, upMode: upMode == '1' ? '1' : '0'
48
       })
42
       })
43
+      setUpMode(upMode == '1' ? '1' : '0')
49
     }
44
     }
50
-
51
     setpcImg(pcImg)
45
     setpcImg(pcImg)
52
-    
46
+
53
     if (pcImgUrl && pcImg) {
47
     if (pcImgUrl && pcImg) {
54
       setFileList([
48
       setFileList([
55
         {
49
         {
60
     }
54
     }
61
 
55
 
62
     setmImg(mImg)
56
     setmImg(mImg)
63
-    
57
+
64
     if (mImgUrl && mImg) {
58
     if (mImgUrl && mImg) {
65
       setFileList2([
59
       setFileList2([
66
         {
60
         {
75
 
69
 
76
   }, [props.open]);
70
   }, [props.open]);
77
 
71
 
78
-  
72
+
79
   const [fileList, setFileList] = useState<any>([]);
73
   const [fileList, setFileList] = useState<any>([]);
80
   const [fileList2, setFileList2] = useState<any>([]);
74
   const [fileList2, setFileList2] = useState<any>([]);
81
   const [pcImg, setpcImg] = useState<any>('');
75
   const [pcImg, setpcImg] = useState<any>('');
82
   const [mImg, setmImg] = useState<any>('');
76
   const [mImg, setmImg] = useState<any>('');
77
+  const [upMode, setUpMode] = useState<any>('0');
83
   const handleOk = async () => {
78
   const handleOk = async () => {
84
     let data = form.getFieldsValue()
79
     let data = form.getFieldsValue()
85
-    
80
+
86
     let val = await form.validateFields()
81
     let val = await form.validateFields()
87
     let formData = {
82
     let formData = {
88
       ...data,
83
       ...data,
137
     return false;
132
     return false;
138
   };
133
   };
139
 
134
 
135
+  const onRadioChange = (e) => {
136
+    setUpMode(e.target.value)
137
+  }
138
+
140
 
139
 
141
   return (
140
   return (
142
     <Drawer
141
     <Drawer
143
       width={'80%'}
142
       width={'80%'}
144
       title={props.currentRow ? '编辑' : '新建'}
143
       title={props.currentRow ? '编辑' : '新建'}
145
-      forceRender
146
       open={props.open}
144
       open={props.open}
147
       destroyOnClose
145
       destroyOnClose
148
       onClose={handleCancel}
146
       onClose={handleCancel}
159
         submitter={false}
157
         submitter={false}
160
         layout="horizontal"
158
         layout="horizontal"
161
       >
159
       >
162
-        <ProForm.Item
163
-          label={'焦点图(PC端'}
160
+
161
+
162
+        <ProFormRadio.Group
163
+          name="upMode"
164
+          label="焦点图类型"
165
+          labelCol={{ style: { width: 105 } }}
166
+
167
+          options={[
168
+            {
169
+              label: '上传文件',
170
+              value: '0',
171
+            },
172
+            {
173
+              label: '链接',
174
+              value: '1',
175
+            },
176
+          ]}
177
+          fieldProps={{
178
+            defaultValue: '0',
179
+            onChange: onRadioChange,
180
+          }}
181
+        />
182
+        {upMode == '0' ? <ProForm.Item
183
+          label={'焦点图(PC端)'}
164
           extra={'图片尺寸1218*915'}
184
           extra={'图片尺寸1218*915'}
165
           labelCol={{
185
           labelCol={{
166
-            style: { width: 95 }
186
+            style: { width: 105 }
167
           }}
187
           }}
168
           rules={[
188
           rules={[
169
             {
189
             {
182
           >
202
           >
183
             {fileList?.length < 1 && '+' + intl.formatMessage({ id: 'public.uploadImg' })}
203
             {fileList?.length < 1 && '+' + intl.formatMessage({ id: 'public.uploadImg' })}
184
           </Upload>
204
           </Upload>
185
-        </ProForm.Item>
205
+        </ProForm.Item> : <ProFormText
206
+          name="pcImgUrl"
207
+          label='焦点图(PC端):'
208
+          labelCol={{
209
+            style: { width: 105 }
210
+          }}
211
+        />}
186
 
212
 
187
-        <ProForm.Item
188
-          label={'焦点图(移动端)'}
213
+        {upMode == '0' ? <ProForm.Item
214
+          label={'焦点图(移动端):'}
189
           extra={'图片尺寸1218*915'}
215
           extra={'图片尺寸1218*915'}
190
           labelCol={{
216
           labelCol={{
191
-            style: { width: 95 }
217
+            style: { width: 105 }
192
           }}
218
           }}
193
           rules={[
219
           rules={[
194
             {
220
             {
207
           >
233
           >
208
             {fileList2?.length < 1 && '+' + intl.formatMessage({ id: 'public.uploadImg' })}
234
             {fileList2?.length < 1 && '+' + intl.formatMessage({ id: 'public.uploadImg' })}
209
           </Upload>
235
           </Upload>
210
-        </ProForm.Item>
236
+        </ProForm.Item> : <ProFormText
237
+          name="mImgUrl"
238
+          label='焦点图(移动端)'
239
+          labelCol={{
240
+            style: { width: 105 }
241
+          }}
242
+        />}
211
 
243
 
212
         <ProFormText
244
         <ProFormText
213
           name="title"
245
           name="title"
214
           label='标题'
246
           label='标题'
215
           labelCol={{
247
           labelCol={{
216
-            style: { width: 95 }
248
+            style: { width: 105 }
217
           }}
249
           }}
218
         />
250
         />
219
 
251
 
220
         <ProFormText
252
         <ProFormText
221
-        name="digest"
222
-        label='简述'
223
-        labelCol={{
224
-          style: { width: 95 }
225
-        }}
226
-      />
253
+          name="digest"
254
+          label='简述'
255
+          labelCol={{
256
+            style: { width: 105 }
257
+          }}
258
+        />
227
 
259
 
228
         <ProFormDigit
260
         <ProFormDigit
229
           name="sort"
261
           name="sort"
230
           label="排序"
262
           label="排序"
231
           labelCol={{
263
           labelCol={{
232
-            style: { width: 95 }
264
+            style: { width: 105 }
233
           }}
265
           }}
234
           placeholder="请输入排序"
266
           placeholder="请输入排序"
235
           rules={[
267
           rules={[

+ 103
- 0
src/pages/Home/introduction/index.tsx 查看文件

1
+import React, { useRef, useEffect } from 'react';
2
+import type { FormInstance } from 'antd';
3
+import { Button, message } from 'antd';
4
+import { PageContainer, ProForm, ProFormTextArea } from '@ant-design/pro-components';
5
+import { saveIntroduce,getIntroduceDetail } from '@/services/home/introduction';
6
+import { push } from '@/services/home/banner';
7
+import { KeepAlive } from 'react-activation';
8
+
9
+
10
+const NoticeTableList: React.FC = () => {
11
+    const form = useRef<FormInstance>(null)
12
+
13
+    useEffect(()=>{
14
+        setTimeout(() => {
15
+            getDetail()
16
+        },100)
17
+    },[form])
18
+    const getDetail = async ()=>{
19
+        try {
20
+            const res = await getIntroduceDetail()
21
+            if(res.code === 200){
22
+                if(res.data){
23
+                    form.current.setFieldsValue(res.data)
24
+                }
25
+            }else{
26
+                message.error(res.msg || '操作失败,请重试')
27
+            }
28
+        } catch (error) {
29
+            
30
+        }
31
+        
32
+    }
33
+    const onFinishForm = async (values)=>{
34
+        try {
35
+            console.log('values',values)
36
+            const res = await saveIntroduce(values)
37
+            if(res.code === 200){
38
+                message.success('保存成功')
39
+            }else{
40
+                message.error(res.msg || '操作失败,请重试')
41
+            }
42
+        } catch (error) {
43
+            
44
+        }
45
+    }
46
+
47
+    /**
48
+     * 一键发布
49
+     */
50
+    const publishing = async () => {
51
+        try {
52
+            const resp = await push();
53
+            if (resp.code === 200) {
54
+                message.success('发布成功');
55
+            } else {
56
+                message.error(resp.msg);
57
+            }
58
+        } catch (error) { }
59
+    }
60
+    return (
61
+        <KeepAlive name='集团介绍' path="/Home/introduction">
62
+            <PageContainer>
63
+                <div style={{ width: '100%', float: 'right' }}>
64
+                    <div style={{ width:'100%',padding:'30px',display:'flex',alignItems:'center',justifyContent:'space-between' }}>
65
+                        <div></div>
66
+                        <div>
67
+                            <Button
68
+                                type="primary"
69
+                                key="fabu"
70
+                                onClick={publishing}
71
+                                style={{ marginRight: 10 }}
72
+                            >
73
+                                一键发布
74
+                            </Button>
75
+                            <Button type='primary' onClick={() => form?.current?.submit()}>保存</Button>
76
+                        </div>
77
+                    </div>
78
+                    <ProForm
79
+                        formRef={form}
80
+                        grid={true}
81
+                        submitter={false}
82
+                        layout="horizontal"
83
+                        onFinish={onFinishForm}
84
+                    >
85
+                        <ProFormTextArea
86
+                            name="introduceMsg"
87
+                            label='集团介绍'
88
+                            labelCol={{
89
+                                style: { width: 95 }
90
+                            }}
91
+                        />
92
+
93
+                    </ProForm>
94
+                    
95
+                </div>
96
+               
97
+            </PageContainer>
98
+        </KeepAlive>
99
+
100
+    );
101
+};
102
+
103
+export default NoticeTableList;

+ 2
- 2
src/pages/JoinZZ/biddingDocument/edit.tsx 查看文件

136
   }, [props.open]);
136
   }, [props.open]);
137
 
137
 
138
   useEffect(() => {
138
   useEffect(() => {
139
+    if (!props.open) return;
139
     var Parchment = Quill.import('parchment');
140
     var Parchment = Quill.import('parchment');
140
 
141
 
141
     let config = {
142
     let config = {
193
 
194
 
194
     // });
195
     // });
195
 
196
 
196
-  }, []);
197
+  }, [props.open]);
197
 
198
 
198
 
199
 
199
   const [fileList, setFileList] = useState<any>([]);
200
   const [fileList, setFileList] = useState<any>([]);
266
     <Drawer
267
     <Drawer
267
       width={'80%'}
268
       width={'80%'}
268
       title={props.currentRow ? '新闻编辑' : '新建新闻'}
269
       title={props.currentRow ? '新闻编辑' : '新建新闻'}
269
-      forceRender
270
       open={props.open}
270
       open={props.open}
271
       destroyOnClose
271
       destroyOnClose
272
       onClose={handleCancel}
272
       onClose={handleCancel}

+ 2
- 2
src/pages/JoinZZ/vacancy/edit.tsx 查看文件

135
   }, [props.open]);
135
   }, [props.open]);
136
 
136
 
137
   useEffect(() => {
137
   useEffect(() => {
138
+    if (!props.open) return;
138
     var Parchment = Quill.import('parchment');
139
     var Parchment = Quill.import('parchment');
139
 
140
 
140
     let config = {
141
     let config = {
192
 
193
 
193
     // });
194
     // });
194
 
195
 
195
-  }, []);
196
+  }, [props.open]);
196
 
197
 
197
 
198
 
198
   const [fileList, setFileList] = useState<any>([]);
199
   const [fileList, setFileList] = useState<any>([]);
265
     <Drawer
266
     <Drawer
266
       width={'80%'}
267
       width={'80%'}
267
       title={props.currentRow ? '新闻编辑' : '新建新闻'}
268
       title={props.currentRow ? '新闻编辑' : '新建新闻'}
268
-      forceRender
269
       open={props.open}
269
       open={props.open}
270
       destroyOnClose
270
       destroyOnClose
271
       onClose={handleCancel}
271
       onClose={handleCancel}

+ 1
- 1
src/pages/News/NewsList/edit.tsx 查看文件

161
       },
161
       },
162
       theme: 'snow'
162
       theme: 'snow'
163
     });
163
     });
164
-
164
+    console.log('editor',editor)
165
     // 工具栏附件按钮
165
     // 工具栏附件按钮
166
     let a = document.querySelectorAll(".ql-wordBox")[0]
166
     let a = document.querySelectorAll(".ql-wordBox")[0]
167
     let b = document.querySelectorAll(".ql-wordBox")[1]
167
     let b = document.querySelectorAll(".ql-wordBox")[1]

+ 5
- 14
src/pages/PartyWork/partyWork/edit.tsx 查看文件

2
 import {
2
 import {
3
   ProForm,
3
   ProForm,
4
   ProFormText,
4
   ProFormText,
5
-  ProFormUploadButton,
6
   ProFormSelect,
5
   ProFormSelect,
7
   ProFormDatePicker,
6
   ProFormDatePicker,
8
-  ProFormRadio
9
 } from '@ant-design/pro-components';
7
 } from '@ant-design/pro-components';
10
-import { Form, Modal, Drawer, message, Upload, Space, Button, Switch,Input,Tooltip } from 'antd';
11
-import {InfoCircleOutlined} from '@ant-design/icons';
8
+import { Form, Drawer, Upload, Space, Button } from 'antd';
12
 
9
 
13
 import { useIntl, FormattedMessage } from '@umijs/max';
10
 import { useIntl, FormattedMessage } from '@umijs/max';
14
-import { DictValueEnumObj } from '@/components/DictTag';
15
 import Editor from '@/components/ueditor';
11
 import Editor from '@/components/ueditor';
16
 import { upload } from '@/services/partyWork/partyWork';
12
 import { upload } from '@/services/partyWork/partyWork';
17
 import { getDataEnumList } from '@/services/system/Enum';
13
 import { getDataEnumList } from '@/services/system/Enum';
18
 import Quill from "quill";
14
 import Quill from "quill";
19
 import "quill/dist/quill.snow.css";
15
 import "quill/dist/quill.snow.css";
20
 import moment from 'moment';
16
 import moment from 'moment';
21
-import { trim } from 'lodash';
22
 let editor: any;
17
 let editor: any;
23
 
18
 
24
 export type PartyWorkProps = {
19
 export type PartyWorkProps = {
26
   onSubmit: (values: any) => Promise<void>;
21
   onSubmit: (values: any) => Promise<void>;
27
   open: boolean;
22
   open: boolean;
28
   currentRow: any;
23
   currentRow: any;
29
-  date: any;
30
-  title: string;
31
-  content: string;
32
-  surface: string;
33
-  surfaceUrl: string;
34
 };
24
 };
35
 
25
 
36
 let toolbarOptions = [
26
 let toolbarOptions = [
137
   }, [props.open]);
127
   }, [props.open]);
138
 
128
 
139
   useEffect(() => {
129
   useEffect(() => {
130
+    if(!props.open) return;
140
     var Parchment = Quill.import('parchment');
131
     var Parchment = Quill.import('parchment');
141
 
132
 
142
     let config = {
133
     let config = {
148
     };
139
     };
149
 
140
 
150
     let wordBox = new Parchment.Attributor.Style('wordBox', 'line-height', config);
141
     let wordBox = new Parchment.Attributor.Style('wordBox', 'line-height', config);
142
+    console.log('wordBox',wordBox)
151
 
143
 
152
     Quill.register(wordBox, true);
144
     Quill.register(wordBox, true);
153
     editor = new Quill('#editor', {
145
     editor = new Quill('#editor', {
159
       },
151
       },
160
       theme: 'snow'
152
       theme: 'snow'
161
     });
153
     });
162
-
154
+    console.log('editor',editor)
163
     // 工具栏附件按钮
155
     // 工具栏附件按钮
164
     let a = document.querySelectorAll(".ql-wordBox")[0]
156
     let a = document.querySelectorAll(".ql-wordBox")[0]
165
     let b = document.querySelectorAll(".ql-wordBox")[1]
157
     let b = document.querySelectorAll(".ql-wordBox")[1]
194
 
186
 
195
     // });
187
     // });
196
 
188
 
197
-  }, []);
189
+  }, [props.open]);
198
 
190
 
199
 
191
 
200
   const [fileList, setFileList] = useState<any>([]);
192
   const [fileList, setFileList] = useState<any>([]);
267
     <Drawer
259
     <Drawer
268
       width={'80%'}
260
       width={'80%'}
269
       title={props.currentRow ? '文章编辑' : '新建文章'}
261
       title={props.currentRow ? '文章编辑' : '新建文章'}
270
-      forceRender
271
       open={props.open}
262
       open={props.open}
272
       destroyOnClose
263
       destroyOnClose
273
       onClose={handleCancel}
264
       onClose={handleCancel}

+ 1
- 1
src/pages/PartyWork/partyWork/index.tsx 查看文件

221
     } catch (error) { }
221
     } catch (error) { }
222
 }
222
 }
223
     return (
223
     return (
224
-        <KeepAlive name={'党建工作'} path="/PartyWork/partyWork">
224
+        <KeepAlive name={'党建工作'} path="/PartyWork/PartyWork">
225
             <PageContainer>
225
             <PageContainer>
226
                 <div style={{ width: '100%', float: 'right' }}>
226
                 <div style={{ width: '100%', float: 'right' }}>
227
                     <ProTable<API.System.Notice>
227
                     <ProTable<API.System.Notice>

+ 1
- 1
src/pages/SocialRespon/socialRespon/index.tsx 查看文件

201
     } catch (error) { }
201
     } catch (error) { }
202
 }
202
 }
203
     return (
203
     return (
204
-        <KeepAlive name={'党建工作'} path="/SocialRespon/partyWork">
204
+        <KeepAlive name={'社会责任'} path="/SocialRespon/socialRespon">
205
             <PageContainer>
205
             <PageContainer>
206
                 <div style={{ width: '100%', float: 'right' }}>
206
                 <div style={{ width: '100%', float: 'right' }}>
207
                     <ProTable<API.System.Notice>
207
                     <ProTable<API.System.Notice>

+ 21
- 0
src/services/home/introduction.ts 查看文件

1
+import { request } from '@umijs/max'; 
2
+
3
+// 查询
4
+export async function getIntroduceDetail(params: any) {
5
+  return request('/api/system/introduce/selectIntroduce', {
6
+    method: 'GET',
7
+    headers: {
8
+      'Content-Type': 'application/json;charset=UTF-8',
9
+    },
10
+    params,
11
+  });
12
+}
13
+
14
+// 保存
15
+export async function saveIntroduce(data: any) {
16
+  return request('/api/system/introduce/saveIntroduce', {
17
+    method: 'post',
18
+    data: data, 
19
+  });
20
+}
21
+

正在加载...
取消
保存