瀏覽代碼

添加发布功能

master
suomingxiang 5 月之前
父節點
當前提交
34a02b90c6
共有 3 個文件被更改,包括 96 次插入18 次删除
  1. 65
    6
      src/pages/Other/seo/index.tsx
  2. 2
    2
      src/pages/User/Login/index.tsx
  3. 29
    10
      src/services/other/seo.ts

+ 65
- 6
src/pages/Other/seo/index.tsx 查看文件

6
 import { ActionType, FooterToolbar, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components';
6
 import { ActionType, FooterToolbar, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components';
7
 import { PlusOutlined, DeleteOutlined, ExclamationCircleOutlined, RedoOutlined } from '@ant-design/icons';
7
 import { PlusOutlined, DeleteOutlined, ExclamationCircleOutlined, RedoOutlined } from '@ant-design/icons';
8
 // import { getNoticeList, removeNotice, addNotice, updateNotice, exportNotice } from '@/services/system/notice';
8
 // import { getNoticeList, removeNotice, addNotice, updateNotice, exportNotice } from '@/services/system/notice';
9
-import { getSEOList, saveSEO} from '@/services/other/seo';
9
+import { getSEOList, saveSEO, setRelease ,setReleaseAll } from '@/services/other/seo';
10
 import SEOForm from './edit';
10
 import SEOForm from './edit';
11
 import moment from 'moment';
11
 import moment from 'moment';
12
 import { KeepAlive } from 'react-activation';
12
 import { KeepAlive } from 'react-activation';
19
     const formTableRef = useRef<FormInstance>();
19
     const formTableRef = useRef<FormInstance>();
20
 
20
 
21
     const [modalVisible, setModalVisible] = useState<boolean>(false);
21
     const [modalVisible, setModalVisible] = useState<boolean>(false);
22
-
23
     const actionRef = useRef<ActionType>();
22
     const actionRef = useRef<ActionType>();
24
     const intl = useIntl();
23
     const intl = useIntl();
25
     const [currentRow, setCurrentRow] = useState<any>();
24
     const [currentRow, setCurrentRow] = useState<any>();
26
-    const [enumList,setEnumList] = useState()
25
+    const [enumList, setEnumList] = useState()
27
 
26
 
28
     useEffect(() => {
27
     useEffect(() => {
29
         getEnum()
28
         getEnum()
30
     }, [])
29
     }, [])
31
 
30
 
32
-    const getEnum = ()=>{
31
+    const getEnum = () => {
33
         getDataEnumList({ enumUuid: '2024810214616101' }).then((res) => {
32
         getDataEnumList({ enumUuid: '2024810214616101' }).then((res) => {
34
             console.log(res.rows)
33
             console.log(res.rows)
35
 
34
 
40
             setEnumList(enumOptions); // 设置 enumList
39
             setEnumList(enumOptions); // 设置 enumList
41
         })
40
         })
42
     }
41
     }
42
+    const releaseAll = async () => {
43
+        try {
44
+            Modal.confirm({
45
+                title: '提示',
46
+                content: '确定发布吗?',
47
+                okText: '确认',
48
+                cancelText: '取消',
49
+                onOk: async () => {
50
+                    const res = await setReleaseAll();
51
+                    if (res.code == 200) {
52
+                        message.success('发布成功')
53
+                    } else {
54
+                        message.error(res.msg || '发布失败')
55
+                    }
56
+                },
57
+            });
58
+
59
+        } catch (error) {
60
+
61
+        }
62
+    }
63
+
64
+    const release = async (id) => {
65
+        try {
66
+            Modal.confirm({
67
+                title: '提示',
68
+                content: '确定发布吗?',
69
+                okText: '确认',
70
+                cancelText: '取消',
71
+                onOk: async () => {
72
+                    const res = await setRelease(id);
73
+                    if (res.code == 200) {
74
+                        message.success('发布成功')
75
+                    } else {
76
+                        message.error(res.msg || '发布失败')
77
+                    }
78
+                },
79
+            });
80
+
81
+        } catch (error) {
82
+
83
+        }
84
+    }
43
     const columns: ProColumns<API.System.Notice>[] = [
85
     const columns: ProColumns<API.System.Notice>[] = [
44
         {
86
         {
45
             title: '序号',
87
             title: '序号',
99
                 >
141
                 >
100
                     编辑
142
                     编辑
101
                 </Button>,
143
                 </Button>,
144
+                <Button
145
+                    type="link"
146
+                    size="small"
147
+                    key="edit"
148
+
149
+                    onClick={() => release(record.html)}
150
+                >
151
+                    发布
152
+                </Button>,
102
             ],
153
             ],
103
         },
154
         },
104
     ];
155
     ];
116
                             labelWidth: 120,
167
                             labelWidth: 120,
117
                         }}
168
                         }}
118
                         toolBarRender={() => [
169
                         toolBarRender={() => [
119
-                            
170
+                           
171
+                        <Button
172
+                            type="primary"
173
+                            key="fabu"
174
+                            onClick={() => releaseAll()}
175
+                        >
176
+                            全量发布
177
+                        </Button>
120
                         ]}
178
                         ]}
121
                         request={(params) => {
179
                         request={(params) => {
122
                             return getSEOList({ ...params } as API.System.NoticeListParams).then((res) => {
180
                             return getSEOList({ ...params } as API.System.NoticeListParams).then((res) => {
135
                         }
193
                         }
136
                         }
194
                         }
137
                         columns={columns}
195
                         columns={columns}
196
+                     
138
                     />
197
                     />
139
                 </div>
198
                 </div>
140
                 <SEOForm
199
                 <SEOForm
143
                         if (currentRow) {
202
                         if (currentRow) {
144
                             values.uuid = currentRow.uuid;
203
                             values.uuid = currentRow.uuid;
145
                         }
204
                         }
146
-                        
205
+
147
                         success = await saveSEO({ ...values });
206
                         success = await saveSEO({ ...values });
148
                         if (success) {
207
                         if (success) {
149
                             setModalVisible(false);
208
                             setModalVisible(false);

+ 2
- 2
src/pages/User/Login/index.tsx 查看文件

178
           if (res.data.some((item: any) => item.meta.title === '项目信息管理')) {
178
           if (res.data.some((item: any) => item.meta.title === '项目信息管理')) {
179
             localStorage.setItem('systemMenu', '项目信息管理');
179
             localStorage.setItem('systemMenu', '项目信息管理');
180
             localStorage.setItem('system', '首页');
180
             localStorage.setItem('system', '首页');
181
-            resolve('/System/Enum');
181
+            resolve('/Home/banner');
182
             return;
182
             return;
183
           }
183
           }
184
         })
184
         })
214
       // }
214
       // }
215
       
215
       
216
       
216
       
217
-      history.push('/System/Enum');
217
+      history.push('/Home/banner');
218
     } catch (error: any) {
218
     } catch (error: any) {
219
       if (typeof error === `string`) {
219
       if (typeof error === `string`) {
220
         message.error(error);
220
         message.error(error);

+ 29
- 10
src/services/other/seo.ts 查看文件

1
-import { request } from '@umijs/max'; 
1
+import { request } from '@umijs/max';
2
+
3
+
4
+export async function setReleaseAll() {
5
+  return request('/api/staticize/static/all', {
6
+    method: 'GET',
7
+    headers: {
8
+      'Content-Type': 'application/json;charset=UTF-8',
9
+    },
10
+  });
11
+}
12
+// 查询
13
+export async function setRelease(id: any) {
14
+  return request('/api/staticize/static/'+id, {
15
+    method: 'GET',
16
+    headers: {
17
+      'Content-Type': 'application/json;charset=UTF-8',
18
+    },
19
+  });
20
+}
2
 
21
 
3
 // 查询
22
 // 查询
4
 export async function getSEOList(params: any) {
23
 export async function getSEOList(params: any) {
5
-    return request('/api/system/other/seo/select', {
24
+  return request('/api/system/other/seo/select', {
6
-      method: 'GET',
25
+    method: 'GET',
7
-      headers: {
26
+    headers: {
8
-        'Content-Type': 'application/json;charset=UTF-8',
27
+      'Content-Type': 'application/json;charset=UTF-8',
9
-      },
28
+    },
10
-      params,
29
+    params,
11
-    });
30
+  });
12
-  }
31
+}
13
 
32
 
14
 // 保存
33
 // 保存
15
 export async function saveSEO(data: any) {
34
 export async function saveSEO(data: any) {
16
   return request('/api/system/other/seo/save', {
35
   return request('/api/system/other/seo/save', {
17
     method: 'post',
36
     method: 'post',
18
-    data: data, 
37
+    data: data,
19
   });
38
   });
20
 }
39
 }
21
 
40
 

Loading…
取消
儲存