suomingxiang 4 месяцев назад
Родитель
Сommit
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,7 +6,7 @@ import { Button, message, Modal, Image } from 'antd';
6 6
 import { ActionType, FooterToolbar, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components';
7 7
 import { PlusOutlined, DeleteOutlined, ExclamationCircleOutlined, RedoOutlined } from '@ant-design/icons';
8 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 10
 import SEOForm from './edit';
11 11
 import moment from 'moment';
12 12
 import { KeepAlive } from 'react-activation';
@@ -19,17 +19,16 @@ const NoticeTableList: React.FC = () => {
19 19
     const formTableRef = useRef<FormInstance>();
20 20
 
21 21
     const [modalVisible, setModalVisible] = useState<boolean>(false);
22
-
23 22
     const actionRef = useRef<ActionType>();
24 23
     const intl = useIntl();
25 24
     const [currentRow, setCurrentRow] = useState<any>();
26
-    const [enumList,setEnumList] = useState()
25
+    const [enumList, setEnumList] = useState()
27 26
 
28 27
     useEffect(() => {
29 28
         getEnum()
30 29
     }, [])
31 30
 
32
-    const getEnum = ()=>{
31
+    const getEnum = () => {
33 32
         getDataEnumList({ enumUuid: '2024810214616101' }).then((res) => {
34 33
             console.log(res.rows)
35 34
 
@@ -40,6 +39,49 @@ const NoticeTableList: React.FC = () => {
40 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 85
     const columns: ProColumns<API.System.Notice>[] = [
44 86
         {
45 87
             title: '序号',
@@ -99,6 +141,15 @@ const NoticeTableList: React.FC = () => {
99 141
                 >
100 142
                     编辑
101 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,7 +167,14 @@ const NoticeTableList: React.FC = () => {
116 167
                             labelWidth: 120,
117 168
                         }}
118 169
                         toolBarRender={() => [
119
-                            
170
+                           
171
+                        <Button
172
+                            type="primary"
173
+                            key="fabu"
174
+                            onClick={() => releaseAll()}
175
+                        >
176
+                            全量发布
177
+                        </Button>
120 178
                         ]}
121 179
                         request={(params) => {
122 180
                             return getSEOList({ ...params } as API.System.NoticeListParams).then((res) => {
@@ -135,6 +193,7 @@ const NoticeTableList: React.FC = () => {
135 193
                         }
136 194
                         }
137 195
                         columns={columns}
196
+                     
138 197
                     />
139 198
                 </div>
140 199
                 <SEOForm
@@ -143,7 +202,7 @@ const NoticeTableList: React.FC = () => {
143 202
                         if (currentRow) {
144 203
                             values.uuid = currentRow.uuid;
145 204
                         }
146
-                        
205
+
147 206
                         success = await saveSEO({ ...values });
148 207
                         if (success) {
149 208
                             setModalVisible(false);

+ 2
- 2
src/pages/User/Login/index.tsx Просмотреть файл

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

+ 29
- 10
src/services/other/seo.ts Просмотреть файл

@@ -1,21 +1,40 @@
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 23
 export async function getSEOList(params: any) {
5
-    return request('/api/system/other/seo/select', {
6
-      method: 'GET',
7
-      headers: {
8
-        'Content-Type': 'application/json;charset=UTF-8',
9
-      },
10
-      params,
11
-    });
12
-  }
24
+  return request('/api/system/other/seo/select', {
25
+    method: 'GET',
26
+    headers: {
27
+      'Content-Type': 'application/json;charset=UTF-8',
28
+    },
29
+    params,
30
+  });
31
+}
13 32
 
14 33
 // 保存
15 34
 export async function saveSEO(data: any) {
16 35
   return request('/api/system/other/seo/save', {
17 36
     method: 'post',
18
-    data: data, 
37
+    data: data,
19 38
   });
20 39
 }
21 40
 

Загрузка…
Отмена
Сохранить