Kaynağa Gözat

修改bug及增加模块

master
suomingxiang 4 ay önce
ebeveyn
işleme
96e5bd44e7

+ 5
- 0
config/routes.ts Dosyayı Görüntüle

@@ -72,6 +72,11 @@ export default [
72 72
         path: '/Home/banner',
73 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 Dosyayı Görüntüle

@@ -3,10 +3,11 @@ import {
3 3
   ProForm,
4 4
   ProFormText,
5 5
   ProFormDigit,
6
-  ProFormRadio
6
+  ProFormRadio,
7
+  ProFormSwitch
7 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 11
 import { useIntl, FormattedMessage } from '@umijs/max';
11 12
 import { DictValueEnumObj } from '@/components/DictTag';
12 13
 import Editor from '@/components/ueditor';
@@ -22,13 +23,6 @@ export type VideoProps = {
22 23
   onSubmit: (values: any) => Promise<void>;
23 24
   open: boolean;
24 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 28
 const VideoForm: React.FC<VideoProps> = (props) => {
@@ -39,17 +33,17 @@ const VideoForm: React.FC<VideoProps> = (props) => {
39 33
   useEffect(() => {
40 34
     console.log(props)
41 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 39
     if (props.currentRow) {
46 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 45
     setpcImg(pcImg)
52
-    
46
+
53 47
     if (pcImgUrl && pcImg) {
54 48
       setFileList([
55 49
         {
@@ -60,7 +54,7 @@ const VideoForm: React.FC<VideoProps> = (props) => {
60 54
     }
61 55
 
62 56
     setmImg(mImg)
63
-    
57
+
64 58
     if (mImgUrl && mImg) {
65 59
       setFileList2([
66 60
         {
@@ -75,14 +69,15 @@ const VideoForm: React.FC<VideoProps> = (props) => {
75 69
 
76 70
   }, [props.open]);
77 71
 
78
-  
72
+
79 73
   const [fileList, setFileList] = useState<any>([]);
80 74
   const [fileList2, setFileList2] = useState<any>([]);
81 75
   const [pcImg, setpcImg] = useState<any>('');
82 76
   const [mImg, setmImg] = useState<any>('');
77
+  const [upMode, setUpMode] = useState<any>('0');
83 78
   const handleOk = async () => {
84 79
     let data = form.getFieldsValue()
85
-    
80
+
86 81
     let val = await form.validateFields()
87 82
     let formData = {
88 83
       ...data,
@@ -137,12 +132,15 @@ const VideoForm: React.FC<VideoProps> = (props) => {
137 132
     return false;
138 133
   };
139 134
 
135
+  const onRadioChange = (e) => {
136
+    setUpMode(e.target.value)
137
+  }
138
+
140 139
 
141 140
   return (
142 141
     <Drawer
143 142
       width={'80%'}
144 143
       title={props.currentRow ? '编辑' : '新建'}
145
-      forceRender
146 144
       open={props.open}
147 145
       destroyOnClose
148 146
       onClose={handleCancel}
@@ -159,11 +157,33 @@ const VideoForm: React.FC<VideoProps> = (props) => {
159 157
         submitter={false}
160 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 184
           extra={'图片尺寸1218*915'}
165 185
           labelCol={{
166
-            style: { width: 95 }
186
+            style: { width: 105 }
167 187
           }}
168 188
           rules={[
169 189
             {
@@ -182,13 +202,19 @@ const VideoForm: React.FC<VideoProps> = (props) => {
182 202
           >
183 203
             {fileList?.length < 1 && '+' + intl.formatMessage({ id: 'public.uploadImg' })}
184 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 215
           extra={'图片尺寸1218*915'}
190 216
           labelCol={{
191
-            style: { width: 95 }
217
+            style: { width: 105 }
192 218
           }}
193 219
           rules={[
194 220
             {
@@ -207,29 +233,35 @@ const VideoForm: React.FC<VideoProps> = (props) => {
207 233
           >
208 234
             {fileList2?.length < 1 && '+' + intl.formatMessage({ id: 'public.uploadImg' })}
209 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 244
         <ProFormText
213 245
           name="title"
214 246
           label='标题'
215 247
           labelCol={{
216
-            style: { width: 95 }
248
+            style: { width: 105 }
217 249
           }}
218 250
         />
219 251
 
220 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 260
         <ProFormDigit
229 261
           name="sort"
230 262
           label="排序"
231 263
           labelCol={{
232
-            style: { width: 95 }
264
+            style: { width: 105 }
233 265
           }}
234 266
           placeholder="请输入排序"
235 267
           rules={[

+ 103
- 0
src/pages/Home/introduction/index.tsx Dosyayı Görüntüle

@@ -0,0 +1,103 @@
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 Dosyayı Görüntüle

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

+ 2
- 2
src/pages/JoinZZ/vacancy/edit.tsx Dosyayı Görüntüle

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

+ 1
- 1
src/pages/News/NewsList/edit.tsx Dosyayı Görüntüle

@@ -161,7 +161,7 @@ const NewsForm: React.FC<NewsProps> = (props) => {
161 161
       },
162 162
       theme: 'snow'
163 163
     });
164
-
164
+    console.log('editor',editor)
165 165
     // 工具栏附件按钮
166 166
     let a = document.querySelectorAll(".ql-wordBox")[0]
167 167
     let b = document.querySelectorAll(".ql-wordBox")[1]

+ 5
- 14
src/pages/PartyWork/partyWork/edit.tsx Dosyayı Görüntüle

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

+ 1
- 1
src/pages/PartyWork/partyWork/index.tsx Dosyayı Görüntüle

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

+ 1
- 1
src/pages/SocialRespon/socialRespon/index.tsx Dosyayı Görüntüle

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

+ 21
- 0
src/services/home/introduction.ts Dosyayı Görüntüle

@@ -0,0 +1,21 @@
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
+

Loading…
İptal
Kaydet